UNPKG

@golem-sdk/golem-js

Version:

NodeJS and WebBrowser SDK for building apps running on Golem Network

1 lines 461 kB
const e=(e,t=!1)=>new Promise((r=>setTimeout(r,e*(t?1:1e3))));class t extends Error{constructor(e,t){super(e),this.previous=t}}class r extends t{}class i extends r{}class n extends r{}class o extends t{}class s extends t{}class a extends t{}class c extends t{constructor(e,t,r){super(e,r),this.code=t}}const u="undefined"!=typeof window&&void 0!==window.document,l="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,h="object"==typeof self&&self.constructor&&"DedicatedWorkerGlobalScope"===self.constructor.name;function d(e){if(u)throw new o(`Feature ${e} is unsupported in the browser.`)}function p(){const e=()=>{};return{child:()=>p(),debug:e,info:e,warn:e,error:e}}var f="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function g(){throw new Error("setTimeout has not been defined")}function v(){throw new Error("clearTimeout has not been defined")}var m=g,y=v;function w(e){if(m===setTimeout)return setTimeout(e,0);if((m===g||!m)&&setTimeout)return m=setTimeout,setTimeout(e,0);try{return m(e,0)}catch(t){try{return m.call(null,e,0)}catch(t){return m.call(this,e,0)}}}"function"==typeof f.setTimeout&&(m=setTimeout),"function"==typeof f.clearTimeout&&(y=clearTimeout);var b,E=[],S=!1,I=-1;function A(){S&&b&&(S=!1,b.length?E=b.concat(E):I=-1,E.length&&P())}function P(){if(!S){var e=w(A);S=!0;for(var t=E.length;t;){for(b=E,E=[];++I<t;)b&&b[I].run();I=-1,t=E.length}b=null,S=!1,function(e){if(y===clearTimeout)return clearTimeout(e);if((y===v||!y)&&clearTimeout)return y=clearTimeout,clearTimeout(e);try{return y(e)}catch(t){try{return y.call(null,e)}catch(t){return y.call(this,e)}}}(e)}}function T(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];E.push(new R(e,t)),1!==E.length||S||w(P)}function R(e,t){this.fun=e,this.array=t}R.prototype.run=function(){this.fun.apply(null,this.array)};function O(){}var C=O,N=O,k=O,x=O,_=O,D=O,F=O;var q=f.performance||{},B=q.now||q.mozNow||q.msNow||q.oNow||q.webkitNow||function(){return(new Date).getTime()};var j=new Date;var $={nextTick:T,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:C,addListener:N,once:k,off:x,removeListener:_,removeAllListeners:D,emit:F,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*B.call(q),r=Math.floor(t),i=Math.floor(t%1*1e9);return e&&(r-=e[0],(i-=e[1])<0&&(r--,i+=1e9)),[r,i]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-j)/1e3}},M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function L(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function V(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),r}var U,H,z={exports:{}};function W(){if(H)return U;H=1;var e=1e3,t=60*e,r=60*t,i=24*r,n=7*i,o=365.25*i;function s(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}return U=function(a,c){c=c||{};var u=typeof a;if("string"===u&&a.length>0)return function(s){if((s=String(s)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*n;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===u&&isFinite(a))return c.long?function(n){var o=Math.abs(n);if(o>=i)return s(n,o,i,"day");if(o>=r)return s(n,o,r,"hour");if(o>=t)return s(n,o,t,"minute");if(o>=e)return s(n,o,e,"second");return n+" ms"}(a):function(n){var o=Math.abs(n);if(o>=i)return Math.round(n/i)+"d";if(o>=r)return Math.round(n/r)+"h";if(o>=t)return Math.round(n/t)+"m";if(o>=e)return Math.round(n/e)+"s";return n+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var G=function(e){function t(e){let i,n,o,s=null;function a(...e){if(!a.enabled)return;const r=a,n=Number(new Date),o=n-(i||n);r.diff=o,r.prev=i,r.curr=n,i=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((i,n)=>{if("%%"===i)return"%";s++;const o=t.formatters[n];if("function"==typeof o){const t=e[s];i=o.call(r,t),e.splice(s,1),s--}return i})),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!==s?s:(n!==t.namespaces&&(n=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const i=t(this.namespace+(void 0===r?":":r)+e);return i.log=this.log,i}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const i=("string"==typeof e?e:"").split(/[\s,]+/),n=i.length;for(r=0;r<n;r++)i[r]&&("-"===(e=i[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,i;for(r=0,i=t.skips.length;r<i;r++)if(t.skips[r].test(e))return!1;for(r=0,i=t.names.length;r<i;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=W(),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};!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 i=0,n=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(i++,"%c"===e&&(n=i))})),t.splice(n,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&&void 0!==$&&"env"in $&&(e=$.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;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},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=G(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(z,z.exports);var Y=L(z.exports);function K(e,t={disableAutoPrefix:!1}){const r=function(e,t){return t||e.startsWith("golem-js:")?e:`golem-js:${e}`}(e,t.disableAutoPrefix),i=Y(r);function n(e,t,r){r?i(`[${e}] ${t} %o`,r):i(`[${e}] ${t}`)}return{child:e=>K(`${r}:${e}`,t),info:function(e,t){n("INFO",e,t)},error:function(e,t){n("ERROR",e,t)},warn:function(e,t){n("WARN",e,t)},debug:function(e,t){n("DEBUG",e,t)}}}function J(){return(l?null===process||void 0===process?void 0:process.env.YAGNA_API_URL:"")||"http://127.0.0.1:7465"}function X(){var e;return l&&null!==(e=null===process||void 0===process?void 0:process.env.YAGNA_APPKEY)&&void 0!==e?e:""}function Q(){var e;return l&&null!==(e=null===process||void 0===process?void 0:process.env.YAGNA_SUBNET)&&void 0!==e?e:"public"}function Z(){var e;return l&&null!==(e=null===process||void 0===process?void 0:process.env.GOLEM_REGISTRY_URL)&&void 0!==e?e:"https://registry.golem.network"}function ee(){var e;return l&&null!==(e=process.env.PAYMENT_NETWORK)&&void 0!==e?e:"holesky"}function te(){return!!l&&"true"===(null===process||void 0===process?void 0:process.env.GOLEM_DEV_MODE)}var re=Object.freeze({__proto__:null,getPaymentNetwork:ee,getRepoUrl:Z,getYagnaApiUrl:J,getYagnaAppKey:X,getYagnaSubnet:Q,isDevMode:te}),ie={},ne={},oe={},se={},ae={};Object.defineProperty(ae,"__esModule",{value:!0}),ae.BaseHttpRequest=void 0;ae.BaseHttpRequest=class{constructor(e){this.config=e}};var ce=[],ue=[],le="undefined"!=typeof Uint8Array?Uint8Array:Array,he=!1;function de(){he=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)ce[t]=e[t],ue[e.charCodeAt(t)]=t;ue["-".charCodeAt(0)]=62,ue["_".charCodeAt(0)]=63}function pe(e,t,r){for(var i,n,o=[],s=t;s<r;s+=3)i=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(ce[(n=i)>>18&63]+ce[n>>12&63]+ce[n>>6&63]+ce[63&n]);return o.join("")}function fe(e){var t;he||de();for(var r=e.length,i=r%3,n="",o=[],s=16383,a=0,c=r-i;a<c;a+=s)o.push(pe(e,a,a+s>c?c:a+s));return 1===i?(t=e[r-1],n+=ce[t>>2],n+=ce[t<<4&63],n+="=="):2===i&&(t=(e[r-2]<<8)+e[r-1],n+=ce[t>>10],n+=ce[t>>4&63],n+=ce[t<<2&63],n+="="),o.push(n),o.join("")}function ge(e,t,r,i,n){var o,s,a=8*n-i-1,c=(1<<a)-1,u=c>>1,l=-7,h=r?n-1:0,d=r?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=i;l>0;s=256*s+e[t+h],h+=d,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,i),o-=u}return(p?-1:1)*s*Math.pow(2,o-i)}function ve(e,t,r,i,n,o){var s,a,c,u=8*o-n-1,l=(1<<u)-1,h=l>>1,d=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,f=i?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*c-1)*Math.pow(2,n),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,n),s=0));n>=8;e[r+p]=255&a,p+=f,a/=256,n-=8);for(s=s<<n|a,u+=n;u>0;e[r+p]=255&s,p+=f,s/=256,u-=8);e[r+p-f]|=128*g}var me={}.toString,ye=Array.isArray||function(e){return"[object Array]"==me.call(e)};function we(){return Ee.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function be(e,t){if(we()<t)throw new RangeError("Invalid typed array length");return Ee.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Ee.prototype:(null===e&&(e=new Ee(t)),e.length=t),e}function Ee(e,t,r){if(!(Ee.TYPED_ARRAY_SUPPORT||this instanceof Ee))return new Ee(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Ae(this,e)}return Se(this,e,t,r)}function Se(e,t,r,i){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,i){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,r):new Uint8Array(t,r,i);Ee.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Ee.prototype:e=Pe(e,t);return e}(e,t,r,i):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!Ee.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|Oe(t,r);e=be(e,i);var n=e.write(t,r);n!==i&&(e=e.slice(0,n));return e}(e,t,r):function(e,t){if(Re(t)){var r=0|Te(t.length);return 0===(e=be(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(i=t.length)!=i?be(e,0):Pe(e,t);if("Buffer"===t.type&&ye(t.data))return Pe(e,t.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function Ie(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function Ae(e,t){if(Ie(t),e=be(e,t<0?0:0|Te(t)),!Ee.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function Pe(e,t){var r=t.length<0?0:0|Te(t.length);e=be(e,r);for(var i=0;i<r;i+=1)e[i]=255&t[i];return e}function Te(e){if(e>=we())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+we().toString(16)+" bytes");return 0|e}function Re(e){return!(null==e||!e._isBuffer)}function Oe(e,t){if(Re(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return tt(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return rt(e).length;default:if(i)return tt(e).length;t=(""+t).toLowerCase(),i=!0}}function Ce(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return He(this,t,r);case"utf8":case"utf-8":return Me(this,t,r);case"ascii":return Ve(this,t,r);case"latin1":case"binary":return Ue(this,t,r);case"base64":return $e(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ze(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function Ne(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function ke(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=Ee.from(t,i)),Re(t))return 0===t.length?-1:xe(e,t,r,i,n);if("number"==typeof t)return t&=255,Ee.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):xe(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function xe(e,t,r,i,n){var o,s=1,a=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){var l=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===c)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){for(var h=!0,d=0;d<c;d++)if(u(e,o+d)!==u(t,d)){h=!1;break}if(h)return o}return-1}function _e(e,t,r,i){r=Number(r)||0;var n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[r+s]=a}return s}function De(e,t,r,i){return it(tt(t,e.length-r),e,r,i)}function Fe(e,t,r,i){return it(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function qe(e,t,r,i){return Fe(e,t,r,i)}function Be(e,t,r,i){return it(rt(t),e,r,i)}function je(e,t,r,i){return it(function(e,t){for(var r,i,n,o=[],s=0;s<e.length&&!((t-=2)<0);++s)i=(r=e.charCodeAt(s))>>8,n=r%256,o.push(n),o.push(i);return o}(t,e.length-r),e,r,i)}function $e(e,t,r){return 0===t&&r===e.length?fe(e):fe(e.slice(t,r))}function Me(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n<r;){var o,s,a,c,u=e[n],l=null,h=u>239?4:u>223?3:u>191?2:1;if(n+h<=r)switch(h){case 1:u<128&&(l=u);break;case 2:128==(192&(o=e[n+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[n+1],s=e[n+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[n+1],s=e[n+2],a=e[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,h=1):l>65535&&(l-=65536,i.push(l>>>10&1023|55296),l=56320|1023&l),i.push(l),n+=h}return function(e){var t=e.length;if(t<=Le)return String.fromCharCode.apply(String,e);var r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=Le));return r}(i)}Ee.TYPED_ARRAY_SUPPORT=void 0===f.TYPED_ARRAY_SUPPORT||f.TYPED_ARRAY_SUPPORT,we(),Ee.poolSize=8192,Ee._augment=function(e){return e.__proto__=Ee.prototype,e},Ee.from=function(e,t,r){return Se(null,e,t,r)},Ee.TYPED_ARRAY_SUPPORT&&(Ee.prototype.__proto__=Uint8Array.prototype,Ee.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Ee[Symbol.species]),Ee.alloc=function(e,t,r){return function(e,t,r,i){return Ie(t),t<=0?be(e,t):void 0!==r?"string"==typeof i?be(e,t).fill(r,i):be(e,t).fill(r):be(e,t)}(null,e,t,r)},Ee.allocUnsafe=function(e){return Ae(null,e)},Ee.allocUnsafeSlow=function(e){return Ae(null,e)},Ee.isBuffer=nt,Ee.compare=function(e,t){if(!Re(e)||!Re(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,i=t.length,n=0,o=Math.min(r,i);n<o;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},Ee.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Ee.concat=function(e,t){if(!ye(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Ee.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var i=Ee.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){var o=e[r];if(!Re(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,n),n+=o.length}return i},Ee.byteLength=Oe,Ee.prototype._isBuffer=!0,Ee.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Ne(this,t,t+1);return this},Ee.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Ne(this,t,t+3),Ne(this,t+1,t+2);return this},Ee.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Ne(this,t,t+7),Ne(this,t+1,t+6),Ne(this,t+2,t+5),Ne(this,t+3,t+4);return this},Ee.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?Me(this,0,e):Ce.apply(this,arguments)},Ee.prototype.equals=function(e){if(!Re(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Ee.compare(this,e)},Ee.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Ee.prototype.compare=function(e,t,r,i,n){if(!Re(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(i,n),u=e.slice(t,r),l=0;l<a;++l)if(c[l]!==u[l]){o=c[l],s=u[l];break}return o<s?-1:s<o?1:0},Ee.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},Ee.prototype.indexOf=function(e,t,r){return ke(this,e,t,r,!0)},Ee.prototype.lastIndexOf=function(e,t,r){return ke(this,e,t,r,!1)},Ee.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return _e(this,e,t,r);case"utf8":case"utf-8":return De(this,e,t,r);case"ascii":return Fe(this,e,t,r);case"latin1":case"binary":return qe(this,e,t,r);case"base64":return Be(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return je(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},Ee.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Le=4096;function Ve(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}function Ue(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function He(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var n="",o=t;o<r;++o)n+=et(e[o]);return n}function ze(e,t,r){for(var i=e.slice(t,r),n="",o=0;o<i.length;o+=2)n+=String.fromCharCode(i[o]+256*i[o+1]);return n}function We(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function Ge(e,t,r,i,n,o){if(!Re(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function Ye(e,t,r,i){t<0&&(t=65535+t+1);for(var n=0,o=Math.min(e.length-r,2);n<o;++n)e[r+n]=(t&255<<8*(i?n:1-n))>>>8*(i?n:1-n)}function Ke(e,t,r,i){t<0&&(t=4294967295+t+1);for(var n=0,o=Math.min(e.length-r,4);n<o;++n)e[r+n]=t>>>8*(i?n:3-n)&255}function Je(e,t,r,i,n,o){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Xe(e,t,r,i,n){return n||Je(e,0,r,4),ve(e,t,r,i,23,4),r+4}function Qe(e,t,r,i,n){return n||Je(e,0,r,8),ve(e,t,r,i,52,8),r+8}Ee.prototype.slice=function(e,t){var r,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e),Ee.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=Ee.prototype;else{var n=t-e;r=new Ee(n,void 0);for(var o=0;o<n;++o)r[o]=this[o+e]}return r},Ee.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||We(e,t,this.length);for(var i=this[e],n=1,o=0;++o<t&&(n*=256);)i+=this[e+o]*n;return i},Ee.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||We(e,t,this.length);for(var i=this[e+--t],n=1;t>0&&(n*=256);)i+=this[e+--t]*n;return i},Ee.prototype.readUInt8=function(e,t){return t||We(e,1,this.length),this[e]},Ee.prototype.readUInt16LE=function(e,t){return t||We(e,2,this.length),this[e]|this[e+1]<<8},Ee.prototype.readUInt16BE=function(e,t){return t||We(e,2,this.length),this[e]<<8|this[e+1]},Ee.prototype.readUInt32LE=function(e,t){return t||We(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Ee.prototype.readUInt32BE=function(e,t){return t||We(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Ee.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||We(e,t,this.length);for(var i=this[e],n=1,o=0;++o<t&&(n*=256);)i+=this[e+o]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},Ee.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||We(e,t,this.length);for(var i=t,n=1,o=this[e+--i];i>0&&(n*=256);)o+=this[e+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*t)),o},Ee.prototype.readInt8=function(e,t){return t||We(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Ee.prototype.readInt16LE=function(e,t){t||We(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Ee.prototype.readInt16BE=function(e,t){t||We(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Ee.prototype.readInt32LE=function(e,t){return t||We(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Ee.prototype.readInt32BE=function(e,t){return t||We(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Ee.prototype.readFloatLE=function(e,t){return t||We(e,4,this.length),ge(this,e,!0,23,4)},Ee.prototype.readFloatBE=function(e,t){return t||We(e,4,this.length),ge(this,e,!1,23,4)},Ee.prototype.readDoubleLE=function(e,t){return t||We(e,8,this.length),ge(this,e,!0,52,8)},Ee.prototype.readDoubleBE=function(e,t){return t||We(e,8,this.length),ge(this,e,!1,52,8)},Ee.prototype.writeUIntLE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||Ge(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[t]=255&e;++o<r&&(n*=256);)this[t+o]=e/n&255;return t+r},Ee.prototype.writeUIntBE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||Ge(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},Ee.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||Ge(this,e,t,1,255,0),Ee.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Ee.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||Ge(this,e,t,2,65535,0),Ee.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ye(this,e,t,!0),t+2},Ee.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||Ge(this,e,t,2,65535,0),Ee.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ye(this,e,t,!1),t+2},Ee.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||Ge(this,e,t,4,4294967295,0),Ee.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Ke(this,e,t,!0),t+4},Ee.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||Ge(this,e,t,4,4294967295,0),Ee.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Ke(this,e,t,!1),t+4},Ee.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);Ge(this,e,t,r,n-1,-n)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+r},Ee.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);Ge(this,e,t,r,n-1,-n)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+r},Ee.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||Ge(this,e,t,1,127,-128),Ee.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Ee.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||Ge(this,e,t,2,32767,-32768),Ee.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ye(this,e,t,!0),t+2},Ee.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||Ge(this,e,t,2,32767,-32768),Ee.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ye(this,e,t,!1),t+2},Ee.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||Ge(this,e,t,4,2147483647,-2147483648),Ee.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Ke(this,e,t,!0),t+4},Ee.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||Ge(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Ee.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Ke(this,e,t,!1),t+4},Ee.prototype.writeFloatLE=function(e,t,r){return Xe(this,e,t,!0,r)},Ee.prototype.writeFloatBE=function(e,t,r){return Xe(this,e,t,!1,r)},Ee.prototype.writeDoubleLE=function(e,t,r){return Qe(this,e,t,!0,r)},Ee.prototype.writeDoubleBE=function(e,t,r){return Qe(this,e,t,!1,r)},Ee.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);var n,o=i-r;if(this===e&&r<t&&t<i)for(n=o-1;n>=0;--n)e[n+t]=this[n+r];else if(o<1e3||!Ee.TYPED_ARRAY_SUPPORT)for(n=0;n<o;++n)e[n+t]=this[n+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},Ee.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===e.length){var n=e.charCodeAt(0);n<256&&(e=n)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!Ee.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=Re(e)?e:tt(new Ee(e,i).toString()),a=s.length;for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var Ze=/[^+\/0-9A-Za-z-_]/g;function et(e){return e<16?"0"+e.toString(16):e.toString(16)}function tt(e,t){var r;t=t||1/0;for(var i=e.length,n=null,o=[],s=0;s<i;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function rt(e){return function(e){var t,r,i,n,o,s;he||de();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[a-2]?2:"="===e[a-1]?1:0,s=new le(3*a/4-o),i=o>0?a-4:a;var c=0;for(t=0,r=0;t<i;t+=4,r+=3)n=ue[e.charCodeAt(t)]<<18|ue[e.charCodeAt(t+1)]<<12|ue[e.charCodeAt(t+2)]<<6|ue[e.charCodeAt(t+3)],s[c++]=n>>16&255,s[c++]=n>>8&255,s[c++]=255&n;return 2===o?(n=ue[e.charCodeAt(t)]<<2|ue[e.charCodeAt(t+1)]>>4,s[c++]=255&n):1===o&&(n=ue[e.charCodeAt(t)]<<10|ue[e.charCodeAt(t+1)]<<4|ue[e.charCodeAt(t+2)]>>2,s[c++]=n>>8&255,s[c++]=255&n),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Ze,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function it(e,t,r,i){for(var n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function nt(e){return null!=e&&(!!e._isBuffer||ot(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&ot(e.slice(0,0))}(e))}function ot(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var st={},at={};Object.defineProperty(at,"__esModule",{value:!0}),at.ApiError=void 0;let ct=class extends Error{constructor(e,t,r){super(r),this.name="ApiError",this.url=t.url,this.status=t.status,this.statusText=t.statusText,this.body=t.body,this.request=e}};at.ApiError=ct;var ut,lt,ht,dt,pt,ft,gt,vt={},mt=M&&M.__classPrivateFieldSet||function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r},yt=M&&M.__classPrivateFieldGet||function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)};Object.defineProperty(vt,"__esModule",{value:!0}),vt.CancelablePromise=vt.CancelError=void 0;let wt=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}};vt.CancelError=wt;let bt=class{constructor(e){ut.set(this,void 0),lt.set(this,void 0),ht.set(this,void 0),dt.set(this,void 0),pt.set(this,void 0),ft.set(this,void 0),gt.set(this,void 0),mt(this,ut,!1,"f"),mt(this,lt,!1,"f"),mt(this,ht,!1,"f"),mt(this,dt,[],"f"),mt(this,pt,new Promise(((t,r)=>{mt(this,ft,t,"f"),mt(this,gt,r,"f");const i=e=>{yt(this,ut,"f")||yt(this,lt,"f")||yt(this,ht,"f")||yt(this,dt,"f").push(e)};return Object.defineProperty(i,"isResolved",{get:()=>yt(this,ut,"f")}),Object.defineProperty(i,"isRejected",{get:()=>yt(this,lt,"f")}),Object.defineProperty(i,"isCancelled",{get:()=>yt(this,ht,"f")}),e((e=>{yt(this,ut,"f")||yt(this,lt,"f")||yt(this,ht,"f")||(mt(this,ut,!0,"f"),yt(this,ft,"f")&&yt(this,ft,"f").call(this,e))}),(e=>{yt(this,ut,"f")||yt(this,lt,"f")||yt(this,ht,"f")||(mt(this,lt,!0,"f"),yt(this,gt,"f")&&yt(this,gt,"f").call(this,e))}),i)})),"f")}get[(ut=new WeakMap,lt=new WeakMap,ht=new WeakMap,dt=new WeakMap,pt=new WeakMap,ft=new WeakMap,gt=new WeakMap,Symbol.toStringTag)](){return"Cancellable Promise"}then(e,t){return yt(this,pt,"f").then(e,t)}catch(e){return yt(this,pt,"f").catch(e)}finally(e){return yt(this,pt,"f").finally(e)}cancel(){if(!(yt(this,ut,"f")||yt(this,lt,"f")||yt(this,ht,"f"))){if(mt(this,ht,!0,"f"),yt(this,dt,"f").length)try{for(const e of yt(this,dt,"f"))e()}catch(e){return void console.warn("Cancellation threw an error",e)}yt(this,dt,"f").length=0,yt(this,gt,"f")&&yt(this,gt,"f").call(this,new wt("Request aborted"))}}get isCancelled(){return yt(this,ht,"f")}};vt.CancelablePromise=bt,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.request=e.catchErrorCodes=e.getResponseBody=e.getResponseHeader=e.sendRequest=e.getRequestBody=e.getHeaders=e.resolve=e.getFormData=e.getQueryString=e.base64=e.isFormData=e.isBlob=e.isStringWithValue=e.isString=e.isDefined=void 0;const t=at,r=vt;e.isDefined=e=>null!=e;e.isString=e=>"string"==typeof e;e.isStringWithValue=t=>(0,e.isString)(t)&&""!==t;e.isBlob=e=>"object"==typeof e&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.arrayBuffer&&"function"==typeof e.constructor&&"string"==typeof e.constructor.name&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag]);e.isFormData=e=>e instanceof FormData;e.base64=e=>{try{return btoa(e)}catch(t){return Ee.from(e).toString("base64")}};e.getQueryString=t=>{const r=[],i=(t,n)=>{(0,e.isDefined)(n)&&(Array.isArray(n)?n.forEach((e=>{i(t,e)})):"object"==typeof n?Object.entries(n).forEach((([e,r])=>{i(`${t}[${e}]`,r)})):((e,t)=>{r.push(`${encodeURIComponent(e)}=${encodeURIComponent(String(t))}`)})(t,n))};return Object.entries(t).forEach((([e,t])=>{i(e,t)})),r.length>0?`?${r.join("&")}`:""};e.getFormData=t=>{if(t.formData){const r=new FormData,i=(t,i)=>{(0,e.isString)(i)||(0,e.isBlob)(i)?r.append(t,i):r.append(t,JSON.stringify(i))};return Object.entries(t.formData).filter((([t,r])=>(0,e.isDefined)(r))).forEach((([e,t])=>{Array.isArray(t)?t.forEach((t=>i(e,t))):i(e,t)})),r}};e.resolve=async(e,t)=>"function"==typeof t?t(e):t;e.getHeaders=async(t,r)=>{const[i,n,o,s]=await Promise.all([(0,e.resolve)(r,t.TOKEN),(0,e.resolve)(r,t.USERNAME),(0,e.resolve)(r,t.PASSWORD),(0,e.resolve)(r,t.HEADERS)]),a=Object.entries({Accept:"application/json",...s,...r.headers}).filter((([t,r])=>(0,e.isDefined)(r))).reduce(((e,[t,r])=>({...e,[t]:String(r)})),{});if((0,e.isStringWithValue)(i)&&(a.Authorization=`Bearer ${i}`),(0,e.isStringWithValue)(n)&&(0,e.isStringWithValue)(o)){const t=(0,e.base64)(`${n}:${o}`);a.Authorization=`Basic ${t}`}return void 0!==r.body&&(r.mediaType?a["Content-Type"]=r.mediaType:(0,e.isBlob)(r.body)?a["Content-Type"]=r.body.type||"application/octet-stream":(0,e.isString)(r.body)?a["Content-Type"]="text/plain":(0,e.isFormData)(r.body)||(a["Content-Type"]="application/json")),new Headers(a)};e.getRequestBody=t=>{if(void 0!==t.body)return t.mediaType?.includes("/json")?JSON.stringify(t.body):(0,e.isString)(t.body)||(0,e.isBlob)(t.body)||(0,e.isFormData)(t.body)?t.body:JSON.stringify(t.body)};e.sendRequest=async(e,t,r,i,n,o,s)=>{const a=new AbortController,c={headers:o,body:i??n,method:t.method,signal:a.signal};return e.WITH_CREDENTIALS&&(c.credentials=e.CREDENTIALS),s((()=>a.abort())),await fetch(r,c)};e.getResponseHeader=(t,r)=>{if(r){const i=t.headers.get(r);if((0,e.isString)(i))return i}};e.getResponseBody=async e=>{if(204!==e.status)try{const t=e.headers.get("Content-Type");if(t){return["application/json","application/problem+json"].some((e=>t.toLowerCase().startsWith(e)))?await e.json():await e.text()}}catch(e){console.error(e)}};e.catchErrorCodes=(e,r)=>{const i={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...e.errors}[r.status];if(i)throw new t.ApiError(e,r,i);if(!r.ok){const i=r.status??"unknown",n=r.statusText??"unknown",o=(()=>{try{return JSON.stringify(r.body,null,2)}catch(e){return}})();throw new t.ApiError(e,r,`Generic Error: status: ${i}; status text: ${n}; body: ${o}`)}};e.request=(t,i)=>new r.CancelablePromise((async(r,n,o)=>{try{const n=((t,r)=>{const i=t.ENCODE_PATH||encodeURI,n=r.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,((e,t)=>r.path?.hasOwnProperty(t)?i(String(r.path[t])):e)),o=`${t.BASE}${n}`;return r.query?`${o}${(0,e.getQueryString)(r.query)}`:o})(t,i),s=(0,e.getFormData)(i),a=(0,e.getRequestBody)(i),c=await(0,e.getHeaders)(t,i);if(!o.isCancelled){const u=await(0,e.sendRequest)(t,i,n,a,s,c,o),l=await(0,e.getResponseBody)(u),h=(0,e.getResponseHeader)(u,i.responseHeader),d={url:n,ok:u.ok,status:u.status,statusText:u.statusText,body:h??l};(0,e.catchErrorCodes)(i,d),r(d.body)}}catch(e){n(e)}}))}(st),Object.defineProperty(se,"__esModule",{value:!0}),se.FetchHttpRequest=void 0;const Et=ae,St=st;let It=class extends Et.BaseHttpRequest{constructor(e){super(e)}request(e){return(0,St.request)(this.config,e)}};se.FetchHttpRequest=It;var At={};Object.defineProperty(At,"__esModule",{value:!0}),At.ProviderService=void 0;At.ProviderService=class{constructor(e){this.httpRequest=e}getOffers(){return this.httpRequest.request({method:"GET",url:"/offers",errors:{400:"(400) Bad request",401:"(401) Authorization information is missing or invalid."}})}subscribeOffer(e){return this.httpRequest.request({method:"POST",url:"/offers",body:e,mediaType:"application/json",errors:{400:"(400) Bad request",401:"(401) Authorization information is missing or invalid."}})}unsubscribeOffer(e){return this.httpRequest.request({method:"DELETE",url:"/offers/{subscriptionId}",path:{subscriptionId:e},errors:{401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found.",410:"Already unsubscribed."}})}collectDemands(e,t=5,r=10){return this.httpRequest.request({method:"GET",url:"/offers/{subscriptionId}/events",path:{subscriptionId:e},query:{timeout:t,maxEvents:r},errors:{401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found."}})}queryReplyOffers(e,t,r){return this.httpRequest.request({method:"POST",url:"/offers/{subscriptionId}/propertyQuery/{queryId}",path:{subscriptionId:e,queryId:t},body:r,mediaType:"application/json",errors:{400:"(400) Bad request",401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found."}})}getProposalDemand(e,t){return this.httpRequest.request({method:"GET",url:"/offers/{subscriptionId}/proposals/{proposalId}",path:{subscriptionId:e,proposalId:t},errors:{401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found.",410:"Proposal rejected."}})}counterProposalOffer(e,t,r){return this.httpRequest.request({method:"POST",url:"/offers/{subscriptionId}/proposals/{proposalId}",path:{subscriptionId:e,proposalId:t},body:r,mediaType:"application/json",errors:{400:"(400) Bad request",401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found.",410:"Proposal rejected."}})}rejectProposalDemand(e,t,r){return this.httpRequest.request({method:"POST",url:"/offers/{subscriptionId}/proposals/{proposalId}/reject",path:{subscriptionId:e,proposalId:t},body:r,mediaType:"application/json",errors:{401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found.",410:"Proposal already rejected."}})}listAgreements(e,t,r,i){return this.httpRequest.request({method:"GET",url:"/agreements",query:{appSessionId:e,state:t,afterDate:r,beforeDate:i},errors:{400:"(400) Bad request",401:"(401) Authorization information is missing or invalid."}})}getAgreement(e){return this.httpRequest.request({method:"GET",url:"/agreements/{agreementId}",path:{agreementId:e},errors:{401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found."}})}collectAgreementEvents(e=5,t,r=10,i){return this.httpRequest.request({method:"GET",url:"/agreementEvents",query:{timeout:e,afterTimestamp:t,maxEvents:r,appSessionId:i},errors:{401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found."}})}approveAgreement(e,t,r=5){return this.httpRequest.request({method:"POST",url:"/agreements/{agreementId}/approve",path:{agreementId:e},query:{appSessionId:t,timeout:r},errors:{401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found.",408:"Agreement not approved within given timeout. Try again.",410:"Agreement approval failed permanently.\n Attached `ErrorMessage` contains further details:\n - `Rejected` - Indicates that the Provider himself has already\n called `rejectAgreement`.\n - `Cancelled` - Indicates that before Provider approved this Agreement,\n the Requestor has called `cancelAgreement`, thus invalidating the\n Agreement. The Provider may attempt to return to the Negotiation phase\n by sending a new Proposal.\n - `Expired` - Indicates that Agreement validity period elapsed and it was\n not approved, rejected nor cancelled.\n - `Terminated` - Indicates that Agreement is already terminated.\n "}})}rejectAgreement(e,t){return this.httpRequest.request({method:"POST",url:"/agreements/{agreementId}/reject",path:{agreementId:e},body:t,mediaType:"application/json",errors:{401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found.",410:"Agreement rejection failed permanently.\n Attached `ErrorMessage` contains further details:\n - `Rejected` - Indicates that the Provider himself has already\n called `rejectAgreement`.\n - `Cancelled` - Indicates that before Provider rejected this Agreement,\n the Requestor has called `cancelAgreement`, thus invalidating the\n Agreement. The Provider may attempt to return to the Negotiation phase\n by sending a new Proposal.\n - `Expired` - Indicates that Agreement validity period elapsed and it was\n not approved, rejected nor cancelled.\n - `Terminated` - Indicates that Agreement is already terminated.\n "}})}terminateAgreement(e,t){return this.httpRequest.request({method:"POST",url:"/agreements/{agreementId}/terminate",path:{agreementId:e},body:t,mediaType:"application/json",errors:{401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found.",409:"Agreement can not be terminated yet (is in `Proposal` or `Pending` state).",410:"Agreement termination failed permanently.\n Attached `ErrorMessage` contains further details:\n - `Rejected` - Indicates that the Provider has rejected this Agreement.\n - `Cancelled` - Indicates the Requestor has called cancelled this Agreement.\n - `Expired` - Indicates that Agreement validity period elapsed and it was\n not approved, rejected nor cancelled.\n - `Terminated` - Indicates that Agreement is already terminated.\n "}})}getTerminateAgreementReason(e){return this.httpRequest.request({method:"POST",url:"/agreements/{agreementId}/terminate/reason",path:{agreementId:e},errors:{400:"(400) Bad request",401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found."}})}};var Pt={};Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.RequestorService=void 0;Pt.RequestorService=class{constructor(e){this.httpRequest=e}beginScan(e){return this.httpRequest.request({method:"POST",url:"/scan",body:e,mediaType:"application/json",errors:{400:"(400) Bad request",401:"(401) Authorization information is missing or invalid."}})}collectScanResults(e,t=5,r=10,i){return this.httpRequest.request({method:"GET",url:"/scan/{subscriptionId}/events",path:{subscriptionId:e},query:{timeout:t,maxEvents:r,peerId:i},errors:{401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found."}})}endScan(e){return this.httpRequest.request({method:"DELETE",url:"/scan/{subscriptionId}",path:{subscriptionId:e},errors:{401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found."}})}getDemands(){return this.httpRequest.request({method:"GET",url:"/demands",errors:{400:"(400) Bad request",401:"(401) Authorization information is missing or invalid."}})}subscribeDemand(e){return this.httpRequest.request({method:"POST",url:"/demands",body:e,mediaType:"application/json",errors:{400:"(400) Bad request",401:"(401) Authorization information is missing or invalid."}})}unsubscribeDemand(e){return this.httpRequest.request({method:"DELETE",url:"/demands/{subscriptionId}",path:{subscriptionId:e},errors:{401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found.",410:"Already unsubscribed."}})}collectOffers(e,t=5,r=10){return this.httpRequest.request({method:"GET",url:"/demands/{subscriptionId}/events",path:{subscriptionId:e},query:{timeout:t,maxEvents:r},errors:{401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found."}})}queryReplyDemands(e,t,r){return this.httpRequest.request({method:"POST",url:"/demands/{subscriptionId}/propertyQuery/{queryId}",path:{subscriptionId:e,queryId:t},body:r,mediaType:"application/json",errors:{400:"(400) Bad request",401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found."}})}getProposalOffer(e,t){return this.httpRequest.request({method:"GET",url:"/demands/{subscriptionId}/proposals/{proposalId}",path:{subscriptionId:e,proposalId:t},errors:{401:"(401) Authorization information is missing or invalid.",404:"(404) The specified resource was not found.",410:"Proposal rejected."}})}counterProposalDemand(e,t,r){return this.httpRequest.request({method:"POST",url:"/demands/{subscriptionId}/proposals/{proposalId}",path:{subscriptionId:e,proposalId:t},body:r,mediaType:"application/json",errors:{400:"(400) Bad request",401:"(401) Authorization information is missing or invalid.",404: