vendor: 9,899 bytes, line 1
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[28],{73996:function(t,e,r){!function(t,e){"use strict";function i(t,e){if(!t)throw Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function s(t,e,r){if(s.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&(("le"===e||"be"===e)&&(r=e,e=10),this._init(t||0,e||10,r||"be"))}"object"==typeof t?t.exports=s:e.BN=s,s.BN=s,s.wordSize=26;try{d="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(39588).Buffer}catch(t){}function o(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+t)}function a(t,e,r){var i=o(t,r);return r-1>=e&&(i|=o(t,r-1)<<4),i}function h(t,e,r,n){for(var s=0,o=0,a=Math.min(t.length,r),h=e;h<a;h++){var u=t.charCodeAt(h)-48;s*=n,o=u>=49?u-49+10:u>=17?u-17+10:u,i(u>=0&&o<n,"Invalid character"),s+=o}return s}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(s.isBN=function(t){return t instanceof s||null!==t&&"object"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return 0>t.cmp(e)?t:e},s.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,r):(this._parseBase(t,e,n),"le"===r&&this._initArray(this.toArray(),e,r)))},s.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=Array(this.length);for(var n,s,o=0;o<this.length;o++)this.words[o]=0;var a=0;if("be"===r)for(o=t.length-1,n=0;o>=0;o-=3)s=t[o]|t[o-1]<<8|t[o-2]<<16,this.words[n]|=s<<a&67108863,this.words[n+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(o=0,n=0;o<t.length;o+=3)s=t[o]|t[o+1]<<8|t[o+2]<<16,this.words[n]|=s<<a&67108863,this.words[n+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);return this._strip()},s.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=Array(this.length);for(var i,n=0;n<this.length;n++)this.words[n]=0;var s=0,o=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=a(t,e,n)<<s,this.words[o]|=67108863&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=a(t,e,n)<<s,this.words[o]|=67108863&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;this._strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var s=t.length-r,o=s%i,a=Math.min(s,s-o)+r,u=0,l=r;l<a;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var d=1;for(u=h(t,l,t.length,e),l=0;l<o;l++)d*=e;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},s.prototype.copy=function(t){t.words=Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},s.prototype._move=function(t){u(t,this)},s.prototype.clone=function(){var t=new s(null);return this.copy(t),t},s.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){s.prototype.inspect=l}else s.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d,c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],m=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],s=0|e.words[0],o=n*s,a=67108863&o,h=o/67108864|0;r.words[0]=a;for(var u=1;u<i;u++){for(var l=h>>>26,d=67108863&h,c=Math.min(u,e.length-1),f=Math.max(0,u-t.length+1);f<=c;f++){var m=u-f|0;l+=(o=(n=0|t.words[m])*(s=0|e.words[f])+d)/67108864|0,d=67108863&o}r.words[u]=0|d,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}s.prototype.toString=function(t,e){if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var r,n=0,s=0,o=0;o<this.length;o++){var a=this.words[o],h=((a<<n|s)&16777215).toString(16);s=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?c[6-h.length]+h+r:h+r}for(0!==s&&(r=s.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=f[t],l=m[t];r="";var d=this.clone();for(d.negative=0;!d.isZero();){var p=d.modrn(l).toString(t);r=(d=d.idivn(l)).isZero()?p+r:c[u-p.length]+p+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16,2)},d&&(s.prototype.toBuffer=function(t,e){return this.toArrayLike(d,t,e)}),s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){this._strip();var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,"byte array longer than desired length"),i(s>0,"Requested array length <= 0");var o=t.allocUnsafe?t.allocUnsafe(s):new t(s);return this["_toArrayLike"+("le"===e?"LE":"BE")](o,n),o},s.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;t[r++]=255&o,r<t.length&&(t[r++]=o>>8&255),r<t.length&&(t[r++]=o>>16&255),6===s?(r<t.length&&(t[r++]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},s.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;t[r--]=255&o,r>=0&&(t[r--]=o>>8&255),r>=0&&(t[r--]=o>>16&255),6===s?(r>=0&&(t[r--]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?s.prototype._countBits=function(t){return 32-Math.clz32(t)}:s.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return(8191&e)==0&&(r+=13,e>>>=13),(127&e)==0&&(r+=7,e>>>=7),(15&e)==0&&(r+=4,e>>>=4),(3&e)==0&&(r+=2,e>>>=2),(1&e)==0&&r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return(this.length-1)*26+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},s.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},s.prototype.ior=function(t){return i((this.negative|t.negative)==0),this.iuor(t)},s.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},s.prototype.iand=function(t){return i((this.negative|t.negative)==0),this.iuand(t)},s.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){this.length>t.length?(e=this,r=t):(e=t,r=this);for(var e,r,i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},s.prototype.ixor=function(t){return i((this.negative|t.negative)==0),this.iuxor(t)}
vendor: 6,978 bytes, line 1
1,s.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),e?this.words[r]=this.words[r]|1<<n:this.words[r]=this.words[r]&~(1<<n),this._strip()},s.prototype.iadd=function(t){if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var e,r,i,n=0,s=0;s<i.length;s++)e=(0|r.words[s])+(0|i.words[s])+n,this.words[s]=67108863&e,n=e>>>26;for(;0!==n&&s<r.length;s++)e=(0|r.words[s])+n,this.words[s]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},s.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e,r,i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(e=this,r=t):(e=t,r=this);for(var s=0,o=0;o<r.length;o++)s=(i=(0|e.words[o])-(0|r.words[o])+s)>>26,this.words[o]=67108863&i;for(;0!==s&&o<e.length;o++)s=(i=(0|e.words[o])+s)>>26,this.words[o]=67108863&i;if(0===s&&o<e.length&&e!==this)for(;o<e.length;o++)this.words[o]=e.words[o];return this.length=Math.max(this.length,o),e!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(t){return this.clone().isub(t)};var g=function(t,e,r){var i,n,s,o=t.words,a=e.words,h=r.words,u=0,l=0|o[0],d=8191&l,c=l>>>13,f=0|o[1],m=8191&f,p=f>>>13,g=0|o[2],y=8191&g,v=g>>>13,w=0|o[3],b=8191&w,M=w>>>13,E=0|o[4],S=8191&E,A=E>>>13,T=0|o[5],O=8191&T,R=T>>>13,_=0|o[6],N=8191&_,k=_>>>13,x=0|o[7],L=8191&x,P=x>>>13,B=0|o[8],I=8191&B,U=B>>>13,C=0|o[9],F=8191&C,q=C>>>13,$=0|a[0],D=8191&$,j=$>>>13,z=0|a[1],G=8191&z,H=z>>>13,K=0|a[2],J=8191&K,Y=K>>>13,W=0|a[3],Z=8191&W,V=W>>>13,X=0|a[4],Q=8191&X,tt=X>>>13,te=0|a[5],tr=8191&te,ti=te>>>13,tn=0|a[6],ts=8191&tn,to=tn>>>13,ta=0|a[7],th=8191&ta,tu=ta>>>13,tl=0|a[8],td=8191&tl,tc=tl>>>13,tf=0|a[9],tm=8191&tf,tp=tf>>>13;r.negative=t.negative^e.negative,r.length=19;var tg=(u+(i=Math.imul(d,D))|0)+((8191&(n=(n=Math.imul(d,j))+Math.imul(c,D)|0))<<13)|0;u=((s=Math.imul(c,j))+(n>>>13)|0)+(tg>>>26)|0,tg&=67108863,i=Math.imul(m,D),n=(n=Math.imul(m,j))+Math.imul(p,D)|0,s=Math.imul(p,j);var ty=(u+(i=i+Math.imul(d,G)|0)|0)+((8191&(n=(n=n+Math.imul(d,H)|0)+Math.imul(c,G)|0))<<13)|0;u=((s=s+Math.imul(c,H)|0)+(n>>>13)|0)+(ty>>>26)|0,ty&=67108863,i=Math.imul(y,D),n=(n=Math.imul(y,j))+Math.imul(v,D)|0,s=Math.imul(v,j),i=i+Math.imul(m,G)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,G)|0,s=s+Math.imul(p,H)|0;var tv=(u+(i=i+Math.imul(d,J)|0)|0)+((8191&(n=(n=n+Math.imul(d,Y)|0)+Math.imul(c,J)|0))<<13)|0;u=((s=s+Math.imul(c,Y)|0)+(n>>>13)|0)+(tv>>>26)|0,tv&=67108863,i=Math.imul(b,D),n=(n=Math.imul(b,j))+Math.imul(M,D)|0,s=Math.imul(M,j),i=i+Math.imul(y,G)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(v,G)|0,s=s+Math.imul(v,H)|0,i=i+Math.imul(m,J)|0,n=(n=n+Math.imul(m,Y)|0)+Math.imul(p,J)|0,s=s+Math.imul(p,Y)|0;var tw=(u+(i=i+Math.imul(d,Z)|0)|0)+((8191&(n=(n=n+Math.imul(d,V)|0)+Math.imul(c,Z)|0))<<13)|0;u=((s=s+Math.imul(c,V)|0)+(n>>>13)|0)+(tw>>>26)|0,tw&=67108863,i=Math.imul(S,D),n=(n=Math.imul(S,j))+Math.imul(A,D)|0,s=Math.imul(A,j),i=i+Math.imul(b,G)|0,n=(n=n+Math.imul(b,H)|0)+Math.imul(M,G)|0,s=s+Math.imul(M,H)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(v,J)|0,s=s+Math.imul(v,Y)|0,i=i+Math.imul(m,Z)|0,n=(n=n+Math.imul(m,V)|0)+Math.imul(p,Z)|0,s=s+Math.imul(p,V)|0;var tb=(u+(i=i+Math.imul(d,Q)|0)|0)+((8191&(n=(n=n+Math.imul(d,tt)|0)+Math.imul(c,Q)|0))<<13)|0;u=((s=s+Math.imul(c,tt)|0)+(n>>>13)|0)+(tb>>>26)|0,tb&=67108863,i=Math.imul(O,D),n=(n=Math.imul(O,j))+Math.imul(R,D)|0,s=Math.imul(R,j),i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(A,G)|0,s=s+Math.imul(A,H)|0,i=i+Math.imul(b,J)|0,n=(n=n+Math.imul(b,Y)|0)+Math.imul(M,J)|0,s=s+Math.imul(M,Y)|0,i=i+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,V)|0)+Math.imul(v,Z)|0,s=s+Math.imul(v,V)|0,i=i+Math.imul(m,Q)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,Q)|0,s=s+Math.imul(p,tt)|0;var tM=(u+(i=i+Math.imul(d,tr)|0)|0)+((8191&(n=(n=n+Math.imul(d,ti)|0)+Math.imul(c,tr)|0))<<13)|0;u=((s=s+Math.imul(c,ti)|0)+(n>>>13)|0)+(tM>>>26)|0,tM&=67108863,i=Math.imul(N,D),n=(n=Math.imul(N,j))+Math.imul(k,D)|0,s=Math.imul(k,j),i=i+Math.imul(O,G)|0,n=(n=n+Math.imul(O,H)|0)+Math.imul(R,G)|0,s=s+Math.imul(R,H)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(A,J)|0,s=s+Math.imul(A,Y)|0,i=i+Math.imul(b,Z)|0,n=(n=n+Math.imul(b,V)|0)+Math.imul(M,Z)|0,s=s+Math.imul(M,V)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(v,Q)|0,s=s+Math.imul(v,tt)|0,i=i+Math.imul(m,tr)|0,n=(n=n+Math.imul(m,ti)|0)+Math.imul(p,tr)|0,s=s+Math.imul(p,ti)|0;var tE=(u+(i=i+Math.imul(d,ts)|0)|0)+((8191&(n=(n=n+Math.imul(d,to)|0)+Math.imul(c,ts)|0))<<13)|0;u=((s=s+Math.imul(c,to)|0)+(n>>>13)|0)+(tE>>>26)|0,tE&=67108863,i=Math.imul(L,D),n=(n=Math.imul(L,j))+Math.imul(P,D)|0,s=Math.imul(P,j),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(k,G)|0,s=s+Math.imul(k,H)|0,i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(R,J)|0,s=s+Math.imul(R,Y)|0,i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(A,Z)|0,s=s+Math.imul(A,V)|0,i=i+Math.imul(b,Q)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(M,Q)|0,s=s+Math.imul(M,tt)|0,i=i+Math.imul(y,tr)|0,n=(n=n+Math.imul(y,ti)|0)+Math.imul(v,tr)|0,s=s+Math.imul(v,ti)|0,i=i+Math.imul(m,ts)|0,n=(n=n+Math.imul(m,to)|0)+Math.imul(p,ts)|0,s=s+Math.imul(p,to)|0;var tS=(u+(i=i+Math.imul(d,th)|0)|0)+((8191&(n=(n=n+Math.imul(d,tu)|0)+Math.imul(c,th)|0))<<13)|0;u=((s=s+Math.imul(c,tu)|0)+(n>>>13)|0)+(tS>>>26)|0,tS&=67108863,i=Math.imul(I,D),n=(n=Math.imul(I,j))+Math.imul(U,D)|0,s=Math.imul(U,j),i=i+Math.imul(L,G)|0,n=(n=n+Math.imul(L,H)|0)+Math.imul(P,G)|0,s=s+Math.imul(P,H)|0,i=i+Math.imul(N,J)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(k,J)|0,s=s+Math.imul(k,Y)|0,i=i+Math.imul(O,Z)|0,n=(n=n+Math.imul(O,V)|0)+Math.imul(R,Z)|0,s=s+Math.imul(R,V)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,tt)|0,i=i+Math.imul(b,tr)|0,n=(n=n+Math.imul(b,t
vendor: 4,145 bytes, line 1
1i)|0)+Math.imul(M,tr)|0,s=s+Math.imul(M,ti)|0,i=i+Math.imul(y,ts)|0,n=(n=n+Math.imul(y,to)|0)+Math.imul(v,ts)|0,s=s+Math.imul(v,to)|0,i=i+Math.imul(m,th)|0,n=(n=n+Math.imul(m,tu)|0)+Math.imul(p,th)|0,s=s+Math.imul(p,tu)|0;var tA=(u+(i=i+Math.imul(d,td)|0)|0)+((8191&(n=(n=n+Math.imul(d,tc)|0)+Math.imul(c,td)|0))<<13)|0;u=((s=s+Math.imul(c,tc)|0)+(n>>>13)|0)+(tA>>>26)|0,tA&=67108863,i=Math.imul(F,D),n=(n=Math.imul(F,j))+Math.imul(q,D)|0,s=Math.imul(q,j),i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,H)|0)+Math.imul(U,G)|0,s=s+Math.imul(U,H)|0,i=i+Math.imul(L,J)|0,n=(n=n+Math.imul(L,Y)|0)+Math.imul(P,J)|0,s=s+Math.imul(P,Y)|0,i=i+Math.imul(N,Z)|0,n=(n=n+Math.imul(N,V)|0)+Math.imul(k,Z)|0,s=s+Math.imul(k,V)|0,i=i+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(R,Q)|0,s=s+Math.imul(R,tt)|0,i=i+Math.imul(S,tr)|0,n=(n=n+Math.imul(S,ti)|0)+Math.imul(A,tr)|0,s=s+Math.imul(A,ti)|0,i=i+Math.imul(b,ts)|0,n=(n=n+Math.imul(b,to)|0)+Math.imul(M,ts)|0,s=s+Math.imul(M,to)|0,i=i+Math.imul(y,th)|0,n=(n=n+Math.imul(y,tu)|0)+Math.imul(v,th)|0,s=s+Math.imul(v,tu)|0,i=i+Math.imul(m,td)|0,n=(n=n+Math.imul(m,tc)|0)+Math.imul(p,td)|0,s=s+Math.imul(p,tc)|0;var tT=(u+(i=i+Math.imul(d,tm)|0)|0)+((8191&(n=(n=n+Math.imul(d,tp)|0)+Math.imul(c,tm)|0))<<13)|0;u=((s=s+Math.imul(c,tp)|0)+(n>>>13)|0)+(tT>>>26)|0,tT&=67108863,i=Math.imul(F,G),n=(n=Math.imul(F,H))+Math.imul(q,G)|0,s=Math.imul(q,H),i=i+Math.imul(I,J)|0,n=(n=n+Math.imul(I,Y)|0)+Math.imul(U,J)|0,s=s+Math.imul(U,Y)|0,i=i+Math.imul(L,Z)|0,n=(n=n+Math.imul(L,V)|0)+Math.imul(P,Z)|0,s=s+Math.imul(P,V)|0,i=i+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,tt)|0,i=i+Math.imul(O,tr)|0,n=(n=n+Math.imul(O,ti)|0)+Math.imul(R,tr)|0,s=s+Math.imul(R,ti)|0,i=i+Math.imul(S,ts)|0,n=(n=n+Math.imul(S,to)|0)+Math.imul(A,ts)|0,s=s+Math.imul(A,to)|0,i=i+Math.imul(b,th)|0,n=(n=n+Math.imul(b,tu)|0)+Math.imul(M,th)|0,s=s+Math.imul(M,tu)|0,i=i+Math.imul(y,td)|0,n=(n=n+Math.imul(y,tc)|0)+Math.imul(v,td)|0,s=s+Math.imul(v,tc)|0;var tO=(u+(i=i+Math.imul(m,tm)|0)|0)+((8191&(n=(n=n+Math.imul(m,tp)|0)+Math.imul(p,tm)|0))<<13)|0;u=((s=s+Math.imul(p,tp)|0)+(n>>>13)|0)+(tO>>>26)|0,tO&=67108863,i=Math.imul(F,J),n=(n=Math.imul(F,Y))+Math.imul(q,J)|0,s=Math.imul(q,Y),i=i+Math.imul(I,Z)|0,n=(n=n+Math.imul(I,V)|0)+Math.imul(U,Z)|0,s=s+Math.imul(U,V)|0,i=i+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,tt)|0,i=i+Math.imul(N,tr)|0,n=(n=n+Math.imul(N,ti)|0)+Math.imul(k,tr)|0,s=s+Math.imul(k,ti)|0,i=i+Math.imul(O,ts)|0,n=(n=n+Math.imul(O,to)|0)+Math.imul(R,ts)|0,s=s+Math.imul(R,to)|0,i=i+Math.imul(S,th)|0,n=(n=n+Math.imul(S,tu)|0)+Math.imul(A,th)|0,s=s+Math.imul(A,tu)|0,i=i+Math.imul(b,td)|0,n=(n=n+Math.imul(b,tc)|0)+Math.imul(M,td)|0,s=s+Math.imul(M,tc)|0;var tR=(u+(i=i+Math.imul(y,tm)|0)|0)+((8191&(n=(n=n+Math.imul(y,tp)|0)+Math.imul(v,tm)|0))<<13)|0;u=((s=s+Math.imul(v,tp)|0)+(n>>>13)|0)+(tR>>>26)|0,tR&=67108863,i=Math.imul(F,Z),n=(n=Math.imul(F,V))+Math.imul(q,Z)|0,s=Math.imul(q,V),i=i+Math.imul(I,Q)|0,n=(n=n+Math.imul(I,tt)|0)+Math.imul(U,Q)|0,s=s+Math.imul(U,tt)|0,i=i+Math.imul(L,tr)|0,n=(n=n+Math.imul(L,ti)|0)+Math.imul(P,tr)|0,s=s+Math.imul(P,ti)|0,i=i+Math.imul(N,ts)|0,n=(n=n+Math.imul(N,to)|0)+Math.imul(k,ts)|0,s=s+Math.imul(k,to)|0,i=i+Math.imul(O,th)|0,n=(n=n+Math.imul(O,tu)|0)+Math.imul(R,th)|0,s=s+Math.imul(R,tu)|0,i=i+Math.imul(S,td)|0,n=(n=n+Math.imul(S,tc)|0)+Math.imul(A,td)|0,s=s+Math.imul(A,tc)|0;var t_=(u+(i=i+Math.imul(b,tm)|0)|0)+((8191&(n=(n=n+Math.imul(b,tp)|0)+Math.imul(M,tm)|0))<<13)|0;u=((s=s+Math.imul(M,tp)|0)+(n>>>13)|0)+(t_>>>26)|0,t_&=67108863,i=Math.imul(F,Q),n=(n=Math.imul(F,tt))+Math.imul(q,Q)|0,s=Math.imul(q,tt),i=i+Math.imul(I,tr)|0,n=(n=n+Math.imul(I,ti)|0)+Math.imul(U,tr)|0,s=s+Math.imul(U,ti)|0,i=i+Math.imul(L,ts)|0,n=(n=n+Math.imul(L,to)|0)+Math.imul(P,ts)|0,s=s+Math.imul(P,to)|0,i=i+Math.imul(N,th)|0,n=(n=n+Math.imul(N,tu)|0)+Math.imul(k,th)|0,s=s+Math.imul(k,tu)|0,i=i+Math.imul(O,td)|0,n=(n=n+Math.imul(O,tc)|0)+Math.imul(R,td)|0,s=s+Math.imul(R,tc)|0;var tN=(u+(i=i+Math.imul(S,tm)|0)|0)+((8191&(n=(n=n+Math.imul(S,tp)|0)+Math.imul(A,tm)|0))<<13)|0;u=((s=s+Math.imul(A,tp)|0)+(n>>>13)|0)+(tN>>>
vendor: 21,331 bytes, line 1
126)|0,tN&=67108863,i=Math.imul(F,tr),n=(n=Math.imul(F,ti))+Math.imul(q,tr)|0,s=Math.imul(q,ti),i=i+Math.imul(I,ts)|0,n=(n=n+Math.imul(I,to)|0)+Math.imul(U,ts)|0,s=s+Math.imul(U,to)|0,i=i+Math.imul(L,th)|0,n=(n=n+Math.imul(L,tu)|0)+Math.imul(P,th)|0,s=s+Math.imul(P,tu)|0,i=i+Math.imul(N,td)|0,n=(n=n+Math.imul(N,tc)|0)+Math.imul(k,td)|0,s=s+Math.imul(k,tc)|0;var tk=(u+(i=i+Math.imul(O,tm)|0)|0)+((8191&(n=(n=n+Math.imul(O,tp)|0)+Math.imul(R,tm)|0))<<13)|0;u=((s=s+Math.imul(R,tp)|0)+(n>>>13)|0)+(tk>>>26)|0,tk&=67108863,i=Math.imul(F,ts),n=(n=Math.imul(F,to))+Math.imul(q,ts)|0,s=Math.imul(q,to),i=i+Math.imul(I,th)|0,n=(n=n+Math.imul(I,tu)|0)+Math.imul(U,th)|0,s=s+Math.imul(U,tu)|0,i=i+Math.imul(L,td)|0,n=(n=n+Math.imul(L,tc)|0)+Math.imul(P,td)|0,s=s+Math.imul(P,tc)|0;var tx=(u+(i=i+Math.imul(N,tm)|0)|0)+((8191&(n=(n=n+Math.imul(N,tp)|0)+Math.imul(k,tm)|0))<<13)|0;u=((s=s+Math.imul(k,tp)|0)+(n>>>13)|0)+(tx>>>26)|0,tx&=67108863,i=Math.imul(F,th),n=(n=Math.imul(F,tu))+Math.imul(q,th)|0,s=Math.imul(q,tu),i=i+Math.imul(I,td)|0,n=(n=n+Math.imul(I,tc)|0)+Math.imul(U,td)|0,s=s+Math.imul(U,tc)|0;var tL=(u+(i=i+Math.imul(L,tm)|0)|0)+((8191&(n=(n=n+Math.imul(L,tp)|0)+Math.imul(P,tm)|0))<<13)|0;u=((s=s+Math.imul(P,tp)|0)+(n>>>13)|0)+(tL>>>26)|0,tL&=67108863,i=Math.imul(F,td),n=(n=Math.imul(F,tc))+Math.imul(q,td)|0,s=Math.imul(q,tc);var tP=(u+(i=i+Math.imul(I,tm)|0)|0)+((8191&(n=(n=n+Math.imul(I,tp)|0)+Math.imul(U,tm)|0))<<13)|0;u=((s=s+Math.imul(U,tp)|0)+(n>>>13)|0)+(tP>>>26)|0,tP&=67108863;var tB=(u+(i=Math.imul(F,tm))|0)+((8191&(n=(n=Math.imul(F,tp))+Math.imul(q,tm)|0))<<13)|0;return u=((s=Math.imul(q,tp))+(n>>>13)|0)+(tB>>>26)|0,tB&=67108863,h[0]=tg,h[1]=ty,h[2]=tv,h[3]=tw,h[4]=tb,h[5]=tM,h[6]=tE,h[7]=tS,h[8]=tA,h[9]=tT,h[10]=tO,h[11]=tR,h[12]=t_,h[13]=tN,h[14]=tk,h[15]=tx,h[16]=tL,h[17]=tP,h[18]=tB,0!==u&&(h[19]=u,r.length++),r};function y(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,s=0;s<r.length-1;s++){var o=n;n=0;for(var a=67108863&i,h=Math.min(s,e.length-1),u=Math.max(0,s-t.length+1);u<=h;u++){var l=s-u,d=(0|t.words[l])*(0|e.words[u]),c=67108863&d;o=o+(d/67108864|0)|0,a=67108863&(c=c+a|0),n+=(o=o+(c>>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r._strip()}function v(t,e){this.x=t,this.y=e}Math.imul||(g=p),s.prototype.mulTo=function(t,e){var r,i=this.length+t.length;return 10===this.length&&10===t.length?g(this,t,e):i<63?p(this,t,e):y(this,t,e)},v.prototype.makeRBT=function(t){for(var e=Array(t),r=s.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},v.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},v.prototype.permute=function(t,e,r,i,n,s){for(var o=0;o<s;o++)i[o]=e[t[o]],n[o]=r[t[o]]},v.prototype.transform=function(t,e,r,i,n,s){this.permute(s,t,e,r,i,n);for(var o=1;o<n;o<<=1)for(var a=o<<1,h=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),l=0;l<n;l+=a)for(var d=h,c=u,f=0;f<o;f++){var m=r[l+f],p=i[l+f],g=r[l+f+o],y=i[l+f+o],v=d*g-c*y;y=d*y+c*g,g=v,r[l+f]=m+g,i[l+f]=p+y,r[l+f+o]=m-g,i[l+f+o]=p-y,f!==a&&(v=h*d-u*c,c=h*c+u*d,d=v)}},v.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},v.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},v.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},v.prototype.convert13b=function(t,e,r,n){for(var s=0,o=0;o<e;o++)s+=0|t[o],r[2*o]=8191&s,s>>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o<n;++o)r[o]=0;i(0===s),i((-8192&s)==0)},v.prototype.stub=function(t){for(var e=Array(t),r=0;r<t;r++)e[r]=0;return e},v.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),s=this.stub(i),o=Array(i),a=Array(i),h=Array(i),u=Array(i),l=Array(i),d=Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,o,i),this.convert13b(e.words,e.length,u,i),this.transform(o,s,a,h,i,n),this.transform(u,s,l,d,i,n);for(var f=0;f<i;f++){var m=a[f]*l[f]-h[f]*d[f];h[f]=a[f]*d[f]+h[f]*l[f],a[f]=m}return this.conjugate(a,h,i),this.transform(a,h,c,s,i,n),this.conjugate(c,s,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},s.prototype.mul=function(t){var e=new s(null);return e.words=Array(this.length+t.length),this.mulTo(t,e)},s.prototype.mulf=function(t){var e=new s(null);return e.words=Array(this.length+t.length),y(this,t,e)},s.prototype.imul=function(t){return this.clone().mulTo(t,this)},s.prototype.imuln=function(t){var e=t<0;e&&(t=-t),i("number"==typeof t),i(t<67108864);for(var r=0,n=0;n<this.length;n++){var s=(0|this.words[n])*t,o=(67108863&s)+(67108863&r);r>>=26,r+=(s/67108864|0)+(o>>>26),this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),this.length=0===t?1:this.length,e?this.ineg():this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new s(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var n=r.sqr();i<e.length;i++,n=n.sqr())0!==e[i]&&(r=r.mul(n));return r},s.prototype.iushln=function(t){i("number"==typeof t&&t>=0);var e,r=t%26,n=(t-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e<this.length;e++){var a=this.words[e]&s,h=(0|this.words[e])-a<<r;this.words[e]=h|o,o=a>>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},s.prototype.ishln=function(t){return i(0===this.negative),this.iushln(t)},s.prototype.iushrn=function(t,e,r){i("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var n,s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<<s;if(n-=o,n=Math.max(0,n),r){for(var h=0;h<o;h++)r.words[h]=this.words[h];r.length=o}if(0===o);else if(this.length>o)for(this.length-=o,h=0;h<this.length;h++)this.words[h]=this.words[h+o];else this.words[0]=0,this.length=1;var u=0;for(h=this.length-1;h>=0&&(0!==u||h>=n);h--){var l=0|this.words[h];this.words[h]=u<<26-s|l>>>s,u=l&a}return r&&0!==u&&(r.words[r.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;return!(this.length<=r)&&!!(this.words[r]&1<<e)},s.prototype.imaskn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;return(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==e&&r++,this.length=Math.min(r,this.length),0!==e&&(this.words[this.length-1]&=67108863^67108863>>>e<<e),this._strip())},s.prototype.maskn=function(t){return this.clone().imaskn(t)},s.prototype.iaddn=function(t){return(i("number"==typeof t),i(t<67108864),t<0)?this.isubn(-t):0!==this.negative?(1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0):(this.negative=0,this.isubn(t),this.negative=1),this):this._iaddn(t)},s.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},s.prototype.addn=function(t){return this.clone().iaddn(t)},s.prototype.subn=function(t){return this.clone().isubn(t)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(t,e,r){var n,s,o=t.length+r;this._expand(o);var a=0;for(n=0;n<t.length;n++){s=(0|this.words[n+r])+a;var h=(0|t.words[n])*e;s-=67108863&h,a=(s>>26)-(h/67108864|0),this.words[n+r]=67108863&s}for(;n<this.length-r;n++)a=(s=(0|this.words[n+r])+a)>>26,this.words[n+r]=67108863&s;if(0===a)return this._strip();for(i(-1===a),a=0,n=0;n<this.length;n++)a=(s=-(0|this.words[n])+a)>>26,this.words[n]=67108863&s;return this.negative=1,this._strip()},s.prototype._wordDiv=function(t,e){var r,i=this.length-t.length,n=this.clone(),o=t,a=0|o.words[o.length-1];0!=(i=26-this._countBits(a))&&(o=o.ushln(i),n.iushln(i),a=0|o.words[o.length-1]);var h=n.length-o.length;if("mod"!==e){(r=new s(null)).length=h+1,r.words=Array(r.length);for(var u=0;u<r.length;u++)r.words[u]=0}var l=n.clone()._ishlnsubmul(o,1,h);0===l.negative&&(n=l,r&&(r.words[h]=1));for(var d=h-1;d>=0;d--){var c=(0|n.words[o.length+d])*67108864+(0|n.words[o.length+d-1]);for(c=Math.min(c/a|0,67108863),n._ishlnsubmul(o,c,d);0!==n.negative;)c--,n.negative=0,n._ishlnsubmul(o,1,d),n.isZero()||(n.negative^=1);r&&(r.words[d]=c)}return r&&r._strip(),n._strip(),"div"!==e&&0!==i&&n.iushrn(i),{div:r||null,mod:n}},s.prototype.divmod=function(t,e,r){var n,o,a;return(i(!t.isZero()),this.isZero())?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):(this.negative&t.negative)!=0?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||0>this.cmp(t)?{div:new s(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new s(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modrn(t.words[0]))}:this._wordDiv(t,e)},s.prototype.div=function(t){return this.divmod(t,"div",!1).div},s.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},s.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modrn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=67108864%t,n=0,s=this.length-1;s>=0;s--)n=(r*n+(0|this.words[s]))%t;return e?-n:n},s.prototype.modn=function(t){return this.modrn(t)},s.prototype.idivn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var s=(0|this.words[n])+67108864*r;this.words[n]=s/t|0,r=s%t}return this._strip(),e?this.ineg():this},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),a=new s(0),h=new s(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var l=r.clone(),d=e.clone();!e.isZero();){for(var c=0,f=1;(e.words[0]&f)==0&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(l),o.isub(d)),n.iushrn(1),o.iushrn(1);for(var m=0,p=1;(r.words[0]&p)==0&&m<26;++m,p<<=1);if(m>0)for(r.iushrn(m);m-- >0;)(a.isOdd()||h.isOdd())&&(a.iadd(l),h.isub(d)),a.iushrn(1),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(h)):(r.isub(e),a.isub(n),h.isub(o))}return{a:a,b:h,gcd:r.iushln(u)}},s.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e,r=this,n=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var o=new s(1),a=new s(0),h=n.clone();r.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;(r.words[0]&l)==0&&u<26;++u,l<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(h),o.iushrn(1);for(var d=0,c=1;(n.words[0]&c)==0&&d<26;++d,c<<=1);if(d>0)for(n.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);r.cmp(n)>=0?(r.isub(n),o.isub(a)):(n.isub(r),a.isub(o))}return 0>(e=0===r.cmpn(1)?o:a).cmpn(0)&&e.iadd(t),e},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var s=e;e=r,r=s}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return(1&this.words[0])==0},s.prototype.isOdd=function(){return(1&this.words[0])==1},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var s=n,o=r;0!==s&&o<this.length;o++){var a=0|this.words[o];a+=s,s=a>>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},s.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return -1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},s.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return -1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return -1===this.cmpn(t)},s.prototype.lt=function(t){return -1===this.cmp(t)},s.prototype.lten=function(t){return 0>=this.cmpn(t)},s.prototype.lte=function(t){return 0>=this.cmp(t)},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new T(t)},s.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},s.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},s.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},s.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},s.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function b(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function T(t){if("string"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function O(t){T.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var t=new s(null);return t.words=Array(Math.ceil(this.n/13)),t},b.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength();while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(t,e){t.iushrn(this.n,0,e)},b.prototype.imulK=function(t){return t.imul(this.k)},n(M,b),M.prototype.split=function(t,e){for(var r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9){t.words[0]=0,t.length=1;return}var n=t.words[9];for(i=10,e.words[e.length++]=4194303&n;i<t.length;i++){var s=0|t.words[i];t.words[i-10]=(4194303&s)<<4|n>>>22,n=s}n>>>=22,t.words[i-10]=n,0===n&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(E,b),n(S,b),n(A,b),A.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=(0|t.words[r])*19+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){var e;if(w[t])return w[t];if("k256"===t)e=new M;else if("p224"===t)e=new E;else if("p192"===t)e=new S;else if("p25519"===t)e=new A;else throw Error("Unknown prime "+t);return w[t]=e,e},T.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},T.prototype._verify2=function(t,e){i((t.negative|e.negative)==0,"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},T.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},T.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},T.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},T.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},T.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},T.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return 0>r.cmpn(0)&&r.iadd(this.m),r},T.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},T.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},T.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},T.prototype.isqr=function(t){return this.imul(t,t.clone())},T.prototype.sqr=function(t){return this.mul(t,t)},T.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),h=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new s(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var d=this.pow(l,n),c=this.pow(t,n.addn(1).iushrn(1)),f=this.pow(t,n),m=o;0!==f.cmp(a);){for(var p=f,g=0;0!==p.cmp(a);g++)p=p.redSqr();i(g<m);var y=this.pow(d,new s(1).iushln(m-g-1));
1c=c.redMul(y),d=y.redSqr(),f=f.redMul(d),m=g}return c},T.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},T.prototype.pow=function(t,e){if(e.isZero())return new s(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=Array(16);r[0]=new s(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var n=r[0],o=0,a=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var d=u>>l&1;if(n!==r[0]&&(n=this.sqr(n)),0===d&&0===o){a=0;continue}o<<=1,o|=d,(4==++a||0===i&&0===l)&&(n=this.mul(n,r[o]),a=0,o=0)}h=26}return n},T.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},T.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new O(t)},n(O,T),O.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},O.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},O.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):0>n.cmpn(0)&&(s=n.iadd(this.m)),s._forceRed(this)},O.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):0>n.cmpn(0)&&(o=n.iadd(this.m)),o._forceRed(this)},O.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t=r.nmd(t),this)},39557:function(t,e,r){"use strict";var i=r(68571),n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s="undefined"!=typeof window&&void 0!==window.document;void 0!==i&&null!=i.versions&&i.versions.node,("undefined"==typeof self?"undefined":n(self))==="object"&&self.constructor&&self.constructor.name,"undefined"!=typeof window&&"nodejs"===window.name||"undefined"!=typeof navigator&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),"undefined"!=typeof Deno&&void 0!==Deno.version&&Deno.version.deno,e.jU=s},40028:function(t,e,r){"use strict";let i,n,s,o;r.d(e,{ClobClient:function(){return ii},Side:function(){return M}});var a,h,u,l,d,c,f,m,p,g,y,v,w,b,M,E,S,A,T,O,R,_,N,k,x={};r.r(x),r.d(x,{hasBrowserEnv:function(){return tz},hasStandardBrowserEnv:function(){return tH},hasStandardBrowserWebWorkerEnv:function(){return tK},navigator:function(){return tG},origin:function(){return tJ}}),(d=M||(M={})).BUY="BUY",d.SELL="SELL",(c=E||(E={})).GTC="GTC",c.FOK="FOK",c.GTD="GTD",c.FAK="FAK",(f=S||(S={}))[f.POLYGON=137]="POLYGON",f[f.AMOY=80002]="AMOY",(m=A||(A={})).MAX="max",m.ONE_WEEK="1w",m.ONE_DAY="1d",m.SIX_HOURS="6h",m.ONE_HOUR="1h",(p=T||(T={})).COLLATERAL="COLLATERAL",p.CONDITIONAL="CONDITIONAL",(g=O||(O={})).COMPLEMENTARY="COMPLEMENTARY",g.MERGE="MERGE",g.MINT="MINT";let L=async(t,e,r,i)=>{let n=await t.getAddress(),s=`${r}`;return await t._signTypedData({name:"ClobAuthDomain",version:"1",chainId:e},{ClobAuth:[{name:"address",type:"address"},{name:"timestamp",type:"string"},{name:"nonce",type:"uint256"},{name:"message",type:"string"}]},{address:n,timestamp:s,nonce:i,message:"This message attests that I control the given wallet"})};function P(t,e,r){return t.split(e).join(r)}let B=async(t,e,r,i,n)=>{let s=e+r+i;void 0!==n&&(s+=n);let o=function(t){let e=atob(t.replace(/-/g,"+").replace(/_/g,"/").replace(/[^A-Za-z0-9+/=]/g,"")),r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);return r.buffer}(t),a=await globalThis.crypto.subtle.importKey("raw",o,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),h=new TextEncoder().encode(s);return P(P(function(t){let e=new Uint8Array(t),r="";for(let t=0;t<e.byteLength;t++)r+=String.fromCharCode(e[t]);return btoa(r)}(await globalThis.crypto.subtle.sign("HMAC",a,h)),"+","-"),"/","_")},I=async(t,e,r,i)=>{let n=Math.floor(Date.now()/1e3);void 0!==i&&(n=i);let s=0;void 0!==r&&(s=r);let o=await L(t,e,n,s);return{POLY_ADDRESS:await t.getAddress(),POLY_SIGNATURE:o,POLY_TIMESTAMP:`${n}`,POLY_NONCE:`${s}`}},U=async(t,e,r,i)=>{let n=Math.floor(Date.now()/1e3);return void 0!==i&&(n=i),{POLY_ADDRESS:await t.getAddress(),POLY_SIGNATURE:await B(e.secret,n,r.method,r.requestPath,r.body),POLY_TIMESTAMP:`${n}`,POLY_API_KEY:e.key,POLY_PASSPHRASE:e.passphrase}},C=(t,e)=>({...t,...e});function F(t,e){return function(){return t.apply(e,arguments)}}var q=r(68571);let{toString:$}=Object.prototype,{getPrototypeOf:D}=Object,{iterator:j,toStringTag:z}=Symbol,G=(i=Object.create(null),t=>{let e=$.call(t);return i[e]||(i[e]=e.slice(8,-1).toLowerCase())}),H=t=>(t=t.toLowerCase(),e=>G(e)===t),K=t=>e=>typeof e===t,{isArray:J}=Array,Y=K("undefined");function W(t){return null!==t&&!Y(t)&&null!==t.constructor&&!Y(t.constructor)&&X(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}let Z=H("ArrayBuffer"),V=K("string"),X=K("function"),Q=K("number"),tt=t=>null!==t&&"object"==typeof t,te=t=>{if("object"!==G(t))return!1;let e=D(t);return(null===e||e===Object.prototype||null===Object.getPrototypeOf(e))&&!(z in t)&&!(j in t)},tr=H("Date"),ti=H("File"),tn=H("Blob"),ts=H("FileList"),to=H("URLSearchParams"),[ta,th,tu,tl]=["ReadableStream","Request","Response","Headers"].map(H);function td(t,e,{allOwnKeys:r=!1}={}){let i,n;if(null!=t){if("object"!=typeof t&&(t=[t]),J(t))for(i=0,n=t.length;i<n;i++)e.call(null,t[i],i,t);else{let n;if(W(t))return;let s=r?Object.getOwnPropertyNames(t):Object.keys(t),o=s.length;for(i=0;i<o;i++)n=s[i],e.call(null,t[n],n,t)}}}function tc(t,e){let r;if(W(t))return null;e=e.toLowerCase();let i=Object.keys(t),n=i.length;for(;n-- >0;)if(e===(r=i[n]).toLowerCase())return r;return null}let tf="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,tm=t=>!Y(t)&&t!==tf,tp=(n="undefined"!=typeof Uint8Array&&D(Uint8Array),t=>n&&t instanceof n),tg=H("HTMLFormElement"),ty=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),tv=H("RegExp"),tw=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),i={};td(r,(r,n)=>{let s;!1!==(s=e(r,n,t))&&(i[n]=s||r)}),Object.defineProperties(t,i)},tb=H("AsyncFunction"),tM=(a="function"==typeof setImmediate,h=X(tf.postMessage),a?setImmediate:h?(u=`axios@${Math.random()}`,l=[],tf.addEventListener("message",({source:t,data:e})=>{t===tf&&e===u&&l.length&&l.shift()()},!1),t=>{l.push(t),tf.postMessage(u,"*")}):t=>setTimeout(t)),tE="undefined"!=typeof queueMicrotask?queueMicrotask.bind(tf):void 0!==q&&q.nextTick||tM;var tS={isArray:J,isArrayBuffer:Z,isBuffer:W,isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||X(t.append)&&("formdata"===(e=G(t))||"object"===e&&X(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&Z(t.buffer)},isString:V,isNumber:Q,isBoolean:t=>!0===t||!1===t,isObject:tt,isPlainObject:te,isEmptyObject:t=>{if(!tt(t)||W(t))return!1;try{return 0===Object.keys(t).length&&Object.getPrototypeOf(t)===Object.prototype}catch(t){return!1}},isReadableStream:ta,isRequest:th,isResponse:tu,isHeaders:tl,isUndefined:Y,isDate:tr,isFile:ti,isBlob:tn,isRegExp:tv,isFunction:X,isStream:t=>tt(t)&&X(t.pipe),isURLSearchParams:to,isTypedArray:tp,isFileList:ts,forEac
1h:td,merge:function t(){let{caseless:e,skipUndefined:r}=tm(this)&&this||{},i={},n=(n,s)=>{let o=e&&tc(i,s)||s;te(i[o])&&te(n)?i[o]=t(i[o],n):te(n)?i[o]=t({},n):J(n)?i[o]=n.slice():r&&Y(n)||(i[o]=n)};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&td(arguments[t],n);return i},extend:(t,e,r,{allOwnKeys:i}={})=>(td(e,(e,i)=>{r&&X(e)?t[i]=F(e,r):t[i]=e},{allOwnKeys:i}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,r,i)=>{t.prototype=Object.create(e.prototype,i),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},toFlatObject:(t,e,r,i)=>{let n,s,o;let a={};if(e=e||{},null==t)return e;do{for(s=(n=Object.getOwnPropertyNames(t)).length;s-- >0;)o=n[s],(!i||i(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=!1!==r&&D(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},kindOf:G,kindOfTest:H,endsWith:(t,e,r)=>{t=String(t),(void 0===r||r>t.length)&&(r=t.length),r-=e.length;let i=t.indexOf(e,r);return -1!==i&&i===r},toArray:t=>{if(!t)return null;if(J(t))return t;let e=t.length;if(!Q(e))return null;let r=Array(e);for(;e-- >0;)r[e]=t[e];return r},forEachEntry:(t,e)=>{let r;let i=(t&&t[j]).call(t);for(;(r=i.next())&&!r.done;){let i=r.value;e.call(t,i[0],i[1])}},matchAll:(t,e)=>{let r;let i=[];for(;null!==(r=t.exec(e));)i.push(r);return i},isHTMLForm:tg,hasOwnProperty:ty,hasOwnProp:ty,reduceDescriptors:tw,freezeMethods:t=>{tw(t,(e,r)=>{if(X(t)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;if(X(t[r])){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},toObjectSet:(t,e)=>{let r={};return(t=>{t.forEach(t=>{r[t]=!0})})(J(t)?t:String(t).split(e)),r},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,e,r){return e.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:tc,global:tf,isContextDefined:tm,isSpecCompliantForm:function(t){return!!(t&&X(t.append)&&"FormData"===t[z]&&t[j])},toJSONObject:t=>{let e=Array(10),r=(t,i)=>{if(tt(t)){if(e.indexOf(t)>=0)return;if(W(t))return t;if(!("toJSON"in t)){e[i]=t;let n=J(t)?[]:{};return td(t,(t,e)=>{let s=r(t,i+1);Y(s)||(n[e]=s)}),e[i]=void 0,n}}return t};return r(t,0)},isAsyncFn:tb,isThenable:t=>t&&(tt(t)||X(t))&&X(t.then)&&X(t.catch),setImmediate:tM,asap:tE,isIterable:t=>null!=t&&X(t[j])};function tA(t,e,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}tS.inherits(tA,Error,{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:tS.toJSONObject(this.config),code:this.code,status:this.status}}});let tT=tA.prototype,tO={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{tO[t]={value:t}}),Object.defineProperties(tA,tO),Object.defineProperty(tT,"isAxiosError",{value:!0}),tA.from=(t,e,r,i,n,s)=>{let o=Object.create(tT);tS.toFlatObject(t,o,function(t){return t!==Error.prototype},t=>"isAxiosError"!==t);let a=t&&t.message?t.message:"Error",h=null==e&&t?t.code:e;return tA.call(o,a,h,r,i,n),t&&null==o.cause&&Object.defineProperty(o,"cause",{value:t,configurable:!0}),o.name=t&&t.name||"Error",s&&Object.assign(o,s),o};var tR=r(46385).lW;function t_(t){return tS.isPlainObject(t)||tS.isArray(t)}function tN(t){return tS.endsWith(t,"[]")?t.slice(0,-2):t}function tk(t,e,r){return t?t.concat(e).map(function(t,e){return t=tN(t),!r&&e?"["+t+"]":t}).join(r?".":""):e}let tx=tS.toFlatObject(tS,{},null,function(t){return/^is[A-Z]/.test(t)});var tL=function(t,e,r){if(!tS.isObject(t))throw TypeError("target must be an object");e=e||new FormData;let i=(r=tS.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(t,e){return!tS.isUndefined(e[t])})).metaTokens,n=r.visitor||u,s=r.dots,o=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&tS.isSpecCompliantForm(e);if(!tS.isFunction(n))throw TypeError("visitor must be a function");function h(t){if(null===t)return"";if(tS.isDate(t))return t.toISOString();if(tS.isBoolean(t))return t.toString();if(!a&&tS.isBlob(t))throw new tA("Blob is not supported. Use a Buffer instead.");return tS.isArrayBuffer(t)||tS.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):tR.from(t):t}function u(t,r,n){let a=t;if(t&&!n&&"object"==typeof t){if(tS.endsWith(r,"{}"))r=i?r:r.slice(0,-2),t=JSON.stringify(t);else{var u;if(tS.isArray(t)&&(u=t,tS.isArray(u)&&!u.some(t_))||(tS.isFileList(t)||t
1S.endsWith(r,"[]"))&&(a=tS.toArray(t)))return r=tN(r),a.forEach(function(t,i){tS.isUndefined(t)||null===t||e.append(!0===o?tk([r],i,s):null===o?r:r+"[]",h(t))}),!1}}return!!t_(t)||(e.append(tk(n,r,s),h(t)),!1)}let l=[],d=Object.assign(tx,{defaultVisitor:u,convertValue:h,isVisitable:t_});if(!tS.isObject(t))throw TypeError("data must be an object");return!function t(r,i){if(!tS.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+i.join("."));l.push(r),tS.forEach(r,function(r,s){!0===(!(tS.isUndefined(r)||null===r)&&n.call(e,r,tS.isString(s)?s.trim():s,i,d))&&t(r,i?i.concat(s):[s])}),l.pop()}}(t),e};function tP(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}function tB(t,e){this._pairs=[],t&&tL(t,this,e)}let tI=tB.prototype;function tU(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function tC(t,e,r){let i;if(!e)return t;let n=r&&r.encode||tU;tS.isFunction(r)&&(r={serialize:r});let s=r&&r.serialize;if(i=s?s(e,r):tS.isURLSearchParams(e)?e.toString():new tB(e,r).toString(n)){let e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+i}return t}tI.append=function(t,e){this._pairs.push([t,e])},tI.toString=function(t){let e=t?function(e){return t.call(this,e,tP)}:tP;return this._pairs.map(function(t){return e(t[0])+"="+e(t[1])},"").join("&")};class tF{constructor(){this.handlers=[]}use(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){tS.forEach(this.handlers,function(e){null!==e&&t(e)})}}var tq={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},t$="undefined"!=typeof URLSearchParams?URLSearchParams:tB,tD="undefined"!=typeof FormData?FormData:null,tj="undefined"!=typeof Blob?Blob:null;let tz="undefined"!=typeof window&&"undefined"!=typeof document,tG="object"==typeof navigator&&navigator||void 0,tH=tz&&(!tG||0>["ReactNative","NativeScript","NS"].indexOf(tG.product)),tK="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,tJ=tz&&window.location.href||"http://localhost";var tY={...x,isBrowser:!0,classes:{URLSearchParams:t$,FormData:tD,Blob:tj},protocols:["http","https","file","blob","url","data"]},tW=function(t){if(tS.isFormData(t)&&tS.isFunction(t.entries)){let e={};return tS.forEachEntry(t,(t,r)=>{!function t(e,r,i,n){let s=e[n++];if("__proto__"===s)return!0;let o=Number.isFinite(+s),a=n>=e.length;return(s=!s&&tS.isArray(i)?i.length:s,a)?tS.hasOwnProp(i,s)?i[s]=[i[s],r]:i[s]=r:(i[s]&&tS.isObject(i[s])||(i[s]=[]),t(e,r,i[s],n)&&tS.isArray(i[s])&&(i[s]=function(t){let e,r;let i={},n=Object.keys(t),s=n.length;for(e=0;e<s;e++)i[r=n[e]]=t[r];return i}(i[s]))),!o}(tS.matchAll(/\w+|\[(\w*)]/g,t).map(t=>"[]"===t[0]?"":t[1]||t[0]),r,e,0)}),e}return null};let tZ={transitional:tq,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){let r;let i=e.getContentType()||"",n=i.indexOf("application/json")>-1,s=tS.isObject(t);if(s&&tS.isHTMLForm(t)&&(t=new FormData(t)),tS.isFormData(t))return n?JSON.stringify(tW(t)):t;if(tS.isArrayBuffer(t)||tS.isBuffer(t)||tS.isStream(t)||tS.isFile(t)||tS.isBlob(t)||tS.isReadableStream(t))return t;if(tS.isArrayBufferView(t))return t.buffer;if(tS.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1){var o,a;return(o=t,a=this.formSerializer,tL(o,new tY.classes.URLSearchParams,{visitor:function(t,e,r,i){return tY.isNode&&tS.isBuffer(t)?(this.append(e,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...a})).toString()}if((r=tS.isFileList(t))||i.indexOf("multipart/form-data")>-1){let e=this.env&&this.env.FormData;return tL(r?{"files[]":t}:t,e&&new e,this.formSerializer)}}return s||n?(e.setContentType("application/json",!1),function(t,e,r){if(tS.isString(t))try{return(0,JSON.parse)(t),tS.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(0,JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){let e=this.transitional||tZ.transitional,r=e&&e.forcedJSONParsing,i="json"===this.responseType;if(tS.isResponse(t)||tS.isReadableStream(t))return t;if(t&&tS.isString(t)&&(r&&!this.responseType||i)){let r=e&&e.silentJSONParsing;try{return JSON.parse(t,this.parseReviver)}catch(t){if(!r&&i){if("SyntaxError"===t.name)throw tA.from(t,tA.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:tY.classes.FormData,Blob:tY.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};
1tS.forEach(["delete","get","head","post","put","patch"],t=>{tZ.headers[t]={}});let tV=tS.toObjectSet(["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"]);var tX=t=>{let e,r,i;let n={};return t&&t.split("\n").forEach(function(t){i=t.indexOf(":"),e=t.substring(0,i).trim().toLowerCase(),r=t.substring(i+1).trim(),!e||n[e]&&tV[e]||("set-cookie"===e?n[e]?n[e].push(r):n[e]=[r]:n[e]=n[e]?n[e]+", "+r:r)}),n};let tQ=Symbol("internals");function t0(t){return t&&String(t).trim().toLowerCase()}function t1(t){return!1===t||null==t?t:tS.isArray(t)?t.map(t1):String(t)}let t6=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function t2(t,e,r,i,n){if(tS.isFunction(i))return i.call(this,e,r);if(n&&(e=r),tS.isString(e)){if(tS.isString(i))return -1!==e.indexOf(i);if(tS.isRegExp(i))return i.test(e)}}class t8{constructor(t){t&&this.set(t)}set(t,e,r){let i=this;function n(t,e,r){let n=t0(e);if(!n)throw Error("header name must be a non-empty string");let s=tS.findKey(i,n);s&&void 0!==i[s]&&!0!==r&&(void 0!==r||!1===i[s])||(i[s||e]=t1(t))}let s=(t,e)=>
1tS.forEach(t,(t,r)=>n(t,r,e));if(tS.isPlainObject(t)||t instanceof this.constructor)s(t,e);else if(tS.isString(t)&&(t=t.trim())&&!t6(t))s(tX(t),e);else if(tS.isObject(t)&&tS.isIterable(t)){let r={},i,n;for(let e of t){if(!tS.isArray(e))throw TypeError("Object iterator must return a key-value pair");r[n=e[0]]=(i=r[n])?tS.isArray(i)?[...i,e[1]]:[i,e[1]]:e[1]}s(r,e)}else null!=t&&n(e,t,r);return this}get(t,e){if(t=t0(t)){let r=tS.findKey(this,t);if(r){let t=this[r];if(!e)return t;if(!0===e)return function(t){let e;let r=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;for(;e=i.exec(t);)r[e[1]]=e[2];return r}(t);if(tS.isFunction(e))return e.call(this,t,r);if(tS.isRegExp(e))return e.exec(t);throw TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=t0(t)){let r=tS.findKey(this,t);return!!(r&&void 0!==this[r]&&(!e||t2(this,this[r],r,e)))}return!1}delete(t,e){let r=this,i=!1;function n(t){if(t=t0(t)){let n=tS.findKey(r,t);n&&(!e||t2(r,r[n],n,e))&&(delete r[n],i=!0)}}return tS.isArray(t)?t.forEach(n):n(t),i}clear(t){let e=Object.keys(this),r=e.length,i=!1;for(;r--;){let n=e[r];(!t||t2(this,this[n],n,t,!0))&&(delete this[n],i=!0)}return i}normalize(t){let e=this,r={};return tS.forEach(this,(i,n)=>{let s=tS.findKey(r,n);if(s){e[s]=t1(i),delete e[n];return}let o=t?n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,r)=>e.toUpperCase()+r):String(n).trim();o!==n&&delete e[n],e[o]=t1(i),r[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let e=Object.create(null);return tS.forEach(this,(r,i)=>{null!=r&&!1!==r&&(e[i]=t&&tS.isArray(r)?r.join(", "):r)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){let r=new this(t);return e.forEach(t=>r.set(t)),r}static accessor(t){let e=(this[tQ]=this[tQ]={accessors:{}}).accessors,r=this.prototype;function i(t){let i=t0(t);e[i]||(!function(t,e){let r=tS.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(t,i+r,{value:function(t,r,n){return this[i].call(this,e,t,r,n)},configurable:!0})})}(r,t),e[i]=!0)}return tS.isArray(t)?t.forEach(i):i(t),this}}function t3(t,e){let r=this||tZ,i=e||r,n=t8.from(i.headers),s=i.data;return tS.forEach(t,function(t){s=t.call(r,s,n.normalize(),e?e.status:void 0)}),n.normalize(),s}function t7(t){return!!(t&&t.__CANCEL__)}function t5(t,e,r){tA.call(this,null==t?"canceled":t,tA.ERR_CANCELED,e,r),this.name="CanceledError"}function t4(t,e,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?t(r):e(new tA("Request failed with status code "+r.status,[tA.ERR_BAD_REQUEST,tA.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}t8.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),tS.reduceDescriptors(t8.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[r]=t}}}),tS.freezeMethods(t8),tS.inherits(t5,tA,{__CANCEL__:!0});var t9=function(t,e){let r;let i=Array(t=t||10),n=Array(t),s=0,o=0;return e=void 0!==e?e:1e3,function(a){let h=Date.now(),u=n[o];r||(r=h),i[s]=a,n[s]=h;let l=o,d=0;for(;l!==s;)d+=i[l++],l%=t;if((s=(s+1)%t)===o&&(o=(o+1)%t),h-r<e)return;let c=u&&h-u;return c?Math.round(1e3*d/c):void 0}},et=function(t,e){let r,i,n=0,s=1e3/e,o=(e,s=Date.now())=>{n=s,r=null,i&&(clearTimeout(i),i=null),t(...e)};return[(...t)=>{let e=Date.now(),a=e-n;a>=s?o(t,e):(r=t,i||(i=setTimeout(()=>{i=null,o(r)},s-a)))},()=>r&&o(r)]};let ee=(t,e,r=3)=>{let i=0,n=t9(50,250);return et(r=>{let s=r.loaded,o=r.lengthComputable?r.total:void 0,a=s-i,h=n(a);i=s,t({loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:h||void 0,estimated:h&&o&&s<=o?(o-s)/h:void 0,event:r,lengthComputable:null!=o,[e?"download":"upload"]:!0})},r)},er=(t,e)=>{let r=null!=t;return[i=>e[0]({lengthComputable:r,total:t,loaded:i}),e[1]]},ei=t=>(...e)=>tS.asap(()=>t(...e));
1var en=tY.hasStandardBrowserEnv?(s=new URL(tY.origin),o=tY.navigator&&/(msie|trident)/i.test(tY.navigator.userAgent),t=>(t=new URL(t,tY.origin),s.protocol===t.protocol&&s.host===t.host&&(o||s.port===t.port))):()=>!0,es=tY.hasStandardBrowserEnv?{write(t,e,r,i,n,s){let o=[t+"="+encodeURIComponent(e)];tS.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),tS.isString(i)&&o.push("path="+i),tS.isString(n)&&o.push("domain="+n),!0===s&&o.push("secure"),document.cookie=o.join("; ")},read(t){let e=document.cookie.match(RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function eo(t,e,r){let i=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);return t&&(i||!1==r)?e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t:e}let ea=t=>t instanceof t8?{...t}:t;function eh(t,e){e=e||{};let r={};function i(t,e,r,i){return tS.isPlainObject(t)&&tS.isPlainObject(e)?tS.merge.call({caseless:i},t,e):tS.isPlainObject(e)?tS.merge({},e):tS.isArray(e)?e.slice():e}function n(t,e,r,n){return tS.isUndefined(e)?tS.isUndefined(t)?void 0:i(void 0,t,r,n):i(t,e,r,n)}function s(t,e){if(!tS.isUndefined(e))return i(void 0,e)}function o(t,e){return tS.isUndefined(e)?tS.isUndefined(t)?void 0:i(void 0,t):i(void 0,e)}function a(r,n,s){return s in e?i(r,n):s in t?i(void 0,r):void 0}let h={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(t,e,r)=>n(ea(t),ea(e),r,!0)};return tS.forEach(Object.keys({...t,...e}),function(i){let s=h[i]||n,o=s(t[i],e[i],i);tS.isUndefined(o)&&s!==a||(r[i]=o)}),r}var eu=t=>{let e=eh({},t),{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:s,headers:o,auth:a}=e;if(e.headers=o=t8.from(o),e.url=tC(eo(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),tS.isFormData(r)){if(tY.hasStandardBrowserEnv||tY.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(tS.isFunction(r.getHeaders)){let t=r.getHeaders(),e=["content-type","content-length"];Object.entries(t).forEach(([t,r])=>{e.includes(t.toLowerCase())&&o.set(t,r)})}}if(tY.hasStandardBrowserEnv&&(i&&tS.isFunction(i)&&(i=i(e)),i||!1!==i&&en(e.url))){let t=n&&s&&es.read(s);t&&o.set(n,t)}return e},el="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise(function(e,r){let i,n,s,o,a;let h=eu(t),u=h.data,l=t8.from(h.headers).normalize(),{responseType:d,onUploadProgress:c,onDownloadProgress:f}=h;function m(){o&&o(),a&&a(),h.cancelToken&&h.cancelToken.unsubscribe(i),h.signal&&h.signal.removeEventListener("abort",i)}let p=new XMLHttpRequest;function g(){if(!p)return;let i=t8.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders());t4(function(t){e(t),m()},function(t){r(t),m()},{data:d&&"text"!==d&&"json"!==d?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:i,config:t,request:p}),p=null}p.open(h.method.toUpperCase(),h.url,!0),p.timeout=h.timeout,"onloadend"in p?p.onloadend=g:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(g)},p.onabort=function(){p&&(r(new tA("Request aborted",tA.ECONNABORTED,t,p)),p=null)},p.onerror=function(e){let i=new tA(e&&e.message?e.message:"Network Error",tA.ERR_NETWORK,t,p);i.event=e||null,r(i),p=null},p.ontimeout=function(){let e=h.timeout?"timeout of "+h.timeout+"ms exceeded":"timeout exceeded",i=h.transitional||tq;h.timeoutErrorMessage&&(e=h.timeoutErrorMessage),r(new tA(e,i.clarifyTimeoutError?tA.ETIMEDOUT:tA.ECONNABORTED,t,p)),p=null},void 0===u&&l.setContentType(null),"setRequestHeader"in p&&tS.forEach(l.toJSON(),function(t,e){p.setRequestHeader(e,t)}),tS.isUndefined(h.withCredentials)||(p.withCredentials=!!h.withCredentials),d&&"json"!==d&&(p.responseType=h.responseType),f&&([s,a]=ee(f,!0),p.addEventListener("progress",s)),c&&p.upload&&([n,o]=ee(c),p.upload.addEventListener("progress",n),p.upload.addEventListener("loadend",o)),(h.cancelToken||h.signal)&&(i=e=>{p&&(r(!e||e.type?new t5(null,t,p):e),p.abort(),p=null)},h.cancelToken&&h.cancelToken.subscribe(i),h.signal&&(h.signal.aborted?i():h.signal.addEventListener("abort",i)));let y=function(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(h.url);if(y&&-1===tY.protocols.indexOf(y)){r(new tA("Unsupported protocol "+y+":",tA.ERR_BAD_REQUEST,t));return}p.send(u||null)})},ed=(t,e)=>{let{length:r}=t=t?t.filter(Boolean):[];if(e||r){let r,i=new AbortController,n=function(t){if(!r){r=!0,o();let e=t instanceof Error?t:this.reason;i.abort(e instanceof tA?e:new t5(e instanceof Error?e.message:e))}},s=e&&setTimeout(()=>{s=null,n(new tA(`timeout ${e} of ms exceeded`,tA.ETIMEDOUT))},e),o=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach(t=>{t.unsubscribe?t.unsubscribe(n):t.removeEventListener("abort",n)}),t=null)};t.forEach(t=>t.addEventListener("abort",n));let{signal:a}=i;return a.unsubscribe=()=>tS.asap(o),a}};let ec=function*(t,e){let r,i=t.byteLength;if(!e||i<e){yield t;return}let n=0;for(;n<i;)r=n+e,yield t.slice(n,r),n=r},ef=async function*(t,e){for await(let r of em(t))yield*ec(r,e)},em=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}let e=t.getReader();try{for(;;){let{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}},ep=(t,e,r,i)=>{let n;let s=ef(t,e),o=0,a=t=>{!n&&(n=!0,i&&i(t))};return new ReadableStream({async pull(t){try{let{done:e,value:i}=await s.next();if(e){a(),t.close();return}let n=i.byteLength;if(r){let t=o+=n;r(t)}t.enqueue(new Uint8Array(i))}catch(t){throw a(t),t}},cancel:t=>(a(t),s.return())},{highWaterMark:2})},{isFunction:eg}=tS,ey=(({Request:t,Response:e})=>({Request:t,Response:e}))(tS.global),{ReadableStream:ev,TextEncoder:ew}=tS.global,eb=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},eM=t=>{let e;let{fetch:r,Request:i,Response:n}=t=tS.merge.call({skipUndefined:!0},ey,t),s=r?eg(r):"function"==typeof fetch,o=eg(i),a=eg(n);if(!s)return!1;let h=s&&eg(ev),u=s&&("function"==typeof ew?(e=new ew,t=>e.encode(t)):async t=>new Uint8Array(await new i(t).arrayBuffer())),l=o&&h&&eb(()=>{let t=!1,e=new i(tY.origin,{body:new ev,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),d=a&&h&&eb(()=>tS.isReadableStream(new n("").body)),c={stream:d&&(t=>t.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(t=>{c[t]||(c[t]=(e,r)=>{let i=e&&e[t];if(i)return i.call(e);throw new tA(`Response type '${t}' is not supported`,tA.ERR_NOT_SUPPORT,r)})});let f=async t=>{if(null==t)return 0;if(tS.isBlob(t))return t.size;if(tS.isSpecCompliantForm(t)){let e=new i(tY.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return tS.isArrayBufferView(t)||tS.isArrayBuffer(t)?t.byteLength:(tS.isURLSearchParams(t)&&(t+=""),tS.isString(t))?(await u(t)).byteLength:void 0},m=async(t,e)=>{let r=tS.toFiniteNumber(t.getContentLength());return null==r?f(e):r};return async t=>{let e,{url:s,method:a,data:h,signal:u,cancelToken:f,timeout:p,onDownloadProgress:g,onUploadProgress:y,responseType:v,headers:w,withCredentials:b="same-origin",fetchOptions:M}=eu(t),E=r||fetch;v=v?(v+"").toLowerCase():"text";let S=ed([u,f&&f.toAbortSignal()],p),A=null,T=S&&S.unsubscribe&&(()=>{S.unsubscribe()});try{if(y&&l&&"get"!==a&&"head"!==a&&0!==(e=await m(w,h))){let t,r=new i(s,{method:"POST",body:h,duplex:"half"});if(tS.isFormData(h)&&(t=r.headers.get("content-type"))&&w.setContentType(t),r.body){let[t,i]=er(e,ee(ei(y)));h=ep(r.body,65536,t,i)}}tS.isString(b)||(b=b?"include":"omit");let r=o&&"credentials"in i.prototype,u={...M,signal:S,method:a.toUpperCase(),headers:w.normalize().toJSON(),body:h,duplex:"half",credentials:r?b:void 0};A=o&&new i(s,u);let f=await (o?E(A,M):E(s,u)),p=d&&("stream"===v||"response"===v);if(d&&(g||p&&T)){let t={};
1["status","statusText","headers"].forEach(e=>{t[e]=f[e]});let e=tS.toFiniteNumber(f.headers.get("content-length")),[r,i]=g&&er(e,ee(ei(g),!0))||[];f=new n(ep(f.body,65536,r,()=>{i&&i(),T&&T()}),t)}v=v||"text";let O=await c[tS.findKey(c,v)||"text"](f,t);return!p&&T&&T(),await new Promise((e,r)=>{t4(e,r,{data:O,headers:t8.from(f.headers),status:f.status,statusText:f.statusText,config:t,request:A})})}catch(e){if(T&&T(),e&&"TypeError"===e.name&&/Load failed|fetch/i.test(e.message))throw Object.assign(new tA("Network Error",tA.ERR_NETWORK,t,A),{cause:e.cause||e});throw tA.from(e,e&&e.code,t,A)}}},eE=new Map,eS=t=>{let e=t?t.env:{},{fetch:r,Request:i,Response:n}=e,s=[i,n,r],o=s.length,a,h,u=eE;for(;o--;)a=s[o],void 0===(h=u.get(a))&&u.set(a,h=o?new Map:eM(e)),u=h;return h};eS();let eA={http:null,xhr:el,fetch:{get:eS}};tS.forEach(eA,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}});let eT=t=>`- ${t}`,eO=t=>tS.isFunction(t)||null===t||!1===t;var eR=(t,e)=>{let r,i;let{length:n}=t=tS.isArray(t)?t:[t],s={};for(let o=0;o<n;o++){let n;if(i=r=t[o],!eO(r)&&void 0===(i=eA[(n=String(r)).toLowerCase()]))throw new tA(`Unknown adapter '${n}'`);if(i&&(tS.isFunction(i)||(i=i.get(e))))break;s[n||"#"+o]=i}if(!i){let t=Object.entries(s).map(([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build"));throw new tA("There is no suitable adapter to dispatch the request "+(n?t.length>1?"since :\n"+t.map(eT).join("\n"):" "+eT(t[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i};function e_(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new t5(null,t)}function eN(t){return e_(t),t.headers=t8.from(t.headers),t.data=t3.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1),eR(t.adapter||tZ.adapter,t)(t).then(function(e){return e_(t),e.data=t3.call(t,t.transformResponse,e),e.headers=t8.from(e.headers),e},function(e){return!t7(e)&&(e_(t),e&&e.response&&(e.response.data=t3.call(t,t.transformResponse,e.response),e.response.headers=t8.from(e.response.headers))),Promise.reject(e)})}let ek="1.12.2",ex={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{ex[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});let eL={};ex.transitional=function(t,e,r){function i(t,e){return"[Axios v"+ek+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return(r,n,s)=>{if(!1===t)throw new tA(i(n," has been removed"+(e?" in "+e:"")),tA.ERR_DEPRECATED);return e&&!eL[n]&&(eL[n]=!0,console.warn(i(n," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,n,s)}},ex.spelling=function(t){return(e,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};var eP={assertOptions:function(t,e,r){if("object"!=typeof t)throw new tA("options must be an object",tA.ERR_BAD_OPTION_VALUE);let i=Object.keys(t),n=i.length;for(;n-- >0;){let s=i[n],o=e[s];if(o){let e=t[s],r=void 0===e||o(e,s,t);if(!0!==r)throw new tA("option "+s+" must be "+r,tA.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new tA("Unknown option "+s,tA.ERR_BAD_OPTION)}},validators:ex};let eB=eP.validators;class eI{constructor(t){this.defaults=t||{},this.interceptors={request:new tF,response:new tF}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=Error();let r=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?r&&!String(t.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+r):t.stack=r}catch(t){}}throw t}}_request(t,e){let r,i;"string"==typeof t?(e=e||{}).url=t:e=t||{};let{transitional:n,paramsSerializer:s,headers:o}=e=eh(this.defaults,e);void 0!==n&&eP.assertOptions(n,{silentJSONParsing:eB.transitional(eB.boolean),forcedJSONParsing:eB.transitional(eB.boolean),clarifyTimeoutError:eB.transitional(eB.boolean)},!1),null!=s&&(tS.isFunction(s)?e.paramsSerializer={serialize:s}:eP.assertOptions(s,{encode:eB.function,serialize:eB.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),eP.assertOptions(e,{baseUrl:eB.spelling("baseURL"),withXsrfToken:eB.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let a=o&&tS.merge(o.common,o[e.method]);
1o&&tS.forEach(["delete","get","head","post","put","patch","common"],t=>{delete o[t]}),e.headers=t8.concat(a,o);let h=[],u=!0;this.interceptors.request.forEach(function(t){("function"!=typeof t.runWhen||!1!==t.runWhen(e))&&(u=u&&t.synchronous,h.unshift(t.fulfilled,t.rejected))});let l=[];this.interceptors.response.forEach(function(t){l.push(t.fulfilled,t.rejected)});let d=0;if(!u){let t=[eN.bind(this),void 0];for(t.unshift(...h),t.push(...l),i=t.length,r=Promise.resolve(e);d<i;)r=r.then(t[d++],t[d++]);return r}i=h.length;let c=e;for(;d<i;){let t=h[d++],e=h[d++];try{c=t(c)}catch(t){e.call(this,t);break}}try{r=eN.call(this,c)}catch(t){return Promise.reject(t)}for(d=0,i=l.length;d<i;)r=r.then(l[d++],l[d++]);return r}getUri(t){return tC(eo((t=eh(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}}tS.forEach(["delete","get","head","options"],function(t){eI.prototype[t]=function(e,r){return this.request(eh(r||{},{method:t,url:e,data:(r||{}).data}))}}),tS.forEach(["post","put","patch"],function(t){function e(e){return function(r,i,n){return this.request(eh(n||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}eI.prototype[t]=e(),eI.prototype[t+"Form"]=e(!0)});class eU{constructor(t){let e;if("function"!=typeof t)throw TypeError("executor must be a function.");this.promise=new Promise(function(t){e=t});let r=this;this.promise.then(t=>{if(!r._listeners)return;let e=r._listeners.length;for(;e-- >0;)r._listeners[e](t);r._listeners=null}),this.promise.then=t=>{let e;let i=new Promise(t=>{r.subscribe(t),e=t}).then(t);return i.cancel=function(){r.unsubscribe(e)},i},t(function(t,i,n){r.reason||(r.reason=new t5(t,i,n),e(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}toAbortSignal(){let t=new AbortController,e=e=>{t.abort(e)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let t;return{token:new eU(function(e){t=e}),cancel:t}}}let eC={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,Parti
1alContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(eC).forEach(([t,e])=>{eC[e]=t});let eF=function t(e){let r=new eI(e),i=F(eI.prototype.request,r);return tS.extend(i,eI.prototype,r,{allOwnKeys:!0}),tS.extend(i,r,null,{allOwnKeys:!0}),i.create=function(r){return t(eh(e,r))},i}(tZ);eF.Axios=eI,eF.CanceledError=t5,eF.CancelToken=eU,eF.isCancel=t7,eF.VERSION=ek,eF.toFormData=tL,eF.AxiosError=tA,eF.Cancel=eF.CanceledError,eF.all=function(t){return Promise.all(t)},eF.spread=function(t){return function(e){return t.apply(null,e)}},eF.isAxiosError=function(t){return tS.isObject(t)&&!0===t.isAxiosError},eF.mergeConfig=eh,eF.AxiosHeaders=t8,eF.formToJSON=t=>tW(tS.isHTMLForm(t)?new FormData(t):t),eF.getAdapter=eR,eF.HttpStatusCode=eC,eF.default=eF;var eq=r(39557);let e$="POST",eD="DELETE",ej=(t,e)=>{!eq.jU&&(e||(e={}),e&&(e["User-Agent"]="@polymarket/clob-client",e.Accept="*/*",e.Connection="keep-alive",e["Content-Type"]="application/json","GET"===t&&(e["Accept-Encoding"]="gzip")))},ez=async(t,e,r,i,n)=>(ej(e,r),await eF({method:e,url:t,headers:r,data:i,params:n})),eG=async(t,e)=>{try{return(await ez(t,e$,e?.headers,e?.data,e?.params)).data}catch(t){return eY(t)}},eH=async(t,e)=>{try{return(await ez(t,"GET",e?.headers,e?.data,e?.params)).data}catch(t){return eY(t)}},eK=async(t,e)=>{try{return(await ez(t,eD,e?.headers,e?.data,e?.params)).data}catch(t){return eY(t)}},eJ=async(t,e)=>{try{return(await ez(t,"PUT",e?.headers,e?.data,e?.params)).data}catch(t){return eY(t)}},eY=t=>{if(eF.isAxiosError(t)){if(t.response&&(console.error("[CLOB Client] request error",JSON.stringify({status:t.response?.status,statusText:t.response?.statusText,data:t.response?.data,config:t.response?.config})),t.response?.data))return"string"==typeof t.response?.data||t.response?.data instanceof String||!Object.prototype.hasOwnProperty.call(t.response?.data,"error")?{error:t.response?.data,status:t.response?.status}:{...t.response?.data,status:t.response?.status};if(t.message)return console.error("[CLOB Client] request error",JSON.stringify({error:t.message})),{error:t.message}}return console.error("[CLOB Client] request error",t),{error:t}},eW=t=>{let e={};return void 0!==t&&void 0!==t.ids&&(e.ids=t?.ids.join(",")),e},eZ=t=>{if(!t)return{};let e={...t};return t.quoteIds&&(e.quoteIds=t.quoteIds.join(",")),t.states&&(e.states=t.states.join(",")),t.markets&&(e.markets=t.markets.join(",")),t.requestIds&&(e.requestIds=t.requestIds.join(",")),e},eV=t=>{if(!t)return{};let e={...t};return t.requestIds&&(e.requestIds=t.requestIds.join(",")),t.states&&(e.states=t.states.join(",")),t.markets&&(e.markets=t.markets.join(",")),e},eX=Error("Signer is needed to interact with this endpoint!"),eQ=Error("API Credentials are needed to interact with this endpoint!"),e0=Error("Builder API Credentials needed to interact with this endpoint!"),e1=Error("Builder key auth failed!");function e6(t,e,r,i=!1){let n=M.BUY;return n=t.side==R.BUY?M.BUY:M.SELL,{deferExec:i,order:{salt:parseInt(t.salt,10),maker:t.maker,signer:t.signer,taker:t.taker,tokenId:t.tokenId,makerAmount:t.makerAmount,takerAmount:t.takerAmount,side:n,expiration:t.expiration,nonce:t.nonce,feeRateBps:t.feeRateBps,signatureType:t.signatureType,signature:t.signature},owner:e,orderType:r}}(y=R||(R={}))[y.BUY=0]="BUY",y[y.SELL=1]="SELL";let e2=(t,e)=>e7(t)<=e?t:Math.round((t+Number.EPSILON)*10**e)/10**e,e8=(t,e)=>e7(t)<=e?t:Math.floor(t*10**e)/10**e,e3=(t,e)=>e7(t)<=e?t:Math.ceil(t*10**e)/10**e,e7=t=>{if(Number.isInteger(t))return 0;let e=t.toString().split(".");return e.length<=1?0:e[1].length},e5=async t=>{t.hash="";let e=JSON.stringify(t),r=new TextEncoder().encode(e),i=Array.from(new Uint8Array(await globalThis.crypto.subtle.digest("SHA-1",r))).map(t=>t.toString(16).padStart(2,"0")).join("");return t.hash=i,i},e4=(t,e)=>parseFloat(t)<parseFloat(e),e9=(t,e)=>t>=parseFloat(e)&&t<=1-parseFloat(e),rt="/data/trades";(v=_||(_={}))[v.EOA=0]="EOA",v[v.POLY_PROXY=1]="POLY_PROXY",v[v.POLY_GNOSIS_SAFE=2]="POLY_GNOSIS_SAFE";let re=!1,rr=!1,ri={debug:1,default:2,info:2,warning:3,error:4,off:5},rn=ri.default,rs=null,ro=function(){try{let t=[];
1if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw Error("broken implementation")}catch(t){return t.message}return null}();(w=N||(N={})).DEBUG="DEBUG",w.INFO="INFO",w.WARNING="WARNING",w.ERROR="ERROR",w.OFF="OFF",(b=k||(k={})).UNKNOWN_ERROR="UNKNOWN_ERROR",b.NOT_IMPLEMENTED="NOT_IMPLEMENTED",b.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",b.NETWORK_ERROR="NETWORK_ERROR",b.SERVER_ERROR="SERVER_ERROR",b.TIMEOUT="TIMEOUT",b.BUFFER_OVERRUN="BUFFER_OVERRUN",b.NUMERIC_FAULT="NUMERIC_FAULT",b.MISSING_NEW="MISSING_NEW",b.INVALID_ARGUMENT="INVALID_ARGUMENT",b.MISSING_ARGUMENT="MISSING_ARGUMENT",b.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",b.CALL_EXCEPTION="CALL_EXCEPTION",b.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",b.NONCE_EXPIRED="NONCE_EXPIRED",b.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",b.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",b.TRANSACTION_REPLACED="TRANSACTION_REPLACED",b.ACTION_REJECTED="ACTION_REJECTED";let ra="0123456789abcdef";class rh{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){let r=t.toLowerCase();null==ri[r]&&this.throwArgumentError("invalid log level name","logLevel",t),rn>ri[r]||console.log.apply(console,e)}debug(...t){this._log(rh.levels.DEBUG,t)}info(...t){this._log(rh.levels.INFO,t)}warn(...t){this._log(rh.levels.WARNING,t)}makeError(t,e,r){if(rr)return this.makeError("censored error",e,{});e||(e=rh.errors.UNKNOWN_ERROR),r||(r={});let i=[];Object.keys(r).forEach(t=>{let e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t<e.length;t++)r+=ra[e[t]>>4]+ra[15&e[t]];i.push(t+"=Uint8Array(0x"+r+")")}else i.push(t+"="+JSON.stringify(e))}catch(e){i.push(t+"="+JSON.stringify(r[t].toString()))}}),i.push(`code=${e}`),i.push(`version=${this.version}`);let n=t,s="";switch(e){case k.NUMERIC_FAULT:{s="NUMERIC_FAULT";let e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":s+="-"+e;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case k.CALL_EXCEPTION:case k.INSUFFICIENT_FUNDS:case k.MISSING_NEW:case k.NONCE_EXPIRED:case k.REPLACEMENT_UNDERPRICED:case k.TRANSACTION_REPLACED:case k.UNPREDICTABLE_GAS_LIMIT:s=e}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(t+=" ("+i.join(", ")+")");let o=Error(t);return o.reason=n,o.code=e,Object.keys(r).forEach(function(t){o[t]=r[t]}),o}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,rh.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,i){t||this.throwError(e,r,i)}assertArgument(t,e,r,i){t||this.throwArgumentError(e,r,i)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),ro&&this.throwError("platform missing String.prototype.normalize",rh.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ro})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,rh.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,rh.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,rh.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,rh.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){(t===Object||null==t)&&this.throwError("missing new",rh.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",rh.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||null==t)&&this.throwError("missing new",rh.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return rs||(rs=new rh("logger/5.8.0")),rs}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",rh.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),re){if(!t)return;this.globalLogger().throwError("error censorship permanent",rh.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}rr=!!t,re=!!e}static setLogLevel(t){let e=ri[t.toLowerCase()];if(null==e){rh.globalLogger().warn("invalid log level - "+t);return}rn=e}static from(t){return new rh(t)}}rh.errors=k,rh.levels=N;let ru=new rh("bytes/5.8.0");function rl(t){return!!t.toHexString}function rd(t){return t.slice||(t.slice=function(){let e=Array.prototype.slice.call(arguments);return rd(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function rc(t){return"number"==typeof t&&t==t&&t%1==0}function rf(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;
1if("string"==typeof t||!rc(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){let r=t[e];if(!rc(r)||r<0||r>=256)return!1}return!0}function rm(t,e){return"string"==typeof t&&!!t.match(/^0x[0-9A-Fa-f]*$/)&&(!e||t.length===2+2*e)}let rp="0123456789abcdef";function rg(t,e){if(e||(e={}),"number"==typeof t){ru.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=rp[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),rl(t))return t.toHexString();if(rm(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":ru.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(rf(t)){let e="0x";for(let r=0;r<t.length;r++){let i=t[r];e+=rp[(240&i)>>4]+rp[15&i]}return e}return ru.throwArgumentError("invalid hexlify value","value",t)}function ry(t,e){for("string"!=typeof t?t=rg(t):rm(t)||ru.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&ru.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}let rv="bignumber/5.8.0";var rw=r(73996),rb=r.n(rw)().BN;let rM=new rh(rv),rE={},rS=!1;class rA{constructor(t,e){t!==rE&&rM.throwError("cannot call constructor directly; use BigNumber.from",rh.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return rO(rR(this).fromTwos(t))}toTwos(t){return rO(rR(this).toTwos(t))}abs(){return"-"===this._hex[0]?rA.from(this._hex.substring(1)):this}add(t){return rO(rR(this).add(rR(t)))}sub(t){return rO(rR(this).sub(rR(t)))}div(t){return rA.from(t).isZero()&&r_("division-by-zero","div"),rO(rR(this).div(rR(t)))}mul(t){return rO(rR(this).mul(rR(t)))}mod(t){let e=rR(t);return e.isNeg()&&r_("division-by-zero","mod"),rO(rR(this).umod(e))}pow(t){let e=rR(t);return e.isNeg()&&r_("negative-power","pow"),rO(rR(this).pow(e))}and(t){let e=rR(t);return(this.isNegative()||e.isNeg())&&r_("unbound-bitwise-result","and"),rO(rR(this).and(e))}or(t){let e=rR(t);return(this.isNegative()||e.isNeg())&&r_("unbound-bitwise-result","or"),rO(rR(this).or(e))}xor(t){let e=rR(t);return(this.isNegative()||e.isNeg())&&r_("unbound-bitwise-result","xor"),rO(rR(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&r_("negative-width","mask"),rO(rR(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&r_("negative-width","shl"),rO(rR(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&r_("negative-width","shr"),rO(rR(this).shrn(t))}eq(t){return rR(this).eq(rR(t))}lt(t){return rR(this).lt(rR(t))}lte(t){return rR(this).lte(rR(t))}gt(t){return rR(this).gt(rR(t))}gte(t){return rR(this).gte(rR(t))}isNegative(){return"-"===this._hex[0]}isZero(){return rR(this).isZero()}toNumber(){try{return rR(this).toNumber()}catch(t){r_("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return rM.throwError("this platform does not support BigInt",rh.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?rS||(rS=!0,rM.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?rM.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",rh.errors.UNEXPECTED_ARGUMENT,{}):rM.throwError("BigNumber.toString does not accept parameters",rh.errors.UNEXPECTED_ARGUMENT,{})),rR(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof rA)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new rA(rE,rT(t)):t.match(/^-?[0-9]+$/)?new rA(rE,rT(new rb(t))):rM.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&r_("underflow","BigNumber.from",t),(t>=9007199254740991||t<=-9007199254740991)&&r_("overflow","BigNumber.from",t),rA.from(String(t));if("bigint"==typeof t)return rA.from(t.toString());if(rf(t))return rA.from(rg(t));if(t){if(t.toHexString){let e=t.toHexString();if("string"==typeof e)return rA.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(rm(e)||"-"===e[0]&&rm(e.substring(1))))return rA.from(e)}}return rM.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!!(t&&t._isBigNumber)}}function rT(t){if("string"!=typeof t)return rT(t.toString(16));if("-"===t[0])return("-"===(t=t.substring(1))[0]&&rM.throwArgumentError("invalid hex","value",t),"0x00"===(t=rT(t)))?t:"-"+t;
1if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function rO(t){return rA.from(rT(t))}function rR(t){let e=rA.from(t).toHexString();return"-"===e[0]?new rb("-"+e.substring(3),16):new rb(e.substring(2),16)}function r_(t,e,r){let i={fault:t,operation:e};return null!=r&&(i.value=r),rM.throwError(t,rh.errors.NUMERIC_FAULT,i)}let rN=new rh(rv),rk={},rx=rA.from(0),rL=rA.from(-1);function rP(t,e,r,i){let n={fault:e,operation:r};return void 0!==i&&(n.value=i),rN.throwError(t,rh.errors.NUMERIC_FAULT,n)}let rB="0";for(;rB.length<256;)rB+=rB;function rI(t){if("number"!=typeof t)try{t=rA.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+rB.substring(0,t):rN.throwArgumentError("invalid decimal size","decimals",t)}function rU(t,e){null==e&&(e=0);let r=rI(e),i=(t=rA.from(t)).lt(rx);i&&(t=t.mul(rL));let n=t.mod(r).toString();for(;n.length<r.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];let s=t.div(r).toString();return t=1===r.length?s:s+"."+n,i&&(t="-"+t),t}function rC(t,e){null==e&&(e=0);let r=rI(e);"string"==typeof t&&t.match(/^-?[0-9.]+$/)||rN.throwArgumentError("invalid decimal value","value",t);let i="-"===t.substring(0,1);i&&(t=t.substring(1)),"."===t&&rN.throwArgumentError("missing value","value",t);let n=t.split(".");n.length>2&&rN.throwArgumentError("too many decimal points","value",t);let s=n[0],o=n[1];for(s||(s="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>r.length-1&&rP("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length<r.length-1;)o+="0";let a=rA.from(s),h=rA.from(o),u=a.mul(r).add(h);return i&&(u=u.mul(rL)),u}class rF{constructor(t,e,r,i){t!==rk&&rN.throwError("cannot use FixedFormat constructor; use FixedFormat.from",rh.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=e,this.width=r,this.decimals=i,this.name=(e?"":"u")+"fixed"+String(r)+"x"+String(i),this._multiplier=rI(i),Object.freeze(this)}static from(t){if(t instanceof rF)return t;"number"==typeof t&&(t=`fixed128x${t}`);let e=!0,r=128,i=18;if("string"==typeof t){if("fixed"===t);else if("ufixed"===t)e=!1;else{let n=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);n||rN.throwArgumentError("invalid fixed format","format",t),e="u"!==n[1],r=parseInt(n[2]),i=parseInt(n[3])}}else if(t){let n=(e,r,i)=>null==t[e]?i:(typeof t[e]!==r&&rN.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);e=n("signed","boolean",e),r=n("width","number",r),i=n("decimals","number",i)}return r%8&&rN.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),i>80&&rN.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new rF(rk,e,r,i)}}class rq{constructor(t,e,r,i){t!==rk&&rN.throwError("cannot use FixedNumber constructor; use FixedNumber.from",rh.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=e,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&rN.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);let e=rC(this._value,this.format.decimals),r=rC(t._value,t.format.decimals);return rq.fromValue(e.add(r),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);let e=rC(this._value,this.format.decimals),r=rC(t._value,t.format.decimals);return rq.fromValue(e.sub(r),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);let e=rC(this._value,this.format.decimals),r=rC(t._value,t.format.decimals);return rq.fromValue(e.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);let e=rC(this._value,this.format.decimals),r=rC(t._value,t.format.decimals);return rq.fromValue(e.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){let t=this.toString().split(".");1===t.length&&t.push("0");let e=rq.from(t[0],this.format),r=!t[1].match(/^(0*)$/);return this.isNegative()&&r&&(e=e.subUnsafe(r$.toFormat(e.format))),e}ceiling(){let t=this.toString().split(".");1===t.length&&t.push("0");let e=rq.from(t[0],this.format),r=!t[1].match(/^(0*)$/);return!this.isNegative()&&r&&(e=e.addUnsafe(r$.toFormat(e.format))),e}round(t){null==t&&(t=0);let e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&rN.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;let r=rq.from("1"+rB.substring(0,t),this.format),i=rD.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(i).floor().divUnsafe(r)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){return null==t?this._hex:(t%8&&rN.throwArgumentError("invalid byte width","width",t),ry(rA.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8))}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return rq.fromString(this._value,t)}static fromValue(t,e,r){var i;return null!=r||null==e||null!=(i=e)&&(rA.isBigNumber(i)||"number"==typeof i&&i%1==0||"string"==typeof i&&i.match(/^-?[0-9]+$/)||rm(i)||"bigint"==typeof i||rf(i))||(r=e,e=null),null==e&&(e=0),null==r&&(r="fixed"),rq.fromString(rU(t,e),rF.from(r))}static fromString(t,e){null==e&&(e="fixed");let r=rF.from(e),i=rC(t,r.decimals);!r.signed&&i.lt(rx)&&rP("unsigned value cannot be negative","overflow","value",t);let n=null;return new rq(rk,r.signed?i.toTwos(r.width).toHexString():ry(i.toHexString(),r.width/8),rU(i,r.decimals),r)}static fromBytes(t,e){null==e&&(e="fixed");let r=rF.from(e);if(function(t,e){if(e||(e={}
1),"number"==typeof t){ru.checkSafeUint53(t,"invalid arrayify value");let e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),rd(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),rl(t)&&(t=t.toHexString()),rm(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0"+r:"right"===e.hexPad?r+="0":ru.throwArgumentError("hex data is odd-length","value",t));let i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return rd(new Uint8Array(i))}return rf(t)?rd(new Uint8Array(t)):ru.throwArgumentError("invalid arrayify value","value",t)}(t).length>r.width/8)throw Error("overflow");let i=rA.from(t);return r.signed&&(i=i.fromTwos(r.width)),new rq(rk,i.toTwos((r.signed?0:1)+r.width).toHexString(),rU(i,r.decimals),r)}static from(t,e){if("string"==typeof t)return rq.fromString(t,e);if(rf(t))return rq.fromBytes(t,e);try{return rq.fromValue(t,0,e)}catch(t){if(t.code!==rh.errors.INVALID_ARGUMENT)throw t}return rN.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!!(t&&t._isFixedNumber)}}let r$=rq.from(1),rD=rq.from("0.5"),rj=new rh("units/5.8.0"),rz=["wei","kwei","mwei","gwei","szabo","finney","ether"];function rG(t,e){if("string"!=typeof t&&rj.throwArgumentError("value must be a string","value",t),"string"==typeof e){let t=rz.indexOf(e);-1!==t&&(e=3*t)}return rC(t,null!=e?e:18)}let rH=[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],rK=[{name:"salt",type:"uint256"},{name:"maker",type:"address"},{name:"signer",type:"address"},{name:"taker",type:"address"},{name:"tokenId",type:"uint256"},{name:"makerAmount",type:"uint256"},{name:"takerAmount",type:"uint256"},{name:"expiration",type:"uint256"},{name:"nonce",type:"uint256"},{name:"feeRateBps",type:"uint256"},{name:"side",type:"uint8"},{name:"signatureType",type:"uint8"}];var rJ=r(15743);function rY(){return Math.round(Math.random()*Date.now())+""}class rW{contractAddress;chainId;signer;generateSalt;constructor(t,e,r,i=rY){this.contractAddress=t,this.chainId=e,this.signer=r,this.generateSalt=i}async buildSignedOrder(t){let e=await this.buildOrder(t),r=this.buildOrderTypedData(e),i=await this.buildOrderSignature(r);return{...e,signature:i}}async buildOrder({maker:t,taker:e,tokenId:r,makerAmount:i,takerAmount:n,side:s,feeRateBps:o,nonce:a,signer:h,expiration:u,signatureType:l}){void 0!==h&&h||(h=t);let d=await this.signer.getAddress();if(h!==d)throw Error("signer does not match");return void 0!==u&&u||(u="0"),void 0!==l&&l||(l=_.EOA),{salt:this.generateSalt(),maker:t,signer:h,taker:e,tokenId:r,makerAmount:i,takerAmount:n,expiration:u,nonce:a,feeRateBps:o,side:s,signatureType:l}}buildOrderTypedData(t){return{primaryType:"Order",types:{EIP712Domain:rH,Order:rK},domain:{name:"Polymarket CTF Exchange",version:"1",chainId:this.chainId,verifyingContract:this.contractAddress},message:{salt:t.salt,maker:t.maker,signer:t.signer,taker:t.taker,tokenId:t.tokenId,makerAmount:t.makerAmount,takerAmount:t.takerAmount,expiration:t.expiration,nonce:t.nonce,feeRateBps:t.feeRateBps,side:t.side,signatureType:t.signatureType}}}buildOrderSignature(t){return delete t.types.EIP712Domain,this.signer._signTypedData(t.domain,t.types,t.message)}buildOrderHash(t){return(0,rJ.Jv)(t)}}let rZ={exchange:"0xdFE02Eb6733538f8Ea35D585af8DE5958AD99E40",negRiskAdapter:"0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296",negRiskExchange:"0xC5d563A36AE78145C45a50134d48A1215220f80a",collateral:"0x9c4e1703476e875070ee25b56a58b008cfb8fa78",conditionalTokens:"0x69308FB512518e39F9b16112fA8d994F4e2Bf8bB"},rV={exchange:"0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E",negRiskAdapter:"0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296",negRiskExchange:"0xC5d563A36AE78145C45a50134d48A1215220f80a",collateral:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",conditionalTokens:"0x4D97DCd97eC945f40cF65F87097ACe5EA0476045"},rX=t=>{switch(t){case 137:return rV;case 80002:return rZ;default:throw Error("Invalid network")}},rQ={"0.1":{price:1,size:2,amount:3},"0.01":{price:2,size:2,amount:4},"0.001":{price:3,size:2,amount:5},"0.0001":{price:4,size:2,amount:6}},r0=async(t,e,r,i)=>new rW(e,r,t).buildSignedOrder(i),r1=(t,e,r,i)=>{let n=e2(r,i.price);if(t===M.BUY){let t=e8(e,i.size),r=t*n;return e7(r)>i.amount&&e7(r=e3(r,i.amount+4))>i.amount&&(r=e8(r,i.amount)),{side:R.BUY,rawMakerAmt:r,rawTakerAmt:t}}{let t=e8(e,i.size),r=t*n;return e7(r)>i.amount&&e7(r=e3(r,i.amount+4))>i.amount&&(r=e8(r,i.amount)),{side:R.SELL,rawMakerAmt:t,rawTakerAmt:r}}},r6=async(t,e,r,i,n)=>{let s,o,a;let{side:h,rawMakerAmt:u,rawTakerAmt:l}
1=r1(i.side,i.size,i.price,n),d=rG(u.toString(),6).toString(),c=rG(l.toString(),6).toString();return s=void 0!==i.taker&&i.taker?i.taker:"0x0000000000000000000000000000000000000000",o=void 0!==i.feeRateBps&&i.feeRateBps?i.feeRateBps.toString():"0",a=void 0!==i.nonce&&i.nonce?i.nonce.toString():"0",{maker:e,taker:s,tokenId:i.tokenID,makerAmount:d,takerAmount:c,side:h,feeRateBps:o,nonce:a,signer:t,expiration:(i.expiration||0).toString(),signatureType:r}},r2=async(t,e,r,i,n,s)=>{let o=await t.getAddress(),a=rX(e),h=await r6(o,void 0===i?o:i,r,n,rQ[s.tickSize]);return r0(t,s.negRisk?a.negRiskExchange:a.exchange,e,h)},r8=(t,e,r,i)=>{let n=e8(r,i.price);if(t===M.BUY){let t=e8(e,i.size),r=t/n;return e7(r)>i.amount&&e7(r=e3(r,i.amount+4))>i.amount&&(r=e8(r,i.amount)),{side:R.BUY,rawMakerAmt:t,rawTakerAmt:r}}{let t=e8(e,i.size),r=t*n;return e7(r)>i.amount&&e7(r=e3(r,i.amount+4))>i.amount&&(r=e8(r,i.amount)),{side:R.SELL,rawMakerAmt:t,rawTakerAmt:r}}},r3=async(t,e,r,i,n)=>{let s,o,a;let{side:h,rawMakerAmt:u,rawTakerAmt:l}=r8(i.side,i.amount,i.price||1,n),d=rG(u.toString(),6).toString(),c=rG(l.toString(),6).toString();return s=void 0!==i.taker&&i.taker?i.taker:"0x0000000000000000000000000000000000000000",o=void 0!==i.feeRateBps&&i.feeRateBps?i.feeRateBps.toString():"0",a=void 0!==i.nonce&&i.nonce?i.nonce.toString():"0",{maker:e,taker:s,tokenId:i.tokenID,makerAmount:d,takerAmount:c,side:h,feeRateBps:o,nonce:a,signer:t,expiration:"0",signatureType:r}},r7=async(t,e,r,i,n,s)=>{let o=await t.getAddress(),a=rX(e),h=await r3(o,void 0===i?o:i,r,n,rQ[s.tickSize]);return r0(t,s.negRisk?a.negRiskExchange:a.exchange,e,h)},r5=(t,e,r)=>{if(!t.length)throw Error("no match");let i=0;for(let r=t.length-1;r>=0;r--){let n=t[r];if((i+=parseFloat(n.size)*parseFloat(n.price))>=e)return parseFloat(n.price)}if(r===E.FOK)throw Error("no match");return parseFloat(t[0].price)},r4=(t,e,r)=>{if(!t.length)throw Error("no match");let i=0;for(let r=t.length-1;r>=0;r--){let n=t[r];if((i+=parseFloat(n.size))>=e)return parseFloat(n.price)}if(r===E.FOK)throw Error("no match");return parseFloat(t[0].price)};class r9{signer;chainId;signatureType;funderAddress;getSigner;constructor(t,e,r,i,n){this.signer=t,this.chainId=e,this.signatureType=void 0===r?_.EOA:r,this.funderAddress=i,this.getSigner=n}async buildOrder(t,e){return r2(await this.resolveSigner(),this.chainId,this.signatureType,this.funderAddress,t,e)}async buildMarketOrder(t,e){return r7(await this.resolveSigner(),this.chainId,this.signatureType,this.funderAddress,t,e)}
1async resolveSigner(){if(this.getSigner){let t=await this.getSigner();if(!t)throw Error("getSigner() function returned undefined or null");return t}return this.signer}}let it="MA==",ie="LTE=";class ir{deps;constructor(t){this.deps=t}async createRfqRequest(t,e){let r,i,n,s;this.ensureL2Auth();let{tokenID:o,price:a,side:h,size:u}=t,l=rQ[await this.deps.resolveTickSize(o,e?.tickSize)],d=e2(a,l.price).toFixed(l.price),c=e8(u,l.size).toFixed(l.size),f=parseFloat(c),m=parseFloat(d);h===M.BUY?(r=rG(c,6).toString(),i=rG((f*m).toFixed(l.amount),6).toString(),n=o,s="0"):(r=rG((f*m).toFixed(l.amount),6).toString(),i=rG(c,6).toString(),n="0",s=o);let p={assetIn:n,assetOut:s,amountIn:r,amountOut:i,userType:this.deps.userType},g="/rfq/request",y={method:e$,requestPath:g,body:JSON.stringify(p)},v=await U(this.deps.signer,this.deps.creds,y,this.deps.useServerTime?await this.deps.getServerTime():void 0);return this.deps.post(`${this.deps.host}${g}`,{headers:v,data:p})}async cancelRfqRequest(t){this.ensureL2Auth();let e="/rfq/request",r={method:eD,requestPath:e,body:JSON.stringify(t)},i=await U(this.deps.signer,this.deps.creds,r,this.deps.useServerTime?await this.deps.getServerTime():void 0);return this.deps.del(`${this.deps.host}${e}`,{headers:i,data:t})}async getRfqRequests(t){this.ensureL2Auth();let e="/rfq/data/requests",r=await U(this.deps.signer,this.deps.creds,{method:"GET",requestPath:e},this.deps.useServerTime?await this.deps.getServerTime():void 0);return this.deps.get(`${this.deps.host}${e}`,{headers:r,params:eV(t)})}async createRfqQuote(t,e){let r,i,n,s;this.ensureL2Auth();let{requestId:o,tokenID:a,price:h,side:u,size:l}=t,d=rQ[await this.deps.resolveTickSize(a,e?.tickSize)],c=e2(h,d.price).toFixed(d.price),f=e8(l,d.size).toFixed(d.size),m=parseFloat(f),p=parseFloat(c);u===M.SELL?(r=rG((m*p).toFixed(d.amount),6).toString(),i=rG(f,6).toString(),n="0",s=a):(r=rG(f,6).toString(),i=rG((m*p).toFixed(d.amount),6).toString(),n=a,s="0");let g="/rfq/quote",y={requestId:o,assetIn:n,assetOut:s,amountIn:r,amountOut:i,userType:this.deps.userType},v={method:e$,requestPath:g,body:JSON.stringify(y)},w=await U(this.deps.signer,this.deps.creds,v,this.deps.useServerTime?await this.deps.getServerTime():void 0);return this.deps.post(`${this.deps.host}${g}`,{headers:w,data:y})}async getRfqQuotes(t){this.ensureL2Auth();let e="/rfq/data/quotes",r=await U(this.deps.signer,this.deps.creds,{method:"GET",requestPath:e},this.deps.useServerTime?await this.deps.getServerTime():void 0);return this.deps.get(`${this.deps.host}${e}`,{headers:r,params:eZ(t)})}async getRfqBestQuote(t){this.ensureL2Auth();let e="/rfq/data/best-quote",r=await U(this.deps.signer,this.deps.creds,{method:"GET",requestPath:e},this.deps.useServerTime?await this.deps.getServerTime():void 0);return this.deps.get(`${this.deps.host}${e}`,{headers:r,params:t})}async cancelRfqQuote(t){this.ensureL2Auth();let e="/rfq/quote",r={method:eD,requestPath:e,body:JSON.stringify(t)},i=await U(this.deps.signer,this.deps.creds,r,this.deps.useServerTime?await this.deps.getServerTime():void 0);return this.deps.del(`${this.deps.host}${e}`,{headers:i,data:t})}async rfqConfig(){this.ensureL2Auth();let t="/rfq/config",e=await U(this.deps.signer,this.deps.creds,{method:"GET",requestPath:t},this.deps.useServerTime?await this.deps.getServerTime():void 0);return this.deps.get(`${this.deps.host}${t}`,{headers:e})}async acceptRfqQuote(t){this.ensureL2Auth();let e=await this.getRfqQuotes({quoteIds:[t.quoteId]});if("error"in e){let t="string"==typeof e.error?e.error:JSON.stringify(e.error);throw Error(`Error fetching RFQ quote: ${t}`)}if(!e?.data||0===e.data.length)throw Error("RFQ quote not found");let r=e.data[0],i=this.getRequestOrderCreationPayload(r),n=i.side,s=i.size,o=i.token,a=await this.deps.createOrder({tokenID:o,price:i.price,size:parseFloat(s),side:n,expiration:t.expiration});if(!a)throw Error("Error creating order");let h={requestId:t.requestId,quoteId:t.quoteId,owner:this.deps.creds.key,...a,expiration:parseInt(a.expiration),side:n,salt:parseInt(a.salt.toString())},u="/rfq/request/accept",l={method:e$,requestPath:u,body:JSON.stringify(h)},d=await U(this.deps.signer,this.deps.creds,l,this.deps.useServerTime?await this.deps.getServerTime():void 0);return this.deps.post(`${this.deps.host}${u}`,{headers:d,data:h})}async approveRfqOrder(t){this.ensureL2Auth();let e=await this.getRfqQuotes({quoteIds:[t.quoteId]});if("error"in e){let t="string"==typeof e.error?e.error:JSON.stringify(e.error);throw Error(`Error fetching RFQ quote: ${t}`)}if(!e?.data||0===e.data.length)throw Error("RFQ quote not found");let r=e.data[0],i="BUY"===r.side?M.BUY:M.SELL,n="BUY"===r.side?r.sizeIn:r.sizeOut,s=await this.deps.createOrder({tokenID:r.token,price:r.price,size:parseFloat(n),side:i,expiration:t.expiration});if(!s)throw Error("Error creating order");let o={requestId:t.requestId,quoteId:t.quoteId,owner:this.deps.creds.key,...s,expiration:parseInt(s.expiration),side:i,salt:parseInt(s.salt.toString())},a="/rfq/quote/approve",h={method:e$,requestPath:a,body:JSON.stringify(o)},u=await U(this.deps.signer,this.deps.creds,h,this.deps.useServerTime?await this.deps.getServerTime():void 0);return this.deps.post(`${this.deps.host}${a}`,{headers:u,data:o})}ensureL2Auth(){if(void 0===this.deps.signer)throw eX;if(void 0===this.deps.creds)throw eQ}getRequestOrderCreationPayload(t){let e,r,i;let n=t.side;switch(t.matchType){case O.COMPLEMENTARY:return e="BUY"===n?M.SELL:M.BUY,r=t.token,i=e==M.BUY?t.sizeOut:t.sizeIn,{token:r,side:e,size:i,price:t.price};case O.MINT:case O.MERGE:return e="BUY"===n?M.BUY:M.SELL,r=t.complement,i=e==M.BUY?t.sizeIn:t.sizeOut,{token:r,side:e,size:i,price:1-t.price};default:throw Error("invalid match type")}}}class ii{host;chainId;signer;creds;orderBuilder;tickSizes;negRisk;feeRates;geoBlockToken;useServerTime;builderConfig;rfq;constructor(t,e,r,i,n,s,o,a,h,u){this.host=t.endsWith("/")?t.slice(0,-1):t,this.chainId=e,void 0!==r&&(this.signer=r),void 0!==i&&(this.creds=i),this.orderBuilder=new r9(r,e,n,s,u),this.tickSizes={},this.negRisk={},this.feeRates={},this.geoBlockToken=o,this.useServerTime=a,void 0!==h&&(this.builderConfig=h);let l={host:this.host,signer:this.signer,creds:this.creds,useServerTime:this.useServerTime,geoBlockToken:this.geoBlockToken,userType:this.orderBuilder.signatureType,getServerTime:this.getServerTime.bind(this),getTickSize:this.getTickSize.bind(this),resolveTickSize:this._resolveTickSize.bind(this),createOrder:this.createOrder.bind(this),get:this.get.bind(this),post:this.post.bind(this),put:this.put.bind(this),del:this.del.bind(this)};this.rfq=new ir(l)}async getOk(){return this.get(`${this.host}/`)}async getServerTime(){return this.get(`${this.host}/time`)}async getSamplingSimplifiedMarkets(t=it){return this.get(`${this.host}/sampling-simplified-markets`,{params:{next_cursor:t}})}async getSamplingMarkets(t=it){return this.get(`${this.host}/sampling-markets`,{params:{next_cursor:t}})}async getSimplifiedMarkets(t=it){return this.get(`${this.host}/simplified-markets`,{params:{next_cursor:t}})}async getMarkets(t=it){return this.get(`${this.host}/markets`,{params:{next_cursor:t}})}async getMarket(t){return this.get(`${this.host}/markets/${t}`)}async getOrderBook(t){return this.get(`${this.host}/book`,{params:{token_id:t}})}async getOrderBooks(t){return this.post(`${this.host}/books`,{data:t})}async getTickSize(t){if(t in this.tickSizes)return this.tickSizes[t];let e=await this.get(`${this.host}/tick-size`,{params:{token_id:t}});return this.tickSizes[t]=e.minimum_tick_size.toString(),this.tickSizes[t]}async getNegRisk(t){if(t in this.negRisk)return this.negRisk[t];let e=await this.get(`${this.host}/neg-risk`,{params:{token_id:t}});return this.negRisk[t]=e.neg_risk,this.negRisk[t]}async getFeeRateBps(t){if(t in this.feeRates)return this.feeRates[t];let e=await this.get(`${this.host}/fee-rate`,{params:{token_id:t}});return this.feeRates[t]=e.base_fee,this.feeRates[t]}getOrderBookHash(t){return e5(t)}async getMidpoint(t){return this.get(`${this.host}/midpoint`,{params:{token_id:t}})}async getMidpoints(t){return this.post(`${this.host}/midpoints`,{data:t})}async getPrice(t,e){return this.get(`${this.host}/price`,{params:{token_id:t,side:e}})}async getPrices(t){return this.post(`${this.host}/prices`,{data:t})}async getSpread(t){return this.get(`${this.host}/spread`,{params:{token_id:t}})}async getSpreads(t){return this.post(`${this.host}/spreads`,{data:t})}async getLastTradePrice(t){return this.get(`${this.host}/last-trade-price`,{params:{token_id:t}})}async getLastTradesPrices(t){return this.post(`${this.host}/last-trades-prices`,{data:t})}async getPricesHistory(t){return this.get(`${this.host}/prices-history`,{params:t})}async createApiKey(t){this.canL1Auth();let e=`${this.host}/auth/api-key`,r=await I(this.signer,this.chainId,t,this.useServerTime?await this.get
1ServerTime():void 0);return await this.post(e,{headers:r}).then(t=>({key:t.apiKey,secret:t.secret,passphrase:t.passphrase}))}async deriveApiKey(t){this.canL1Auth();let e=`${this.host}/auth/derive-api-key`,r=await I(this.signer,this.chainId,t,this.useServerTime?await this.getServerTime():void 0);return await this.get(e,{headers:r}).then(t=>({key:t.apiKey,secret:t.secret,passphrase:t.passphrase}))}async createOrDeriveApiKey(t){return this.createApiKey(t).then(e=>e.key?e:this.deriveApiKey(t))}async getApiKeys(){this.canL2Auth();let t="/auth/api-keys",e=await U(this.signer,this.creds,{method:"GET",requestPath:t},this.useServerTime?await this.getServerTime():void 0);return this.get(`${this.host}${t}`,{headers:e})}async getClosedOnlyMode(){this.canL2Auth();let t="/auth/ban-status/closed-only",e=await U(this.signer,this.creds,{method:"GET",requestPath:t},this.useServerTime?await this.getServerTime():void 0);return this.get(`${this.host}${t}`,{headers:e})}async deleteApiKey(){this.canL2Auth();let t="/auth/api-key",e=await U(this.signer,this.creds,{method:eD,requestPath:t}
1,this.useServerTime?await this.getServerTime():void 0);return this.del(`${this.host}${t}`,{headers:e})}async createReadonlyApiKey(){this.canL2Auth();let t="/auth/readonly-api-key",e=await U(this.signer,this.creds,{method:e$,requestPath:t},this.useServerTime?await this.getServerTime():void 0);return this.post(`${this.host}${t}`,{headers:e})}async getReadonlyApiKeys(){this.canL2Auth();let t="/auth/readonly-api-keys",e=await U(this.signer,this.creds,{method:"GET",requestPath:t},this.useServerTime?await this.getServerTime():void 0);return this.get(`${this.host}${t}`,{headers:e})}async deleteReadonlyApiKey(t){this.canL2Auth();let e="/auth/readonly-api-key",r={key:t},i={method:eD,requestPath:e,body:JSON.stringify(r)},n=await U(this.signer,this.creds,i,this.useServerTime?await this.getServerTime():void 0);return this.del(`${this.host}${e}`,{headers:n,data:r})}async validateReadonlyApiKey(t,e){return this.get(`${this.host}/auth/validate-readonly-api-key`,{params:{address:t,key:e}})}async getOrder(t){this.canL2Auth();let e=`/data/order/${t}`,r=await U(this.signer,this.creds,{method:"GET",requestPath:e}
1,this.useServerTime?await this.getServerTime():void 0);return this.get(`${this.host}${e}`,{headers:r})}async getTrades(t,e=!1,r){this.canL2Auth();let i=await U(this.signer,this.creds,{method:"GET",requestPath:rt},this.useServerTime?await this.getServerTime():void 0),n=[];for(r=r||it;r!=ie&&(r===it||!e);){let e={...t,next_cursor:r},s=await this.get(`${this.host}${rt}`,{headers:i,params:e});r=s.next_cursor,n=[...n,...s.data]}return n}async getTradesPaginated(t,e){this.canL2Auth();let r=await U(this.signer,this.creds,{method:"GET",requestPath:rt},this.useServerTime?await this.getServerTime():void 0);e=e||it;let i={...t,next_cursor:e},{data:n,...s}=await this.get(`${this.host}${rt}`,{headers:r,params:i});return{trades:Array.isArray(n)?[...n]:[],...s}}async getBuilderTrades(t,e){this.mustBuilderAuth();let r="/builder/trades",i=await this._getBuilderHeaders("GET",r);if(void 0==i)throw e1;e=e||it;let n={...t,next_cursor:e},{data:s,...o}=await this.get(`${this.host}${r}`,{headers:i,params:n});return{trades:Array.isArray(s)?[...s]:[],...o}}async getNotifications(){this.canL2Auth();let t="/notifications",e=await U(this.signer,this.creds,{method:"GET",requestPath:t}
1,this.useServerTime?await this.getServerTime():void 0);return this.get(`${this.host}${t}`,{headers:e,params:{signature_type:this.orderBuilder.signatureType}})}async dropNotifications(t){this.canL2Auth();let e="/notifications",r=await U(this.signer,this.creds,{method:eD,requestPath:e},this.useServerTime?await this.getServerTime():void 0);return this.del(`${this.host}${e}`,{headers:r,params:eW(t)})}async getBalanceAllowance(t){this.canL2Auth();let e="/balance-allowance",r=await U(this.signer,this.creds,{method:"GET",requestPath:e},this.useServerTime?await this.getServerTime():void 0),i={...t,signature_type:this.orderBuilder.signatureType};return this.get(`${this.host}${e}`,{headers:r,params:i})}async updateBalanceAllowance(t){this.canL2Auth();let e="/balance-allowance/update",r=await U(this.signer,this.creds,{method:"GET",requestPath:e},this.useServerTime?await this.getServerTime():void 0),i={...t,signature_type:this.orderBuilder.signatureType};return this.get(`${this.host}${e}`,{headers:r,params:i})}async createOrder(t,e){this.canL1Auth();let{tokenID:r}=t,i=await this._resolveTickSize(r,e?.tickSize),n=await this._resolveFeeRateBps(r,t.feeRateBps);if(t.feeRateBps=n,!e9(t.price,i))throw Error(`invalid price (${t.price}), min: ${parseFloat(i)} - max: ${1-parseFloat(i)}`);let s=e?.negRisk??await this.getNegRisk(r);return this.orderBuilder.buildOrder(t,{tickSize:i,negRisk:s})}async createMarketOrder(t,e){this.canL1Auth();let{tokenID:r}=t,i=await this._resolveTickSize(r,e?.tickSize),n=await this._resolveFeeRateBps(r,t.feeRateBps);if(t.feeRateBps=n,t.price||(t.price=await this.calculateMarketPrice(r,t.side,t.amount,t.orderType)),!e9(t.price,i))throw Error(`invalid price (${t.price}), min: ${parseFloat(i)} - max: ${1-parseFloat(i)}`);let s=e?.negRisk??await this.getNegRisk(r);return this.orderBuilder.buildMarketOrder(t,{tickSize:i,negRisk:s})}async createAndPostOrder(t,e,r=E.GTC,i=!1){let n=await this.createOrder(t,e);return this.postOrder(n,r,i)}async createAndPostMarketOrder(t,e,r=E.FOK,i=!1){let n=await this.createMarketOrder(t,e);return this.postOrder(n,r,i)}async getOpenOrders(t,e=!1,r){this.canL2Auth();let i="/data/orders",n=await U(this.signer,this.creds,{method:"GET",requestPath:i}
1,this.useServerTime?await this.getServerTime():void 0),s=[];for(r=r||it;r!=ie&&(r===it||!e);){let e={...t,next_cursor:r},o=await this.get(`${this.host}${i}`,{headers:n,params:e});r=o.next_cursor,s=[...s,...o.data]}return s}async postOrder(t,e=E.GTC,r=!1){this.canL2Auth();let i="/order",n=e6(t,this.creds?.key||"",e,r),s={method:e$,requestPath:i,body:JSON.stringify(n)},o=await U(this.signer,this.creds,s,this.useServerTime?await this.getServerTime():void 0);if(this.canBuilderAuth()){let t=await this._generateBuilderHeaders(o,s);if(void 0!==t)return this.post(`${this.host}${i}`,{headers:t,data:n})}return this.post(`${this.host}${i}`,{headers:o,data:n})}async postOrders(t,e=!1){this.canL2Auth();let r="/orders",i=[];for(let{order:r,orderType:n}of t){let t=e6(r,this.creds?.key||"",n,e);i.push(t)}let n={method:e$,requestPath:r,body:JSON.stringify(i)},s=await U(this.signer,this.creds,n,this.useServerTime?await this.getServerTime():void 0);if(this.canBuilderAuth()){let t=await this._generateBuilderHeaders(s,n);if(void 0!==t)return this.post(`${this.host}${r}`,{headers:t,data:i})}return this.post(`${this.host}${r}`,{headers:s,data:i})}async cancelOrder(t){this.canL2Auth();let e="/order",r={method:eD,requestPath:e,body:JSON.stringify(t)},i=await U(this.signer,this.creds,r,this.useServerTime?await this.get
1ServerTime():void 0);return this.del(`${this.host}${e}`,{headers:i,data:t})}async cancelOrders(t){this.canL2Auth();let e="/orders",r={method:eD,requestPath:e,body:JSON.stringify(t)},i=await U(this.signer,this.creds,r,this.useServerTime?await this.getServerTime():void 0);return this.del(`${this.host}${e}`,{headers:i,data:t})}async cancelAll(){this.canL2Auth();let t="/cancel-all",e=await U(this.signer,this.creds,{method:eD,requestPath:t},this.useServerTime?await this.getServerTime():void 0);return this.del(`${this.host}${t}`,{headers:e})}async cancelMarketOrders(t){this.canL2Auth();let e="/cancel-market-orders",r={method:eD,requestPath:e,body:JSON.stringify(t)},i=await U(this.signer,this.creds,r,this.useServerTime?await this.getServerTime():void 0);return this.del(`${this.host}${e}`,{headers:i,data:t})}async isOrderScoring(t){this.canL2Auth();let e="/order-scoring",r=await U(this.signer,this.creds,{method:"GET",requestPath:e},this.useServerTime?await this.getServerTime():void 0);return this.get(`${this.host}${e}`,{headers:r,params:t})}async areOrdersScoring(t){this.canL2Auth();let e="/orders-scoring",r=JSON.stringify(t?.orderIds),i=await U(this.signer,this.creds,{method:e$,requestPath:e,body:r}
1,this.useServerTime?await this.getServerTime():void 0);return this.post(`${this.host}${e}`,{headers:i,data:r})}async getEarningsForUserForDay(t){this.canL2Auth();let e="/rewards/user",r=await U(this.signer,this.creds,{method:"GET",requestPath:e},this.useServerTime?await this.getServerTime():void 0),i=[],n=it;for(;n!=ie;){let s={date:t,signature_type:this.orderBuilder.signatureType,next_cursor:n},o=await this.get(`${this.host}${e}`,{headers:r,params:s});n=o.next_cursor,i=[...i,...o.data]}return i}async getTotalEarningsForUserForDay(t){this.canL2Auth();let e="/rewards/user/total",r=await U(this.signer,this.creds,{method:"GET",requestPath:e},this.useServerTime?await this.getServerTime():void 0),i={date:t,signature_type:this.orderBuilder.signatureType};return await this.get(`${this.host}${e}`,{headers:r,params:i})}async getUserEarningsAndMarketsConfig(t,e="",r="",i=!1){this.canL2Auth();let n="/rewards/user/markets",s=await U(this.signer,this.creds,{method:"GET",requestPath:n},this.useServerTime?await this.getServerTime():void 0),o=[],a=it;for(;a!=ie;){let h={date:t,signature_type:this.orderBuilder.signatureType,next_cursor:a,order_by:e,position:r,no_competition:i},u=await this.get(`${this.host}${n}`,{headers:s,params:h});a=u.next_cursor,o=[...o,...u.data]}return o}async getRewardPercentages(){this.canL2Auth();let t="/rewards/user/percentages",e=await U(this.signer,this.creds,{method:"GET",requestPath:t}
1,this.useServerTime?await this.getServerTime():void 0),r={signature_type:this.orderBuilder.signatureType};return this.get(`${this.host}${t}`,{headers:e,params:r})}async getCurrentRewards(){let t=[],e=it;for(;e!=ie;){let r=await this.get(`${this.host}/rewards/markets/current`,{params:{next_cursor:e}});e=r.next_cursor,t=[...t,...r.data]}return t}async getRawRewardsForMarket(t){let e=[],r=it;for(;r!=ie;){let i=await this.get(`${this.host}/rewards/markets/${t}`,{params:{next_cursor:r}});r=i.next_cursor,e=[...e,...i.data]}return e}async getMarketTradesEvents(t){return this.get(`${this.host}/live-activity/events/${t}`)}async calculateMarketPrice(t,e,r,i=E.FOK){let n=await this.getOrderBook(t);if(!n)throw Error("no orderbook");if(e===M.BUY){if(!n.asks)throw Error("no match");return r5(n.asks,r,i)}if(!n.bids)throw Error("no match");return r4(n.bids,r,i)}async createBuilderApiKey(){this.canL2Auth();let t="/auth/builder-api-key",e=await U(this.signer,this.creds,{method:e$,requestPath:t},this.useServerTime?await this.getServerTime():void 0);return this.post(`${this.host}${t}`,{headers:e})}async getBuilderApiKeys(){this.canL2Auth();let t="/auth/builder-api-key",e=await U(this.signer,this.creds,{method:"GET",requestPath:t}
1,this.useServerTime?await this.getServerTime():void 0);return this.get(`${this.host}${t}`,{headers:e})}async revokeBuilderApiKey(){this.mustBuilderAuth();let t="/auth/builder-api-key",e=await this._getBuilderHeaders(eD,t);if(void 0==e)throw e1;return this.del(`${this.host}${t}`,{headers:e})}async _resolveTickSize(t,e){let r=await this.getTickSize(t);if(e){if(e4(e,r))throw Error(`invalid tick size (${e}), minimum for the market is ${r}`)}else e=r;return e}async get(t,e){return eH(t,{...e,params:{...e?.params,geo_block_token:this.geoBlockToken}})}async post(t,e){return eG(t,{...e,params:{...e?.params,geo_block_token:this.geoBlockToken}})}async put(t,e){return eJ(t,{...e,params:{...e?.params,geo_block_token:this.geoBlockToken}})}async del(t,e){return eK(t,{...e,params:{...e?.params,geo_block_token:this.geoBlockToken}})}canL1Auth(){if(void 0===this.signer)throw eX}canL2Auth(){if(void 0===this.signer)throw eX;if(void 0===this.creds)throw eQ}mustBuilderAuth(){if(!this.canBuilderAuth())throw e0}canBuilderAuth(){return void 0!=this.builderConfig&&this.builderConfig.isValid()}async _resolveFeeRateBps(t,e){let r=await this.getFeeRateBps(t);if(r>0&&void 0!=e&&e!=r)throw Error(`invalid user provided fee rate: ${e}, fee rate for the market must be ${r}`);return r}async _generateBuilderHeaders(t,e){if(void 0!==this.builderConfig){let r=await this._getBuilderHeaders(e.method,e.requestPath,e.body);if(void 0!=r)return C(t,r)}}async _getBuilderHeaders(t,e,r){return this.builderConfig.generateBuilderHeaders(t,e,r)}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.