@mindconnect/mindconnect-nodejs
Version:
NodeJS Library for MindSphere Connectivity - TypeScript SDK for MindSphere - MindSphere Command Line Interface - MindSphere Development Proxy
1 lines • 688 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("process"),require("stream"),require("http"),require("url"),require("https"),require("zlib"),require("tty"),require("util"),require("os"),require("buffer"),require("crypto"),require("fs"),require("net"),require("tls"),require("assert"),require("events"),require("path")):"function"==typeof define&&define.amd?define(["process","stream","http","url","https","zlib","tty","util","os","buffer","crypto","fs","net","tls","assert","events","path"],t):(e="undefined"!=typeof globalThis?globalThis:e||self)["@mindconnect/mindconnect-nodejs"]=t(e.process$1,e.Stream$3,e.http$1,e.Url,e.https,e.zlib,e.require$$0$3,e.require$$5,e.require$$0$2,e.require$$0$4,e.require$$0$5,e.require$$1,e.require$$0$7,e.require$$1$1,e.require$$3$1,e.require$$0$6,e.require$$4)}(this,(function(e,t,n,i,a,r,o,s,c,l,u,p,d,f,h,m,v){"use strict";function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=y(e),b=y(t),w=y(n),x=y(i),_=y(a),E=y(r),T=y(o),S=y(s),A=y(c),G=y(l),$=y(u),k=y(p),C=y(d),I=y(f),P=y(h),R=y(m),D=y(v),O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function U(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function N(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})})),t}var M={},j={},L=function(e){if(e=e||{},this.Promise=e.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=e.domainReentrant||!1,this.domainReentrant){if(void 0===g.default||void 0===g.default.domain)throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=e.timeout||L.DEFAULT_TIMEOUT,this.maxOccupationTime=e.maxOccupationTime||L.DEFAULT_MAX_OCCUPATION_TIME,e.maxPending===1/0||Number.isInteger(e.maxPending)&&e.maxPending>=0?this.maxPending=e.maxPending:this.maxPending=L.DEFAULT_MAX_PENDING};L.DEFAULT_TIMEOUT=0,L.DEFAULT_MAX_OCCUPATION_TIME=0,L.DEFAULT_MAX_PENDING=1e3,L.prototype.acquire=function(e,t,n,i){if(Array.isArray(e))return this._acquireBatch(e,t,n,i);if("function"!=typeof t)throw new Error("You must pass a function to execute");var a=null,r=null,o=null;"function"!=typeof n&&(i=n,n=null,o=new this.Promise((function(e,t){a=e,r=t}))),i=i||{};var s=!1,c=null,l=null,u=this,p=function(t,i,c){l&&(clearTimeout(l),l=null),t&&(u.queues[e]&&0===u.queues[e].length&&delete u.queues[e],u.domainReentrant&&delete u.domains[e]),s||(o?i?r(i):a(c):"function"==typeof n&&n(i,c),s=!0),t&&u.queues[e]&&u.queues[e].length>0&&u.queues[e].shift()()},d=function(n){if(s)return p(n);if(c&&(clearTimeout(c),c=null),u.domainReentrant&&n&&(u.domains[e]=g.default.domain),1===t.length){var i=!1;t((function(e,t){i||(i=!0,p(n,e,t))}))}else u._promiseTry((function(){return t()})).then((function(e){p(n,void 0,e)}),(function(e){p(n,e)}))};if(u.domainReentrant&&g.default.domain&&(d=g.default.domain.bind(d)),u.queues[e])if(u.domainReentrant&&g.default.domain&&g.default.domain===u.domains[e])d(!1);else if(u.queues[e].length>=u.maxPending)p(!1,new Error("Too much pending tasks"));else{var f=function(){d(!0)};i.skipQueue?u.queues[e].unshift(f):u.queues[e].push(f);var h=i.timeout||u.timeout;h&&(c=setTimeout((function(){c=null,p(!1,new Error("async-lock timed out"))}),h))}else u.queues[e]=[],d(!0);var m=i.maxOccupationTime||u.maxOccupationTime;return m&&(l=setTimeout((function(){u.queues[e]&&p(!1,new Error("Maximum occupation time is exceeded"))}),m)),o||void 0},L.prototype._acquireBatch=function(e,t,n,i){"function"!=typeof n&&(i=n,n=null);var a=this,r=t;if(e.reverse().forEach((function(e){r=function(e,t){return function(n){a.acquire(e,t,n,i)}}(e,r)})),"function"!=typeof n)return new this.Promise((function(e,t){1===r.length?r((function(n,i){n?t(n):e(i)})):e(r())}));r(n)},L.prototype.isBusy=function(e){return e?!!this.queues[e]:Object.keys(this.queues).length>0},L.prototype._promiseTry=function(e){try{return this.Promise.resolve(e())}catch(e){return this.Promise.reject(e)}};var z=L,H={exports:{}};const q=b.default.Readable,F=Symbol("buffer"),V=Symbol("type");class B{constructor(){this[V]="";const e=arguments[0],t=arguments[1],n=[];let i=0;if(e){const t=e,a=Number(t.length);for(let e=0;e<a;e++){const a=t[e];let r;r=a instanceof Buffer?a:ArrayBuffer.isView(a)?Buffer.from(a.buffer,a.byteOffset,a.byteLength):a instanceof ArrayBuffer?Buffer.from(a):a instanceof B?a[F]:Buffer.from("string"==typeof a?a:String(a)),i+=r.length,n.push(r)}}this[F]=Buffer.concat(n);let a=t&&void 0!==t.type&&String(t.type).toLowerCase();a&&!/[^\u0020-\u007E]/.test(a)&&(this[V]=a)}get size(){return this[F].length}get type(){return this[V]}text(){return Promise.resolve(this[F].toString())}arrayBuffer(){const e=this[F],t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return Promise.resolve(t)}stream(){const e=new q;return e._read=function(){},e.push(this[F]),e.push(null),e}toString(){return"[object Blob]"}slice(){const e=this.size,t=arguments[0],n=arguments[1];let i,a;i=void 0===t?0:t<0?Math.max(e+t,0):Math.min(t,e),a=void 0===n?e:n<0?Math.max(e+n,0):Math.min(n,e);const r=Math.max(a-i,0),o=this[F].slice(i,i+r),s=new B([],{type:arguments[2]});return s[F]=o,s}}function J(e,t,n){Error.call(this,e),this.message=e,this.type=t,n&&(this.code=this.errno=n.code),Error.captureStackTrace(this,this.constructor)}let W;Object.defineProperties(B.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Object.defineProperty(B.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0}),J.prototype=Object.create(Error.prototype),J.prototype.constructor=J,J.prototype.name="FetchError";try{W=require("encoding").convert}catch(e){}const K=Symbol("Body internals"),Q=b.default.PassThrough;function Y(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.size;let a=void 0===i?0:i;var r=n.timeout;let o=void 0===r?0:r;null==e?e=null:X(e)?e=Buffer.from(e.toString()):ee(e)||Buffer.isBuffer(e)||("[object ArrayBuffer]"===Object.prototype.toString.call(e)?e=Buffer.from(e):ArrayBuffer.isView(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof b.default||(e=Buffer.from(String(e)))),this[K]={body:e,disturbed:!1,error:null},this.size=a,this.timeout=o,e instanceof b.default&&e.on("error",(function(e){const n="AbortError"===e.name?e:new J(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e);t[K].error=n}))}function Z(){var e=this;if(this[K].disturbed)return Y.Promise.reject(new TypeError("body used already for: "+this.url));if(this[K].disturbed=!0,this[K].error)return Y.Promise.reject(this[K].error);let t=this.body;if(null===t)return Y.Promise.resolve(Buffer.alloc(0));if(ee(t)&&(t=t.stream()),Buffer.isBuffer(t))return Y.Promise.resolve(t);if(!(t instanceof b.default))return Y.Promise.resolve(Buffer.alloc(0));let n=[],i=0,a=!1;return new Y.Promise((function(r,o){let s;e.timeout&&(s=setTimeout((function(){a=!0,o(new J(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))}),e.timeout)),t.on("error",(function(t){"AbortError"===t.name?(a=!0,o(t)):o(new J(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t))})),t.on("data",(function(t){if(!a&&null!==t){if(e.size&&i+t.length>e.size)return a=!0,void o(new J(`content size at ${e.url} over limit: ${e.size}`,"max-size"));i+=t.length,n.push(t)}})),t.on("end",(function(){if(!a){clearTimeout(s);try{r(Buffer.concat(n,i))}catch(t){o(new J(`Could not create Buffer from response body for ${e.url}: ${t.message}`,"system",t))}}}))}))}function X(e){return"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&("URLSearchParams"===e.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(e)||"function"==typeof e.sort)}function ee(e){return"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.constructor&&"string"==typeof e.constructor.name&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}function te(e){let t,n,i=e.body;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return i instanceof b.default&&"function"!=typeof i.getBoundary&&(t=new Q,n=new Q,i.pipe(t),i.pipe(n),e[K].body=t,i=n),i}function ne(e){return null===e?null:"string"==typeof e?"text/plain;charset=UTF-8":X(e)?"application/x-www-form-urlencoded;charset=UTF-8":ee(e)?e.type||null:Buffer.isBuffer(e)||"[object ArrayBuffer]"===Object.prototype.toString.call(e)||ArrayBuffer.isView(e)?null:"function"==typeof e.getBoundary?"multipart/form-data;boundary="+e.getBoundary():e instanceof b.default?null:"text/plain;charset=UTF-8"}function ie(e){const t=e.body;return null===t?0:ee(t)?t.size:Buffer.isBuffer(t)?t.length:t&&"function"==typeof t.getLengthSync&&(t._lengthRetrievers&&0==t._lengthRetrievers.length||t.hasKnownLength&&t.hasKnownLength())?t.getLengthSync():null}Y.prototype={get body(){return this[K].body},get bodyUsed(){return this[K].disturbed},arrayBuffer(){return Z.call(this).then((function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}))},blob(){let e=this.headers&&this.headers.get("content-type")||"";return Z.call(this).then((function(t){return Object.assign(new B([],{type:e.toLowerCase()}),{[F]:t})}))},json(){var e=this;return Z.call(this).then((function(t){try{return JSON.parse(t.toString())}catch(t){return Y.Promise.reject(new J(`invalid json response body at ${e.url} reason: ${t.message}`,"invalid-json"))}}))},text(){return Z.call(this).then((function(e){return e.toString()}))},buffer(){return Z.call(this)},textConverted(){var e=this;return Z.call(this).then((function(t){return function(e,t){if("function"!=typeof W)throw new Error("The package `encoding` must be installed to use the textConverted() function");const n=t.get("content-type");let i,a,r="utf-8";n&&(i=/charset=([^;]*)/i.exec(n));a=e.slice(0,1024).toString(),!i&&a&&(i=/<meta.+?charset=(['"])(.+?)\1/i.exec(a));!i&&a&&(i=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(a),i||(i=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(a),i&&i.pop()),i&&(i=/charset=(.*)/i.exec(i.pop())));!i&&a&&(i=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(a));i&&(r=i.pop(),"gb2312"!==r&&"gbk"!==r||(r="gb18030"));return W(e,"UTF-8",r).toString()}(t,e.headers)}))}},Object.defineProperties(Y.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}}),Y.mixIn=function(e){for(const t of Object.getOwnPropertyNames(Y.prototype))if(!(t in e)){const n=Object.getOwnPropertyDescriptor(Y.prototype,t);Object.defineProperty(e,t,n)}},Y.Promise=global.Promise;const ae=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,re=/[^\t\x20-\x7e\x80-\xff]/;function oe(e){if(e=""+e,ae.test(e)||""===e)throw new TypeError(e+" is not a legal HTTP header name")}function se(e){if(e=""+e,re.test(e))throw new TypeError(e+" is not a legal HTTP header value")}function ce(e,t){t=t.toLowerCase();for(const n in e)if(n.toLowerCase()===t)return n}const le=Symbol("map");class ue{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[le]=Object.create(null),e instanceof ue){const t=e.raw(),n=Object.keys(t);for(const e of n)for(const n of t[e])this.append(e,n)}else if(null==e);else{if("object"!=typeof e)throw new TypeError("Provided initializer must be an object");{const t=e[Symbol.iterator];if(null!=t){if("function"!=typeof t)throw new TypeError("Header pairs must be iterable");const n=[];for(const t of e){if("object"!=typeof t||"function"!=typeof t[Symbol.iterator])throw new TypeError("Each header pair must be iterable");n.push(Array.from(t))}for(const e of n){if(2!==e.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(e[0],e[1])}}else for(const t of Object.keys(e)){const n=e[t];this.append(t,n)}}}}get(e){oe(e=""+e);const t=ce(this[le],e);return void 0===t?null:this[le][t].join(", ")}forEach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=pe(this),i=0;for(;i<n.length;){var a=n[i];const r=a[0],o=a[1];e.call(t,o,r,this),n=pe(this),i++}}set(e,t){t=""+t,oe(e=""+e),se(t);const n=ce(this[le],e);this[le][void 0!==n?n:e]=[t]}append(e,t){t=""+t,oe(e=""+e),se(t);const n=ce(this[le],e);void 0!==n?this[le][n].push(t):this[le][e]=[t]}has(e){return oe(e=""+e),void 0!==ce(this[le],e)}delete(e){oe(e=""+e);const t=ce(this[le],e);void 0!==t&&delete this[le][t]}raw(){return this[le]}keys(){return fe(this,"key")}values(){return fe(this,"value")}[Symbol.iterator](){return fe(this,"key+value")}}function pe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key+value";const n=Object.keys(e[le]).sort();return n.map("key"===t?function(e){return e.toLowerCase()}:"value"===t?function(t){return e[le][t].join(", ")}:function(t){return[t.toLowerCase(),e[le][t].join(", ")]})}ue.prototype.entries=ue.prototype[Symbol.iterator],Object.defineProperty(ue.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(ue.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const de=Symbol("internal");function fe(e,t){const n=Object.create(he);return n[de]={target:e,kind:t,index:0},n}const he=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==he)throw new TypeError("Value of `this` is not a HeadersIterator");var e=this[de];const t=e.target,n=e.kind,i=e.index,a=pe(t,n);return i>=a.length?{value:void 0,done:!0}:(this[de].index=i+1,{value:a[i],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function me(e){const t=Object.assign({__proto__:null},e[le]),n=ce(e[le],"Host");return void 0!==n&&(t[n]=t[n][0]),t}Object.defineProperty(he,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const ve=Symbol("Response internals"),ye=w.default.STATUS_CODES;class ge{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Y.call(this,e,t);const n=t.status||200,i=new ue(t.headers);if(null!=e&&!i.has("Content-Type")){const t=ne(e);t&&i.append("Content-Type",t)}this[ve]={url:t.url,status:n,statusText:t.statusText||ye[n],headers:i,counter:t.counter}}get url(){return this[ve].url||""}get status(){return this[ve].status}get ok(){return this[ve].status>=200&&this[ve].status<300}get redirected(){return this[ve].counter>0}get statusText(){return this[ve].statusText}get headers(){return this[ve].headers}clone(){return new ge(te(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}Y.mixIn(ge.prototype),Object.defineProperties(ge.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(ge.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const be=Symbol("Request internals"),we=x.default.parse,xe=x.default.format,_e="destroy"in b.default.Readable.prototype;function Ee(e){return"object"==typeof e&&"object"==typeof e[be]}class Te{constructor(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ee(e)?t=we(e.url):(t=e&&e.href?we(e.href):we(""+e),e={});let i=n.method||e.method||"GET";if(i=i.toUpperCase(),(null!=n.body||Ee(e)&&null!==e.body)&&("GET"===i||"HEAD"===i))throw new TypeError("Request with GET/HEAD method cannot have body");let a=null!=n.body?n.body:Ee(e)&&null!==e.body?te(e):null;Y.call(this,a,{timeout:n.timeout||e.timeout||0,size:n.size||e.size||0});const r=new ue(n.headers||e.headers||{});if(null!=a&&!r.has("Content-Type")){const e=ne(a);e&&r.append("Content-Type",e)}let o=Ee(e)?e.signal:null;if("signal"in n&&(o=n.signal),null!=o&&!function(e){const t=e&&"object"==typeof e&&Object.getPrototypeOf(e);return!(!t||"AbortSignal"!==t.constructor.name)}(o))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[be]={method:i,redirect:n.redirect||e.redirect||"follow",headers:r,parsedURL:t,signal:o},this.follow=void 0!==n.follow?n.follow:void 0!==e.follow?e.follow:20,this.compress=void 0!==n.compress?n.compress:void 0===e.compress||e.compress,this.counter=n.counter||e.counter||0,this.agent=n.agent||e.agent}get method(){return this[be].method}get url(){return xe(this[be].parsedURL)}get headers(){return this[be].headers}get redirect(){return this[be].redirect}get signal(){return this[be].signal}clone(){return new Te(this)}}function Se(e){Error.call(this,e),this.type="aborted",this.message=e,Error.captureStackTrace(this,this.constructor)}Y.mixIn(Te.prototype),Object.defineProperty(Te.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(Te.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),Se.prototype=Object.create(Error.prototype),Se.prototype.constructor=Se,Se.prototype.name="AbortError";const Ae=b.default.PassThrough,Ge=x.default.resolve;function $e(e,t){if(!$e.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return Y.Promise=$e.Promise,new $e.Promise((function(n,i){const a=new Te(e,t),r=function(e){const t=e[be].parsedURL,n=new ue(e[be].headers);if(n.has("Accept")||n.set("Accept","*/*"),!t.protocol||!t.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(t.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(e.signal&&e.body instanceof b.default.Readable&&!_e)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let i=null;if(null==e.body&&/^(POST|PUT)$/i.test(e.method)&&(i="0"),null!=e.body){const t=ie(e);"number"==typeof t&&(i=String(t))}i&&n.set("Content-Length",i),n.has("User-Agent")||n.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),e.compress&&!n.has("Accept-Encoding")&&n.set("Accept-Encoding","gzip,deflate");let a=e.agent;return"function"==typeof a&&(a=a(t)),n.has("Connection")||a||n.set("Connection","close"),Object.assign({},t,{method:e.method,headers:me(n),agent:a})}(a),o=("https:"===r.protocol?_.default:w.default).request,s=a.signal;let c=null;const l=function(){let e=new Se("The user aborted a request.");i(e),a.body&&a.body instanceof b.default.Readable&&a.body.destroy(e),c&&c.body&&c.body.emit("error",e)};if(s&&s.aborted)return void l();const u=function(){l(),f()},p=o(r);let d;function f(){p.abort(),s&&s.removeEventListener("abort",u),clearTimeout(d)}s&&s.addEventListener("abort",u),a.timeout&&p.once("socket",(function(e){d=setTimeout((function(){i(new J("network timeout at: "+a.url,"request-timeout")),f()}),a.timeout)})),p.on("error",(function(e){i(new J(`request to ${a.url} failed, reason: ${e.message}`,"system",e)),f()})),p.on("response",(function(e){clearTimeout(d);const t=function(e){const t=new ue;for(const n of Object.keys(e))if(!ae.test(n))if(Array.isArray(e[n]))for(const i of e[n])re.test(i)||(void 0===t[le][n]?t[le][n]=[i]:t[le][n].push(i));else re.test(e[n])||(t[le][n]=[e[n]]);return t}(e.headers);if($e.isRedirect(e.statusCode)){const r=t.get("Location"),o=null===r?null:Ge(a.url,r);switch(a.redirect){case"error":return i(new J("uri requested responds with a redirect, redirect mode is set to error: "+a.url,"no-redirect")),void f();case"manual":if(null!==o)try{t.set("Location",o)}catch(e){i(e)}break;case"follow":if(null===o)break;if(a.counter>=a.follow)return i(new J("maximum redirect reached at: "+a.url,"max-redirect")),void f();const r={headers:new ue(a.headers),follow:a.follow,counter:a.counter+1,agent:a.agent,compress:a.compress,method:a.method,body:a.body,signal:a.signal,timeout:a.timeout,size:a.size};return 303!==e.statusCode&&a.body&&null===ie(a)?(i(new J("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void f()):(303!==e.statusCode&&(301!==e.statusCode&&302!==e.statusCode||"POST"!==a.method)||(r.method="GET",r.body=void 0,r.headers.delete("content-length")),n($e(new Te(o,r))),void f())}}e.once("end",(function(){s&&s.removeEventListener("abort",u)}));let r=e.pipe(new Ae);const o={url:a.url,status:e.statusCode,statusText:e.statusMessage,headers:t,size:a.size,timeout:a.timeout,counter:a.counter},l=t.get("Content-Encoding");if(!a.compress||"HEAD"===a.method||null===l||204===e.statusCode||304===e.statusCode)return c=new ge(r,o),void n(c);const p={flush:E.default.Z_SYNC_FLUSH,finishFlush:E.default.Z_SYNC_FLUSH};if("gzip"==l||"x-gzip"==l)return r=r.pipe(E.default.createGunzip(p)),c=new ge(r,o),void n(c);if("deflate"!=l&&"x-deflate"!=l){if("br"==l&&"function"==typeof E.default.createBrotliDecompress)return r=r.pipe(E.default.createBrotliDecompress()),c=new ge(r,o),void n(c);c=new ge(r,o),n(c)}else{e.pipe(new Ae).once("data",(function(e){r=8==(15&e[0])?r.pipe(E.default.createInflate()):r.pipe(E.default.createInflateRaw()),c=new ge(r,o),n(c)}))}})),function(e,t){const n=t.body;null===n?e.end():ee(n)?n.stream().pipe(e):Buffer.isBuffer(n)?(e.write(n),e.end()):n.pipe(e)}(p,a)}))}$e.isRedirect=function(e){return 301===e||302===e||303===e||307===e||308===e},$e.Promise=global.Promise;var ke=N(Object.freeze({__proto__:null,default:$e,Headers:ue,Request:Te,Response:ge,FetchError:J}));!function(e,t){const n=ke,i=n.default||n,a=function(e,t){return/^\/\//.test(e)&&(e="https:"+e),i.call(this,e,t)};a.ponyfill=!0,e.exports=t=a,t.fetch=a,t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response,t.default=a}(H,H.exports);var Ce={exports:{}},Ie={exports:{}},Pe=1e3,Re=6e4,De=60*Re,Oe=24*De,Ue=7*Oe,Ne=365.25*Oe,Me=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*Ne;case"weeks":case"week":case"w":return n*Ue;case"days":case"day":case"d":return n*Oe;case"hours":case"hour":case"hrs":case"hr":case"h":return n*De;case"minutes":case"minute":case"mins":case"min":case"m":return n*Re;case"seconds":case"second":case"secs":case"sec":case"s":return n*Pe;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=Oe)return je(e,t,Oe,"day");if(t>=De)return je(e,t,De,"hour");if(t>=Re)return je(e,t,Re,"minute");if(t>=Pe)return je(e,t,Pe,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=Oe)return Math.round(e/Oe)+"d";if(t>=De)return Math.round(e/De)+"h";if(t>=Re)return Math.round(e/Re)+"m";if(t>=Pe)return Math.round(e/Pe)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function je(e,t,n,i){var a=t>=1.5*n;return Math.round(e/n)+" "+i+(a?"s":"")}var Le=function(e){function t(e){let i,a,r,o=null;function s(...e){if(!s.enabled)return;const n=s,a=Number(new Date),r=a-(i||a);n.diff=r,n.prev=i,n.curr=a,i=a,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((i,a)=>{if("%%"===i)return"%";o++;const r=t.formatters[a];if("function"==typeof r){const t=e[o];i=r.call(n,t),e.splice(o,1),o--}return i})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(a!==t.namespaces&&(a=t.namespaces,r=t.enabled(e)),r),set:e=>{o=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const i=t(this.namespace+(void 0===n?":":n)+e);return i.log=this.log,i}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const i=("string"==typeof e?e:"").split(/[\s,]+/),a=i.length;for(n=0;n<a;n++)i[n]&&("-"===(e=i[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,i;for(n=0,i=t.skips.length;n<i;n++)if(t.skips[n].test(e))return!1;for(n=0,i=t.names.length;n<i;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=Me,t.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((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t};!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let i=0,a=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(i++,"%c"===e&&(a=i))})),t.splice(a,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==g.default&&"env"in g.default&&(e=g.default.env.DEBUG);return e},t.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;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&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.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`."))}})(),t.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"],t.log=console.debug||console.log||(()=>{}),e.exports=Le(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Ie,Ie.exports);var ze={exports:{}};const He=A.default,qe=(e,t)=>{t=t||g.default.argv;const n=e.startsWith("-")?"":1===e.length?"-":"--",i=t.indexOf(n+e),a=t.indexOf("--");return-1!==i&&(-1===a||i<a)},Fe=g.default.env;let Ve;function Be(e){return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(function(e){if(!1===Ve)return 0;if(qe("color=16m")||qe("color=full")||qe("color=truecolor"))return 3;if(qe("color=256"))return 2;if(e&&!e.isTTY&&!0!==Ve)return 0;const t=Ve?1:0;if("win32"===g.default.platform){const e=He.release().split(".");return Number(g.default.versions.node.split(".")[0])>=8&&Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in Fe)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in Fe))||"codeship"===Fe.CI_NAME?1:t;if("TEAMCITY_VERSION"in Fe)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Fe.TEAMCITY_VERSION)?1:0;if("truecolor"===Fe.COLORTERM)return 3;if("TERM_PROGRAM"in Fe){const e=parseInt((Fe.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Fe.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Fe.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Fe.TERM)||"COLORTERM"in Fe?1:(Fe.TERM,t)}(e))}qe("no-color")||qe("no-colors")||qe("color=false")?Ve=!1:(qe("color")||qe("colors")||qe("color=true")||qe("color=always"))&&(Ve=!0),"FORCE_COLOR"in Fe&&(Ve=0===Fe.FORCE_COLOR.length||0!==parseInt(Fe.FORCE_COLOR,10));var Je={supportsColor:Be,stdout:Be(g.default.stdout),stderr:Be(g.default.stderr)};!function(e,t){const n=T.default,i=S.default;t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let i=0;i<n.length;i++)e.inspectOpts[n[i]]=t.inspectOpts[n[i]]},t.log=function(...e){return g.default.stderr.write(i.format(...e)+"\n")},t.formatArgs=function(n){const{namespace:i,useColors:a}=this;if(a){const t=this.color,a="[3"+(t<8?t:"8;5;"+t),r=` ${a};1m${i} [0m`;n[0]=r+n[0].split("\n").join("\n"+r),n.push(a+"m+"+e.exports.humanize(this.diff)+"[0m")}else n[0]=function(){if(t.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+i+" "+n[0]},t.save=function(e){e?g.default.env.DEBUG=e:delete g.default.env.DEBUG},t.load=function(){return g.default.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):n.isatty(g.default.stderr.fd)},t.destroy=i.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=Je;e&&(e.stderr||e).level>=2&&(t.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){}t.inspectOpts=Object.keys(g.default.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let i=g.default.env[t];return i=!!/^(yes|on|true|enabled)$/i.test(i)||!/^(no|off|false|disabled)$/i.test(i)&&("null"===i?null:Number(i)),e[n]=i,e}),{}),e.exports=Le(t);const{formatters:a}=e.exports;a.o=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},a.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)}}(ze,ze.exports),void 0===g.default||"renderer"===g.default.type||!0===g.default.browser||g.default.__nwjs?Ce.exports=Ie.exports:Ce.exports=ze.exports;var We={},Ke={exports:{}};!function(e,t){var n=G.default,i=n.Buffer;function a(e,t){for(var n in e)t[n]=e[n]}function r(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(a(n,t),t.Buffer=r),a(i,r),r.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},r.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var a=i(e);return void 0!==t?"string"==typeof n?a.fill(t,n):a.fill(t):a.fill(0),a},r.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},r.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(Ke,Ke.exports);var Qe=Ke.exports.Buffer,Ye=b.default;function Ze(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=Qe.alloc(0),this;if("function"==typeof e.pipe)return this.buffer=Qe.alloc(0),e.pipe(this),this;if(e.length||"object"==typeof e)return this.buffer=e,this.writable=!1,g.default.nextTick(function(){this.emit("end",e),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof e+")")}S.default.inherits(Ze,Ye),Ze.prototype.write=function(e){this.buffer=Qe.concat([this.buffer,Qe.from(e)]),this.emit("data",e)},Ze.prototype.end=function(e){e&&this.write(e),this.emit("end",e),this.emit("close"),this.writable=!1,this.readable=!1};var Xe=Ze,et=G.default.Buffer,tt=G.default.SlowBuffer,nt=it;function it(e,t){if(!et.isBuffer(e)||!et.isBuffer(t))return!1;if(e.length!==t.length)return!1;for(var n=0,i=0;i<e.length;i++)n|=e[i]^t[i];return 0===n}it.install=function(){et.prototype.equal=tt.prototype.equal=function(e){return it(this,e)}};var at=et.prototype.equal,rt=tt.prototype.equal;function ot(e){return(e/8|0)+(e%8==0?0:1)}it.restore=function(){et.prototype.equal=at,tt.prototype.equal=rt};var st={ES256:ot(256),ES384:ot(384),ES512:ot(521)};var ct=function(e){var t=st[e];if(t)return t;throw new Error('Unknown algorithm "'+e+'"')},lt=Ke.exports.Buffer,ut=ct,pt=128;function dt(e){if(lt.isBuffer(e))return e;if("string"==typeof e)return lt.from(e,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function ft(e,t,n){for(var i=0;t+i<n&&0===e[t+i];)++i;return e[t+i]>=pt&&--i,i}var ht={derToJose:function(e,t){e=dt(e);var n=ut(t),i=n+1,a=e.length,r=0;if(48!==e[r++])throw new Error('Could not find expected "seq"');var o=e[r++];if(129===o&&(o=e[r++]),a-r<o)throw new Error('"seq" specified length of "'+o+'", only "'+(a-r)+'" remaining');if(2!==e[r++])throw new Error('Could not find expected "int" for "r"');var s=e[r++];if(a-r-2<s)throw new Error('"r" specified length of "'+s+'", only "'+(a-r-2)+'" available');if(i<s)throw new Error('"r" specified length of "'+s+'", max of "'+i+'" is acceptable');var c=r;if(r+=s,2!==e[r++])throw new Error('Could not find expected "int" for "s"');var l=e[r++];if(a-r!==l)throw new Error('"s" specified length of "'+l+'", expected "'+(a-r)+'"');if(i<l)throw new Error('"s" specified length of "'+l+'", max of "'+i+'" is acceptable');var u=r;if((r+=l)!==a)throw new Error('Expected to consume entire buffer, but "'+(a-r)+'" bytes remain');var p=n-s,d=n-l,f=lt.allocUnsafe(p+s+d+l);for(r=0;r<p;++r)f[r]=0;e.copy(f,r,c+Math.max(-p,0),c+s);for(var h=r=n;r<h+d;++r)f[r]=0;return e.copy(f,r,u+Math.max(-d,0),u+l),f=(f=f.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(e,t){e=dt(e);var n=ut(t),i=e.length;if(i!==2*n)throw new TypeError('"'+t+'" signatures must be "'+2*n+'" bytes, saw "'+i+'"');var a=ft(e,0,n),r=ft(e,n,e.length),o=n-a,s=n-r,c=2+o+1+1+s,l=c<pt,u=lt.allocUnsafe((l?2:3)+c),p=0;return u[p++]=48,l?u[p++]=c:(u[p++]=129,u[p++]=255&c),u[p++]=2,u[p++]=o,a<0?(u[p++]=0,p+=e.copy(u,p,0,n)):p+=e.copy(u,p,a,n),u[p++]=2,u[p++]=s,r<0?(u[p++]=0,e.copy(u,p,n)):e.copy(u,p,n+r),u}},mt=nt,vt=Ke.exports.Buffer,yt=$.default,gt=ht,bt=S.default,wt="secret must be a string or buffer",xt="key must be a string or a buffer",_t="function"==typeof yt.createPublicKey;function Et(e){if(!vt.isBuffer(e)&&"string"!=typeof e){if(!_t)throw Gt(xt);if("object"!=typeof e)throw Gt(xt);if("string"!=typeof e.type)throw Gt(xt);if("string"!=typeof e.asymmetricKeyType)throw Gt(xt);if("function"!=typeof e.export)throw Gt(xt)}}function Tt(e){if(!vt.isBuffer(e)&&"string"!=typeof e&&"object"!=typeof e)throw Gt("key must be a string, a buffer or an object")}function St(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function At(e){var t=4-(e=e.toString()).length%4;if(4!==t)for(var n=0;n<t;++n)e+="=";return e.replace(/\-/g,"+").replace(/_/g,"/")}function Gt(e){var t=[].slice.call(arguments,1),n=bt.format.bind(bt,e).apply(null,t);return new TypeError(n)}function $t(e){var t;return t=e,vt.isBuffer(t)||"string"==typeof t||(e=JSON.stringify(e)),e}function kt(e){return function(t,n){!function(e){if(!vt.isBuffer(e)){if("string"==typeof e)return e;if(!_t)throw Gt(wt);if("object"!=typeof e)throw Gt(wt);if("secret"!==e.type)throw Gt(wt);if("function"!=typeof e.export)throw Gt(wt)}}(n),t=$t(t);var i=yt.createHmac("sha"+e,n);return St((i.update(t),i.digest("base64")))}}function Ct(e){return function(t,n,i){var a=kt(e)(t,i);return mt(vt.from(n),vt.from(a))}}function It(e){return function(t,n){Tt(n),t=$t(t);var i=yt.createSign("RSA-SHA"+e);return St((i.update(t),i.sign(n,"base64")))}}function Pt(e){return function(t,n,i){Et(i),t=$t(t),n=At(n);var a=yt.createVerify("RSA-SHA"+e);return a.update(t),a.verify(i,n,"base64")}}function Rt(e){return function(t,n){Tt(n),t=$t(t);var i=yt.createSign("RSA-SHA"+e);return St((i.update(t),i.sign({key:n,padding:yt.constants.RSA_PKCS1_PSS_PADDING,saltLength:yt.constants.RSA_PSS_SALTLEN_DIGEST},"base64")))}}function Dt(e){return function(t,n,i){Et(i),t=$t(t),n=At(n);var a=yt.createVerify("RSA-SHA"+e);return a.update(t),a.verify({key:i,padding:yt.constants.RSA_PKCS1_PSS_PADDING,saltLength:yt.constants.RSA_PSS_SALTLEN_DIGEST},n,"base64")}}function Ot(e){var t=It(e);return function(){var n=t.apply(null,arguments);return n=gt.derToJose(n,"ES"+e)}}function Ut(e){var t=Pt(e);return function(n,i,a){return i=gt.joseToDer(i,"ES"+e).toString("base64"),t(n,i,a)}}function Nt(){return function(){return""}}function Mt(){return function(e,t){return""===t}}_t&&(xt+=" or a KeyObject",wt+="or a KeyObject");var jt=function(e){var t={hs:kt,rs:It,ps:Rt,es:Ot,none:Nt},n={hs:Ct,rs:Pt,ps:Dt,es:Ut,none:Mt},i=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/i);if(!i)throw Gt('"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".',e);var a=(i[1]||i[3]).toLowerCase(),r=i[2];return{sign:t[a](r),verify:n[a](r)}},Lt=G.default.Buffer,zt=function(e){return"string"==typeof e?e:"number"==typeof e||Lt.isBuffer(e)?e.toString():JSON.stringify(e)},Ht=Ke.exports.Buffer,qt=Xe,Ft=jt,Vt=b.default,Bt=zt,Jt=S.default;function Wt(e,t){return Ht.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Kt(e){var t=e.header,n=e.payload,i=e.secret||e.privateKey,a=e.encoding,r=Ft(t.alg),o=function(e,t,n){n=n||"utf8";var i=Wt(Bt(e),"binary"),a=Wt(Bt(t),n);return Jt.format("%s.%s",i,a)}(t,n,a),s=r.sign(o,i);return Jt.format("%s.%s",o,s)}function Qt(e){var t=e.secret||e.privateKey||e.key,n=new qt(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=n,this.payload=new qt(e.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}Jt.inherits(Qt,Vt),Qt.prototype.sign=function(){try{var e=Kt({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",e),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},Qt.sign=Kt;var Yt=Qt,Zt=Ke.exports.Buffer,Xt=Xe,en=jt,tn=b.default,nn=zt,an=S.default,rn=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function on(e){if(function(e){return"[object Object]"===Object.prototype.toString.call(e)}(e))return e;try{return JSON.parse(e)}catch(e){return}}function sn(e){var t=e.split(".",1)[0];return on(Zt.from(t,"base64").toString("binary"))}function cn(e){return e.split(".")[2]}function ln(e){return rn.test(e)&&!!sn(e)}function un(e,t,n){if(!t){var i=new Error("Missing algorithm parameter for jws.verify");throw i.code="MISSING_ALGORITHM",i}var a=cn(e=nn(e)),r=function(e){return e.split(".",2).join(".")}(e);return en(t).verify(r,a,n)}function pn(e,t){if(t=t||{},!ln(e=nn(e)))return null;var n=sn(e);if(!n)return null;var i=function(e,t){t=t||"utf8";var n=e.split(".")[1];return Zt.from(n,"base64").toString(t)}(e);return("JWT"===n.typ||t.json)&&(i=JSON.parse(i,t.encoding)),{header:n,payload:i,signature:cn(e)}}function dn(e){var t=(e=e||{}).secret||e.publicKey||e.key,n=new Xt(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=n,this.signature=new Xt(e.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}an.inherits(dn,tn),dn.prototype.verify=function(){try{var e=un(this.signature.buffer,this.algorithm,this.key.buffer),t=pn(this.signature.buffer,this.encoding);return this.emit("done",e,t),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},dn.decode=pn,dn.isValid=ln,dn.verify=un;var fn=Yt,hn=dn;We.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],We.sign=fn.sign,We.verify=hn.verify,We.decode=hn.decode,We.isValid=hn.isValid,We.createSign=function(e){return new fn(e)},We.createVerify=function(e){return new hn(e)};var mn=We,vn=function(e,t){t=t||{};var n=mn.decode(e,t);if(!n)return null;var i=n.payload;if("string"==typeof i)try{var a=JSON.parse(i);null!==a&&"object"==typeof a&&(i=a)}catch(e){}return!0===t.complete?{header:n.header,payload:i,signature:n.signature}:i},yn=function(e,t){Error.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=e,t&&(this.inner=t)};(yn.prototype=Object.create(Error.prototype)).constructor=yn;var gn=yn,bn=gn,wn=function(e,t){bn.call(this,e),this.name="NotBeforeError",this.date=t};(wn.prototype=Object.create(bn.prototype)).constructor=wn;var xn=wn,_n=gn,En=function(e,t){_n.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};(En.prototype=Object.create(_n.prototype)).constructor=En;var Tn=En,Sn=1e3,An=60*Sn,Gn=60*An,$n=24*Gn,kn=7*$n,Cn=365.25*$n;function In(e,t,n,i){var a=t>=1.5*n;return Math.round(e/n)+" "+i+(a?"s":"")}var Pn=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*Cn;case"weeks":case"week":case"w":return n*kn;case"days":case"day":case"d":return n*$n;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Gn;case"minutes":case"minute":case"mins":case"min":case"m":return n*An;case"seconds":case"second":case"secs":case"sec":case"s":return n*Sn;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&!1===isNaN(e))return t.long?function(e){var t=Math.abs(e);if(t>=$n)return In(e,t,$n,"day");if(t>=Gn)return In(e,t,Gn,"hour");if(t>=An)return In(e,t,An,"minute");if(t>=Sn)return In(e,t,Sn,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=$n)return Math.round(e/$n)+"d";if(t>=Gn)return Math.round(e/Gn)+"h";if(t>=An)return Math.round(e/An)+"m";if(t>=Sn)return Math.round(e/Sn)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))},Rn=function(e,t){var n=t||Math.floor(Date.now()/1e3);if("string"==typeof e){var i=Pn(e);if(void 0===i)return;return Math.floor(n+i/1e3)}return"number"==typeof e?n+e:void 0},Dn={exports:{}};!function(e,t){var n;t=e.exports=J,n="object"==typeof g.default&&g.default.env&&g.default.env.NODE_DEBUG&&/\bsemver\b/i.test(g.default.env.NODE_DEBUG)?function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER"),console.log.apply(console,e)}:function(){},t.SEMVER_SPEC_VERSION="2.0.0";var i=Number.MAX_SAFE_INTEGER||9007199254740991,a=t.re=[],r=t.src=[],o=0,s=o++;r[s]="0|[1-9]\\d*";var c=o++;r[c]="[0-9]+";var l=o++;r[l]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var u=o++;r[u]="("+r[s]+")\\.("+r[s]+")\\.("+r[s]+")";var p=o++;r[p]="("+r[c]+")\\.("+r[c]+")\\.("+r[c]+")";var d=o++;r[d]="(?:"+r[s]+"|"+r[l]+")";var f=o++;r[f]="(?:"+r[c]+"|"+r[l]+")";var h=o++;r[h]="(?:-("+r[d]+"(?:\\."+r[d]+")*))";var m=o++;r[m]="(?:-?("+r[f]+"(?:\\."+r[f]+")*))";var v=o++;r[v]="[0-9A-Za-z-]+";var y=o++;r[y]="(?:\\+("+r[v]+"(?:\\."+r[v]+")*))";var b=o++,w="v?"+r[u]+r[h]+"?"+r[y]+"?";r[b]="^"+w+"$";var x="[v=\\s]*"+r[p]+r[m]+"?"+r[y]+"?",_=o++;r[_]="^"+x+"$";var E=o++;r[E]="((?:<|>)?=?)";var T=o++;r[T]=r[c]+"|x|X|\\*";var S=o++;r[S]=r[s]+"|x|X|\\*";var A=o++;r[A]="[v=\\s]*("+r[S]+")(?:\\.("+r[S]+")(?:\\.("+r[S]+")(?:"+r[h]+")?"+r[y]+"?)?)?";var G=o++;r[G]="[v=\\s]*("+r[T]+")(?:\\.("+r[T]+")(?:\\.("+r[T]+")(?:"+r[m]+")?"+r[y]+"?)?)?";var $=o++;r[$]="^"+r[E]+"\\s*"+r[A]+"$";var k=o++;r[k]="^"+r[E]+"\\s*"+r[G]+"$";var C=o++;r[C]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var I=o++;r[I]="(?:~>?)";var P=o++;r[P]="(\\s*)"+r[I]+"\\s+",a[P]=new RegExp(r[P],"g");var R=o++;r[R]="^"+r[I]+r[A]+"$";var D=o++;r[D]="^"+r[I]+r[G]+"$";var O=o++;r[O]="(?:\\^)";var U=o++;r[U]="(\\s*)"+r[O]+"\\s+",a[U]=new RegExp(r[U],"g");var N=o++;r[N]="^"+r[O]+r[A]+"$";var M=o++;r[M]="^"+r[O]+r[G]+"$";var j=o++;r[j]="^"+r[E]+"\\s*("+x+")$|^$";var L=o++;r[L]="^"+r[E]+"\\s*("+w+")$|^$";var z=o++;r[z]="(\\s*)"+r[E]+"\\s*("+x+"|"+r[A]+")",a[z]=new RegExp(r[z],"g");var H=o++;r[H]="^\\s*("+r[A]+")\\s+-\\s+("+r[A]+")\\s*$";var q=o++;r[q]="^\\s*("+r[G]+")\\s+-\\s+("+r[G]+")\\s*$";var F=o++;r[F]="(<|>)?=?\\s*\\*";for(var V=0;V<35;V++)n(V,r[V]),a[V]||(a[V]=new RegExp(r[V]));function B(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof J)return e;if("string"!=typeof e)return null;if(e.length>256)return null;if(!(t.loose?a[_]:a[b]).test(e))return null;try{return new J(e,t)}catch(e){return null}}function J(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof J){if(e.loose===t.loose)return e;e=e.version}else if("string"!=typeof e)throw new TypeError("Invalid Version: "+e);if(e.length>256)throw new TypeError("version is longer than 256 characters");if(!(this instanceof J))return new J(e,t);n("SemVer",e,t),this.options=t,this.loose=!!t.loose;var r=e.trim().match(t.loose?a[_]:a[b]);if(!r)throw new TypeError("Invalid Version: "+e);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>i||this.major<0)throw new TypeError("Invalid major version");if(this.minor>i||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>i||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((function(e){if(/^[0-9]+$/.test(e)){var t=+e;if(t>=0&&t<i)return t}return e})):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}t.parse=B,t.valid=function(e,t){var n=B(e,t);return n?n.version:null},t.clean=function(e,t){var n=B(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null},t.SemVer=J,J.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},J.prototype.toString=function(){return this.version},J.prototype.compare=function(e){return n("SemVer.compare",this.version,this.options,e),e instanceof J||(e=new J(e,this.options)),this.compareMain(e)||this.comparePre(e)},J.prototype.compareMain=function(e){return e instanceof J||(e=new J(e,this.options)),K(this.major,e.major)||K(this.minor,e.minor)||K(this.patch,e.patch)},J.prototype.comparePre=function(e){if(e instanceof J||(e=new J(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;var t=0;do{var i=this.prerelease[t],a=e.prerelease[t];if(n("prerelease compare",t,i,a),void 0===i&&void 0===a)return 0;if(void 0===a)return 1;if(void 0===i)return-1;if(i!==a)return K(i,a)}while(++t)},J.prototype.inc=function(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var n=this.prerelease.length;--n>=0;)"number"==typeof this.prerelease[n]