libaria2-ts
Advanced tools
Comparing version 1.0.81 to 1.0.82
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var t;Object.defineProperty(exports,"__esModule",{value:!0});var n=new Uint8Array(16);function r(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(n)}var o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function i(e){return"string"==typeof e&&o.test(e)}for(var a=[],s=0;s<256;++s)a.push((s+256).toString(16).substr(1));function l(e,t,n){var o=(e=e||{}).random||(e.rng||r)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var s=0;s<16;++s)t[n+s]=o[s];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(a[e[t+0]]+a[e[t+1]]+a[e[t+2]]+a[e[t+3]]+"-"+a[e[t+4]]+a[e[t+5]]+"-"+a[e[t+6]]+a[e[t+7]]+"-"+a[e[t+8]]+a[e[t+9]]+"-"+a[e[t+10]]+a[e[t+11]]+a[e[t+12]]+a[e[t+13]]+a[e[t+14]]+a[e[t+15]]).toLowerCase();if(!i(n))throw TypeError("Stringified UUID is invalid");return n}(o)}var u,c="object"==typeof Reflect?Reflect:null,f=c&&"function"==typeof c.apply?c.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};u=c&&"function"==typeof c.ownKeys?c.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var d=Number.isNaN||function(e){return e!=e};function p(){p.init.call(this)}var h=p,m=function(e,t){return new Promise((function(n,r){function o(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}P(e,t,i,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&P(e,"error",t,n)}(e,o,{once:!0})}))};p.EventEmitter=p,p.prototype._events=void 0,p.prototype._eventsCount=0,p.prototype._maxListeners=void 0;var w,v,y,g,b=10;function C(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function S(e){return void 0===e._maxListeners?p.defaultMaxListeners:e._maxListeners}function E(e,t,n,r){var o,i,a,s;if(C(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),a=i[t]),void 0===a)a=i[t]=n,++e._eventsCount;else if("function"==typeof a?a=i[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=S(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function O(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function $(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=O.bind(r);return o.listener=n,r.wrapFn=o,o}function L(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(o):j(o,o.length)}function x(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function j(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function P(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){r.once&&e.removeEventListener(t,o),n(i)}))}}function R(e){return e.toString()}function A(e){return e.toString()}function k(e){if(/^(false|true)$/.test(e))return"true"==e;throw"Unknown Boolean Value: "+e}function D(e){return Number(e)}function N(e){return BigInt(e)}function T(e){let t={};for(const n in e)if(null!=e[n])if("string"==typeof e[n])t[n]=e[n];else if("boolean"==typeof e[n])t[n]=e[n].toString();else if("number"==typeof e[n])t[n]=A(e[n]);else{if("bigint"!=typeof e[n])throw"Unknown Value: "+e[n];t[n]=R(e[n])}return t}function _(e){let t={};for(const n in e)if(null!=e[n])if("string"==typeof e[n])t[n]=e[n];else if("boolean"==typeof e[n])t[n]=k(e[n]);else if("number"==typeof e[n])t[n]=D(e[n]);else{if("bigint"!=typeof e[n])throw"Unknown Value: "+e[n];t[n]=N(e[n])}return t}function U(e){let t=Object.assign({},e);if(null!=e.totalLength&&(t.totalLength=N(e.totalLength)),null!=e.totalLength&&(t.completedLength=N(e.completedLength)),null!=e.totalLength&&(t.uploadLength=N(e.uploadLength)),null!=e.totalLength&&(t.downloadSpeed=N(e.downloadSpeed)),null!=e.totalLength&&(t.uploadSpeed=N(e.uploadSpeed)),null!=e.numSeeders&&(t.numSeeders=N(e.numSeeders)),null!=e.seeder&&(t.seeder=k(e.seeder)),null!=e.totalLength&&(t.pieceLength=N(e.pieceLength)),null!=e.totalLength&&(t.numPieces=N(e.numPieces)),null!=e.totalLength&&(t.connections=N(e.connections)),null!=e.errorCode&&(t.errorCode=D(e.errorCode)),null!=e.bittorrent&&null!=e.bittorrent.creationDate&&(t.bittorrent.creationDate=N(e.bittorrent.creationDate)),null!=e.files)for(const n in e.files)t.files[n]=B(e.files[n]);return t}function B(e){let t=Object.assign({},e);return t.length=N(e.length),t.completedLength=N(e.completedLength),t.index=D(e.index),t.selected=k(e.selected),t}function M(e){let t=Object.assign({},e);return t.amChoking=k(e.amChoking),t.downloadSpeed=N(e.downloadSpeed),t.peerChoking=k(e.peerChoking),t.port=D(e.port),t.seeder=k(e.seeder),t.uploadSpeed=N(e.uploadSpeed),t}function q(e){let t=Object.assign({},e);return t.downloadSpeed=N(e.downloadSpeed),t}function F(e){let t=Object.assign({},e);t.index=D(e.index);for(const n in e.servers)t.servers[n]=q(e.servers[n]);return t}Object.defineProperty(p,"defaultMaxListeners",{enumerable:!0,get:function(){return b},set:function(e){if("number"!=typeof e||e<0||d(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");b=e}}),p.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},p.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||d(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},p.prototype.getMaxListeners=function(){return S(this)},p.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var s=o[e];if(void 0===s)return!1;if("function"==typeof s)f(s,this,t);else{var l=s.length,u=j(s,l);for(n=0;n<l;++n)f(u[n],this,t)}return!0},p.prototype.addListener=function(e,t){return E(this,e,t,!1)},p.prototype.on=p.prototype.addListener,p.prototype.prependListener=function(e,t){return E(this,e,t,!0)},p.prototype.once=function(e,t){return C(t),this.on(e,$(this,e,t)),this},p.prototype.prependOnceListener=function(e,t){return C(t),this.prependListener(e,$(this,e,t)),this},p.prototype.removeListener=function(e,t){var n,r,o,i,a;if(C(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,o),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},p.prototype.off=p.prototype.removeListener,p.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var o,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(o=i[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},p.prototype.listeners=function(e){return L(this,e,!0)},p.prototype.rawListeners=function(e){return L(this,e,!1)},p.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):x.call(e,t)},p.prototype.listenerCount=x,p.prototype.eventNames=function(){return this._eventsCount>0?u(this._events):[]},h.once=m;class H extends h.EventEmitter{constructor(){super()}async addMetalink(e,t,n){var r;null!==(r=process.versions.node)&&void 0!==r&&r&&e instanceof Buffer&&(e=e.toString("base64"));let o=[e];if(null!=t&&o.push(t),null!=t&&null!=n)o.push(n);else if(null!=n)throw"Require `options`!";return await this.rawCall("aria2.addMetalink",...o)}async remove(e){return await this.rawCall("aria2.remove",e)}async forceRemove(e){return await this.rawCall("aria2.forceRemove",e)}async pause(e){return await this.rawCall("aria2.pause",e)}async forcePause(e){return await this.rawCall("aria2.forcePause",e)}async pauseAll(){return await this.rawCall("aria2.pauseAll")}async forcePauseAll(){return await this.rawCall("aria2.forcePauseAll")}async unpause(e){return await this.rawCall("aria2.unpause",e)}async unpauseAll(){return await this.rawCall("aria2.unpauseAll")}async tellStatus(e,t){if(null!=t){return U(await this.rawCall("aria2.tellStatus",e,t))}return U(await this.rawCall("aria2.tellStatus",e))}async getUris(e){return await this.rawCall("aria2.getUris",e)}async getFiles(e){return await this.rawCall("aria2.getFiles",e)}async getPeers(e){return(await this.rawCall("aria2.getPeers",e)).map(M)}async getServers(e){return(await this.rawCall("aria2.getServers",e)).map(F)}async tellActive(e){if(null!=e){return(await this.rawCall("aria2.tellActive",e)).map(U)}return(await this.rawCall("aria2.tellActive")).map(U)}async tellWaiting(e,t,n){if(null!=n){return(await this.rawCall("aria2.tellWaiting",e,t,n)).map(U)}return(await this.rawCall("aria2.tellWaiting",e,t)).map(U)}async tellStopped(e,t,n){if(null!=n){return(await this.rawCall("aria2.tellStopped",e,t,n)).map(U)}return(await this.rawCall("aria2.tellStopped",e,t)).map(U)}async changePosition(e,t,n){return await this.rawCall("aria2.changePosition",e,t,n)}async changeUri(e,t,n,r,o){return await this.rawCall("aria2.changeUri",e,t,n,r,o)}async getOption(e){return _(await this.rawCall("aria2.getOption",e))}async changeOption(e,t){return await this.rawCall("aria2.changeOption",e,T(t))}async getGlobalOption(){return _(await this.rawCall("aria2.getGlobalOption"))}async changeGlobalOption(e){return await this.rawCall("aria2.changeGlobalOption",T(e))}async getGlobalStat(){return function(e){let t=Object.assign({},e);return t.downloadSpeed=N(e.downloadSpeed),t.uploadSpeed=N(e.uploadSpeed),t.numActive=D(e.numActive),t.numWaiting=D(e.numWaiting),t.numStopped=D(e.numStopped),t.numStoppedTotal=D(e.numStoppedTotal),t}(await this.rawCall("aria2.getGlobalStat"))}async purgeDownloadResult(){return await this.rawCall("aria2.purgeDownloadResult")}async removeDownloadResult(e){return await this.rawCall("aria2.removeDownloadResult",e)}async getVersion(){return await this.rawCall("aria2.getVersion")}async shutdown(){return await this.rawCall("aria2.shutdown")}async forceShutdown(){return await this.rawCall("aria2.forceShutdown")}async saveSession(){return await this.rawCall("aria2.saveSession")}async getSessionInfo(){return await this.rawCall("aria2.getSessioninfo")}async addUri(e,t,n){"string"==typeof e&&(e=[e]);let r=[e];if(null!=t&&r.push(T(t)),null!=t&&null!=n)r.push(n);else if(null!=n)throw"Require `options`!";return await this.rawCall("aria2.addUri",...r)}async addTorrent(e,t,n,r){e instanceof Buffer&&(e=e.toString("base64")),"string"==typeof t&&(t=[t]);let o=[e,t];if(null!=n&&o.push(n),null!=n&&null!=r)o.push(r);else if(null!=r)throw"Require `options`!";return await this.rawCall("aria2.addTorrent",...o)}onceDownloadStart(){return new Promise((e=>this.once("aria2.onDownloadStart",e)))}onceDownloadPause(){return new Promise((e=>this.once("aria2.onDownloadPause",e)))}onceDownloadStop(){return new Promise((e=>this.once("aria2.onDownloadStop",e)))}onceDownloadComplete(){return new Promise((e=>this.once("aria2.onDownloadComplete",e)))}onceDownloadError(){return new Promise((e=>this.once("aria2.onDownloadError",e)))}onceBtDownloadStart(){return new Promise((e=>this.once("aria2.onBtDownloadStart",e)))}}!function(e){e.Set="POS_SET",e.Cur="POS_CUR",e.End="POS_END"}(w||(w={})),function(e){e.Active="active",e.Waiting="waiting",e.Paused="paused",e.Error="error",e.Complete="complete",e.Removed="removed"}(v||(v={})),function(e){e.Waiting="waiting",e.Used="used"}(y||(y={})),function(e){e.Single="single",e.Multi="multi"}(g||(g={}));class I{constructor(t){e(this,"$client",void 0),this.$client=t}}var V,W=Object.freeze({__proto__:null,Aria2ClientBaseClass:H,get EAria2ChangePositionHow(){return w},get EAria2DownloadState(){return v},get EAria2UriStatusEnum(){return y},get EAria2DownloadBitTorrentMode(){return g},Aria2ClientSystemMethodsBaseClass:I});!function(e){e.atob=function(e){return Buffer.from(e,"base64").toString()},e.btoa=function(e){return Buffer.from(e).toString("base64")}}(V||(V={}));const J=()=>{var e,t;return"string"==typeof(null===globalThis||void 0===globalThis||null===(e=globalThis.process)||void 0===e||null===(t=e.versions)||void 0===t?void 0:t.node)},z=null!=globalThis.WebSocket?class extends globalThis.WebSocket{constructor(e){super(e)}}:require("ws"),G=(()=>{if(J())return V.btoa;if(null!=globalThis.btoa)return globalThis.btoa;throw new Error("`btoa()` is not defined!")})();(()=>{if(J())return V.atob;if(null!=globalThis.atob)return globalThis.atob;throw new Error("`atob()` is not defined!")})();var X=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},K=Object.prototype.toString;function Q(e){return"[object Array]"===K.call(e)}function Y(e){return void 0===e}function Z(e){return null!==e&&"object"==typeof e}function ee(e){if("[object Object]"!==K.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function te(e){return"[object Function]"===K.call(e)}function ne(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),Q(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var re={isArray:Q,isArrayBuffer:function(e){return"[object ArrayBuffer]"===K.call(e)},isBuffer:function(e){return null!==e&&!Y(e)&&null!==e.constructor&&!Y(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Z,isPlainObject:ee,isUndefined:Y,isDate:function(e){return"[object Date]"===K.call(e)},isFile:function(e){return"[object File]"===K.call(e)},isBlob:function(e){return"[object Blob]"===K.call(e)},isFunction:te,isStream:function(e){return Z(e)&&te(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:ne,merge:function e(){var t={};function n(n,r){ee(t[r])&&ee(n)?t[r]=e(t[r],n):ee(n)?t[r]=e({},n):Q(n)?t[r]=n.slice():t[r]=n}for(var r=0,o=arguments.length;r<o;r++)ne(arguments[r],n);return t},extend:function(e,t,n){return ne(t,(function(t,r){e[r]=n&&"function"==typeof t?X(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}};function oe(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var ie=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(re.isURLSearchParams(t))r=t.toString();else{var o=[];re.forEach(t,(function(e,t){null!=e&&(re.isArray(e)?t+="[]":e=[e],re.forEach(e,(function(e){re.isDate(e)?e=e.toISOString():re.isObject(e)&&(e=JSON.stringify(e)),o.push(oe(t)+"="+oe(e))})))})),r=o.join("&")}if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e};function ae(){this.handlers=[]}ae.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},ae.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},ae.prototype.forEach=function(e){re.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var se=ae,le=function(e,t,n){return re.forEach(n,(function(n){e=n(e,t)})),e},ue=function(e){return!(!e||!e.__CANCEL__)},ce=function(e,t){re.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},fe=function(e,t,n,r,o){return function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}(new Error(e),t,n,r,o)},de=re.isStandardBrowserEnv()?{write:function(e,t,n,r,o,i){var a=[];a.push(e+"="+encodeURIComponent(t)),re.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),re.isString(r)&&a.push("path="+r),re.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},pe=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],he=re.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=re.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},me=function(e){return new Promise((function(t,n){var r=e.data,o=e.headers;re.isFormData(r)&&delete o["Content-Type"];var i=new XMLHttpRequest;if(e.auth){var a=e.auth.username||"",s=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(a+":"+s)}var l,u,c=(l=e.baseURL,u=e.url,l&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(u)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(l,u):u);if(i.open(e.method.toUpperCase(),ie(c,e.params,e.paramsSerializer),!0),i.timeout=e.timeout,i.onreadystatechange=function(){if(i&&4===i.readyState&&(0!==i.status||i.responseURL&&0===i.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in i?function(e){var t,n,r,o={};return e?(re.forEach(e.split("\n"),(function(e){if(r=e.indexOf(":"),t=re.trim(e.substr(0,r)).toLowerCase(),n=re.trim(e.substr(r+1)),t){if(o[t]&&pe.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o}(i.getAllResponseHeaders()):null,o={data:e.responseType&&"text"!==e.responseType?i.response:i.responseText,status:i.status,statusText:i.statusText,headers:r,config:e,request:i};!function(e,t,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(fe("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}(t,n,o),i=null}},i.onabort=function(){i&&(n(fe("Request aborted",e,"ECONNABORTED",i)),i=null)},i.onerror=function(){n(fe("Network Error",e,null,i)),i=null},i.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(fe(t,e,"ECONNABORTED",i)),i=null},re.isStandardBrowserEnv()){var f=(e.withCredentials||he(c))&&e.xsrfCookieName?de.read(e.xsrfCookieName):void 0;f&&(o[e.xsrfHeaderName]=f)}if("setRequestHeader"in i&&re.forEach(o,(function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete o[t]:i.setRequestHeader(t,e)})),re.isUndefined(e.withCredentials)||(i.withCredentials=!!e.withCredentials),e.responseType)try{i.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&i.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&i.upload&&i.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){i&&(i.abort(),n(e),i=null)})),r||(r=null),i.send(r)}))},we={"Content-Type":"application/x-www-form-urlencoded"};function ve(e,t){!re.isUndefined(e)&&re.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var ye={adapter:function(){var e;return("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(e=me),e}(),transformRequest:[function(e,t){return ce(t,"Accept"),ce(t,"Content-Type"),re.isFormData(e)||re.isArrayBuffer(e)||re.isBuffer(e)||re.isStream(e)||re.isFile(e)||re.isBlob(e)?e:re.isArrayBufferView(e)?e.buffer:re.isURLSearchParams(e)?(ve(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):re.isObject(e)?(ve(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};re.forEach(["delete","get","head"],(function(e){ye.headers[e]={}})),re.forEach(["post","put","patch"],(function(e){ye.headers[e]=re.merge(we)}));var ge=ye;function be(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var Ce=function(e){return be(e),e.headers=e.headers||{},e.data=le(e.data,e.headers,e.transformRequest),e.headers=re.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),re.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||ge.adapter)(e).then((function(t){return be(e),t.data=le(t.data,t.headers,e.transformResponse),t}),(function(t){return ue(t)||(be(e),t&&t.response&&(t.response.data=le(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Se=function(e,t){t=t||{};var n={},r=["url","method","data"],o=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function s(e,t){return re.isPlainObject(e)&&re.isPlainObject(t)?re.merge(e,t):re.isPlainObject(t)?re.merge({},t):re.isArray(t)?t.slice():t}function l(r){re.isUndefined(t[r])?re.isUndefined(e[r])||(n[r]=s(void 0,e[r])):n[r]=s(e[r],t[r])}re.forEach(r,(function(e){re.isUndefined(t[e])||(n[e]=s(void 0,t[e]))})),re.forEach(o,l),re.forEach(i,(function(r){re.isUndefined(t[r])?re.isUndefined(e[r])||(n[r]=s(void 0,e[r])):n[r]=s(void 0,t[r])})),re.forEach(a,(function(r){r in t?n[r]=s(e[r],t[r]):r in e&&(n[r]=s(void 0,e[r]))}));var u=r.concat(o).concat(i).concat(a),c=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===u.indexOf(e)}));return re.forEach(c,l),n};function Ee(e){this.defaults=e,this.interceptors={request:new se,response:new se}}Ee.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Se(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[Ce,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},Ee.prototype.getUri=function(e){return e=Se(this.defaults,e),ie(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},re.forEach(["delete","get","head","options"],(function(e){Ee.prototype[e]=function(t,n){return this.request(Se(n||{},{method:e,url:t,data:(n||{}).data}))}})),re.forEach(["post","put","patch"],(function(e){Ee.prototype[e]=function(t,n,r){return this.request(Se(r||{},{method:e,url:t,data:n}))}}));var Oe=Ee;function $e(e){this.message=e}$e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},$e.prototype.__CANCEL__=!0;var Le=$e;function xe(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new Le(e),t(n.reason))}))}xe.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},xe.source=function(){var e;return{token:new xe((function(t){e=t})),cancel:e}};var je=xe;function Pe(e){var t=new Oe(e),n=X(Oe.prototype.request,t);return re.extend(n,Oe.prototype,t),re.extend(n,t),n}var Re=Pe(ge);Re.Axios=Oe,Re.create=function(e){return Pe(Se(Re.defaults,e))},Re.Cancel=Le,Re.CancelToken=je,Re.isCancel=ue,Re.all=function(e){return Promise.all(e)},Re.spread=function(e){return function(t){return e.apply(null,t)}},Re.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError};var Ae=Re,ke=Re;Ae.default=ke;var De=Ae;exports.WebSocket=void 0,function(t){t.Client=class extends H{constructor(t){var r,o,i;super(),e(this,"$ws",void 0),e(this,"$options",void 0),e(this,"$respCallbacks",new Map),e(this,"$openCallbacks",[]),e(this,"$opened",!1),e(this,"$waitOpened",(()=>new Promise(((e,t)=>{this.$opened&&1==this.$ws.readyState?e():this.$ws.readyState<1&&this.$ws.readyState>1?t(this.$ws.readyState):this.$openCallbacks.push(e)})))),e(this,"$sendRaw",(e=>new Promise(((t,n)=>{try{this.$ws.send(e)}catch(e){n(e)}})))),e(this,"$sendJson",((e,...t)=>new Promise((async(n,r)=>{var o,i;await this.$waitOpened();let a=l(),s={jsonrpc:"2.0",id:a,method:e,params:[]};null!=(null===(o=this.$options)||void 0===o||null===(i=o.auth)||void 0===i?void 0:i.secret)&&s.params.push("token:"+this.$options.auth.secret),s.params=[...s.params,...t],this.$respCallbacks.set(a,n),this.$sendRaw(JSON.stringify(s)).catch(r)})))),e(this,"$systemMethods",new n(this)),this.$options=Object.assign({},t),this.$ws=new z(`${null!==(r=t.protocol)&&void 0!==r?r:"ws"}://${t.host}:${t.port}${null!==(o=t.path)&&void 0!==o?o:"/jsonrpc"}`,J()?null!==(i=t.wsOptions)&&void 0!==i?i:{}:void 0),this.$ws.onclose=()=>{this.emit("ws.close"),this.$opened=!1,this.$openCallbacks=[]},this.$ws.onopen=()=>{for(this.emit("ws.open"),this.$opened=!0;this.$openCallbacks.length>0;){let e=this.$openCallbacks.pop();null!=e&&1==this.$ws.readyState&&e()}},this.$ws.onmessage=e=>{var t,n,r,o,i,a,s;("message"==(null===(t=e)||void 0===t?void 0:t.type)||J())&&(e=e.data);try{this.emit("ws.message",e);let t=JSON.parse(e.toString());if(t instanceof Array){let e=this.$respCallbacks.get(t[0].id);null!=e&&e(t),this.$respCallbacks.delete(t[0].id)}else if(null!=t.id&&this.$respCallbacks.has(null==t?void 0:t.id)){let e=this.$respCallbacks.get(t.id);null!=e&&e(t),this.$respCallbacks.delete(t.id)}else if(null!=t.method)switch(null==t?void 0:t.method){case"aria2.onDownloadStart":this.emit("aria2.onDownloadStart",{},...null!==(n=t.params)&&void 0!==n?n:[]);break;case"aria2.onDownloadPause":this.emit("aria2.onDownloadPause",{},...null!==(r=t.params)&&void 0!==r?r:[]);break;case"aria2.onDownloadStop":this.emit("aria2.onDownloadStop",{},...null!==(o=t.params)&&void 0!==o?o:[]);break;case"aria2.onDownloadComplete":this.emit("aria2.onDownloadComplete",{},...null!==(i=t.params)&&void 0!==i?i:[]);break;case"aria2.onDownloadError":this.emit("aria2.onDownloadError",{},...null!==(a=t.params)&&void 0!==a?a:[]);break;case"aria2.onBtDownloadComplete":this.emit("aria2.onBtDownloadComplete",{},...null!==(s=t.params)&&void 0!==s?s:[])}}catch(e){throw this.$errorHandle(e),e}}}$errorHandle(e){}get system(){return this.$systemMethods}async rawCall(e,...t){let n=await this.$sendJson(e,...t);if(null!=n.error)throw n.error;return n.result}async rawSend(e){return await this.$sendRaw(e)}async getCreateOptions(){return Object.freeze(this.$options)}async closeConnection(e,t){this.$ws.close(e,t)}};class n extends I{async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}multicall(...e){return new Promise((async(t,n)=>{var r;let o=l(),i=!1,a=[],s=await this.$client.getCreateOptions();var u;null!=(null==s||null===(r=s.auth)||void 0===r?void 0:r.secret)&&a.push("token:"+(null==s||null===(u=s.auth)||void 0===u?void 0:u.secret));let c=[];for(const t of e)1!=i?(c.push({jsonrpc:"2.0",id:o,method:t.methodName,params:[...a,...t.params]}),i=!0):c.push({jsonrpc:"2.0",id:l(),method:t.methodName,params:[...a,...t.params]});await this.$client.$waitOpened(),this.$client.$respCallbacks.set(o,(e=>{let n=[];for(const t of e)null!=t.error?n.push(Promise.reject(t.error)):n.push(Promise.resolve(t.result));t(n)})),this.$client.rawSend(JSON.stringify(c)).catch(n)}))}}t.SystemMethods=n}(exports.WebSocket||(exports.WebSocket={})),exports.Http=void 0,function(t){t.Client=class extends H{constructor(t){super(),e(this,"$options",void 0),e(this,"$system",void 0),this.$options=t,this.$system=new n(this)}onDownloadStart(){throw new Error("Method not implemented.")}onDownloadPause(){throw new Error("Method not implemented.")}onDownloadStop(){throw new Error("Method not implemented.")}onDownloadComplete(){throw new Error("Method not implemented.")}onDownloadError(){throw new Error("Method not implemented.")}onBtDownloadStart(){throw new Error("Method not implemented.")}get system(){return this.$system}async rawCall(e,...t){var n,r,o;let i=l(),a=[...t];null!=(null===(n=this.$options)||void 0===n||null===(r=n.auth)||void 0===r?void 0:r.secret)&&a.push("token:"+this.$options.auth.secret);let s=`${null!==(o=this.$options.protocol)&&void 0!==o?o:"http"}://${this.$options.host}:${this.$options.port}/jsonrpc?method=${decodeURIComponent(e)}&id=${decodeURIComponent(i)}¶ms=${G(JSON.stringify(a))}`,u=(await De(s,{method:"GET",...this.$options.fetchOptions})).data;if(null==u.error)return u.result;throw u.error}async rawSend(e){throw new Error("Method not implemented.")}async getCreateOptions(){return this.$options}};class n extends I{async multicall(...e){let t={},n=[],r=[],o=await this.$client.getCreateOptions();for(const s of e){var i,a;let e=l(),u=[];null!=(null==o||null===(i=o.auth)||void 0===i?void 0:i.secret)&&u.push(null==o||null===(a=o.auth)||void 0===a?void 0:a.secret),n.push({jsonrpc:"2.0",id:e,params:[...u,...s.params],method:s.methodName}),r.push(new Promise(((n,r)=>{t[e]={r:n,j:r}})))}return new Promise((async()=>{var e;let r=`${null!==(e=o.protocol)&&void 0!==e?e:"http"}://${o.host}:${o.port}/jsonrpc?method=&id=¶ms=${G(JSON.stringify(n))}`,i=await De(r,{method:"GET",...o.fetchOptions});for(const e of i.data)null!=e.id&&null!=t[e.id]&&(null!=e.error?t[e.id].j(e.error):t[e.id].r(e.result))})),r}async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}}t.SystemMethods=n}(exports.Http||(exports.Http={})),exports.Adapter=W; | ||
"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var t;Object.defineProperty(exports,"__esModule",{value:!0});var n=new Uint8Array(16);function r(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(n)}var o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function i(e){return"string"==typeof e&&o.test(e)}for(var a=[],s=0;s<256;++s)a.push((s+256).toString(16).substr(1));function l(e,t,n){var o=(e=e||{}).random||(e.rng||r)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var s=0;s<16;++s)t[n+s]=o[s];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(a[e[t+0]]+a[e[t+1]]+a[e[t+2]]+a[e[t+3]]+"-"+a[e[t+4]]+a[e[t+5]]+"-"+a[e[t+6]]+a[e[t+7]]+"-"+a[e[t+8]]+a[e[t+9]]+"-"+a[e[t+10]]+a[e[t+11]]+a[e[t+12]]+a[e[t+13]]+a[e[t+14]]+a[e[t+15]]).toLowerCase();if(!i(n))throw TypeError("Stringified UUID is invalid");return n}(o)}var u,c="object"==typeof Reflect?Reflect:null,f=c&&"function"==typeof c.apply?c.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};u=c&&"function"==typeof c.ownKeys?c.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var d=Number.isNaN||function(e){return e!=e};function p(){p.init.call(this)}var h=p,m=function(e,t){return new Promise((function(n,r){function o(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}x(e,t,i,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&x(e,"error",t,n)}(e,o,{once:!0})}))};p.EventEmitter=p,p.prototype._events=void 0,p.prototype._eventsCount=0,p.prototype._maxListeners=void 0;var w,v,g,y,b=10;function C(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function S(e){return void 0===e._maxListeners?p.defaultMaxListeners:e._maxListeners}function E(e,t,n,r){var o,i,a,s;if(C(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),a=i[t]),void 0===a)a=i[t]=n,++e._eventsCount;else if("function"==typeof a?a=i[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=S(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function O(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function $(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=O.bind(r);return o.listener=n,r.wrapFn=o,o}function L(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(o):P(o,o.length)}function j(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function P(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function x(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){r.once&&e.removeEventListener(t,o),n(i)}))}}function R(e){return e.toString()}function k(e){return e.toString()}function A(e){if(/^(false|true)$/.test(e))return"true"==e;throw"Unknown Boolean Value: "+e}function T(e){return Number(e)}function _(e){return BigInt(e)}function N(e){let t={};for(const n in e)if(null!=e[n])if("string"==typeof e[n])t[n]=e[n];else if("boolean"==typeof e[n])t[n]=e[n].toString();else if("number"==typeof e[n])t[n]=k(e[n]);else{if("bigint"!=typeof e[n])throw"Unknown Value: "+e[n];t[n]=R(e[n])}return t}function D(e){let t={};for(const n in e)if(null!=e[n])if("string"==typeof e[n])t[n]=e[n];else if("boolean"==typeof e[n])t[n]=A(e[n]);else if("number"==typeof e[n])t[n]=T(e[n]);else{if("bigint"!=typeof e[n])throw"Unknown Value: "+e[n];t[n]=_(e[n])}return t}function U(e){let t=Object.assign({},e);if(null!=e.totalLength&&(t.totalLength=_(e.totalLength)),null!=e.totalLength&&(t.completedLength=_(e.completedLength)),null!=e.totalLength&&(t.uploadLength=_(e.uploadLength)),null!=e.totalLength&&(t.downloadSpeed=_(e.downloadSpeed)),null!=e.totalLength&&(t.uploadSpeed=_(e.uploadSpeed)),null!=e.numSeeders&&(t.numSeeders=_(e.numSeeders)),null!=e.seeder&&(t.seeder=A(e.seeder)),null!=e.totalLength&&(t.pieceLength=_(e.pieceLength)),null!=e.totalLength&&(t.numPieces=_(e.numPieces)),null!=e.totalLength&&(t.connections=_(e.connections)),null!=e.errorCode&&(t.errorCode=T(e.errorCode)),null!=e.bittorrent&&null!=e.bittorrent.creationDate&&(t.bittorrent.creationDate=_(e.bittorrent.creationDate)),null!=e.files)for(const n in e.files)t.files[n]=B(e.files[n]);return t}function B(e){let t=Object.assign({},e);return t.length=_(e.length),t.completedLength=_(e.completedLength),t.index=T(e.index),t.selected=A(e.selected),t}function M(e){let t=Object.assign({},e);return t.amChoking=A(e.amChoking),t.downloadSpeed=_(e.downloadSpeed),t.peerChoking=A(e.peerChoking),t.port=T(e.port),t.seeder=A(e.seeder),t.uploadSpeed=_(e.uploadSpeed),t}function q(e){let t=Object.assign({},e);return t.downloadSpeed=_(e.downloadSpeed),t}function F(e){let t=Object.assign({},e);t.index=T(e.index);for(const n in e.servers)t.servers[n]=q(e.servers[n]);return t}Object.defineProperty(p,"defaultMaxListeners",{enumerable:!0,get:function(){return b},set:function(e){if("number"!=typeof e||e<0||d(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");b=e}}),p.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},p.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||d(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},p.prototype.getMaxListeners=function(){return S(this)},p.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var s=o[e];if(void 0===s)return!1;if("function"==typeof s)f(s,this,t);else{var l=s.length,u=P(s,l);for(n=0;n<l;++n)f(u[n],this,t)}return!0},p.prototype.addListener=function(e,t){return E(this,e,t,!1)},p.prototype.on=p.prototype.addListener,p.prototype.prependListener=function(e,t){return E(this,e,t,!0)},p.prototype.once=function(e,t){return C(t),this.on(e,$(this,e,t)),this},p.prototype.prependOnceListener=function(e,t){return C(t),this.prependListener(e,$(this,e,t)),this},p.prototype.removeListener=function(e,t){var n,r,o,i,a;if(C(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,o),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},p.prototype.off=p.prototype.removeListener,p.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var o,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(o=i[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},p.prototype.listeners=function(e){return L(this,e,!0)},p.prototype.rawListeners=function(e){return L(this,e,!1)},p.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):j.call(e,t)},p.prototype.listenerCount=j,p.prototype.eventNames=function(){return this._eventsCount>0?u(this._events):[]},h.once=m;class J extends h.EventEmitter{constructor(){super()}async addMetalink(e,t,n){var r;null!==(r=process.versions.node)&&void 0!==r&&r&&e instanceof Buffer&&(e=e.toString("base64"));let o=[e];if(null!=t&&o.push(t),null!=t&&null!=n)o.push(n);else if(null!=n)throw"Require `options`!";return await this.rawCall("aria2.addMetalink",...o)}async remove(e){return await this.rawCall("aria2.remove",e)}async forceRemove(e){return await this.rawCall("aria2.forceRemove",e)}async pause(e){return await this.rawCall("aria2.pause",e)}async forcePause(e){return await this.rawCall("aria2.forcePause",e)}async pauseAll(){return await this.rawCall("aria2.pauseAll")}async forcePauseAll(){return await this.rawCall("aria2.forcePauseAll")}async unpause(e){return await this.rawCall("aria2.unpause",e)}async unpauseAll(){return await this.rawCall("aria2.unpauseAll")}async tellStatus(e,t){if(null!=t){return U(await this.rawCall("aria2.tellStatus",e,t))}return U(await this.rawCall("aria2.tellStatus",e))}async getUris(e){return await this.rawCall("aria2.getUris",e)}async getFiles(e){return await this.rawCall("aria2.getFiles",e)}async getPeers(e){return(await this.rawCall("aria2.getPeers",e)).map(M)}async getServers(e){return(await this.rawCall("aria2.getServers",e)).map(F)}async tellActive(e){if(null!=e){return(await this.rawCall("aria2.tellActive",e)).map(U)}return(await this.rawCall("aria2.tellActive")).map(U)}async tellWaiting(e,t,n){if(null!=n){return(await this.rawCall("aria2.tellWaiting",e,t,n)).map(U)}return(await this.rawCall("aria2.tellWaiting",e,t)).map(U)}async tellStopped(e,t,n){if(null!=n){return(await this.rawCall("aria2.tellStopped",e,t,n)).map(U)}return(await this.rawCall("aria2.tellStopped",e,t)).map(U)}async changePosition(e,t,n){return await this.rawCall("aria2.changePosition",e,t,n)}async changeUri(e,t,n,r,o){return await this.rawCall("aria2.changeUri",e,t,n,r,o)}async getOption(e){return D(await this.rawCall("aria2.getOption",e))}async changeOption(e,t){return await this.rawCall("aria2.changeOption",e,N(t))}async getGlobalOption(){return D(await this.rawCall("aria2.getGlobalOption"))}async changeGlobalOption(e){return await this.rawCall("aria2.changeGlobalOption",N(e))}async getGlobalStat(){return function(e){let t=Object.assign({},e);return t.downloadSpeed=_(e.downloadSpeed),t.uploadSpeed=_(e.uploadSpeed),t.numActive=T(e.numActive),t.numWaiting=T(e.numWaiting),t.numStopped=T(e.numStopped),t.numStoppedTotal=T(e.numStoppedTotal),t}(await this.rawCall("aria2.getGlobalStat"))}async purgeDownloadResult(){return await this.rawCall("aria2.purgeDownloadResult")}async removeDownloadResult(e){return await this.rawCall("aria2.removeDownloadResult",e)}async getVersion(){return await this.rawCall("aria2.getVersion")}async shutdown(){return await this.rawCall("aria2.shutdown")}async forceShutdown(){return await this.rawCall("aria2.forceShutdown")}async saveSession(){return await this.rawCall("aria2.saveSession")}async getSessionInfo(){return await this.rawCall("aria2.getSessioninfo")}async addUri(e,t,n){"string"==typeof e&&(e=[e]);let r=[e];if(null!=t&&r.push(N(t)),null!=t&&null!=n)r.push(n);else if(null!=n)throw"Require `options`!";return await this.rawCall("aria2.addUri",...r)}async addTorrent(e,t,n,r){e instanceof Buffer&&(e=e.toString("base64")),"string"==typeof t&&(t=[t]);let o=[e,t];if(null!=n&&o.push(n),null!=n&&null!=r)o.push(r);else if(null!=r)throw"Require `options`!";return await this.rawCall("aria2.addTorrent",...o)}onceDownloadStart(){return new Promise((e=>this.once("aria2.onDownloadStart",e)))}onceDownloadPause(){return new Promise((e=>this.once("aria2.onDownloadPause",e)))}onceDownloadStop(){return new Promise((e=>this.once("aria2.onDownloadStop",e)))}onceDownloadComplete(){return new Promise((e=>this.once("aria2.onDownloadComplete",e)))}onceDownloadError(){return new Promise((e=>this.once("aria2.onDownloadError",e)))}onceBtDownloadStart(){return new Promise((e=>this.once("aria2.onBtDownloadStart",e)))}}!function(e){e.Set="POS_SET",e.Cur="POS_CUR",e.End="POS_END"}(w||(w={})),function(e){e.Active="active",e.Waiting="waiting",e.Paused="paused",e.Error="error",e.Complete="complete",e.Removed="removed"}(v||(v={})),function(e){e.Waiting="waiting",e.Used="used"}(g||(g={})),function(e){e.Single="single",e.Multi="multi"}(y||(y={}));class W{constructor(t){e(this,"$client",void 0),this.$client=t}}var I,H=Object.freeze({__proto__:null,Aria2ClientBaseClass:J,get EAria2ChangePositionHow(){return w},get EAria2DownloadState(){return v},get EAria2UriStatusEnum(){return g},get EAria2DownloadBitTorrentMode(){return y},Aria2ClientSystemMethodsBaseClass:W});!function(e){e.atob=function(e){return Buffer.from(e,"base64").toString()},e.btoa=function(e){return Buffer.from(e).toString("base64")}}(I||(I={}));const V=()=>{var e,t;return"string"==typeof(null===globalThis||void 0===globalThis||null===(e=globalThis.process)||void 0===e||null===(t=e.versions)||void 0===t?void 0:t.node)},z=null!=globalThis.WebSocket?class extends globalThis.WebSocket{constructor(e){super(e)}}:require("ws"),G=(()=>{if(V())return I.btoa;if(null!=globalThis.btoa)return globalThis.btoa;throw new Error("`btoa()` is not defined!")})();(()=>{if(V())return I.atob;if(null!=globalThis.atob)return globalThis.atob;throw new Error("`atob()` is not defined!")})();var X=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},K=Object.prototype.toString;function Q(e){return"[object Array]"===K.call(e)}function Y(e){return void 0===e}function Z(e){return null!==e&&"object"==typeof e}function ee(e){if("[object Object]"!==K.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function te(e){return"[object Function]"===K.call(e)}function ne(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),Q(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var re={isArray:Q,isArrayBuffer:function(e){return"[object ArrayBuffer]"===K.call(e)},isBuffer:function(e){return null!==e&&!Y(e)&&null!==e.constructor&&!Y(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Z,isPlainObject:ee,isUndefined:Y,isDate:function(e){return"[object Date]"===K.call(e)},isFile:function(e){return"[object File]"===K.call(e)},isBlob:function(e){return"[object Blob]"===K.call(e)},isFunction:te,isStream:function(e){return Z(e)&&te(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:ne,merge:function e(){var t={};function n(n,r){ee(t[r])&&ee(n)?t[r]=e(t[r],n):ee(n)?t[r]=e({},n):Q(n)?t[r]=n.slice():t[r]=n}for(var r=0,o=arguments.length;r<o;r++)ne(arguments[r],n);return t},extend:function(e,t,n){return ne(t,(function(t,r){e[r]=n&&"function"==typeof t?X(t,n):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}};function oe(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var ie=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(re.isURLSearchParams(t))r=t.toString();else{var o=[];re.forEach(t,(function(e,t){null!=e&&(re.isArray(e)?t+="[]":e=[e],re.forEach(e,(function(e){re.isDate(e)?e=e.toISOString():re.isObject(e)&&(e=JSON.stringify(e)),o.push(oe(t)+"="+oe(e))})))})),r=o.join("&")}if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e};function ae(){this.handlers=[]}ae.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},ae.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},ae.prototype.forEach=function(e){re.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var se=ae,le=function(e,t){re.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},ue=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},ce=function(e,t,n,r,o){var i=new Error(e);return ue(i,t,n,r,o)},fe=re.isStandardBrowserEnv()?{write:function(e,t,n,r,o,i){var a=[];a.push(e+"="+encodeURIComponent(t)),re.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),re.isString(r)&&a.push("path="+r),re.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},de=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],pe=re.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=re.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0};function he(e){this.message=e}he.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},he.prototype.__CANCEL__=!0;var me=he,we=Ce,ve=function(e){return new Promise((function(t,n){var r,o=e.data,i=e.headers,a=e.responseType;function s(){e.cancelToken&&e.cancelToken.unsubscribe(r),e.signal&&e.signal.removeEventListener("abort",r)}re.isFormData(o)&&delete i["Content-Type"];var l=new XMLHttpRequest;if(e.auth){var u=e.auth.username||"",c=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.Authorization="Basic "+btoa(u+":"+c)}var f,d,p=(f=e.baseURL,d=e.url,f&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(d)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(f,d):d);function h(){if(l){var r="getAllResponseHeaders"in l?function(e){var t,n,r,o={};return e?(re.forEach(e.split("\n"),(function(e){if(r=e.indexOf(":"),t=re.trim(e.substr(0,r)).toLowerCase(),n=re.trim(e.substr(r+1)),t){if(o[t]&&de.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o}(l.getAllResponseHeaders()):null;!function(e,t,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(ce("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}((function(e){t(e),s()}),(function(e){n(e),s()}),{data:a&&"text"!==a&&"json"!==a?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:r,config:e,request:l}),l=null}}if(l.open(e.method.toUpperCase(),ie(p,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,"onloadend"in l?l.onloadend=h:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(h)},l.onabort=function(){l&&(n(ce("Request aborted",e,"ECONNABORTED",l)),l=null)},l.onerror=function(){n(ce("Network Error",e,null,l)),l=null},l.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded",r=e.transitional||we.transitional;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(ce(t,e,r.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",l)),l=null},re.isStandardBrowserEnv()){var m=(e.withCredentials||pe(p))&&e.xsrfCookieName?fe.read(e.xsrfCookieName):void 0;m&&(i[e.xsrfHeaderName]=m)}"setRequestHeader"in l&&re.forEach(i,(function(e,t){void 0===o&&"content-type"===t.toLowerCase()?delete i[t]:l.setRequestHeader(t,e)})),re.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),a&&"json"!==a&&(l.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(r=function(e){l&&(n(!e||e&&e.type?new me("canceled"):e),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(r),e.signal&&(e.signal.aborted?r():e.signal.addEventListener("abort",r))),o||(o=null),l.send(o)}))},ge={"Content-Type":"application/x-www-form-urlencoded"};function ye(e,t){!re.isUndefined(e)&&re.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var be={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:function(){var e;return("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(e=ve),e}(),transformRequest:[function(e,t){return le(t,"Accept"),le(t,"Content-Type"),re.isFormData(e)||re.isArrayBuffer(e)||re.isBuffer(e)||re.isStream(e)||re.isFile(e)||re.isBlob(e)?e:re.isArrayBufferView(e)?e.buffer:re.isURLSearchParams(e)?(ye(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):re.isObject(e)||t&&"application/json"===t["Content-Type"]?(ye(t,"application/json"),function(e,t,n){if(re.isString(e))try{return(t||JSON.parse)(e),re.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||be.transitional,n=t&&t.silentJSONParsing,r=t&&t.forcedJSONParsing,o=!n&&"json"===this.responseType;if(o||r&&re.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw ue(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};re.forEach(["delete","get","head"],(function(e){be.headers[e]={}})),re.forEach(["post","put","patch"],(function(e){be.headers[e]=re.merge(ge)}));var Ce=be,Se=function(e,t,n){var r=this||we;return re.forEach(n,(function(n){e=n.call(r,e,t)})),e},Ee=function(e){return!(!e||!e.__CANCEL__)};function Oe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new me("canceled")}var $e=function(e){return Oe(e),e.headers=e.headers||{},e.data=Se.call(e,e.data,e.headers,e.transformRequest),e.headers=re.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),re.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||we.adapter)(e).then((function(t){return Oe(e),t.data=Se.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return Ee(t)||(Oe(e),t&&t.response&&(t.response.data=Se.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Le=function(e,t){t=t||{};var n={};function r(e,t){return re.isPlainObject(e)&&re.isPlainObject(t)?re.merge(e,t):re.isPlainObject(t)?re.merge({},t):re.isArray(t)?t.slice():t}function o(n){return re.isUndefined(t[n])?re.isUndefined(e[n])?void 0:r(void 0,e[n]):r(e[n],t[n])}function i(e){if(!re.isUndefined(t[e]))return r(void 0,t[e])}function a(n){return re.isUndefined(t[n])?re.isUndefined(e[n])?void 0:r(void 0,e[n]):r(void 0,t[n])}function s(n){return n in t?r(e[n],t[n]):n in e?r(void 0,e[n]):void 0}var l={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s};return re.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=l[e]||o,r=t(e);re.isUndefined(r)&&t!==s||(n[e]=r)})),n},je="0.22.0",Pe=je,xe={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){xe[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var Re={};xe.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Pe+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,o,i){if(!1===e)throw new Error(r(o," has been removed"+(t?" in "+t:"")));return t&&!Re[o]&&(Re[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}};var ke={assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),o=r.length;o-- >0;){var i=r[o],a=t[i];if(a){var s=e[i],l=void 0===s||a(s,i,e);if(!0!==l)throw new TypeError("option "+i+" must be "+l)}else if(!0!==n)throw Error("Unknown option "+i)}},validators:xe},Ae=ke.validators;function Te(e){this.defaults=e,this.interceptors={request:new se,response:new se}}Te.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Le(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&ke.assertOptions(t,{silentJSONParsing:Ae.transitional(Ae.boolean),forcedJSONParsing:Ae.transitional(Ae.boolean),clarifyTimeoutError:Ae.transitional(Ae.boolean)},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var o,i=[];if(this.interceptors.response.forEach((function(e){i.push(e.fulfilled,e.rejected)})),!r){var a=[$e,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(i),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var s=e;n.length;){var l=n.shift(),u=n.shift();try{s=l(s)}catch(e){u(e);break}}try{o=$e(s)}catch(e){return Promise.reject(e)}for(;i.length;)o=o.then(i.shift(),i.shift());return o},Te.prototype.getUri=function(e){return e=Le(this.defaults,e),ie(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},re.forEach(["delete","get","head","options"],(function(e){Te.prototype[e]=function(t,n){return this.request(Le(n||{},{method:e,url:t,data:(n||{}).data}))}})),re.forEach(["post","put","patch"],(function(e){Te.prototype[e]=function(t,n,r){return this.request(Le(r||{},{method:e,url:t,data:n}))}}));var _e=Te;function Ne(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e){n.reason||(n.reason=new me(e),t(n.reason))}))}Ne.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Ne.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},Ne.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},Ne.source=function(){var e;return{token:new Ne((function(t){e=t})),cancel:e}};var De=Ne;var Ue=function e(t){var n=new _e(t),r=X(_e.prototype.request,n);return re.extend(r,_e.prototype,n),re.extend(r,n),r.create=function(n){return e(Le(t,n))},r}(we);Ue.Axios=_e,Ue.Cancel=me,Ue.CancelToken=De,Ue.isCancel=Ee,Ue.VERSION=je,Ue.all=function(e){return Promise.all(e)},Ue.spread=function(e){return function(t){return e.apply(null,t)}},Ue.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError};var Be=Ue,Me=Ue;Be.default=Me;var qe=Be;exports.WebSocket=void 0,function(t){t.Client=class extends J{constructor(t){var r,o,i;super(),e(this,"$ws",void 0),e(this,"$options",void 0),e(this,"$respCallbacks",new Map),e(this,"$openCallbacks",[]),e(this,"$opened",!1),e(this,"$waitOpened",(()=>new Promise(((e,t)=>{this.$opened&&1==this.$ws.readyState?e():this.$ws.readyState<1&&this.$ws.readyState>1?t(this.$ws.readyState):this.$openCallbacks.push(e)})))),e(this,"$sendRaw",(e=>new Promise(((t,n)=>{try{this.$ws.send(e)}catch(e){n(e)}})))),e(this,"$sendJson",((e,...t)=>new Promise((async(n,r)=>{var o,i;await this.$waitOpened();let a=l(),s={jsonrpc:"2.0",id:a,method:e,params:[]};null!=(null===(o=this.$options)||void 0===o||null===(i=o.auth)||void 0===i?void 0:i.secret)&&s.params.push("token:"+this.$options.auth.secret),s.params=[...s.params,...t],this.$respCallbacks.set(a,n),this.$sendRaw(JSON.stringify(s)).catch(r)})))),e(this,"$systemMethods",new n(this)),this.$options=Object.assign({},t),this.$ws=new z(`${null!==(r=t.protocol)&&void 0!==r?r:"ws"}://${t.host}:${t.port}${null!==(o=t.path)&&void 0!==o?o:"/jsonrpc"}`,V()?null!==(i=t.wsOptions)&&void 0!==i?i:{}:void 0),this.$ws.onclose=()=>{this.emit("ws.close"),this.$opened=!1,this.$openCallbacks=[]},this.$ws.onopen=()=>{for(this.emit("ws.open"),this.$opened=!0;this.$openCallbacks.length>0;){let e=this.$openCallbacks.pop();null!=e&&1==this.$ws.readyState&&e()}},this.$ws.onmessage=e=>{var t,n,r,o,i,a,s;("message"==(null===(t=e)||void 0===t?void 0:t.type)||V())&&(e=e.data);try{this.emit("ws.message",e);let t=JSON.parse(e.toString());if(t instanceof Array){let e=this.$respCallbacks.get(t[0].id);null!=e&&e(t),this.$respCallbacks.delete(t[0].id)}else if(null!=t.id&&this.$respCallbacks.has(null==t?void 0:t.id)){let e=this.$respCallbacks.get(t.id);null!=e&&e(t),this.$respCallbacks.delete(t.id)}else if(null!=t.method)switch(null==t?void 0:t.method){case"aria2.onDownloadStart":this.emit("aria2.onDownloadStart",{},...null!==(n=t.params)&&void 0!==n?n:[]);break;case"aria2.onDownloadPause":this.emit("aria2.onDownloadPause",{},...null!==(r=t.params)&&void 0!==r?r:[]);break;case"aria2.onDownloadStop":this.emit("aria2.onDownloadStop",{},...null!==(o=t.params)&&void 0!==o?o:[]);break;case"aria2.onDownloadComplete":this.emit("aria2.onDownloadComplete",{},...null!==(i=t.params)&&void 0!==i?i:[]);break;case"aria2.onDownloadError":this.emit("aria2.onDownloadError",{},...null!==(a=t.params)&&void 0!==a?a:[]);break;case"aria2.onBtDownloadComplete":this.emit("aria2.onBtDownloadComplete",{},...null!==(s=t.params)&&void 0!==s?s:[])}}catch(e){throw this.$errorHandle(e),e}}}$errorHandle(e){}get system(){return this.$systemMethods}async rawCall(e,...t){let n=await this.$sendJson(e,...t);if(null!=n.error)throw n.error;return n.result}async rawSend(e){return await this.$sendRaw(e)}async getCreateOptions(){return Object.freeze(this.$options)}async closeConnection(e,t){this.$ws.close(e,t)}};class n extends W{async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}multicall(...e){return new Promise((async(t,n)=>{var r;let o=l(),i=!1,a=[],s=await this.$client.getCreateOptions();var u;null!=(null==s||null===(r=s.auth)||void 0===r?void 0:r.secret)&&a.push("token:"+(null==s||null===(u=s.auth)||void 0===u?void 0:u.secret));let c=[];for(const t of e)1!=i?(c.push({jsonrpc:"2.0",id:o,method:t.methodName,params:[...a,...t.params]}),i=!0):c.push({jsonrpc:"2.0",id:l(),method:t.methodName,params:[...a,...t.params]});await this.$client.$waitOpened(),this.$client.$respCallbacks.set(o,(e=>{let n=[];for(const t of e)null!=t.error?n.push(Promise.reject(t.error)):n.push(Promise.resolve(t.result));t(n)})),this.$client.rawSend(JSON.stringify(c)).catch(n)}))}}t.SystemMethods=n}(exports.WebSocket||(exports.WebSocket={})),exports.Http=void 0,function(t){t.Client=class extends J{constructor(t){super(),e(this,"$options",void 0),e(this,"$system",void 0),this.$options=t,this.$system=new n(this)}onDownloadStart(){throw new Error("Method not implemented.")}onDownloadPause(){throw new Error("Method not implemented.")}onDownloadStop(){throw new Error("Method not implemented.")}onDownloadComplete(){throw new Error("Method not implemented.")}onDownloadError(){throw new Error("Method not implemented.")}onBtDownloadStart(){throw new Error("Method not implemented.")}get system(){return this.$system}async rawCall(e,...t){var n,r,o;let i=l(),a=[...t];null!=(null===(n=this.$options)||void 0===n||null===(r=n.auth)||void 0===r?void 0:r.secret)&&a.push("token:"+this.$options.auth.secret);let s=`${null!==(o=this.$options.protocol)&&void 0!==o?o:"http"}://${this.$options.host}:${this.$options.port}/jsonrpc?method=${decodeURIComponent(e)}&id=${decodeURIComponent(i)}¶ms=${G(JSON.stringify(a))}`,u=(await qe(s,{method:"GET",...this.$options.fetchOptions})).data;if(null==u.error)return u.result;throw u.error}async rawSend(e){throw new Error("Method not implemented.")}async getCreateOptions(){return this.$options}};class n extends W{async multicall(...e){let t={},n=[],r=[],o=await this.$client.getCreateOptions();for(const s of e){var i,a;let e=l(),u=[];null!=(null==o||null===(i=o.auth)||void 0===i?void 0:i.secret)&&u.push(null==o||null===(a=o.auth)||void 0===a?void 0:a.secret),n.push({jsonrpc:"2.0",id:e,params:[...u,...s.params],method:s.methodName}),r.push(new Promise(((n,r)=>{t[e]={r:n,j:r}})))}return new Promise((async()=>{var e;let r=`${null!==(e=o.protocol)&&void 0!==e?e:"http"}://${o.host}:${o.port}/jsonrpc?method=&id=¶ms=${G(JSON.stringify(n))}`,i=await qe(r,{method:"GET",...o.fetchOptions});for(const e of i.data)null!=e.id&&null!=t[e.id]&&(null!=e.error?t[e.id].j(e.error):t[e.id].r(e.result))})),r}async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}}t.SystemMethods=n}(exports.Http||(exports.Http={})),exports.Adapter=H; | ||
//# sourceMappingURL=libaria2.browser.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var t,n=new Uint8Array(16);function r(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(n)}var o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function i(e){return"string"==typeof e&&o.test(e)}for(var a=[],s=0;s<256;++s)a.push((s+256).toString(16).substr(1));function l(e,t,n){var o=(e=e||{}).random||(e.rng||r)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var s=0;s<16;++s)t[n+s]=o[s];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(a[e[t+0]]+a[e[t+1]]+a[e[t+2]]+a[e[t+3]]+"-"+a[e[t+4]]+a[e[t+5]]+"-"+a[e[t+6]]+a[e[t+7]]+"-"+a[e[t+8]]+a[e[t+9]]+"-"+a[e[t+10]]+a[e[t+11]]+a[e[t+12]]+a[e[t+13]]+a[e[t+14]]+a[e[t+15]]).toLowerCase();if(!i(n))throw TypeError("Stringified UUID is invalid");return n}(o)}var u,c="object"==typeof Reflect?Reflect:null,f=c&&"function"==typeof c.apply?c.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};u=c&&"function"==typeof c.ownKeys?c.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var d=Number.isNaN||function(e){return e!=e};function p(){p.init.call(this)}var h=p,m=function(e,t){return new Promise((function(n,r){function o(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}P(e,t,i,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&P(e,"error",t,n)}(e,o,{once:!0})}))};p.EventEmitter=p,p.prototype._events=void 0,p.prototype._eventsCount=0,p.prototype._maxListeners=void 0;var w,v,g,y,b=10;function C(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function S(e){return void 0===e._maxListeners?p.defaultMaxListeners:e._maxListeners}function E(e,t,n,r){var o,i,a,s;if(C(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),a=i[t]),void 0===a)a=i[t]=n,++e._eventsCount;else if("function"==typeof a?a=i[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=S(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function O(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function $(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=O.bind(r);return o.listener=n,r.wrapFn=o,o}function L(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(o):x(o,o.length)}function j(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function x(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function P(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){r.once&&e.removeEventListener(t,o),n(i)}))}}function R(e){return e.toString()}function A(e){return e.toString()}function D(e){if(/^(false|true)$/.test(e))return"true"==e;throw"Unknown Boolean Value: "+e}function k(e){return Number(e)}function N(e){return BigInt(e)}function T(e){let t={};for(const n in e)if(null!=e[n])if("string"==typeof e[n])t[n]=e[n];else if("boolean"==typeof e[n])t[n]=e[n].toString();else if("number"==typeof e[n])t[n]=A(e[n]);else{if("bigint"!=typeof e[n])throw"Unknown Value: "+e[n];t[n]=R(e[n])}return t}function U(e){let t={};for(const n in e)if(null!=e[n])if("string"==typeof e[n])t[n]=e[n];else if("boolean"==typeof e[n])t[n]=D(e[n]);else if("number"==typeof e[n])t[n]=k(e[n]);else{if("bigint"!=typeof e[n])throw"Unknown Value: "+e[n];t[n]=N(e[n])}return t}function _(e){let t=Object.assign({},e);if(null!=e.totalLength&&(t.totalLength=N(e.totalLength)),null!=e.totalLength&&(t.completedLength=N(e.completedLength)),null!=e.totalLength&&(t.uploadLength=N(e.uploadLength)),null!=e.totalLength&&(t.downloadSpeed=N(e.downloadSpeed)),null!=e.totalLength&&(t.uploadSpeed=N(e.uploadSpeed)),null!=e.numSeeders&&(t.numSeeders=N(e.numSeeders)),null!=e.seeder&&(t.seeder=D(e.seeder)),null!=e.totalLength&&(t.pieceLength=N(e.pieceLength)),null!=e.totalLength&&(t.numPieces=N(e.numPieces)),null!=e.totalLength&&(t.connections=N(e.connections)),null!=e.errorCode&&(t.errorCode=k(e.errorCode)),null!=e.bittorrent&&null!=e.bittorrent.creationDate&&(t.bittorrent.creationDate=N(e.bittorrent.creationDate)),null!=e.files)for(const n in e.files)t.files[n]=B(e.files[n]);return t}function B(e){let t=Object.assign({},e);return t.length=N(e.length),t.completedLength=N(e.completedLength),t.index=k(e.index),t.selected=D(e.selected),t}function M(e){let t=Object.assign({},e);return t.amChoking=D(e.amChoking),t.downloadSpeed=N(e.downloadSpeed),t.peerChoking=D(e.peerChoking),t.port=k(e.port),t.seeder=D(e.seeder),t.uploadSpeed=N(e.uploadSpeed),t}function q(e){let t=Object.assign({},e);return t.downloadSpeed=N(e.downloadSpeed),t}function F(e){let t=Object.assign({},e);t.index=k(e.index);for(const n in e.servers)t.servers[n]=q(e.servers[n]);return t}Object.defineProperty(p,"defaultMaxListeners",{enumerable:!0,get:function(){return b},set:function(e){if("number"!=typeof e||e<0||d(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");b=e}}),p.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},p.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||d(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},p.prototype.getMaxListeners=function(){return S(this)},p.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var s=o[e];if(void 0===s)return!1;if("function"==typeof s)f(s,this,t);else{var l=s.length,u=x(s,l);for(n=0;n<l;++n)f(u[n],this,t)}return!0},p.prototype.addListener=function(e,t){return E(this,e,t,!1)},p.prototype.on=p.prototype.addListener,p.prototype.prependListener=function(e,t){return E(this,e,t,!0)},p.prototype.once=function(e,t){return C(t),this.on(e,$(this,e,t)),this},p.prototype.prependOnceListener=function(e,t){return C(t),this.prependListener(e,$(this,e,t)),this},p.prototype.removeListener=function(e,t){var n,r,o,i,a;if(C(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,o),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},p.prototype.off=p.prototype.removeListener,p.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var o,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(o=i[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},p.prototype.listeners=function(e){return L(this,e,!0)},p.prototype.rawListeners=function(e){return L(this,e,!1)},p.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):j.call(e,t)},p.prototype.listenerCount=j,p.prototype.eventNames=function(){return this._eventsCount>0?u(this._events):[]},h.once=m;class I extends h.EventEmitter{constructor(){super()}async addMetalink(e,t,n){var r;null!==(r=process.versions.node)&&void 0!==r&&r&&e instanceof Buffer&&(e=e.toString("base64"));let o=[e];if(null!=t&&o.push(t),null!=t&&null!=n)o.push(n);else if(null!=n)throw"Require `options`!";return await this.rawCall("aria2.addMetalink",...o)}async remove(e){return await this.rawCall("aria2.remove",e)}async forceRemove(e){return await this.rawCall("aria2.forceRemove",e)}async pause(e){return await this.rawCall("aria2.pause",e)}async forcePause(e){return await this.rawCall("aria2.forcePause",e)}async pauseAll(){return await this.rawCall("aria2.pauseAll")}async forcePauseAll(){return await this.rawCall("aria2.forcePauseAll")}async unpause(e){return await this.rawCall("aria2.unpause",e)}async unpauseAll(){return await this.rawCall("aria2.unpauseAll")}async tellStatus(e,t){if(null!=t){return _(await this.rawCall("aria2.tellStatus",e,t))}return _(await this.rawCall("aria2.tellStatus",e))}async getUris(e){return await this.rawCall("aria2.getUris",e)}async getFiles(e){return await this.rawCall("aria2.getFiles",e)}async getPeers(e){return(await this.rawCall("aria2.getPeers",e)).map(M)}async getServers(e){return(await this.rawCall("aria2.getServers",e)).map(F)}async tellActive(e){if(null!=e){return(await this.rawCall("aria2.tellActive",e)).map(_)}return(await this.rawCall("aria2.tellActive")).map(_)}async tellWaiting(e,t,n){if(null!=n){return(await this.rawCall("aria2.tellWaiting",e,t,n)).map(_)}return(await this.rawCall("aria2.tellWaiting",e,t)).map(_)}async tellStopped(e,t,n){if(null!=n){return(await this.rawCall("aria2.tellStopped",e,t,n)).map(_)}return(await this.rawCall("aria2.tellStopped",e,t)).map(_)}async changePosition(e,t,n){return await this.rawCall("aria2.changePosition",e,t,n)}async changeUri(e,t,n,r,o){return await this.rawCall("aria2.changeUri",e,t,n,r,o)}async getOption(e){return U(await this.rawCall("aria2.getOption",e))}async changeOption(e,t){return await this.rawCall("aria2.changeOption",e,T(t))}async getGlobalOption(){return U(await this.rawCall("aria2.getGlobalOption"))}async changeGlobalOption(e){return await this.rawCall("aria2.changeGlobalOption",T(e))}async getGlobalStat(){return function(e){let t=Object.assign({},e);return t.downloadSpeed=N(e.downloadSpeed),t.uploadSpeed=N(e.uploadSpeed),t.numActive=k(e.numActive),t.numWaiting=k(e.numWaiting),t.numStopped=k(e.numStopped),t.numStoppedTotal=k(e.numStoppedTotal),t}(await this.rawCall("aria2.getGlobalStat"))}async purgeDownloadResult(){return await this.rawCall("aria2.purgeDownloadResult")}async removeDownloadResult(e){return await this.rawCall("aria2.removeDownloadResult",e)}async getVersion(){return await this.rawCall("aria2.getVersion")}async shutdown(){return await this.rawCall("aria2.shutdown")}async forceShutdown(){return await this.rawCall("aria2.forceShutdown")}async saveSession(){return await this.rawCall("aria2.saveSession")}async getSessionInfo(){return await this.rawCall("aria2.getSessioninfo")}async addUri(e,t,n){"string"==typeof e&&(e=[e]);let r=[e];if(null!=t&&r.push(T(t)),null!=t&&null!=n)r.push(n);else if(null!=n)throw"Require `options`!";return await this.rawCall("aria2.addUri",...r)}async addTorrent(e,t,n,r){e instanceof Buffer&&(e=e.toString("base64")),"string"==typeof t&&(t=[t]);let o=[e,t];if(null!=n&&o.push(n),null!=n&&null!=r)o.push(r);else if(null!=r)throw"Require `options`!";return await this.rawCall("aria2.addTorrent",...o)}onceDownloadStart(){return new Promise((e=>this.once("aria2.onDownloadStart",e)))}onceDownloadPause(){return new Promise((e=>this.once("aria2.onDownloadPause",e)))}onceDownloadStop(){return new Promise((e=>this.once("aria2.onDownloadStop",e)))}onceDownloadComplete(){return new Promise((e=>this.once("aria2.onDownloadComplete",e)))}onceDownloadError(){return new Promise((e=>this.once("aria2.onDownloadError",e)))}onceBtDownloadStart(){return new Promise((e=>this.once("aria2.onBtDownloadStart",e)))}}!function(e){e.Set="POS_SET",e.Cur="POS_CUR",e.End="POS_END"}(w||(w={})),function(e){e.Active="active",e.Waiting="waiting",e.Paused="paused",e.Error="error",e.Complete="complete",e.Removed="removed"}(v||(v={})),function(e){e.Waiting="waiting",e.Used="used"}(g||(g={})),function(e){e.Single="single",e.Multi="multi"}(y||(y={}));class V{constructor(t){e(this,"$client",void 0),this.$client=t}}var H,J=Object.freeze({__proto__:null,Aria2ClientBaseClass:I,get EAria2ChangePositionHow(){return w},get EAria2DownloadState(){return v},get EAria2UriStatusEnum(){return g},get EAria2DownloadBitTorrentMode(){return y},Aria2ClientSystemMethodsBaseClass:V});!function(e){e.atob=function(e){return Buffer.from(e,"base64").toString()},e.btoa=function(e){return Buffer.from(e).toString("base64")}}(H||(H={}));const W=()=>{var e,t;return"string"==typeof(null===globalThis||void 0===globalThis||null===(e=globalThis.process)||void 0===e||null===(t=e.versions)||void 0===t?void 0:t.node)},z=null!=globalThis.WebSocket?class extends globalThis.WebSocket{constructor(e){super(e)}}:require("ws"),G=(()=>{if(W())return H.btoa;if(null!=globalThis.btoa)return globalThis.btoa;throw new Error("`btoa()` is not defined!")})();(()=>{if(W())return H.atob;if(null!=globalThis.atob)return globalThis.atob;throw new Error("`atob()` is not defined!")})();var X=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},K=Object.prototype.toString;function Q(e){return"[object Array]"===K.call(e)}function Y(e){return void 0===e}function Z(e){return null!==e&&"object"==typeof e}function ee(e){if("[object Object]"!==K.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function te(e){return"[object Function]"===K.call(e)}function ne(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),Q(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var re={isArray:Q,isArrayBuffer:function(e){return"[object ArrayBuffer]"===K.call(e)},isBuffer:function(e){return null!==e&&!Y(e)&&null!==e.constructor&&!Y(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Z,isPlainObject:ee,isUndefined:Y,isDate:function(e){return"[object Date]"===K.call(e)},isFile:function(e){return"[object File]"===K.call(e)},isBlob:function(e){return"[object Blob]"===K.call(e)},isFunction:te,isStream:function(e){return Z(e)&&te(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:ne,merge:function e(){var t={};function n(n,r){ee(t[r])&&ee(n)?t[r]=e(t[r],n):ee(n)?t[r]=e({},n):Q(n)?t[r]=n.slice():t[r]=n}for(var r=0,o=arguments.length;r<o;r++)ne(arguments[r],n);return t},extend:function(e,t,n){return ne(t,(function(t,r){e[r]=n&&"function"==typeof t?X(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}};function oe(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var ie=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(re.isURLSearchParams(t))r=t.toString();else{var o=[];re.forEach(t,(function(e,t){null!=e&&(re.isArray(e)?t+="[]":e=[e],re.forEach(e,(function(e){re.isDate(e)?e=e.toISOString():re.isObject(e)&&(e=JSON.stringify(e)),o.push(oe(t)+"="+oe(e))})))})),r=o.join("&")}if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e};function ae(){this.handlers=[]}ae.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},ae.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},ae.prototype.forEach=function(e){re.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var se=ae,le=function(e,t,n){return re.forEach(n,(function(n){e=n(e,t)})),e},ue=function(e){return!(!e||!e.__CANCEL__)},ce=function(e,t){re.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},fe=function(e,t,n,r,o){return function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}(new Error(e),t,n,r,o)},de=re.isStandardBrowserEnv()?{write:function(e,t,n,r,o,i){var a=[];a.push(e+"="+encodeURIComponent(t)),re.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),re.isString(r)&&a.push("path="+r),re.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},pe=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],he=re.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=re.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},me=function(e){return new Promise((function(t,n){var r=e.data,o=e.headers;re.isFormData(r)&&delete o["Content-Type"];var i=new XMLHttpRequest;if(e.auth){var a=e.auth.username||"",s=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(a+":"+s)}var l,u,c=(l=e.baseURL,u=e.url,l&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(u)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(l,u):u);if(i.open(e.method.toUpperCase(),ie(c,e.params,e.paramsSerializer),!0),i.timeout=e.timeout,i.onreadystatechange=function(){if(i&&4===i.readyState&&(0!==i.status||i.responseURL&&0===i.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in i?function(e){var t,n,r,o={};return e?(re.forEach(e.split("\n"),(function(e){if(r=e.indexOf(":"),t=re.trim(e.substr(0,r)).toLowerCase(),n=re.trim(e.substr(r+1)),t){if(o[t]&&pe.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o}(i.getAllResponseHeaders()):null,o={data:e.responseType&&"text"!==e.responseType?i.response:i.responseText,status:i.status,statusText:i.statusText,headers:r,config:e,request:i};!function(e,t,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(fe("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}(t,n,o),i=null}},i.onabort=function(){i&&(n(fe("Request aborted",e,"ECONNABORTED",i)),i=null)},i.onerror=function(){n(fe("Network Error",e,null,i)),i=null},i.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(fe(t,e,"ECONNABORTED",i)),i=null},re.isStandardBrowserEnv()){var f=(e.withCredentials||he(c))&&e.xsrfCookieName?de.read(e.xsrfCookieName):void 0;f&&(o[e.xsrfHeaderName]=f)}if("setRequestHeader"in i&&re.forEach(o,(function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete o[t]:i.setRequestHeader(t,e)})),re.isUndefined(e.withCredentials)||(i.withCredentials=!!e.withCredentials),e.responseType)try{i.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&i.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&i.upload&&i.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){i&&(i.abort(),n(e),i=null)})),r||(r=null),i.send(r)}))},we={"Content-Type":"application/x-www-form-urlencoded"};function ve(e,t){!re.isUndefined(e)&&re.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var ge={adapter:function(){var e;return("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(e=me),e}(),transformRequest:[function(e,t){return ce(t,"Accept"),ce(t,"Content-Type"),re.isFormData(e)||re.isArrayBuffer(e)||re.isBuffer(e)||re.isStream(e)||re.isFile(e)||re.isBlob(e)?e:re.isArrayBufferView(e)?e.buffer:re.isURLSearchParams(e)?(ve(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):re.isObject(e)?(ve(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};re.forEach(["delete","get","head"],(function(e){ge.headers[e]={}})),re.forEach(["post","put","patch"],(function(e){ge.headers[e]=re.merge(we)}));var ye=ge;function be(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var Ce=function(e){return be(e),e.headers=e.headers||{},e.data=le(e.data,e.headers,e.transformRequest),e.headers=re.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),re.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||ye.adapter)(e).then((function(t){return be(e),t.data=le(t.data,t.headers,e.transformResponse),t}),(function(t){return ue(t)||(be(e),t&&t.response&&(t.response.data=le(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Se=function(e,t){t=t||{};var n={},r=["url","method","data"],o=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function s(e,t){return re.isPlainObject(e)&&re.isPlainObject(t)?re.merge(e,t):re.isPlainObject(t)?re.merge({},t):re.isArray(t)?t.slice():t}function l(r){re.isUndefined(t[r])?re.isUndefined(e[r])||(n[r]=s(void 0,e[r])):n[r]=s(e[r],t[r])}re.forEach(r,(function(e){re.isUndefined(t[e])||(n[e]=s(void 0,t[e]))})),re.forEach(o,l),re.forEach(i,(function(r){re.isUndefined(t[r])?re.isUndefined(e[r])||(n[r]=s(void 0,e[r])):n[r]=s(void 0,t[r])})),re.forEach(a,(function(r){r in t?n[r]=s(e[r],t[r]):r in e&&(n[r]=s(void 0,e[r]))}));var u=r.concat(o).concat(i).concat(a),c=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===u.indexOf(e)}));return re.forEach(c,l),n};function Ee(e){this.defaults=e,this.interceptors={request:new se,response:new se}}Ee.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Se(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[Ce,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},Ee.prototype.getUri=function(e){return e=Se(this.defaults,e),ie(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},re.forEach(["delete","get","head","options"],(function(e){Ee.prototype[e]=function(t,n){return this.request(Se(n||{},{method:e,url:t,data:(n||{}).data}))}})),re.forEach(["post","put","patch"],(function(e){Ee.prototype[e]=function(t,n,r){return this.request(Se(r||{},{method:e,url:t,data:n}))}}));var Oe=Ee;function $e(e){this.message=e}$e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},$e.prototype.__CANCEL__=!0;var Le=$e;function je(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new Le(e),t(n.reason))}))}je.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},je.source=function(){var e;return{token:new je((function(t){e=t})),cancel:e}};var xe=je;function Pe(e){var t=new Oe(e),n=X(Oe.prototype.request,t);return re.extend(n,Oe.prototype,t),re.extend(n,t),n}var Re=Pe(ye);Re.Axios=Oe,Re.create=function(e){return Pe(Se(Re.defaults,e))},Re.Cancel=Le,Re.CancelToken=xe,Re.isCancel=ue,Re.all=function(e){return Promise.all(e)},Re.spread=function(e){return function(t){return e.apply(null,t)}},Re.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError};var Ae=Re,De=Re;Ae.default=De;var ke,Ne,Te=Ae;!function(t){t.Client=class extends I{constructor(t){var r,o,i;super(),e(this,"$ws",void 0),e(this,"$options",void 0),e(this,"$respCallbacks",new Map),e(this,"$openCallbacks",[]),e(this,"$opened",!1),e(this,"$waitOpened",(()=>new Promise(((e,t)=>{this.$opened&&1==this.$ws.readyState?e():this.$ws.readyState<1&&this.$ws.readyState>1?t(this.$ws.readyState):this.$openCallbacks.push(e)})))),e(this,"$sendRaw",(e=>new Promise(((t,n)=>{try{this.$ws.send(e)}catch(e){n(e)}})))),e(this,"$sendJson",((e,...t)=>new Promise((async(n,r)=>{var o,i;await this.$waitOpened();let a=l(),s={jsonrpc:"2.0",id:a,method:e,params:[]};null!=(null===(o=this.$options)||void 0===o||null===(i=o.auth)||void 0===i?void 0:i.secret)&&s.params.push("token:"+this.$options.auth.secret),s.params=[...s.params,...t],this.$respCallbacks.set(a,n),this.$sendRaw(JSON.stringify(s)).catch(r)})))),e(this,"$systemMethods",new n(this)),this.$options=Object.assign({},t),this.$ws=new z(`${null!==(r=t.protocol)&&void 0!==r?r:"ws"}://${t.host}:${t.port}${null!==(o=t.path)&&void 0!==o?o:"/jsonrpc"}`,W()?null!==(i=t.wsOptions)&&void 0!==i?i:{}:void 0),this.$ws.onclose=()=>{this.emit("ws.close"),this.$opened=!1,this.$openCallbacks=[]},this.$ws.onopen=()=>{for(this.emit("ws.open"),this.$opened=!0;this.$openCallbacks.length>0;){let e=this.$openCallbacks.pop();null!=e&&1==this.$ws.readyState&&e()}},this.$ws.onmessage=e=>{var t,n,r,o,i,a,s;("message"==(null===(t=e)||void 0===t?void 0:t.type)||W())&&(e=e.data);try{this.emit("ws.message",e);let t=JSON.parse(e.toString());if(t instanceof Array){let e=this.$respCallbacks.get(t[0].id);null!=e&&e(t),this.$respCallbacks.delete(t[0].id)}else if(null!=t.id&&this.$respCallbacks.has(null==t?void 0:t.id)){let e=this.$respCallbacks.get(t.id);null!=e&&e(t),this.$respCallbacks.delete(t.id)}else if(null!=t.method)switch(null==t?void 0:t.method){case"aria2.onDownloadStart":this.emit("aria2.onDownloadStart",{},...null!==(n=t.params)&&void 0!==n?n:[]);break;case"aria2.onDownloadPause":this.emit("aria2.onDownloadPause",{},...null!==(r=t.params)&&void 0!==r?r:[]);break;case"aria2.onDownloadStop":this.emit("aria2.onDownloadStop",{},...null!==(o=t.params)&&void 0!==o?o:[]);break;case"aria2.onDownloadComplete":this.emit("aria2.onDownloadComplete",{},...null!==(i=t.params)&&void 0!==i?i:[]);break;case"aria2.onDownloadError":this.emit("aria2.onDownloadError",{},...null!==(a=t.params)&&void 0!==a?a:[]);break;case"aria2.onBtDownloadComplete":this.emit("aria2.onBtDownloadComplete",{},...null!==(s=t.params)&&void 0!==s?s:[])}}catch(e){throw this.$errorHandle(e),e}}}$errorHandle(e){}get system(){return this.$systemMethods}async rawCall(e,...t){let n=await this.$sendJson(e,...t);if(null!=n.error)throw n.error;return n.result}async rawSend(e){return await this.$sendRaw(e)}async getCreateOptions(){return Object.freeze(this.$options)}async closeConnection(e,t){this.$ws.close(e,t)}};class n extends V{async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}multicall(...e){return new Promise((async(t,n)=>{var r;let o=l(),i=!1,a=[],s=await this.$client.getCreateOptions();var u;null!=(null==s||null===(r=s.auth)||void 0===r?void 0:r.secret)&&a.push("token:"+(null==s||null===(u=s.auth)||void 0===u?void 0:u.secret));let c=[];for(const t of e)1!=i?(c.push({jsonrpc:"2.0",id:o,method:t.methodName,params:[...a,...t.params]}),i=!0):c.push({jsonrpc:"2.0",id:l(),method:t.methodName,params:[...a,...t.params]});await this.$client.$waitOpened(),this.$client.$respCallbacks.set(o,(e=>{let n=[];for(const t of e)null!=t.error?n.push(Promise.reject(t.error)):n.push(Promise.resolve(t.result));t(n)})),this.$client.rawSend(JSON.stringify(c)).catch(n)}))}}t.SystemMethods=n}(ke||(ke={})),function(t){t.Client=class extends I{constructor(t){super(),e(this,"$options",void 0),e(this,"$system",void 0),this.$options=t,this.$system=new n(this)}onDownloadStart(){throw new Error("Method not implemented.")}onDownloadPause(){throw new Error("Method not implemented.")}onDownloadStop(){throw new Error("Method not implemented.")}onDownloadComplete(){throw new Error("Method not implemented.")}onDownloadError(){throw new Error("Method not implemented.")}onBtDownloadStart(){throw new Error("Method not implemented.")}get system(){return this.$system}async rawCall(e,...t){var n,r,o;let i=l(),a=[...t];null!=(null===(n=this.$options)||void 0===n||null===(r=n.auth)||void 0===r?void 0:r.secret)&&a.push("token:"+this.$options.auth.secret);let s=`${null!==(o=this.$options.protocol)&&void 0!==o?o:"http"}://${this.$options.host}:${this.$options.port}/jsonrpc?method=${decodeURIComponent(e)}&id=${decodeURIComponent(i)}¶ms=${G(JSON.stringify(a))}`,u=(await Te(s,{method:"GET",...this.$options.fetchOptions})).data;if(null==u.error)return u.result;throw u.error}async rawSend(e){throw new Error("Method not implemented.")}async getCreateOptions(){return this.$options}};class n extends V{async multicall(...e){let t={},n=[],r=[],o=await this.$client.getCreateOptions();for(const s of e){var i,a;let e=l(),u=[];null!=(null==o||null===(i=o.auth)||void 0===i?void 0:i.secret)&&u.push(null==o||null===(a=o.auth)||void 0===a?void 0:a.secret),n.push({jsonrpc:"2.0",id:e,params:[...u,...s.params],method:s.methodName}),r.push(new Promise(((n,r)=>{t[e]={r:n,j:r}})))}return new Promise((async()=>{var e;let r=`${null!==(e=o.protocol)&&void 0!==e?e:"http"}://${o.host}:${o.port}/jsonrpc?method=&id=¶ms=${G(JSON.stringify(n))}`,i=await Te(r,{method:"GET",...o.fetchOptions});for(const e of i.data)null!=e.id&&null!=t[e.id]&&(null!=e.error?t[e.id].j(e.error):t[e.id].r(e.result))})),r}async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}}t.SystemMethods=n}(Ne||(Ne={}));export{J as Adapter,Ne as Http,ke as WebSocket}; | ||
function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var t,n=new Uint8Array(16);function r(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(n)}var o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function i(e){return"string"==typeof e&&o.test(e)}for(var a=[],s=0;s<256;++s)a.push((s+256).toString(16).substr(1));function l(e,t,n){var o=(e=e||{}).random||(e.rng||r)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var s=0;s<16;++s)t[n+s]=o[s];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(a[e[t+0]]+a[e[t+1]]+a[e[t+2]]+a[e[t+3]]+"-"+a[e[t+4]]+a[e[t+5]]+"-"+a[e[t+6]]+a[e[t+7]]+"-"+a[e[t+8]]+a[e[t+9]]+"-"+a[e[t+10]]+a[e[t+11]]+a[e[t+12]]+a[e[t+13]]+a[e[t+14]]+a[e[t+15]]).toLowerCase();if(!i(n))throw TypeError("Stringified UUID is invalid");return n}(o)}var u,c="object"==typeof Reflect?Reflect:null,f=c&&"function"==typeof c.apply?c.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};u=c&&"function"==typeof c.ownKeys?c.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var d=Number.isNaN||function(e){return e!=e};function h(){h.init.call(this)}var p=h,m=function(e,t){return new Promise((function(n,r){function o(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}x(e,t,i,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&x(e,"error",t,n)}(e,o,{once:!0})}))};h.EventEmitter=h,h.prototype._events=void 0,h.prototype._eventsCount=0,h.prototype._maxListeners=void 0;var w,v,g,y,b=10;function C(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function S(e){return void 0===e._maxListeners?h.defaultMaxListeners:e._maxListeners}function E(e,t,n,r){var o,i,a,s;if(C(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),a=i[t]),void 0===a)a=i[t]=n,++e._eventsCount;else if("function"==typeof a?a=i[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(o=S(e))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function O(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function $(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=O.bind(r);return o.listener=n,r.wrapFn=o,o}function L(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(o):P(o,o.length)}function j(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function P(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function x(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){r.once&&e.removeEventListener(t,o),n(i)}))}}function R(e){return e.toString()}function A(e){return e.toString()}function k(e){if(/^(false|true)$/.test(e))return"true"==e;throw"Unknown Boolean Value: "+e}function T(e){return Number(e)}function N(e){return BigInt(e)}function _(e){let t={};for(const n in e)if(null!=e[n])if("string"==typeof e[n])t[n]=e[n];else if("boolean"==typeof e[n])t[n]=e[n].toString();else if("number"==typeof e[n])t[n]=A(e[n]);else{if("bigint"!=typeof e[n])throw"Unknown Value: "+e[n];t[n]=R(e[n])}return t}function D(e){let t={};for(const n in e)if(null!=e[n])if("string"==typeof e[n])t[n]=e[n];else if("boolean"==typeof e[n])t[n]=k(e[n]);else if("number"==typeof e[n])t[n]=T(e[n]);else{if("bigint"!=typeof e[n])throw"Unknown Value: "+e[n];t[n]=N(e[n])}return t}function U(e){let t=Object.assign({},e);if(null!=e.totalLength&&(t.totalLength=N(e.totalLength)),null!=e.totalLength&&(t.completedLength=N(e.completedLength)),null!=e.totalLength&&(t.uploadLength=N(e.uploadLength)),null!=e.totalLength&&(t.downloadSpeed=N(e.downloadSpeed)),null!=e.totalLength&&(t.uploadSpeed=N(e.uploadSpeed)),null!=e.numSeeders&&(t.numSeeders=N(e.numSeeders)),null!=e.seeder&&(t.seeder=k(e.seeder)),null!=e.totalLength&&(t.pieceLength=N(e.pieceLength)),null!=e.totalLength&&(t.numPieces=N(e.numPieces)),null!=e.totalLength&&(t.connections=N(e.connections)),null!=e.errorCode&&(t.errorCode=T(e.errorCode)),null!=e.bittorrent&&null!=e.bittorrent.creationDate&&(t.bittorrent.creationDate=N(e.bittorrent.creationDate)),null!=e.files)for(const n in e.files)t.files[n]=B(e.files[n]);return t}function B(e){let t=Object.assign({},e);return t.length=N(e.length),t.completedLength=N(e.completedLength),t.index=T(e.index),t.selected=k(e.selected),t}function M(e){let t=Object.assign({},e);return t.amChoking=k(e.amChoking),t.downloadSpeed=N(e.downloadSpeed),t.peerChoking=k(e.peerChoking),t.port=T(e.port),t.seeder=k(e.seeder),t.uploadSpeed=N(e.uploadSpeed),t}function q(e){let t=Object.assign({},e);return t.downloadSpeed=N(e.downloadSpeed),t}function F(e){let t=Object.assign({},e);t.index=T(e.index);for(const n in e.servers)t.servers[n]=q(e.servers[n]);return t}Object.defineProperty(h,"defaultMaxListeners",{enumerable:!0,get:function(){return b},set:function(e){if("number"!=typeof e||e<0||d(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");b=e}}),h.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},h.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||d(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},h.prototype.getMaxListeners=function(){return S(this)},h.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var s=o[e];if(void 0===s)return!1;if("function"==typeof s)f(s,this,t);else{var l=s.length,u=P(s,l);for(n=0;n<l;++n)f(u[n],this,t)}return!0},h.prototype.addListener=function(e,t){return E(this,e,t,!1)},h.prototype.on=h.prototype.addListener,h.prototype.prependListener=function(e,t){return E(this,e,t,!0)},h.prototype.once=function(e,t){return C(t),this.on(e,$(this,e,t)),this},h.prototype.prependOnceListener=function(e,t){return C(t),this.prependListener(e,$(this,e,t)),this},h.prototype.removeListener=function(e,t){var n,r,o,i,a;if(C(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,o),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},h.prototype.off=h.prototype.removeListener,h.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var o,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(o=i[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},h.prototype.listeners=function(e){return L(this,e,!0)},h.prototype.rawListeners=function(e){return L(this,e,!1)},h.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):j.call(e,t)},h.prototype.listenerCount=j,h.prototype.eventNames=function(){return this._eventsCount>0?u(this._events):[]},p.once=m;class J extends p.EventEmitter{constructor(){super()}async addMetalink(e,t,n){var r;null!==(r=process.versions.node)&&void 0!==r&&r&&e instanceof Buffer&&(e=e.toString("base64"));let o=[e];if(null!=t&&o.push(t),null!=t&&null!=n)o.push(n);else if(null!=n)throw"Require `options`!";return await this.rawCall("aria2.addMetalink",...o)}async remove(e){return await this.rawCall("aria2.remove",e)}async forceRemove(e){return await this.rawCall("aria2.forceRemove",e)}async pause(e){return await this.rawCall("aria2.pause",e)}async forcePause(e){return await this.rawCall("aria2.forcePause",e)}async pauseAll(){return await this.rawCall("aria2.pauseAll")}async forcePauseAll(){return await this.rawCall("aria2.forcePauseAll")}async unpause(e){return await this.rawCall("aria2.unpause",e)}async unpauseAll(){return await this.rawCall("aria2.unpauseAll")}async tellStatus(e,t){if(null!=t){return U(await this.rawCall("aria2.tellStatus",e,t))}return U(await this.rawCall("aria2.tellStatus",e))}async getUris(e){return await this.rawCall("aria2.getUris",e)}async getFiles(e){return await this.rawCall("aria2.getFiles",e)}async getPeers(e){return(await this.rawCall("aria2.getPeers",e)).map(M)}async getServers(e){return(await this.rawCall("aria2.getServers",e)).map(F)}async tellActive(e){if(null!=e){return(await this.rawCall("aria2.tellActive",e)).map(U)}return(await this.rawCall("aria2.tellActive")).map(U)}async tellWaiting(e,t,n){if(null!=n){return(await this.rawCall("aria2.tellWaiting",e,t,n)).map(U)}return(await this.rawCall("aria2.tellWaiting",e,t)).map(U)}async tellStopped(e,t,n){if(null!=n){return(await this.rawCall("aria2.tellStopped",e,t,n)).map(U)}return(await this.rawCall("aria2.tellStopped",e,t)).map(U)}async changePosition(e,t,n){return await this.rawCall("aria2.changePosition",e,t,n)}async changeUri(e,t,n,r,o){return await this.rawCall("aria2.changeUri",e,t,n,r,o)}async getOption(e){return D(await this.rawCall("aria2.getOption",e))}async changeOption(e,t){return await this.rawCall("aria2.changeOption",e,_(t))}async getGlobalOption(){return D(await this.rawCall("aria2.getGlobalOption"))}async changeGlobalOption(e){return await this.rawCall("aria2.changeGlobalOption",_(e))}async getGlobalStat(){return function(e){let t=Object.assign({},e);return t.downloadSpeed=N(e.downloadSpeed),t.uploadSpeed=N(e.uploadSpeed),t.numActive=T(e.numActive),t.numWaiting=T(e.numWaiting),t.numStopped=T(e.numStopped),t.numStoppedTotal=T(e.numStoppedTotal),t}(await this.rawCall("aria2.getGlobalStat"))}async purgeDownloadResult(){return await this.rawCall("aria2.purgeDownloadResult")}async removeDownloadResult(e){return await this.rawCall("aria2.removeDownloadResult",e)}async getVersion(){return await this.rawCall("aria2.getVersion")}async shutdown(){return await this.rawCall("aria2.shutdown")}async forceShutdown(){return await this.rawCall("aria2.forceShutdown")}async saveSession(){return await this.rawCall("aria2.saveSession")}async getSessionInfo(){return await this.rawCall("aria2.getSessioninfo")}async addUri(e,t,n){"string"==typeof e&&(e=[e]);let r=[e];if(null!=t&&r.push(_(t)),null!=t&&null!=n)r.push(n);else if(null!=n)throw"Require `options`!";return await this.rawCall("aria2.addUri",...r)}async addTorrent(e,t,n,r){e instanceof Buffer&&(e=e.toString("base64")),"string"==typeof t&&(t=[t]);let o=[e,t];if(null!=n&&o.push(n),null!=n&&null!=r)o.push(r);else if(null!=r)throw"Require `options`!";return await this.rawCall("aria2.addTorrent",...o)}onceDownloadStart(){return new Promise((e=>this.once("aria2.onDownloadStart",e)))}onceDownloadPause(){return new Promise((e=>this.once("aria2.onDownloadPause",e)))}onceDownloadStop(){return new Promise((e=>this.once("aria2.onDownloadStop",e)))}onceDownloadComplete(){return new Promise((e=>this.once("aria2.onDownloadComplete",e)))}onceDownloadError(){return new Promise((e=>this.once("aria2.onDownloadError",e)))}onceBtDownloadStart(){return new Promise((e=>this.once("aria2.onBtDownloadStart",e)))}}!function(e){e.Set="POS_SET",e.Cur="POS_CUR",e.End="POS_END"}(w||(w={})),function(e){e.Active="active",e.Waiting="waiting",e.Paused="paused",e.Error="error",e.Complete="complete",e.Removed="removed"}(v||(v={})),function(e){e.Waiting="waiting",e.Used="used"}(g||(g={})),function(e){e.Single="single",e.Multi="multi"}(y||(y={}));class I{constructor(t){e(this,"$client",void 0),this.$client=t}}var V,W=Object.freeze({__proto__:null,Aria2ClientBaseClass:J,get EAria2ChangePositionHow(){return w},get EAria2DownloadState(){return v},get EAria2UriStatusEnum(){return g},get EAria2DownloadBitTorrentMode(){return y},Aria2ClientSystemMethodsBaseClass:I});!function(e){e.atob=function(e){return Buffer.from(e,"base64").toString()},e.btoa=function(e){return Buffer.from(e).toString("base64")}}(V||(V={}));const H=()=>{var e,t;return"string"==typeof(null===globalThis||void 0===globalThis||null===(e=globalThis.process)||void 0===e||null===(t=e.versions)||void 0===t?void 0:t.node)},z=null!=globalThis.WebSocket?class extends globalThis.WebSocket{constructor(e){super(e)}}:require("ws"),G=(()=>{if(H())return V.btoa;if(null!=globalThis.btoa)return globalThis.btoa;throw new Error("`btoa()` is not defined!")})();(()=>{if(H())return V.atob;if(null!=globalThis.atob)return globalThis.atob;throw new Error("`atob()` is not defined!")})();var X=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},K=Object.prototype.toString;function Q(e){return"[object Array]"===K.call(e)}function Y(e){return void 0===e}function Z(e){return null!==e&&"object"==typeof e}function ee(e){if("[object Object]"!==K.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function te(e){return"[object Function]"===K.call(e)}function ne(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),Q(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var re={isArray:Q,isArrayBuffer:function(e){return"[object ArrayBuffer]"===K.call(e)},isBuffer:function(e){return null!==e&&!Y(e)&&null!==e.constructor&&!Y(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Z,isPlainObject:ee,isUndefined:Y,isDate:function(e){return"[object Date]"===K.call(e)},isFile:function(e){return"[object File]"===K.call(e)},isBlob:function(e){return"[object Blob]"===K.call(e)},isFunction:te,isStream:function(e){return Z(e)&&te(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:ne,merge:function e(){var t={};function n(n,r){ee(t[r])&&ee(n)?t[r]=e(t[r],n):ee(n)?t[r]=e({},n):Q(n)?t[r]=n.slice():t[r]=n}for(var r=0,o=arguments.length;r<o;r++)ne(arguments[r],n);return t},extend:function(e,t,n){return ne(t,(function(t,r){e[r]=n&&"function"==typeof t?X(t,n):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}};function oe(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var ie=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(re.isURLSearchParams(t))r=t.toString();else{var o=[];re.forEach(t,(function(e,t){null!=e&&(re.isArray(e)?t+="[]":e=[e],re.forEach(e,(function(e){re.isDate(e)?e=e.toISOString():re.isObject(e)&&(e=JSON.stringify(e)),o.push(oe(t)+"="+oe(e))})))})),r=o.join("&")}if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e};function ae(){this.handlers=[]}ae.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},ae.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},ae.prototype.forEach=function(e){re.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var se=ae,le=function(e,t){re.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},ue=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},ce=function(e,t,n,r,o){var i=new Error(e);return ue(i,t,n,r,o)},fe=re.isStandardBrowserEnv()?{write:function(e,t,n,r,o,i){var a=[];a.push(e+"="+encodeURIComponent(t)),re.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),re.isString(r)&&a.push("path="+r),re.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},de=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],he=re.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=re.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0};function pe(e){this.message=e}pe.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},pe.prototype.__CANCEL__=!0;var me=pe,we=Ce,ve=function(e){return new Promise((function(t,n){var r,o=e.data,i=e.headers,a=e.responseType;function s(){e.cancelToken&&e.cancelToken.unsubscribe(r),e.signal&&e.signal.removeEventListener("abort",r)}re.isFormData(o)&&delete i["Content-Type"];var l=new XMLHttpRequest;if(e.auth){var u=e.auth.username||"",c=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.Authorization="Basic "+btoa(u+":"+c)}var f,d,h=(f=e.baseURL,d=e.url,f&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(d)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(f,d):d);function p(){if(l){var r="getAllResponseHeaders"in l?function(e){var t,n,r,o={};return e?(re.forEach(e.split("\n"),(function(e){if(r=e.indexOf(":"),t=re.trim(e.substr(0,r)).toLowerCase(),n=re.trim(e.substr(r+1)),t){if(o[t]&&de.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o}(l.getAllResponseHeaders()):null;!function(e,t,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(ce("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}((function(e){t(e),s()}),(function(e){n(e),s()}),{data:a&&"text"!==a&&"json"!==a?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:r,config:e,request:l}),l=null}}if(l.open(e.method.toUpperCase(),ie(h,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,"onloadend"in l?l.onloadend=p:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(p)},l.onabort=function(){l&&(n(ce("Request aborted",e,"ECONNABORTED",l)),l=null)},l.onerror=function(){n(ce("Network Error",e,null,l)),l=null},l.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded",r=e.transitional||we.transitional;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(ce(t,e,r.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",l)),l=null},re.isStandardBrowserEnv()){var m=(e.withCredentials||he(h))&&e.xsrfCookieName?fe.read(e.xsrfCookieName):void 0;m&&(i[e.xsrfHeaderName]=m)}"setRequestHeader"in l&&re.forEach(i,(function(e,t){void 0===o&&"content-type"===t.toLowerCase()?delete i[t]:l.setRequestHeader(t,e)})),re.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),a&&"json"!==a&&(l.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(r=function(e){l&&(n(!e||e&&e.type?new me("canceled"):e),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(r),e.signal&&(e.signal.aborted?r():e.signal.addEventListener("abort",r))),o||(o=null),l.send(o)}))},ge={"Content-Type":"application/x-www-form-urlencoded"};function ye(e,t){!re.isUndefined(e)&&re.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var be={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:function(){var e;return("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(e=ve),e}(),transformRequest:[function(e,t){return le(t,"Accept"),le(t,"Content-Type"),re.isFormData(e)||re.isArrayBuffer(e)||re.isBuffer(e)||re.isStream(e)||re.isFile(e)||re.isBlob(e)?e:re.isArrayBufferView(e)?e.buffer:re.isURLSearchParams(e)?(ye(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):re.isObject(e)||t&&"application/json"===t["Content-Type"]?(ye(t,"application/json"),function(e,t,n){if(re.isString(e))try{return(t||JSON.parse)(e),re.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||be.transitional,n=t&&t.silentJSONParsing,r=t&&t.forcedJSONParsing,o=!n&&"json"===this.responseType;if(o||r&&re.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw ue(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};re.forEach(["delete","get","head"],(function(e){be.headers[e]={}})),re.forEach(["post","put","patch"],(function(e){be.headers[e]=re.merge(ge)}));var Ce=be,Se=function(e,t,n){var r=this||we;return re.forEach(n,(function(n){e=n.call(r,e,t)})),e},Ee=function(e){return!(!e||!e.__CANCEL__)};function Oe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new me("canceled")}var $e=function(e){return Oe(e),e.headers=e.headers||{},e.data=Se.call(e,e.data,e.headers,e.transformRequest),e.headers=re.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),re.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||we.adapter)(e).then((function(t){return Oe(e),t.data=Se.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return Ee(t)||(Oe(e),t&&t.response&&(t.response.data=Se.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Le=function(e,t){t=t||{};var n={};function r(e,t){return re.isPlainObject(e)&&re.isPlainObject(t)?re.merge(e,t):re.isPlainObject(t)?re.merge({},t):re.isArray(t)?t.slice():t}function o(n){return re.isUndefined(t[n])?re.isUndefined(e[n])?void 0:r(void 0,e[n]):r(e[n],t[n])}function i(e){if(!re.isUndefined(t[e]))return r(void 0,t[e])}function a(n){return re.isUndefined(t[n])?re.isUndefined(e[n])?void 0:r(void 0,e[n]):r(void 0,t[n])}function s(n){return n in t?r(e[n],t[n]):n in e?r(void 0,e[n]):void 0}var l={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s};return re.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=l[e]||o,r=t(e);re.isUndefined(r)&&t!==s||(n[e]=r)})),n},je="0.22.0",Pe=je,xe={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){xe[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var Re={};xe.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Pe+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,o,i){if(!1===e)throw new Error(r(o," has been removed"+(t?" in "+t:"")));return t&&!Re[o]&&(Re[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}};var Ae={assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),o=r.length;o-- >0;){var i=r[o],a=t[i];if(a){var s=e[i],l=void 0===s||a(s,i,e);if(!0!==l)throw new TypeError("option "+i+" must be "+l)}else if(!0!==n)throw Error("Unknown option "+i)}},validators:xe},ke=Ae.validators;function Te(e){this.defaults=e,this.interceptors={request:new se,response:new se}}Te.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Le(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&Ae.assertOptions(t,{silentJSONParsing:ke.transitional(ke.boolean),forcedJSONParsing:ke.transitional(ke.boolean),clarifyTimeoutError:ke.transitional(ke.boolean)},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var o,i=[];if(this.interceptors.response.forEach((function(e){i.push(e.fulfilled,e.rejected)})),!r){var a=[$e,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(i),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var s=e;n.length;){var l=n.shift(),u=n.shift();try{s=l(s)}catch(e){u(e);break}}try{o=$e(s)}catch(e){return Promise.reject(e)}for(;i.length;)o=o.then(i.shift(),i.shift());return o},Te.prototype.getUri=function(e){return e=Le(this.defaults,e),ie(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},re.forEach(["delete","get","head","options"],(function(e){Te.prototype[e]=function(t,n){return this.request(Le(n||{},{method:e,url:t,data:(n||{}).data}))}})),re.forEach(["post","put","patch"],(function(e){Te.prototype[e]=function(t,n,r){return this.request(Le(r||{},{method:e,url:t,data:n}))}}));var Ne=Te;function _e(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e){n.reason||(n.reason=new me(e),t(n.reason))}))}_e.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},_e.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},_e.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},_e.source=function(){var e;return{token:new _e((function(t){e=t})),cancel:e}};var De=_e;var Ue=function e(t){var n=new Ne(t),r=X(Ne.prototype.request,n);return re.extend(r,Ne.prototype,n),re.extend(r,n),r.create=function(n){return e(Le(t,n))},r}(we);Ue.Axios=Ne,Ue.Cancel=me,Ue.CancelToken=De,Ue.isCancel=Ee,Ue.VERSION=je,Ue.all=function(e){return Promise.all(e)},Ue.spread=function(e){return function(t){return e.apply(null,t)}},Ue.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError};var Be=Ue,Me=Ue;Be.default=Me;var qe,Fe,Je=Be;!function(t){t.Client=class extends J{constructor(t){var r,o,i;super(),e(this,"$ws",void 0),e(this,"$options",void 0),e(this,"$respCallbacks",new Map),e(this,"$openCallbacks",[]),e(this,"$opened",!1),e(this,"$waitOpened",(()=>new Promise(((e,t)=>{this.$opened&&1==this.$ws.readyState?e():this.$ws.readyState<1&&this.$ws.readyState>1?t(this.$ws.readyState):this.$openCallbacks.push(e)})))),e(this,"$sendRaw",(e=>new Promise(((t,n)=>{try{this.$ws.send(e)}catch(e){n(e)}})))),e(this,"$sendJson",((e,...t)=>new Promise((async(n,r)=>{var o,i;await this.$waitOpened();let a=l(),s={jsonrpc:"2.0",id:a,method:e,params:[]};null!=(null===(o=this.$options)||void 0===o||null===(i=o.auth)||void 0===i?void 0:i.secret)&&s.params.push("token:"+this.$options.auth.secret),s.params=[...s.params,...t],this.$respCallbacks.set(a,n),this.$sendRaw(JSON.stringify(s)).catch(r)})))),e(this,"$systemMethods",new n(this)),this.$options=Object.assign({},t),this.$ws=new z(`${null!==(r=t.protocol)&&void 0!==r?r:"ws"}://${t.host}:${t.port}${null!==(o=t.path)&&void 0!==o?o:"/jsonrpc"}`,H()?null!==(i=t.wsOptions)&&void 0!==i?i:{}:void 0),this.$ws.onclose=()=>{this.emit("ws.close"),this.$opened=!1,this.$openCallbacks=[]},this.$ws.onopen=()=>{for(this.emit("ws.open"),this.$opened=!0;this.$openCallbacks.length>0;){let e=this.$openCallbacks.pop();null!=e&&1==this.$ws.readyState&&e()}},this.$ws.onmessage=e=>{var t,n,r,o,i,a,s;("message"==(null===(t=e)||void 0===t?void 0:t.type)||H())&&(e=e.data);try{this.emit("ws.message",e);let t=JSON.parse(e.toString());if(t instanceof Array){let e=this.$respCallbacks.get(t[0].id);null!=e&&e(t),this.$respCallbacks.delete(t[0].id)}else if(null!=t.id&&this.$respCallbacks.has(null==t?void 0:t.id)){let e=this.$respCallbacks.get(t.id);null!=e&&e(t),this.$respCallbacks.delete(t.id)}else if(null!=t.method)switch(null==t?void 0:t.method){case"aria2.onDownloadStart":this.emit("aria2.onDownloadStart",{},...null!==(n=t.params)&&void 0!==n?n:[]);break;case"aria2.onDownloadPause":this.emit("aria2.onDownloadPause",{},...null!==(r=t.params)&&void 0!==r?r:[]);break;case"aria2.onDownloadStop":this.emit("aria2.onDownloadStop",{},...null!==(o=t.params)&&void 0!==o?o:[]);break;case"aria2.onDownloadComplete":this.emit("aria2.onDownloadComplete",{},...null!==(i=t.params)&&void 0!==i?i:[]);break;case"aria2.onDownloadError":this.emit("aria2.onDownloadError",{},...null!==(a=t.params)&&void 0!==a?a:[]);break;case"aria2.onBtDownloadComplete":this.emit("aria2.onBtDownloadComplete",{},...null!==(s=t.params)&&void 0!==s?s:[])}}catch(e){throw this.$errorHandle(e),e}}}$errorHandle(e){}get system(){return this.$systemMethods}async rawCall(e,...t){let n=await this.$sendJson(e,...t);if(null!=n.error)throw n.error;return n.result}async rawSend(e){return await this.$sendRaw(e)}async getCreateOptions(){return Object.freeze(this.$options)}async closeConnection(e,t){this.$ws.close(e,t)}};class n extends I{async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}multicall(...e){return new Promise((async(t,n)=>{var r;let o=l(),i=!1,a=[],s=await this.$client.getCreateOptions();var u;null!=(null==s||null===(r=s.auth)||void 0===r?void 0:r.secret)&&a.push("token:"+(null==s||null===(u=s.auth)||void 0===u?void 0:u.secret));let c=[];for(const t of e)1!=i?(c.push({jsonrpc:"2.0",id:o,method:t.methodName,params:[...a,...t.params]}),i=!0):c.push({jsonrpc:"2.0",id:l(),method:t.methodName,params:[...a,...t.params]});await this.$client.$waitOpened(),this.$client.$respCallbacks.set(o,(e=>{let n=[];for(const t of e)null!=t.error?n.push(Promise.reject(t.error)):n.push(Promise.resolve(t.result));t(n)})),this.$client.rawSend(JSON.stringify(c)).catch(n)}))}}t.SystemMethods=n}(qe||(qe={})),function(t){t.Client=class extends J{constructor(t){super(),e(this,"$options",void 0),e(this,"$system",void 0),this.$options=t,this.$system=new n(this)}onDownloadStart(){throw new Error("Method not implemented.")}onDownloadPause(){throw new Error("Method not implemented.")}onDownloadStop(){throw new Error("Method not implemented.")}onDownloadComplete(){throw new Error("Method not implemented.")}onDownloadError(){throw new Error("Method not implemented.")}onBtDownloadStart(){throw new Error("Method not implemented.")}get system(){return this.$system}async rawCall(e,...t){var n,r,o;let i=l(),a=[...t];null!=(null===(n=this.$options)||void 0===n||null===(r=n.auth)||void 0===r?void 0:r.secret)&&a.push("token:"+this.$options.auth.secret);let s=`${null!==(o=this.$options.protocol)&&void 0!==o?o:"http"}://${this.$options.host}:${this.$options.port}/jsonrpc?method=${decodeURIComponent(e)}&id=${decodeURIComponent(i)}¶ms=${G(JSON.stringify(a))}`,u=(await Je(s,{method:"GET",...this.$options.fetchOptions})).data;if(null==u.error)return u.result;throw u.error}async rawSend(e){throw new Error("Method not implemented.")}async getCreateOptions(){return this.$options}};class n extends I{async multicall(...e){let t={},n=[],r=[],o=await this.$client.getCreateOptions();for(const s of e){var i,a;let e=l(),u=[];null!=(null==o||null===(i=o.auth)||void 0===i?void 0:i.secret)&&u.push(null==o||null===(a=o.auth)||void 0===a?void 0:a.secret),n.push({jsonrpc:"2.0",id:e,params:[...u,...s.params],method:s.methodName}),r.push(new Promise(((n,r)=>{t[e]={r:n,j:r}})))}return new Promise((async()=>{var e;let r=`${null!==(e=o.protocol)&&void 0!==e?e:"http"}://${o.host}:${o.port}/jsonrpc?method=&id=¶ms=${G(JSON.stringify(n))}`,i=await Je(r,{method:"GET",...o.fetchOptions});for(const e of i.data)null!=e.id&&null!=t[e.id]&&(null!=e.error?t[e.id].j(e.error):t[e.id].r(e.result))})),r}async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}}t.SystemMethods=n}(Fe||(Fe={}));export{W as Adapter,Fe as Http,qe as WebSocket}; | ||
//# sourceMappingURL=libaria2.browser.esm.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("events"),t=require("http"),r=require("https"),n=require("url"),o=require("stream"),s=require("assert"),a=require("tty"),i=require("util"),u=require("os"),l=require("zlib"),c=require("crypto");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=d(t),p=d(r),f=d(n),m=d(o),g=d(s),w=d(a),y=d(i),C=d(u),v=d(l),b=d(c);function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const R=new Uint8Array(256);let E=R.length;function O(){return E>R.length-16&&(b.default.randomFillSync(R),E=0),R.slice(E,E+=16)}var _=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const x=[];for(let e=0;e<256;++e)x.push((e+256).toString(16).substr(1));function A(e,t=0){const r=(x[e[t+0]]+x[e[t+1]]+x[e[t+2]]+x[e[t+3]]+"-"+x[e[t+4]]+x[e[t+5]]+"-"+x[e[t+6]]+x[e[t+7]]+"-"+x[e[t+8]]+x[e[t+9]]+"-"+x[e[t+10]]+x[e[t+11]]+x[e[t+12]]+x[e[t+13]]+x[e[t+14]]+x[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&_.test(e)}(r))throw TypeError("Stringified UUID is invalid");return r}function $(e,t,r){const n=(e=e||{}).random||(e.rng||O)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return A(n)}function F(e){return e.toString()}function T(e){return e.toString()}function k(e){if(/^(false|true)$/.test(e))return"true"==e;throw"Unknown Boolean Value: "+e}function B(e){return Number(e)}function L(e){return BigInt(e)}function j(e){let t={};for(const r in e)if(null!=e[r])if("string"==typeof e[r])t[r]=e[r];else if("boolean"==typeof e[r])t[r]=e[r].toString();else if("number"==typeof e[r])t[r]=T(e[r]);else{if("bigint"!=typeof e[r])throw"Unknown Value: "+e[r];t[r]=F(e[r])}return t}function D(e){let t={};for(const r in e)if(null!=e[r])if("string"==typeof e[r])t[r]=e[r];else if("boolean"==typeof e[r])t[r]=k(e[r]);else if("number"==typeof e[r])t[r]=B(e[r]);else{if("bigint"!=typeof e[r])throw"Unknown Value: "+e[r];t[r]=L(e[r])}return t}function P(e){let t=Object.assign({},e);if(null!=e.totalLength&&(t.totalLength=L(e.totalLength)),null!=e.totalLength&&(t.completedLength=L(e.completedLength)),null!=e.totalLength&&(t.uploadLength=L(e.uploadLength)),null!=e.totalLength&&(t.downloadSpeed=L(e.downloadSpeed)),null!=e.totalLength&&(t.uploadSpeed=L(e.uploadSpeed)),null!=e.numSeeders&&(t.numSeeders=L(e.numSeeders)),null!=e.seeder&&(t.seeder=k(e.seeder)),null!=e.totalLength&&(t.pieceLength=L(e.pieceLength)),null!=e.totalLength&&(t.numPieces=L(e.numPieces)),null!=e.totalLength&&(t.connections=L(e.connections)),null!=e.errorCode&&(t.errorCode=B(e.errorCode)),null!=e.bittorrent&&null!=e.bittorrent.creationDate&&(t.bittorrent.creationDate=L(e.bittorrent.creationDate)),null!=e.files)for(const r in e.files)t.files[r]=U(e.files[r]);return t}function U(e){let t=Object.assign({},e);return t.length=L(e.length),t.completedLength=L(e.completedLength),t.index=B(e.index),t.selected=k(e.selected),t}function N(e){let t=Object.assign({},e);return t.amChoking=k(e.amChoking),t.downloadSpeed=L(e.downloadSpeed),t.peerChoking=k(e.peerChoking),t.port=B(e.port),t.seeder=k(e.seeder),t.uploadSpeed=L(e.uploadSpeed),t}function q(e){let t=Object.assign({},e);return t.downloadSpeed=L(e.downloadSpeed),t}function M(e){let t=Object.assign({},e);t.index=B(e.index);for(const r in e.servers)t.servers[r]=q(e.servers[r]);return t}class I extends e.EventEmitter{constructor(){super()}async addMetalink(e,t,r){var n;null!==(n=process.versions.node)&&void 0!==n&&n&&e instanceof Buffer&&(e=e.toString("base64"));let o=[e];if(null!=t&&o.push(t),null!=t&&null!=r)o.push(r);else if(null!=r)throw"Require `options`!";return await this.rawCall("aria2.addMetalink",...o)}async remove(e){return await this.rawCall("aria2.remove",e)}async forceRemove(e){return await this.rawCall("aria2.forceRemove",e)}async pause(e){return await this.rawCall("aria2.pause",e)}async forcePause(e){return await this.rawCall("aria2.forcePause",e)}async pauseAll(){return await this.rawCall("aria2.pauseAll")}async forcePauseAll(){return await this.rawCall("aria2.forcePauseAll")}async unpause(e){return await this.rawCall("aria2.unpause",e)}async unpauseAll(){return await this.rawCall("aria2.unpauseAll")}async tellStatus(e,t){if(null!=t){return P(await this.rawCall("aria2.tellStatus",e,t))}return P(await this.rawCall("aria2.tellStatus",e))}async getUris(e){return await this.rawCall("aria2.getUris",e)}async getFiles(e){return await this.rawCall("aria2.getFiles",e)}async getPeers(e){return(await this.rawCall("aria2.getPeers",e)).map(N)}async getServers(e){return(await this.rawCall("aria2.getServers",e)).map(M)}async tellActive(e){if(null!=e){return(await this.rawCall("aria2.tellActive",e)).map(P)}return(await this.rawCall("aria2.tellActive")).map(P)}async tellWaiting(e,t,r){if(null!=r){return(await this.rawCall("aria2.tellWaiting",e,t,r)).map(P)}return(await this.rawCall("aria2.tellWaiting",e,t)).map(P)}async tellStopped(e,t,r){if(null!=r){return(await this.rawCall("aria2.tellStopped",e,t,r)).map(P)}return(await this.rawCall("aria2.tellStopped",e,t)).map(P)}async changePosition(e,t,r){return await this.rawCall("aria2.changePosition",e,t,r)}async changeUri(e,t,r,n,o){return await this.rawCall("aria2.changeUri",e,t,r,n,o)}async getOption(e){return D(await this.rawCall("aria2.getOption",e))}async changeOption(e,t){return await this.rawCall("aria2.changeOption",e,j(t))}async getGlobalOption(){return D(await this.rawCall("aria2.getGlobalOption"))}async changeGlobalOption(e){return await this.rawCall("aria2.changeGlobalOption",j(e))}async getGlobalStat(){return function(e){let t=Object.assign({},e);return t.downloadSpeed=L(e.downloadSpeed),t.uploadSpeed=L(e.uploadSpeed),t.numActive=B(e.numActive),t.numWaiting=B(e.numWaiting),t.numStopped=B(e.numStopped),t.numStoppedTotal=B(e.numStoppedTotal),t}(await this.rawCall("aria2.getGlobalStat"))}async purgeDownloadResult(){return await this.rawCall("aria2.purgeDownloadResult")}async removeDownloadResult(e){return await this.rawCall("aria2.removeDownloadResult",e)}async getVersion(){return await this.rawCall("aria2.getVersion")}async shutdown(){return await this.rawCall("aria2.shutdown")}async forceShutdown(){return await this.rawCall("aria2.forceShutdown")}async saveSession(){return await this.rawCall("aria2.saveSession")}async getSessionInfo(){return await this.rawCall("aria2.getSessioninfo")}async addUri(e,t,r){"string"==typeof e&&(e=[e]);let n=[e];if(null!=t&&n.push(j(t)),null!=t&&null!=r)n.push(r);else if(null!=r)throw"Require `options`!";return await this.rawCall("aria2.addUri",...n)}async addTorrent(e,t,r,n){e instanceof Buffer&&(e=e.toString("base64")),"string"==typeof t&&(t=[t]);let o=[e,t];if(null!=r&&o.push(r),null!=r&&null!=n)o.push(n);else if(null!=n)throw"Require `options`!";return await this.rawCall("aria2.addTorrent",...o)}onceDownloadStart(){return new Promise((e=>this.once("aria2.onDownloadStart",e)))}onceDownloadPause(){return new Promise((e=>this.once("aria2.onDownloadPause",e)))}onceDownloadStop(){return new Promise((e=>this.once("aria2.onDownloadStop",e)))}onceDownloadComplete(){return new Promise((e=>this.once("aria2.onDownloadComplete",e)))}onceDownloadError(){return new Promise((e=>this.once("aria2.onDownloadError",e)))}onceBtDownloadStart(){return new Promise((e=>this.once("aria2.onBtDownloadStart",e)))}}var z,H,G,W;!function(e){e.Set="POS_SET",e.Cur="POS_CUR",e.End="POS_END"}(z||(z={})),function(e){e.Active="active",e.Waiting="waiting",e.Paused="paused",e.Error="error",e.Complete="complete",e.Removed="removed"}(H||(H={})),function(e){e.Waiting="waiting",e.Used="used"}(G||(G={})),function(e){e.Single="single",e.Multi="multi"}(W||(W={}));class J{constructor(e){S(this,"$client",void 0),this.$client=e}}var V,X=Object.freeze({__proto__:null,Aria2ClientBaseClass:I,get EAria2ChangePositionHow(){return z},get EAria2DownloadState(){return H},get EAria2UriStatusEnum(){return G},get EAria2DownloadBitTorrentMode(){return W},Aria2ClientSystemMethodsBaseClass:J});!function(e){e.atob=function(e){return Buffer.from(e,"base64").toString()},e.btoa=function(e){return Buffer.from(e).toString("base64")}}(V||(V={}));const Y=()=>{var e,t;return"string"==typeof(null===globalThis||void 0===globalThis||null===(e=globalThis.process)||void 0===e||null===(t=e.versions)||void 0===t?void 0:t.node)},K=null!=globalThis.WebSocket?class extends globalThis.WebSocket{constructor(e){super(e)}}:require("ws"),Z=(()=>{if(Y())return V.btoa;if(null!=globalThis.btoa)return globalThis.btoa;throw new Error("`btoa()` is not defined!")})();(()=>{if(Y())return V.atob;if(null!=globalThis.atob)return globalThis.atob;throw new Error("`atob()` is not defined!")})();var Q=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},ee=Object.prototype.toString;function te(e){return"[object Array]"===ee.call(e)}function re(e){return void 0===e}function ne(e){return null!==e&&"object"==typeof e}function oe(e){if("[object Object]"!==ee.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function se(e){return"[object Function]"===ee.call(e)}function ae(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),te(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var ie={isArray:te,isArrayBuffer:function(e){return"[object ArrayBuffer]"===ee.call(e)},isBuffer:function(e){return null!==e&&!re(e)&&null!==e.constructor&&!re(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:ne,isPlainObject:oe,isUndefined:re,isDate:function(e){return"[object Date]"===ee.call(e)},isFile:function(e){return"[object File]"===ee.call(e)},isBlob:function(e){return"[object Blob]"===ee.call(e)},isFunction:se,isStream:function(e){return ne(e)&&se(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:ae,merge:function e(){var t={};function r(r,n){oe(t[n])&&oe(r)?t[n]=e(t[n],r):oe(r)?t[n]=e({},r):te(r)?t[n]=r.slice():t[n]=r}for(var n=0,o=arguments.length;n<o;n++)ae(arguments[n],r);return t},extend:function(e,t,r){return ae(t,(function(t,n){e[n]=r&&"function"==typeof t?Q(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}};function ue(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var le=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(ie.isURLSearchParams(t))n=t.toString();else{var o=[];ie.forEach(t,(function(e,t){null!=e&&(ie.isArray(e)?t+="[]":e=[e],ie.forEach(e,(function(e){ie.isDate(e)?e=e.toISOString():ie.isObject(e)&&(e=JSON.stringify(e)),o.push(ue(t)+"="+ue(e))})))})),n=o.join("&")}if(n){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e};function ce(){this.handlers=[]}ce.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},ce.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},ce.prototype.forEach=function(e){ie.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var de=ce,he=function(e,t,r){return ie.forEach(r,(function(r){e=r(e,t)})),e},pe=function(e){return!(!e||!e.__CANCEL__)},fe=function(e,t){ie.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))},me=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e},ge=function(e,t,r,n,o){var s=new Error(e);return me(s,t,r,n,o)},we=function(e,t,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(ge("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)},ye=ie.isStandardBrowserEnv()?{write:function(e,t,r,n,o,s){var a=[];a.push(e+"="+encodeURIComponent(t)),ie.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),ie.isString(n)&&a.push("path="+n),ie.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},Ce=function(e,t){return e&&!function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t},ve=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],be=ie.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=ie.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0},Se=function(e){return new Promise((function(t,r){var n=e.data,o=e.headers;ie.isFormData(n)&&delete o["Content-Type"];var s=new XMLHttpRequest;if(e.auth){var a=e.auth.username||"",i=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(a+":"+i)}var u=Ce(e.baseURL,e.url);if(s.open(e.method.toUpperCase(),le(u,e.params,e.paramsSerializer),!0),s.timeout=e.timeout,s.onreadystatechange=function(){if(s&&4===s.readyState&&(0!==s.status||s.responseURL&&0===s.responseURL.indexOf("file:"))){var n,o,a,i,u,l="getAllResponseHeaders"in s?(n=s.getAllResponseHeaders(),u={},n?(ie.forEach(n.split("\n"),(function(e){if(i=e.indexOf(":"),o=ie.trim(e.substr(0,i)).toLowerCase(),a=ie.trim(e.substr(i+1)),o){if(u[o]&&ve.indexOf(o)>=0)return;u[o]="set-cookie"===o?(u[o]?u[o]:[]).concat([a]):u[o]?u[o]+", "+a:a}})),u):u):null,c={data:e.responseType&&"text"!==e.responseType?s.response:s.responseText,status:s.status,statusText:s.statusText,headers:l,config:e,request:s};we(t,r,c),s=null}},s.onabort=function(){s&&(r(ge("Request aborted",e,"ECONNABORTED",s)),s=null)},s.onerror=function(){r(ge("Network Error",e,null,s)),s=null},s.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(ge(t,e,"ECONNABORTED",s)),s=null},ie.isStandardBrowserEnv()){var l=(e.withCredentials||be(u))&&e.xsrfCookieName?ye.read(e.xsrfCookieName):void 0;l&&(o[e.xsrfHeaderName]=l)}if("setRequestHeader"in s&&ie.forEach(o,(function(e,t){void 0===n&&"content-type"===t.toLowerCase()?delete o[t]:s.setRequestHeader(t,e)})),ie.isUndefined(e.withCredentials)||(s.withCredentials=!!e.withCredentials),e.responseType)try{s.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&s.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&s.upload&&s.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){s&&(s.abort(),r(e),s=null)})),n||(n=null),s.send(n)}))};function Re(e){var t={exports:{}};return e(t,t.exports),t.exports}var Ee=1e3,Oe=60*Ee,_e=60*Oe,xe=24*_e,Ae=7*xe,$e=365.25*xe,Fe=function(e,t){t=t||{};var r=typeof e;if("string"===r&&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 r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*$e;case"weeks":case"week":case"w":return r*Ae;case"days":case"day":case"d":return r*xe;case"hours":case"hour":case"hrs":case"hr":case"h":return r*_e;case"minutes":case"minute":case"mins":case"min":case"m":return r*Oe;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ee;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=xe)return Te(e,t,xe,"day");if(t>=_e)return Te(e,t,_e,"hour");if(t>=Oe)return Te(e,t,Oe,"minute");if(t>=Ee)return Te(e,t,Ee,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=xe)return Math.round(e/xe)+"d";if(t>=_e)return Math.round(e/_e)+"h";if(t>=Oe)return Math.round(e/Oe)+"m";if(t>=Ee)return Math.round(e/Ee)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Te(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}var ke=function(e){function t(e){let n,o,s,a=null;function i(...e){if(!i.enabled)return;const r=i,o=Number(new Date),s=o-(n||o);r.diff=s,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";a++;const s=t.formatters[o];if("function"==typeof s){const t=e[a];n=s.call(r,t),e.splice(a,1),a--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return i.namespace=e,i.useColors=t.useColors(),i.color=t.selectColor(e),i.extend=r,i.destroy=t.destroy,Object.defineProperty(i,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(o!==t.namespaces&&(o=t.namespaces,s=t.enabled(e)),s),set:e=>{a=e}}),"function"==typeof t.init&&t.init(i),i}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(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(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(e=n[r].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 r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=Fe,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((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t},Be=Re((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 r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},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&&"undefined"!=typeof process&&"env"in process&&(e=process.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=ke(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}})),Le=(e,t=process.argv)=>{const r=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return-1!==n&&(-1===o||n<o)};const{env:je}=process;let De;function Pe(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Ue(e,t){if(0===De)return 0;if(Le("color=16m")||Le("color=full")||Le("color=truecolor"))return 3;if(Le("color=256"))return 2;if(e&&!t&&void 0===De)return 0;const r=De||0;if("dumb"===je.TERM)return r;if("win32"===process.platform){const e=C.default.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in je)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in je))||"codeship"===je.CI_NAME?1:r;if("TEAMCITY_VERSION"in je)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(je.TEAMCITY_VERSION)?1:0;if("truecolor"===je.COLORTERM)return 3;if("TERM_PROGRAM"in je){const e=parseInt((je.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(je.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(je.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(je.TERM)||"COLORTERM"in je?1:r}Le("no-color")||Le("no-colors")||Le("color=false")||Le("color=never")?De=0:(Le("color")||Le("colors")||Le("color=true")||Le("color=always"))&&(De=1),"FORCE_COLOR"in je&&(De="true"===je.FORCE_COLOR?1:"false"===je.FORCE_COLOR?0:0===je.FORCE_COLOR.length?1:Math.min(parseInt(je.FORCE_COLOR,10),3));var Ne,qe={supportsColor:function(e){return Pe(Ue(e,e&&e.isTTY))},stdout:Pe(Ue(!0,w.default.isatty(1))),stderr:Pe(Ue(!0,w.default.isatty(2)))},Me=Re((function(e,t){t.init=function(e){e.inspectOpts={};const r=Object.keys(t.inspectOpts);for(let n=0;n<r.length;n++)e.inspectOpts[r[n]]=t.inspectOpts[r[n]]},t.log=function(...e){return process.stderr.write(y.default.format(...e)+"\n")},t.formatArgs=function(r){const{namespace:n,useColors:o}=this;if(o){const t=this.color,o="[3"+(t<8?t:"8;5;"+t),s=` ${o};1m${n} [0m`;r[0]=s+r[0].split("\n").join("\n"+s),r.push(o+"m+"+e.exports.humanize(this.diff)+"[0m")}else r[0]=function(){if(t.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+n+" "+r[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):w.default.isatty(process.stderr.fd)},t.destroy=y.default.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=qe;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(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let n=process.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[r]=n,e}),{}),e.exports=ke(t);const{formatters:r}=e.exports;r.o=function(e){return this.inspectOpts.colors=this.useColors,y.default.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},r.O=function(e){return this.inspectOpts.colors=this.useColors,y.default.inspect(e,this.inspectOpts)}})),Ie=Re((function(e){"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?e.exports=Be:e.exports=Me})),ze=function(){if(!Ne)try{Ne=Ie("follow-redirects")}catch(e){Ne=function(){}}Ne.apply(null,arguments)},He=f.default.URL,Ge=m.default.Writable,We=["abort","aborted","connect","error","socket","timeout"],Je=Object.create(null);We.forEach((function(e){Je[e]=function(t,r,n){this._redirectable.emit(e,t,r,n)}}));var Ve=nt("ERR_FR_REDIRECTION_FAILURE",""),Xe=nt("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),Ye=nt("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),Ke=nt("ERR_STREAM_WRITE_AFTER_END","write after end");function Ze(e,t){Ge.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var r=this;this._onNativeResponse=function(e){r._processResponse(e)},this._performRequest()}function Qe(e){var t={maxRedirects:21,maxBodyLength:10485760},r={};return Object.keys(e).forEach((function(n){var o=n+":",s=r[o]=e[n],a=t[n]=Object.create(s);Object.defineProperties(a,{request:{value:function(e,n,s){if("string"==typeof e){var a=e;try{e=tt(new He(a))}catch(t){e=f.default.parse(a)}}else He&&e instanceof He?e=tt(e):(s=n,n=e,e={protocol:o});return"function"==typeof n&&(s=n,n=null),(n=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,n)).nativeProtocols=r,g.default.equal(n.protocol,o,"protocol mismatch"),ze("options",n),new Ze(n,s)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,r){var n=a.request(e,t,r);return n.end(),n},configurable:!0,enumerable:!0,writable:!0}})})),t}function et(){}function tt(e){var t={protocol:e.protocol,hostname:e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:e.pathname+e.search,href:e.href};return""!==e.port&&(t.port=Number(e.port)),t}function rt(e,t){var r;for(var n in t)e.test(n)&&(r=t[n],delete t[n]);return r}function nt(e,t){function r(e){Error.captureStackTrace(this,this.constructor),this.message=e||t}return r.prototype=new Error,r.prototype.constructor=r,r.prototype.name="Error ["+e+"]",r.prototype.code=e,r}function ot(e){for(var t=0;t<We.length;t++)e.removeListener(We[t],Je[We[t]]);e.on("error",et),e.abort()}Ze.prototype=Object.create(Ge.prototype),Ze.prototype.abort=function(){ot(this._currentRequest),this.emit("abort")},Ze.prototype.write=function(e,t,r){if(this._ending)throw new Ke;if(!("string"==typeof e||"object"==typeof e&&"length"in e))throw new TypeError("data should be a string, Buffer or Uint8Array");"function"==typeof t&&(r=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,r)):(this.emit("error",new Ye),this.abort()):r&&r()},Ze.prototype.end=function(e,t,r){if("function"==typeof e?(r=e,e=t=null):"function"==typeof t&&(r=t,t=null),e){var n=this,o=this._currentRequest;this.write(e,t,(function(){n._ended=!0,o.end(null,null,r)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,r)},Ze.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},Ze.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},Ze.prototype.setTimeout=function(e,t){var r=this;function n(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function o(t){r._timeout&&clearTimeout(r._timeout),r._timeout=setTimeout((function(){r.emit("timeout"),s()}),e),n(t)}function s(){clearTimeout(this._timeout),t&&r.removeListener("timeout",t),this.socket||r._currentRequest.removeListener("socket",o)}return t&&this.on("timeout",t),this.socket?o(this.socket):this._currentRequest.once("socket",o),this.on("socket",n),this.once("response",s),this.once("error",s),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){Ze.prototype[e]=function(t,r){return this._currentRequest[e](t,r)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(Ze.prototype,e,{get:function(){return this._currentRequest[e]}})})),Ze.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}},Ze.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(t){if(this._options.agents){var r=e.substr(0,e.length-1);this._options.agent=this._options.agents[r]}var n=this._currentRequest=t.request(this._options,this._onNativeResponse);this._currentUrl=f.default.format(this._options),n._redirectable=this;for(var o=0;o<We.length;o++)n.on(We[o],Je[We[o]]);if(this._isRedirect){var s=0,a=this,i=this._requestBodyBuffers;!function e(t){if(n===a._currentRequest)if(t)a.emit("error",t);else if(s<i.length){var r=i[s++];n.finished||n.write(r.data,r.encoding,e)}else a._ended&&n.end()}()}}else this.emit("error",new TypeError("Unsupported protocol "+e))},Ze.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var r=e.headers.location;if(r&&!1!==this._options.followRedirects&&t>=300&&t<400){if(ot(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)return void this.emit("error",new Xe);((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],rt(/^content-/i,this._options.headers));var n=rt(/^host$/i,this._options.headers)||f.default.parse(this._currentUrl).hostname,o=f.default.resolve(this._currentUrl,r);ze("redirecting to",o),this._isRedirect=!0;var s=f.default.parse(o);if(Object.assign(this._options,s),s.hostname!==n&&rt(/^authorization$/i,this._options.headers),"function"==typeof this._options.beforeRedirect){var a={headers:e.headers};try{this._options.beforeRedirect.call(null,this._options,a)}catch(e){return void this.emit("error",e)}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(e){var i=new Ve("Redirected request failed: "+e.message);i.cause=e,this.emit("error",i)}}else e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),this._requestBodyBuffers=[]};var st=Qe({http:h.default,https:p.default}),at=Qe;st.wrap=at;var it="0.21.1",ut=st.http,lt=st.https,ct=/https:?/;function dt(e,t,r){if(e.hostname=t.host,e.host=t.host,e.port=t.port,e.path=r,t.auth){var n=Buffer.from(t.auth.username+":"+t.auth.password,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+n}e.beforeRedirect=function(e){e.headers.host=e.host,dt(e,t,e.href)}}var ht=function(e){return new Promise((function(t,r){var n=function(e){t(e)},o=function(e){r(e)},s=e.data,a=e.headers;if(a["User-Agent"]||a["user-agent"]||(a["User-Agent"]="axios/"+it),s&&!ie.isStream(s)){if(Buffer.isBuffer(s));else if(ie.isArrayBuffer(s))s=Buffer.from(new Uint8Array(s));else{if(!ie.isString(s))return o(ge("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",e));s=Buffer.from(s,"utf-8")}a["Content-Length"]=s.length}var i=void 0;e.auth&&(i=(e.auth.username||"")+":"+(e.auth.password||""));var u=Ce(e.baseURL,e.url),l=f.default.parse(u),c=l.protocol||"http:";if(!i&&l.auth){var d=l.auth.split(":");i=(d[0]||"")+":"+(d[1]||"")}i&&delete a.Authorization;var m=ct.test(c),g=m?e.httpsAgent:e.httpAgent,w={path:le(l.path,e.params,e.paramsSerializer).replace(/^\?/,""),method:e.method.toUpperCase(),headers:a,agent:g,agents:{http:e.httpAgent,https:e.httpsAgent},auth:i};e.socketPath?w.socketPath=e.socketPath:(w.hostname=l.hostname,w.port=l.port);var y,C=e.proxy;if(!C&&!1!==C){var b=c.slice(0,-1)+"_proxy",S=process.env[b]||process.env[b.toUpperCase()];if(S){var R=f.default.parse(S),E=process.env.no_proxy||process.env.NO_PROXY,O=!0;if(E)O=!E.split(",").map((function(e){return e.trim()})).some((function(e){return!!e&&("*"===e||("."===e[0]&&l.hostname.substr(l.hostname.length-e.length)===e||l.hostname===e))}));if(O&&(C={host:R.hostname,port:R.port,protocol:R.protocol},R.auth)){var _=R.auth.split(":");C.auth={username:_[0],password:_[1]}}}}C&&(w.headers.host=l.hostname+(l.port?":"+l.port:""),dt(w,C,c+"//"+l.hostname+(l.port?":"+l.port:"")+w.path));var x=m&&(!C||ct.test(C.protocol));e.transport?y=e.transport:0===e.maxRedirects?y=x?p.default:h.default:(e.maxRedirects&&(w.maxRedirects=e.maxRedirects),y=x?lt:ut),e.maxBodyLength>-1&&(w.maxBodyLength=e.maxBodyLength);var A=y.request(w,(function(t){if(!A.aborted){var r=t,s=t.req||A;if(204!==t.statusCode&&"HEAD"!==s.method&&!1!==e.decompress)switch(t.headers["content-encoding"]){case"gzip":case"compress":case"deflate":r=r.pipe(v.default.createUnzip()),delete t.headers["content-encoding"]}var a={status:t.statusCode,statusText:t.statusMessage,headers:t.headers,config:e,request:s};if("stream"===e.responseType)a.data=r,we(n,o,a);else{var i=[];r.on("data",(function(t){i.push(t),e.maxContentLength>-1&&Buffer.concat(i).length>e.maxContentLength&&(r.destroy(),o(ge("maxContentLength size of "+e.maxContentLength+" exceeded",e,null,s)))})),r.on("error",(function(t){A.aborted||o(me(t,e,null,s))})),r.on("end",(function(){var t=Buffer.concat(i);"arraybuffer"!==e.responseType&&(t=t.toString(e.responseEncoding),e.responseEncoding&&"utf8"!==e.responseEncoding||(t=ie.stripBOM(t))),a.data=t,we(n,o,a)}))}}}));A.on("error",(function(t){A.aborted&&"ERR_FR_TOO_MANY_REDIRECTS"!==t.code||o(me(t,e,null,A))})),e.timeout&&A.setTimeout(e.timeout,(function(){A.abort(),o(ge("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",A))})),e.cancelToken&&e.cancelToken.promise.then((function(e){A.aborted||(A.abort(),o(e))})),ie.isStream(s)?s.on("error",(function(t){o(me(t,e,null,A))})).pipe(A):A.end(s)}))},pt={"Content-Type":"application/x-www-form-urlencoded"};function ft(e,t){!ie.isUndefined(e)&&ie.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var mt={adapter:function(){var e;return"undefined"!=typeof XMLHttpRequest?e=Se:"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)&&(e=ht),e}(),transformRequest:[function(e,t){return fe(t,"Accept"),fe(t,"Content-Type"),ie.isFormData(e)||ie.isArrayBuffer(e)||ie.isBuffer(e)||ie.isStream(e)||ie.isFile(e)||ie.isBlob(e)?e:ie.isArrayBufferView(e)?e.buffer:ie.isURLSearchParams(e)?(ft(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):ie.isObject(e)?(ft(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};ie.forEach(["delete","get","head"],(function(e){mt.headers[e]={}})),ie.forEach(["post","put","patch"],(function(e){mt.headers[e]=ie.merge(pt)}));var gt=mt;function wt(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var yt=function(e){return wt(e),e.headers=e.headers||{},e.data=he(e.data,e.headers,e.transformRequest),e.headers=ie.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ie.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||gt.adapter)(e).then((function(t){return wt(e),t.data=he(t.data,t.headers,e.transformResponse),t}),(function(t){return pe(t)||(wt(e),t&&t.response&&(t.response.data=he(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Ct=function(e,t){t=t||{};var r={},n=["url","method","data"],o=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function i(e,t){return ie.isPlainObject(e)&&ie.isPlainObject(t)?ie.merge(e,t):ie.isPlainObject(t)?ie.merge({},t):ie.isArray(t)?t.slice():t}function u(n){ie.isUndefined(t[n])?ie.isUndefined(e[n])||(r[n]=i(void 0,e[n])):r[n]=i(e[n],t[n])}ie.forEach(n,(function(e){ie.isUndefined(t[e])||(r[e]=i(void 0,t[e]))})),ie.forEach(o,u),ie.forEach(s,(function(n){ie.isUndefined(t[n])?ie.isUndefined(e[n])||(r[n]=i(void 0,e[n])):r[n]=i(void 0,t[n])})),ie.forEach(a,(function(n){n in t?r[n]=i(e[n],t[n]):n in e&&(r[n]=i(void 0,e[n]))}));var l=n.concat(o).concat(s).concat(a),c=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return ie.forEach(c,u),r};function vt(e){this.defaults=e,this.interceptors={request:new de,response:new de}}vt.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Ct(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[yt,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},vt.prototype.getUri=function(e){return e=Ct(this.defaults,e),le(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},ie.forEach(["delete","get","head","options"],(function(e){vt.prototype[e]=function(t,r){return this.request(Ct(r||{},{method:e,url:t,data:(r||{}).data}))}})),ie.forEach(["post","put","patch"],(function(e){vt.prototype[e]=function(t,r,n){return this.request(Ct(n||{},{method:e,url:t,data:r}))}}));var bt=vt;function St(e){this.message=e}St.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},St.prototype.__CANCEL__=!0;var Rt=St;function Et(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new Rt(e),t(r.reason))}))}Et.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Et.source=function(){var e;return{token:new Et((function(t){e=t})),cancel:e}};var Ot=Et;function _t(e){var t=new bt(e),r=Q(bt.prototype.request,t);return ie.extend(r,bt.prototype,t),ie.extend(r,t),r}var xt=_t(gt);xt.Axios=bt,xt.create=function(e){return _t(Ct(xt.defaults,e))},xt.Cancel=Rt,xt.CancelToken=Ot,xt.isCancel=pe,xt.all=function(e){return Promise.all(e)},xt.spread=function(e){return function(t){return e.apply(null,t)}},xt.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError};var At=xt,$t=xt;At.default=$t;var Ft=At;exports.WebSocket=void 0,function(e){e.Client=class extends I{constructor(e){var r,n,o;super(),S(this,"$ws",void 0),S(this,"$options",void 0),S(this,"$respCallbacks",new Map),S(this,"$openCallbacks",[]),S(this,"$opened",!1),S(this,"$waitOpened",(()=>new Promise(((e,t)=>{this.$opened&&1==this.$ws.readyState?e():this.$ws.readyState<1&&this.$ws.readyState>1?t(this.$ws.readyState):this.$openCallbacks.push(e)})))),S(this,"$sendRaw",(e=>new Promise(((t,r)=>{try{this.$ws.send(e)}catch(e){r(e)}})))),S(this,"$sendJson",((e,...t)=>new Promise((async(r,n)=>{var o,s;await this.$waitOpened();let a=$(),i={jsonrpc:"2.0",id:a,method:e,params:[]};null!=(null===(o=this.$options)||void 0===o||null===(s=o.auth)||void 0===s?void 0:s.secret)&&i.params.push("token:"+this.$options.auth.secret),i.params=[...i.params,...t],this.$respCallbacks.set(a,r),this.$sendRaw(JSON.stringify(i)).catch(n)})))),S(this,"$systemMethods",new t(this)),this.$options=Object.assign({},e),this.$ws=new K(`${null!==(r=e.protocol)&&void 0!==r?r:"ws"}://${e.host}:${e.port}${null!==(n=e.path)&&void 0!==n?n:"/jsonrpc"}`,Y()?null!==(o=e.wsOptions)&&void 0!==o?o:{}:void 0),this.$ws.onclose=()=>{this.emit("ws.close"),this.$opened=!1,this.$openCallbacks=[]},this.$ws.onopen=()=>{for(this.emit("ws.open"),this.$opened=!0;this.$openCallbacks.length>0;){let e=this.$openCallbacks.pop();null!=e&&1==this.$ws.readyState&&e()}},this.$ws.onmessage=e=>{var t,r,n,o,s,a,i;("message"==(null===(t=e)||void 0===t?void 0:t.type)||Y())&&(e=e.data);try{this.emit("ws.message",e);let t=JSON.parse(e.toString());if(t instanceof Array){let e=this.$respCallbacks.get(t[0].id);null!=e&&e(t),this.$respCallbacks.delete(t[0].id)}else if(null!=t.id&&this.$respCallbacks.has(null==t?void 0:t.id)){let e=this.$respCallbacks.get(t.id);null!=e&&e(t),this.$respCallbacks.delete(t.id)}else if(null!=t.method)switch(null==t?void 0:t.method){case"aria2.onDownloadStart":this.emit("aria2.onDownloadStart",{},...null!==(r=t.params)&&void 0!==r?r:[]);break;case"aria2.onDownloadPause":this.emit("aria2.onDownloadPause",{},...null!==(n=t.params)&&void 0!==n?n:[]);break;case"aria2.onDownloadStop":this.emit("aria2.onDownloadStop",{},...null!==(o=t.params)&&void 0!==o?o:[]);break;case"aria2.onDownloadComplete":this.emit("aria2.onDownloadComplete",{},...null!==(s=t.params)&&void 0!==s?s:[]);break;case"aria2.onDownloadError":this.emit("aria2.onDownloadError",{},...null!==(a=t.params)&&void 0!==a?a:[]);break;case"aria2.onBtDownloadComplete":this.emit("aria2.onBtDownloadComplete",{},...null!==(i=t.params)&&void 0!==i?i:[])}}catch(e){throw this.$errorHandle(e),e}}}$errorHandle(e){}get system(){return this.$systemMethods}async rawCall(e,...t){let r=await this.$sendJson(e,...t);if(null!=r.error)throw r.error;return r.result}async rawSend(e){return await this.$sendRaw(e)}async getCreateOptions(){return Object.freeze(this.$options)}async closeConnection(e,t){this.$ws.close(e,t)}};class t extends J{async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}multicall(...e){return new Promise((async(t,r)=>{var n;let o=$(),s=!1,a=[],i=await this.$client.getCreateOptions();var u;null!=(null==i||null===(n=i.auth)||void 0===n?void 0:n.secret)&&a.push("token:"+(null==i||null===(u=i.auth)||void 0===u?void 0:u.secret));let l=[];for(const t of e)1!=s?(l.push({jsonrpc:"2.0",id:o,method:t.methodName,params:[...a,...t.params]}),s=!0):l.push({jsonrpc:"2.0",id:$(),method:t.methodName,params:[...a,...t.params]});await this.$client.$waitOpened(),this.$client.$respCallbacks.set(o,(e=>{let r=[];for(const t of e)null!=t.error?r.push(Promise.reject(t.error)):r.push(Promise.resolve(t.result));t(r)})),this.$client.rawSend(JSON.stringify(l)).catch(r)}))}}e.SystemMethods=t}(exports.WebSocket||(exports.WebSocket={})),exports.Http=void 0,function(e){e.Client=class extends I{constructor(e){super(),S(this,"$options",void 0),S(this,"$system",void 0),this.$options=e,this.$system=new t(this)}onDownloadStart(){throw new Error("Method not implemented.")}onDownloadPause(){throw new Error("Method not implemented.")}onDownloadStop(){throw new Error("Method not implemented.")}onDownloadComplete(){throw new Error("Method not implemented.")}onDownloadError(){throw new Error("Method not implemented.")}onBtDownloadStart(){throw new Error("Method not implemented.")}get system(){return this.$system}async rawCall(e,...t){var r,n,o;let s=$(),a=[...t];null!=(null===(r=this.$options)||void 0===r||null===(n=r.auth)||void 0===n?void 0:n.secret)&&a.push("token:"+this.$options.auth.secret);let i=`${null!==(o=this.$options.protocol)&&void 0!==o?o:"http"}://${this.$options.host}:${this.$options.port}/jsonrpc?method=${decodeURIComponent(e)}&id=${decodeURIComponent(s)}¶ms=${Z(JSON.stringify(a))}`,u=(await Ft(i,{method:"GET",...this.$options.fetchOptions})).data;if(null==u.error)return u.result;throw u.error}async rawSend(e){throw new Error("Method not implemented.")}async getCreateOptions(){return this.$options}};class t extends J{async multicall(...e){let t={},r=[],n=[],o=await this.$client.getCreateOptions();for(const i of e){var s,a;let e=$(),u=[];null!=(null==o||null===(s=o.auth)||void 0===s?void 0:s.secret)&&u.push(null==o||null===(a=o.auth)||void 0===a?void 0:a.secret),r.push({jsonrpc:"2.0",id:e,params:[...u,...i.params],method:i.methodName}),n.push(new Promise(((r,n)=>{t[e]={r:r,j:n}})))}return new Promise((async()=>{var e;let n=`${null!==(e=o.protocol)&&void 0!==e?e:"http"}://${o.host}:${o.port}/jsonrpc?method=&id=¶ms=${Z(JSON.stringify(r))}`,s=await Ft(n,{method:"GET",...o.fetchOptions});for(const e of s.data)null!=e.id&&null!=t[e.id]&&(null!=e.error?t[e.id].j(e.error):t[e.id].r(e.result))})),n}async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}}e.SystemMethods=t}(exports.Http||(exports.Http={})),exports.Adapter=X; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("events"),t=require("http"),r=require("https"),n=require("url"),o=require("stream"),s=require("assert"),i=require("tty"),a=require("util"),u=require("os"),l=require("zlib"),c=require("crypto");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=d(t),f=d(r),p=d(n),m=d(o),g=d(s),w=d(i),y=d(a),v=d(u),C=d(l),b=d(c);function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const S=new Uint8Array(256);let O=S.length;function _(){return O>S.length-16&&(b.default.randomFillSync(S),O=0),S.slice(O,O+=16)}var R=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const T=[];for(let e=0;e<256;++e)T.push((e+256).toString(16).substr(1));function x(e,t=0){const r=(T[e[t+0]]+T[e[t+1]]+T[e[t+2]]+T[e[t+3]]+"-"+T[e[t+4]]+T[e[t+5]]+"-"+T[e[t+6]]+T[e[t+7]]+"-"+T[e[t+8]]+T[e[t+9]]+"-"+T[e[t+10]]+T[e[t+11]]+T[e[t+12]]+T[e[t+13]]+T[e[t+14]]+T[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&R.test(e)}(r))throw TypeError("Stringified UUID is invalid");return r}function A(e,t,r){const n=(e=e||{}).random||(e.rng||_)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return x(n)}function $(e){return e.toString()}function F(e){return e.toString()}function k(e){if(/^(false|true)$/.test(e))return"true"==e;throw"Unknown Boolean Value: "+e}function P(e){return Number(e)}function j(e){return BigInt(e)}function L(e){let t={};for(const r in e)if(null!=e[r])if("string"==typeof e[r])t[r]=e[r];else if("boolean"==typeof e[r])t[r]=e[r].toString();else if("number"==typeof e[r])t[r]=F(e[r]);else{if("bigint"!=typeof e[r])throw"Unknown Value: "+e[r];t[r]=$(e[r])}return t}function B(e){let t={};for(const r in e)if(null!=e[r])if("string"==typeof e[r])t[r]=e[r];else if("boolean"==typeof e[r])t[r]=k(e[r]);else if("number"==typeof e[r])t[r]=P(e[r]);else{if("bigint"!=typeof e[r])throw"Unknown Value: "+e[r];t[r]=j(e[r])}return t}function N(e){let t=Object.assign({},e);if(null!=e.totalLength&&(t.totalLength=j(e.totalLength)),null!=e.totalLength&&(t.completedLength=j(e.completedLength)),null!=e.totalLength&&(t.uploadLength=j(e.uploadLength)),null!=e.totalLength&&(t.downloadSpeed=j(e.downloadSpeed)),null!=e.totalLength&&(t.uploadSpeed=j(e.uploadSpeed)),null!=e.numSeeders&&(t.numSeeders=j(e.numSeeders)),null!=e.seeder&&(t.seeder=k(e.seeder)),null!=e.totalLength&&(t.pieceLength=j(e.pieceLength)),null!=e.totalLength&&(t.numPieces=j(e.numPieces)),null!=e.totalLength&&(t.connections=j(e.connections)),null!=e.errorCode&&(t.errorCode=P(e.errorCode)),null!=e.bittorrent&&null!=e.bittorrent.creationDate&&(t.bittorrent.creationDate=j(e.bittorrent.creationDate)),null!=e.files)for(const r in e.files)t.files[r]=D(e.files[r]);return t}function D(e){let t=Object.assign({},e);return t.length=j(e.length),t.completedLength=j(e.completedLength),t.index=P(e.index),t.selected=k(e.selected),t}function U(e){let t=Object.assign({},e);return t.amChoking=k(e.amChoking),t.downloadSpeed=j(e.downloadSpeed),t.peerChoking=k(e.peerChoking),t.port=P(e.port),t.seeder=k(e.seeder),t.uploadSpeed=j(e.uploadSpeed),t}function q(e){let t=Object.assign({},e);return t.downloadSpeed=j(e.downloadSpeed),t}function M(e){let t=Object.assign({},e);t.index=P(e.index);for(const r in e.servers)t.servers[r]=q(e.servers[r]);return t}class I extends e.EventEmitter{constructor(){super()}async addMetalink(e,t,r){var n;null!==(n=process.versions.node)&&void 0!==n&&n&&e instanceof Buffer&&(e=e.toString("base64"));let o=[e];if(null!=t&&o.push(t),null!=t&&null!=r)o.push(r);else if(null!=r)throw"Require `options`!";return await this.rawCall("aria2.addMetalink",...o)}async remove(e){return await this.rawCall("aria2.remove",e)}async forceRemove(e){return await this.rawCall("aria2.forceRemove",e)}async pause(e){return await this.rawCall("aria2.pause",e)}async forcePause(e){return await this.rawCall("aria2.forcePause",e)}async pauseAll(){return await this.rawCall("aria2.pauseAll")}async forcePauseAll(){return await this.rawCall("aria2.forcePauseAll")}async unpause(e){return await this.rawCall("aria2.unpause",e)}async unpauseAll(){return await this.rawCall("aria2.unpauseAll")}async tellStatus(e,t){if(null!=t){return N(await this.rawCall("aria2.tellStatus",e,t))}return N(await this.rawCall("aria2.tellStatus",e))}async getUris(e){return await this.rawCall("aria2.getUris",e)}async getFiles(e){return await this.rawCall("aria2.getFiles",e)}async getPeers(e){return(await this.rawCall("aria2.getPeers",e)).map(U)}async getServers(e){return(await this.rawCall("aria2.getServers",e)).map(M)}async tellActive(e){if(null!=e){return(await this.rawCall("aria2.tellActive",e)).map(N)}return(await this.rawCall("aria2.tellActive")).map(N)}async tellWaiting(e,t,r){if(null!=r){return(await this.rawCall("aria2.tellWaiting",e,t,r)).map(N)}return(await this.rawCall("aria2.tellWaiting",e,t)).map(N)}async tellStopped(e,t,r){if(null!=r){return(await this.rawCall("aria2.tellStopped",e,t,r)).map(N)}return(await this.rawCall("aria2.tellStopped",e,t)).map(N)}async changePosition(e,t,r){return await this.rawCall("aria2.changePosition",e,t,r)}async changeUri(e,t,r,n,o){return await this.rawCall("aria2.changeUri",e,t,r,n,o)}async getOption(e){return B(await this.rawCall("aria2.getOption",e))}async changeOption(e,t){return await this.rawCall("aria2.changeOption",e,L(t))}async getGlobalOption(){return B(await this.rawCall("aria2.getGlobalOption"))}async changeGlobalOption(e){return await this.rawCall("aria2.changeGlobalOption",L(e))}async getGlobalStat(){return function(e){let t=Object.assign({},e);return t.downloadSpeed=j(e.downloadSpeed),t.uploadSpeed=j(e.uploadSpeed),t.numActive=P(e.numActive),t.numWaiting=P(e.numWaiting),t.numStopped=P(e.numStopped),t.numStoppedTotal=P(e.numStoppedTotal),t}(await this.rawCall("aria2.getGlobalStat"))}async purgeDownloadResult(){return await this.rawCall("aria2.purgeDownloadResult")}async removeDownloadResult(e){return await this.rawCall("aria2.removeDownloadResult",e)}async getVersion(){return await this.rawCall("aria2.getVersion")}async shutdown(){return await this.rawCall("aria2.shutdown")}async forceShutdown(){return await this.rawCall("aria2.forceShutdown")}async saveSession(){return await this.rawCall("aria2.saveSession")}async getSessionInfo(){return await this.rawCall("aria2.getSessioninfo")}async addUri(e,t,r){"string"==typeof e&&(e=[e]);let n=[e];if(null!=t&&n.push(L(t)),null!=t&&null!=r)n.push(r);else if(null!=r)throw"Require `options`!";return await this.rawCall("aria2.addUri",...n)}async addTorrent(e,t,r,n){e instanceof Buffer&&(e=e.toString("base64")),"string"==typeof t&&(t=[t]);let o=[e,t];if(null!=r&&o.push(r),null!=r&&null!=n)o.push(n);else if(null!=n)throw"Require `options`!";return await this.rawCall("aria2.addTorrent",...o)}onceDownloadStart(){return new Promise((e=>this.once("aria2.onDownloadStart",e)))}onceDownloadPause(){return new Promise((e=>this.once("aria2.onDownloadPause",e)))}onceDownloadStop(){return new Promise((e=>this.once("aria2.onDownloadStop",e)))}onceDownloadComplete(){return new Promise((e=>this.once("aria2.onDownloadComplete",e)))}onceDownloadError(){return new Promise((e=>this.once("aria2.onDownloadError",e)))}onceBtDownloadStart(){return new Promise((e=>this.once("aria2.onBtDownloadStart",e)))}}var z,H,J,G;!function(e){e.Set="POS_SET",e.Cur="POS_CUR",e.End="POS_END"}(z||(z={})),function(e){e.Active="active",e.Waiting="waiting",e.Paused="paused",e.Error="error",e.Complete="complete",e.Removed="removed"}(H||(H={})),function(e){e.Waiting="waiting",e.Used="used"}(J||(J={})),function(e){e.Single="single",e.Multi="multi"}(G||(G={}));class W{constructor(e){E(this,"$client",void 0),this.$client=e}}var V,X=Object.freeze({__proto__:null,Aria2ClientBaseClass:I,get EAria2ChangePositionHow(){return z},get EAria2DownloadState(){return H},get EAria2UriStatusEnum(){return J},get EAria2DownloadBitTorrentMode(){return G},Aria2ClientSystemMethodsBaseClass:W});!function(e){e.atob=function(e){return Buffer.from(e,"base64").toString()},e.btoa=function(e){return Buffer.from(e).toString("base64")}}(V||(V={}));const Y=()=>{var e,t;return"string"==typeof(null===globalThis||void 0===globalThis||null===(e=globalThis.process)||void 0===e||null===(t=e.versions)||void 0===t?void 0:t.node)},K=null!=globalThis.WebSocket?class extends globalThis.WebSocket{constructor(e){super(e)}}:require("ws"),Z=(()=>{if(Y())return V.btoa;if(null!=globalThis.btoa)return globalThis.btoa;throw new Error("`btoa()` is not defined!")})();(()=>{if(Y())return V.atob;if(null!=globalThis.atob)return globalThis.atob;throw new Error("`atob()` is not defined!")})();var Q=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},ee=Object.prototype.toString;function te(e){return"[object Array]"===ee.call(e)}function re(e){return void 0===e}function ne(e){return null!==e&&"object"==typeof e}function oe(e){if("[object Object]"!==ee.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function se(e){return"[object Function]"===ee.call(e)}function ie(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),te(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var ae={isArray:te,isArrayBuffer:function(e){return"[object ArrayBuffer]"===ee.call(e)},isBuffer:function(e){return null!==e&&!re(e)&&null!==e.constructor&&!re(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:ne,isPlainObject:oe,isUndefined:re,isDate:function(e){return"[object Date]"===ee.call(e)},isFile:function(e){return"[object File]"===ee.call(e)},isBlob:function(e){return"[object Blob]"===ee.call(e)},isFunction:se,isStream:function(e){return ne(e)&&se(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:ie,merge:function e(){var t={};function r(r,n){oe(t[n])&&oe(r)?t[n]=e(t[n],r):oe(r)?t[n]=e({},r):te(r)?t[n]=r.slice():t[n]=r}for(var n=0,o=arguments.length;n<o;n++)ie(arguments[n],r);return t},extend:function(e,t,r){return ie(t,(function(t,n){e[n]=r&&"function"==typeof t?Q(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}};function ue(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var le=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(ae.isURLSearchParams(t))n=t.toString();else{var o=[];ae.forEach(t,(function(e,t){null!=e&&(ae.isArray(e)?t+="[]":e=[e],ae.forEach(e,(function(e){ae.isDate(e)?e=e.toISOString():ae.isObject(e)&&(e=JSON.stringify(e)),o.push(ue(t)+"="+ue(e))})))})),n=o.join("&")}if(n){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e};function ce(){this.handlers=[]}ce.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},ce.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},ce.prototype.forEach=function(e){ae.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var de=ce,he=function(e,t){ae.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))},fe=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},pe=function(e,t,r,n,o){var s=new Error(e);return fe(s,t,r,n,o)},me=function(e,t,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(pe("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)},ge=ae.isStandardBrowserEnv()?{write:function(e,t,r,n,o,s){var i=[];i.push(e+"="+encodeURIComponent(t)),ae.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),ae.isString(n)&&i.push("path="+n),ae.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},we=function(e,t){return e&&!function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t},ye=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],ve=ae.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=ae.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0};function Ce(e){this.message=e}Ce.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Ce.prototype.__CANCEL__=!0;var be=Ce,Ee=yt,Se=function(e){return new Promise((function(t,r){var n,o=e.data,s=e.headers,i=e.responseType;function a(){e.cancelToken&&e.cancelToken.unsubscribe(n),e.signal&&e.signal.removeEventListener("abort",n)}ae.isFormData(o)&&delete s["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",c=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.Authorization="Basic "+btoa(l+":"+c)}var d=we(e.baseURL,e.url);function h(){if(u){var n,o,s,l,c,d="getAllResponseHeaders"in u?(n=u.getAllResponseHeaders(),c={},n?(ae.forEach(n.split("\n"),(function(e){if(l=e.indexOf(":"),o=ae.trim(e.substr(0,l)).toLowerCase(),s=ae.trim(e.substr(l+1)),o){if(c[o]&&ye.indexOf(o)>=0)return;c[o]="set-cookie"===o?(c[o]?c[o]:[]).concat([s]):c[o]?c[o]+", "+s:s}})),c):c):null,h={data:i&&"text"!==i&&"json"!==i?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:d,config:e,request:u};me((function(e){t(e),a()}),(function(e){r(e),a()}),h),u=null}}if(u.open(e.method.toUpperCase(),le(d,e.params,e.paramsSerializer),!0),u.timeout=e.timeout,"onloadend"in u?u.onloadend=h:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(h)},u.onabort=function(){u&&(r(pe("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){r(pe("Network Error",e,null,u)),u=null},u.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded",n=e.transitional||Ee.transitional;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(pe(t,e,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},ae.isStandardBrowserEnv()){var f=(e.withCredentials||ve(d))&&e.xsrfCookieName?ge.read(e.xsrfCookieName):void 0;f&&(s[e.xsrfHeaderName]=f)}"setRequestHeader"in u&&ae.forEach(s,(function(e,t){void 0===o&&"content-type"===t.toLowerCase()?delete s[t]:u.setRequestHeader(t,e)})),ae.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),i&&"json"!==i&&(u.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&u.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(n=function(e){u&&(r(!e||e&&e.type?new be("canceled"):e),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(n),e.signal&&(e.signal.aborted?n():e.signal.addEventListener("abort",n))),o||(o=null),u.send(o)}))};function Oe(e){var t={exports:{}};return e(t,t.exports),t.exports}var _e=1e3,Re=60*_e,Te=60*Re,xe=24*Te,Ae=7*xe,$e=365.25*xe,Fe=function(e,t){t=t||{};var r=typeof e;if("string"===r&&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 r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*$e;case"weeks":case"week":case"w":return r*Ae;case"days":case"day":case"d":return r*xe;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Te;case"minutes":case"minute":case"mins":case"min":case"m":return r*Re;case"seconds":case"second":case"secs":case"sec":case"s":return r*_e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=xe)return ke(e,t,xe,"day");if(t>=Te)return ke(e,t,Te,"hour");if(t>=Re)return ke(e,t,Re,"minute");if(t>=_e)return ke(e,t,_e,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=xe)return Math.round(e/xe)+"d";if(t>=Te)return Math.round(e/Te)+"h";if(t>=Re)return Math.round(e/Re)+"m";if(t>=_e)return Math.round(e/_e)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function ke(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}var Pe=function(e){function t(e){let n,o,s,i=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),s=o-(n||o);r.diff=s,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";i++;const s=t.formatters[o];if("function"==typeof s){const t=e[i];n=s.call(r,t),e.splice(i,1),i--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(o!==t.namespaces&&(o=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(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(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(e=n[r].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 r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=Fe,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((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t},je=Oe((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 r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},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&&"undefined"!=typeof process&&"env"in process&&(e=process.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=Pe(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}})),Le=(e,t=process.argv)=>{const r=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return-1!==n&&(-1===o||n<o)};const{env:Be}=process;let Ne;function De(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Ue(e,t){if(0===Ne)return 0;if(Le("color=16m")||Le("color=full")||Le("color=truecolor"))return 3;if(Le("color=256"))return 2;if(e&&!t&&void 0===Ne)return 0;const r=Ne||0;if("dumb"===Be.TERM)return r;if("win32"===process.platform){const e=v.default.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in Be)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in Be))||"codeship"===Be.CI_NAME?1:r;if("TEAMCITY_VERSION"in Be)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Be.TEAMCITY_VERSION)?1:0;if("truecolor"===Be.COLORTERM)return 3;if("TERM_PROGRAM"in Be){const e=parseInt((Be.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Be.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Be.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Be.TERM)||"COLORTERM"in Be?1:r}Le("no-color")||Le("no-colors")||Le("color=false")||Le("color=never")?Ne=0:(Le("color")||Le("colors")||Le("color=true")||Le("color=always"))&&(Ne=1),"FORCE_COLOR"in Be&&(Ne="true"===Be.FORCE_COLOR?1:"false"===Be.FORCE_COLOR?0:0===Be.FORCE_COLOR.length?1:Math.min(parseInt(Be.FORCE_COLOR,10),3));var qe,Me={supportsColor:function(e){return De(Ue(e,e&&e.isTTY))},stdout:De(Ue(!0,w.default.isatty(1))),stderr:De(Ue(!0,w.default.isatty(2)))},Ie=Oe((function(e,t){t.init=function(e){e.inspectOpts={};const r=Object.keys(t.inspectOpts);for(let n=0;n<r.length;n++)e.inspectOpts[r[n]]=t.inspectOpts[r[n]]},t.log=function(...e){return process.stderr.write(y.default.format(...e)+"\n")},t.formatArgs=function(r){const{namespace:n,useColors:o}=this;if(o){const t=this.color,o="[3"+(t<8?t:"8;5;"+t),s=` ${o};1m${n} [0m`;r[0]=s+r[0].split("\n").join("\n"+s),r.push(o+"m+"+e.exports.humanize(this.diff)+"[0m")}else r[0]=function(){if(t.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+n+" "+r[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):w.default.isatty(process.stderr.fd)},t.destroy=y.default.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=Me;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(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let n=process.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[r]=n,e}),{}),e.exports=Pe(t);const{formatters:r}=e.exports;r.o=function(e){return this.inspectOpts.colors=this.useColors,y.default.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},r.O=function(e){return this.inspectOpts.colors=this.useColors,y.default.inspect(e,this.inspectOpts)}})),ze=Oe((function(e){"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?e.exports=je:e.exports=Ie})),He=function(){if(!qe){try{qe=ze("follow-redirects")}catch(e){}"function"!=typeof qe&&(qe=function(){})}qe.apply(null,arguments)},Je=p.default.URL,Ge=m.default.Writable,We=["abort","aborted","connect","error","socket","timeout"],Ve=Object.create(null);We.forEach((function(e){Ve[e]=function(t,r,n){this._redirectable.emit(e,t,r,n)}}));var Xe=ot("ERR_FR_REDIRECTION_FAILURE",""),Ye=ot("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),Ke=ot("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),Ze=ot("ERR_STREAM_WRITE_AFTER_END","write after end");function Qe(e,t){Ge.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var r=this;this._onNativeResponse=function(e){r._processResponse(e)},this._performRequest()}function et(e){var t={maxRedirects:21,maxBodyLength:10485760},r={};return Object.keys(e).forEach((function(n){var o=n+":",s=r[o]=e[n],i=t[n]=Object.create(s);Object.defineProperties(i,{request:{value:function(e,n,s){if("string"==typeof e){var i=e;try{e=rt(new Je(i))}catch(t){e=p.default.parse(i)}}else Je&&e instanceof Je?e=rt(e):(s=n,n=e,e={protocol:o});return"function"==typeof n&&(s=n,n=null),(n=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,n)).nativeProtocols=r,g.default.equal(n.protocol,o,"protocol mismatch"),He("options",n),new Qe(n,s)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,r){var n=i.request(e,t,r);return n.end(),n},configurable:!0,enumerable:!0,writable:!0}})})),t}function tt(){}function rt(e){var t={protocol:e.protocol,hostname:e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:e.pathname+e.search,href:e.href};return""!==e.port&&(t.port=Number(e.port)),t}function nt(e,t){var r;for(var n in t)e.test(n)&&(r=t[n],delete t[n]);return r}function ot(e,t){function r(e){Error.captureStackTrace(this,this.constructor),this.message=e||t}return r.prototype=new Error,r.prototype.constructor=r,r.prototype.name="Error ["+e+"]",r.prototype.code=e,r}function st(e){for(var t=0;t<We.length;t++)e.removeListener(We[t],Ve[We[t]]);e.on("error",tt),e.abort()}Qe.prototype=Object.create(Ge.prototype),Qe.prototype.abort=function(){st(this._currentRequest),this.emit("abort")},Qe.prototype.write=function(e,t,r){if(this._ending)throw new Ze;if(!("string"==typeof e||"object"==typeof e&&"length"in e))throw new TypeError("data should be a string, Buffer or Uint8Array");"function"==typeof t&&(r=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,r)):(this.emit("error",new Ke),this.abort()):r&&r()},Qe.prototype.end=function(e,t,r){if("function"==typeof e?(r=e,e=t=null):"function"==typeof t&&(r=t,t=null),e){var n=this,o=this._currentRequest;this.write(e,t,(function(){n._ended=!0,o.end(null,null,r)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,r)},Qe.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},Qe.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},Qe.prototype.setTimeout=function(e,t){var r=this;function n(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function o(t){r._timeout&&clearTimeout(r._timeout),r._timeout=setTimeout((function(){r.emit("timeout"),s()}),e),n(t)}function s(){r._timeout&&(clearTimeout(r._timeout),r._timeout=null),t&&r.removeListener("timeout",t),r.socket||r._currentRequest.removeListener("socket",o)}return t&&this.on("timeout",t),this.socket?o(this.socket):this._currentRequest.once("socket",o),this.on("socket",n),this.once("response",s),this.once("error",s),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){Qe.prototype[e]=function(t,r){return this._currentRequest[e](t,r)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(Qe.prototype,e,{get:function(){return this._currentRequest[e]}})})),Qe.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}},Qe.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(t){if(this._options.agents){var r=e.substr(0,e.length-1);this._options.agent=this._options.agents[r]}var n=this._currentRequest=t.request(this._options,this._onNativeResponse);this._currentUrl=p.default.format(this._options),n._redirectable=this;for(var o=0;o<We.length;o++)n.on(We[o],Ve[We[o]]);if(this._isRedirect){var s=0,i=this,a=this._requestBodyBuffers;!function e(t){if(n===i._currentRequest)if(t)i.emit("error",t);else if(s<a.length){var r=a[s++];n.finished||n.write(r.data,r.encoding,e)}else i._ended&&n.end()}()}}else this.emit("error",new TypeError("Unsupported protocol "+e))},Qe.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var r=e.headers.location;if(r&&!1!==this._options.followRedirects&&t>=300&&t<400){if(st(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)return void this.emit("error",new Ye);((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],nt(/^content-/i,this._options.headers));var n=nt(/^host$/i,this._options.headers)||p.default.parse(this._currentUrl).hostname,o=p.default.resolve(this._currentUrl,r);He("redirecting to",o),this._isRedirect=!0;var s=p.default.parse(o);if(Object.assign(this._options,s),s.hostname!==n&&nt(/^authorization$/i,this._options.headers),"function"==typeof this._options.beforeRedirect){var i={headers:e.headers};try{this._options.beforeRedirect.call(null,this._options,i)}catch(e){return void this.emit("error",e)}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(e){var a=new Xe("Redirected request failed: "+e.message);a.cause=e,this.emit("error",a)}}else e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),this._requestBodyBuffers=[]};var it=et({http:h.default,https:f.default}),at=et;it.wrap=at;var ut="0.22.0",lt=it.http,ct=it.https,dt=ut,ht=/https:?/;function ft(e,t,r){if(e.hostname=t.host,e.host=t.host,e.port=t.port,e.path=r,t.auth){var n=Buffer.from(t.auth.username+":"+t.auth.password,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+n}e.beforeRedirect=function(e){e.headers.host=e.host,ft(e,t,e.href)}}var pt=function(e){return new Promise((function(t,r){var n;function o(){e.cancelToken&&e.cancelToken.unsubscribe(n),e.signal&&e.signal.removeEventListener("abort",n)}var s=function(e){o(),t(e)},i=function(e){o(),r(e)},a=e.data,u=e.headers,l={};if(Object.keys(u).forEach((function(e){l[e.toLowerCase()]=e})),"user-agent"in l?u[l["user-agent"]]||delete u[l["user-agent"]]:u["User-Agent"]="axios/"+dt,a&&!ae.isStream(a)){if(Buffer.isBuffer(a));else if(ae.isArrayBuffer(a))a=Buffer.from(new Uint8Array(a));else{if(!ae.isString(a))return i(pe("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",e));a=Buffer.from(a,"utf-8")}l["content-length"]||(u["Content-Length"]=a.length)}var c=void 0;e.auth&&(c=(e.auth.username||"")+":"+(e.auth.password||""));var d=we(e.baseURL,e.url),m=p.default.parse(d),g=m.protocol||"http:";if(!c&&m.auth){var w=m.auth.split(":");c=(w[0]||"")+":"+(w[1]||"")}c&&l.authorization&&delete u[l.authorization];var y=ht.test(g),v=y?e.httpsAgent:e.httpAgent,b={path:le(m.path,e.params,e.paramsSerializer).replace(/^\?/,""),method:e.method.toUpperCase(),headers:u,agent:v,agents:{http:e.httpAgent,https:e.httpsAgent},auth:c};e.socketPath?b.socketPath=e.socketPath:(b.hostname=m.hostname,b.port=m.port);var E,S=e.proxy;if(!S&&!1!==S){var O=g.slice(0,-1)+"_proxy",_=process.env[O]||process.env[O.toUpperCase()];if(_){var R=p.default.parse(_),T=process.env.no_proxy||process.env.NO_PROXY,x=!0;if(T){var A=T.split(",").map((function(e){return e.trim()}));x=!A.some((function(e){return!!e&&("*"===e||("."===e[0]&&m.hostname.substr(m.hostname.length-e.length)===e||m.hostname===e))}))}if(x&&(S={host:R.hostname,port:R.port,protocol:R.protocol},R.auth)){var $=R.auth.split(":");S.auth={username:$[0],password:$[1]}}}}S&&(b.headers.host=m.hostname+(m.port?":"+m.port:""),ft(b,S,g+"//"+m.hostname+(m.port?":"+m.port:"")+b.path));var F=y&&(!S||ht.test(S.protocol));e.transport?E=e.transport:0===e.maxRedirects?E=F?f.default:h.default:(e.maxRedirects&&(b.maxRedirects=e.maxRedirects),E=F?ct:lt),e.maxBodyLength>-1&&(b.maxBodyLength=e.maxBodyLength),e.insecureHTTPParser&&(b.insecureHTTPParser=e.insecureHTTPParser);var k=E.request(b,(function(t){if(!k.aborted){var r=t,n=t.req||k;if(204!==t.statusCode&&"HEAD"!==n.method&&!1!==e.decompress)switch(t.headers["content-encoding"]){case"gzip":case"compress":case"deflate":r=r.pipe(C.default.createUnzip()),delete t.headers["content-encoding"]}var o={status:t.statusCode,statusText:t.statusMessage,headers:t.headers,config:e,request:n};if("stream"===e.responseType)o.data=r,me(s,i,o);else{var a=[],u=0;r.on("data",(function(t){a.push(t),u+=t.length,e.maxContentLength>-1&&u>e.maxContentLength&&(r.destroy(),i(pe("maxContentLength size of "+e.maxContentLength+" exceeded",e,null,n)))})),r.on("error",(function(t){k.aborted||i(fe(t,e,null,n))})),r.on("end",(function(){var t=Buffer.concat(a);"arraybuffer"!==e.responseType&&(t=t.toString(e.responseEncoding),e.responseEncoding&&"utf8"!==e.responseEncoding||(t=ae.stripBOM(t))),o.data=t,me(s,i,o)}))}}}));if(k.on("error",(function(t){k.aborted&&"ERR_FR_TOO_MANY_REDIRECTS"!==t.code||i(fe(t,e,null,k))})),e.timeout){var P=parseInt(e.timeout,10);if(isNaN(P))return void i(pe("error trying to parse `config.timeout` to int",e,"ERR_PARSE_TIMEOUT",k));k.setTimeout(P,(function(){k.abort();var t=e.transitional||Ee.transitional;i(pe("timeout of "+P+"ms exceeded",e,t.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",k))}))}(e.cancelToken||e.signal)&&(n=function(e){k.aborted||(k.abort(),i(!e||e&&e.type?new be("canceled"):e))},e.cancelToken&&e.cancelToken.subscribe(n),e.signal&&(e.signal.aborted?n():e.signal.addEventListener("abort",n))),ae.isStream(a)?a.on("error",(function(t){i(fe(t,e,null,k))})).pipe(k):k.end(a)}))},mt={"Content-Type":"application/x-www-form-urlencoded"};function gt(e,t){!ae.isUndefined(e)&&ae.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var wt={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:function(){var e;return"undefined"!=typeof XMLHttpRequest?e=Se:"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)&&(e=pt),e}(),transformRequest:[function(e,t){return he(t,"Accept"),he(t,"Content-Type"),ae.isFormData(e)||ae.isArrayBuffer(e)||ae.isBuffer(e)||ae.isStream(e)||ae.isFile(e)||ae.isBlob(e)?e:ae.isArrayBufferView(e)?e.buffer:ae.isURLSearchParams(e)?(gt(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):ae.isObject(e)||t&&"application/json"===t["Content-Type"]?(gt(t,"application/json"),function(e,t,r){if(ae.isString(e))try{return(t||JSON.parse)(e),ae.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||wt.transitional,r=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,o=!r&&"json"===this.responseType;if(o||n&&ae.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw fe(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};ae.forEach(["delete","get","head"],(function(e){wt.headers[e]={}})),ae.forEach(["post","put","patch"],(function(e){wt.headers[e]=ae.merge(mt)}));var yt=wt,vt=function(e,t,r){var n=this||Ee;return ae.forEach(r,(function(r){e=r.call(n,e,t)})),e},Ct=function(e){return!(!e||!e.__CANCEL__)};function bt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new be("canceled")}var Et=function(e){return bt(e),e.headers=e.headers||{},e.data=vt.call(e,e.data,e.headers,e.transformRequest),e.headers=ae.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ae.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||Ee.adapter)(e).then((function(t){return bt(e),t.data=vt.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return Ct(t)||(bt(e),t&&t.response&&(t.response.data=vt.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},St=function(e,t){t=t||{};var r={};function n(e,t){return ae.isPlainObject(e)&&ae.isPlainObject(t)?ae.merge(e,t):ae.isPlainObject(t)?ae.merge({},t):ae.isArray(t)?t.slice():t}function o(r){return ae.isUndefined(t[r])?ae.isUndefined(e[r])?void 0:n(void 0,e[r]):n(e[r],t[r])}function s(e){if(!ae.isUndefined(t[e]))return n(void 0,t[e])}function i(r){return ae.isUndefined(t[r])?ae.isUndefined(e[r])?void 0:n(void 0,e[r]):n(void 0,t[r])}function a(r){return r in t?n(e[r],t[r]):r in e?n(void 0,e[r]):void 0}var u={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a};return ae.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||o,n=t(e);ae.isUndefined(n)&&t!==a||(r[e]=n)})),r},Ot=ut,_t={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){_t[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var Rt={};_t.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Ot+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,o,s){if(!1===e)throw new Error(n(o," has been removed"+(t?" in "+t:"")));return t&&!Rt[o]&&(Rt[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,s)}};var Tt={assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),o=n.length;o-- >0;){var s=n[o],i=t[s];if(i){var a=e[s],u=void 0===a||i(a,s,e);if(!0!==u)throw new TypeError("option "+s+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+s)}},validators:_t},xt=Tt.validators;function At(e){this.defaults=e,this.interceptors={request:new de,response:new de}}At.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=St(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&Tt.assertOptions(t,{silentJSONParsing:xt.transitional(xt.boolean),forcedJSONParsing:xt.transitional(xt.boolean),clarifyTimeoutError:xt.transitional(xt.boolean)},!1);var r=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var o,s=[];if(this.interceptors.response.forEach((function(e){s.push(e.fulfilled,e.rejected)})),!n){var i=[Et,void 0];for(Array.prototype.unshift.apply(i,r),i=i.concat(s),o=Promise.resolve(e);i.length;)o=o.then(i.shift(),i.shift());return o}for(var a=e;r.length;){var u=r.shift(),l=r.shift();try{a=u(a)}catch(e){l(e);break}}try{o=Et(a)}catch(e){return Promise.reject(e)}for(;s.length;)o=o.then(s.shift(),s.shift());return o},At.prototype.getUri=function(e){return e=St(this.defaults,e),le(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},ae.forEach(["delete","get","head","options"],(function(e){At.prototype[e]=function(t,r){return this.request(St(r||{},{method:e,url:t,data:(r||{}).data}))}})),ae.forEach(["post","put","patch"],(function(e){At.prototype[e]=function(t,r,n){return this.request(St(n||{},{method:e,url:t,data:r}))}}));var $t=At;function Ft(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,n=r._listeners.length;for(t=0;t<n;t++)r._listeners[t](e);r._listeners=null}})),this.promise.then=function(e){var t,n=new Promise((function(e){r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e){r.reason||(r.reason=new be(e),t(r.reason))}))}Ft.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Ft.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},Ft.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},Ft.source=function(){var e;return{token:new Ft((function(t){e=t})),cancel:e}};var kt=Ft;var Pt=function e(t){var r=new $t(t),n=Q($t.prototype.request,r);return ae.extend(n,$t.prototype,r),ae.extend(n,r),n.create=function(r){return e(St(t,r))},n}(Ee);Pt.Axios=$t,Pt.Cancel=be,Pt.CancelToken=kt,Pt.isCancel=Ct,Pt.VERSION=ut,Pt.all=function(e){return Promise.all(e)},Pt.spread=function(e){return function(t){return e.apply(null,t)}},Pt.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError};var jt=Pt,Lt=Pt;jt.default=Lt;var Bt=jt;exports.WebSocket=void 0,function(e){e.Client=class extends I{constructor(e){var r,n,o;super(),E(this,"$ws",void 0),E(this,"$options",void 0),E(this,"$respCallbacks",new Map),E(this,"$openCallbacks",[]),E(this,"$opened",!1),E(this,"$waitOpened",(()=>new Promise(((e,t)=>{this.$opened&&1==this.$ws.readyState?e():this.$ws.readyState<1&&this.$ws.readyState>1?t(this.$ws.readyState):this.$openCallbacks.push(e)})))),E(this,"$sendRaw",(e=>new Promise(((t,r)=>{try{this.$ws.send(e)}catch(e){r(e)}})))),E(this,"$sendJson",((e,...t)=>new Promise((async(r,n)=>{var o,s;await this.$waitOpened();let i=A(),a={jsonrpc:"2.0",id:i,method:e,params:[]};null!=(null===(o=this.$options)||void 0===o||null===(s=o.auth)||void 0===s?void 0:s.secret)&&a.params.push("token:"+this.$options.auth.secret),a.params=[...a.params,...t],this.$respCallbacks.set(i,r),this.$sendRaw(JSON.stringify(a)).catch(n)})))),E(this,"$systemMethods",new t(this)),this.$options=Object.assign({},e),this.$ws=new K(`${null!==(r=e.protocol)&&void 0!==r?r:"ws"}://${e.host}:${e.port}${null!==(n=e.path)&&void 0!==n?n:"/jsonrpc"}`,Y()?null!==(o=e.wsOptions)&&void 0!==o?o:{}:void 0),this.$ws.onclose=()=>{this.emit("ws.close"),this.$opened=!1,this.$openCallbacks=[]},this.$ws.onopen=()=>{for(this.emit("ws.open"),this.$opened=!0;this.$openCallbacks.length>0;){let e=this.$openCallbacks.pop();null!=e&&1==this.$ws.readyState&&e()}},this.$ws.onmessage=e=>{var t,r,n,o,s,i,a;("message"==(null===(t=e)||void 0===t?void 0:t.type)||Y())&&(e=e.data);try{this.emit("ws.message",e);let t=JSON.parse(e.toString());if(t instanceof Array){let e=this.$respCallbacks.get(t[0].id);null!=e&&e(t),this.$respCallbacks.delete(t[0].id)}else if(null!=t.id&&this.$respCallbacks.has(null==t?void 0:t.id)){let e=this.$respCallbacks.get(t.id);null!=e&&e(t),this.$respCallbacks.delete(t.id)}else if(null!=t.method)switch(null==t?void 0:t.method){case"aria2.onDownloadStart":this.emit("aria2.onDownloadStart",{},...null!==(r=t.params)&&void 0!==r?r:[]);break;case"aria2.onDownloadPause":this.emit("aria2.onDownloadPause",{},...null!==(n=t.params)&&void 0!==n?n:[]);break;case"aria2.onDownloadStop":this.emit("aria2.onDownloadStop",{},...null!==(o=t.params)&&void 0!==o?o:[]);break;case"aria2.onDownloadComplete":this.emit("aria2.onDownloadComplete",{},...null!==(s=t.params)&&void 0!==s?s:[]);break;case"aria2.onDownloadError":this.emit("aria2.onDownloadError",{},...null!==(i=t.params)&&void 0!==i?i:[]);break;case"aria2.onBtDownloadComplete":this.emit("aria2.onBtDownloadComplete",{},...null!==(a=t.params)&&void 0!==a?a:[])}}catch(e){throw this.$errorHandle(e),e}}}$errorHandle(e){}get system(){return this.$systemMethods}async rawCall(e,...t){let r=await this.$sendJson(e,...t);if(null!=r.error)throw r.error;return r.result}async rawSend(e){return await this.$sendRaw(e)}async getCreateOptions(){return Object.freeze(this.$options)}async closeConnection(e,t){this.$ws.close(e,t)}};class t extends W{async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}multicall(...e){return new Promise((async(t,r)=>{var n;let o=A(),s=!1,i=[],a=await this.$client.getCreateOptions();var u;null!=(null==a||null===(n=a.auth)||void 0===n?void 0:n.secret)&&i.push("token:"+(null==a||null===(u=a.auth)||void 0===u?void 0:u.secret));let l=[];for(const t of e)1!=s?(l.push({jsonrpc:"2.0",id:o,method:t.methodName,params:[...i,...t.params]}),s=!0):l.push({jsonrpc:"2.0",id:A(),method:t.methodName,params:[...i,...t.params]});await this.$client.$waitOpened(),this.$client.$respCallbacks.set(o,(e=>{let r=[];for(const t of e)null!=t.error?r.push(Promise.reject(t.error)):r.push(Promise.resolve(t.result));t(r)})),this.$client.rawSend(JSON.stringify(l)).catch(r)}))}}e.SystemMethods=t}(exports.WebSocket||(exports.WebSocket={})),exports.Http=void 0,function(e){e.Client=class extends I{constructor(e){super(),E(this,"$options",void 0),E(this,"$system",void 0),this.$options=e,this.$system=new t(this)}onDownloadStart(){throw new Error("Method not implemented.")}onDownloadPause(){throw new Error("Method not implemented.")}onDownloadStop(){throw new Error("Method not implemented.")}onDownloadComplete(){throw new Error("Method not implemented.")}onDownloadError(){throw new Error("Method not implemented.")}onBtDownloadStart(){throw new Error("Method not implemented.")}get system(){return this.$system}async rawCall(e,...t){var r,n,o;let s=A(),i=[...t];null!=(null===(r=this.$options)||void 0===r||null===(n=r.auth)||void 0===n?void 0:n.secret)&&i.push("token:"+this.$options.auth.secret);let a=`${null!==(o=this.$options.protocol)&&void 0!==o?o:"http"}://${this.$options.host}:${this.$options.port}/jsonrpc?method=${decodeURIComponent(e)}&id=${decodeURIComponent(s)}¶ms=${Z(JSON.stringify(i))}`,u=(await Bt(a,{method:"GET",...this.$options.fetchOptions})).data;if(null==u.error)return u.result;throw u.error}async rawSend(e){throw new Error("Method not implemented.")}async getCreateOptions(){return this.$options}};class t extends W{async multicall(...e){let t={},r=[],n=[],o=await this.$client.getCreateOptions();for(const a of e){var s,i;let e=A(),u=[];null!=(null==o||null===(s=o.auth)||void 0===s?void 0:s.secret)&&u.push(null==o||null===(i=o.auth)||void 0===i?void 0:i.secret),r.push({jsonrpc:"2.0",id:e,params:[...u,...a.params],method:a.methodName}),n.push(new Promise(((r,n)=>{t[e]={r:r,j:n}})))}return new Promise((async()=>{var e;let n=`${null!==(e=o.protocol)&&void 0!==e?e:"http"}://${o.host}:${o.port}/jsonrpc?method=&id=¶ms=${Z(JSON.stringify(r))}`,s=await Bt(n,{method:"GET",...o.fetchOptions});for(const e of s.data)null!=e.id&&null!=t[e.id]&&(null!=e.error?t[e.id].j(e.error):t[e.id].r(e.result))})),n}async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}}e.SystemMethods=t}(exports.Http||(exports.Http={})),exports.Adapter=X; | ||
//# sourceMappingURL=libaria2.node.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import{EventEmitter as e}from"events";import t from"http";import r from"https";import n from"url";import o from"stream";import s from"assert";import i from"tty";import a from"util";import u from"os";import l from"zlib";import c from"crypto";function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const p=new Uint8Array(256);let d=p.length;function f(){return d>p.length-16&&(c.randomFillSync(p),d=0),p.slice(d,d+=16)}var m=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const g=[];for(let e=0;e<256;++e)g.push((e+256).toString(16).substr(1));function w(e,t=0){const r=(g[e[t+0]]+g[e[t+1]]+g[e[t+2]]+g[e[t+3]]+"-"+g[e[t+4]]+g[e[t+5]]+"-"+g[e[t+6]]+g[e[t+7]]+"-"+g[e[t+8]]+g[e[t+9]]+"-"+g[e[t+10]]+g[e[t+11]]+g[e[t+12]]+g[e[t+13]]+g[e[t+14]]+g[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&m.test(e)}(r))throw TypeError("Stringified UUID is invalid");return r}function y(e,t,r){const n=(e=e||{}).random||(e.rng||f)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return w(n)}function C(e){return e.toString()}function v(e){return e.toString()}function b(e){if(/^(false|true)$/.test(e))return"true"==e;throw"Unknown Boolean Value: "+e}function R(e){return Number(e)}function S(e){return BigInt(e)}function E(e){let t={};for(const r in e)if(null!=e[r])if("string"==typeof e[r])t[r]=e[r];else if("boolean"==typeof e[r])t[r]=e[r].toString();else if("number"==typeof e[r])t[r]=v(e[r]);else{if("bigint"!=typeof e[r])throw"Unknown Value: "+e[r];t[r]=C(e[r])}return t}function O(e){let t={};for(const r in e)if(null!=e[r])if("string"==typeof e[r])t[r]=e[r];else if("boolean"==typeof e[r])t[r]=b(e[r]);else if("number"==typeof e[r])t[r]=R(e[r]);else{if("bigint"!=typeof e[r])throw"Unknown Value: "+e[r];t[r]=S(e[r])}return t}function _(e){let t=Object.assign({},e);if(null!=e.totalLength&&(t.totalLength=S(e.totalLength)),null!=e.totalLength&&(t.completedLength=S(e.completedLength)),null!=e.totalLength&&(t.uploadLength=S(e.uploadLength)),null!=e.totalLength&&(t.downloadSpeed=S(e.downloadSpeed)),null!=e.totalLength&&(t.uploadSpeed=S(e.uploadSpeed)),null!=e.numSeeders&&(t.numSeeders=S(e.numSeeders)),null!=e.seeder&&(t.seeder=b(e.seeder)),null!=e.totalLength&&(t.pieceLength=S(e.pieceLength)),null!=e.totalLength&&(t.numPieces=S(e.numPieces)),null!=e.totalLength&&(t.connections=S(e.connections)),null!=e.errorCode&&(t.errorCode=R(e.errorCode)),null!=e.bittorrent&&null!=e.bittorrent.creationDate&&(t.bittorrent.creationDate=S(e.bittorrent.creationDate)),null!=e.files)for(const r in e.files)t.files[r]=x(e.files[r]);return t}function x(e){let t=Object.assign({},e);return t.length=S(e.length),t.completedLength=S(e.completedLength),t.index=R(e.index),t.selected=b(e.selected),t}function A(e){let t=Object.assign({},e);return t.amChoking=b(e.amChoking),t.downloadSpeed=S(e.downloadSpeed),t.peerChoking=b(e.peerChoking),t.port=R(e.port),t.seeder=b(e.seeder),t.uploadSpeed=S(e.uploadSpeed),t}function $(e){let t=Object.assign({},e);return t.downloadSpeed=S(e.downloadSpeed),t}function F(e){let t=Object.assign({},e);t.index=R(e.index);for(const r in e.servers)t.servers[r]=$(e.servers[r]);return t}class T extends e{constructor(){super()}async addMetalink(e,t,r){var n;null!==(n=process.versions.node)&&void 0!==n&&n&&e instanceof Buffer&&(e=e.toString("base64"));let o=[e];if(null!=t&&o.push(t),null!=t&&null!=r)o.push(r);else if(null!=r)throw"Require `options`!";return await this.rawCall("aria2.addMetalink",...o)}async remove(e){return await this.rawCall("aria2.remove",e)}async forceRemove(e){return await this.rawCall("aria2.forceRemove",e)}async pause(e){return await this.rawCall("aria2.pause",e)}async forcePause(e){return await this.rawCall("aria2.forcePause",e)}async pauseAll(){return await this.rawCall("aria2.pauseAll")}async forcePauseAll(){return await this.rawCall("aria2.forcePauseAll")}async unpause(e){return await this.rawCall("aria2.unpause",e)}async unpauseAll(){return await this.rawCall("aria2.unpauseAll")}async tellStatus(e,t){if(null!=t){return _(await this.rawCall("aria2.tellStatus",e,t))}return _(await this.rawCall("aria2.tellStatus",e))}async getUris(e){return await this.rawCall("aria2.getUris",e)}async getFiles(e){return await this.rawCall("aria2.getFiles",e)}async getPeers(e){return(await this.rawCall("aria2.getPeers",e)).map(A)}async getServers(e){return(await this.rawCall("aria2.getServers",e)).map(F)}async tellActive(e){if(null!=e){return(await this.rawCall("aria2.tellActive",e)).map(_)}return(await this.rawCall("aria2.tellActive")).map(_)}async tellWaiting(e,t,r){if(null!=r){return(await this.rawCall("aria2.tellWaiting",e,t,r)).map(_)}return(await this.rawCall("aria2.tellWaiting",e,t)).map(_)}async tellStopped(e,t,r){if(null!=r){return(await this.rawCall("aria2.tellStopped",e,t,r)).map(_)}return(await this.rawCall("aria2.tellStopped",e,t)).map(_)}async changePosition(e,t,r){return await this.rawCall("aria2.changePosition",e,t,r)}async changeUri(e,t,r,n,o){return await this.rawCall("aria2.changeUri",e,t,r,n,o)}async getOption(e){return O(await this.rawCall("aria2.getOption",e))}async changeOption(e,t){return await this.rawCall("aria2.changeOption",e,E(t))}async getGlobalOption(){return O(await this.rawCall("aria2.getGlobalOption"))}async changeGlobalOption(e){return await this.rawCall("aria2.changeGlobalOption",E(e))}async getGlobalStat(){return function(e){let t=Object.assign({},e);return t.downloadSpeed=S(e.downloadSpeed),t.uploadSpeed=S(e.uploadSpeed),t.numActive=R(e.numActive),t.numWaiting=R(e.numWaiting),t.numStopped=R(e.numStopped),t.numStoppedTotal=R(e.numStoppedTotal),t}(await this.rawCall("aria2.getGlobalStat"))}async purgeDownloadResult(){return await this.rawCall("aria2.purgeDownloadResult")}async removeDownloadResult(e){return await this.rawCall("aria2.removeDownloadResult",e)}async getVersion(){return await this.rawCall("aria2.getVersion")}async shutdown(){return await this.rawCall("aria2.shutdown")}async forceShutdown(){return await this.rawCall("aria2.forceShutdown")}async saveSession(){return await this.rawCall("aria2.saveSession")}async getSessionInfo(){return await this.rawCall("aria2.getSessioninfo")}async addUri(e,t,r){"string"==typeof e&&(e=[e]);let n=[e];if(null!=t&&n.push(E(t)),null!=t&&null!=r)n.push(r);else if(null!=r)throw"Require `options`!";return await this.rawCall("aria2.addUri",...n)}async addTorrent(e,t,r,n){e instanceof Buffer&&(e=e.toString("base64")),"string"==typeof t&&(t=[t]);let o=[e,t];if(null!=r&&o.push(r),null!=r&&null!=n)o.push(n);else if(null!=n)throw"Require `options`!";return await this.rawCall("aria2.addTorrent",...o)}onceDownloadStart(){return new Promise((e=>this.once("aria2.onDownloadStart",e)))}onceDownloadPause(){return new Promise((e=>this.once("aria2.onDownloadPause",e)))}onceDownloadStop(){return new Promise((e=>this.once("aria2.onDownloadStop",e)))}onceDownloadComplete(){return new Promise((e=>this.once("aria2.onDownloadComplete",e)))}onceDownloadError(){return new Promise((e=>this.once("aria2.onDownloadError",e)))}onceBtDownloadStart(){return new Promise((e=>this.once("aria2.onBtDownloadStart",e)))}}var B,k,L,j;!function(e){e.Set="POS_SET",e.Cur="POS_CUR",e.End="POS_END"}(B||(B={})),function(e){e.Active="active",e.Waiting="waiting",e.Paused="paused",e.Error="error",e.Complete="complete",e.Removed="removed"}(k||(k={})),function(e){e.Waiting="waiting",e.Used="used"}(L||(L={})),function(e){e.Single="single",e.Multi="multi"}(j||(j={}));class D{constructor(e){h(this,"$client",void 0),this.$client=e}}var P,U=Object.freeze({__proto__:null,Aria2ClientBaseClass:T,get EAria2ChangePositionHow(){return B},get EAria2DownloadState(){return k},get EAria2UriStatusEnum(){return L},get EAria2DownloadBitTorrentMode(){return j},Aria2ClientSystemMethodsBaseClass:D});!function(e){e.atob=function(e){return Buffer.from(e,"base64").toString()},e.btoa=function(e){return Buffer.from(e).toString("base64")}}(P||(P={}));const N=()=>{var e,t;return"string"==typeof(null===globalThis||void 0===globalThis||null===(e=globalThis.process)||void 0===e||null===(t=e.versions)||void 0===t?void 0:t.node)},M=null!=globalThis.WebSocket?class extends globalThis.WebSocket{constructor(e){super(e)}}:require("ws"),q=(()=>{if(N())return P.btoa;if(null!=globalThis.btoa)return globalThis.btoa;throw new Error("`btoa()` is not defined!")})();(()=>{if(N())return P.atob;if(null!=globalThis.atob)return globalThis.atob;throw new Error("`atob()` is not defined!")})();var I=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},z=Object.prototype.toString;function H(e){return"[object Array]"===z.call(e)}function G(e){return void 0===e}function W(e){return null!==e&&"object"==typeof e}function J(e){if("[object Object]"!==z.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function V(e){return"[object Function]"===z.call(e)}function X(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),H(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var Y={isArray:H,isArrayBuffer:function(e){return"[object ArrayBuffer]"===z.call(e)},isBuffer:function(e){return null!==e&&!G(e)&&null!==e.constructor&&!G(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:W,isPlainObject:J,isUndefined:G,isDate:function(e){return"[object Date]"===z.call(e)},isFile:function(e){return"[object File]"===z.call(e)},isBlob:function(e){return"[object Blob]"===z.call(e)},isFunction:V,isStream:function(e){return W(e)&&V(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:X,merge:function e(){var t={};function r(r,n){J(t[n])&&J(r)?t[n]=e(t[n],r):J(r)?t[n]=e({},r):H(r)?t[n]=r.slice():t[n]=r}for(var n=0,o=arguments.length;n<o;n++)X(arguments[n],r);return t},extend:function(e,t,r){return X(t,(function(t,n){e[n]=r&&"function"==typeof t?I(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}};function K(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Z=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(Y.isURLSearchParams(t))n=t.toString();else{var o=[];Y.forEach(t,(function(e,t){null!=e&&(Y.isArray(e)?t+="[]":e=[e],Y.forEach(e,(function(e){Y.isDate(e)?e=e.toISOString():Y.isObject(e)&&(e=JSON.stringify(e)),o.push(K(t)+"="+K(e))})))})),n=o.join("&")}if(n){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e};function Q(){this.handlers=[]}Q.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},Q.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},Q.prototype.forEach=function(e){Y.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var ee=Q,te=function(e,t,r){return Y.forEach(r,(function(r){e=r(e,t)})),e},re=function(e){return!(!e||!e.__CANCEL__)},ne=function(e,t){Y.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))},oe=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e},se=function(e,t,r,n,o){var s=new Error(e);return oe(s,t,r,n,o)},ie=function(e,t,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(se("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)},ae=Y.isStandardBrowserEnv()?{write:function(e,t,r,n,o,s){var i=[];i.push(e+"="+encodeURIComponent(t)),Y.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),Y.isString(n)&&i.push("path="+n),Y.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},ue=function(e,t){return e&&!function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t},le=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],ce=Y.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=Y.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0},he=function(e){return new Promise((function(t,r){var n=e.data,o=e.headers;Y.isFormData(n)&&delete o["Content-Type"];var s=new XMLHttpRequest;if(e.auth){var i=e.auth.username||"",a=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(i+":"+a)}var u=ue(e.baseURL,e.url);if(s.open(e.method.toUpperCase(),Z(u,e.params,e.paramsSerializer),!0),s.timeout=e.timeout,s.onreadystatechange=function(){if(s&&4===s.readyState&&(0!==s.status||s.responseURL&&0===s.responseURL.indexOf("file:"))){var n,o,i,a,u,l="getAllResponseHeaders"in s?(n=s.getAllResponseHeaders(),u={},n?(Y.forEach(n.split("\n"),(function(e){if(a=e.indexOf(":"),o=Y.trim(e.substr(0,a)).toLowerCase(),i=Y.trim(e.substr(a+1)),o){if(u[o]&&le.indexOf(o)>=0)return;u[o]="set-cookie"===o?(u[o]?u[o]:[]).concat([i]):u[o]?u[o]+", "+i:i}})),u):u):null,c={data:e.responseType&&"text"!==e.responseType?s.response:s.responseText,status:s.status,statusText:s.statusText,headers:l,config:e,request:s};ie(t,r,c),s=null}},s.onabort=function(){s&&(r(se("Request aborted",e,"ECONNABORTED",s)),s=null)},s.onerror=function(){r(se("Network Error",e,null,s)),s=null},s.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(se(t,e,"ECONNABORTED",s)),s=null},Y.isStandardBrowserEnv()){var l=(e.withCredentials||ce(u))&&e.xsrfCookieName?ae.read(e.xsrfCookieName):void 0;l&&(o[e.xsrfHeaderName]=l)}if("setRequestHeader"in s&&Y.forEach(o,(function(e,t){void 0===n&&"content-type"===t.toLowerCase()?delete o[t]:s.setRequestHeader(t,e)})),Y.isUndefined(e.withCredentials)||(s.withCredentials=!!e.withCredentials),e.responseType)try{s.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&s.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&s.upload&&s.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){s&&(s.abort(),r(e),s=null)})),n||(n=null),s.send(n)}))};function pe(e){var t={exports:{}};return e(t,t.exports),t.exports}var de=1e3,fe=60*de,me=60*fe,ge=24*me,we=7*ge,ye=365.25*ge,Ce=function(e,t){t=t||{};var r=typeof e;if("string"===r&&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 r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*ye;case"weeks":case"week":case"w":return r*we;case"days":case"day":case"d":return r*ge;case"hours":case"hour":case"hrs":case"hr":case"h":return r*me;case"minutes":case"minute":case"mins":case"min":case"m":return r*fe;case"seconds":case"second":case"secs":case"sec":case"s":return r*de;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=ge)return ve(e,t,ge,"day");if(t>=me)return ve(e,t,me,"hour");if(t>=fe)return ve(e,t,fe,"minute");if(t>=de)return ve(e,t,de,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=ge)return Math.round(e/ge)+"d";if(t>=me)return Math.round(e/me)+"h";if(t>=fe)return Math.round(e/fe)+"m";if(t>=de)return Math.round(e/de)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function ve(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}var be=function(e){function t(e){let n,o,s,i=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),s=o-(n||o);r.diff=s,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";i++;const s=t.formatters[o];if("function"==typeof s){const t=e[i];n=s.call(r,t),e.splice(i,1),i--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(o!==t.namespaces&&(o=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(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(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(e=n[r].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 r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=Ce,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((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t},Re=pe((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 r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},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&&"undefined"!=typeof process&&"env"in process&&(e=process.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=be(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}})),Se=(e,t=process.argv)=>{const r=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return-1!==n&&(-1===o||n<o)};const{env:Ee}=process;let Oe;function _e(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function xe(e,t){if(0===Oe)return 0;if(Se("color=16m")||Se("color=full")||Se("color=truecolor"))return 3;if(Se("color=256"))return 2;if(e&&!t&&void 0===Oe)return 0;const r=Oe||0;if("dumb"===Ee.TERM)return r;if("win32"===process.platform){const e=u.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in Ee)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in Ee))||"codeship"===Ee.CI_NAME?1:r;if("TEAMCITY_VERSION"in Ee)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ee.TEAMCITY_VERSION)?1:0;if("truecolor"===Ee.COLORTERM)return 3;if("TERM_PROGRAM"in Ee){const e=parseInt((Ee.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ee.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ee.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ee.TERM)||"COLORTERM"in Ee?1:r}Se("no-color")||Se("no-colors")||Se("color=false")||Se("color=never")?Oe=0:(Se("color")||Se("colors")||Se("color=true")||Se("color=always"))&&(Oe=1),"FORCE_COLOR"in Ee&&(Oe="true"===Ee.FORCE_COLOR?1:"false"===Ee.FORCE_COLOR?0:0===Ee.FORCE_COLOR.length?1:Math.min(parseInt(Ee.FORCE_COLOR,10),3));var Ae,$e={supportsColor:function(e){return _e(xe(e,e&&e.isTTY))},stdout:_e(xe(!0,i.isatty(1))),stderr:_e(xe(!0,i.isatty(2)))},Fe=pe((function(e,t){t.init=function(e){e.inspectOpts={};const r=Object.keys(t.inspectOpts);for(let n=0;n<r.length;n++)e.inspectOpts[r[n]]=t.inspectOpts[r[n]]},t.log=function(...e){return process.stderr.write(a.format(...e)+"\n")},t.formatArgs=function(r){const{namespace:n,useColors:o}=this;if(o){const t=this.color,o="[3"+(t<8?t:"8;5;"+t),s=` ${o};1m${n} [0m`;r[0]=s+r[0].split("\n").join("\n"+s),r.push(o+"m+"+e.exports.humanize(this.diff)+"[0m")}else r[0]=function(){if(t.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+n+" "+r[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):i.isatty(process.stderr.fd)},t.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`."),t.colors=[6,2,3,4,5,1];try{const e=$e;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(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let n=process.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[r]=n,e}),{}),e.exports=be(t);const{formatters:r}=e.exports;r.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},r.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)}})),Te=pe((function(e){"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?e.exports=Re:e.exports=Fe})),Be=function(){if(!Ae)try{Ae=Te("follow-redirects")}catch(e){Ae=function(){}}Ae.apply(null,arguments)},ke=n.URL,Le=o.Writable,je=["abort","aborted","connect","error","socket","timeout"],De=Object.create(null);je.forEach((function(e){De[e]=function(t,r,n){this._redirectable.emit(e,t,r,n)}}));var Pe=We("ERR_FR_REDIRECTION_FAILURE",""),Ue=We("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),Ne=We("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),Me=We("ERR_STREAM_WRITE_AFTER_END","write after end");function qe(e,t){Le.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var r=this;this._onNativeResponse=function(e){r._processResponse(e)},this._performRequest()}function Ie(e){var t={maxRedirects:21,maxBodyLength:10485760},r={};return Object.keys(e).forEach((function(o){var i=o+":",a=r[i]=e[o],u=t[o]=Object.create(a);Object.defineProperties(u,{request:{value:function(e,o,a){if("string"==typeof e){var u=e;try{e=He(new ke(u))}catch(t){e=n.parse(u)}}else ke&&e instanceof ke?e=He(e):(a=o,o=e,e={protocol:i});return"function"==typeof o&&(a=o,o=null),(o=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,o)).nativeProtocols=r,s.equal(o.protocol,i,"protocol mismatch"),Be("options",o),new qe(o,a)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,r){var n=u.request(e,t,r);return n.end(),n},configurable:!0,enumerable:!0,writable:!0}})})),t}function ze(){}function He(e){var t={protocol:e.protocol,hostname:e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:e.pathname+e.search,href:e.href};return""!==e.port&&(t.port=Number(e.port)),t}function Ge(e,t){var r;for(var n in t)e.test(n)&&(r=t[n],delete t[n]);return r}function We(e,t){function r(e){Error.captureStackTrace(this,this.constructor),this.message=e||t}return r.prototype=new Error,r.prototype.constructor=r,r.prototype.name="Error ["+e+"]",r.prototype.code=e,r}function Je(e){for(var t=0;t<je.length;t++)e.removeListener(je[t],De[je[t]]);e.on("error",ze),e.abort()}qe.prototype=Object.create(Le.prototype),qe.prototype.abort=function(){Je(this._currentRequest),this.emit("abort")},qe.prototype.write=function(e,t,r){if(this._ending)throw new Me;if(!("string"==typeof e||"object"==typeof e&&"length"in e))throw new TypeError("data should be a string, Buffer or Uint8Array");"function"==typeof t&&(r=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,r)):(this.emit("error",new Ne),this.abort()):r&&r()},qe.prototype.end=function(e,t,r){if("function"==typeof e?(r=e,e=t=null):"function"==typeof t&&(r=t,t=null),e){var n=this,o=this._currentRequest;this.write(e,t,(function(){n._ended=!0,o.end(null,null,r)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,r)},qe.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},qe.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},qe.prototype.setTimeout=function(e,t){var r=this;function n(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function o(t){r._timeout&&clearTimeout(r._timeout),r._timeout=setTimeout((function(){r.emit("timeout"),s()}),e),n(t)}function s(){clearTimeout(this._timeout),t&&r.removeListener("timeout",t),this.socket||r._currentRequest.removeListener("socket",o)}return t&&this.on("timeout",t),this.socket?o(this.socket):this._currentRequest.once("socket",o),this.on("socket",n),this.once("response",s),this.once("error",s),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){qe.prototype[e]=function(t,r){return this._currentRequest[e](t,r)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(qe.prototype,e,{get:function(){return this._currentRequest[e]}})})),qe.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}},qe.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(t){if(this._options.agents){var r=e.substr(0,e.length-1);this._options.agent=this._options.agents[r]}var o=this._currentRequest=t.request(this._options,this._onNativeResponse);this._currentUrl=n.format(this._options),o._redirectable=this;for(var s=0;s<je.length;s++)o.on(je[s],De[je[s]]);if(this._isRedirect){var i=0,a=this,u=this._requestBodyBuffers;!function e(t){if(o===a._currentRequest)if(t)a.emit("error",t);else if(i<u.length){var r=u[i++];o.finished||o.write(r.data,r.encoding,e)}else a._ended&&o.end()}()}}else this.emit("error",new TypeError("Unsupported protocol "+e))},qe.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var r=e.headers.location;if(r&&!1!==this._options.followRedirects&&t>=300&&t<400){if(Je(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)return void this.emit("error",new Ue);((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],Ge(/^content-/i,this._options.headers));var o=Ge(/^host$/i,this._options.headers)||n.parse(this._currentUrl).hostname,s=n.resolve(this._currentUrl,r);Be("redirecting to",s),this._isRedirect=!0;var i=n.parse(s);if(Object.assign(this._options,i),i.hostname!==o&&Ge(/^authorization$/i,this._options.headers),"function"==typeof this._options.beforeRedirect){var a={headers:e.headers};try{this._options.beforeRedirect.call(null,this._options,a)}catch(e){return void this.emit("error",e)}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(e){var u=new Pe("Redirected request failed: "+e.message);u.cause=e,this.emit("error",u)}}else e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),this._requestBodyBuffers=[]};var Ve=Ie({http:t,https:r}),Xe=Ie;Ve.wrap=Xe;var Ye="0.21.1",Ke=Ve.http,Ze=Ve.https,Qe=/https:?/;function et(e,t,r){if(e.hostname=t.host,e.host=t.host,e.port=t.port,e.path=r,t.auth){var n=Buffer.from(t.auth.username+":"+t.auth.password,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+n}e.beforeRedirect=function(e){e.headers.host=e.host,et(e,t,e.href)}}var tt=function(e){return new Promise((function(o,s){var i=function(e){o(e)},a=function(e){s(e)},u=e.data,c=e.headers;if(c["User-Agent"]||c["user-agent"]||(c["User-Agent"]="axios/"+Ye),u&&!Y.isStream(u)){if(Buffer.isBuffer(u));else if(Y.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else{if(!Y.isString(u))return a(se("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",e));u=Buffer.from(u,"utf-8")}c["Content-Length"]=u.length}var h=void 0;e.auth&&(h=(e.auth.username||"")+":"+(e.auth.password||""));var p=ue(e.baseURL,e.url),d=n.parse(p),f=d.protocol||"http:";if(!h&&d.auth){var m=d.auth.split(":");h=(m[0]||"")+":"+(m[1]||"")}h&&delete c.Authorization;var g=Qe.test(f),w=g?e.httpsAgent:e.httpAgent,y={path:Z(d.path,e.params,e.paramsSerializer).replace(/^\?/,""),method:e.method.toUpperCase(),headers:c,agent:w,agents:{http:e.httpAgent,https:e.httpsAgent},auth:h};e.socketPath?y.socketPath=e.socketPath:(y.hostname=d.hostname,y.port=d.port);var C,v=e.proxy;if(!v&&!1!==v){var b=f.slice(0,-1)+"_proxy",R=process.env[b]||process.env[b.toUpperCase()];if(R){var S=n.parse(R),E=process.env.no_proxy||process.env.NO_PROXY,O=!0;if(E)O=!E.split(",").map((function(e){return e.trim()})).some((function(e){return!!e&&("*"===e||("."===e[0]&&d.hostname.substr(d.hostname.length-e.length)===e||d.hostname===e))}));if(O&&(v={host:S.hostname,port:S.port,protocol:S.protocol},S.auth)){var _=S.auth.split(":");v.auth={username:_[0],password:_[1]}}}}v&&(y.headers.host=d.hostname+(d.port?":"+d.port:""),et(y,v,f+"//"+d.hostname+(d.port?":"+d.port:"")+y.path));var x=g&&(!v||Qe.test(v.protocol));e.transport?C=e.transport:0===e.maxRedirects?C=x?r:t:(e.maxRedirects&&(y.maxRedirects=e.maxRedirects),C=x?Ze:Ke),e.maxBodyLength>-1&&(y.maxBodyLength=e.maxBodyLength);var A=C.request(y,(function(t){if(!A.aborted){var r=t,n=t.req||A;if(204!==t.statusCode&&"HEAD"!==n.method&&!1!==e.decompress)switch(t.headers["content-encoding"]){case"gzip":case"compress":case"deflate":r=r.pipe(l.createUnzip()),delete t.headers["content-encoding"]}var o={status:t.statusCode,statusText:t.statusMessage,headers:t.headers,config:e,request:n};if("stream"===e.responseType)o.data=r,ie(i,a,o);else{var s=[];r.on("data",(function(t){s.push(t),e.maxContentLength>-1&&Buffer.concat(s).length>e.maxContentLength&&(r.destroy(),a(se("maxContentLength size of "+e.maxContentLength+" exceeded",e,null,n)))})),r.on("error",(function(t){A.aborted||a(oe(t,e,null,n))})),r.on("end",(function(){var t=Buffer.concat(s);"arraybuffer"!==e.responseType&&(t=t.toString(e.responseEncoding),e.responseEncoding&&"utf8"!==e.responseEncoding||(t=Y.stripBOM(t))),o.data=t,ie(i,a,o)}))}}}));A.on("error",(function(t){A.aborted&&"ERR_FR_TOO_MANY_REDIRECTS"!==t.code||a(oe(t,e,null,A))})),e.timeout&&A.setTimeout(e.timeout,(function(){A.abort(),a(se("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",A))})),e.cancelToken&&e.cancelToken.promise.then((function(e){A.aborted||(A.abort(),a(e))})),Y.isStream(u)?u.on("error",(function(t){a(oe(t,e,null,A))})).pipe(A):A.end(u)}))},rt={"Content-Type":"application/x-www-form-urlencoded"};function nt(e,t){!Y.isUndefined(e)&&Y.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var ot={adapter:function(){var e;return"undefined"!=typeof XMLHttpRequest?e=he:"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)&&(e=tt),e}(),transformRequest:[function(e,t){return ne(t,"Accept"),ne(t,"Content-Type"),Y.isFormData(e)||Y.isArrayBuffer(e)||Y.isBuffer(e)||Y.isStream(e)||Y.isFile(e)||Y.isBlob(e)?e:Y.isArrayBufferView(e)?e.buffer:Y.isURLSearchParams(e)?(nt(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Y.isObject(e)?(nt(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Y.forEach(["delete","get","head"],(function(e){ot.headers[e]={}})),Y.forEach(["post","put","patch"],(function(e){ot.headers[e]=Y.merge(rt)}));var st=ot;function it(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var at=function(e){return it(e),e.headers=e.headers||{},e.data=te(e.data,e.headers,e.transformRequest),e.headers=Y.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Y.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||st.adapter)(e).then((function(t){return it(e),t.data=te(t.data,t.headers,e.transformResponse),t}),(function(t){return re(t)||(it(e),t&&t.response&&(t.response.data=te(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},ut=function(e,t){t=t||{};var r={},n=["url","method","data"],o=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],i=["validateStatus"];function a(e,t){return Y.isPlainObject(e)&&Y.isPlainObject(t)?Y.merge(e,t):Y.isPlainObject(t)?Y.merge({},t):Y.isArray(t)?t.slice():t}function u(n){Y.isUndefined(t[n])?Y.isUndefined(e[n])||(r[n]=a(void 0,e[n])):r[n]=a(e[n],t[n])}Y.forEach(n,(function(e){Y.isUndefined(t[e])||(r[e]=a(void 0,t[e]))})),Y.forEach(o,u),Y.forEach(s,(function(n){Y.isUndefined(t[n])?Y.isUndefined(e[n])||(r[n]=a(void 0,e[n])):r[n]=a(void 0,t[n])})),Y.forEach(i,(function(n){n in t?r[n]=a(e[n],t[n]):n in e&&(r[n]=a(void 0,e[n]))}));var l=n.concat(o).concat(s).concat(i),c=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return Y.forEach(c,u),r};function lt(e){this.defaults=e,this.interceptors={request:new ee,response:new ee}}lt.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=ut(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[at,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},lt.prototype.getUri=function(e){return e=ut(this.defaults,e),Z(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Y.forEach(["delete","get","head","options"],(function(e){lt.prototype[e]=function(t,r){return this.request(ut(r||{},{method:e,url:t,data:(r||{}).data}))}})),Y.forEach(["post","put","patch"],(function(e){lt.prototype[e]=function(t,r,n){return this.request(ut(n||{},{method:e,url:t,data:r}))}}));var ct=lt;function ht(e){this.message=e}ht.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},ht.prototype.__CANCEL__=!0;var pt=ht;function dt(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new pt(e),t(r.reason))}))}dt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},dt.source=function(){var e;return{token:new dt((function(t){e=t})),cancel:e}};var ft=dt;function mt(e){var t=new ct(e),r=I(ct.prototype.request,t);return Y.extend(r,ct.prototype,t),Y.extend(r,t),r}var gt=mt(st);gt.Axios=ct,gt.create=function(e){return mt(ut(gt.defaults,e))},gt.Cancel=pt,gt.CancelToken=ft,gt.isCancel=re,gt.all=function(e){return Promise.all(e)},gt.spread=function(e){return function(t){return e.apply(null,t)}},gt.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError};var wt=gt,yt=gt;wt.default=yt;var Ct,vt,bt=wt;!function(e){e.Client=class extends T{constructor(e){var r,n,o;super(),h(this,"$ws",void 0),h(this,"$options",void 0),h(this,"$respCallbacks",new Map),h(this,"$openCallbacks",[]),h(this,"$opened",!1),h(this,"$waitOpened",(()=>new Promise(((e,t)=>{this.$opened&&1==this.$ws.readyState?e():this.$ws.readyState<1&&this.$ws.readyState>1?t(this.$ws.readyState):this.$openCallbacks.push(e)})))),h(this,"$sendRaw",(e=>new Promise(((t,r)=>{try{this.$ws.send(e)}catch(e){r(e)}})))),h(this,"$sendJson",((e,...t)=>new Promise((async(r,n)=>{var o,s;await this.$waitOpened();let i=y(),a={jsonrpc:"2.0",id:i,method:e,params:[]};null!=(null===(o=this.$options)||void 0===o||null===(s=o.auth)||void 0===s?void 0:s.secret)&&a.params.push("token:"+this.$options.auth.secret),a.params=[...a.params,...t],this.$respCallbacks.set(i,r),this.$sendRaw(JSON.stringify(a)).catch(n)})))),h(this,"$systemMethods",new t(this)),this.$options=Object.assign({},e),this.$ws=new M(`${null!==(r=e.protocol)&&void 0!==r?r:"ws"}://${e.host}:${e.port}${null!==(n=e.path)&&void 0!==n?n:"/jsonrpc"}`,N()?null!==(o=e.wsOptions)&&void 0!==o?o:{}:void 0),this.$ws.onclose=()=>{this.emit("ws.close"),this.$opened=!1,this.$openCallbacks=[]},this.$ws.onopen=()=>{for(this.emit("ws.open"),this.$opened=!0;this.$openCallbacks.length>0;){let e=this.$openCallbacks.pop();null!=e&&1==this.$ws.readyState&&e()}},this.$ws.onmessage=e=>{var t,r,n,o,s,i,a;("message"==(null===(t=e)||void 0===t?void 0:t.type)||N())&&(e=e.data);try{this.emit("ws.message",e);let t=JSON.parse(e.toString());if(t instanceof Array){let e=this.$respCallbacks.get(t[0].id);null!=e&&e(t),this.$respCallbacks.delete(t[0].id)}else if(null!=t.id&&this.$respCallbacks.has(null==t?void 0:t.id)){let e=this.$respCallbacks.get(t.id);null!=e&&e(t),this.$respCallbacks.delete(t.id)}else if(null!=t.method)switch(null==t?void 0:t.method){case"aria2.onDownloadStart":this.emit("aria2.onDownloadStart",{},...null!==(r=t.params)&&void 0!==r?r:[]);break;case"aria2.onDownloadPause":this.emit("aria2.onDownloadPause",{},...null!==(n=t.params)&&void 0!==n?n:[]);break;case"aria2.onDownloadStop":this.emit("aria2.onDownloadStop",{},...null!==(o=t.params)&&void 0!==o?o:[]);break;case"aria2.onDownloadComplete":this.emit("aria2.onDownloadComplete",{},...null!==(s=t.params)&&void 0!==s?s:[]);break;case"aria2.onDownloadError":this.emit("aria2.onDownloadError",{},...null!==(i=t.params)&&void 0!==i?i:[]);break;case"aria2.onBtDownloadComplete":this.emit("aria2.onBtDownloadComplete",{},...null!==(a=t.params)&&void 0!==a?a:[])}}catch(e){throw this.$errorHandle(e),e}}}$errorHandle(e){}get system(){return this.$systemMethods}async rawCall(e,...t){let r=await this.$sendJson(e,...t);if(null!=r.error)throw r.error;return r.result}async rawSend(e){return await this.$sendRaw(e)}async getCreateOptions(){return Object.freeze(this.$options)}async closeConnection(e,t){this.$ws.close(e,t)}};class t extends D{async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}multicall(...e){return new Promise((async(t,r)=>{var n;let o=y(),s=!1,i=[],a=await this.$client.getCreateOptions();var u;null!=(null==a||null===(n=a.auth)||void 0===n?void 0:n.secret)&&i.push("token:"+(null==a||null===(u=a.auth)||void 0===u?void 0:u.secret));let l=[];for(const t of e)1!=s?(l.push({jsonrpc:"2.0",id:o,method:t.methodName,params:[...i,...t.params]}),s=!0):l.push({jsonrpc:"2.0",id:y(),method:t.methodName,params:[...i,...t.params]});await this.$client.$waitOpened(),this.$client.$respCallbacks.set(o,(e=>{let r=[];for(const t of e)null!=t.error?r.push(Promise.reject(t.error)):r.push(Promise.resolve(t.result));t(r)})),this.$client.rawSend(JSON.stringify(l)).catch(r)}))}}e.SystemMethods=t}(Ct||(Ct={})),function(e){e.Client=class extends T{constructor(e){super(),h(this,"$options",void 0),h(this,"$system",void 0),this.$options=e,this.$system=new t(this)}onDownloadStart(){throw new Error("Method not implemented.")}onDownloadPause(){throw new Error("Method not implemented.")}onDownloadStop(){throw new Error("Method not implemented.")}onDownloadComplete(){throw new Error("Method not implemented.")}onDownloadError(){throw new Error("Method not implemented.")}onBtDownloadStart(){throw new Error("Method not implemented.")}get system(){return this.$system}async rawCall(e,...t){var r,n,o;let s=y(),i=[...t];null!=(null===(r=this.$options)||void 0===r||null===(n=r.auth)||void 0===n?void 0:n.secret)&&i.push("token:"+this.$options.auth.secret);let a=`${null!==(o=this.$options.protocol)&&void 0!==o?o:"http"}://${this.$options.host}:${this.$options.port}/jsonrpc?method=${decodeURIComponent(e)}&id=${decodeURIComponent(s)}¶ms=${q(JSON.stringify(i))}`,u=(await bt(a,{method:"GET",...this.$options.fetchOptions})).data;if(null==u.error)return u.result;throw u.error}async rawSend(e){throw new Error("Method not implemented.")}async getCreateOptions(){return this.$options}};class t extends D{async multicall(...e){let t={},r=[],n=[],o=await this.$client.getCreateOptions();for(const a of e){var s,i;let e=y(),u=[];null!=(null==o||null===(s=o.auth)||void 0===s?void 0:s.secret)&&u.push(null==o||null===(i=o.auth)||void 0===i?void 0:i.secret),r.push({jsonrpc:"2.0",id:e,params:[...u,...a.params],method:a.methodName}),n.push(new Promise(((r,n)=>{t[e]={r:r,j:n}})))}return new Promise((async()=>{var e;let n=`${null!==(e=o.protocol)&&void 0!==e?e:"http"}://${o.host}:${o.port}/jsonrpc?method=&id=¶ms=${q(JSON.stringify(r))}`,s=await bt(n,{method:"GET",...o.fetchOptions});for(const e of s.data)null!=e.id&&null!=t[e.id]&&(null!=e.error?t[e.id].j(e.error):t[e.id].r(e.result))})),n}async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}}e.SystemMethods=t}(vt||(vt={}));export{U as Adapter,vt as Http,Ct as WebSocket}; | ||
import{EventEmitter as e}from"events";import t from"http";import r from"https";import n from"url";import o from"stream";import s from"assert";import i from"tty";import a from"util";import u from"os";import l from"zlib";import c from"crypto";function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const p=new Uint8Array(256);let f=p.length;function d(){return f>p.length-16&&(c.randomFillSync(p),f=0),p.slice(f,f+=16)}var m=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const g=[];for(let e=0;e<256;++e)g.push((e+256).toString(16).substr(1));function w(e,t=0){const r=(g[e[t+0]]+g[e[t+1]]+g[e[t+2]]+g[e[t+3]]+"-"+g[e[t+4]]+g[e[t+5]]+"-"+g[e[t+6]]+g[e[t+7]]+"-"+g[e[t+8]]+g[e[t+9]]+"-"+g[e[t+10]]+g[e[t+11]]+g[e[t+12]]+g[e[t+13]]+g[e[t+14]]+g[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&m.test(e)}(r))throw TypeError("Stringified UUID is invalid");return r}function y(e,t,r){const n=(e=e||{}).random||(e.rng||d)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return w(n)}function v(e){return e.toString()}function C(e){return e.toString()}function b(e){if(/^(false|true)$/.test(e))return"true"==e;throw"Unknown Boolean Value: "+e}function E(e){return Number(e)}function S(e){return BigInt(e)}function O(e){let t={};for(const r in e)if(null!=e[r])if("string"==typeof e[r])t[r]=e[r];else if("boolean"==typeof e[r])t[r]=e[r].toString();else if("number"==typeof e[r])t[r]=C(e[r]);else{if("bigint"!=typeof e[r])throw"Unknown Value: "+e[r];t[r]=v(e[r])}return t}function R(e){let t={};for(const r in e)if(null!=e[r])if("string"==typeof e[r])t[r]=e[r];else if("boolean"==typeof e[r])t[r]=b(e[r]);else if("number"==typeof e[r])t[r]=E(e[r]);else{if("bigint"!=typeof e[r])throw"Unknown Value: "+e[r];t[r]=S(e[r])}return t}function _(e){let t=Object.assign({},e);if(null!=e.totalLength&&(t.totalLength=S(e.totalLength)),null!=e.totalLength&&(t.completedLength=S(e.completedLength)),null!=e.totalLength&&(t.uploadLength=S(e.uploadLength)),null!=e.totalLength&&(t.downloadSpeed=S(e.downloadSpeed)),null!=e.totalLength&&(t.uploadSpeed=S(e.uploadSpeed)),null!=e.numSeeders&&(t.numSeeders=S(e.numSeeders)),null!=e.seeder&&(t.seeder=b(e.seeder)),null!=e.totalLength&&(t.pieceLength=S(e.pieceLength)),null!=e.totalLength&&(t.numPieces=S(e.numPieces)),null!=e.totalLength&&(t.connections=S(e.connections)),null!=e.errorCode&&(t.errorCode=E(e.errorCode)),null!=e.bittorrent&&null!=e.bittorrent.creationDate&&(t.bittorrent.creationDate=S(e.bittorrent.creationDate)),null!=e.files)for(const r in e.files)t.files[r]=T(e.files[r]);return t}function T(e){let t=Object.assign({},e);return t.length=S(e.length),t.completedLength=S(e.completedLength),t.index=E(e.index),t.selected=b(e.selected),t}function x(e){let t=Object.assign({},e);return t.amChoking=b(e.amChoking),t.downloadSpeed=S(e.downloadSpeed),t.peerChoking=b(e.peerChoking),t.port=E(e.port),t.seeder=b(e.seeder),t.uploadSpeed=S(e.uploadSpeed),t}function A(e){let t=Object.assign({},e);return t.downloadSpeed=S(e.downloadSpeed),t}function $(e){let t=Object.assign({},e);t.index=E(e.index);for(const r in e.servers)t.servers[r]=A(e.servers[r]);return t}class F extends e{constructor(){super()}async addMetalink(e,t,r){var n;null!==(n=process.versions.node)&&void 0!==n&&n&&e instanceof Buffer&&(e=e.toString("base64"));let o=[e];if(null!=t&&o.push(t),null!=t&&null!=r)o.push(r);else if(null!=r)throw"Require `options`!";return await this.rawCall("aria2.addMetalink",...o)}async remove(e){return await this.rawCall("aria2.remove",e)}async forceRemove(e){return await this.rawCall("aria2.forceRemove",e)}async pause(e){return await this.rawCall("aria2.pause",e)}async forcePause(e){return await this.rawCall("aria2.forcePause",e)}async pauseAll(){return await this.rawCall("aria2.pauseAll")}async forcePauseAll(){return await this.rawCall("aria2.forcePauseAll")}async unpause(e){return await this.rawCall("aria2.unpause",e)}async unpauseAll(){return await this.rawCall("aria2.unpauseAll")}async tellStatus(e,t){if(null!=t){return _(await this.rawCall("aria2.tellStatus",e,t))}return _(await this.rawCall("aria2.tellStatus",e))}async getUris(e){return await this.rawCall("aria2.getUris",e)}async getFiles(e){return await this.rawCall("aria2.getFiles",e)}async getPeers(e){return(await this.rawCall("aria2.getPeers",e)).map(x)}async getServers(e){return(await this.rawCall("aria2.getServers",e)).map($)}async tellActive(e){if(null!=e){return(await this.rawCall("aria2.tellActive",e)).map(_)}return(await this.rawCall("aria2.tellActive")).map(_)}async tellWaiting(e,t,r){if(null!=r){return(await this.rawCall("aria2.tellWaiting",e,t,r)).map(_)}return(await this.rawCall("aria2.tellWaiting",e,t)).map(_)}async tellStopped(e,t,r){if(null!=r){return(await this.rawCall("aria2.tellStopped",e,t,r)).map(_)}return(await this.rawCall("aria2.tellStopped",e,t)).map(_)}async changePosition(e,t,r){return await this.rawCall("aria2.changePosition",e,t,r)}async changeUri(e,t,r,n,o){return await this.rawCall("aria2.changeUri",e,t,r,n,o)}async getOption(e){return R(await this.rawCall("aria2.getOption",e))}async changeOption(e,t){return await this.rawCall("aria2.changeOption",e,O(t))}async getGlobalOption(){return R(await this.rawCall("aria2.getGlobalOption"))}async changeGlobalOption(e){return await this.rawCall("aria2.changeGlobalOption",O(e))}async getGlobalStat(){return function(e){let t=Object.assign({},e);return t.downloadSpeed=S(e.downloadSpeed),t.uploadSpeed=S(e.uploadSpeed),t.numActive=E(e.numActive),t.numWaiting=E(e.numWaiting),t.numStopped=E(e.numStopped),t.numStoppedTotal=E(e.numStoppedTotal),t}(await this.rawCall("aria2.getGlobalStat"))}async purgeDownloadResult(){return await this.rawCall("aria2.purgeDownloadResult")}async removeDownloadResult(e){return await this.rawCall("aria2.removeDownloadResult",e)}async getVersion(){return await this.rawCall("aria2.getVersion")}async shutdown(){return await this.rawCall("aria2.shutdown")}async forceShutdown(){return await this.rawCall("aria2.forceShutdown")}async saveSession(){return await this.rawCall("aria2.saveSession")}async getSessionInfo(){return await this.rawCall("aria2.getSessioninfo")}async addUri(e,t,r){"string"==typeof e&&(e=[e]);let n=[e];if(null!=t&&n.push(O(t)),null!=t&&null!=r)n.push(r);else if(null!=r)throw"Require `options`!";return await this.rawCall("aria2.addUri",...n)}async addTorrent(e,t,r,n){e instanceof Buffer&&(e=e.toString("base64")),"string"==typeof t&&(t=[t]);let o=[e,t];if(null!=r&&o.push(r),null!=r&&null!=n)o.push(n);else if(null!=n)throw"Require `options`!";return await this.rawCall("aria2.addTorrent",...o)}onceDownloadStart(){return new Promise((e=>this.once("aria2.onDownloadStart",e)))}onceDownloadPause(){return new Promise((e=>this.once("aria2.onDownloadPause",e)))}onceDownloadStop(){return new Promise((e=>this.once("aria2.onDownloadStop",e)))}onceDownloadComplete(){return new Promise((e=>this.once("aria2.onDownloadComplete",e)))}onceDownloadError(){return new Promise((e=>this.once("aria2.onDownloadError",e)))}onceBtDownloadStart(){return new Promise((e=>this.once("aria2.onBtDownloadStart",e)))}}var k,P,j,L;!function(e){e.Set="POS_SET",e.Cur="POS_CUR",e.End="POS_END"}(k||(k={})),function(e){e.Active="active",e.Waiting="waiting",e.Paused="paused",e.Error="error",e.Complete="complete",e.Removed="removed"}(P||(P={})),function(e){e.Waiting="waiting",e.Used="used"}(j||(j={})),function(e){e.Single="single",e.Multi="multi"}(L||(L={}));class B{constructor(e){h(this,"$client",void 0),this.$client=e}}var N,D=Object.freeze({__proto__:null,Aria2ClientBaseClass:F,get EAria2ChangePositionHow(){return k},get EAria2DownloadState(){return P},get EAria2UriStatusEnum(){return j},get EAria2DownloadBitTorrentMode(){return L},Aria2ClientSystemMethodsBaseClass:B});!function(e){e.atob=function(e){return Buffer.from(e,"base64").toString()},e.btoa=function(e){return Buffer.from(e).toString("base64")}}(N||(N={}));const U=()=>{var e,t;return"string"==typeof(null===globalThis||void 0===globalThis||null===(e=globalThis.process)||void 0===e||null===(t=e.versions)||void 0===t?void 0:t.node)},M=null!=globalThis.WebSocket?class extends globalThis.WebSocket{constructor(e){super(e)}}:require("ws"),q=(()=>{if(U())return N.btoa;if(null!=globalThis.btoa)return globalThis.btoa;throw new Error("`btoa()` is not defined!")})();(()=>{if(U())return N.atob;if(null!=globalThis.atob)return globalThis.atob;throw new Error("`atob()` is not defined!")})();var I=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},z=Object.prototype.toString;function H(e){return"[object Array]"===z.call(e)}function J(e){return void 0===e}function G(e){return null!==e&&"object"==typeof e}function W(e){if("[object Object]"!==z.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function V(e){return"[object Function]"===z.call(e)}function X(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),H(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var Y={isArray:H,isArrayBuffer:function(e){return"[object ArrayBuffer]"===z.call(e)},isBuffer:function(e){return null!==e&&!J(e)&&null!==e.constructor&&!J(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:G,isPlainObject:W,isUndefined:J,isDate:function(e){return"[object Date]"===z.call(e)},isFile:function(e){return"[object File]"===z.call(e)},isBlob:function(e){return"[object Blob]"===z.call(e)},isFunction:V,isStream:function(e){return G(e)&&V(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:X,merge:function e(){var t={};function r(r,n){W(t[n])&&W(r)?t[n]=e(t[n],r):W(r)?t[n]=e({},r):H(r)?t[n]=r.slice():t[n]=r}for(var n=0,o=arguments.length;n<o;n++)X(arguments[n],r);return t},extend:function(e,t,r){return X(t,(function(t,n){e[n]=r&&"function"==typeof t?I(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}};function K(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Z=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(Y.isURLSearchParams(t))n=t.toString();else{var o=[];Y.forEach(t,(function(e,t){null!=e&&(Y.isArray(e)?t+="[]":e=[e],Y.forEach(e,(function(e){Y.isDate(e)?e=e.toISOString():Y.isObject(e)&&(e=JSON.stringify(e)),o.push(K(t)+"="+K(e))})))})),n=o.join("&")}if(n){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e};function Q(){this.handlers=[]}Q.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},Q.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},Q.prototype.forEach=function(e){Y.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var ee=Q,te=function(e,t){Y.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))},re=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},ne=function(e,t,r,n,o){var s=new Error(e);return re(s,t,r,n,o)},oe=function(e,t,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(ne("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)},se=Y.isStandardBrowserEnv()?{write:function(e,t,r,n,o,s){var i=[];i.push(e+"="+encodeURIComponent(t)),Y.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),Y.isString(n)&&i.push("path="+n),Y.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},ie=function(e,t){return e&&!function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t},ae=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],ue=Y.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=Y.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0};function le(e){this.message=e}le.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},le.prototype.__CANCEL__=!0;var ce=le,he=at,pe=function(e){return new Promise((function(t,r){var n,o=e.data,s=e.headers,i=e.responseType;function a(){e.cancelToken&&e.cancelToken.unsubscribe(n),e.signal&&e.signal.removeEventListener("abort",n)}Y.isFormData(o)&&delete s["Content-Type"];var u=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",c=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.Authorization="Basic "+btoa(l+":"+c)}var h=ie(e.baseURL,e.url);function p(){if(u){var n,o,s,l,c,h="getAllResponseHeaders"in u?(n=u.getAllResponseHeaders(),c={},n?(Y.forEach(n.split("\n"),(function(e){if(l=e.indexOf(":"),o=Y.trim(e.substr(0,l)).toLowerCase(),s=Y.trim(e.substr(l+1)),o){if(c[o]&&ae.indexOf(o)>=0)return;c[o]="set-cookie"===o?(c[o]?c[o]:[]).concat([s]):c[o]?c[o]+", "+s:s}})),c):c):null,p={data:i&&"text"!==i&&"json"!==i?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:h,config:e,request:u};oe((function(e){t(e),a()}),(function(e){r(e),a()}),p),u=null}}if(u.open(e.method.toUpperCase(),Z(h,e.params,e.paramsSerializer),!0),u.timeout=e.timeout,"onloadend"in u?u.onloadend=p:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(p)},u.onabort=function(){u&&(r(ne("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){r(ne("Network Error",e,null,u)),u=null},u.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded",n=e.transitional||he.transitional;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(ne(t,e,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},Y.isStandardBrowserEnv()){var f=(e.withCredentials||ue(h))&&e.xsrfCookieName?se.read(e.xsrfCookieName):void 0;f&&(s[e.xsrfHeaderName]=f)}"setRequestHeader"in u&&Y.forEach(s,(function(e,t){void 0===o&&"content-type"===t.toLowerCase()?delete s[t]:u.setRequestHeader(t,e)})),Y.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),i&&"json"!==i&&(u.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&u.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(n=function(e){u&&(r(!e||e&&e.type?new ce("canceled"):e),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(n),e.signal&&(e.signal.aborted?n():e.signal.addEventListener("abort",n))),o||(o=null),u.send(o)}))};function fe(e){var t={exports:{}};return e(t,t.exports),t.exports}var de=1e3,me=60*de,ge=60*me,we=24*ge,ye=7*we,ve=365.25*we,Ce=function(e,t){t=t||{};var r=typeof e;if("string"===r&&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 r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*ve;case"weeks":case"week":case"w":return r*ye;case"days":case"day":case"d":return r*we;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ge;case"minutes":case"minute":case"mins":case"min":case"m":return r*me;case"seconds":case"second":case"secs":case"sec":case"s":return r*de;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=we)return be(e,t,we,"day");if(t>=ge)return be(e,t,ge,"hour");if(t>=me)return be(e,t,me,"minute");if(t>=de)return be(e,t,de,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=we)return Math.round(e/we)+"d";if(t>=ge)return Math.round(e/ge)+"h";if(t>=me)return Math.round(e/me)+"m";if(t>=de)return Math.round(e/de)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function be(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}var Ee=function(e){function t(e){let n,o,s,i=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),s=o-(n||o);r.diff=s,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";i++;const s=t.formatters[o];if("function"==typeof s){const t=e[i];n=s.call(r,t),e.splice(i,1),i--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(o!==t.namespaces&&(o=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(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(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(e=n[r].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 r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=Ce,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((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t},Se=fe((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 r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},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&&"undefined"!=typeof process&&"env"in process&&(e=process.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=Ee(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}})),Oe=(e,t=process.argv)=>{const r=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return-1!==n&&(-1===o||n<o)};const{env:Re}=process;let _e;function Te(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function xe(e,t){if(0===_e)return 0;if(Oe("color=16m")||Oe("color=full")||Oe("color=truecolor"))return 3;if(Oe("color=256"))return 2;if(e&&!t&&void 0===_e)return 0;const r=_e||0;if("dumb"===Re.TERM)return r;if("win32"===process.platform){const e=u.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in Re)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in Re))||"codeship"===Re.CI_NAME?1:r;if("TEAMCITY_VERSION"in Re)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Re.TEAMCITY_VERSION)?1:0;if("truecolor"===Re.COLORTERM)return 3;if("TERM_PROGRAM"in Re){const e=parseInt((Re.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Re.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Re.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Re.TERM)||"COLORTERM"in Re?1:r}Oe("no-color")||Oe("no-colors")||Oe("color=false")||Oe("color=never")?_e=0:(Oe("color")||Oe("colors")||Oe("color=true")||Oe("color=always"))&&(_e=1),"FORCE_COLOR"in Re&&(_e="true"===Re.FORCE_COLOR?1:"false"===Re.FORCE_COLOR?0:0===Re.FORCE_COLOR.length?1:Math.min(parseInt(Re.FORCE_COLOR,10),3));var Ae,$e={supportsColor:function(e){return Te(xe(e,e&&e.isTTY))},stdout:Te(xe(!0,i.isatty(1))),stderr:Te(xe(!0,i.isatty(2)))},Fe=fe((function(e,t){t.init=function(e){e.inspectOpts={};const r=Object.keys(t.inspectOpts);for(let n=0;n<r.length;n++)e.inspectOpts[r[n]]=t.inspectOpts[r[n]]},t.log=function(...e){return process.stderr.write(a.format(...e)+"\n")},t.formatArgs=function(r){const{namespace:n,useColors:o}=this;if(o){const t=this.color,o="[3"+(t<8?t:"8;5;"+t),s=` ${o};1m${n} [0m`;r[0]=s+r[0].split("\n").join("\n"+s),r.push(o+"m+"+e.exports.humanize(this.diff)+"[0m")}else r[0]=function(){if(t.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+n+" "+r[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):i.isatty(process.stderr.fd)},t.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`."),t.colors=[6,2,3,4,5,1];try{const e=$e;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(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let n=process.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[r]=n,e}),{}),e.exports=Ee(t);const{formatters:r}=e.exports;r.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},r.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)}})),ke=fe((function(e){"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?e.exports=Se:e.exports=Fe})),Pe=function(){if(!Ae){try{Ae=ke("follow-redirects")}catch(e){}"function"!=typeof Ae&&(Ae=function(){})}Ae.apply(null,arguments)},je=n.URL,Le=o.Writable,Be=["abort","aborted","connect","error","socket","timeout"],Ne=Object.create(null);Be.forEach((function(e){Ne[e]=function(t,r,n){this._redirectable.emit(e,t,r,n)}}));var De=We("ERR_FR_REDIRECTION_FAILURE",""),Ue=We("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),Me=We("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),qe=We("ERR_STREAM_WRITE_AFTER_END","write after end");function Ie(e,t){Le.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var r=this;this._onNativeResponse=function(e){r._processResponse(e)},this._performRequest()}function ze(e){var t={maxRedirects:21,maxBodyLength:10485760},r={};return Object.keys(e).forEach((function(o){var i=o+":",a=r[i]=e[o],u=t[o]=Object.create(a);Object.defineProperties(u,{request:{value:function(e,o,a){if("string"==typeof e){var u=e;try{e=Je(new je(u))}catch(t){e=n.parse(u)}}else je&&e instanceof je?e=Je(e):(a=o,o=e,e={protocol:i});return"function"==typeof o&&(a=o,o=null),(o=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,o)).nativeProtocols=r,s.equal(o.protocol,i,"protocol mismatch"),Pe("options",o),new Ie(o,a)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,r){var n=u.request(e,t,r);return n.end(),n},configurable:!0,enumerable:!0,writable:!0}})})),t}function He(){}function Je(e){var t={protocol:e.protocol,hostname:e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:e.pathname+e.search,href:e.href};return""!==e.port&&(t.port=Number(e.port)),t}function Ge(e,t){var r;for(var n in t)e.test(n)&&(r=t[n],delete t[n]);return r}function We(e,t){function r(e){Error.captureStackTrace(this,this.constructor),this.message=e||t}return r.prototype=new Error,r.prototype.constructor=r,r.prototype.name="Error ["+e+"]",r.prototype.code=e,r}function Ve(e){for(var t=0;t<Be.length;t++)e.removeListener(Be[t],Ne[Be[t]]);e.on("error",He),e.abort()}Ie.prototype=Object.create(Le.prototype),Ie.prototype.abort=function(){Ve(this._currentRequest),this.emit("abort")},Ie.prototype.write=function(e,t,r){if(this._ending)throw new qe;if(!("string"==typeof e||"object"==typeof e&&"length"in e))throw new TypeError("data should be a string, Buffer or Uint8Array");"function"==typeof t&&(r=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,r)):(this.emit("error",new Me),this.abort()):r&&r()},Ie.prototype.end=function(e,t,r){if("function"==typeof e?(r=e,e=t=null):"function"==typeof t&&(r=t,t=null),e){var n=this,o=this._currentRequest;this.write(e,t,(function(){n._ended=!0,o.end(null,null,r)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,r)},Ie.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},Ie.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},Ie.prototype.setTimeout=function(e,t){var r=this;function n(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function o(t){r._timeout&&clearTimeout(r._timeout),r._timeout=setTimeout((function(){r.emit("timeout"),s()}),e),n(t)}function s(){r._timeout&&(clearTimeout(r._timeout),r._timeout=null),t&&r.removeListener("timeout",t),r.socket||r._currentRequest.removeListener("socket",o)}return t&&this.on("timeout",t),this.socket?o(this.socket):this._currentRequest.once("socket",o),this.on("socket",n),this.once("response",s),this.once("error",s),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){Ie.prototype[e]=function(t,r){return this._currentRequest[e](t,r)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(Ie.prototype,e,{get:function(){return this._currentRequest[e]}})})),Ie.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}},Ie.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(t){if(this._options.agents){var r=e.substr(0,e.length-1);this._options.agent=this._options.agents[r]}var o=this._currentRequest=t.request(this._options,this._onNativeResponse);this._currentUrl=n.format(this._options),o._redirectable=this;for(var s=0;s<Be.length;s++)o.on(Be[s],Ne[Be[s]]);if(this._isRedirect){var i=0,a=this,u=this._requestBodyBuffers;!function e(t){if(o===a._currentRequest)if(t)a.emit("error",t);else if(i<u.length){var r=u[i++];o.finished||o.write(r.data,r.encoding,e)}else a._ended&&o.end()}()}}else this.emit("error",new TypeError("Unsupported protocol "+e))},Ie.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var r=e.headers.location;if(r&&!1!==this._options.followRedirects&&t>=300&&t<400){if(Ve(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)return void this.emit("error",new Ue);((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],Ge(/^content-/i,this._options.headers));var o=Ge(/^host$/i,this._options.headers)||n.parse(this._currentUrl).hostname,s=n.resolve(this._currentUrl,r);Pe("redirecting to",s),this._isRedirect=!0;var i=n.parse(s);if(Object.assign(this._options,i),i.hostname!==o&&Ge(/^authorization$/i,this._options.headers),"function"==typeof this._options.beforeRedirect){var a={headers:e.headers};try{this._options.beforeRedirect.call(null,this._options,a)}catch(e){return void this.emit("error",e)}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(e){var u=new De("Redirected request failed: "+e.message);u.cause=e,this.emit("error",u)}}else e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),this._requestBodyBuffers=[]};var Xe=ze({http:t,https:r}),Ye=ze;Xe.wrap=Ye;var Ke="0.22.0",Ze=Xe.http,Qe=Xe.https,et=Ke,tt=/https:?/;function rt(e,t,r){if(e.hostname=t.host,e.host=t.host,e.port=t.port,e.path=r,t.auth){var n=Buffer.from(t.auth.username+":"+t.auth.password,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+n}e.beforeRedirect=function(e){e.headers.host=e.host,rt(e,t,e.href)}}var nt=function(e){return new Promise((function(o,s){var i;function a(){e.cancelToken&&e.cancelToken.unsubscribe(i),e.signal&&e.signal.removeEventListener("abort",i)}var u=function(e){a(),o(e)},c=function(e){a(),s(e)},h=e.data,p=e.headers,f={};if(Object.keys(p).forEach((function(e){f[e.toLowerCase()]=e})),"user-agent"in f?p[f["user-agent"]]||delete p[f["user-agent"]]:p["User-Agent"]="axios/"+et,h&&!Y.isStream(h)){if(Buffer.isBuffer(h));else if(Y.isArrayBuffer(h))h=Buffer.from(new Uint8Array(h));else{if(!Y.isString(h))return c(ne("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",e));h=Buffer.from(h,"utf-8")}f["content-length"]||(p["Content-Length"]=h.length)}var d=void 0;e.auth&&(d=(e.auth.username||"")+":"+(e.auth.password||""));var m=ie(e.baseURL,e.url),g=n.parse(m),w=g.protocol||"http:";if(!d&&g.auth){var y=g.auth.split(":");d=(y[0]||"")+":"+(y[1]||"")}d&&f.authorization&&delete p[f.authorization];var v=tt.test(w),C=v?e.httpsAgent:e.httpAgent,b={path:Z(g.path,e.params,e.paramsSerializer).replace(/^\?/,""),method:e.method.toUpperCase(),headers:p,agent:C,agents:{http:e.httpAgent,https:e.httpsAgent},auth:d};e.socketPath?b.socketPath=e.socketPath:(b.hostname=g.hostname,b.port=g.port);var E,S=e.proxy;if(!S&&!1!==S){var O=w.slice(0,-1)+"_proxy",R=process.env[O]||process.env[O.toUpperCase()];if(R){var _=n.parse(R),T=process.env.no_proxy||process.env.NO_PROXY,x=!0;if(T){var A=T.split(",").map((function(e){return e.trim()}));x=!A.some((function(e){return!!e&&("*"===e||("."===e[0]&&g.hostname.substr(g.hostname.length-e.length)===e||g.hostname===e))}))}if(x&&(S={host:_.hostname,port:_.port,protocol:_.protocol},_.auth)){var $=_.auth.split(":");S.auth={username:$[0],password:$[1]}}}}S&&(b.headers.host=g.hostname+(g.port?":"+g.port:""),rt(b,S,w+"//"+g.hostname+(g.port?":"+g.port:"")+b.path));var F=v&&(!S||tt.test(S.protocol));e.transport?E=e.transport:0===e.maxRedirects?E=F?r:t:(e.maxRedirects&&(b.maxRedirects=e.maxRedirects),E=F?Qe:Ze),e.maxBodyLength>-1&&(b.maxBodyLength=e.maxBodyLength),e.insecureHTTPParser&&(b.insecureHTTPParser=e.insecureHTTPParser);var k=E.request(b,(function(t){if(!k.aborted){var r=t,n=t.req||k;if(204!==t.statusCode&&"HEAD"!==n.method&&!1!==e.decompress)switch(t.headers["content-encoding"]){case"gzip":case"compress":case"deflate":r=r.pipe(l.createUnzip()),delete t.headers["content-encoding"]}var o={status:t.statusCode,statusText:t.statusMessage,headers:t.headers,config:e,request:n};if("stream"===e.responseType)o.data=r,oe(u,c,o);else{var s=[],i=0;r.on("data",(function(t){s.push(t),i+=t.length,e.maxContentLength>-1&&i>e.maxContentLength&&(r.destroy(),c(ne("maxContentLength size of "+e.maxContentLength+" exceeded",e,null,n)))})),r.on("error",(function(t){k.aborted||c(re(t,e,null,n))})),r.on("end",(function(){var t=Buffer.concat(s);"arraybuffer"!==e.responseType&&(t=t.toString(e.responseEncoding),e.responseEncoding&&"utf8"!==e.responseEncoding||(t=Y.stripBOM(t))),o.data=t,oe(u,c,o)}))}}}));if(k.on("error",(function(t){k.aborted&&"ERR_FR_TOO_MANY_REDIRECTS"!==t.code||c(re(t,e,null,k))})),e.timeout){var P=parseInt(e.timeout,10);if(isNaN(P))return void c(ne("error trying to parse `config.timeout` to int",e,"ERR_PARSE_TIMEOUT",k));k.setTimeout(P,(function(){k.abort();var t=e.transitional||he.transitional;c(ne("timeout of "+P+"ms exceeded",e,t.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",k))}))}(e.cancelToken||e.signal)&&(i=function(e){k.aborted||(k.abort(),c(!e||e&&e.type?new ce("canceled"):e))},e.cancelToken&&e.cancelToken.subscribe(i),e.signal&&(e.signal.aborted?i():e.signal.addEventListener("abort",i))),Y.isStream(h)?h.on("error",(function(t){c(re(t,e,null,k))})).pipe(k):k.end(h)}))},ot={"Content-Type":"application/x-www-form-urlencoded"};function st(e,t){!Y.isUndefined(e)&&Y.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var it={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:function(){var e;return"undefined"!=typeof XMLHttpRequest?e=pe:"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)&&(e=nt),e}(),transformRequest:[function(e,t){return te(t,"Accept"),te(t,"Content-Type"),Y.isFormData(e)||Y.isArrayBuffer(e)||Y.isBuffer(e)||Y.isStream(e)||Y.isFile(e)||Y.isBlob(e)?e:Y.isArrayBufferView(e)?e.buffer:Y.isURLSearchParams(e)?(st(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Y.isObject(e)||t&&"application/json"===t["Content-Type"]?(st(t,"application/json"),function(e,t,r){if(Y.isString(e))try{return(t||JSON.parse)(e),Y.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||it.transitional,r=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,o=!r&&"json"===this.responseType;if(o||n&&Y.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw re(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Y.forEach(["delete","get","head"],(function(e){it.headers[e]={}})),Y.forEach(["post","put","patch"],(function(e){it.headers[e]=Y.merge(ot)}));var at=it,ut=function(e,t,r){var n=this||he;return Y.forEach(r,(function(r){e=r.call(n,e,t)})),e},lt=function(e){return!(!e||!e.__CANCEL__)};function ct(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ce("canceled")}var ht=function(e){return ct(e),e.headers=e.headers||{},e.data=ut.call(e,e.data,e.headers,e.transformRequest),e.headers=Y.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Y.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||he.adapter)(e).then((function(t){return ct(e),t.data=ut.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return lt(t)||(ct(e),t&&t.response&&(t.response.data=ut.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},pt=function(e,t){t=t||{};var r={};function n(e,t){return Y.isPlainObject(e)&&Y.isPlainObject(t)?Y.merge(e,t):Y.isPlainObject(t)?Y.merge({},t):Y.isArray(t)?t.slice():t}function o(r){return Y.isUndefined(t[r])?Y.isUndefined(e[r])?void 0:n(void 0,e[r]):n(e[r],t[r])}function s(e){if(!Y.isUndefined(t[e]))return n(void 0,t[e])}function i(r){return Y.isUndefined(t[r])?Y.isUndefined(e[r])?void 0:n(void 0,e[r]):n(void 0,t[r])}function a(r){return r in t?n(e[r],t[r]):r in e?n(void 0,e[r]):void 0}var u={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a};return Y.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||o,n=t(e);Y.isUndefined(n)&&t!==a||(r[e]=n)})),r},ft=Ke,dt={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){dt[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var mt={};dt.transitional=function(e,t,r){function n(e,t){return"[Axios v"+ft+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,o,s){if(!1===e)throw new Error(n(o," has been removed"+(t?" in "+t:"")));return t&&!mt[o]&&(mt[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,s)}};var gt={assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),o=n.length;o-- >0;){var s=n[o],i=t[s];if(i){var a=e[s],u=void 0===a||i(a,s,e);if(!0!==u)throw new TypeError("option "+s+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+s)}},validators:dt},wt=gt.validators;function yt(e){this.defaults=e,this.interceptors={request:new ee,response:new ee}}yt.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=pt(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&>.assertOptions(t,{silentJSONParsing:wt.transitional(wt.boolean),forcedJSONParsing:wt.transitional(wt.boolean),clarifyTimeoutError:wt.transitional(wt.boolean)},!1);var r=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var o,s=[];if(this.interceptors.response.forEach((function(e){s.push(e.fulfilled,e.rejected)})),!n){var i=[ht,void 0];for(Array.prototype.unshift.apply(i,r),i=i.concat(s),o=Promise.resolve(e);i.length;)o=o.then(i.shift(),i.shift());return o}for(var a=e;r.length;){var u=r.shift(),l=r.shift();try{a=u(a)}catch(e){l(e);break}}try{o=ht(a)}catch(e){return Promise.reject(e)}for(;s.length;)o=o.then(s.shift(),s.shift());return o},yt.prototype.getUri=function(e){return e=pt(this.defaults,e),Z(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Y.forEach(["delete","get","head","options"],(function(e){yt.prototype[e]=function(t,r){return this.request(pt(r||{},{method:e,url:t,data:(r||{}).data}))}})),Y.forEach(["post","put","patch"],(function(e){yt.prototype[e]=function(t,r,n){return this.request(pt(n||{},{method:e,url:t,data:r}))}}));var vt=yt;function Ct(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,n=r._listeners.length;for(t=0;t<n;t++)r._listeners[t](e);r._listeners=null}})),this.promise.then=function(e){var t,n=new Promise((function(e){r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e){r.reason||(r.reason=new ce(e),t(r.reason))}))}Ct.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Ct.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},Ct.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},Ct.source=function(){var e;return{token:new Ct((function(t){e=t})),cancel:e}};var bt=Ct;var Et=function e(t){var r=new vt(t),n=I(vt.prototype.request,r);return Y.extend(n,vt.prototype,r),Y.extend(n,r),n.create=function(r){return e(pt(t,r))},n}(he);Et.Axios=vt,Et.Cancel=ce,Et.CancelToken=bt,Et.isCancel=lt,Et.VERSION=Ke,Et.all=function(e){return Promise.all(e)},Et.spread=function(e){return function(t){return e.apply(null,t)}},Et.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError};var St=Et,Ot=Et;St.default=Ot;var Rt,_t,Tt=St;!function(e){e.Client=class extends F{constructor(e){var r,n,o;super(),h(this,"$ws",void 0),h(this,"$options",void 0),h(this,"$respCallbacks",new Map),h(this,"$openCallbacks",[]),h(this,"$opened",!1),h(this,"$waitOpened",(()=>new Promise(((e,t)=>{this.$opened&&1==this.$ws.readyState?e():this.$ws.readyState<1&&this.$ws.readyState>1?t(this.$ws.readyState):this.$openCallbacks.push(e)})))),h(this,"$sendRaw",(e=>new Promise(((t,r)=>{try{this.$ws.send(e)}catch(e){r(e)}})))),h(this,"$sendJson",((e,...t)=>new Promise((async(r,n)=>{var o,s;await this.$waitOpened();let i=y(),a={jsonrpc:"2.0",id:i,method:e,params:[]};null!=(null===(o=this.$options)||void 0===o||null===(s=o.auth)||void 0===s?void 0:s.secret)&&a.params.push("token:"+this.$options.auth.secret),a.params=[...a.params,...t],this.$respCallbacks.set(i,r),this.$sendRaw(JSON.stringify(a)).catch(n)})))),h(this,"$systemMethods",new t(this)),this.$options=Object.assign({},e),this.$ws=new M(`${null!==(r=e.protocol)&&void 0!==r?r:"ws"}://${e.host}:${e.port}${null!==(n=e.path)&&void 0!==n?n:"/jsonrpc"}`,U()?null!==(o=e.wsOptions)&&void 0!==o?o:{}:void 0),this.$ws.onclose=()=>{this.emit("ws.close"),this.$opened=!1,this.$openCallbacks=[]},this.$ws.onopen=()=>{for(this.emit("ws.open"),this.$opened=!0;this.$openCallbacks.length>0;){let e=this.$openCallbacks.pop();null!=e&&1==this.$ws.readyState&&e()}},this.$ws.onmessage=e=>{var t,r,n,o,s,i,a;("message"==(null===(t=e)||void 0===t?void 0:t.type)||U())&&(e=e.data);try{this.emit("ws.message",e);let t=JSON.parse(e.toString());if(t instanceof Array){let e=this.$respCallbacks.get(t[0].id);null!=e&&e(t),this.$respCallbacks.delete(t[0].id)}else if(null!=t.id&&this.$respCallbacks.has(null==t?void 0:t.id)){let e=this.$respCallbacks.get(t.id);null!=e&&e(t),this.$respCallbacks.delete(t.id)}else if(null!=t.method)switch(null==t?void 0:t.method){case"aria2.onDownloadStart":this.emit("aria2.onDownloadStart",{},...null!==(r=t.params)&&void 0!==r?r:[]);break;case"aria2.onDownloadPause":this.emit("aria2.onDownloadPause",{},...null!==(n=t.params)&&void 0!==n?n:[]);break;case"aria2.onDownloadStop":this.emit("aria2.onDownloadStop",{},...null!==(o=t.params)&&void 0!==o?o:[]);break;case"aria2.onDownloadComplete":this.emit("aria2.onDownloadComplete",{},...null!==(s=t.params)&&void 0!==s?s:[]);break;case"aria2.onDownloadError":this.emit("aria2.onDownloadError",{},...null!==(i=t.params)&&void 0!==i?i:[]);break;case"aria2.onBtDownloadComplete":this.emit("aria2.onBtDownloadComplete",{},...null!==(a=t.params)&&void 0!==a?a:[])}}catch(e){throw this.$errorHandle(e),e}}}$errorHandle(e){}get system(){return this.$systemMethods}async rawCall(e,...t){let r=await this.$sendJson(e,...t);if(null!=r.error)throw r.error;return r.result}async rawSend(e){return await this.$sendRaw(e)}async getCreateOptions(){return Object.freeze(this.$options)}async closeConnection(e,t){this.$ws.close(e,t)}};class t extends B{async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}multicall(...e){return new Promise((async(t,r)=>{var n;let o=y(),s=!1,i=[],a=await this.$client.getCreateOptions();var u;null!=(null==a||null===(n=a.auth)||void 0===n?void 0:n.secret)&&i.push("token:"+(null==a||null===(u=a.auth)||void 0===u?void 0:u.secret));let l=[];for(const t of e)1!=s?(l.push({jsonrpc:"2.0",id:o,method:t.methodName,params:[...i,...t.params]}),s=!0):l.push({jsonrpc:"2.0",id:y(),method:t.methodName,params:[...i,...t.params]});await this.$client.$waitOpened(),this.$client.$respCallbacks.set(o,(e=>{let r=[];for(const t of e)null!=t.error?r.push(Promise.reject(t.error)):r.push(Promise.resolve(t.result));t(r)})),this.$client.rawSend(JSON.stringify(l)).catch(r)}))}}e.SystemMethods=t}(Rt||(Rt={})),function(e){e.Client=class extends F{constructor(e){super(),h(this,"$options",void 0),h(this,"$system",void 0),this.$options=e,this.$system=new t(this)}onDownloadStart(){throw new Error("Method not implemented.")}onDownloadPause(){throw new Error("Method not implemented.")}onDownloadStop(){throw new Error("Method not implemented.")}onDownloadComplete(){throw new Error("Method not implemented.")}onDownloadError(){throw new Error("Method not implemented.")}onBtDownloadStart(){throw new Error("Method not implemented.")}get system(){return this.$system}async rawCall(e,...t){var r,n,o;let s=y(),i=[...t];null!=(null===(r=this.$options)||void 0===r||null===(n=r.auth)||void 0===n?void 0:n.secret)&&i.push("token:"+this.$options.auth.secret);let a=`${null!==(o=this.$options.protocol)&&void 0!==o?o:"http"}://${this.$options.host}:${this.$options.port}/jsonrpc?method=${decodeURIComponent(e)}&id=${decodeURIComponent(s)}¶ms=${q(JSON.stringify(i))}`,u=(await Tt(a,{method:"GET",...this.$options.fetchOptions})).data;if(null==u.error)return u.result;throw u.error}async rawSend(e){throw new Error("Method not implemented.")}async getCreateOptions(){return this.$options}};class t extends B{async multicall(...e){let t={},r=[],n=[],o=await this.$client.getCreateOptions();for(const a of e){var s,i;let e=y(),u=[];null!=(null==o||null===(s=o.auth)||void 0===s?void 0:s.secret)&&u.push(null==o||null===(i=o.auth)||void 0===i?void 0:i.secret),r.push({jsonrpc:"2.0",id:e,params:[...u,...a.params],method:a.methodName}),n.push(new Promise(((r,n)=>{t[e]={r:r,j:n}})))}return new Promise((async()=>{var e;let n=`${null!==(e=o.protocol)&&void 0!==e?e:"http"}://${o.host}:${o.port}/jsonrpc?method=&id=¶ms=${q(JSON.stringify(r))}`,s=await Tt(n,{method:"GET",...o.fetchOptions});for(const e of s.data)null!=e.id&&null!=t[e.id]&&(null!=e.error?t[e.id].j(e.error):t[e.id].r(e.result))})),n}async listMethods(){return await this.$client.rawCall("system.listMethods")}async listNotifications(){return await this.$client.rawCall("system.listNotifications")}}e.SystemMethods=t}(_t||(_t={}));export{D as Adapter,_t as Http,Rt as WebSocket}; | ||
//# sourceMappingURL=libaria2.node.esm.js.map |
{ | ||
"name": "libaria2-ts", | ||
"version": "1.0.81", | ||
"version": "1.0.82", | ||
"description": "A full-typing wrapper around `aria2`, `The next generation download utility`.", | ||
@@ -28,3 +28,4 @@ "repository": "https://github.com/hyroge/libaria2-ts", | ||
"default": "./dist/libaria2.browser.esm.js" | ||
} | ||
}, | ||
"./*": "./*" | ||
}, | ||
@@ -34,3 +35,2 @@ "scripts": { | ||
"build:dts": "api-extractor run", | ||
"build:prod": "rollup -c ./rollup.prod.config.js --sourcemap", | ||
"build": "rollup -c ./rollup.config.js --sourcemap", | ||
@@ -51,6 +51,9 @@ "test": "ts-node ./tests/index.ts", | ||
"@rollup/pluginutils": "^4.1.0", | ||
"@types/events": "^3.0.0", | ||
"@types/node": "^16.4.13", | ||
"@types/uuid": "^8.3.0", | ||
"@types/ws": "^7.4.0", | ||
"@typescript-eslint/eslint-plugin": "^4.15.2", | ||
"@typescript-eslint/parser": "^4.15.2", | ||
"axios": "^0.22.0", | ||
"eslint": "7.12.1", | ||
@@ -63,6 +66,6 @@ "eslint-config-standard": "^16.0.2", | ||
"isomorphic-ws": "^4.0.1", | ||
"rollup": "^2.40.0", | ||
"rollup": "^2.58.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "^0.30.0", | ||
"typedoc": "^0.21.5", | ||
"typedoc": "^0.22.5", | ||
"typescript": "^4.3.5", | ||
@@ -73,9 +76,9 @@ "uuid": "^8.3.2" | ||
"@types/events": "^3.0.0", | ||
"@types/node": "^16.4.13", | ||
"@types/ws": "^7.4.0", | ||
"@types/node": "^16.4.13", | ||
"axios": "^0.21.1" | ||
}, | ||
"dependencies": { | ||
"ws": "^8.0.0" | ||
"ws": "^8.2.3" | ||
} | ||
} |
@@ -6,3 +6,2 @@ /// <reference types="node" /> | ||
import type { default as WebSocket_3 } from 'ws'; | ||
import WebSocketClient from 'isomorphic-ws'; | ||
@@ -808,3 +807,3 @@ declare namespace Adapter { | ||
/** @ignore */ | ||
protected $ws: WebSocketClient; | ||
protected $ws: WebSocket; | ||
/** @ignore */ | ||
@@ -820,3 +819,3 @@ protected $options: IAria2ClientOptions & IAria2WSClientOptions; | ||
/** @ignore */ | ||
protected $errorHandle<TError>(e: TError): void; | ||
protected $errorHandle<T>(e: T): void; | ||
/** | ||
@@ -823,0 +822,0 @@ * ## Wait WebSocket Open |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
1090367
18
1586
4
30
Updatedws@^8.2.3