wowok 1.6.88 → 1.6.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +28 -1
- package/dist/resource.d.ts +2 -1
- package/dist/resource.d.ts.map +1 -1
- package/dist/resource.js +1 -0
- package/dist/resource.js.map +1 -1
- package/dist/utils.js +3 -3
- package/dist/utils.js.map +1 -1
- package/package.json +3 -5
- package/src/resource.ts +2 -1
- package/src/utils.ts +3 -3
- package/tsconfig.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1,28 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var s in r)("object"==typeof exports?exports:e)[s]=r[s]}}(this,(()=>(()=>{var e={281:()=>{},343:(e,t)=>{"use strict";t.I=void 0;const r="qpzry9x8gf2tvdw0s3jn54khce6mua7l",s={};for(let e=0;e<32;e++){const t=r.charAt(e);s[t]=e}function i(e){const t=e>>25;return(33554431&e)<<5^996825010&-(1&t)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function n(e){let t=1;for(let r=0;r<e.length;++r){const s=e.charCodeAt(r);if(s<33||s>126)return"Invalid prefix ("+e+")";t=i(t)^s>>5}t=i(t);for(let r=0;r<e.length;++r){const s=e.charCodeAt(r);t=i(t)^31&s}return t}function a(e,t,r,s){let i=0,n=0;const a=(1<<r)-1,o=[];for(let s=0;s<e.length;++s)for(i=i<<t|e[s],n+=t;n>=r;)n-=r,o.push(i>>n&a);if(s)n>0&&o.push(i<<r-n&a);else{if(n>=t)return"Excess padding";if(i<<r-n&a)return"Non-zero padding"}return o}function o(e){return a(e,8,5,!0)}function u(e){const t=a(e,5,8,!1);if(Array.isArray(t))return t}function c(e){const t=a(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function d(e){let t;function a(e,r){if(r=r||90,e.length<8)return e+" too short";if(e.length>r)return"Exceeds length limit";const a=e.toLowerCase(),o=e.toUpperCase();if(e!==a&&e!==o)return"Mixed-case string "+e;const u=(e=a).lastIndexOf("1");if(-1===u)return"No separator character for "+e;if(0===u)return"Missing prefix for "+e;const c=e.slice(0,u),d=e.slice(u+1);if(d.length<6)return"Data too short";let h=n(c);if("string"==typeof h)return h;const p=[];for(let e=0;e<d.length;++e){const t=d.charAt(e),r=s[t];if(void 0===r)return"Unknown character "+t;h=i(h)^r,e+6>=d.length||p.push(r)}return h!==t?"Invalid checksum for "+e:{prefix:c,words:p}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const r=a(e,t);if("object"==typeof r)return r},decode:function(e,t){const r=a(e,t);if("object"==typeof r)return r;throw new Error(r)},encode:function(e,s,a){if(a=a||90,e.length+7+s.length>a)throw new TypeError("Exceeds length limit");let o=n(e=e.toLowerCase());if("string"==typeof o)throw new Error(o);let u=e+"1";for(let e=0;e<s.length;++e){const t=s[e];if(t>>5)throw new Error("Non 5-bit word");o=i(o)^t,u+=r.charAt(t)}for(let e=0;e<6;++e)o=i(o);o^=t;for(let e=0;e<6;++e)u+=r.charAt(o>>5*(5-e)&31);return u},toWords:o,fromWordsUnsafe:u,fromWords:c}}t.I=d("bech32"),d("bech32m")},364:e=>{"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var s=0;s<e.length;s++){var i=e.charAt(s),n=i.charCodeAt(0);if(255!==t[n])throw new TypeError(i+" is ambiguous");t[n]=s}var a=e.length,o=e.charAt(0),u=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function d(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var r=0,s=0,i=0;e[r]===o;)s++,r++;for(var n=(e.length-r)*u+1>>>0,c=new Uint8Array(n);e[r];){var d=t[e.charCodeAt(r)];if(255===d)return;for(var h=0,p=n-1;(0!==d||h<i)&&-1!==p;p--,h++)d+=a*c[p]>>>0,c[p]=d%256>>>0,d=d/256>>>0;if(0!==d)throw new Error("Non-zero carry");i=h,r++}for(var l=n-i;l!==n&&0===c[l];)l++;for(var m=new Uint8Array(s+(n-l)),_=s;l!==n;)m[_++]=c[l++];return m}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,s=0,i=0,n=t.length;i!==n&&0===t[i];)i++,r++;for(var u=(n-i)*c+1>>>0,d=new Uint8Array(u);i!==n;){for(var h=t[i],p=0,l=u-1;(0!==h||p<s)&&-1!==l;l--,p++)h+=256*d[l]>>>0,d[l]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");s=p,i++}for(var m=u-s;m!==u&&0===d[m];)m++;for(var _=o.repeat(r);m<u;++m)_+=e.charAt(d[m]);return _},decodeUnsafe:d,decode:function(e){var t=d(e);if(t)return t;throw new Error("Non-base"+a+" character")}}}},763:(e,t,r)=>{const s=r(364);e.exports=s("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},947:(e,t,r)=>{!function(e){"use strict";var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;t++)r[t]=e[t];return r},s=function(){throw new Error("no PRNG")},i=new Uint8Array(16),n=new Uint8Array(32);n[0]=9;var a=t(),o=t([1]),u=t([56129,1]),c=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),h=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),p=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),l=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function m(e,t,r,s){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=s>>24&255,e[t+5]=s>>16&255,e[t+6]=s>>8&255,e[t+7]=255&s}function _(e,t,r,s,i){var n,a=0;for(n=0;n<i;n++)a|=e[t+n]^r[s+n];return(1&a-1>>>8)-1}function b(e,t,r,s){return _(e,t,r,s,16)}function g(e,t,r,s){return _(e,t,r,s,32)}function y(e,t,r,s){!function(e,t,r,s){for(var i,n=255&s[0]|(255&s[1])<<8|(255&s[2])<<16|(255&s[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,u=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,c=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,d=255&s[4]|(255&s[5])<<8|(255&s[6])<<16|(255&s[7])<<24,h=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,p=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,m=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,_=255&s[8]|(255&s[9])<<8|(255&s[10])<<16|(255&s[11])<<24,b=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,f=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,T=255&s[12]|(255&s[13])<<8|(255&s[14])<<16|(255&s[15])<<24,E=n,v=a,x=o,O=u,w=c,B=d,I=h,C=p,P=l,S=m,A=_,j=b,k=g,U=y,Y=f,D=T,R=0;R<20;R+=2)E^=(i=(k^=(i=(P^=(i=(w^=(i=E+k|0)<<7|i>>>25)+E|0)<<9|i>>>23)+w|0)<<13|i>>>19)+P|0)<<18|i>>>14,B^=(i=(v^=(i=(U^=(i=(S^=(i=B+v|0)<<7|i>>>25)+B|0)<<9|i>>>23)+S|0)<<13|i>>>19)+U|0)<<18|i>>>14,A^=(i=(I^=(i=(x^=(i=(Y^=(i=A+I|0)<<7|i>>>25)+A|0)<<9|i>>>23)+Y|0)<<13|i>>>19)+x|0)<<18|i>>>14,D^=(i=(j^=(i=(C^=(i=(O^=(i=D+j|0)<<7|i>>>25)+D|0)<<9|i>>>23)+O|0)<<13|i>>>19)+C|0)<<18|i>>>14,E^=(i=(O^=(i=(x^=(i=(v^=(i=E+O|0)<<7|i>>>25)+E|0)<<9|i>>>23)+v|0)<<13|i>>>19)+x|0)<<18|i>>>14,B^=(i=(w^=(i=(C^=(i=(I^=(i=B+w|0)<<7|i>>>25)+B|0)<<9|i>>>23)+I|0)<<13|i>>>19)+C|0)<<18|i>>>14,A^=(i=(S^=(i=(P^=(i=(j^=(i=A+S|0)<<7|i>>>25)+A|0)<<9|i>>>23)+j|0)<<13|i>>>19)+P|0)<<18|i>>>14,D^=(i=(Y^=(i=(U^=(i=(k^=(i=D+Y|0)<<7|i>>>25)+D|0)<<9|i>>>23)+k|0)<<13|i>>>19)+U|0)<<18|i>>>14;E=E+n|0,v=v+a|0,x=x+o|0,O=O+u|0,w=w+c|0,B=B+d|0,I=I+h|0,C=C+p|0,P=P+l|0,S=S+m|0,A=A+_|0,j=j+b|0,k=k+g|0,U=U+y|0,Y=Y+f|0,D=D+T|0,e[0]=E>>>0&255,e[1]=E>>>8&255,e[2]=E>>>16&255,e[3]=E>>>24&255,e[4]=v>>>0&255,e[5]=v>>>8&255,e[6]=v>>>16&255,e[7]=v>>>24&255,e[8]=x>>>0&255,e[9]=x>>>8&255,e[10]=x>>>16&255,e[11]=x>>>24&255,e[12]=O>>>0&255,e[13]=O>>>8&255,e[14]=O>>>16&255,e[15]=O>>>24&255,e[16]=w>>>0&255,e[17]=w>>>8&255,e[18]=w>>>16&255,e[19]=w>>>24&255,e[20]=B>>>0&255,e[21]=B>>>8&255,e[22]=B>>>16&255,e[23]=B>>>24&255,e[24]=I>>>0&255,e[25]=I>>>8&255,e[26]=I>>>16&255,e[27]=I>>>24&255,e[28]=C>>>0&255,e[29]=C>>>8&255,e[30]=C>>>16&255,e[31]=C>>>24&255,e[32]=P>>>0&255,e[33]=P>>>8&255,e[34]=P>>>16&255,e[35]=P>>>24&255,e[36]=S>>>0&255,e[37]=S>>>8&255,e[38]=S>>>16&255,e[39]=S>>>24&255,e[40]=A>>>0&255,e[41]=A>>>8&255,e[42]=A>>>16&255,e[43]=A>>>24&255,e[44]=j>>>0&255,e[45]=j>>>8&255,e[46]=j>>>16&255,e[47]=j>>>24&255,e[48]=k>>>0&255,e[49]=k>>>8&255,e[50]=k>>>16&255,e[51]=k>>>24&255,e[52]=U>>>0&255,e[53]=U>>>8&255,e[54]=U>>>16&255,e[55]=U>>>24&255,e[56]=Y>>>0&255,e[57]=Y>>>8&255,e[58]=Y>>>16&255,e[59]=Y>>>24&255,e[60]=D>>>0&255,e[61]=D>>>8&255,e[62]=D>>>16&255,e[63]=D>>>24&255}(e,t,r,s)}function f(e,t,r,s){!function(e,t,r,s){for(var i,n=255&s[0]|(255&s[1])<<8|(255&s[2])<<16|(255&s[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,o=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,u=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,c=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,d=255&s[4]|(255&s[5])<<8|(255&s[6])<<16|(255&s[7])<<24,h=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,p=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,m=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,_=255&s[8]|(255&s[9])<<8|(255&s[10])<<16|(255&s[11])<<24,b=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,f=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,T=255&s[12]|(255&s[13])<<8|(255&s[14])<<16|(255&s[15])<<24,E=0;E<20;E+=2)n^=(i=(g^=(i=(l^=(i=(c^=(i=n+g|0)<<7|i>>>25)+n|0)<<9|i>>>23)+c|0)<<13|i>>>19)+l|0)<<18|i>>>14,d^=(i=(a^=(i=(y^=(i=(m^=(i=d+a|0)<<7|i>>>25)+d|0)<<9|i>>>23)+m|0)<<13|i>>>19)+y|0)<<18|i>>>14,_^=(i=(h^=(i=(o^=(i=(f^=(i=_+h|0)<<7|i>>>25)+_|0)<<9|i>>>23)+f|0)<<13|i>>>19)+o|0)<<18|i>>>14,T^=(i=(b^=(i=(p^=(i=(u^=(i=T+b|0)<<7|i>>>25)+T|0)<<9|i>>>23)+u|0)<<13|i>>>19)+p|0)<<18|i>>>14,n^=(i=(u^=(i=(o^=(i=(a^=(i=n+u|0)<<7|i>>>25)+n|0)<<9|i>>>23)+a|0)<<13|i>>>19)+o|0)<<18|i>>>14,d^=(i=(c^=(i=(p^=(i=(h^=(i=d+c|0)<<7|i>>>25)+d|0)<<9|i>>>23)+h|0)<<13|i>>>19)+p|0)<<18|i>>>14,_^=(i=(m^=(i=(l^=(i=(b^=(i=_+m|0)<<7|i>>>25)+_|0)<<9|i>>>23)+b|0)<<13|i>>>19)+l|0)<<18|i>>>14,T^=(i=(f^=(i=(y^=(i=(g^=(i=T+f|0)<<7|i>>>25)+T|0)<<9|i>>>23)+g|0)<<13|i>>>19)+y|0)<<18|i>>>14;e[0]=n>>>0&255,e[1]=n>>>8&255,e[2]=n>>>16&255,e[3]=n>>>24&255,e[4]=d>>>0&255,e[5]=d>>>8&255,e[6]=d>>>16&255,e[7]=d>>>24&255,e[8]=_>>>0&255,e[9]=_>>>8&255,e[10]=_>>>16&255,e[11]=_>>>24&255,e[12]=T>>>0&255,e[13]=T>>>8&255,e[14]=T>>>16&255,e[15]=T>>>24&255,e[16]=h>>>0&255,e[17]=h>>>8&255,e[18]=h>>>16&255,e[19]=h>>>24&255,e[20]=p>>>0&255,e[21]=p>>>8&255,e[22]=p>>>16&255,e[23]=p>>>24&255,e[24]=l>>>0&255,e[25]=l>>>8&255,e[26]=l>>>16&255,e[27]=l>>>24&255,e[28]=m>>>0&255,e[29]=m>>>8&255,e[30]=m>>>16&255,e[31]=m>>>24&255}(e,t,r,s)}var T=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function E(e,t,r,s,i,n,a){var o,u,c=new Uint8Array(16),d=new Uint8Array(64);for(u=0;u<16;u++)c[u]=0;for(u=0;u<8;u++)c[u]=n[u];for(;i>=64;){for(y(d,c,a,T),u=0;u<64;u++)e[t+u]=r[s+u]^d[u];for(o=1,u=8;u<16;u++)o=o+(255&c[u])|0,c[u]=255&o,o>>>=8;i-=64,t+=64,s+=64}if(i>0)for(y(d,c,a,T),u=0;u<i;u++)e[t+u]=r[s+u]^d[u];return 0}function v(e,t,r,s,i){var n,a,o=new Uint8Array(16),u=new Uint8Array(64);for(a=0;a<16;a++)o[a]=0;for(a=0;a<8;a++)o[a]=s[a];for(;r>=64;){for(y(u,o,i,T),a=0;a<64;a++)e[t+a]=u[a];for(n=1,a=8;a<16;a++)n=n+(255&o[a])|0,o[a]=255&n,n>>>=8;r-=64,t+=64}if(r>0)for(y(u,o,i,T),a=0;a<r;a++)e[t+a]=u[a];return 0}function x(e,t,r,s,i){var n=new Uint8Array(32);f(n,s,i,T);for(var a=new Uint8Array(8),o=0;o<8;o++)a[o]=s[o+16];return v(e,t,r,a,n)}function O(e,t,r,s,i,n,a){var o=new Uint8Array(32);f(o,n,a,T);for(var u=new Uint8Array(8),c=0;c<8;c++)u[c]=n[c+16];return E(e,t,r,s,i,u,o)}var w=function(e){var t,r,s,i,n,a,o,u;this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0,t=255&e[0]|(255&e[1])<<8,this.r[0]=8191&t,r=255&e[2]|(255&e[3])<<8,this.r[1]=8191&(t>>>13|r<<3),s=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|s<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(s>>>7|i<<9),n=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|n<<12),this.r[5]=n>>>1&8190,a=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(n>>>14|a<<2),o=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(a>>>11|o<<5),u=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(o>>>8|u<<8),this.r[9]=u>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function B(e,t,r,s,i,n){var a=new w(n);return a.update(r,s,i),a.finish(e,t),0}function I(e,t,r,s,i,n){var a=new Uint8Array(16);return B(a,0,r,s,i,n),b(e,t,a,0)}function C(e,t,r,s,i){var n;if(r<32)return-1;for(O(e,0,t,0,r,s,i),B(e,16,e,32,r-32,e),n=0;n<16;n++)e[n]=0;return 0}function P(e,t,r,s,i){var n,a=new Uint8Array(32);if(r<32)return-1;if(x(a,0,32,s,i),0!==I(t,16,t,32,r-32,a))return-1;for(O(e,0,t,0,r,s,i),n=0;n<32;n++)e[n]=0;return 0}function S(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function A(e){var t,r,s=1;for(t=0;t<16;t++)r=e[t]+s+65535,s=Math.floor(r/65536),e[t]=r-65536*s;e[0]+=s-1+37*(s-1)}function j(e,t,r){for(var s,i=~(r-1),n=0;n<16;n++)s=i&(e[n]^t[n]),e[n]^=s,t[n]^=s}function k(e,r){var s,i,n,a=t(),o=t();for(s=0;s<16;s++)o[s]=r[s];for(A(o),A(o),A(o),i=0;i<2;i++){for(a[0]=o[0]-65517,s=1;s<15;s++)a[s]=o[s]-65535-(a[s-1]>>16&1),a[s-1]&=65535;a[15]=o[15]-32767-(a[14]>>16&1),n=a[15]>>16&1,a[14]&=65535,j(o,a,1-n)}for(s=0;s<16;s++)e[2*s]=255&o[s],e[2*s+1]=o[s]>>8}function U(e,t){var r=new Uint8Array(32),s=new Uint8Array(32);return k(r,e),k(s,t),g(r,0,s,0)}function Y(e){var t=new Uint8Array(32);return k(t,e),1&t[0]}function D(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function R(e,t,r){for(var s=0;s<16;s++)e[s]=t[s]+r[s]}function N(e,t,r){for(var s=0;s<16;s++)e[s]=t[s]-r[s]}function V(e,t,r){var s,i,n=0,a=0,o=0,u=0,c=0,d=0,h=0,p=0,l=0,m=0,_=0,b=0,g=0,y=0,f=0,T=0,E=0,v=0,x=0,O=0,w=0,B=0,I=0,C=0,P=0,S=0,A=0,j=0,k=0,U=0,Y=0,D=r[0],R=r[1],N=r[2],V=r[3],X=r[4],J=r[5],F=r[6],q=r[7],L=r[8],M=r[9],G=r[10],$=r[11],z=r[12],W=r[13],H=r[14],K=r[15];n+=(s=t[0])*D,a+=s*R,o+=s*N,u+=s*V,c+=s*X,d+=s*J,h+=s*F,p+=s*q,l+=s*L,m+=s*M,_+=s*G,b+=s*$,g+=s*z,y+=s*W,f+=s*H,T+=s*K,a+=(s=t[1])*D,o+=s*R,u+=s*N,c+=s*V,d+=s*X,h+=s*J,p+=s*F,l+=s*q,m+=s*L,_+=s*M,b+=s*G,g+=s*$,y+=s*z,f+=s*W,T+=s*H,E+=s*K,o+=(s=t[2])*D,u+=s*R,c+=s*N,d+=s*V,h+=s*X,p+=s*J,l+=s*F,m+=s*q,_+=s*L,b+=s*M,g+=s*G,y+=s*$,f+=s*z,T+=s*W,E+=s*H,v+=s*K,u+=(s=t[3])*D,c+=s*R,d+=s*N,h+=s*V,p+=s*X,l+=s*J,m+=s*F,_+=s*q,b+=s*L,g+=s*M,y+=s*G,f+=s*$,T+=s*z,E+=s*W,v+=s*H,x+=s*K,c+=(s=t[4])*D,d+=s*R,h+=s*N,p+=s*V,l+=s*X,m+=s*J,_+=s*F,b+=s*q,g+=s*L,y+=s*M,f+=s*G,T+=s*$,E+=s*z,v+=s*W,x+=s*H,O+=s*K,d+=(s=t[5])*D,h+=s*R,p+=s*N,l+=s*V,m+=s*X,_+=s*J,b+=s*F,g+=s*q,y+=s*L,f+=s*M,T+=s*G,E+=s*$,v+=s*z,x+=s*W,O+=s*H,w+=s*K,h+=(s=t[6])*D,p+=s*R,l+=s*N,m+=s*V,_+=s*X,b+=s*J,g+=s*F,y+=s*q,f+=s*L,T+=s*M,E+=s*G,v+=s*$,x+=s*z,O+=s*W,w+=s*H,B+=s*K,p+=(s=t[7])*D,l+=s*R,m+=s*N,_+=s*V,b+=s*X,g+=s*J,y+=s*F,f+=s*q,T+=s*L,E+=s*M,v+=s*G,x+=s*$,O+=s*z,w+=s*W,B+=s*H,I+=s*K,l+=(s=t[8])*D,m+=s*R,_+=s*N,b+=s*V,g+=s*X,y+=s*J,f+=s*F,T+=s*q,E+=s*L,v+=s*M,x+=s*G,O+=s*$,w+=s*z,B+=s*W,I+=s*H,C+=s*K,m+=(s=t[9])*D,_+=s*R,b+=s*N,g+=s*V,y+=s*X,f+=s*J,T+=s*F,E+=s*q,v+=s*L,x+=s*M,O+=s*G,w+=s*$,B+=s*z,I+=s*W,C+=s*H,P+=s*K,_+=(s=t[10])*D,b+=s*R,g+=s*N,y+=s*V,f+=s*X,T+=s*J,E+=s*F,v+=s*q,x+=s*L,O+=s*M,w+=s*G,B+=s*$,I+=s*z,C+=s*W,P+=s*H,S+=s*K,b+=(s=t[11])*D,g+=s*R,y+=s*N,f+=s*V,T+=s*X,E+=s*J,v+=s*F,x+=s*q,O+=s*L,w+=s*M,B+=s*G,I+=s*$,C+=s*z,P+=s*W,S+=s*H,A+=s*K,g+=(s=t[12])*D,y+=s*R,f+=s*N,T+=s*V,E+=s*X,v+=s*J,x+=s*F,O+=s*q,w+=s*L,B+=s*M,I+=s*G,C+=s*$,P+=s*z,S+=s*W,A+=s*H,j+=s*K,y+=(s=t[13])*D,f+=s*R,T+=s*N,E+=s*V,v+=s*X,x+=s*J,O+=s*F,w+=s*q,B+=s*L,I+=s*M,C+=s*G,P+=s*$,S+=s*z,A+=s*W,j+=s*H,k+=s*K,f+=(s=t[14])*D,T+=s*R,E+=s*N,v+=s*V,x+=s*X,O+=s*J,w+=s*F,B+=s*q,I+=s*L,C+=s*M,P+=s*G,S+=s*$,A+=s*z,j+=s*W,k+=s*H,U+=s*K,T+=(s=t[15])*D,a+=38*(v+=s*N),o+=38*(x+=s*V),u+=38*(O+=s*X),c+=38*(w+=s*J),d+=38*(B+=s*F),h+=38*(I+=s*q),p+=38*(C+=s*L),l+=38*(P+=s*M),m+=38*(S+=s*G),_+=38*(A+=s*$),b+=38*(j+=s*z),g+=38*(k+=s*W),y+=38*(U+=s*H),f+=38*(Y+=s*K),n=(s=(n+=38*(E+=s*R))+(i=1)+65535)-65536*(i=Math.floor(s/65536)),a=(s=a+i+65535)-65536*(i=Math.floor(s/65536)),o=(s=o+i+65535)-65536*(i=Math.floor(s/65536)),u=(s=u+i+65535)-65536*(i=Math.floor(s/65536)),c=(s=c+i+65535)-65536*(i=Math.floor(s/65536)),d=(s=d+i+65535)-65536*(i=Math.floor(s/65536)),h=(s=h+i+65535)-65536*(i=Math.floor(s/65536)),p=(s=p+i+65535)-65536*(i=Math.floor(s/65536)),l=(s=l+i+65535)-65536*(i=Math.floor(s/65536)),m=(s=m+i+65535)-65536*(i=Math.floor(s/65536)),_=(s=_+i+65535)-65536*(i=Math.floor(s/65536)),b=(s=b+i+65535)-65536*(i=Math.floor(s/65536)),g=(s=g+i+65535)-65536*(i=Math.floor(s/65536)),y=(s=y+i+65535)-65536*(i=Math.floor(s/65536)),f=(s=f+i+65535)-65536*(i=Math.floor(s/65536)),T=(s=T+i+65535)-65536*(i=Math.floor(s/65536)),n=(s=(n+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(s/65536)),a=(s=a+i+65535)-65536*(i=Math.floor(s/65536)),o=(s=o+i+65535)-65536*(i=Math.floor(s/65536)),u=(s=u+i+65535)-65536*(i=Math.floor(s/65536)),c=(s=c+i+65535)-65536*(i=Math.floor(s/65536)),d=(s=d+i+65535)-65536*(i=Math.floor(s/65536)),h=(s=h+i+65535)-65536*(i=Math.floor(s/65536)),p=(s=p+i+65535)-65536*(i=Math.floor(s/65536)),l=(s=l+i+65535)-65536*(i=Math.floor(s/65536)),m=(s=m+i+65535)-65536*(i=Math.floor(s/65536)),_=(s=_+i+65535)-65536*(i=Math.floor(s/65536)),b=(s=b+i+65535)-65536*(i=Math.floor(s/65536)),g=(s=g+i+65535)-65536*(i=Math.floor(s/65536)),y=(s=y+i+65535)-65536*(i=Math.floor(s/65536)),f=(s=f+i+65535)-65536*(i=Math.floor(s/65536)),T=(s=T+i+65535)-65536*(i=Math.floor(s/65536)),n+=i-1+37*(i-1),e[0]=n,e[1]=a,e[2]=o,e[3]=u,e[4]=c,e[5]=d,e[6]=h,e[7]=p,e[8]=l,e[9]=m,e[10]=_,e[11]=b,e[12]=g,e[13]=y,e[14]=f,e[15]=T}function X(e,t){V(e,t,t)}function J(e,r){var s,i=t();for(s=0;s<16;s++)i[s]=r[s];for(s=253;s>=0;s--)X(i,i),2!==s&&4!==s&&V(i,i,r);for(s=0;s<16;s++)e[s]=i[s]}function F(e,r){var s,i=t();for(s=0;s<16;s++)i[s]=r[s];for(s=250;s>=0;s--)X(i,i),1!==s&&V(i,i,r);for(s=0;s<16;s++)e[s]=i[s]}function q(e,r,s){var i,n,a=new Uint8Array(32),o=new Float64Array(80),c=t(),d=t(),h=t(),p=t(),l=t(),m=t();for(n=0;n<31;n++)a[n]=r[n];for(a[31]=127&r[31]|64,a[0]&=248,D(o,s),n=0;n<16;n++)d[n]=o[n],p[n]=c[n]=h[n]=0;for(c[0]=p[0]=1,n=254;n>=0;--n)j(c,d,i=a[n>>>3]>>>(7&n)&1),j(h,p,i),R(l,c,h),N(c,c,h),R(h,d,p),N(d,d,p),X(p,l),X(m,c),V(c,h,c),V(h,d,l),R(l,c,h),N(c,c,h),X(d,c),N(h,p,m),V(c,h,u),R(c,c,p),V(h,h,c),V(c,p,m),V(p,d,o),X(d,l),j(c,d,i),j(h,p,i);for(n=0;n<16;n++)o[n+16]=c[n],o[n+32]=h[n],o[n+48]=d[n],o[n+64]=p[n];var _=o.subarray(32),b=o.subarray(16);return J(_,_),V(b,b,_),k(e,b),0}function L(e,t){return q(e,t,n)}function M(e,t){return s(t,32),L(e,t)}function G(e,t,r){var s=new Uint8Array(32);return q(s,r,t),f(e,i,s,T)}w.prototype.blocks=function(e,t,r){for(var s,i,n,a,o,u,c,d,h,p,l,m,_,b,g,y,f,T,E,v=this.fin?0:2048,x=this.h[0],O=this.h[1],w=this.h[2],B=this.h[3],I=this.h[4],C=this.h[5],P=this.h[6],S=this.h[7],A=this.h[8],j=this.h[9],k=this.r[0],U=this.r[1],Y=this.r[2],D=this.r[3],R=this.r[4],N=this.r[5],V=this.r[6],X=this.r[7],J=this.r[8],F=this.r[9];r>=16;)p=h=0,p+=(x+=8191&(s=255&e[t+0]|(255&e[t+1])<<8))*k,p+=(O+=8191&(s>>>13|(i=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*F),p+=(w+=8191&(i>>>10|(n=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*J),p+=(B+=8191&(n>>>7|(a=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*X),h=(p+=(I+=8191&(a>>>4|(o=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*V))>>>13,p&=8191,p+=(C+=o>>>1&8191)*(5*N),p+=(P+=8191&(o>>>14|(u=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*R),p+=(S+=8191&(u>>>11|(c=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*D),p+=(A+=8191&(c>>>8|(d=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*Y),l=h+=(p+=(j+=d>>>5|v)*(5*U))>>>13,l+=x*U,l+=O*k,l+=w*(5*F),l+=B*(5*J),h=(l+=I*(5*X))>>>13,l&=8191,l+=C*(5*V),l+=P*(5*N),l+=S*(5*R),l+=A*(5*D),h+=(l+=j*(5*Y))>>>13,l&=8191,m=h,m+=x*Y,m+=O*U,m+=w*k,m+=B*(5*F),h=(m+=I*(5*J))>>>13,m&=8191,m+=C*(5*X),m+=P*(5*V),m+=S*(5*N),m+=A*(5*R),_=h+=(m+=j*(5*D))>>>13,_+=x*D,_+=O*Y,_+=w*U,_+=B*k,h=(_+=I*(5*F))>>>13,_&=8191,_+=C*(5*J),_+=P*(5*X),_+=S*(5*V),_+=A*(5*N),b=h+=(_+=j*(5*R))>>>13,b+=x*R,b+=O*D,b+=w*Y,b+=B*U,h=(b+=I*k)>>>13,b&=8191,b+=C*(5*F),b+=P*(5*J),b+=S*(5*X),b+=A*(5*V),g=h+=(b+=j*(5*N))>>>13,g+=x*N,g+=O*R,g+=w*D,g+=B*Y,h=(g+=I*U)>>>13,g&=8191,g+=C*k,g+=P*(5*F),g+=S*(5*J),g+=A*(5*X),y=h+=(g+=j*(5*V))>>>13,y+=x*V,y+=O*N,y+=w*R,y+=B*D,h=(y+=I*Y)>>>13,y&=8191,y+=C*U,y+=P*k,y+=S*(5*F),y+=A*(5*J),f=h+=(y+=j*(5*X))>>>13,f+=x*X,f+=O*V,f+=w*N,f+=B*R,h=(f+=I*D)>>>13,f&=8191,f+=C*Y,f+=P*U,f+=S*k,f+=A*(5*F),T=h+=(f+=j*(5*J))>>>13,T+=x*J,T+=O*X,T+=w*V,T+=B*N,h=(T+=I*R)>>>13,T&=8191,T+=C*D,T+=P*Y,T+=S*U,T+=A*k,E=h+=(T+=j*(5*F))>>>13,E+=x*F,E+=O*J,E+=w*X,E+=B*V,h=(E+=I*N)>>>13,E&=8191,E+=C*R,E+=P*D,E+=S*Y,E+=A*U,x=p=8191&(h=(h=((h+=(E+=j*k)>>>13)<<2)+h|0)+(p&=8191)|0),O=l+=h>>>=13,w=m&=8191,B=_&=8191,I=b&=8191,C=g&=8191,P=y&=8191,S=f&=8191,A=T&=8191,j=E&=8191,t+=16,r-=16;this.h[0]=x,this.h[1]=O,this.h[2]=w,this.h[3]=B,this.h[4]=I,this.h[5]=C,this.h[6]=P,this.h[7]=S,this.h[8]=A,this.h[9]=j},w.prototype.finish=function(e,t){var r,s,i,n,a=new Uint16Array(10);if(this.leftover){for(n=this.leftover,this.buffer[n++]=1;n<16;n++)this.buffer[n]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,n=2;n<10;n++)this.h[n]+=r,r=this.h[n]>>>13,this.h[n]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,a[0]=this.h[0]+5,r=a[0]>>>13,a[0]&=8191,n=1;n<10;n++)a[n]=this.h[n]+r,r=a[n]>>>13,a[n]&=8191;for(a[9]-=8192,s=(1^r)-1,n=0;n<10;n++)a[n]&=s;for(s=~s,n=0;n<10;n++)this.h[n]=this.h[n]&s|a[n];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,n=1;n<8;n++)i=(this.h[n]+this.pad[n]|0)+(i>>>16)|0,this.h[n]=65535&i;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},w.prototype.update=function(e,t,r){var s,i;if(this.leftover){for((i=16-this.leftover)>r&&(i=r),s=0;s<i;s++)this.buffer[this.leftover+s]=e[t+s];if(r-=i,t+=i,this.leftover+=i,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(r>=16&&(i=r-r%16,this.blocks(e,t,i),t+=i,r-=i),r){for(s=0;s<r;s++)this.buffer[this.leftover+s]=e[t+s];this.leftover+=r}};var $=C,z=P,W=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function H(e,t,r,s){for(var i,n,a,o,u,c,d,h,p,l,m,_,b,g,y,f,T,E,v,x,O,w,B,I,C,P,S=new Int32Array(16),A=new Int32Array(16),j=e[0],k=e[1],U=e[2],Y=e[3],D=e[4],R=e[5],N=e[6],V=e[7],X=t[0],J=t[1],F=t[2],q=t[3],L=t[4],M=t[5],G=t[6],$=t[7],z=0;s>=128;){for(v=0;v<16;v++)x=8*v+z,S[v]=r[x+0]<<24|r[x+1]<<16|r[x+2]<<8|r[x+3],A[v]=r[x+4]<<24|r[x+5]<<16|r[x+6]<<8|r[x+7];for(v=0;v<80;v++)if(i=j,n=k,a=U,o=Y,u=D,c=R,d=N,p=X,l=J,m=F,_=q,b=L,g=M,y=G,B=65535&(w=$),I=w>>>16,C=65535&(O=V),P=O>>>16,B+=65535&(w=(L>>>14|D<<18)^(L>>>18|D<<14)^(D>>>9|L<<23)),I+=w>>>16,C+=65535&(O=(D>>>14|L<<18)^(D>>>18|L<<14)^(L>>>9|D<<23)),P+=O>>>16,B+=65535&(w=L&M^~L&G),I+=w>>>16,C+=65535&(O=D&R^~D&N),P+=O>>>16,B+=65535&(w=W[2*v+1]),I+=w>>>16,C+=65535&(O=W[2*v]),P+=O>>>16,O=S[v%16],I+=(w=A[v%16])>>>16,C+=65535&O,P+=O>>>16,C+=(I+=(B+=65535&w)>>>16)>>>16,B=65535&(w=E=65535&B|I<<16),I=w>>>16,C=65535&(O=T=65535&C|(P+=C>>>16)<<16),P=O>>>16,B+=65535&(w=(X>>>28|j<<4)^(j>>>2|X<<30)^(j>>>7|X<<25)),I+=w>>>16,C+=65535&(O=(j>>>28|X<<4)^(X>>>2|j<<30)^(X>>>7|j<<25)),P+=O>>>16,I+=(w=X&J^X&F^J&F)>>>16,C+=65535&(O=j&k^j&U^k&U),P+=O>>>16,h=65535&(C+=(I+=(B+=65535&w)>>>16)>>>16)|(P+=C>>>16)<<16,f=65535&B|I<<16,B=65535&(w=_),I=w>>>16,C=65535&(O=o),P=O>>>16,I+=(w=E)>>>16,C+=65535&(O=T),P+=O>>>16,k=i,U=n,Y=a,D=o=65535&(C+=(I+=(B+=65535&w)>>>16)>>>16)|(P+=C>>>16)<<16,R=u,N=c,V=d,j=h,J=p,F=l,q=m,L=_=65535&B|I<<16,M=b,G=g,$=y,X=f,v%16==15)for(x=0;x<16;x++)O=S[x],B=65535&(w=A[x]),I=w>>>16,C=65535&O,P=O>>>16,O=S[(x+9)%16],B+=65535&(w=A[(x+9)%16]),I+=w>>>16,C+=65535&O,P+=O>>>16,T=S[(x+1)%16],B+=65535&(w=((E=A[(x+1)%16])>>>1|T<<31)^(E>>>8|T<<24)^(E>>>7|T<<25)),I+=w>>>16,C+=65535&(O=(T>>>1|E<<31)^(T>>>8|E<<24)^T>>>7),P+=O>>>16,T=S[(x+14)%16],I+=(w=((E=A[(x+14)%16])>>>19|T<<13)^(T>>>29|E<<3)^(E>>>6|T<<26))>>>16,C+=65535&(O=(T>>>19|E<<13)^(E>>>29|T<<3)^T>>>6),P+=O>>>16,P+=(C+=(I+=(B+=65535&w)>>>16)>>>16)>>>16,S[x]=65535&C|P<<16,A[x]=65535&B|I<<16;B=65535&(w=X),I=w>>>16,C=65535&(O=j),P=O>>>16,O=e[0],I+=(w=t[0])>>>16,C+=65535&O,P+=O>>>16,P+=(C+=(I+=(B+=65535&w)>>>16)>>>16)>>>16,e[0]=j=65535&C|P<<16,t[0]=X=65535&B|I<<16,B=65535&(w=J),I=w>>>16,C=65535&(O=k),P=O>>>16,O=e[1],I+=(w=t[1])>>>16,C+=65535&O,P+=O>>>16,P+=(C+=(I+=(B+=65535&w)>>>16)>>>16)>>>16,e[1]=k=65535&C|P<<16,t[1]=J=65535&B|I<<16,B=65535&(w=F),I=w>>>16,C=65535&(O=U),P=O>>>16,O=e[2],I+=(w=t[2])>>>16,C+=65535&O,P+=O>>>16,P+=(C+=(I+=(B+=65535&w)>>>16)>>>16)>>>16,e[2]=U=65535&C|P<<16,t[2]=F=65535&B|I<<16,B=65535&(w=q),I=w>>>16,C=65535&(O=Y),P=O>>>16,O=e[3],I+=(w=t[3])>>>16,C+=65535&O,P+=O>>>16,P+=(C+=(I+=(B+=65535&w)>>>16)>>>16)>>>16,e[3]=Y=65535&C|P<<16,t[3]=q=65535&B|I<<16,B=65535&(w=L),I=w>>>16,C=65535&(O=D),P=O>>>16,O=e[4],I+=(w=t[4])>>>16,C+=65535&O,P+=O>>>16,P+=(C+=(I+=(B+=65535&w)>>>16)>>>16)>>>16,e[4]=D=65535&C|P<<16,t[4]=L=65535&B|I<<16,B=65535&(w=M),I=w>>>16,C=65535&(O=R),P=O>>>16,O=e[5],I+=(w=t[5])>>>16,C+=65535&O,P+=O>>>16,P+=(C+=(I+=(B+=65535&w)>>>16)>>>16)>>>16,e[5]=R=65535&C|P<<16,t[5]=M=65535&B|I<<16,B=65535&(w=G),I=w>>>16,C=65535&(O=N),P=O>>>16,O=e[6],I+=(w=t[6])>>>16,C+=65535&O,P+=O>>>16,P+=(C+=(I+=(B+=65535&w)>>>16)>>>16)>>>16,e[6]=N=65535&C|P<<16,t[6]=G=65535&B|I<<16,B=65535&(w=$),I=w>>>16,C=65535&(O=V),P=O>>>16,O=e[7],I+=(w=t[7])>>>16,C+=65535&O,P+=O>>>16,P+=(C+=(I+=(B+=65535&w)>>>16)>>>16)>>>16,e[7]=V=65535&C|P<<16,t[7]=$=65535&B|I<<16,z+=128,s-=128}return s}function K(e,t,r){var s,i=new Int32Array(8),n=new Int32Array(8),a=new Uint8Array(256),o=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,n[0]=4089235720,n[1]=2227873595,n[2]=4271175723,n[3]=1595750129,n[4]=2917565137,n[5]=725511199,n[6]=4215389547,n[7]=327033209,H(i,n,t,r),r%=128,s=0;s<r;s++)a[s]=t[o-r+s];for(a[r]=128,a[(r=256-128*(r<112?1:0))-9]=0,m(a,r-8,o/536870912|0,o<<3),H(i,n,a,r),s=0;s<8;s++)m(e,8*s,i[s],n[s]);return 0}function Q(e,r){var s=t(),i=t(),n=t(),a=t(),o=t(),u=t(),c=t(),h=t(),p=t();N(s,e[1],e[0]),N(p,r[1],r[0]),V(s,s,p),R(i,e[0],e[1]),R(p,r[0],r[1]),V(i,i,p),V(n,e[3],r[3]),V(n,n,d),V(a,e[2],r[2]),R(a,a,a),N(o,i,s),N(u,a,n),R(c,a,n),R(h,i,s),V(e[0],o,u),V(e[1],h,c),V(e[2],c,u),V(e[3],o,h)}function Z(e,t,r){var s;for(s=0;s<4;s++)j(e[s],t[s],r)}function ee(e,r){var s=t(),i=t(),n=t();J(n,r[2]),V(s,r[0],n),V(i,r[1],n),k(e,i),e[31]^=Y(s)<<7}function te(e,t,r){var s,i;for(S(e[0],a),S(e[1],o),S(e[2],o),S(e[3],a),i=255;i>=0;--i)Z(e,t,s=r[i/8|0]>>(7&i)&1),Q(t,e),Q(e,e),Z(e,t,s)}function re(e,r){var s=[t(),t(),t(),t()];S(s[0],h),S(s[1],p),S(s[2],o),V(s[3],h,p),te(e,s,r)}function se(e,r,i){var n,a=new Uint8Array(64),o=[t(),t(),t(),t()];for(i||s(r,32),K(a,r,32),a[0]&=248,a[31]&=127,a[31]|=64,re(o,a),ee(e,o),n=0;n<32;n++)r[n+32]=e[n];return 0}var ie=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ne(e,t){var r,s,i,n;for(s=63;s>=32;--s){for(r=0,i=s-32,n=s-12;i<n;++i)t[i]+=r-16*t[s]*ie[i-(s-32)],r=Math.floor((t[i]+128)/256),t[i]-=256*r;t[i]+=r,t[s]=0}for(r=0,i=0;i<32;i++)t[i]+=r-(t[31]>>4)*ie[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*ie[i];for(s=0;s<32;s++)t[s+1]+=t[s]>>8,e[s]=255&t[s]}function ae(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;ne(e,r)}function oe(e,r,s,i){var n,a,o=new Uint8Array(64),u=new Uint8Array(64),c=new Uint8Array(64),d=new Float64Array(64),h=[t(),t(),t(),t()];K(o,i,32),o[0]&=248,o[31]&=127,o[31]|=64;var p=s+64;for(n=0;n<s;n++)e[64+n]=r[n];for(n=0;n<32;n++)e[32+n]=o[32+n];for(K(c,e.subarray(32),s+32),ae(c),re(h,c),ee(e,h),n=32;n<64;n++)e[n]=i[n];for(K(u,e,s+64),ae(u),n=0;n<64;n++)d[n]=0;for(n=0;n<32;n++)d[n]=c[n];for(n=0;n<32;n++)for(a=0;a<32;a++)d[n+a]+=u[n]*o[a];return ne(e.subarray(32),d),p}function ue(e,r,s,i){var n,u=new Uint8Array(32),d=new Uint8Array(64),h=[t(),t(),t(),t()],p=[t(),t(),t(),t()];if(s<64)return-1;if(function(e,r){var s=t(),i=t(),n=t(),u=t(),d=t(),h=t(),p=t();return S(e[2],o),D(e[1],r),X(n,e[1]),V(u,n,c),N(n,n,e[2]),R(u,e[2],u),X(d,u),X(h,d),V(p,h,d),V(s,p,n),V(s,s,u),F(s,s),V(s,s,n),V(s,s,u),V(s,s,u),V(e[0],s,u),X(i,e[0]),V(i,i,u),U(i,n)&&V(e[0],e[0],l),X(i,e[0]),V(i,i,u),U(i,n)?-1:(Y(e[0])===r[31]>>7&&N(e[0],a,e[0]),V(e[3],e[0],e[1]),0)}(p,i))return-1;for(n=0;n<s;n++)e[n]=r[n];for(n=0;n<32;n++)e[n+32]=i[n];if(K(d,e,s),ae(d),te(h,p,d),re(p,r.subarray(32)),Q(h,p),ee(u,h),s-=64,g(r,0,u,0)){for(n=0;n<s;n++)e[n]=0;return-1}for(n=0;n<s;n++)e[n]=r[n+64];return s}var ce,de=64,he=32,pe=64;function le(e,t){if(32!==e.length)throw new Error("bad key size");if(24!==t.length)throw new Error("bad nonce size")}function me(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function _e(e){for(var t=0;t<e.length;t++)e[t]=0}e.lowlevel={crypto_core_hsalsa20:f,crypto_stream_xor:O,crypto_stream:x,crypto_stream_salsa20_xor:E,crypto_stream_salsa20:v,crypto_onetimeauth:B,crypto_onetimeauth_verify:I,crypto_verify_16:b,crypto_verify_32:g,crypto_secretbox:C,crypto_secretbox_open:P,crypto_scalarmult:q,crypto_scalarmult_base:L,crypto_box_beforenm:G,crypto_box_afternm:$,crypto_box:function(e,t,r,s,i,n){var a=new Uint8Array(32);return G(a,i,n),$(e,t,r,s,a)},crypto_box_open:function(e,t,r,s,i,n){var a=new Uint8Array(32);return G(a,i,n),z(e,t,r,s,a)},crypto_box_keypair:M,crypto_hash:K,crypto_sign:oe,crypto_sign_keypair:se,crypto_sign_open:ue,crypto_secretbox_KEYBYTES:32,crypto_secretbox_NONCEBYTES:24,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:16,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:32,crypto_box_SECRETKEYBYTES:32,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:24,crypto_box_ZEROBYTES:32,crypto_box_BOXZEROBYTES:16,crypto_sign_BYTES:de,crypto_sign_PUBLICKEYBYTES:he,crypto_sign_SECRETKEYBYTES:pe,crypto_sign_SEEDBYTES:32,crypto_hash_BYTES:64,gf:t,D:c,L:ie,pack25519:k,unpack25519:D,M:V,A:R,S:X,Z:N,pow2523:F,add:Q,set25519:S,modL:ne,scalarmult:te,scalarbase:re},e.randomBytes=function(e){var t=new Uint8Array(e);return s(t,e),t},e.secretbox=function(e,t,r){me(e,t,r),le(r,t);for(var s=new Uint8Array(32+e.length),i=new Uint8Array(s.length),n=0;n<e.length;n++)s[n+32]=e[n];return C(i,s,s.length,t,r),i.subarray(16)},e.secretbox.open=function(e,t,r){me(e,t,r),le(r,t);for(var s=new Uint8Array(16+e.length),i=new Uint8Array(s.length),n=0;n<e.length;n++)s[n+16]=e[n];return s.length<32||0!==P(i,s,s.length,t,r)?null:i.subarray(32)},e.secretbox.keyLength=32,e.secretbox.nonceLength=24,e.secretbox.overheadLength=16,e.scalarMult=function(e,t){if(me(e,t),32!==e.length)throw new Error("bad n size");if(32!==t.length)throw new Error("bad p size");var r=new Uint8Array(32);return q(r,e,t),r},e.scalarMult.base=function(e){if(me(e),32!==e.length)throw new Error("bad n size");var t=new Uint8Array(32);return L(t,e),t},e.scalarMult.scalarLength=32,e.scalarMult.groupElementLength=32,e.box=function(t,r,s,i){var n=e.box.before(s,i);return e.secretbox(t,r,n)},e.box.before=function(e,t){me(e,t),function(e,t){if(32!==e.length)throw new Error("bad public key size");if(32!==t.length)throw new Error("bad secret key size")}(e,t);var r=new Uint8Array(32);return G(r,e,t),r},e.box.after=e.secretbox,e.box.open=function(t,r,s,i){var n=e.box.before(s,i);return e.secretbox.open(t,r,n)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var e=new Uint8Array(32),t=new Uint8Array(32);return M(e,t),{publicKey:e,secretKey:t}},e.box.keyPair.fromSecretKey=function(e){if(me(e),32!==e.length)throw new Error("bad secret key size");var t=new Uint8Array(32);return L(t,e),{publicKey:t,secretKey:new Uint8Array(e)}},e.box.publicKeyLength=32,e.box.secretKeyLength=32,e.box.sharedKeyLength=32,e.box.nonceLength=24,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(e,t){if(me(e,t),t.length!==pe)throw new Error("bad secret key size");var r=new Uint8Array(de+e.length);return oe(r,e,e.length,t),r},e.sign.open=function(e,t){if(me(e,t),t.length!==he)throw new Error("bad public key size");var r=new Uint8Array(e.length),s=ue(r,e,e.length,t);if(s<0)return null;for(var i=new Uint8Array(s),n=0;n<i.length;n++)i[n]=r[n];return i},e.sign.detached=function(t,r){for(var s=e.sign(t,r),i=new Uint8Array(de),n=0;n<i.length;n++)i[n]=s[n];return i},e.sign.detached.verify=function(e,t,r){if(me(e,t,r),t.length!==de)throw new Error("bad signature size");if(r.length!==he)throw new Error("bad public key size");var s,i=new Uint8Array(de+e.length),n=new Uint8Array(de+e.length);for(s=0;s<de;s++)i[s]=t[s];for(s=0;s<e.length;s++)i[s+de]=e[s];return ue(n,i,i.length,r)>=0},e.sign.keyPair=function(){var e=new Uint8Array(he),t=new Uint8Array(pe);return se(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(me(e),e.length!==pe)throw new Error("bad secret key size");for(var t=new Uint8Array(he),r=0;r<t.length;r++)t[r]=e[32+r];return{publicKey:t,secretKey:new Uint8Array(e)}},e.sign.keyPair.fromSeed=function(e){if(me(e),32!==e.length)throw new Error("bad seed size");for(var t=new Uint8Array(he),r=new Uint8Array(pe),s=0;s<32;s++)r[s]=e[s];return se(t,r,!0),{publicKey:t,secretKey:r}},e.sign.publicKeyLength=he,e.sign.secretKeyLength=pe,e.sign.seedLength=32,e.sign.signatureLength=de,e.hash=function(e){me(e);var t=new Uint8Array(64);return K(t,e,e.length),t},e.hash.hashLength=64,e.verify=function(e,t){return me(e,t),0!==e.length&&0!==t.length&&e.length===t.length&&0===_(e,0,t,0,e.length)},e.setPRNG=function(e){s=e},(ce="undefined"!=typeof self?self.crypto||self.msCrypto:null)&&ce.getRandomValues?e.setPRNG((function(e,t){var r,s=new Uint8Array(t);for(r=0;r<t;r+=65536)ce.getRandomValues(s.subarray(r,r+Math.min(t-r,65536)));for(r=0;r<t;r++)e[r]=s[r];_e(s)})):(ce=r(281))&&ce.randomBytes&&e.setPRNG((function(e,t){var r,s=ce.randomBytes(t);for(r=0;r<t;r++)e[r]=s[r];_e(s)}))}(e.exports?e.exports:self.nacl=self.nacl||{})}},t={};function r(s){var i=t[s];if(void 0!==i)return i.exports;var n=t[s]={exports:{}};return e[s](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var s in t)r.o(t,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return(()=>{"use strict";function e(e){return Uint8Array.from(atob(e),(e=>e.charCodeAt(0)))}r.r(s),r.d(s,{Arbitration:()=>Bu,BCS:()=>Oa,Bcs:()=>za,BuyRequiredEnum:()=>pu,ContextType:()=>qo,Demand:()=>Wo,ENTRYPOINT:()=>Mo,ERROR:()=>Ia,Ed25519Keypair:()=>Qn,Entity:()=>Tu,Errors:()=>Ba,FirstLetterUppercase:()=>So,FunctionGroup:()=>su,GUARD_QUERIES:()=>ru,Guard:()=>nu,GuardFunctions:()=>iu,GuardMaker:()=>ou,GuardParser:()=>gu,IsNumberType:()=>Fo,IsValidAddress:()=>oo,IsValidArgType:()=>go,IsValidArray:()=>To,IsValidBigint:()=>ho,IsValidCoinType:()=>uo,IsValidDesription:()=>so,IsValidEndpoint:()=>ao,IsValidGuardIdentifier:()=>au,IsValidInt:()=>yo,IsValidName:()=>io,IsValidName_AllowEmpty:()=>no,IsValidOperatorType:()=>Xo,IsValidPercent:()=>fo,IsValidTokenType:()=>bo,IsValidU128:()=>mo,IsValidU256:()=>_o,IsValidU64:()=>lo,IsValidU8:()=>po,IsValidValueType:()=>Jo,LogicsInfo:()=>Uo,MAX_DESCRIPTION_LENGTH:()=>Za,MAX_ENDPOINT_LENGTH:()=>to,MAX_NAME_LENGTH:()=>eo,MAX_U128:()=>Sa,MAX_U256:()=>Aa,MAX_U64:()=>Pa,MAX_U8:()=>Ca,MODULES:()=>jo,Machine:()=>Zo,OPTION_NONE:()=>ja,OperatorType:()=>ko,OperatorTypeArray:()=>No,PAYMENT_MAX_RECEIVER_COUNT:()=>Ou,ParseType:()=>Oo,Passport:()=>yu,Permission:()=>Qo,PermissionIndex:()=>Ho,PermissionInfo:()=>Ko,Progress:()=>tu,Protocol:()=>$o,Repository:()=>bu,RepositoryValueType:()=>Do,RepositoryValueTypeInfo:()=>Ro,Repository_Policy_Mode:()=>uu,Repository_Type:()=>cu,ResolveBalance:()=>xo,ResolveU64:()=>Eo,Resource:()=>vu,RpcResultParser:()=>zo,SER_VALUE:()=>Lo,Service:()=>fu,Service_Discount_Type:()=>hu,SuiClient:()=>Zs,TagName:()=>lu,TransactionBlock:()=>bs,Treasury:()=>xu,Treasury_Operation:()=>_u,Treasury_WithdrawMode:()=>mu,ValueType:()=>Yo,ValueTypeArray:()=>Vo,ValueTypeConvert:()=>ka,Wowok:()=>Eu,array_equal:()=>La,array_unique:()=>Ma,capitalize:()=>Ga,cb_U128:()=>Xa,cb_U256:()=>Ja,cb_U64:()=>Va,cb_U8:()=>Na,concatenate:()=>Fa,create_payment:()=>wu,decodeSuiPrivateKey:()=>kn,deepClone:()=>Qa,encodeSuiPrivateKey:()=>Un,fromHEX:()=>Zn,getFaucetHost:()=>Au,getSuiMoveConfig:()=>wa,getUTCDayStartByDivision:()=>co,hasDuplicates:()=>Ao,insertAtHead:()=>wo,isArr:()=>Ka,isValidHttpUrl:()=>Io,normalizeSuiAddress:()=>oe,numToUint8Array:()=>Ha,parseObjectType:()=>qa,parse_object_type:()=>$a,query_object:()=>Po,readOption:()=>Ua,readOptionString:()=>Ya,readVec:()=>Ra,requestSuiFromFaucetV0:()=>Pu,requestSuiFromFaucetV1:()=>Su,stringToUint8Array:()=>Wa,toFixed:()=>Bo,toHEX:()=>ea,uint2address:()=>Co,ulebDecode:()=>Da});const t=8192;function i(e){if(e.length<t)return btoa(String.fromCharCode(...e));let r="";for(var s=0;s<e.length;s+=t){const i=e.slice(s,s+t);r+=String.fromCharCode(...i)}return btoa(r)}const n=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let r=0;r<e.length;r++){const s=e.charAt(r),i=s.charCodeAt(0);if(255!==t[i])throw new TypeError(s+" is ambiguous");t[i]=r}const r=e.length,s=e.charAt(0),i=Math.log(r)/Math.log(256),n=Math.log(256)/Math.log(r);function a(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;let n=0,a=0,o=0;for(;e[n]===s;)a++,n++;const u=(e.length-n)*i+1>>>0,c=new Uint8Array(u);for(;e[n];){let s=t[e.charCodeAt(n)];if(255===s)return;let i=0;for(let e=u-1;(0!==s||i<o)&&-1!==e;e--,i++)s+=r*c[e]>>>0,c[e]=s%256>>>0,s=s/256>>>0;if(0!==s)throw new Error("Non-zero carry");o=i,n++}let d=u-o;for(;d!==u&&0===c[d];)d++;const h=new Uint8Array(a+(u-d));let p=a;for(;d!==u;)h[p++]=c[d++];return h}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";let i=0,a=0,o=0;const u=t.length;for(;o!==u&&0===t[o];)o++,i++;const c=(u-o)*n+1>>>0,d=new Uint8Array(c);for(;o!==u;){let e=t[o],s=0;for(let t=c-1;(0!==e||s<a)&&-1!==t;t--,s++)e+=256*d[t]>>>0,d[t]=e%r>>>0,e=e/r>>>0;if(0!==e)throw new Error("Non-zero carry");a=s,o++}let h=c-a;for(;h!==c&&0===d[h];)h++;let p=s.repeat(i);for(;h<c;++h)p+=e.charAt(d[h]);return p},decodeUnsafe:a,decode:function(e){const t=a(e);if(t)return t;throw new Error("Non-base"+r+" character")}}}("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),a=e=>n.encode(e),o=e=>n.decode(e);function u(e){const t=e.startsWith("0x")?e.slice(2):e,r=t.length%2==0?t:`0${t}}`,s=r.match(/.{2}/g)?.map((e=>parseInt(e,16)))??[];return Uint8Array.from(s)}function c(e){return e.reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),"")}function d(e){let t=[],r=0;if(0===e)return[0];for(;e>0;)t[r]=127&e,(e>>=7)&&(t[r]|=128),r+=1;return t}class h{constructor(e){this.bytePosition=0,this.dataView=new DataView(e.buffer)}shift(e){return this.bytePosition+=e,this}read8(){let e=this.dataView.getUint8(this.bytePosition);return this.shift(1),e}read16(){let e=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),e}read32(){let e=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),e}read64(){let e=this.read32(),t=this.read32().toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+t).toString(10)}read128(){let e=BigInt(this.read64()),t=BigInt(this.read64()).toString(16)+e.toString(16).padStart(16,"0");return BigInt("0x"+t).toString(10)}read256(){let e=BigInt(this.read128()),t=BigInt(this.read128()).toString(16)+e.toString(16).padStart(32,"0");return BigInt("0x"+t).toString(10)}readBytes(e){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t,e);return this.shift(e),r}readULEB(){let e=this.bytePosition+this.dataView.byteOffset,t=new Uint8Array(this.dataView.buffer,e),{value:r,length:s}=function(e){let t=0,r=0,s=0;for(;;){let i=e[s];if(s+=1,t|=(127&i)<<r,!(128&i))break;r+=7}return{value:t,length:s}}(t);return this.shift(s),r}readVec(e){let t=this.readULEB(),r=[];for(let s=0;s<t;s++)r.push(e(this,s,t));return r}}class p{constructor({initialSize:e=1024,maxSize:t=1/0,allocateSize:r=1024}={}){this.bytePosition=0,this.size=e,this.maxSize=t,this.allocateSize=r,this.dataView=new DataView(new ArrayBuffer(e))}ensureSizeOrGrow(e){const t=this.bytePosition+e;if(t>this.size){const e=Math.min(this.maxSize,this.size+this.allocateSize);if(t>e)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${t}`);this.size=e;const r=new ArrayBuffer(this.size);new Uint8Array(r).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(r)}}shift(e){return this.bytePosition+=e,this}write8(e){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(e)),this.shift(1)}write16(e){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(e),!0),this.shift(2)}write32(e){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(e),!0),this.shift(4)}write64(e){return l(BigInt(e),8).forEach((e=>this.write8(e))),this}write128(e){return l(BigInt(e),16).forEach((e=>this.write8(e))),this}write256(e){return l(BigInt(e),32).forEach((e=>this.write8(e))),this}writeULEB(e){return d(e).forEach((e=>this.write8(e))),this}writeVec(e,t){return this.writeULEB(e.length),Array.from(e).forEach(((r,s)=>t(this,r,s,e.length))),this}*[Symbol.iterator](){for(let e=0;e<this.bytePosition;e++)yield this.dataView.getUint8(e);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(e){return function(e,t){switch(t){case"base58":return a(e);case"base64":return i(e);case"hex":return c(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}(this.toBytes(),e)}}function l(e,t){let r=new Uint8Array(t),s=0;for(;e>0;)r[s]=Number(e%BigInt(256)),e/=BigInt(256),s+=1;return r}var m,_,b,g,y=e=>{throw TypeError(e)},f=(e,t,r)=>t.has(e)||y("Cannot "+r),T=(e,t,r)=>(f(e,t,"read from private field"),r?r.call(e):t.get(e)),E=(e,t,r)=>t.has(e)?y("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),v=(e,t,r,s)=>(f(e,t,"write to private field"),s?s.call(e,r):t.set(e,r),r);m=new WeakMap,_=new WeakMap;let x=class t{constructor(e){E(this,m),E(this,_),this.name=e.name,this.read=e.read,this.serializedSize=e.serializedSize??(()=>null),v(this,m,e.write),v(this,_,e.serialize??((e,t)=>{const r=new p({initialSize:this.serializedSize(e)??void 0,...t});return T(this,m).call(this,e,r),r.toBytes()})),this.validate=e.validate??(()=>{})}write(e,t){this.validate(e),T(this,m).call(this,e,t)}serialize(e,t){return this.validate(e),new B(this,T(this,_).call(this,e,t))}parse(e){const t=new h(e);return this.read(t)}fromHex(e){return this.parse(u(e))}fromBase58(e){return this.parse(o(e))}fromBase64(t){return this.parse(e(t))}transform({name:e,input:r,output:s,validate:i}){return new t({name:e??this.name,read:e=>s(this.read(e)),write:(e,t)=>T(this,m).call(this,r(e),t),serializedSize:e=>this.serializedSize(r(e)),serialize:(e,t)=>T(this,_).call(this,r(e),t),validate:e=>{i?.(e),this.validate(r(e))}})}};const O=Symbol.for("@mysten/serialized-bcs");function w(e){return!!e&&"object"==typeof e&&!0===e[O]}class B{constructor(e,t){E(this,b),E(this,g),v(this,b,e),v(this,g,t)}get[O](){return!0}toBytes(){return T(this,g)}toHex(){return c(T(this,g))}toBase64(){return i(T(this,g))}toBase58(){return a(T(this,g))}parse(){return T(this,b).parse(T(this,g))}}function I({size:e,...t}){return new x({...t,serializedSize:()=>e})}function C({readMethod:e,writeMethod:t,...r}){return I({...r,read:t=>t[e](),write:(e,r)=>r[t](e),validate:e=>{if(e<0||e>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${e}. Expected value in range 0-${r.maxValue}`);r.validate?.(e)}})}function P({readMethod:e,writeMethod:t,...r}){return I({...r,read:t=>t[e](),write:(e,r)=>r[t](BigInt(e)),validate:e=>{const t=BigInt(e);if(t<0||t>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${t}. Expected value in range 0-${r.maxValue}`);r.validate?.(t)}})}function S(e){const t=typeof e;return"string"===t?`"${e}"`:"number"===t||"bigint"===t||"boolean"===t?`${e}`:"object"===t||"function"===t?(e&&Object.getPrototypeOf(e)?.constructor?.name)??"null":t}function A(e,t,r,s,i){const n=i&&"input"in i?i.input:r.value,a=i?.expected??e.expects??null,o=i?.received??S(n),u={kind:e.kind,type:e.type,input:n,expected:a,received:o,message:`Invalid ${t}: ${a?`Expected ${a} but r`:"R"}eceived ${o}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:s.lang,abortEarly:s.abortEarly,abortPipeEarly:s.abortPipeEarly},c="schema"===e.kind,d=i?.message??e.message??(e.reference,void u.lang)??(c?void u.lang:null)??s.message??void u.lang;d&&(u.message="function"==typeof d?d(u):d),c&&(r.typed=!1),r.issues?r.issues.push(u):r.issues=[u]}function j(e,t){return Object.hasOwn(e,t)&&"__proto__"!==t&&"prototype"!==t&&"constructor"!==t}b=new WeakMap,g=new WeakMap;var k=class extends Error{issues;constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function U(e,t){return{kind:"validation",type:"check",reference:U,async:!1,expects:null,requirement:e,message:t,_run(e,t){return e.typed&&!this.requirement(e.value)&&A(this,"input",e,t),e}}}function Y(e){return{kind:"validation",type:"integer",reference:Y,async:!1,expects:null,requirement:Number.isInteger,message:e,_run(e,t){return e.typed&&!this.requirement(e.value)&&A(this,"integer",e,t),e}}}function D(e){return{kind:"transformation",type:"transform",reference:D,async:!1,operation:e,_run(e){return e.value=this.operation(e.value),e}}}function R(e,t,r){return"function"==typeof e.default?e.default(t,r):e.default}function N(e,t){return!e._run({typed:!1,value:t},{abortEarly:!0}).issues}function V(e,t){return{kind:"schema",type:"array",reference:V,expects:"Array",async:!1,item:e,message:t,_run(e,t){const r=e.value;if(Array.isArray(r)){e.typed=!0,e.value=[];for(let s=0;s<r.length;s++){const i=r[s],n=this.item._run({typed:!1,value:i},t);if(n.issues){const a={type:"array",origin:"value",input:r,key:s,value:i};for(const t of n.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||(e.issues=n.issues),t.abortEarly){e.typed=!1;break}}n.typed||(e.typed=!1),e.value.push(n.value)}}else A(this,"type",e,t);return e}}}function X(e){return{kind:"schema",type:"bigint",reference:X,expects:"bigint",async:!1,message:e,_run(e,t){return"bigint"==typeof e.value?e.typed=!0:A(this,"type",e,t),e}}}function J(e){return{kind:"schema",type:"boolean",reference:J,expects:"boolean",async:!1,message:e,_run(e,t){return"boolean"==typeof e.value?e.typed=!0:A(this,"type",e,t),e}}}function F(e){return{kind:"schema",type:"lazy",reference:F,expects:"unknown",async:!1,getter:e,_run(e,t){return this.getter(e.value)._run(e,t)}}}function q(e,t){return{kind:"schema",type:"literal",reference:q,expects:S(e),async:!1,literal:e,message:t,_run(e,t){return e.value===this.literal?e.typed=!0:A(this,"type",e,t),e}}}function L(e,...t){const r={kind:"schema",type:"nullable",reference:L,expects:`${e.expects} | null`,async:!1,wrapped:e,_run(e,t){return null===e.value&&("default"in this&&(e.value=R(this,e,t)),null===e.value)?(e.typed=!0,e):this.wrapped._run(e,t)}};return 0 in t&&(r.default=t[0]),r}function M(e,...t){const r={kind:"schema",type:"nullish",reference:M,expects:`${e.expects} | null | undefined`,async:!1,wrapped:e,_run(e,t){return null!==e.value&&void 0!==e.value||("default"in this&&(e.value=R(this,e,t)),null!==e.value&&void 0!==e.value)?this.wrapped._run(e,t):(e.typed=!0,e)}};return 0 in t&&(r.default=t[0]),r}function G(e){return{kind:"schema",type:"number",reference:G,expects:"number",async:!1,message:e,_run(e,t){return"number"!=typeof e.value||isNaN(e.value)?A(this,"type",e,t):e.typed=!0,e}}}function $(e,t){return{kind:"schema",type:"object",reference:$,expects:"Object",async:!1,entries:e,message:t,_run(e,t){const r=e.value;if(r&&"object"==typeof r){e.typed=!0,e.value={};for(const s in this.entries){const i=r[s],n=this.entries[s]._run({typed:!1,value:i},t);if(n.issues){const a={type:"object",origin:"value",input:r,key:s,value:i};for(const t of n.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||(e.issues=n.issues),t.abortEarly){e.typed=!1;break}}n.typed||(e.typed=!1),(void 0!==n.value||s in r)&&(e.value[s]=n.value)}}else A(this,"type",e,t);return e}}}function z(e,...t){const r={kind:"schema",type:"optional",reference:z,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(e,t){return void 0===e.value&&("default"in this&&(e.value=R(this,e,t)),void 0===e.value)?(e.typed=!0,e):this.wrapped._run(e,t)}};return 0 in t&&(r.default=t[0]),r}function W(e,t,r){return{kind:"schema",type:"record",reference:W,expects:"Object",async:!1,key:e,value:t,message:r,_run(e,t){const r=e.value;if(r&&"object"==typeof r){e.typed=!0,e.value={};for(const s in r)if(j(r,s)){const i=r[s],n=this.key._run({typed:!1,value:s},t);if(n.issues){const a={type:"object",origin:"key",input:r,key:s,value:i};for(const t of n.issues)t.path=[a],e.issues?.push(t);if(e.issues||(e.issues=n.issues),t.abortEarly){e.typed=!1;break}}const a=this.value._run({typed:!1,value:i},t);if(a.issues){const n={type:"object",origin:"value",input:r,key:s,value:i};for(const t of a.issues)t.path?t.path.unshift(n):t.path=[n],e.issues?.push(t);if(e.issues||(e.issues=a.issues),t.abortEarly){e.typed=!1;break}}n.typed&&a.typed||(e.typed=!1),n.typed&&(e.value[n.value]=a.value)}}else A(this,"type",e,t);return e}}}function H(e){return{kind:"schema",type:"string",reference:H,expects:"string",async:!1,message:e,_run(e,t){return"string"==typeof e.value?e.typed=!0:A(this,"type",e,t),e}}}function K(e,t){return{kind:"schema",type:"tuple",reference:K,expects:"Array",async:!1,items:e,message:t,_run(e,t){const r=e.value;if(Array.isArray(r)){e.typed=!0,e.value=[];for(let s=0;s<this.items.length;s++){const i=r[s],n=this.items[s]._run({typed:!1,value:i},t);if(n.issues){const a={type:"array",origin:"value",input:r,key:s,value:i};for(const t of n.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||(e.issues=n.issues),t.abortEarly){e.typed=!1;break}}n.typed||(e.typed=!1),e.value.push(n.value)}}else A(this,"type",e,t);return e}}}function Q(e){let t;if(e)for(const r of e)t?t.push(...r.issues):t=r.issues;return t}function Z(e,t){return{kind:"schema",type:"union",reference:Z,expects:[...new Set(e.map((e=>e.expects)))].join(" | ")||"never",async:!1,options:e,message:t,_run(e,t){let r,s,i;for(const n of this.options){const a=n._run({typed:!1,value:e.value},t);if(a.typed){if(!a.issues){r=a;break}s?s.push(a):s=[a]}else i?i.push(a):i=[a]}if(r)return r;if(s){if(1===s.length)return s[0];A(this,"type",e,t,{issues:Q(s)}),e.typed=!0}else{if(1===i?.length)return i[0];A(this,"type",e,t,{issues:Q(i)})}return e}}}function ee(){return{kind:"schema",type:"unknown",reference:ee,expects:"unknown",async:!1,_run:e=>(e.typed=!0,e)}}function te(e,t,r){const s=e._run({typed:!1,value:t},function(e){return{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}}(r));if(s.issues)throw new k(s.issues);return s.value}function re(...e){return{...e[0],pipe:e,_run(t,r){for(let s=0;s<e.length;s++){if(t.issues&&("schema"===e[s].kind||"transformation"===e[s].kind)){t.typed=!1;break}t.issues&&(r.abortEarly||r.abortPipeEarly)||(t=e[s]._run(t,r))}return t}}}function se(e){try{return 32===o(e).length}catch(e){return!1}}const ie=32;function ne(e){return function(e){return/^(0x|0X)?[a-fA-F0-9]+$/.test(e)&&e.length%2==0}(e)&&function(e){return/^(0x|0X)/.test(e)?(e.length-2)/2:e.length/2}(e)===ie}function ae(e){return ne(e)}function oe(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(2*ie,"0")}`}function ue(e,t=!1){return oe(e,t)}function ce(e){return re(Z(Object.entries(e).map((([e,t])=>$({[e]:t})))),D((e=>({...e,$kind:Object.keys(e)[0]}))))}const de=re(H(),D((e=>oe(e))),U(ne)),he=de,pe=H(),le=re(Z([H(),re(G(),Y())]),U((e=>{try{return BigInt(e),BigInt(e)>=0&&BigInt(e)<=18446744073709551615n}catch{return!1}}),"Invalid u64")),me=$({objectId:de,version:le,digest:H()}),_e=re(Z([$({GasCoin:q(!0)}),$({Input:re(G(),Y()),type:z(q("pure"))}),$({Input:re(G(),Y()),type:z(q("object"))}),$({Result:re(G(),Y())}),$({NestedResult:K([re(G(),Y()),re(G(),Y())])})]),D((e=>({...e,$kind:Object.keys(e)[0]})))),be=$({budget:L(le),price:L(le),owner:L(de),payment:L(V(me))}),ge=($({address:H(),module:H(),name:H(),typeParams:V(H())}),Z([q("address"),q("bool"),q("u8"),q("u16"),q("u32"),q("u64"),q("u128"),q("u256"),$({vector:F((()=>ge))}),$({datatype:$({package:H(),module:H(),type:H(),typeParameters:V(F((()=>ge)))})}),$({typeParameter:re(G(),Y())})])),ye=$({ref:L(Z([q("&"),q("&mut")])),body:ge}),fe=$({package:he,module:H(),function:H(),typeArguments:V(H()),arguments:V(_e),_argumentTypes:z(L(V(ye)))}),Te=$({name:H(),inputs:W(H(),Z([_e,V(_e)])),data:W(H(),ee())}),Ee=ce({MoveCall:fe,TransferObjects:$({objects:V(_e),address:_e}),SplitCoins:$({coin:_e,amounts:V(_e)}),MergeCoins:$({destination:_e,sources:V(_e)}),Publish:$({modules:V(pe),dependencies:V(he)}),MakeMoveVec:$({type:L(H()),elements:V(_e)}),Upgrade:$({modules:V(pe),dependencies:V(he),package:he,ticket:_e}),$Intent:Te}),ve=ce({ImmOrOwnedObject:me,SharedObject:$({objectId:he,initialSharedVersion:le,mutable:J()}),Receiving:me}),xe=ce({Object:ve,Pure:$({bytes:pe}),UnresolvedPure:$({value:ee()}),UnresolvedObject:$({objectId:he,version:z(L(le)),digest:z(L(H())),initialSharedVersion:z(L(le))})}),Oe=ce({Object:ve,Pure:$({bytes:pe})}),we=ce({None:q(!0),Epoch:le}),Be=$({version:q(2),sender:M(de),expiration:M(we),gasData:be,inputs:V(xe),commands:V(Ee)}),Ie={MoveCall(e){const[t,r="",s=""]="target"in e?e.target.split("::"):[e.package,e.module,e.function];return{$kind:"MoveCall",MoveCall:{package:t,module:r,function:s,typeArguments:e.typeArguments??[],arguments:e.arguments??[]}}},TransferObjects:(e,t)=>({$kind:"TransferObjects",TransferObjects:{objects:e.map((e=>te(_e,e))),address:te(_e,t)}}),SplitCoins:(e,t)=>({$kind:"SplitCoins",SplitCoins:{coin:te(_e,e),amounts:t.map((e=>te(_e,e)))}}),MergeCoins:(e,t)=>({$kind:"MergeCoins",MergeCoins:{destination:te(_e,e),sources:t.map((e=>te(_e,e)))}}),Publish:({modules:e,dependencies:t})=>({$kind:"Publish",Publish:{modules:e.map((e=>"string"==typeof e?e:i(new Uint8Array(e)))),dependencies:t.map((e=>ue(e)))}}),Upgrade:({modules:e,dependencies:t,package:r,ticket:s})=>({$kind:"Upgrade",Upgrade:{modules:e.map((e=>"string"==typeof e?e:i(new Uint8Array(e)))),dependencies:t.map((e=>ue(e))),package:r,ticket:te(_e,s)}}),MakeMoveVec:({type:e,elements:t})=>({$kind:"MakeMoveVec",MakeMoveVec:{type:e??null,elements:t.map((e=>te(_e,e)))}}),Intent:({name:e,inputs:t={},data:r={}})=>({$kind:"$Intent",$Intent:{name:e,inputs:Object.fromEntries(Object.entries(t).map((([e,t])=>[e,Array.isArray(t)?t.map((e=>te(_e,e))):te(_e,t)]))),data:r}})},Ce=/^vector<(.+)>$/,Pe=/^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;class Se{static parseFromStr(e,t=!1){if("address"===e)return{address:null};if("bool"===e)return{bool:null};if("u8"===e)return{u8:null};if("u16"===e)return{u16:null};if("u32"===e)return{u32:null};if("u64"===e)return{u64:null};if("u128"===e)return{u128:null};if("u256"===e)return{u256:null};if("signer"===e)return{signer:null};const r=e.match(Ce);if(r)return{vector:Se.parseFromStr(r[1],t)};const s=e.match(Pe);if(s)return{struct:{address:t?oe(s[1]):s[1],module:s[2],name:s[3],typeParams:void 0===s[5]?[]:Se.parseStructTypeArgs(s[5],t)}};throw new Error(`Encountered unexpected token when parsing type args for ${e}`)}static parseStructTypeArgs(e,t=!1){return function(e,t=["<",">"]){const[r,s]=t,i=[];let n="",a=0;for(let t=0;t<e.length;t++){const o=e[t];o===r&&a++,o===s&&a--,0!==a||","!==o?n+=o:(i.push(n.trim()),n="")}return i.push(n.trim()),i}(e).map((e=>Se.parseFromStr(e,t)))}static tagToString(e){if("bool"in e)return"bool";if("u8"in e)return"u8";if("u16"in e)return"u16";if("u32"in e)return"u32";if("u64"in e)return"u64";if("u128"in e)return"u128";if("u256"in e)return"u256";if("address"in e)return"address";if("signer"in e)return"signer";if("vector"in e)return`vector<${Se.tagToString(e.vector)}>`;if("struct"in e){const t=e.struct,r=t.typeParams.map(Se.tagToString).join(", ");return`${t.address}::${t.module}::${t.name}${r?`<${r}>`:""}`}throw new Error("Invalid TypeTag")}}const Ae=$({digest:H(),objectId:H(),version:Z([re(G(),Y()),H(),X()])}),je=ce({ImmOrOwned:Ae,Shared:$({objectId:he,initialSharedVersion:le,mutable:J()}),Receiving:Ae}),ke=ce({Object:je,Pure:V(re(G(),Y()))}),Ue=Z([$({kind:q("Input"),index:re(G(),Y()),value:ee(),type:z(q("object"))}),$({kind:q("Input"),index:re(G(),Y()),value:ee(),type:q("pure")})]),Ye=Z([$({Epoch:re(G(),Y())}),$({None:L(q(!0))})]),De=re(Z([G(),H(),X()]),U((e=>{if(!["string","number","bigint"].includes(typeof e))return!1;try{return BigInt(e),!0}catch{return!1}}))),Re=Z([$({bool:L(q(!0))}),$({u8:L(q(!0))}),$({u64:L(q(!0))}),$({u128:L(q(!0))}),$({address:L(q(!0))}),$({signer:L(q(!0))}),$({vector:F((()=>Re))}),$({struct:F((()=>Ne))}),$({u16:L(q(!0))}),$({u32:L(q(!0))}),$({u256:L(q(!0))})]),Ne=$({address:H(),module:H(),name:H(),typeParams:V(Re)}),Ve=$({budget:z(De),price:z(De),payment:z(V(Ae)),owner:z(H())}),Xe=Z([Ue,$({kind:q("GasCoin")}),$({kind:q("Result"),index:re(G(),Y())}),$({kind:q("NestedResult"),index:re(G(),Y()),resultIndex:re(G(),Y())})]),Je=$({kind:q("MoveCall"),target:re(H(),U((e=>3===e.split("::").length))),typeArguments:V(H()),arguments:V(Xe)}),Fe=$({kind:q("TransferObjects"),objects:V(Xe),address:Xe}),qe=$({kind:q("SplitCoins"),coin:Xe,amounts:V(Xe)}),Le=$({kind:q("MergeCoins"),destination:Xe,sources:V(Xe)}),Me=$({kind:q("MakeMoveVec"),type:Z([$({Some:Re}),$({None:L(q(!0))})]),objects:V(Xe)}),Ge=Z([Je,Fe,qe,Le,$({kind:q("Publish"),modules:V(V(re(G(),Y()))),dependencies:V(H())}),$({kind:q("Upgrade"),modules:V(V(re(G(),Y()))),dependencies:V(H()),packageId:H(),ticket:Xe}),Me]);function $e(t){const r=t.inputs.map(((t,r)=>{if(t.Object)return{kind:"Input",index:r,value:{Object:t.Object.ImmOrOwnedObject?{ImmOrOwned:t.Object.ImmOrOwnedObject}:t.Object.Receiving?{Receiving:{digest:t.Object.Receiving.digest,version:t.Object.Receiving.version,objectId:t.Object.Receiving.objectId}}:{Shared:{mutable:t.Object.SharedObject.mutable,initialSharedVersion:t.Object.SharedObject.initialSharedVersion,objectId:t.Object.SharedObject.objectId}}},type:"object"};if(t.Pure)return{kind:"Input",index:r,value:{Pure:Array.from(e(t.Pure.bytes))},type:"pure"};if(t.UnresolvedPure)return{kind:"Input",type:"pure",index:r,value:t.UnresolvedPure.value};if(t.UnresolvedObject)return{kind:"Input",type:"object",index:r,value:t.UnresolvedObject.objectId};throw new Error("Invalid input")}));return{version:1,sender:t.sender??void 0,expiration:"Epoch"===t.expiration?.$kind?{Epoch:Number(t.expiration.Epoch)}:t.expiration?{None:!0}:null,gasConfig:{owner:t.gasData.owner??void 0,budget:t.gasData.budget??void 0,price:t.gasData.price??void 0,payment:t.gasData.payment??void 0},inputs:r,transactions:t.commands.map((t=>{if(t.MakeMoveVec)return{kind:"MakeMoveVec",type:null===t.MakeMoveVec.type?{None:!0}:{Some:Se.parseFromStr(t.MakeMoveVec.type)},objects:t.MakeMoveVec.elements.map((e=>ze(e,r)))};if(t.MergeCoins)return{kind:"MergeCoins",destination:ze(t.MergeCoins.destination,r),sources:t.MergeCoins.sources.map((e=>ze(e,r)))};if(t.MoveCall)return{kind:"MoveCall",target:`${t.MoveCall.package}::${t.MoveCall.module}::${t.MoveCall.function}`,typeArguments:t.MoveCall.typeArguments,arguments:t.MoveCall.arguments.map((e=>ze(e,r)))};if(t.Publish)return{kind:"Publish",modules:t.Publish.modules.map((t=>Array.from(e(t)))),dependencies:t.Publish.dependencies};if(t.SplitCoins)return{kind:"SplitCoins",coin:ze(t.SplitCoins.coin,r),amounts:t.SplitCoins.amounts.map((e=>ze(e,r)))};if(t.TransferObjects)return{kind:"TransferObjects",objects:t.TransferObjects.objects.map((e=>ze(e,r))),address:ze(t.TransferObjects.address,r)};if(t.Upgrade)return{kind:"Upgrade",modules:t.Upgrade.modules.map((t=>Array.from(e(t)))),dependencies:t.Upgrade.dependencies,packageId:t.Upgrade.package,ticket:ze(t.Upgrade.ticket,r)};throw new Error(`Unknown transaction ${Object.keys(t)}`)}))}}function ze(e,t){if("GasCoin"===e.$kind)return{kind:"GasCoin"};if("Result"===e.$kind)return{kind:"Result",index:e.Result};if("NestedResult"===e.$kind)return{kind:"NestedResult",index:e.NestedResult[0],resultIndex:e.NestedResult[1]};if("Input"===e.$kind)return t[e.Input];throw new Error(`Invalid argument ${Object.keys(e)}`)}function We(e){switch(e.kind){case"GasCoin":return{GasCoin:!0};case"Result":return{Result:e.index};case"NestedResult":return{NestedResult:[e.index,e.resultIndex]};case"Input":return{Input:e.index}}}function He(e){return Z(Object.entries(e).map((([e,t])=>$({[e]:t}))))}$({version:q(1),sender:z(H()),expiration:M(Ye),gasConfig:Ve,inputs:V(Ue),transactions:V(Ge)});const Ke=He({GasCoin:q(!0),Input:re(G(),Y()),Result:re(G(),Y()),NestedResult:K([re(G(),Y()),re(G(),Y())])}),Qe=$({budget:L(le),price:L(le),owner:L(de),payment:L(V(me))}),Ze=$({package:he,module:H(),function:H(),typeArguments:V(H()),arguments:V(Ke)}),et=$({name:H(),inputs:W(H(),Z([Ke,V(Ke)])),data:W(H(),ee())}),tt=He({MoveCall:Ze,TransferObjects:$({objects:V(Ke),address:Ke}),SplitCoins:$({coin:Ke,amounts:V(Ke)}),MergeCoins:$({destination:Ke,sources:V(Ke)}),Publish:$({modules:V(pe),dependencies:V(he)}),MakeMoveVec:$({type:L(H()),elements:V(Ke)}),Upgrade:$({modules:V(pe),dependencies:V(he),package:he,ticket:Ke}),$Intent:et}),rt=He({ImmOrOwnedObject:me,SharedObject:$({objectId:he,initialSharedVersion:le,mutable:J()}),Receiving:me}),st=He({Object:rt,Pure:$({bytes:pe}),UnresolvedPure:$({value:ee()}),UnresolvedObject:$({objectId:he,version:z(L(le)),digest:z(L(H())),initialSharedVersion:z(L(le))})}),it=He({None:q(!0),Epoch:le}),nt=$({version:q(2),sender:M(de),expiration:M(it),gasData:Qe,inputs:V(st),commands:V(tt)}),at=function(e){return{$kind:"Pure",Pure:{bytes:e instanceof Uint8Array?i(e):e.toBase64()}}},ot=({objectId:e,digest:t,version:r})=>({$kind:"Object",Object:{$kind:"ImmOrOwnedObject",ImmOrOwnedObject:{digest:t,version:r,objectId:oe(e)}}}),ut=({objectId:e,mutable:t,initialSharedVersion:r})=>({$kind:"Object",Object:{$kind:"SharedObject",SharedObject:{mutable:t,initialSharedVersion:r,objectId:oe(e)}}}),ct=({objectId:e,digest:t,version:r})=>({$kind:"Object",Object:{$kind:"Receiving",Receiving:{digest:t,version:r,objectId:oe(e)}}}),dt={u8:e=>C({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:255,...e}),u16:e=>C({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:65535,...e}),u32:e=>C({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...e}),u64:e=>P({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...e}),u128:e=>P({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...e}),u256:e=>P({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...e}),bool:e=>I({name:"bool",size:1,read:e=>1===e.read8(),write:(e,t)=>t.write8(e?1:0),...e,validate:t=>{if(e?.validate?.(t),"boolean"!=typeof t)throw new TypeError("Expected boolean, found "+typeof t)}}),uleb128:e=>function({serialize:e,...t}){const r=new x({...t,serialize:e,write:(e,t)=>{for(const s of r.serialize(e).toBytes())t.write8(s)}});return r}({name:"uleb128",read:e=>e.readULEB(),serialize:e=>Uint8Array.from(d(e)),...e}),bytes:(e,t)=>I({name:`bytes[${e}]`,size:e,read:t=>t.readBytes(e),write:(t,r)=>{for(let s=0;s<e;s++)r.write8(t[s]??0)},...t,validate:r=>{if(t?.validate?.(r),!r||"object"!=typeof r||!("length"in r))throw new TypeError("Expected array, found "+typeof r);if(r.length!==e)throw new TypeError(`Expected array of length ${e}, found ${r.length}`)}}),string:e=>function({toBytes:e,fromBytes:t,...r}){return new x({...r,read:e=>{const r=e.readULEB(),s=e.readBytes(r);return t(s)},write:(t,r)=>{const s=e(t);r.writeULEB(s.length);for(let e=0;e<s.length;e++)r.write8(s[e])},serialize:t=>{const r=e(t),s=d(r.length),i=new Uint8Array(s.length+r.length);return i.set(s,0),i.set(r,s.length),i},validate:e=>{if("string"!=typeof e)throw new TypeError(`Invalid ${r.name} value: ${e}. Expected string`);r.validate?.(e)}})}({name:"string",toBytes:e=>(new TextEncoder).encode(e),fromBytes:e=>(new TextDecoder).decode(e),...e}),fixedArray:(e,t,r)=>new x({name:`${t.name}[${e}]`,read:r=>{const s=new Array(e);for(let i=0;i<e;i++)s[i]=t.read(r);return s},write:(e,r)=>{for(const s of e)t.write(s,r)},...r,validate:t=>{if(r?.validate?.(t),!t||"object"!=typeof t||!("length"in t))throw new TypeError("Expected array, found "+typeof t);if(t.length!==e)throw new TypeError(`Expected array of length ${e}, found ${t.length}`)}}),option:e=>dt.enum(`Option<${e.name}>`,{None:null,Some:e}).transform({input:e=>null==e?{None:!0}:{Some:e},output:e=>"Some"===e.$kind?e.Some:null}),vector:(e,t)=>new x({name:`vector<${e.name}>`,read:t=>{const r=t.readULEB(),s=new Array(r);for(let i=0;i<r;i++)s[i]=e.read(t);return s},write:(t,r)=>{r.writeULEB(t.length);for(const s of t)e.write(s,r)},...t,validate:e=>{if(t?.validate?.(e),!e||"object"!=typeof e||!("length"in e))throw new TypeError("Expected array, found "+typeof e)}}),tuple:(e,t)=>new x({name:`(${e.map((e=>e.name)).join(", ")})`,serializedSize:t=>{let r=0;for(let s=0;s<e.length;s++){const i=e[s].serializedSize(t[s]);if(null==i)return null;r+=i}return r},read:t=>{const r=[];for(const s of e)r.push(s.read(t));return r},write:(t,r)=>{for(let s=0;s<e.length;s++)e[s].write(t[s],r)},...t,validate:r=>{if(t?.validate?.(r),!Array.isArray(r))throw new TypeError("Expected array, found "+typeof r);if(r.length!==e.length)throw new TypeError(`Expected array of length ${e.length}, found ${r.length}`)}}),struct(e,t,r){const s=Object.entries(t);return new x({name:e,serializedSize:e=>{let t=0;for(const[r,i]of s){const s=i.serializedSize(e[r]);if(null==s)return null;t+=s}return t},read:e=>{const t={};for(const[r,i]of s)t[r]=i.read(e);return t},write:(e,t)=>{for(const[r,i]of s)i.write(e[r],t)},...r,validate:e=>{if(r?.validate?.(e),"object"!=typeof e||null==e)throw new TypeError("Expected object, found "+typeof e)}})},enum(e,t,r){const s=Object.entries(t);return new x({name:e,read:t=>{const r=t.readULEB(),i=s[r];if(!i)throw new TypeError(`Unknown value ${r} for enum ${e}`);const[n,a]=i;return{[n]:a?.read(t)??!0,$kind:n}},write:(e,r)=>{const[i,n]=Object.entries(e).filter((([e])=>Object.hasOwn(t,e)))[0];for(let e=0;e<s.length;e++){const[t,a]=s[e];if(t===i)return r.writeULEB(e),void a?.write(n,r)}},...r,validate:s=>{if(r?.validate?.(s),"object"!=typeof s||null==s)throw new TypeError("Expected object, found "+typeof s);const i=Object.keys(s).filter((e=>void 0!==s[e]&&Object.hasOwn(t,e)));if(1!==i.length)throw new TypeError(`Expected object with one key, but found ${i.length} for type ${e}}`);const[n]=i;if(!Object.hasOwn(t,n))throw new TypeError(`Invalid enum variant ${n}`)}})},map:(e,t)=>dt.vector(dt.tuple([e,t])).transform({name:`Map<${e.name}, ${t.name}>`,input:e=>[...e.entries()],output:e=>{const t=new Map;for(const[r,s]of e)t.set(r,s);return t}}),lazy:e=>function(e){let t=null;function r(){return t||(t=e()),t}return new x({name:"lazy",read:e=>r().read(e),serializedSize:e=>r().serializedSize(e),write:(e,t)=>r().write(e,t),serialize:(e,t)=>r().serialize(e,t).toBytes()})}(e)},ht=dt.bytes(ie).transform({validate:e=>{const t="string"==typeof e?e:c(e);if(!t||!ne(oe(t)))throw new Error(`Invalid Sui address ${t}`)},input:e=>"string"==typeof e?u(oe(e)):e,output:e=>oe(c(e))}),pt=dt.vector(dt.u8()).transform({name:"ObjectDigest",input:e=>o(e),output:e=>a(new Uint8Array(e)),validate:e=>{if(32!==o(e).length)throw new Error("ObjectDigest must be 32 bytes")}}),lt=dt.struct("SuiObjectRef",{objectId:ht,version:dt.u64(),digest:pt}),mt=dt.struct("SharedObjectRef",{objectId:ht,initialSharedVersion:dt.u64(),mutable:dt.bool()}),_t=dt.enum("ObjectArg",{ImmOrOwnedObject:lt,SharedObject:mt,Receiving:lt}),bt=dt.enum("CallArg",{Pure:dt.struct("Pure",{bytes:dt.vector(dt.u8()).transform({input:t=>"string"==typeof t?e(t):t,output:e=>i(new Uint8Array(e))})}),Object:_t}),gt=dt.enum("TypeTag",{bool:null,u8:null,u64:null,u128:null,address:null,signer:null,vector:dt.lazy((()=>gt)),struct:dt.lazy((()=>wt)),u16:null,u32:null,u256:null}),yt=gt.transform({input:e=>"string"==typeof e?Se.parseFromStr(e,!0):e,output:e=>Se.tagToString(e)}),ft=dt.enum("Argument",{GasCoin:null,Input:dt.u16(),Result:dt.u16(),NestedResult:dt.tuple([dt.u16(),dt.u16()])}),Tt=dt.struct("ProgrammableMoveCall",{package:ht,module:dt.string(),function:dt.string(),typeArguments:dt.vector(yt),arguments:dt.vector(ft)}),Et=dt.enum("Command",{MoveCall:Tt,TransferObjects:dt.struct("TransferObjects",{objects:dt.vector(ft),address:ft}),SplitCoins:dt.struct("SplitCoins",{coin:ft,amounts:dt.vector(ft)}),MergeCoins:dt.struct("MergeCoins",{destination:ft,sources:dt.vector(ft)}),Publish:dt.struct("Publish",{modules:dt.vector(dt.vector(dt.u8()).transform({input:t=>"string"==typeof t?e(t):t,output:e=>i(new Uint8Array(e))})),dependencies:dt.vector(ht)}),MakeMoveVec:dt.struct("MakeMoveVec",{type:function(e){return dt.enum("Option",{None:null,Some:e})}(yt).transform({input:e=>null===e?{None:!0}:{Some:e},output:e=>e.Some??null}),elements:dt.vector(ft)}),Upgrade:dt.struct("Upgrade",{modules:dt.vector(dt.vector(dt.u8()).transform({input:t=>"string"==typeof t?e(t):t,output:e=>i(new Uint8Array(e))})),dependencies:dt.vector(ht),package:ht,ticket:ft})}),vt=dt.struct("ProgrammableTransaction",{inputs:dt.vector(bt),commands:dt.vector(Et)}),xt=dt.enum("TransactionKind",{ProgrammableTransaction:vt,ChangeEpoch:null,Genesis:null,ConsensusCommitPrologue:null}),Ot=dt.enum("TransactionExpiration",{None:null,Epoch:dt.u64({name:"unsafe_u64"}).transform({input:e=>e,output:e=>Number(e)})});const wt=dt.struct("StructTag",{address:ht,module:dt.string(),name:dt.string(),typeParams:dt.vector(gt)}),Bt=dt.struct("GasData",{payment:dt.vector(lt),owner:ht,price:dt.u64(),budget:dt.u64()}),It=dt.struct("TransactionDataV1",{kind:xt,sender:ht,gasData:Bt,expiration:Ot}),Ct=dt.enum("TransactionData",{V1:It}),Pt=dt.enum("IntentScope",{TransactionData:null,TransactionEffects:null,CheckpointSummary:null,PersonalMessage:null}),St=dt.enum("IntentVersion",{V0:null}),At=dt.enum("AppId",{Sui:null}),jt=dt.struct("Intent",{scope:Pt,version:St,appId:At});function kt(e){return dt.struct(`IntentMessage<${e.name}>`,{intent:jt,value:e})}const Ut=dt.enum("CompressedSignature",{ED25519:dt.fixedArray(64,dt.u8()),Secp256k1:dt.fixedArray(64,dt.u8()),Secp256r1:dt.fixedArray(64,dt.u8()),ZkLogin:dt.vector(dt.u8())}),Yt=dt.enum("PublicKey",{ED25519:dt.fixedArray(32,dt.u8()),Secp256k1:dt.fixedArray(33,dt.u8()),Secp256r1:dt.fixedArray(33,dt.u8()),ZkLogin:dt.vector(dt.u8())}),Dt=dt.struct("MultiSigPkMap",{pubKey:Yt,weight:dt.u8()}),Rt=dt.struct("MultiSigPublicKey",{pk_map:dt.vector(Dt),threshold:dt.u16()}),Nt=dt.struct("MultiSig",{sigs:dt.vector(Ut),bitmap:dt.u16(),multisig_pk:Rt}),Vt=dt.vector(dt.u8()).transform({input:t=>"string"==typeof t?e(t):t,output:e=>i(new Uint8Array(e))}),Xt=dt.struct("SenderSignedTransaction",{intentMessage:kt(Ct),txSignatures:dt.vector(Vt)}),Jt=dt.vector(Xt,{name:"SenderSignedData"}),Ft=dt.enum("PackageUpgradeError",{UnableToFetchPackage:dt.struct("UnableToFetchPackage",{packageId:ht}),NotAPackage:dt.struct("NotAPackage",{objectId:ht}),IncompatibleUpgrade:null,DigestDoesNotMatch:dt.struct("DigestDoesNotMatch",{digest:dt.vector(dt.u8())}),UnknownUpgradePolicy:dt.struct("UnknownUpgradePolicy",{policy:dt.u8()}),PackageIDDoesNotMatch:dt.struct("PackageIDDoesNotMatch",{packageId:ht,ticketId:ht})}),qt=dt.struct("ModuleId",{address:ht,name:dt.string()}),Lt=dt.struct("MoveLocation",{module:qt,function:dt.u16(),instruction:dt.u16(),functionName:dt.option(dt.string())}),Mt=dt.enum("CommandArgumentError",{TypeMismatch:null,InvalidBCSBytes:null,InvalidUsageOfPureArg:null,InvalidArgumentToPrivateEntryFunction:null,IndexOutOfBounds:dt.struct("IndexOutOfBounds",{idx:dt.u16()}),SecondaryIndexOutOfBounds:dt.struct("SecondaryIndexOutOfBounds",{resultIdx:dt.u16(),secondaryIdx:dt.u16()}),InvalidResultArity:dt.struct("InvalidResultArity",{resultIdx:dt.u16()}),InvalidGasCoinUsage:null,InvalidValueUsage:null,InvalidObjectByValue:null,InvalidObjectByMutRef:null,SharedObjectOperationNotAllowed:null}),Gt=dt.enum("TypeArgumentError",{TypeNotFound:null,ConstraintNotSatisfied:null}),$t=dt.enum("ExecutionFailureStatus",{InsufficientGas:null,InvalidGasObject:null,InvariantViolation:null,FeatureNotYetSupported:null,MoveObjectTooBig:dt.struct("MoveObjectTooBig",{objectSize:dt.u64(),maxObjectSize:dt.u64()}),MovePackageTooBig:dt.struct("MovePackageTooBig",{objectSize:dt.u64(),maxObjectSize:dt.u64()}),CircularObjectOwnership:dt.struct("CircularObjectOwnership",{object:ht}),InsufficientCoinBalance:null,CoinBalanceOverflow:null,PublishErrorNonZeroAddress:null,SuiMoveVerificationError:null,MovePrimitiveRuntimeError:dt.option(Lt),MoveAbort:dt.tuple([Lt,dt.u64()]),VMVerificationOrDeserializationError:null,VMInvariantViolation:null,FunctionNotFound:null,ArityMismatch:null,TypeArityMismatch:null,NonEntryFunctionInvoked:null,CommandArgumentError:dt.struct("CommandArgumentError",{argIdx:dt.u16(),kind:Mt}),TypeArgumentError:dt.struct("TypeArgumentError",{argumentIdx:dt.u16(),kind:Gt}),UnusedValueWithoutDrop:dt.struct("UnusedValueWithoutDrop",{resultIdx:dt.u16(),secondaryIdx:dt.u16()}),InvalidPublicFunctionReturnType:dt.struct("InvalidPublicFunctionReturnType",{idx:dt.u16()}),InvalidTransferObject:null,EffectsTooLarge:dt.struct("EffectsTooLarge",{currentSize:dt.u64(),maxSize:dt.u64()}),PublishUpgradeMissingDependency:null,PublishUpgradeDependencyDowngrade:null,PackageUpgradeError:dt.struct("PackageUpgradeError",{upgradeError:Ft}),WrittenObjectsTooLarge:dt.struct("WrittenObjectsTooLarge",{currentSize:dt.u64(),maxSize:dt.u64()}),CertificateDenied:null,SuiMoveVerificationTimedout:null,SharedObjectOperationNotAllowed:null,InputObjectDeleted:null}),zt=dt.enum("ExecutionStatus",{Success:null,Failed:dt.struct("ExecutionFailed",{error:$t,command:dt.option(dt.u64())})}),Wt=dt.struct("GasCostSummary",{computationCost:dt.u64(),storageCost:dt.u64(),storageRebate:dt.u64(),nonRefundableStorageFee:dt.u64()}),Ht=dt.enum("Owner",{AddressOwner:ht,ObjectOwner:ht,Shared:dt.struct("Shared",{initialSharedVersion:dt.u64()}),Immutable:null}),Kt=dt.struct("TransactionEffectsV1",{status:zt,executedEpoch:dt.u64(),gasUsed:Wt,modifiedAtVersions:dt.vector(dt.tuple([ht,dt.u64()])),sharedObjects:dt.vector(lt),transactionDigest:pt,created:dt.vector(dt.tuple([lt,Ht])),mutated:dt.vector(dt.tuple([lt,Ht])),unwrapped:dt.vector(dt.tuple([lt,Ht])),deleted:dt.vector(lt),unwrappedThenDeleted:dt.vector(lt),wrapped:dt.vector(lt),gasObject:dt.tuple([lt,Ht]),eventsDigest:dt.option(pt),dependencies:dt.vector(pt)}),Qt=dt.tuple([dt.u64(),pt]),Zt=dt.enum("ObjectIn",{NotExist:null,Exist:dt.tuple([Qt,Ht])}),er=dt.enum("ObjectOut",{NotExist:null,ObjectWrite:dt.tuple([pt,Ht]),PackageWrite:Qt}),tr=dt.enum("IDOperation",{None:null,Created:null,Deleted:null}),rr=dt.struct("EffectsObjectChange",{inputState:Zt,outputState:er,idOperation:tr}),sr=dt.enum("UnchangedSharedKind",{ReadOnlyRoot:Qt,MutateDeleted:dt.u64(),ReadDeleted:dt.u64(),Cancelled:dt.u64(),PerEpochConfig:null}),ir=dt.struct("TransactionEffectsV2",{status:zt,executedEpoch:dt.u64(),gasUsed:Wt,transactionDigest:pt,gasObjectIndex:dt.option(dt.u32()),eventsDigest:dt.option(pt),dependencies:dt.vector(pt),lamportVersion:dt.u64(),changedObjects:dt.vector(dt.tuple([ht,rr])),unchangedSharedObjects:dt.vector(dt.tuple([ht,sr])),auxDataDigest:dt.option(pt)}),nr=dt.enum("TransactionEffects",{V1:Kt,V2:ir}),ar={...dt,U8:dt.u8(),U16:dt.u16(),U32:dt.u32(),U64:dt.u64(),U128:dt.u128(),U256:dt.u256(),ULEB128:dt.uleb128(),Bool:dt.bool(),String:dt.string(),Address:ht,AppId:At,Argument:ft,CallArg:bt,CompressedSignature:Ut,GasData:Bt,Intent:jt,IntentMessage:kt,IntentScope:Pt,IntentVersion:St,MultiSig:Nt,MultiSigPkMap:Dt,MultiSigPublicKey:Rt,ObjectArg:_t,ObjectDigest:pt,ProgrammableMoveCall:Tt,ProgrammableTransaction:vt,PublicKey:Yt,SenderSignedData:Jt,SenderSignedTransaction:Xt,SharedObjectRef:mt,StructTag:wt,SuiObjectRef:lt,Command:Et,TransactionData:Ct,TransactionDataV1:It,TransactionExpiration:Ot,TransactionKind:xt,TypeTag:yt,TransactionEffects:nr},or=(BigInt(1e9),ue("0x6"),"0x2::sui::SUI");function ur(e){if("string"==typeof e)switch(e){case"address":return ar.Address;case"bool":return ar.Bool;case"u8":return ar.U8;case"u16":return ar.U16;case"u32":return ar.U32;case"u64":return ar.U64;case"u128":return ar.U128;case"u256":return ar.U256;default:throw new Error(`Unknown type signature ${e}`)}if("vector"in e){if("u8"===e.vector)return ar.vector(ar.U8).transform({input:e=>"string"==typeof e?(new TextEncoder).encode(e):e,output:e=>e});const t=ur(e.vector);return t?ar.vector(t):null}if("datatype"in e){const t=oe(e.datatype.package);if(t===oe("0x1")){if("ascii"===e.datatype.module&&"String"===e.datatype.type)return ar.String;if("string"===e.datatype.module&&"String"===e.datatype.type)return ar.String;if("option"===e.datatype.module&&"Option"===e.datatype.type){const t=ur(e.datatype.typeParameters[0]);return t?ar.vector(t):null}}if(t===oe("0x2")&&"object"===e.datatype.module&&"ID"===e.datatype.type)return ar.Address}return null}function cr(e){if("string"==typeof e)switch(e){case"Address":return"address";case"Bool":return"bool";case"U8":return"u8";case"U16":return"u16";case"U32":return"u32";case"U64":return"u64";case"U128":return"u128";case"U256":return"u256";default:throw new Error(`Unexpected type ${e}`)}if("Vector"in e)return{vector:cr(e.Vector)};if("Struct"in e)return{datatype:{package:e.Struct.address,module:e.Struct.module,type:e.Struct.name,typeParameters:e.Struct.typeArguments.map(cr)}};if("TypeParameter"in e)return{typeParameter:e.TypeParameter};throw new Error(`Unexpected type ${JSON.stringify(e)}`)}ue("0x5");async function dr(e,t,r){return await async function(e,t){const{inputs:r,commands:s}=e,i=[],n=new Set;s.forEach((t=>{if(t.MoveCall){if(t.MoveCall._argumentTypes)return;if(t.MoveCall.arguments.map((t=>"Input"===t.$kind?e.inputs[t.Input]:null)).some((e=>e?.UnresolvedPure||e?.UnresolvedObject))){const e=`${t.MoveCall.package}::${t.MoveCall.module}::${t.MoveCall.function}`;n.add(e),i.push(t.MoveCall)}}switch(t.$kind){case"SplitCoins":t.SplitCoins.amounts.forEach((t=>{hr(t,ar.U64,e)}));break;case"TransferObjects":hr(t.TransferObjects.address,ar.Address,e)}}));const a=new Map;if(n.size>0){const e=mr(t);await Promise.all([...n].map((async t=>{const[r,s,i]=t.split("::"),n=await e.getNormalizedMoveFunction({package:r,module:s,function:i});a.set(t,n.parameters.map((e=>function(e){return"object"==typeof e&&"Reference"in e?{ref:"&",body:cr(e.Reference)}:"object"==typeof e&&"MutableReference"in e?{ref:"&mut",body:cr(e.MutableReference)}:{ref:null,body:cr(e)}}(e))))})))}i.length&&await Promise.all(i.map((async e=>{const t=a.get(`${e.package}::${e.module}::${e.function}`);if(!t)return;const r=t.length>0&&function(e){const t="object"==typeof e.body&&"datatype"in e.body?e.body.datatype:null;return!!t&&oe(t.package)===oe("0x2")&&"tx_context"===t.module&&"TxContext"===t.type}(t.at(-1))?t.slice(0,t.length-1):t;e._argumentTypes=r}))),s.forEach((e=>{if(!e.MoveCall)return;const t=e.MoveCall,s=`${t.package}::${t.module}::${t.function}`,i=t._argumentTypes;if(i){if(i.length!==e.MoveCall.arguments.length)throw new Error(`Incorrect number of arguments for ${s}`);i.forEach(((e,s)=>{const i=t.arguments[s];if("Input"!==i.$kind)return;const n=r[i.Input];if(!n.UnresolvedPure&&!n.UnresolvedObject)return;const a=n.UnresolvedPure?.value??n.UnresolvedObject?.objectId,o=ur(e.body);if(o)return i.type="pure",void(r[r.indexOf(n)]=at(o.serialize(a)));if("string"!=typeof a)throw new Error(`Expect the argument to be an object id string, got ${JSON.stringify(a,null,2)}`);i.type="object";const u=n.UnresolvedPure?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:a}}:n;r[i.Input]=u}))}}))}(e,t),await async function(e,t){const r=e.inputs.filter((e=>e.UnresolvedObject&&!(e.UnresolvedObject.version||e.UnresolvedObject?.initialSharedVersion))),s=[...new Set(r.map((e=>ue(e.UnresolvedObject.objectId))))],i=s.length?(u=s,Array.from({length:Math.ceil(u.length/50)},((e,t)=>u.slice(50*t,50*t+50)))):[],n=(await Promise.all(i.map((e=>mr(t).multiGetObjects({ids:e,options:{showOwner:!0}}))))).flat(),a=new Map(s.map(((e,t)=>[e,n[t]]))),o=Array.from(a).filter((([e,t])=>t.error)).map((([e,t])=>JSON.stringify(t.error)));var u;if(o.length)throw new Error(`The following input objects are invalid: ${o.join(", ")}`);const c=n.map((e=>{if(e.error||!e.data)throw new Error(`Failed to fetch object: ${e.error}`);const t=e.data.owner,r=t&&"object"==typeof t&&"Shared"in t?t.Shared.initial_shared_version:null;return{objectId:e.data.objectId,digest:e.data.digest,version:e.data.version,initialSharedVersion:r}})),d=new Map(s.map(((e,t)=>[e,c[t]])));for(const[t,r]of e.inputs.entries()){if(!r.UnresolvedObject)continue;let s;const i=oe(r.UnresolvedObject.objectId),n=d.get(i);r.UnresolvedObject.initialSharedVersion??n?.initialSharedVersion?s=ut({objectId:i,initialSharedVersion:r.UnresolvedObject.initialSharedVersion||n?.initialSharedVersion,mutable:pr(e,t)}):lr(e,t)&&(s=ct({objectId:i,digest:r.UnresolvedObject.digest??n?.digest,version:r.UnresolvedObject.version??n?.version})),e.inputs[e.inputs.indexOf(r)]=s??ot({objectId:i,digest:r.UnresolvedObject.digest??n?.digest,version:r.UnresolvedObject.version??n?.version})}}(e,t),t.onlyTransactionKind||(await async function(e,t){e.gasConfig.price||(e.gasConfig.price=String(await mr(t).getReferenceGasPrice()))}(e,t),await async function(e,t){if(e.gasConfig.budget)return;const r=await mr(t).dryRunTransactionBlock({transactionBlock:e.build({overrides:{gasData:{budget:String(5e10),payment:[]}}})});if("success"!==r.effects.status.status)throw new Error(`Dry run failed, could not automatically determine a budget: ${r.effects.status.error}`,{cause:r});const s=1000n*BigInt(e.gasConfig.price||1n),i=BigInt(r.effects.gasUsed.computationCost)+s,n=i+BigInt(r.effects.gasUsed.storageCost)-BigInt(r.effects.gasUsed.storageRebate);e.gasConfig.budget=String(n>i?n:i)}(e,t),await async function(e,t){if(!e.gasConfig.payment){const r=(await mr(t).getCoins({owner:e.gasConfig.owner||e.sender,coinType:or})).data.filter((t=>!e.inputs.find((e=>!!e.Object?.ImmOrOwnedObject&&t.coinObjectId===e.Object.ImmOrOwnedObject.objectId)))).map((e=>({objectId:e.coinObjectId,digest:e.digest,version:e.version})));if(!r.length)throw new Error("No valid gas coins found for the transaction.");e.gasConfig.payment=r.map((e=>te(me,e)))}}(e,t)),await function(e){e.inputs.forEach(((e,t)=>{if("Object"!==e.$kind&&"Pure"!==e.$kind)throw new Error(`Input at index ${t} has not been resolved. Expected a Pure or Object input, but found ${JSON.stringify(e)}`)}))}(e),await r()}function hr(e,t,r){if("Input"!==e.$kind)return;const s=r.inputs[e.Input];"UnresolvedPure"===s.$kind&&(r.inputs[e.Input]=at(t.serialize(s.UnresolvedPure.value)))}function pr(e,t){let r=!1;return e.getInputUses(t,((e,t)=>{if(t.MoveCall&&t.MoveCall._argumentTypes){const s=t.MoveCall.arguments.indexOf(e);r="&"!==t.MoveCall._argumentTypes[s].ref||r}"MakeMoveVec"!==t.$kind&&"MergeCoins"!==t.$kind&&"SplitCoins"!==t.$kind||(r=!0)})),r}function lr(e,t){let r=!1;return e.getInputUses(t,((e,t)=>{if(t.MoveCall&&t.MoveCall._argumentTypes){const s=t.MoveCall.arguments.indexOf(e);r=function(e){return"object"==typeof e.body&&"datatype"in e.body&&("0x2"===e.body.datatype.package&&"transfer"===e.body.datatype.module&&"Receiving"===e.body.datatype.type)}(t.MoveCall._argumentTypes[s])||r}})),r}function mr(e){if(!e.client)throw new Error("No provider passed to Transaction#build, but transaction data was not sufficient to build offline.");return e.client}function _r(e){function t(t,r){if("string"==typeof t)return e(br(t).serialize(r));if(t instanceof Uint8Array||w(t))return e(t);throw new Error("tx.pure must be called either a bcs type name, or a serialized bcs value")}return t.u8=t=>e(ar.U8.serialize(t)),t.u16=t=>e(ar.U16.serialize(t)),t.u32=t=>e(ar.U32.serialize(t)),t.u64=t=>e(ar.U64.serialize(t)),t.u128=t=>e(ar.U128.serialize(t)),t.u256=t=>e(ar.U256.serialize(t)),t.bool=t=>e(ar.Bool.serialize(t)),t.string=t=>e(ar.String.serialize(t)),t.address=t=>e(ar.Address.serialize(t)),t.id=t.address,t.vector=(t,r)=>e(ar.vector(br(t)).serialize(r)),t.option=(t,r)=>e(ar.option(br(t)).serialize(r)),t}function br(e){switch(e){case"u8":return ar.u8();case"u16":return ar.u16();case"u32":return ar.u32();case"u64":return ar.u64();case"u128":return ar.u128();case"u256":return ar.u256();case"bool":return ar.bool();case"string":return ar.string();case"id":case"address":return ar.Address}const t=e.match(/^(vector|option)<(.+)>$/);if(t){const[e,r]=t.slice(1);return"vector"===e?ar.vector(br(r)):ar.option(br(r))}throw new Error(`Invalid Pure type name: ${e}`)}function gr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function yr(e,...t){if(!function(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function fr(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");gr(e.outputLen),gr(e.blockLen)}function Tr(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Er(e,t){yr(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function vr(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function xr(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const Or=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();function wr(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const Br=Or?e=>e:e=>wr(e);function Ir(e){for(let t=0;t<e.length;t++)e[t]=wr(e[t])}const Cr=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Pr(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0}function Sr(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),yr(e),e}class Ar{clone(){return this._cloneInto()}}function jr(e){const t=t=>e().update(Sr(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function kr(e){const t=(t,r)=>e(r).update(Sr(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}const Ur=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]);class Yr extends Ar{constructor(e,t,r={},s,i,n){if(super(),this.blockLen=e,this.outputLen=t,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,gr(e),gr(t),gr(s),t<0||t>s)throw new Error("outputLen bigger than keyLen");if(void 0!==r.key&&(r.key.length<1||r.key.length>s))throw new Error("key length must be undefined or 1.."+s);if(void 0!==r.salt&&r.salt.length!==i)throw new Error("salt must be undefined or "+i);if(void 0!==r.personalization&&r.personalization.length!==n)throw new Error("personalization must be undefined or "+n);this.buffer=new Uint8Array(e),this.buffer32=vr(this.buffer)}update(e){Tr(this);const{blockLen:t,buffer:r,buffer32:s}=this,i=(e=Sr(e)).length,n=e.byteOffset,a=e.buffer;for(let o=0;o<i;){this.pos===t&&(Or||Ir(s),this.compress(s,0,!1),Or||Ir(s),this.pos=0);const u=Math.min(t-this.pos,i-o),c=n+o;if(u!==t||c%4||!(o+u<i))r.set(e.subarray(o,o+u),this.pos),this.pos+=u,this.length+=u,o+=u;else{const e=new Uint32Array(a,c,Math.floor((i-o)/4));Or||Ir(e);for(let r=0;o+t<i;r+=s.length,o+=t)this.length+=t,this.compress(e,r,!1);Or||Ir(e)}}return this}digestInto(e){Tr(this),Er(e,this);const{pos:t,buffer32:r}=this;this.finished=!0,this.buffer.subarray(t).fill(0),Or||Ir(r),this.compress(r,0,!0),Or||Ir(r);const s=vr(e);this.get().forEach(((e,t)=>s[t]=Br(e)))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){const{buffer:t,length:r,finished:s,destroyed:i,outputLen:n,pos:a}=this;return e||(e=new this.constructor({dkLen:n})),e.set(...this.get()),e.length=r,e.finished=s,e.destroyed=i,e.outputLen=n,e.buffer.set(t),e.pos=a,e}}const Dr=BigInt(2**32-1),Rr=BigInt(32);function Nr(e,t=!1){return t?{h:Number(e&Dr),l:Number(e>>Rr&Dr)}:{h:0|Number(e>>Rr&Dr),l:0|Number(e&Dr)}}const Vr={fromBig:Nr,split:function(e,t=!1){let r=new Uint32Array(e.length),s=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:n,l:a}=Nr(e[i],t);[r[i],s[i]]=[n,a]}return[r,s]},toBig:(e,t)=>BigInt(e>>>0)<<Rr|BigInt(t>>>0),shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,r)=>e<<r|t>>>32-r,rotlSL:(e,t,r)=>t<<r|e>>>32-r,rotlBH:(e,t,r)=>t<<r-32|e>>>64-r,rotlBL:(e,t,r)=>e<<r-32|t>>>64-r,add:function(e,t,r,s){const i=(t>>>0)+(s>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,s)=>t+r+s+(e/2**32|0)|0,add4L:(e,t,r,s)=>(e>>>0)+(t>>>0)+(r>>>0)+(s>>>0),add4H:(e,t,r,s,i)=>t+r+s+i+(e/2**32|0)|0,add5H:(e,t,r,s,i,n)=>t+r+s+i+n+(e/2**32|0)|0,add5L:(e,t,r,s,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(s>>>0)+(i>>>0)},Xr=Vr,Jr=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Fr=new Uint32Array(32);function qr(e,t,r,s,i,n){const a=i[n],o=i[n+1];let u=Fr[2*e],c=Fr[2*e+1],d=Fr[2*t],h=Fr[2*t+1],p=Fr[2*r],l=Fr[2*r+1],m=Fr[2*s],_=Fr[2*s+1],b=Xr.add3L(u,d,a);c=Xr.add3H(b,c,h,o),u=0|b,({Dh:_,Dl:m}={Dh:_^c,Dl:m^u}),({Dh:_,Dl:m}={Dh:Xr.rotr32H(_,m),Dl:Xr.rotr32L(_,m)}),({h:l,l:p}=Xr.add(l,p,_,m)),({Bh:h,Bl:d}={Bh:h^l,Bl:d^p}),({Bh:h,Bl:d}={Bh:Xr.rotrSH(h,d,24),Bl:Xr.rotrSL(h,d,24)}),Fr[2*e]=u,Fr[2*e+1]=c,Fr[2*t]=d,Fr[2*t+1]=h,Fr[2*r]=p,Fr[2*r+1]=l,Fr[2*s]=m,Fr[2*s+1]=_}function Lr(e,t,r,s,i,n){const a=i[n],o=i[n+1];let u=Fr[2*e],c=Fr[2*e+1],d=Fr[2*t],h=Fr[2*t+1],p=Fr[2*r],l=Fr[2*r+1],m=Fr[2*s],_=Fr[2*s+1],b=Xr.add3L(u,d,a);c=Xr.add3H(b,c,h,o),u=0|b,({Dh:_,Dl:m}={Dh:_^c,Dl:m^u}),({Dh:_,Dl:m}={Dh:Xr.rotrSH(_,m,16),Dl:Xr.rotrSL(_,m,16)}),({h:l,l:p}=Xr.add(l,p,_,m)),({Bh:h,Bl:d}={Bh:h^l,Bl:d^p}),({Bh:h,Bl:d}={Bh:Xr.rotrBH(h,d,63),Bl:Xr.rotrBL(h,d,63)}),Fr[2*e]=u,Fr[2*e+1]=c,Fr[2*t]=d,Fr[2*t+1]=h,Fr[2*r]=p,Fr[2*r+1]=l,Fr[2*s]=m,Fr[2*s+1]=_}class Mr extends Yr{constructor(e={}){super(128,void 0===e.dkLen?64:e.dkLen,e,64,16,16),this.v0l=0|Jr[0],this.v0h=0|Jr[1],this.v1l=0|Jr[2],this.v1h=0|Jr[3],this.v2l=0|Jr[4],this.v2h=0|Jr[5],this.v3l=0|Jr[6],this.v3h=0|Jr[7],this.v4l=0|Jr[8],this.v4h=0|Jr[9],this.v5l=0|Jr[10],this.v5h=0|Jr[11],this.v6l=0|Jr[12],this.v6h=0|Jr[13],this.v7l=0|Jr[14],this.v7h=0|Jr[15];const t=e.key?e.key.length:0;if(this.v0l^=this.outputLen|t<<8|65536|1<<24,e.salt){const t=vr(Sr(e.salt));this.v4l^=Br(t[0]),this.v4h^=Br(t[1]),this.v5l^=Br(t[2]),this.v5h^=Br(t[3])}if(e.personalization){const t=vr(Sr(e.personalization));this.v6l^=Br(t[0]),this.v6h^=Br(t[1]),this.v7l^=Br(t[2]),this.v7h^=Br(t[3])}if(e.key){const t=new Uint8Array(this.blockLen);t.set(Sr(e.key)),this.update(t)}}get(){let{v0l:e,v0h:t,v1l:r,v1h:s,v2l:i,v2h:n,v3l:a,v3h:o,v4l:u,v4h:c,v5l:d,v5h:h,v6l:p,v6h:l,v7l:m,v7h:_}=this;return[e,t,r,s,i,n,a,o,u,c,d,h,p,l,m,_]}set(e,t,r,s,i,n,a,o,u,c,d,h,p,l,m,_){this.v0l=0|e,this.v0h=0|t,this.v1l=0|r,this.v1h=0|s,this.v2l=0|i,this.v2h=0|n,this.v3l=0|a,this.v3h=0|o,this.v4l=0|u,this.v4h=0|c,this.v5l=0|d,this.v5h=0|h,this.v6l=0|p,this.v6h=0|l,this.v7l=0|m,this.v7h=0|_}compress(e,t,r){this.get().forEach(((e,t)=>Fr[t]=e)),Fr.set(Jr,16);let{h:s,l:i}=Xr.fromBig(BigInt(this.length));Fr[24]=Jr[8]^i,Fr[25]=Jr[9]^s,r&&(Fr[28]=~Fr[28],Fr[29]=~Fr[29]);let n=0;const a=Ur;for(let r=0;r<12;r++)qr(0,4,8,12,e,t+2*a[n++]),Lr(0,4,8,12,e,t+2*a[n++]),qr(1,5,9,13,e,t+2*a[n++]),Lr(1,5,9,13,e,t+2*a[n++]),qr(2,6,10,14,e,t+2*a[n++]),Lr(2,6,10,14,e,t+2*a[n++]),qr(3,7,11,15,e,t+2*a[n++]),Lr(3,7,11,15,e,t+2*a[n++]),qr(0,5,10,15,e,t+2*a[n++]),Lr(0,5,10,15,e,t+2*a[n++]),qr(1,6,11,12,e,t+2*a[n++]),Lr(1,6,11,12,e,t+2*a[n++]),qr(2,7,8,13,e,t+2*a[n++]),Lr(2,7,8,13,e,t+2*a[n++]),qr(3,4,9,14,e,t+2*a[n++]),Lr(3,4,9,14,e,t+2*a[n++]);this.v0l^=Fr[0]^Fr[16],this.v0h^=Fr[1]^Fr[17],this.v1l^=Fr[2]^Fr[18],this.v1h^=Fr[3]^Fr[19],this.v2l^=Fr[4]^Fr[20],this.v2h^=Fr[5]^Fr[21],this.v3l^=Fr[6]^Fr[22],this.v3h^=Fr[7]^Fr[23],this.v4l^=Fr[8]^Fr[24],this.v4h^=Fr[9]^Fr[25],this.v5l^=Fr[10]^Fr[26],this.v5h^=Fr[11]^Fr[27],this.v6l^=Fr[12]^Fr[28],this.v6h^=Fr[13]^Fr[29],this.v7l^=Fr[14]^Fr[30],this.v7h^=Fr[15]^Fr[31],Fr.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Gr=kr((e=>new Mr(e)));function $r(e){return oe(e).replace("0x","")}class zr{constructor(e){this.version=2,this.sender=e?.sender??null,this.expiration=e?.expiration??null,this.inputs=e?.inputs??[],this.commands=e?.commands??[],this.gasData=e?.gasData??{budget:null,price:null,owner:null,payment:null}}static fromKindBytes(e){const t=ar.TransactionKind.parse(e).ProgrammableTransaction;if(!t)throw new Error("Unable to deserialize from bytes.");return zr.restore({version:2,sender:null,expiration:null,gasData:{budget:null,owner:null,payment:null,price:null},inputs:t.inputs,commands:t.commands})}static fromBytes(e){const t=ar.TransactionData.parse(e),r=t?.V1,s=r.kind.ProgrammableTransaction;if(!r||!s)throw new Error("Unable to deserialize from bytes.");return zr.restore({version:2,sender:r.sender,expiration:r.expiration,gasData:r.gasData,inputs:s.inputs,commands:s.commands})}static restore(e){return 2===e.version?new zr(te(Be,e)):new zr(te(Be,function(e){return te(Be,{version:2,sender:e.sender??null,expiration:e.expiration?"Epoch"in e.expiration?{Epoch:e.expiration.Epoch}:{None:!0}:null,gasData:{owner:e.gasConfig.owner??null,budget:e.gasConfig.budget?.toString()??null,price:e.gasConfig.price?.toString()??null,payment:e.gasConfig.payment?.map((e=>({digest:e.digest,objectId:e.objectId,version:e.version.toString()})))??null},inputs:e.inputs.map((e=>{if("Input"===e.kind){if(N(ke,e.value)){const t=te(ke,e.value);if(t.Object){if(t.Object.ImmOrOwned)return{Object:{ImmOrOwnedObject:{objectId:t.Object.ImmOrOwned.objectId,version:String(t.Object.ImmOrOwned.version),digest:t.Object.ImmOrOwned.digest}}};if(t.Object.Shared)return{Object:{SharedObject:{mutable:t.Object.Shared.mutable??null,initialSharedVersion:t.Object.Shared.initialSharedVersion,objectId:t.Object.Shared.objectId}}};if(t.Object.Receiving)return{Object:{Receiving:{digest:t.Object.Receiving.digest,version:String(t.Object.Receiving.version),objectId:t.Object.Receiving.objectId}}};throw new Error("Invalid object input")}return{Pure:{bytes:i(new Uint8Array(t.Pure))}}}return"object"===e.type?{UnresolvedObject:{objectId:e.value}}:{UnresolvedPure:{value:e.value}}}throw new Error("Invalid input")})),commands:e.transactions.map((e=>{switch(e.kind){case"MakeMoveVec":return{MakeMoveVec:{type:"Some"in e.type?Se.tagToString(e.type.Some):null,elements:e.objects.map((e=>We(e)))}};case"MergeCoins":return{MergeCoins:{destination:We(e.destination),sources:e.sources.map((e=>We(e)))}};case"MoveCall":{const[t,r,s]=e.target.split("::");return{MoveCall:{package:t,module:r,function:s,typeArguments:e.typeArguments,arguments:e.arguments.map((e=>We(e)))}}}case"Publish":return{Publish:{modules:e.modules.map((e=>i(Uint8Array.from(e)))),dependencies:e.dependencies}};case"SplitCoins":return{SplitCoins:{coin:We(e.coin),amounts:e.amounts.map((e=>We(e)))}};case"TransferObjects":return{TransferObjects:{objects:e.objects.map((e=>We(e))),address:We(e.address)}};case"Upgrade":return{Upgrade:{modules:e.modules.map((e=>i(Uint8Array.from(e)))),dependencies:e.dependencies,package:e.packageId,ticket:We(e.ticket)}}}throw new Error(`Unknown transaction ${Object.keys(e)}`)}))})}(e)))}static getDigestFromBytes(e){const t=function(e,t){const r=Array.from("TransactionData::").map((e=>e.charCodeAt(0))),s=new Uint8Array(r.length+t.length);return s.set(r),s.set(t,r.length),Gr(s,{dkLen:32})}(0,e);return a(t)}get gasConfig(){return this.gasData}set gasConfig(e){this.gasData=e}build({maxSizeBytes:e=1/0,overrides:t,onlyTransactionKind:r}={}){const s=this.inputs,i=this.commands,n={ProgrammableTransaction:{inputs:s,commands:i}};if(r)return ar.TransactionKind.serialize(n,{maxSize:e}).toBytes();const a=t?.expiration??this.expiration,o=t?.sender??this.sender,u={...this.gasData,...t?.gasConfig,...t?.gasData};if(!o)throw new Error("Missing transaction sender");if(!u.budget)throw new Error("Missing gas budget");if(!u.payment)throw new Error("Missing gas payment");if(!u.price)throw new Error("Missing gas price");const c={sender:$r(o),expiration:a||{None:!0},gasData:{payment:u.payment,owner:$r(this.gasData.owner??o),price:BigInt(u.price),budget:BigInt(u.budget)},kind:{ProgrammableTransaction:{inputs:s,commands:i}}};return ar.TransactionData.serialize({V1:c},{maxSize:e}).toBytes()}addInput(e,t){const r=this.inputs.length;return this.inputs.push(t),{Input:r,type:e,$kind:"Input"}}getInputUses(e,t){this.mapArguments(((r,s)=>("Input"===r.$kind&&r.Input===e&&t(r,s),r)))}mapArguments(e){for(const t of this.commands)switch(t.$kind){case"MoveCall":t.MoveCall.arguments=t.MoveCall.arguments.map((r=>e(r,t)));break;case"TransferObjects":t.TransferObjects.objects=t.TransferObjects.objects.map((r=>e(r,t))),t.TransferObjects.address=e(t.TransferObjects.address,t);break;case"SplitCoins":t.SplitCoins.coin=e(t.SplitCoins.coin,t),t.SplitCoins.amounts=t.SplitCoins.amounts.map((r=>e(r,t)));break;case"MergeCoins":t.MergeCoins.destination=e(t.MergeCoins.destination,t),t.MergeCoins.sources=t.MergeCoins.sources.map((r=>e(r,t)));break;case"MakeMoveVec":t.MakeMoveVec.elements=t.MakeMoveVec.elements.map((r=>e(r,t)));break;case"Upgrade":t.Upgrade.ticket=e(t.Upgrade.ticket,t);break;case"$Intent":const r=t.$Intent.inputs;t.$Intent.inputs={};for(const[s,i]of Object.entries(r))t.$Intent.inputs[s]=Array.isArray(i)?i.map((r=>e(r,t))):e(i,t);break;case"Publish":break;default:throw new Error(`Unexpected transaction kind: ${t.$kind}`)}}replaceCommand(e,t){if(!Array.isArray(t))return void(this.commands[e]=t);const r=t.length-1;this.commands.splice(e,1,...t),0!==r&&this.mapArguments((t=>{switch(t.$kind){case"Result":t.Result>e&&(t.Result+=r);break;case"NestedResult":t.NestedResult[0]>e&&(t.NestedResult[0]+=r)}return t}))}getDigest(){const e=this.build({onlyTransactionKind:!1});return zr.getDigestFromBytes(e)}snapshot(){return te(Be,this)}}function Wr(e){return"string"==typeof e?oe(e):e.Object?e.Object.ImmOrOwnedObject?oe(e.Object.ImmOrOwnedObject.objectId):e.Object.Receiving?oe(e.Object.Receiving.objectId):oe(e.Object.SharedObject.objectId):e.UnresolvedObject?oe(e.UnresolvedObject.objectId):void 0}var Hr,Kr,Qr,Zr,es,ts,rs,ss,is,ns=e=>{throw TypeError(e)},as=(e,t,r)=>t.has(e)||ns("Cannot "+r),os=(e,t,r)=>(as(e,t,"read from private field"),r?r.call(e):t.get(e)),us=(e,t,r)=>t.has(e)?ns("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),cs=(e,t,r,s)=>(as(e,t,"write to private field"),s?s.call(e,r):t.set(e,r),r),ds=(e,t,r)=>(as(e,t,"access private method"),r);const hs=Symbol.for("@mysten/transaction");function ps(e){return!!e&&"object"==typeof e&&!0===e[hs]}const ls={buildPlugins:[],serializationPlugins:[]},ms=Symbol.for("@mysten/transaction/registry");function _s(){try{const e=globalThis;return e[ms]||(e[ms]=ls),e[ms]}catch(e){return ls}}Hr=new WeakMap,Kr=new WeakMap,Qr=new WeakMap,Zr=new WeakMap,es=new WeakSet,ts=function(e){return w(e)?this.pure(e):ds(this,es,rs).call(this,e)},rs=function(e){return te(_e,"function"==typeof e?e(this):e)},ss=async function(e){if(!e.onlyTransactionKind&&!os(this,Zr).sender)throw new Error("Missing transaction sender");await ds(this,es,is).call(this,[...os(this,Kr),dr],e)},is=async function(e,t){const r=s=>{if(s>=e.length)return()=>{};const i=e[s];return async()=>{const e=r(s+1);let n=!1,a=!1;if(await i(os(this,Zr),t,(async()=>{if(n)throw new Error(`next() was call multiple times in TransactionPlugin ${s}`);n=!0,await e(),a=!0})),!n)throw new Error(`next() was not called in TransactionPlugin ${s}`);if(!a)throw new Error(`next() was not awaited in TransactionPlugin ${s}`)}};await r(0)()};let bs=class t{constructor(){us(this,es),us(this,Hr),us(this,Kr),us(this,Qr,new Map),us(this,Zr),this.object=function(e){function t(t){return e(t)}return t.system=()=>t("0x5"),t.clock=()=>t("0x6"),t.random=()=>t("0x8"),t.denyList=()=>t("0x403"),t}((e=>{if("function"==typeof e)return this.object(e(this));if("object"==typeof e&&N(_e,e))return e;const t=Wr(e),r=os(this,Zr).inputs.find((e=>t===Wr(e)));return r?.Object?.SharedObject&&"object"==typeof e&&e.Object?.SharedObject&&(r.Object.SharedObject.mutable=r.Object.SharedObject.mutable||e.Object.SharedObject.mutable),r?{$kind:"Input",Input:os(this,Zr).inputs.indexOf(r),type:"object"}:os(this,Zr).addInput("object","string"==typeof e?{$kind:"UnresolvedObject",UnresolvedObject:{objectId:oe(e)}}:e)}));const e=_s();cs(this,Zr,new zr),cs(this,Kr,[...e.buildPlugins]),cs(this,Hr,[...e.serializationPlugins])}static fromKind(r){const s=new t;return cs(s,Zr,zr.fromKindBytes("string"==typeof r?e(r):r)),s}static from(r){const s=new t;return ps(r)?cs(s,Zr,new zr(r.getData())):"string"==typeof r&&r.startsWith("{")?cs(s,Zr,zr.restore(JSON.parse(r))):cs(s,Zr,zr.fromBytes("string"==typeof r?e(r):r)),s}static registerGlobalSerializationPlugin(e){_s().serializationPlugins.push(e)}static registerGlobalBuildPlugin(e){_s().buildPlugins.push(e)}addSerializationPlugin(e){os(this,Hr).push(e)}addBuildPlugin(e){os(this,Kr).push(e)}addIntentResolver(e,t){if(os(this,Qr).has(e)&&os(this,Qr).get(e)!==t)throw new Error(`Intent resolver for ${e} already exists`);os(this,Qr).set(e,t)}setSender(e){os(this,Zr).sender=e}setSenderIfNotSet(e){os(this,Zr).sender||(os(this,Zr).sender=e)}setExpiration(e){os(this,Zr).expiration=e?te(we,e):null}setGasPrice(e){os(this,Zr).gasConfig.price=String(e)}setGasBudget(e){os(this,Zr).gasConfig.budget=String(e)}setGasBudgetIfNotSet(e){null==os(this,Zr).gasData.budget&&(os(this,Zr).gasConfig.budget=String(e))}setGasOwner(e){os(this,Zr).gasConfig.owner=e}setGasPayment(e){os(this,Zr).gasConfig.payment=e.map((e=>te(me,e)))}get blockData(){return $e(os(this,Zr).snapshot())}getData(){return os(this,Zr).snapshot()}get[hs](){return!0}get pure(){return Object.defineProperty(this,"pure",{enumerable:!1,value:_r((e=>w(e)?os(this,Zr).addInput("pure",{$kind:"Pure",Pure:{bytes:e.toBase64()}}):os(this,Zr).addInput("pure",N(Oe,e)?te(Oe,e):e instanceof Uint8Array?at(e):{$kind:"UnresolvedPure",UnresolvedPure:{value:e}})))}),this.pure}get gas(){return{$kind:"GasCoin",GasCoin:!0}}objectRef(...e){return this.object(ot(...e))}receivingRef(...e){return this.object(ct(...e))}sharedObjectRef(...e){return this.object(ut(...e))}add(e){return"function"==typeof e?e(this):function(e){const t=[],r=r=>t[r]??(t[r]={$kind:"NestedResult",NestedResult:[e,r]});return new Proxy({$kind:"Result",Result:e},{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(e,t){if(t in e)return Reflect.get(e,t);if(t===Symbol.iterator)return function*(){let e=0;for(;;)yield r(e),e++};if("symbol"==typeof t)return;const s=parseInt(t,10);return Number.isNaN(s)||s<0?void 0:r(s)}})}(os(this,Zr).commands.push(e)-1)}splitCoins(e,t){return this.add(Ie.SplitCoins("string"==typeof e?this.object(e):ds(this,es,rs).call(this,e),t.map((e=>"number"==typeof e||"bigint"==typeof e||"string"==typeof e?this.pure.u64(e):ds(this,es,ts).call(this,e)))))}mergeCoins(e,t){return this.add(Ie.MergeCoins(this.object(e),t.map((e=>this.object(e)))))}publish({modules:e,dependencies:t}){return this.add(Ie.Publish({modules:e,dependencies:t}))}upgrade({modules:e,dependencies:t,package:r,ticket:s}){return this.add(Ie.Upgrade({modules:e,dependencies:t,package:r,ticket:this.object(s)}))}moveCall({arguments:e,...t}){return this.add(Ie.MoveCall({...t,arguments:e?.map((e=>ds(this,es,ts).call(this,e)))}))}transferObjects(e,t){return this.add(Ie.TransferObjects(e.map((e=>this.object(e))),"string"==typeof t?this.pure.address(t):ds(this,es,ts).call(this,t)))}makeMoveVec({type:e,elements:t}){return this.add(Ie.MakeMoveVec({type:e,elements:t.map((e=>this.object(e)))}))}serialize(){return JSON.stringify($e(os(this,Zr).snapshot()))}async toJSON(e={}){return await this.prepareForSerialization(e),JSON.stringify(te(nt,os(this,Zr).snapshot()),((e,t)=>"bigint"==typeof t?t.toString():t),2)}async sign(e){const{signer:t,...r}=e,s=await this.build(r);return t.signTransaction(s)}async build(e={}){return await this.prepareForSerialization(e),await ds(this,es,ss).call(this,e),os(this,Zr).build({onlyTransactionKind:e.onlyTransactionKind})}async getDigest(e={}){return await ds(this,es,ss).call(this,e),os(this,Zr).getDigest()}async prepareForSerialization(e){const t=new Set;for(const e of os(this,Zr).commands)e.$Intent&&t.add(e.$Intent.name);const r=[...os(this,Hr)];for(const s of t)if(!e.supportedIntents?.includes(s)){if(!os(this,Qr).has(s))throw new Error(`Missing intent resolver for ${s}`);r.push(os(this,Qr).get(s))}await ds(this,es,is).call(this,r,e)}};const gs=/^(?!.*(^(?!@)|[-.@])($|[-.@]))(?:[a-z0-9-]{0,63}(?:\.[a-z0-9-]{0,63})*)?@[a-z0-9-]{0,63}$/i,ys=/^(?!.*(^|[-.])($|[-.]))(?:[a-z0-9-]{0,63}\.)+sui$/i,fs={"-32700":"ParseError","-32701":"OversizedRequest","-32702":"OversizedResponse","-32600":"InvalidRequest","-32601":"MethodNotFound","-32602":"InvalidParams","-32603":"InternalError","-32604":"ServerBusy","-32000":"CallExecutionFailed","-32001":"UnknownError","-32003":"SubscriptionClosed","-32004":"SubscriptionClosedWithError","-32005":"BatchesNotSupported","-32006":"TooManySubscriptions","-32050":"TransientError","-32002":"TransactionExecutionClientError"};class Ts extends Error{}class Es extends Ts{constructor(e,t){super(e),this.code=t,this.type=fs[t]??"ServerError"}}class vs extends Ts{constructor(e,t,r){super(e),this.status=t,this.statusText=r}}var xs,Os,ws,Bs,Is,Cs,Ps,Ss,As,js=e=>{throw TypeError(e)},ks=(e,t,r)=>t.has(e)||js("Cannot "+r),Us=(e,t,r)=>(ks(e,t,"read from private field"),r?r.call(e):t.get(e)),Ys=(e,t,r)=>t.has(e)?js("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ds=(e,t,r,s)=>(ks(e,t,"write to private field"),s?s.call(e,r):t.set(e,r),r),Rs=(e,t,r)=>(ks(e,t,"access private method"),r);const Ns={WebSocketConstructor:"undefined"!=typeof WebSocket?WebSocket:void 0,callTimeout:3e4,reconnectTimeout:3e3,maxReconnects:5};class Vs{constructor(e,t={}){if(Ys(this,Ps),Ys(this,xs,0),Ys(this,Os,0),Ys(this,ws,null),Ys(this,Bs,null),Ys(this,Is,new Set),Ys(this,Cs,new Map),this.endpoint=e,this.options={...Ns,...t},!this.options.WebSocketConstructor)throw new Error("Missing WebSocket constructor");this.endpoint.startsWith("http")&&(this.endpoint=function(e){const t=new URL(e);return t.protocol=t.protocol.replace("http","ws"),t.toString()}(this.endpoint))}async makeRequest(e,t){const r=await Rs(this,Ps,Ss).call(this);return new Promise(((s,i)=>{Ds(this,xs,Us(this,xs)+1),Us(this,Cs).set(Us(this,xs),{resolve:s,reject:i,timeout:setTimeout((()=>{Us(this,Cs).delete(Us(this,xs)),i(new Error(`Request timeout: ${e}`))}),this.options.callTimeout)}),r.send(JSON.stringify({jsonrpc:"2.0",id:Us(this,xs),method:e,params:t}))})).then((({error:e,result:t})=>{if(e)throw new Es(e.message,e.code);return t}))}async subscribe(e){const t=new Xs(e);return Us(this,Is).add(t),await t.subscribe(this),()=>t.unsubscribe(this)}}xs=new WeakMap,Os=new WeakMap,ws=new WeakMap,Bs=new WeakMap,Is=new WeakMap,Cs=new WeakMap,Ps=new WeakSet,Ss=function(){return Us(this,Bs)||Ds(this,Bs,new Promise((e=>{Us(this,ws)?.close(),Ds(this,ws,new this.options.WebSocketConstructor(this.endpoint)),Us(this,ws).addEventListener("open",(()=>{Ds(this,Os,0),e(Us(this,ws))})),Us(this,ws).addEventListener("close",(()=>{var e,t;(e=this,t=Os,{set _(r){Ds(e,t,r,undefined)},get _(){return Us(e,t,undefined)}})._++,Us(this,Os)<=this.options.maxReconnects&&setTimeout((()=>{Rs(this,Ps,As).call(this)}),this.options.reconnectTimeout)})),Us(this,ws).addEventListener("message",(({data:e})=>{let t;try{t=JSON.parse(e)}catch(t){return void console.error(new Error(`Failed to parse RPC message: ${e}`,{cause:t}))}if("id"in t&&null!=t.id&&Us(this,Cs).has(t.id)){const{resolve:e,timeout:r}=Us(this,Cs).get(t.id);clearTimeout(r),e(t)}else if("params"in t){const{params:e}=t;Us(this,Is).forEach((t=>{t.subscriptionId===e.subscription&&e.subscription===t.subscriptionId&&t.onMessage(e.result)}))}}))}))),Us(this,Bs)},As=async function(){return Us(this,ws)?.close(),Ds(this,Bs,null),Promise.allSettled([...Us(this,Is)].map((e=>e.subscribe(this))))};class Xs{constructor(e){this.subscriptionId=null,this.subscribed=!1,this.input=e}onMessage(e){this.subscribed&&this.input.onMessage(e)}async unsubscribe(e){const{subscriptionId:t}=this;return this.subscribed=!1,null!=t&&(this.subscriptionId=null,e.makeRequest(this.input.unsubscribe,[t]))}async subscribe(e){this.subscriptionId=null,this.subscribed=!0;const t=await e.makeRequest(this.input.method,this.input.params);this.subscribed&&(this.subscriptionId=t)}}var Js,Fs,qs,Ls,Ms,Gs=e=>{throw TypeError(e)},$s=(e,t,r)=>t.has(e)||Gs("Cannot "+r),zs=(e,t,r)=>($s(e,t,"read from private field"),r?r.call(e):t.get(e)),Ws=(e,t,r)=>t.has(e)?Gs("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Hs=(e,t,r,s)=>($s(e,t,"write to private field"),s?s.call(e,r):t.set(e,r),r);class Ks{constructor(e){Ws(this,Ls),Ws(this,Js,0),Ws(this,Fs),Ws(this,qs),Hs(this,Fs,e)}fetch(e,t){const r=zs(this,Fs).fetch??fetch;if(!r)throw new Error("The current environment does not support fetch, you can provide a fetch implementation in the options for SuiHTTPTransport.");return r(e,t)}async request(e){Hs(this,Js,zs(this,Js)+1);const t=await this.fetch(zs(this,Fs).rpc?.url??zs(this,Fs).url,{method:"POST",headers:{"Content-Type":"application/json","Client-Sdk-Type":"typescript","Client-Sdk-Version":"1.7.0","Client-Target-Api-Version":"1.32.0",...zs(this,Fs).rpc?.headers},body:JSON.stringify({jsonrpc:"2.0",id:zs(this,Js),method:e.method,params:e.params})});if(!t.ok)throw new vs(`Unexpected status code: ${t.status}`,t.status,t.statusText);const r=await t.json();if("error"in r&&null!=r.error)throw new Es(r.error.message,r.error.code);return r.result}async subscribe(e){const t=await(r=Ls,s=Ms,$s(this,r,"access private method"),s).call(this).subscribe(e);var r,s;return async()=>!!await t()}}Js=new WeakMap,Fs=new WeakMap,qs=new WeakMap,Ls=new WeakSet,Ms=function(){if(!zs(this,qs)){const e=zs(this,Fs).WebSocketConstructor??WebSocket;if(!e)throw new Error("The current environment does not support WebSocket, you can provide a WebSocketConstructor in the options for SuiHTTPTransport.");Hs(this,qs,new Vs(zs(this,Fs).websocket?.url??zs(this,Fs).url,{WebSocketConstructor:e,...zs(this,Fs).websocket}))}return zs(this,qs)};const Qs=Symbol.for("@mysten/SuiClient");class Zs{get[Qs](){return!0}constructor(e){this.transport=e.transport??new Ks({url:e.url})}async getRpcApiVersion(){return(await this.transport.request({method:"rpc.discover",params:[]})).info.version}async getCoins(e){if(!e.owner||!ne(oe(e.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getCoins",params:[e.owner,e.coinType,e.cursor,e.limit]})}async getAllCoins(e){if(!e.owner||!ne(oe(e.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllCoins",params:[e.owner,e.cursor,e.limit]})}async getBalance(e){if(!e.owner||!ne(oe(e.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getBalance",params:[e.owner,e.coinType]})}async getAllBalances(e){if(!e.owner||!ne(oe(e.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getAllBalances",params:[e.owner]})}async getCoinMetadata(e){return await this.transport.request({method:"suix_getCoinMetadata",params:[e.coinType]})}async getTotalSupply(e){return await this.transport.request({method:"suix_getTotalSupply",params:[e.coinType]})}async call(e,t){return await this.transport.request({method:e,params:t})}async getMoveFunctionArgTypes(e){return await this.transport.request({method:"sui_getMoveFunctionArgTypes",params:[e.package,e.module,e.function]})}async getNormalizedMoveModulesByPackage(e){return await this.transport.request({method:"sui_getNormalizedMoveModulesByPackage",params:[e.package]})}async getNormalizedMoveModule(e){return await this.transport.request({method:"sui_getNormalizedMoveModule",params:[e.package,e.module]})}async getNormalizedMoveFunction(e){return await this.transport.request({method:"sui_getNormalizedMoveFunction",params:[e.package,e.module,e.function]})}async getNormalizedMoveStruct(e){return await this.transport.request({method:"sui_getNormalizedMoveStruct",params:[e.package,e.module,e.struct]})}async getOwnedObjects(e){if(!e.owner||!ne(oe(e.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getOwnedObjects",params:[e.owner,{filter:e.filter,options:e.options},e.cursor,e.limit]})}async getObject(e){if(!e.id||!ae(ue(e.id)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"sui_getObject",params:[e.id,e.options]})}async tryGetPastObject(e){return await this.transport.request({method:"sui_tryGetPastObject",params:[e.id,e.version,e.options]})}async multiGetObjects(e){if(e.ids.forEach((e=>{if(!e||!ae(ue(e)))throw new Error(`Invalid Sui Object id ${e}`)})),e.ids.length!==new Set(e.ids).size)throw new Error(`Duplicate object ids in batch call ${e.ids}`);return await this.transport.request({method:"sui_multiGetObjects",params:[e.ids,e.options]})}async queryTransactionBlocks(e){return await this.transport.request({method:"suix_queryTransactionBlocks",params:[{filter:e.filter,options:e.options},e.cursor,e.limit,"descending"===(e.order||"descending")]})}async getTransactionBlock(e){if(!se(e.digest))throw new Error("Invalid Transaction digest");return await this.transport.request({method:"sui_getTransactionBlock",params:[e.digest,e.options]})}async multiGetTransactionBlocks(e){if(e.digests.forEach((e=>{if(!se(e))throw new Error(`Invalid Transaction digest ${e}`)})),e.digests.length!==new Set(e.digests).size)throw new Error(`Duplicate digests in batch call ${e.digests}`);return await this.transport.request({method:"sui_multiGetTransactionBlocks",params:[e.digests,e.options]})}async executeTransactionBlock({transactionBlock:e,signature:t,options:r,requestType:s}){const n=await this.transport.request({method:"sui_executeTransactionBlock",params:["string"==typeof e?e:i(e),Array.isArray(t)?t:[t],r]});if("WaitForLocalExecution"===s)try{await this.waitForTransaction({digest:n.digest})}catch(e){}return n}async signAndExecuteTransaction({transaction:e,signer:t,...r}){let s;e instanceof Uint8Array?s=e:(e.setSenderIfNotSet(t.toSuiAddress()),s=await e.build({client:this}));const{signature:i,bytes:n}=await t.signTransaction(s);return this.executeTransactionBlock({transactionBlock:n,signature:i,...r})}async getTotalTransactionBlocks(){const e=await this.transport.request({method:"sui_getTotalTransactionBlocks",params:[]});return BigInt(e)}async getReferenceGasPrice(){const e=await this.transport.request({method:"suix_getReferenceGasPrice",params:[]});return BigInt(e)}async getStakes(e){if(!e.owner||!ne(oe(e.owner)))throw new Error("Invalid Sui address");return await this.transport.request({method:"suix_getStakes",params:[e.owner]})}async getStakesByIds(e){return e.stakedSuiIds.forEach((e=>{if(!e||!ae(ue(e)))throw new Error(`Invalid Sui Stake id ${e}`)})),await this.transport.request({method:"suix_getStakesByIds",params:[e.stakedSuiIds]})}async getLatestSuiSystemState(){return await this.transport.request({method:"suix_getLatestSuiSystemState",params:[]})}async queryEvents(e){return await this.transport.request({method:"suix_queryEvents",params:[e.query,e.cursor,e.limit,"descending"===(e.order||"descending")]})}async subscribeEvent(e){return this.transport.subscribe({method:"suix_subscribeEvent",unsubscribe:"suix_unsubscribeEvent",params:[e.filter],onMessage:e.onMessage})}async subscribeTransaction(e){return this.transport.subscribe({method:"suix_subscribeTransaction",unsubscribe:"suix_unsubscribeTransaction",params:[e.filter],onMessage:e.onMessage})}async devInspectTransactionBlock(e){let t;if(ps(e.transactionBlock))e.transactionBlock.setSenderIfNotSet(e.sender),t=i(await e.transactionBlock.build({client:this,onlyTransactionKind:!0}));else if("string"==typeof e.transactionBlock)t=e.transactionBlock;else{if(!(e.transactionBlock instanceof Uint8Array))throw new Error("Unknown transaction block format.");t=i(e.transactionBlock)}return await this.transport.request({method:"sui_devInspectTransactionBlock",params:[e.sender,t,e.gasPrice?.toString(),e.epoch]})}async dryRunTransactionBlock(e){return await this.transport.request({method:"sui_dryRunTransactionBlock",params:["string"==typeof e.transactionBlock?e.transactionBlock:i(e.transactionBlock)]})}async getDynamicFields(e){if(!e.parentId||!ae(ue(e.parentId)))throw new Error("Invalid Sui Object id");return await this.transport.request({method:"suix_getDynamicFields",params:[e.parentId,e.cursor,e.limit]})}async getDynamicFieldObject(e){return await this.transport.request({method:"suix_getDynamicFieldObject",params:[e.parentId,e.name]})}async getLatestCheckpointSequenceNumber(){const e=await this.transport.request({method:"sui_getLatestCheckpointSequenceNumber",params:[]});return String(e)}async getCheckpoint(e){return await this.transport.request({method:"sui_getCheckpoint",params:[e.id]})}async getCheckpoints(e){return await this.transport.request({method:"sui_getCheckpoints",params:[e.cursor,e?.limit,e.descendingOrder]})}async getCommitteeInfo(e){return await this.transport.request({method:"suix_getCommitteeInfo",params:[e?.epoch]})}async getNetworkMetrics(){return await this.transport.request({method:"suix_getNetworkMetrics",params:[]})}async getAddressMetrics(){return await this.transport.request({method:"suix_getLatestAddressMetrics",params:[]})}async getEpochMetrics(e){return await this.transport.request({method:"suix_getEpochMetrics",params:[e?.cursor,e?.limit,e?.descendingOrder]})}async getAllEpochAddressMetrics(e){return await this.transport.request({method:"suix_getAllEpochAddressMetrics",params:[e?.descendingOrder]})}async getEpochs(e){return await this.transport.request({method:"suix_getEpochs",params:[e?.cursor,e?.limit,e?.descendingOrder]})}async getMoveCallMetrics(){return await this.transport.request({method:"suix_getMoveCallMetrics",params:[]})}async getCurrentEpoch(){return await this.transport.request({method:"suix_getCurrentEpoch",params:[]})}async getValidatorsApy(){return await this.transport.request({method:"suix_getValidatorsApy",params:[]})}async getChainIdentifier(){const e=await this.getCheckpoint({id:"0"});return c(o(e.digest).slice(0,4))}async resolveNameServiceAddress(e){return await this.transport.request({method:"suix_resolveNameServiceAddress",params:[e.name]})}async resolveNameServiceNames({format:e="dot",...t}){const{nextCursor:r,hasNextPage:s,data:i}=await this.transport.request({method:"suix_resolveNameServiceNames",params:[t.address,t.cursor,t.limit]});return{hasNextPage:s,nextCursor:r,data:i.map((t=>function(e,t="at"){const r=e.toLowerCase();let s;if(r.includes("@")){if(!gs.test(r))throw new Error(`Invalid SuiNS name ${e}`);const[t,i]=r.split("@");s=[...t?t.split("."):[],i]}else{if(!ys.test(r))throw new Error(`Invalid SuiNS name ${e}`);s=r.split(".").slice(0,-1)}return"dot"===t?`${s.join(".")}.sui`:`${s.slice(0,-1).join(".")}@${s[s.length-1]}`}(t,e)))}}async getProtocolConfig(e){return await this.transport.request({method:"sui_getProtocolConfig",params:[e?.version]})}async waitForTransaction({signal:e,timeout:t=6e4,pollInterval:r=2e3,...s}){const i=AbortSignal.timeout(t),n=new Promise(((e,t)=>{i.addEventListener("abort",(()=>t(i.reason)))}));for(n.catch((()=>{}));!i.aborted;){e?.throwIfAborted();try{return await this.getTransactionBlock(s)}catch(e){await Promise.race([new Promise((e=>setTimeout(e,r))),n])}}throw i.throwIfAborted(),new Error("Unexpected error while waiting for transaction block.")}}var ei=r(947),ti=r(343);function ri(e,t){return ar.IntentMessage(ar.fixedArray(t.length,ar.u8())).serialize({intent:{scope:{[e]:!0},version:{V0:!0},appId:{Sui:!0}},value:t}).toBytes()}const si={ED25519:0,Secp256k1:1,Secp256r1:2,MultiSig:3,ZkLogin:5},ii={ED25519:32,Secp256k1:33,Secp256r1:33},ni={0:"ED25519",1:"Secp256k1",2:"Secp256r1",3:"MultiSig",5:"ZkLogin"};function ai(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}class oi{equals(e){return ai(this.toRawBytes(),e.toRawBytes())}toBase64(){return i(this.toRawBytes())}toString(){throw new Error("`toString` is not implemented on public keys. Use `toBase64()` or `toRawBytes()` instead.")}toSuiPublicKey(){return i(this.toSuiBytes())}verifyWithIntent(e,t,r){const s=ri(r,e),i=Gr(s,{dkLen:32});return this.verify(i,t)}verifyPersonalMessage(e,t){return this.verifyWithIntent(ar.vector(ar.u8()).serialize(e).toBytes(),t,"PersonalMessage")}verifyTransaction(e,t){return this.verifyWithIntent(e,t,"TransactionData")}toSuiBytes(){const e=this.toRawBytes(),t=new Uint8Array(e.length+1);return t.set([this.flag()]),t.set(e,1),t}toSuiAddress(){return oe(function(e){yr(e);let t="";for(let r=0;r<e.length;r++)t+=Cr[e[r]];return t}(Gr(this.toSuiBytes(),{dkLen:32})).slice(0,2*ie))}}function ui(e){return 9===e||32===e}const ci=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function di(e){return hi[e.charCodeAt(0)]}const hi=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"];function pi(e,t){if(!Boolean(e))throw new Error(t)}function li(e){return mi(e,[])}function mi(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return function(e,t){if(null===e)return"null";if(t.includes(e))return"[Circular]";const r=[...t,e];if(function(e){return"function"==typeof e.toJSON}(e)){const t=e.toJSON();if(t!==e)return"string"==typeof t?t:mi(t,r)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>2)return"[Array]";const r=Math.min(10,e.length),s=e.length-r,i=[];for(let s=0;s<r;++s)i.push(mi(e[s],t));return 1===s?i.push("... 1 more item"):s>1&&i.push(`... ${s} more items`),"["+i.join(", ")+"]"}(e,r);return function(e,t){const r=Object.entries(e);if(0===r.length)return"{}";if(t.length>2)return"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]";const s=r.map((([e,r])=>e+": "+mi(r,t)));return"{ "+s.join(", ")+" }"}(e,r)}(e,t);default:return String(e)}}Symbol.toStringTag,Symbol.toStringTag;const _i={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},bi=new Set(Object.keys(_i));function gi(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&bi.has(t)}var yi,fi,Ti;!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(yi||(yi={})),(Ti=fi||(fi={})).NAME="Name",Ti.DOCUMENT="Document",Ti.OPERATION_DEFINITION="OperationDefinition",Ti.VARIABLE_DEFINITION="VariableDefinition",Ti.SELECTION_SET="SelectionSet",Ti.FIELD="Field",Ti.ARGUMENT="Argument",Ti.FRAGMENT_SPREAD="FragmentSpread",Ti.INLINE_FRAGMENT="InlineFragment",Ti.FRAGMENT_DEFINITION="FragmentDefinition",Ti.VARIABLE="Variable",Ti.INT="IntValue",Ti.FLOAT="FloatValue",Ti.STRING="StringValue",Ti.BOOLEAN="BooleanValue",Ti.NULL="NullValue",Ti.ENUM="EnumValue",Ti.LIST="ListValue",Ti.OBJECT="ObjectValue",Ti.OBJECT_FIELD="ObjectField",Ti.DIRECTIVE="Directive",Ti.NAMED_TYPE="NamedType",Ti.LIST_TYPE="ListType",Ti.NON_NULL_TYPE="NonNullType",Ti.SCHEMA_DEFINITION="SchemaDefinition",Ti.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",Ti.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",Ti.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",Ti.FIELD_DEFINITION="FieldDefinition",Ti.INPUT_VALUE_DEFINITION="InputValueDefinition",Ti.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",Ti.UNION_TYPE_DEFINITION="UnionTypeDefinition",Ti.ENUM_TYPE_DEFINITION="EnumTypeDefinition",Ti.ENUM_VALUE_DEFINITION="EnumValueDefinition",Ti.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",Ti.DIRECTIVE_DEFINITION="DirectiveDefinition",Ti.SCHEMA_EXTENSION="SchemaExtension",Ti.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",Ti.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",Ti.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",Ti.UNION_TYPE_EXTENSION="UnionTypeExtension",Ti.ENUM_TYPE_EXTENSION="EnumTypeExtension",Ti.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension";const Ei=Object.freeze({});function vi(e,t){const r=e[t];return"object"==typeof r?r:"function"==typeof r?{enter:r,leave:void 0}:{enter:e.enter,leave:e.leave}}const xi={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>Oi(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=Bi("(",Oi(e.variableDefinitions,", "),")"),r=Oi([e.operation,Oi([e.name,t]),Oi(e.directives," ")]," ");return("query"===r?"":r+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:r,directives:s})=>e+": "+t+Bi(" = ",r)+Bi(" ",Oi(s," "))},SelectionSet:{leave:({selections:e})=>wi(e)},Field:{leave({alias:e,name:t,arguments:r,directives:s,selectionSet:i}){const n=Bi("",e,": ")+t;let a=n+Bi("(",Oi(r,", "),")");return a.length>80&&(a=n+Bi("(\n",Ii(Oi(r,"\n")),"\n)")),Oi([a,Oi(s," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+Bi(" ",Oi(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:r})=>Oi(["...",Bi("on ",e),Oi(t," "),r]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:r,directives:s,selectionSet:i})=>`fragment ${e}${Bi("(",Oi(r,", "),")")} on ${t} ${Bi("",Oi(s," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?function(e){const t=e.replace(/"""/g,'\\"""'),r=t.split(/\r\n|[\n\r]/g),s=1===r.length,i=r.length>1&&r.slice(1).every((e=>0===e.length||ui(e.charCodeAt(0)))),n=t.endsWith('\\"""'),a=e.endsWith('"')&&!n,o=e.endsWith("\\"),u=a||o,c=!s||e.length>70||u||i||n;let d="";const h=s&&ui(e.charCodeAt(0));return(c&&!h||i)&&(d+="\n"),d+=t,(c||u)&&(d+="\n"),'"""'+d+'"""'}(e):`"${e.replace(ci,di)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+Oi(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+Oi(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+Bi("(",Oi(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:r})=>Bi("",e,"\n")+Oi(["schema",Oi(t," "),wi(r)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:r})=>Bi("",e,"\n")+Oi(["scalar",t,Oi(r," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:s,fields:i})=>Bi("",e,"\n")+Oi(["type",t,Bi("implements ",Oi(r," & ")),Oi(s," "),wi(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:r,type:s,directives:i})=>Bi("",e,"\n")+t+(Ci(r)?Bi("(\n",Ii(Oi(r,"\n")),"\n)"):Bi("(",Oi(r,", "),")"))+": "+s+Bi(" ",Oi(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:r,defaultValue:s,directives:i})=>Bi("",e,"\n")+Oi([t+": "+r,Bi("= ",s),Oi(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:r,directives:s,fields:i})=>Bi("",e,"\n")+Oi(["interface",t,Bi("implements ",Oi(r," & ")),Oi(s," "),wi(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:r,types:s})=>Bi("",e,"\n")+Oi(["union",t,Oi(r," "),Bi("= ",Oi(s," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:r,values:s})=>Bi("",e,"\n")+Oi(["enum",t,Oi(r," "),wi(s)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:r})=>Bi("",e,"\n")+Oi([t,Oi(r," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:r,fields:s})=>Bi("",e,"\n")+Oi(["input",t,Oi(r," "),wi(s)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:r,repeatable:s,locations:i})=>Bi("",e,"\n")+"directive @"+t+(Ci(r)?Bi("(\n",Ii(Oi(r,"\n")),"\n)"):Bi("(",Oi(r,", "),")"))+(s?" repeatable":"")+" on "+Oi(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>Oi(["extend schema",Oi(e," "),wi(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>Oi(["extend scalar",e,Oi(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:s})=>Oi(["extend type",e,Bi("implements ",Oi(t," & ")),Oi(r," "),wi(s)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:r,fields:s})=>Oi(["extend interface",e,Bi("implements ",Oi(t," & ")),Oi(r," "),wi(s)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:r})=>Oi(["extend union",e,Oi(t," "),Bi("= ",Oi(r," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:r})=>Oi(["extend enum",e,Oi(t," "),wi(r)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:r})=>Oi(["extend input",e,Oi(t," "),wi(r)]," ")}};function Oi(e,t=""){var r;return null!==(r=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==r?r:""}function wi(e){return Bi("{\n",Ii(Oi(e,"\n")),"\n}")}function Bi(e,t,r=""){return null!=t&&""!==t?e+t+r:""}function Ii(e){return Bi(" ",e.replace(/\n/g,"\n "))}function Ci(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}var Pi,Si,Ai,ji,ki=e=>{throw TypeError(e)},Ui=(e,t,r)=>t.has(e)||ki("Cannot "+r),Yi=(e,t,r)=>(Ui(e,t,"read from private field"),r?r.call(e):t.get(e)),Di=(e,t,r)=>t.has(e)?ki("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ri=(e,t,r,s)=>(Ui(e,t,"write to private field"),s?s.call(e,r):t.set(e,r),r);class Ni extends Error{}class Vi{constructor({url:e,fetch:t=fetch,headers:r={},queries:s={}}){Di(this,Pi),Di(this,Si),Di(this,Ai),Di(this,ji),Ri(this,Pi,e),Ri(this,Si,s),Ri(this,Ai,r),Ri(this,ji,((...e)=>t(...e)))}async query(e){const t=await Yi(this,ji).call(this,Yi(this,Pi),{method:"POST",headers:{"Content-Type":"application/json",...Yi(this,Ai)},body:JSON.stringify({query:"string"==typeof e.query?String(e.query):(r=e.query,function(e,t,r=_i){const s=new Map;for(const e of Object.values(fi))s.set(e,vi(t,e));let i,n,a,o=Array.isArray(e),u=[e],c=-1,d=[],h=e;const p=[],l=[];do{c++;const e=c===u.length,g=e&&0!==d.length;if(e){if(n=0===l.length?void 0:p[p.length-1],h=a,a=l.pop(),g)if(o){h=h.slice();let e=0;for(const[t,r]of d){const s=t-e;null===r?(h.splice(s,1),e++):h[s]=r}}else{h=Object.defineProperties({},Object.getOwnPropertyDescriptors(h));for(const[e,t]of d)h[e]=t}c=i.index,u=i.keys,d=i.edits,o=i.inArray,i=i.prev}else if(a){if(n=o?c:u[c],h=a[n],null==h)continue;p.push(n)}let y;if(!Array.isArray(h)){var m,_;gi(h)||pi(!1,`Invalid AST Node: ${li(h)}.`);const r=e?null===(m=s.get(h.kind))||void 0===m?void 0:m.leave:null===(_=s.get(h.kind))||void 0===_?void 0:_.enter;if(y=null==r?void 0:r.call(t,h,n,a,p,l),y===Ei)break;if(!1===y){if(!e){p.pop();continue}}else if(void 0!==y&&(d.push([n,y]),!e)){if(!gi(y)){p.pop();continue}h=y}}var b;void 0===y&&g&&d.push([n,h]),e?p.pop():(i={inArray:o,index:c,keys:u,edits:d,prev:i},o=Array.isArray(h),u=o?h:null!==(b=r[h.kind])&&void 0!==b?b:[],c=-1,d=[],a&&l.push(a),a=h)}while(void 0!==i);return 0!==d.length?d[d.length-1][1]:e}(r,xi)),variables:e.variables,extensions:e.extensions,operationName:e.operationName})});var r;if(!t.ok)throw new Ni(`GraphQL request failed: ${t.statusText} (${t.status})`);return await t.json()}async execute(e,t){return this.query({...t,query:Yi(this,Si)[e]})}}Pi=new WeakMap,Si=new WeakMap,Ai=new WeakMap,ji=new WeakMap;var Xi,Ji,Fi="Document",qi="FragmentDefinition";class Li extends Error{constructor(e,t,r,s,i,n,a){super(e),this.name="GraphQLError",this.message=e,i&&(this.path=i),t&&(this.nodes=Array.isArray(t)?t:[t]),r&&(this.source=r),s&&(this.positions=s),n&&(this.originalError=n);var o=a;if(!o&&n){var u=n.extensions;u&&"object"==typeof u&&(o=u)}this.extensions=o||{}}toJSON(){return{...this,message:this.message}}toString(){return this.message}get[Symbol.toStringTag](){return"GraphQLError"}}function Mi(e){return new Li(`Syntax Error: Unexpected token at ${Ji} in ${e}`)}function Gi(e){if(e.lastIndex=Ji,e.test(Xi))return Xi.slice(Ji,Ji=e.lastIndex)}var $i=/ +(?=[^\s])/y;function zi(e){for(var t=e.split("\n"),r="",s=0,i=0,n=t.length-1,a=0;a<t.length;a++)$i.lastIndex=0,$i.test(t[a])&&(a&&(!s||$i.lastIndex<s)&&(s=$i.lastIndex),i=i||a,n=a);for(var o=i;o<=n;o++)o!==i&&(r+="\n"),r+=t[o].slice(s).replace(/\\"""/g,'"""');return r}function Wi(){for(var e=0|Xi.charCodeAt(Ji++);9===e||10===e||13===e||32===e||35===e||44===e||65279===e;e=0|Xi.charCodeAt(Ji++))if(35===e)for(;10!==(e=Xi.charCodeAt(Ji++))&&13!==e;);Ji--}function Hi(){for(var e=Ji,t=0|Xi.charCodeAt(Ji++);t>=48&&t<=57||t>=65&&t<=90||95===t||t>=97&&t<=122;t=0|Xi.charCodeAt(Ji++));if(e===Ji-1)throw Mi("Name");var r=Xi.slice(e,--Ji);return Wi(),r}function Ki(){return{kind:"Name",value:Hi()}}var Qi=/(?:"""|(?:[\s\S]*?[^\\])""")/y,Zi=/(?:(?:\.\d+)?[eE][+-]?\d+|\.\d+)/y;function en(e){var t;switch(Xi.charCodeAt(Ji)){case 91:Ji++,Wi();for(var r=[];93!==Xi.charCodeAt(Ji);)r.push(en(e));return Ji++,Wi(),{kind:"ListValue",values:r};case 123:Ji++,Wi();for(var s=[];125!==Xi.charCodeAt(Ji);){var i=Ki();if(58!==Xi.charCodeAt(Ji++))throw Mi("ObjectField");Wi(),s.push({kind:"ObjectField",name:i,value:en(e)})}return Ji++,Wi(),{kind:"ObjectValue",fields:s};case 36:if(e)throw Mi("Variable");return Ji++,{kind:"Variable",name:Ki()};case 34:if(34===Xi.charCodeAt(Ji+1)&&34===Xi.charCodeAt(Ji+2)){if(Ji+=3,null==(t=Gi(Qi)))throw Mi("StringValue");return Wi(),{kind:"StringValue",value:zi(t.slice(0,-3)),block:!0}}var n,a=Ji;Ji++;var o=!1;for(n=0|Xi.charCodeAt(Ji++);92===n&&(Ji++,o=!0)||10!==n&&13!==n&&34!==n&&n;n=0|Xi.charCodeAt(Ji++));if(34!==n)throw Mi("StringValue");return t=Xi.slice(a,Ji),Wi(),{kind:"StringValue",value:o?JSON.parse(t):t.slice(1,-1),block:!1};case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:for(var u,c=Ji++;(u=0|Xi.charCodeAt(Ji++))>=48&&u<=57;);var d=Xi.slice(c,--Ji);if(46===(u=Xi.charCodeAt(Ji))||69===u||101===u){if(null==(t=Gi(Zi)))throw Mi("FloatValue");return Wi(),{kind:"FloatValue",value:d+t}}return Wi(),{kind:"IntValue",value:d};case 110:if(117===Xi.charCodeAt(Ji+1)&&108===Xi.charCodeAt(Ji+2)&&108===Xi.charCodeAt(Ji+3))return Ji+=4,Wi(),{kind:"NullValue"};break;case 116:if(114===Xi.charCodeAt(Ji+1)&&117===Xi.charCodeAt(Ji+2)&&101===Xi.charCodeAt(Ji+3))return Ji+=4,Wi(),{kind:"BooleanValue",value:!0};break;case 102:if(97===Xi.charCodeAt(Ji+1)&&108===Xi.charCodeAt(Ji+2)&&115===Xi.charCodeAt(Ji+3)&&101===Xi.charCodeAt(Ji+4))return Ji+=5,Wi(),{kind:"BooleanValue",value:!1}}return{kind:"EnumValue",value:Hi()}}function tn(e){if(40===Xi.charCodeAt(Ji)){var t=[];Ji++,Wi();do{var r=Ki();if(58!==Xi.charCodeAt(Ji++))throw Mi("Argument");Wi(),t.push({kind:"Argument",name:r,value:en(e)})}while(41!==Xi.charCodeAt(Ji));return Ji++,Wi(),t}}function rn(e){if(64===Xi.charCodeAt(Ji)){var t=[];do{Ji++,t.push({kind:"Directive",name:Ki(),arguments:tn(e)})}while(64===Xi.charCodeAt(Ji));return t}}function sn(){for(var e=0;91===Xi.charCodeAt(Ji);)e++,Ji++,Wi();var t={kind:"NamedType",name:Ki()};do{if(33===Xi.charCodeAt(Ji)&&(Ji++,Wi(),t={kind:"NonNullType",type:t}),e){if(93!==Xi.charCodeAt(Ji++))throw Mi("NamedType");Wi(),t={kind:"ListType",type:t}}}while(e--);return t}function nn(){if(123!==Xi.charCodeAt(Ji++))throw Mi("SelectionSet");return Wi(),an()}function an(){var e=[];do{if(46===Xi.charCodeAt(Ji)){if(46!==Xi.charCodeAt(++Ji)||46!==Xi.charCodeAt(++Ji))throw Mi("SelectionSet");switch(Ji++,Wi(),Xi.charCodeAt(Ji)){case 64:e.push({kind:"InlineFragment",typeCondition:void 0,directives:rn(!1),selectionSet:nn()});break;case 111:110===Xi.charCodeAt(Ji+1)?(Ji+=2,Wi(),e.push({kind:"InlineFragment",typeCondition:{kind:"NamedType",name:Ki()},directives:rn(!1),selectionSet:nn()})):e.push({kind:"FragmentSpread",name:Ki(),directives:rn(!1)});break;case 123:Ji++,Wi(),e.push({kind:"InlineFragment",typeCondition:void 0,directives:void 0,selectionSet:an()});break;default:e.push({kind:"FragmentSpread",name:Ki(),directives:rn(!1)})}}else{var t=Ki(),r=void 0;58===Xi.charCodeAt(Ji)&&(Ji++,Wi(),r=t,t=Ki());var s=tn(!1),i=rn(!1),n=void 0;123===Xi.charCodeAt(Ji)&&(Ji++,Wi(),n=an()),e.push({kind:"Field",alias:r,name:t,arguments:s,directives:i,selectionSet:n})}}while(125!==Xi.charCodeAt(Ji));return Ji++,Wi(),{kind:"SelectionSet",selections:e}}function on(){if(Wi(),40===Xi.charCodeAt(Ji)){var e=[];Ji++,Wi();do{if(36!==Xi.charCodeAt(Ji++))throw Mi("Variable");var t=Ki();if(58!==Xi.charCodeAt(Ji++))throw Mi("VariableDefinition");Wi();var r=sn(),s=void 0;61===Xi.charCodeAt(Ji)&&(Ji++,Wi(),s=en(!0)),Wi(),e.push({kind:"VariableDefinition",variable:{kind:"Variable",name:t},type:r,defaultValue:s,directives:rn(!0)})}while(41!==Xi.charCodeAt(Ji));return Ji++,Wi(),e}}function un(){var e=Ki();if(111!==Xi.charCodeAt(Ji++)||110!==Xi.charCodeAt(Ji++))throw Mi("FragmentDefinition");return Wi(),{kind:"FragmentDefinition",name:e,typeCondition:{kind:"NamedType",name:Ki()},directives:rn(!1),selectionSet:nn()}}function cn(){var e=[];do{if(123===Xi.charCodeAt(Ji))Ji++,Wi(),e.push({kind:"OperationDefinition",operation:"query",name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:an()});else{var t=Hi();switch(t){case"fragment":e.push(un());break;case"query":case"mutation":case"subscription":var r,s=void 0;40!==(r=Xi.charCodeAt(Ji))&&64!==r&&123!==r&&(s=Ki()),e.push({kind:"OperationDefinition",operation:t,name:s,variableDefinitions:on(),directives:rn(!1),selectionSet:nn()});break;default:throw Mi("Document")}}}while(Ji<Xi.length);return e}function dn(e,t){return Xi=e.body?e.body:e,Ji=0,Wi(),t&&t.noLocation?{kind:"Document",definitions:cn()}:{kind:"Document",definitions:cn(),loc:{start:0,end:Xi.length,startToken:void 0,endToken:void 0,source:{body:Xi,name:"graphql.web",locationOffset:{line:1,column:1}}}}}var hn=0,pn=new Set;function ln(){function e(e,t){var r,s,i=dn(e).definitions,n=new Set;for(var a of t||[])for(var o of a.definitions)o.kind!==qi||n.has(o)||(i.push(o),n.add(o));return(r=i[0].kind===qi)&&i[0].directives&&(i[0].directives=i[0].directives.filter((e=>"_unmask"!==e.name.value))),{kind:Fi,definitions:i,get loc(){if(!s&&r){var i=e+function(e){try{hn++;var t="";for(var r of e)if(!pn.has(r)){pn.add(r);var{loc:s}=r;s&&(t+=s.source.body)}return t}finally{0==--hn&&pn.clear()}}(t||[]);return{start:0,end:i.length,source:{body:i,name:"GraphQLTada",locationOffset:{line:1,column:1}}}}return s},set loc(e){s=e}}}return e.scalar=function(e,t){return t},e.persisted=function(e,t){return{kind:Fi,definitions:t?t.definitions:[],documentId:e}},e}ln();const mn=ln();function _n(e){if(1!==e.length)throw new Error("Invalid base64Url character: "+e);const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".indexOf(e);if(-1===t)throw new Error("Invalid base64Url character: "+e);const r=t.toString(2).padStart(6,"0");return Array.from(r).map(Number)}function bn(e,t){const r=function(e,t){if(e.length<2)throw new Error(`Input (s = ${e}) is not tightly packed because s.length < 2`);let r=function(e){let t=[];for(let r=0;r<e.length;r++){const s=_n(e.charAt(r));t=t.concat(s)}return t}(e);const s=t%4;if(0===s);else if(1===s)r=r.slice(2);else{if(2!==s)throw new Error(`Input (s = ${e}) is not tightly packed because i%4 = 3 (i = ${t}))`);r=r.slice(4)}const i=(t+e.length-1)%4;if(3===i);else if(2===i)r=r.slice(0,r.length-2);else{if(1!==i)throw new Error(`Input (s = ${e}) is not tightly packed because (i + s.length - 1)%4 = 0 (i = ${t}))`);r=r.slice(0,r.length-4)}if(r.length%8!=0)throw new Error("We should never reach here...");const n=new Uint8Array(Math.floor(r.length/8));let a=0;for(let e=0;e<r.length;e+=8){const t=r.slice(e,e+8),s=parseInt(t.join(""),2);n[a++]=s}return(new TextDecoder).decode(n)}(e.value,e.indexMod4),[s,i]=function(e){if("}"!==e.slice(-1)&&","!==e.slice(-1))throw new Error("Invalid claim");const t=JSON.parse("{"+e.slice(0,-1)+"}");if(1!==Object.keys(t).length)throw new Error("Invalid claim");const r=Object.keys(t)[0];return[r,t[r]]}(r);if(s!==t)throw new Error(`Invalid field name: found ${s} expected ${t}`);return i}const gn=dt.struct("ZkLoginSignature",{inputs:dt.struct("ZkLoginSignatureInputs",{proofPoints:dt.struct("ZkLoginSignatureInputsProofPoints",{a:dt.vector(dt.string()),b:dt.vector(dt.vector(dt.string())),c:dt.vector(dt.string())}),issBase64Details:dt.struct("ZkLoginSignatureInputsClaim",{value:dt.string(),indexMod4:dt.u8()}),headerBase64:dt.string(),addressSeed:dt.string()}),maxEpoch:dt.u64(),userSignature:dt.vector(dt.u8())});var yn,fn,Tn=e=>{throw TypeError(e)},En=(e,t,r)=>t.has(e)||Tn("Cannot "+r),vn=(e,t,r)=>(En(e,t,"read from private field"),r?r.call(e):t.get(e)),xn=(e,t,r)=>t.has(e)?Tn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),On=(e,t,r,s)=>(En(e,t,"write to private field"),s?s.call(e,r):t.set(e,r),r);yn=new WeakMap,fn=new WeakMap;let wn=class t extends oi{constructor(t,{client:r}={}){super(),xn(this,yn),xn(this,fn),On(this,fn,r),"string"==typeof t?On(this,yn,e(t)):t instanceof Uint8Array?On(this,yn,t):On(this,yn,Uint8Array.from(t))}equals(e){return super.equals(e)}toRawBytes(){return vn(this,yn)}flag(){return si.ZkLogin}async verify(e,t){throw Error("does not support")}verifyPersonalMessage(e,r){const s=Cn(r);return In({address:new t(s.publicKey).toSuiAddress(),bytes:i(e),signature:s.serializedSignature,intentScope:"PERSONAL_MESSAGE",client:vn(this,fn)})}verifyTransaction(e,r){const s=Cn(r);return In({address:new t(s.publicKey).toSuiAddress(),bytes:i(e),signature:s.serializedSignature,intentScope:"TRANSACTION_DATA",client:vn(this,fn)})}};const Bn=mn("\n\tquery Zklogin(\n\t\t$bytes: Base64!\n\t\t$signature: Base64!\n\t\t$intentScope: ZkLoginIntentScope!\n\t\t$author: SuiAddress!\n\t) {\n\t\tverifyZkloginSignature(\n\t\t\tbytes: $bytes\n\t\t\tsignature: $signature\n\t\t\tintentScope: $intentScope\n\t\t\tauthor: $author\n\t\t) {\n\t\t\tsuccess\n\t\t\terrors\n\t\t}\n\t}\n");async function In({address:e,bytes:t,signature:r,intentScope:s,client:i=new Vi({url:"https://sui-mainnet.mystenlabs.com/graphql"})}){const n=await i.query({query:Bn,variables:{bytes:t,signature:r,intentScope:s,author:e}});return!0===n.data?.verifyZkloginSignature.success&&0===n.data?.verifyZkloginSignature.errors.length}function Cn(t){const r="string"==typeof t?e(t):t;if(r[0]!==si.ZkLogin)throw new Error("Invalid signature scheme");const s=r.slice(1),{inputs:n,maxEpoch:a,userSignature:o}=function(t){return gn.parse("string"==typeof t?e(t):t)}(s),{issBase64Details:u,addressSeed:c}=n,d=bn(u,"iss"),h=function(e,t){const r=(n=32,function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const s=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){const r=Pr(e.charCodeAt(i)),n=Pr(e.charCodeAt(i+1));if(void 0===r||void 0===n){const t=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}s[t]=16*r+n}return s}(e.toString(16).padStart(2*n,"0").slice(2*-n))),s=(new TextEncoder).encode(t),i=new Uint8Array(1+s.length+r.length);var n;return i.set([s.length],0),i.set(s,1),i.set(r,1+s.length),new wn(i,void 0)}(BigInt(c),d);return{serializedSignature:i(r),signatureScheme:"ZkLogin",zkLogin:{inputs:n,maxEpoch:a,userSignature:o,iss:d,addressSeed:BigInt(c)},signature:r,publicKey:h.toRawBytes()}}const Pn=32,Sn="suiprivkey";class An{async signWithIntent(e,t){const r=ri(t,e),s=Gr(r,{dkLen:32});return{signature:function({signature:e,signatureScheme:t,publicKey:r}){if(!r)throw new Error("`publicKey` is required");const s=r.toRawBytes(),n=new Uint8Array(1+e.length+s.length);return n.set([si[t]]),n.set(e,1),n.set(s,1+e.length),i(n)}({signature:await this.sign(s),signatureScheme:this.getKeyScheme(),publicKey:this.getPublicKey()}),bytes:i(e)}}async signTransaction(e){return this.signWithIntent(e,"TransactionData")}async signPersonalMessage(e){const{signature:t}=await this.signWithIntent(dt.vector(dt.u8()).serialize(e).toBytes(),"PersonalMessage");return{bytes:i(e),signature:t}}toSuiAddress(){return this.getPublicKey().toSuiAddress()}}class jn extends An{}function kn(e){const{prefix:t,words:r}=ti.I.decode(e);if(t!==Sn)throw new Error("invalid private key prefix");const s=new Uint8Array(ti.I.fromWords(r)),i=s.slice(1);return{schema:ni[s[0]],secretKey:i}}function Un(e,t){if(e.length!==Pn)throw new Error("Invalid bytes length");const r=si[t],s=new Uint8Array(e.length+1);return s.set([r]),s.set(e,1),ti.I.encode(Sn,ti.I.toWords(s))}class Yn extends Ar{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,fr(e);const r=Sr(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?e.create().update(r).digest():r);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),i.fill(0)}update(e){return Tr(this),this.iHash.update(e),this}digestInto(e){Tr(this),yr(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:s,destroyed:i,blockLen:n,outputLen:a}=this;return e.finished=s,e.destroyed=i,e.blockLen=n,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Dn=(e,t,r)=>new Yn(e,t).update(r).digest();Dn.create=(e,t)=>new Yn(e,t);class Rn extends Ar{constructor(e,t,r,s){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=xr(this.buffer)}update(e){Tr(this);const{view:t,buffer:r,blockLen:s}=this,i=(e=Sr(e)).length;for(let n=0;n<i;){const a=Math.min(s-this.pos,i-n);if(a!==s)r.set(e.subarray(n,n+a),this.pos),this.pos+=a,n+=a,this.pos===s&&(this.process(t,0),this.pos=0);else{const t=xr(e);for(;s<=i-n;n+=s)this.process(t,n)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){Tr(this),Er(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:s,isLE:i}=this;let{pos:n}=this;t[n++]=128,this.buffer.subarray(n).fill(0),this.padOffset>s-n&&(this.process(r,0),n=0);for(let e=n;e<s;e++)t[e]=0;!function(e,t,r,s){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,s);const i=BigInt(32),n=BigInt(4294967295),a=Number(r>>i&n),o=Number(r&n),u=s?4:0,c=s?0:4;e.setUint32(t+u,a,s),e.setUint32(t+c,o,s)}(r,s-8,BigInt(8*this.length),i),this.process(r,0);const a=xr(e),o=this.outputLen;if(o%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=o/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)a.setUint32(4*e,c[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:s,finished:i,destroyed:n,pos:a}=this;return e.length=s,e.pos=a,e.finished=i,e.destroyed=n,s%t&&e.buffer.set(r),e}}const[Nn,Vn]=(()=>Xr.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e=>BigInt(e)))))(),Xn=new Uint32Array(80),Jn=new Uint32Array(80);class Fn extends Rn{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:r,Bl:s,Ch:i,Cl:n,Dh:a,Dl:o,Eh:u,El:c,Fh:d,Fl:h,Gh:p,Gl:l,Hh:m,Hl:_}=this;return[e,t,r,s,i,n,a,o,u,c,d,h,p,l,m,_]}set(e,t,r,s,i,n,a,o,u,c,d,h,p,l,m,_){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|s,this.Ch=0|i,this.Cl=0|n,this.Dh=0|a,this.Dl=0|o,this.Eh=0|u,this.El=0|c,this.Fh=0|d,this.Fl=0|h,this.Gh=0|p,this.Gl=0|l,this.Hh=0|m,this.Hl=0|_}process(e,t){for(let r=0;r<16;r++,t+=4)Xn[r]=e.getUint32(t),Jn[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|Xn[e-15],r=0|Jn[e-15],s=Xr.rotrSH(t,r,1)^Xr.rotrSH(t,r,8)^Xr.shrSH(t,r,7),i=Xr.rotrSL(t,r,1)^Xr.rotrSL(t,r,8)^Xr.shrSL(t,r,7),n=0|Xn[e-2],a=0|Jn[e-2],o=Xr.rotrSH(n,a,19)^Xr.rotrBH(n,a,61)^Xr.shrSH(n,a,6),u=Xr.rotrSL(n,a,19)^Xr.rotrBL(n,a,61)^Xr.shrSL(n,a,6),c=Xr.add4L(i,u,Jn[e-7],Jn[e-16]),d=Xr.add4H(c,s,o,Xn[e-7],Xn[e-16]);Xn[e]=0|d,Jn[e]=0|c}let{Ah:r,Al:s,Bh:i,Bl:n,Ch:a,Cl:o,Dh:u,Dl:c,Eh:d,El:h,Fh:p,Fl:l,Gh:m,Gl:_,Hh:b,Hl:g}=this;for(let e=0;e<80;e++){const t=Xr.rotrSH(d,h,14)^Xr.rotrSH(d,h,18)^Xr.rotrBH(d,h,41),y=Xr.rotrSL(d,h,14)^Xr.rotrSL(d,h,18)^Xr.rotrBL(d,h,41),f=d&p^~d&m,T=h&l^~h&_,E=Xr.add5L(g,y,T,Vn[e],Jn[e]),v=Xr.add5H(E,b,t,f,Nn[e],Xn[e]),x=0|E,O=Xr.rotrSH(r,s,28)^Xr.rotrBH(r,s,34)^Xr.rotrBH(r,s,39),w=Xr.rotrSL(r,s,28)^Xr.rotrBL(r,s,34)^Xr.rotrBL(r,s,39),B=r&i^r&a^i&a,I=s&n^s&o^n&o;b=0|m,g=0|_,m=0|p,_=0|l,p=0|d,l=0|h,({h:d,l:h}=Xr.add(0|u,0|c,0|v,0|x)),u=0|a,c=0|o,a=0|i,o=0|n,i=0|r,n=0|s;const C=Xr.add3L(x,w,I);r=Xr.add3H(C,v,O,B),s=0|C}({h:r,l:s}=Xr.add(0|this.Ah,0|this.Al,0|r,0|s)),({h:i,l:n}=Xr.add(0|this.Bh,0|this.Bl,0|i,0|n)),({h:a,l:o}=Xr.add(0|this.Ch,0|this.Cl,0|a,0|o)),({h:u,l:c}=Xr.add(0|this.Dh,0|this.Dl,0|u,0|c)),({h:d,l:h}=Xr.add(0|this.Eh,0|this.El,0|d,0|h)),({h:p,l}=Xr.add(0|this.Fh,0|this.Fl,0|p,0|l)),({h:m,l:_}=Xr.add(0|this.Gh,0|this.Gl,0|m,0|_)),({h:b,l:g}=Xr.add(0|this.Hh,0|this.Hl,0|b,0|g)),this.set(r,s,i,n,a,o,u,c,d,h,p,l,m,_,b,g)}roundClean(){Xn.fill(0),Jn.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const qn=jr((()=>new Fn));function Ln(e){if("string"!=typeof e)throw new TypeError("invalid mnemonic type: "+typeof e);return e.normalize("NFKD")}function Mn(e,t=""){return function(e,t,r){const{c:s,dkLen:i,DK:n,PRF:a,PRFSalt:o}=function(e,t,r,s){fr(e);const i=function(e,t){if(void 0!==t&&"[object Object]"!=={}.toString.call(t))throw new Error("Options should be object or undefined");return Object.assign({dkLen:32,asyncTick:10},t)}(0,s),{c:n,dkLen:a,asyncTick:o}=i;if(gr(n),gr(a),gr(o),n<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const u=Sr(t),c=Sr(r),d=new Uint8Array(a),h=Dn.create(e,u),p=h._cloneInto().update(c);return{c:n,dkLen:a,asyncTick:o,DK:d,PRF:h,PRFSalt:p}}(e,t,r,{c:2048,dkLen:64});let u;const c=new Uint8Array(4),d=xr(c),h=new Uint8Array(a.outputLen);for(let e=1,t=0;t<i;e++,t+=a.outputLen){const r=n.subarray(t,t+a.outputLen);d.setInt32(0,e,!1),(u=o._cloneInto(u)).update(c).digestInto(h),r.set(h.subarray(0,r.length));for(let e=1;e<s;e++){a._cloneInto(u).update(h).digestInto(h);for(let e=0;e<r.length;e++)r[e]^=h[e]}}return function(e,t,r,s,i){return e.destroy(),t.destroy(),s&&s.destroy(),i.fill(0),r}(a,o,n,u,h)}(qn,function(e){const t=Ln(e),r=t.split(" ");if(![12,15,18,21,24].includes(r.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:r}}(e).nfkd,(e=>Ln("mnemonic"+e))(t))}function Gn(e){return!!new RegExp("^m\\/44'\\/784'\\/[0-9]+'\\/[0-9]+'\\/[0-9]+'+$").test(e)}const $n=new RegExp("^m(\\/[0-9]+')+$"),zn=e=>e.replace("'",""),Wn=(e,t,r=2147483648)=>{if(!(e=>!!$n.test(e)&&!e.split("/").slice(1).map(zn).some(isNaN))(e))throw new Error("Invalid derivation path");const{key:s,chainCode:i}=(e=>{const t=Dn.create(qn,"ed25519 seed").update(u(e)).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}})(t);return e.split("/").slice(1).map(zn).map((e=>parseInt(e,10))).reduce(((e,t)=>(({key:e,chainCode:t},r)=>{const s=new ArrayBuffer(4);new DataView(s).setUint32(0,r);const i=new Uint8Array(1+e.length+s.byteLength);i.set(new Uint8Array(1).fill(0)),i.set(e,1),i.set(new Uint8Array(s,0,s.byteLength),e.length+1);const n=Dn.create(qn,t).update(i).digest();return{key:n.slice(0,32),chainCode:n.slice(32)}})(e,t+r)),{key:s,chainCode:i})};class Hn extends oi{constructor(t){if(super(),"string"==typeof t?this.data=e(t):t instanceof Uint8Array?this.data=t:this.data=Uint8Array.from(t),32!==this.data.length)throw new Error(`Invalid public key input. Expected 32 bytes, got ${this.data.length}`)}equals(e){return super.equals(e)}toRawBytes(){return this.data}flag(){return si.ED25519}async verify(t,r){let s;if("string"==typeof r){const t=function(t){const r=e(t),s=ni[r[0]];switch(s){case"MultiSig":return{serializedSignature:t,signatureScheme:s,multisig:ar.MultiSig.parse(r.slice(1)),bytes:r};case"ZkLogin":return Cn(t);case"ED25519":case"Secp256k1":case"Secp256r1":const e=ii[s],i=r.slice(1,r.length-e);return{serializedSignature:t,signatureScheme:s,signature:i,publicKey:r.slice(1+i.length),bytes:r};default:throw new Error("Unsupported signature scheme")}}(r);if("ED25519"!==t.signatureScheme)throw new Error("Invalid signature scheme");if(!ai(this.toRawBytes(),t.publicKey))throw new Error("Signature does not match public key");s=t.signature}else s=r;return ei.sign.detached.verify(t,s,this.toRawBytes())}}Hn.SIZE=32;const Kn="m/44'/784'/0'/0'/0'";class Qn extends jn{constructor(e){super(),this.keypair=e||ei.sign.keyPair()}getKeyScheme(){return"ED25519"}static generate(){return new Qn(ei.sign.keyPair())}static fromSecretKey(e,t){const r=e.length;if(r!==Pn)throw new Error(`Wrong secretKey size. Expected ${Pn} bytes, got ${r}.`);const s=ei.sign.keyPair.fromSeed(e);if(!t||!t.skipValidation){const e=(new TextEncoder).encode("sui validation"),t=ei.sign.detached(e,s.secretKey);if(!ei.sign.detached.verify(e,t,s.publicKey))throw new Error("provided secretKey is invalid")}return new Qn(s)}getPublicKey(){return new Hn(this.keypair.publicKey)}getSecretKey(){return Un(this.keypair.secretKey.slice(0,Pn),this.getKeyScheme())}async sign(e){return ei.sign.detached(e,this.keypair.secretKey)}static deriveKeypair(e,t){if(null==t&&(t=Kn),!Gn(t))throw new Error("Invalid derivation path");const{key:r}=Wn(t,function(e){return c(function(e){return Mn(e,"")}(e))}(e));return Qn.fromSecretKey(r)}static deriveKeypairFromSeed(e,t){if(null==t&&(t=Kn),!Gn(t))throw new Error("Invalid derivation path");const{key:r}=Wn(t,e);return Qn.fromSecretKey(r)}}function Zn(e){const t=e.startsWith("0x")?e.slice(2):e,r=t.length%2==0?t:`0${t}}`,s=r.match(/.{2}/g)?.map((e=>parseInt(e,16)))??[];return Uint8Array.from(s)}function ea(e){return e.reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),"")}var ta=r(763);const ra=e=>ta.encode(e),sa=e=>ta.decode(e);function ia(e){return Uint8Array.from(atob(e),(e=>e.charCodeAt(0)))}const na=8192;function aa(e){if(e.length<na)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=na){const s=e.slice(r,r+na);t+=String.fromCharCode(...s)}return btoa(t)}class oa{constructor(e){this.bytePosition=0,this.dataView=new DataView(e.buffer)}shift(e){return this.bytePosition+=e,this}read8(){let e=this.dataView.getUint8(this.bytePosition);return this.shift(1),e}read16(){let e=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),e}read32(){let e=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),e}read64(){let e=this.read32(),t=this.read32().toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+t).toString(10)}read128(){let e=BigInt(this.read64()),t=BigInt(this.read64()).toString(16)+e.toString(16).padStart(16,"0");return BigInt("0x"+t).toString(10)}read256(){let e=BigInt(this.read128()),t=BigInt(this.read128()).toString(16)+e.toString(16).padStart(32,"0");return BigInt("0x"+t).toString(10)}readBytes(e){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t,e);return this.shift(e),r}readULEB(){let e=this.bytePosition+this.dataView.byteOffset,t=new Uint8Array(this.dataView.buffer,e),{value:r,length:s}=function(e){let t=0,r=0,s=0;for(;;){let i=e[s];if(s+=1,t|=(127&i)<<r,!(128&i))break;r+=7}return{value:t,length:s}}(t);return this.shift(s),r}readVec(e){let t=this.readULEB(),r=[];for(let s=0;s<t;s++)r.push(e(this,s,t));return r}}class ua{constructor({size:e=1024,maxSize:t,allocateSize:r=1024}={}){this.bytePosition=0,this.size=e,this.maxSize=t||e,this.allocateSize=r,this.dataView=new DataView(new ArrayBuffer(e))}ensureSizeOrGrow(e){const t=this.bytePosition+e;if(t>this.size){const e=Math.min(this.maxSize,this.size+this.allocateSize);if(t>e)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${t}`);this.size=e;const r=new ArrayBuffer(this.size);new Uint8Array(r).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(r)}}shift(e){return this.bytePosition+=e,this}write8(e){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(e)),this.shift(1)}write16(e){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(e),!0),this.shift(2)}write32(e){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(e),!0),this.shift(4)}write64(e){return ca(BigInt(e),8).forEach((e=>this.write8(e))),this}write128(e){return ca(BigInt(e),16).forEach((e=>this.write8(e))),this}write256(e){return ca(BigInt(e),32).forEach((e=>this.write8(e))),this}writeULEB(e){return function(e){let t=[],r=0;if(0===e)return[0];for(;e>0;)t[r]=127&e,(e>>=7)&&(t[r]|=128),r+=1;return t}(e).forEach((e=>this.write8(e))),this}writeVec(e,t){return this.writeULEB(e.length),Array.from(e).forEach(((r,s)=>t(this,r,s,e.length))),this}*[Symbol.iterator](){for(let e=0;e<this.bytePosition;e++)yield this.dataView.getUint8(e);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(e){return function(e,t){switch(t){case"base58":return ra(e);case"base64":return aa(e);case"hex":return ea(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}(this.toBytes(),e)}}function ca(e,t){let r=new Uint8Array(t),s=0;for(;e>0;)r[s]=Number(e%BigInt(256)),e/=BigInt(256),s+=1;return r}var da,ha,pa,la,ma=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},_a=(e,t,r)=>(ma(e,t,"read from private field"),r?r.call(e):t.get(e)),ba=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},ga=(e,t,r,s)=>(ma(e,t,"write to private field"),s?s.call(e,r):t.set(e,r),r);const ya=class{constructor(e){ba(this,da,void 0),ba(this,ha,void 0),this.name=e.name,this.read=e.read,this.serializedSize=e.serializedSize??(()=>null),ga(this,da,e.write),ga(this,ha,e.serialize??((e,t)=>{const r=new ua({size:this.serializedSize(e)??void 0,...t});return _a(this,da).call(this,e,r),r.toBytes()})),this.validate=e.validate??(()=>{})}write(e,t){this.validate(e),_a(this,da).call(this,e,t)}serialize(e,t){return this.validate(e),new Ea(this,_a(this,ha).call(this,e,t))}parse(e){const t=new oa(e);return this.read(t)}transform({name:e,input:t,output:r}){return new ya({name:e??this.name,read:e=>r(this.read(e)),write:(e,r)=>_a(this,da).call(this,t(e),r),serializedSize:e=>this.serializedSize(t(e)),serialize:(e,r)=>_a(this,ha).call(this,t(e),r),validate:e=>this.validate(t(e))})}};let fa=ya;da=new WeakMap,ha=new WeakMap;const Ta=Symbol.for("@mysten/serialized-bcs");class Ea{constructor(e,t){ba(this,pa,void 0),ba(this,la,void 0),ga(this,pa,e),ga(this,la,t)}get[Ta](){return!0}toBytes(){return _a(this,la)}toHex(){return ea(_a(this,la))}toBase64(){return aa(_a(this,la))}toBase58(){return ra(_a(this,la))}parse(){return _a(this,pa).parse(_a(this,la))}}pa=new WeakMap,la=new WeakMap;const va=32,xa=class{constructor(e){if(this.types=new Map,this.counter=0,e instanceof xa)return this.schema=e.schema,void(this.types=new Map(e.types));if(this.schema=e,this.registerAddressType(xa.ADDRESS,e.addressLength,e.addressEncoding),this.registerVectorType(e.vectorType),e.types&&e.types.structs)for(let t of Object.keys(e.types.structs))this.registerStructType(t,e.types.structs[t]);if(e.types&&e.types.enums)for(let t of Object.keys(e.types.enums))this.registerEnumType(t,e.types.enums[t]);if(e.types&&e.types.aliases)for(let t of Object.keys(e.types.aliases))this.registerAlias(t,e.types.aliases[t]);var t;!1!==e.withPrimitives&&((t=this).registerType(Oa.U8,(function(e,t){return e.write8(t)}),(function(e){return e.read8()}),(e=>e<256)),t.registerType(Oa.U16,(function(e,t){return e.write16(t)}),(function(e){return e.read16()}),(e=>e<65536)),t.registerType(Oa.U32,(function(e,t){return e.write32(t)}),(function(e){return e.read32()}),(e=>e<=4294967296n)),t.registerType(Oa.U64,(function(e,t){return e.write64(t)}),(function(e){return e.read64()})),t.registerType(Oa.U128,(function(e,t){return e.write128(t)}),(function(e){return e.read128()})),t.registerType(Oa.U256,(function(e,t){return e.write256(t)}),(function(e){return e.read256()})),t.registerType(Oa.BOOL,(function(e,t){return e.write8(t)}),(function(e){return"1"===e.read8().toString(10)})),t.registerType(Oa.STRING,(function(e,t){return e.writeVec(Array.from(t),((e,t)=>e.write8(t.charCodeAt(0))))}),(function(e){return e.readVec((e=>e.read8())).map((e=>String.fromCharCode(Number(e)))).join("")}),(e=>!0)),t.registerType(Oa.HEX,(function(e,t){return e.writeVec(Array.from(Zn(t)),((e,t)=>e.write8(t)))}),(function(e){let t=e.readVec((e=>e.read8()));return ea(new Uint8Array(t))})),t.registerType(Oa.BASE58,(function(e,t){return e.writeVec(Array.from(sa(t)),((e,t)=>e.write8(t)))}),(function(e){let t=e.readVec((e=>e.read8()));return ra(new Uint8Array(t))})),t.registerType(Oa.BASE64,(function(e,t){return e.writeVec(Array.from(ia(t)),((e,t)=>e.write8(t)))}),(function(e){let t=e.readVec((e=>e.read8()));return aa(new Uint8Array(t))})))}tempKey(){return"bcs-struct-"+ ++this.counter}ser(e,t,r){if("string"==typeof e||Array.isArray(e)){const{name:s,params:i}=this.parseTypeName(e);return this.getTypeInterface(s).encode(this,t,r,i)}if("object"==typeof e){const s=this.tempKey();return new xa(this).registerStructType(s,e).ser(s,t,r)}throw new Error(`Incorrect type passed into the '.ser()' function. \n${JSON.stringify(e)}`)}de(e,t,r){if("string"==typeof t){if(!r)throw new Error("To pass a string to `bcs.de`, specify encoding");t=function(e,t){switch(t){case"base58":return sa(e);case"base64":return ia(e);case"hex":return Zn(e);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}(t,r)}if("string"==typeof e||Array.isArray(e)){const{name:r,params:s}=this.parseTypeName(e);return this.getTypeInterface(r).decode(this,t,s)}if("object"==typeof e){const s=new xa(this),i=this.tempKey();return s.registerStructType(i,e).de(i,t,r)}throw new Error(`Incorrect type passed into the '.de()' function. \n${JSON.stringify(e)}`)}hasType(e){return this.types.has(e)}registerAlias(e,t){return this.types.set(e,t),this}registerType(e,t,r,s=()=>!0){const{name:i,params:n}=this.parseTypeName(e);return this.types.set(i,{encode(e,t,r,s){const i=n.reduce(((e,t,r)=>Object.assign(e,{[t]:s[r]})),{});return this._encodeRaw.call(e,new ua(r),t,s,i)},decode(e,t,r){const s=n.reduce(((e,t,s)=>Object.assign(e,{[t]:r[s]})),{});return this._decodeRaw.call(e,new oa(t),r,s)},_encodeRaw(e,r,n,a){if(s(r))return t.call(this,e,r,n,a);throw new Error(`Validation failed for type ${i}, data: ${r}`)},_decodeRaw(e,t,s){return r.call(this,e,t,s)}}),this}registerBcsType(e,t){return this.registerType(e,((e,r,s)=>{const i=s.map((e=>new fa({name:String(e),write:(t,r)=>{const{name:i,params:n}=this.parseTypeName(e),a=this.getTypeInterface(i),o=n.reduce(((e,t,r)=>Object.assign(e,{[t]:s[r]})),{});return a._encodeRaw.call(this,r,t,n,o)},read:()=>{throw new Error("Not implemented")}})));return t(...i).write(r,e),e}),((e,r)=>{const s=r.map((e=>new fa({name:String(e),write:(e,t)=>{throw new Error("Not implemented")},read:t=>{const{name:s,params:i}=this.parseTypeName(e),n=this.getTypeInterface(s),a=i.reduce(((e,t,s)=>Object.assign(e,{[t]:r[s]})),{});return n._decodeRaw.call(this,t,i,a)}})));return t(...s).read(e)})),this}registerAddressType(e,t,r="hex"){switch(r){case"base64":return this.registerType(e,(function(e,t){return ia(t).reduce(((e,t)=>e.write8(t)),e)}),(function(e){return aa(e.readBytes(t))}));case"hex":return this.registerType(e,(function(e,t){return Zn(t).reduce(((e,t)=>e.write8(t)),e)}),(function(e){return ea(e.readBytes(t))}));default:throw new Error("Unsupported encoding! Use either hex or base64")}}registerVectorType(e){let{name:t,params:r}=this.parseTypeName(e);if(r.length>1)throw new Error("Vector can have only one type parameter; got "+t);return this.registerType(e,(function(t,r,s,i){return t.writeVec(r,((t,r)=>{let n=s[0];if(!n)throw new Error(`Incorrect number of type parameters passed a to vector '${e}'`);let{name:a,params:o}=this.parseTypeName(n);if(this.hasType(a))return this.getTypeInterface(a)._encodeRaw.call(this,t,r,o,i);if(!(a in i))throw new Error(`Unable to find a matching type definition for ${a} in vector; make sure you passed a generic`);let{name:u,params:c}=this.parseTypeName(i[a]);return this.getTypeInterface(u)._encodeRaw.call(this,t,r,c,i)}))}),(function(t,r,s){return t.readVec((t=>{let i=r[0];if(!i)throw new Error(`Incorrect number of type parameters passed to a vector '${e}'`);let{name:n,params:a}=this.parseTypeName(i);if(this.hasType(n))return this.getTypeInterface(n)._decodeRaw.call(this,t,a,s);if(!(n in s))throw new Error(`Unable to find a matching type definition for ${n} in vector; make sure you passed a generic`);let{name:o,params:u}=this.parseTypeName(s[n]);return this.getTypeInterface(o)._decodeRaw.call(this,t,u,s)}))}))}registerStructType(e,t){for(let e in t){let r=this.tempKey(),s=t[e];Array.isArray(s)||"string"==typeof s||(t[e]=r,this.registerStructType(r,s))}let r=Object.freeze(t),s=Object.keys(r),{name:i,params:n}=this.parseTypeName(e);return this.registerType(e,(function(e,t,a,o){if(!t||t.constructor!==Object)throw new Error(`Expected ${i} to be an Object, got: ${t}`);if(a.length!==n.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${n.length}, got: ${a.length}`);for(let u of s){if(!(u in t))throw new Error(`Struct ${i} requires field ${u}:${r[u]}`);const{name:s,params:c}=this.parseTypeName(r[u]);if(n.includes(s)){const r=n.indexOf(s);let{name:c,params:d}=this.parseTypeName(a[r]);if(this.hasType(c)){this.getTypeInterface(c)._encodeRaw.call(this,e,t[u],d,o);continue}if(!(c in o))throw new Error(`Unable to find a matching type definition for ${c} in ${i}; make sure you passed a generic`);let{name:h,params:p}=this.parseTypeName(o[c]);this.getTypeInterface(h)._encodeRaw.call(this,e,t[u],p,o)}else this.getTypeInterface(s)._encodeRaw.call(this,e,t[u],c,o)}return e}),(function(e,t,a){if(t.length!==n.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${n.length}, got: ${t.length}`);let o={};for(let u of s){const{name:s,params:c}=this.parseTypeName(r[u]);if(n.includes(s)){const r=n.indexOf(s);let{name:c,params:d}=this.parseTypeName(t[r]);if(this.hasType(c)){o[u]=this.getTypeInterface(c)._decodeRaw.call(this,e,d,a);continue}if(!(c in a))throw new Error(`Unable to find a matching type definition for ${c} in ${i}; make sure you passed a generic`);let{name:h,params:p}=this.parseTypeName(a[c]);o[u]=this.getTypeInterface(h)._decodeRaw.call(this,e,p,a)}else o[u]=this.getTypeInterface(s)._decodeRaw.call(this,e,c,a)}return o}))}registerEnumType(e,t){for(let e in t){let r=this.tempKey(),s=t[e];null===s||Array.isArray(s)||"string"==typeof s||(t[e]=r,this.registerStructType(r,s))}let r=Object.freeze(t),s=Object.keys(r),{name:i,params:n}=this.parseTypeName(e);return this.registerType(e,(function(e,t,a,o){if(!t)throw new Error(`Unable to write enum "${i}", missing data.\nReceived: "${t}"`);if("object"!=typeof t)throw new Error(`Incorrect data passed into enum "${i}", expected object with properties: "${s.join(" | ")}".\nReceived: "${JSON.stringify(t)}"`);let u=Object.keys(t)[0];if(void 0===u)throw new Error(`Empty object passed as invariant of the enum "${i}"`);let c=s.indexOf(u);if(-1===c)throw new Error(`Unknown invariant of the enum "${i}", allowed values: "${s.join(" | ")}"; received "${u}"`);let d=s[c],h=r[d];if(e.write8(c),null===h)return e;let p=n.indexOf(h),l=-1===p?h:a[p];{let{name:r,params:s}=this.parseTypeName(l);return this.getTypeInterface(r)._encodeRaw.call(this,e,t[u],s,o)}}),(function(e,t,a){let o=e.readULEB(),u=s[o],c=r[u];if(-1===o)throw new Error(`Decoding type mismatch, expected enum "${i}" invariant index, received "${o}"`);if(null===c)return{[u]:!0};let d=n.indexOf(c),h=-1===d?c:t[d];{let{name:t,params:r}=this.parseTypeName(h);return{[u]:this.getTypeInterface(t)._decodeRaw.call(this,e,r,a)}}}))}getTypeInterface(e){let t=this.types.get(e);if("string"==typeof t){let e=[];for(;"string"==typeof t;){if(e.includes(t))throw new Error(`Recursive definition found: ${e.join(" -> ")} -> ${t}`);e.push(t),t=this.types.get(t)}}if(void 0===t)throw new Error(`Type ${e} is not registered`);return t}parseTypeName(e){if(Array.isArray(e)){let[t,...r]=e;return{name:t,params:r}}if("string"!=typeof e)throw new Error(`Illegal type passed as a name of the type: ${e}`);let[t,r]=this.schema.genericSeparators||["<",">"],s=e.indexOf(t),i=Array.from(e).reverse().indexOf(r);if(-1===s&&-1===i)return{name:e,params:[]};if(-1===s||-1===i)throw new Error(`Unclosed generic in name '${e}'`);let n=e.slice(0,s),a=function(e,t=["<",">"]){const[r,s]=t,i=[];let n="",a=0;for(let t=0;t<e.length;t++){const o=e[t];o===r&&a++,o===s&&a--,0!==a||","!==o?n+=o:(i.push(n.trim()),n="")}return i.push(n.trim()),i}(e.slice(s+1,e.length-i-1),this.schema.genericSeparators);return{name:n,params:a}}};let Oa=xa;function wa(){return{genericSeparators:["<",">"],vectorType:"vector",addressLength:va,addressEncoding:"hex"}}var Ba;Oa.U8="u8",Oa.U16="u16",Oa.U32="u32",Oa.U64="u64",Oa.U128="u128",Oa.U256="u256",Oa.BOOL="bool",Oa.VECTOR="vector",Oa.ADDRESS="address",Oa.STRING="string",Oa.HEX="hex-string",Oa.BASE58="base58-string",Oa.BASE64="base64-string",function(e){e.IsValidDesription="invalid description",e.IsValidName="invalid name",e.IsValidName_AllowEmpty="invalid name",e.IsValidEndpoint="invalid endpoint",e.IsValidAddress="invalid address",e.IsValidArgType="invalid argument type",e.IsValidTokenType="invalid token type",e.IsValidUint="invalid uint",e.IsValidInt="invalid int",e.IsValidU64="invalid u64",e.IsValidU8="invalid u8",e.IsValidPercent="invalid percent",e.IsValidArray="invalid array",e.IsValidObjects="invalid objects",e.AllInvalid="one valid at least",e.InvalidParam="invalid parameter",e.IsValidPermissionIndex="invalid permission index",e.IsValidKey="invalid key",e.Fail="fail",e.IsValidIndentifier="indentifier invalid",e.isValidHttpUrl="invalid url",e.IsValidBizPermissionIndex="invalid biz-permission index",e.bcsTypeInvalid="invalid bcs type",e.IsValidServiceItemName="invalid service item name",e.IsValidCoinType="not the coin type",e.IsValidGuardIdentifier="guard identifier invalid",e.noPermission="no permission"}(Ba||(Ba={}));const Ia=(e,t)=>{throw e.toString()+(t?" "+t:"")},Ca=BigInt("255"),Pa=BigInt("18446744073709551615"),Sa=BigInt("340282366920938463463374607431768211455"),Aa=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),ja=0,ka=e=>e===Yo.TYPE_U8||e===Yo.TYPE_U64||e===Yo.TYPE_U128||e===Yo.TYPE_U256?Do.PositiveNumber:e===Yo.TYPE_VEC_U8||e===Yo.TYPE_VEC_U64||e===Yo.TYPE_VEC_U128||e===Yo.TYPE_VEC_U256||e===Yo.TYPE_VEC_BOOL?Do.PositiveNumber_Vec:e===Yo.TYPE_ADDRESS?Do.Address:e===Yo.TYPE_VEC_ADDRESS?Do.Address_Vec:e===Yo.TYPE_STRING?Do.String:e===Yo.TYPE_VEC_STRING?Do.String_Vec:e===Yo.TYPE_BOOL?Do.Bool:-1,Ua=(e,t)=>{let r=e.splice(0,1);return 1==r[0]?{bNone:!1,value:za.getInstance().de(t,Uint8Array.from(e))}:(0==r[0]||Ia(Ba.Fail,"readOption: option invalid"),{bNone:!0,value:ja})},Ya=e=>{let t=e.splice(0,1);if(1==t[0]){let t=Da(Uint8Array.from(e)),r=za.getInstance().de(Yo.TYPE_STRING,Uint8Array.from(e));return e.splice(0,t.value+t.length),{bNone:!1,value:r}}return 0==t[0]||Ia(Ba.Fail,"readOption: option invalid"),{bNone:!0,value:ja}},Da=e=>{let t=0,r=0,s=0;for(;;){let i=e[s];if(s+=1,t|=(127&i)<<r,!(128&i))break;r+=7}return{value:t,length:s}},Ra=(e,t)=>{let r=Da(Uint8Array.from(e));e.splice(0,r.length);let s=[];for(let i=0;i<r.value;i++)s.push(t(e,i,r.value));return s},Na=(e,t,r)=>e.shift(),Va=(e,t,r)=>e.splice(0,8),Xa=(e,t,r)=>e.splice(0,16),Ja=(e,t,r)=>e.splice(0,32),Fa=(e,...t)=>{let r=0;for(const e of t)r+=e.length;const s=new e(r);let i=0;for(const e of t)s.set(e,i),i+=e.length;return s},qa=(e,t="payment::Payment<")=>{if(e){const r=e.indexOf(t);if(r>0)return e.slice(r+t.length,e.length-1)}return""},La=(e,t)=>e.length===t.length&&!e.some((e=>!t.includes(e))),Ma=e=>{for(var t=[],r=0;r<e.length;r++)-1==t.indexOf(e[r])&&t.push(e[r]);return t};function Ga(e){return e&&e[0].toUpperCase()+e.slice(1)}function $a(e){var t=[];let r=e.indexOf("<");return r>=0&&(t=e.slice(r+1,e.length-1).split(",")),t}class za{constructor(){this.bcs=new Oa(wa()),this.bcs.registerEnumType("Option<T>",{none:null,some:"T"}),this.bcs.registerStructType("EntStruct",{avatar:"vector<u8>",resource:"Option<address>",safer_name:"vector<string>",safer_value:"vector<string>",like:Oa.U32,dislike:Oa.U32}),this.bcs.registerStructType("TagStruct",{nick:"string",tags:"vector<string>"}),this.bcs.registerStructType("PersonalInfo",{name:"vector<u8>",description:"vector<u8>",avatar:Oa.STRING,twitter:Oa.STRING,discord:Oa.STRING,homepage:Oa.STRING}),this.bcs.registerStructType("OptionAddress",{address:"Option<address>"}),this.bcs.registerStructType("Guards",{guards:"vector<OptionAddress>"}),this.bcs.registerStructType("Perm",{index:Oa.U64,guard:"Option<address>"}),this.bcs.registerStructType("Perms",{perms:"vector<Perm>"})}static getInstance(){return za._instance||(za._instance=new za),za._instance}ser_option_u32(e){return this.bcs.ser("Option<u32>",{some:e}).toBytes()}ser(e,t){if("string"==typeof e)return this.bcs.ser(e,t).toBytes();switch(e){case Yo.TYPE_BOOL:return this.bcs.ser(Oa.BOOL,t).toBytes();case Yo.TYPE_ADDRESS:return this.bcs.ser(Oa.ADDRESS,t).toBytes();case Yo.TYPE_U64:return this.bcs.ser(Oa.U64,t).toBytes();case Yo.TYPE_U8:return this.bcs.ser(Oa.U8,t).toBytes();case Yo.TYPE_VEC_U8:return this.bcs.ser("vector<u8>",t).toBytes();case Yo.TYPE_U128:return this.bcs.ser(Oa.U128,t).toBytes();case Yo.TYPE_VEC_ADDRESS:return this.bcs.ser("vector<address>",t).toBytes();case Yo.TYPE_VEC_BOOL:return this.bcs.ser("vector<bool>",t).toBytes();case Yo.TYPE_VEC_VEC_U8:return this.bcs.ser("vector<vector<u8>>",t).toBytes();case Yo.TYPE_VEC_U64:return this.bcs.ser("vector<u64>",t).toBytes();case Yo.TYPE_VEC_U128:return this.bcs.ser("vector<u128>",t).toBytes();case Yo.TYPE_OPTION_ADDRESS:return this.bcs.ser("Option<address>",{some:t}).toBytes();case Yo.TYPE_OPTION_BOOL:return this.bcs.ser("Option<bool>",{some:t}).toBytes();case Yo.TYPE_OPTION_U8:return this.bcs.ser("Option<u8>",{some:t}).toBytes();case Yo.TYPE_OPTION_U64:return this.bcs.ser("Option<u64>",{some:t}).toBytes();case Yo.TYPE_OPTION_U128:return this.bcs.ser("Option<u128>",{some:t}).toBytes();case Yo.TYPE_OPTION_U256:return this.bcs.ser("Option<u256>",{some:t}).toBytes();case Yo.TYPE_OPTION_STRING:return this.bcs.ser("Option<string>",{some:t}).toBytes();case Yo.TYPE_VEC_U256:return this.bcs.ser("vector<u256>",t).toBytes();case Yo.TYPE_U256:return this.bcs.ser(Oa.U256,t).toBytes();case Yo.TYPE_STRING:const e=(new TextEncoder).encode(t);return this.bcs.ser("vector<u8>",e).toBytes();case Yo.TYPE_VEC_STRING:return this.bcs.ser("vector<vector<u8>>",t.map((e=>(new TextEncoder).encode(e)))).toBytes();default:Ia(Ba.bcsTypeInvalid,"ser")}return new Uint8Array}de(e,t){if("string"==typeof e)return this.bcs.de(e,t);switch(e){case Yo.TYPE_BOOL:return this.bcs.de(Oa.BOOL,t);case Yo.TYPE_ADDRESS:return this.bcs.de(Oa.ADDRESS,t);case Yo.TYPE_U64:return this.bcs.de(Oa.U64,t);case Yo.TYPE_U8:return this.bcs.de(Oa.U8,t);case Yo.TYPE_VEC_U8:return this.bcs.de("vector<u8>",t);case Yo.TYPE_U128:return this.bcs.de(Oa.U128,t);case Yo.TYPE_VEC_ADDRESS:return this.bcs.de("vector<address>",t);case Yo.TYPE_VEC_BOOL:return this.bcs.de("vector<bool>",t);case Yo.TYPE_VEC_VEC_U8:return this.bcs.de("vector<vector<u8>>",t);case Yo.TYPE_VEC_U64:return this.bcs.de("vector<u64>",t);case Yo.TYPE_VEC_U128:return this.bcs.de("vector<u128>",t);case Yo.TYPE_OPTION_ADDRESS:return this.bcs.de("Option<address>",t);case Yo.TYPE_OPTION_BOOL:return this.bcs.de("Option<bool>",t);case Yo.TYPE_OPTION_U8:return this.bcs.de("Option<u8>",t);case Yo.TYPE_OPTION_U64:return this.bcs.de("Option<u64>",t);case Yo.TYPE_OPTION_U128:return this.bcs.de("Option<u128>",t);case Yo.TYPE_OPTION_U256:return this.bcs.de("Option<u256>",t);case Yo.TYPE_OPTION_STRING:return this.bcs.de("Option<string>",t);case Yo.TYPE_VEC_U256:return this.bcs.de("vector<u256>",t);case Yo.TYPE_STRING:return(new TextDecoder).decode(Uint8Array.from(this.bcs.de("vector<u8>",t)));case Yo.TYPE_VEC_STRING:return this.bcs.de("vector<string>",t);case Yo.TYPE_U256:return this.bcs.de(Oa.U256,t);default:Ia(Ba.bcsTypeInvalid,"de")}}de_ent(e){if(!e||e.length<2)return"";const t=this.bcs.de("vector<u8>",e);return this.bcs.de("EntStruct",Uint8Array.from(t))}de_entInfo(e){if(!e||0===e.length)return;let t=this.bcs.de("PersonalInfo",e);return t.name=(new TextDecoder).decode(Uint8Array.from(t.name)),t.description=(new TextDecoder).decode(Uint8Array.from(t.description)),t}de_tags(e){if(!e||0===e.length)return"";const t=this.bcs.de("vector<u8>",e);return this.bcs.de("TagStruct",Uint8Array.from(t))}de_perms(e){return!e||e.length<1?"":this.bcs.de("Perms",e).perms.map((e=>({index:e?.index,guard:e?.guard?.none?void 0:"0x"+e?.guard?.some})))}}function Wa(e){const t=(new TextEncoder).encode(e);return new Uint8Array(t.buffer)}function Ha(e){if(!e)return new Uint8Array(0);const t=[];for(t.unshift(255&e);e>=256;)e>>>=8,t.unshift(255&e);return new Uint8Array(t)}const Ka=e=>"[object Array]"==Object.prototype.toString.call(e),Qa=(e,t)=>{let r=t||{};for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&("object"==typeof e[t]&&null!==e[t]?(r[t]=Ka(e[t])?[]:{},Qa(e[t],r[t])):r[t]=e[t]);return r},Za=4e3,eo=64,to=1024,ro=(e,t)=>za.getInstance().ser(Yo.TYPE_STRING,e).length<=t,so=e=>ro(e,Za),io=e=>!(!e||0===e.length)&&ro(e,eo),no=e=>ro(e,eo),ao=e=>e.length>0&&e.length<=to&&Io(e),oo=e=>!(!e||!ne(e)),uo=e=>!!e&&(e.startsWith("0x2::coin::Coin")||e.startsWith("0x0000000000000000000000000000000000000000000000000000000000000002")),co=(e=864e5)=>{const t=Date.now();return Math.floor(t/e)*e},ho=(e,t=Aa,r)=>{if(""===e||void 0===e)return!1;try{const s=BigInt(e);if(s<=t)return void 0===r||s>=r}catch(e){}return!1},po=(e,t=0)=>ho(e,Ca,BigInt(t)),lo=(e,t=0)=>ho(e,Pa,BigInt(t)),mo=(e,t=0)=>ho(e,Sa,BigInt(t)),_o=(e,t=0)=>ho(e,Aa,BigInt(t)),bo=e=>{if(!e||0===e.length)return!1;let t=e.split("::");return 3===t.length&&!(!oo(t[0])&&"0x2"!=t[0]||0===t[1].length||0===t[2].length)},go=e=>!(!e||0===e.length)&&!(e.split("::").length<3),yo=e=>("string"==typeof e&&(e=parseInt(e)),Number.isSafeInteger(e)),fo=e=>ho(e,BigInt(100),BigInt(0)),To=(e,t)=>{for(let r=0;r<e.length;r++)if(!t(e[r]))return!1;return!0},Eo=e=>e>Pa?Pa:e;function vo(e){const t=e.trim();if(-1!==t.indexOf(".")){let e=t.length-1;for(;"0"===t[e];)e--;return"."===t[e]&&e--,t.slice(0,e+1)}return t}const xo=(e,t)=>{if(!e)return"";if("0"===e)return"0";if(t<=0)return e;var r=t-e.length;return vo(0===r?"."+e:r<0?e.slice(0,Math.abs(r))+"."+e.slice(Math.abs(r)):"."+e.padStart(t,"0"))},Oo=e=>{if(e){const t="0x2::coin::Coin<";let r=e.indexOf(t);if(r>=0){let s=e.slice(r+t.length,e.length-1);if(-1===s.indexOf("<")){for(;">"==s[s.length-1];)s=s.slice(0,-1);let e=s.lastIndexOf("::");return{isCoin:!0,coin:s,token:s.slice(e+2)}}}}return{isCoin:!1,coin:"",token:""}};function wo(e,t){const r=e.length+1,s=new Uint8Array(r);return s.set([t],0),s.set(e,1),s}function Bo(e){let t="";var r;return Math.abs(e)<1?(r=parseInt(e.toString().split("e-")[1]))&&(e*=Math.pow(10,r-1),t="0."+new Array(r).join("0")+e.toString().substring(2)):(r=parseInt(e.toString().split("+")[1]))>20&&(r-=20,t=(e/=Math.pow(10,r))+new Array(r+1).join("0")),t}function Io(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol||"ipfs:"===t.protocol}const Co=e=>oe(e.toString(16)),Po=e=>{e.id&&(e?.onBegin&&e.onBegin(e.id),$o.Client().getObject({id:e.id,options:{showContent:!0,showType:!0,showOwner:!0}}).then((t=>{t.error?e?.onObjectErr&&e.onObjectErr(e.id,t.error):e?.onObjectRes&&e.onObjectRes(e.id,t)})).catch((t=>{console.log(t),e?.onObjectErr&&e.onObjectErr(e.id,t)})),$o.Client().getDynamicFields({parentId:e.id}).then((t=>{e?.onDynamicRes&&e.onDynamicRes(e.id,t),t.data.length>0&&$o.Client().multiGetObjects({ids:t.data.map((e=>e.objectId)),options:{showContent:!0}}).then((t=>{e?.onFieldsRes&&e.onFieldsRes(e.id,t)})).catch((t=>{console.log(t),e?.onFieldsErr&&e.onFieldsErr(e.id,t)}))})).catch((t=>{console.log(t),e?.onDynamicErr&&e.onDynamicErr(e.id,t)})))},So=e=>e?e.substring(0,1).toUpperCase()+e.substring(1):"";function Ao(e){return e.some(((t,r)=>e.findIndex((e=>e===t))!==r))}var jo,ko;!function(e){e.machine="machine",e.progress="progress",e.repository="repository",e.permission="permission",e.passport="passport",e.guard="guard",e.demand="demand",e.order="order",e.service="service",e.resource="resource",e.entity="entity",e.wowok="wowok",e.treasury="treasury",e.payment="payment",e.arbitration="arbitration",e.arb="arb"}(jo||(jo={})),function(e){e[e.TYPE_QUERY=1]="TYPE_QUERY",e[e.TYPE_NUMBER_ADD=2]="TYPE_NUMBER_ADD",e[e.TYPE_NUMBER_SUBTRACT=3]="TYPE_NUMBER_SUBTRACT",e[e.TYPE_NUMBER_MULTIPLY=4]="TYPE_NUMBER_MULTIPLY",e[e.TYPE_NUMBER_DEVIDE=5]="TYPE_NUMBER_DEVIDE",e[e.TYPE_NUMBER_MOD=6]="TYPE_NUMBER_MOD",e[e.TYPE_NUMBER_ADDRESS=7]="TYPE_NUMBER_ADDRESS",e[e.TYPE_LOGIC_AS_U256_GREATER=11]="TYPE_LOGIC_AS_U256_GREATER",e[e.TYPE_LOGIC_AS_U256_GREATER_EQUAL=12]="TYPE_LOGIC_AS_U256_GREATER_EQUAL",e[e.TYPE_LOGIC_AS_U256_LESSER=13]="TYPE_LOGIC_AS_U256_LESSER",e[e.TYPE_LOGIC_AS_U256_LESSER_EQUAL=14]="TYPE_LOGIC_AS_U256_LESSER_EQUAL",e[e.TYPE_LOGIC_AS_U256_EQUAL=15]="TYPE_LOGIC_AS_U256_EQUAL",e[e.TYPE_LOGIC_EQUAL=16]="TYPE_LOGIC_EQUAL",e[e.TYPE_LOGIC_HAS_SUBSTRING=17]="TYPE_LOGIC_HAS_SUBSTRING",e[e.TYPE_LOGIC_NOT=18]="TYPE_LOGIC_NOT",e[e.TYPE_LOGIC_AND=19]="TYPE_LOGIC_AND",e[e.TYPE_LOGIC_OR=20]="TYPE_LOGIC_OR"}(ko||(ko={}));const Uo=[[ko.TYPE_LOGIC_AS_U256_GREATER,"Unsigned Integer >","The first item > anything that follows"],[ko.TYPE_LOGIC_AS_U256_GREATER_EQUAL,"Unsigned Integer >=","The first item >= anything that follows"],[ko.TYPE_LOGIC_AS_U256_LESSER,"Unsigned Integer <","The first item < anything that follows"],[ko.TYPE_LOGIC_AS_U256_LESSER_EQUAL,"Unsigned Integer <=","The first item <= anything that follows"],[ko.TYPE_LOGIC_AS_U256_EQUAL,"Unsigned Integer =","The first item = anything that follows"],[ko.TYPE_LOGIC_EQUAL,"Equal","Data and type are exactly equal for all items"],[ko.TYPE_LOGIC_HAS_SUBSTRING,"Has Sub String","The first string contains anything that follows"],[ko.TYPE_LOGIC_NOT,"Not","Not operation"],[ko.TYPE_LOGIC_AND,"And","All Items And operations"],[ko.TYPE_LOGIC_OR,"Or","All Items Or operations"]];var Yo,Do;!function(e){e[e.TYPE_BOOL=100]="TYPE_BOOL",e[e.TYPE_ADDRESS=101]="TYPE_ADDRESS",e[e.TYPE_U8=102]="TYPE_U8",e[e.TYPE_U64=103]="TYPE_U64",e[e.TYPE_VEC_U8=104]="TYPE_VEC_U8",e[e.TYPE_U128=105]="TYPE_U128",e[e.TYPE_VEC_ADDRESS=106]="TYPE_VEC_ADDRESS",e[e.TYPE_VEC_BOOL=107]="TYPE_VEC_BOOL",e[e.TYPE_VEC_VEC_U8=108]="TYPE_VEC_VEC_U8",e[e.TYPE_VEC_U64=109]="TYPE_VEC_U64",e[e.TYPE_VEC_U128=110]="TYPE_VEC_U128",e[e.TYPE_OPTION_ADDRESS=111]="TYPE_OPTION_ADDRESS",e[e.TYPE_OPTION_BOOL=112]="TYPE_OPTION_BOOL",e[e.TYPE_OPTION_U8=113]="TYPE_OPTION_U8",e[e.TYPE_OPTION_U64=114]="TYPE_OPTION_U64",e[e.TYPE_OPTION_U128=115]="TYPE_OPTION_U128",e[e.TYPE_OPTION_U256=116]="TYPE_OPTION_U256",e[e.TYPE_OPTION_STRING=117]="TYPE_OPTION_STRING",e[e.TYPE_OPTION_VEC_U8=118]="TYPE_OPTION_VEC_U8",e[e.TYPE_VEC_U256=119]="TYPE_VEC_U256",e[e.TYPE_STRING=120]="TYPE_STRING",e[e.TYPE_VEC_STRING=121]="TYPE_VEC_STRING",e[e.TYPE_U256=122]="TYPE_U256"}(Yo||(Yo={})),function(e){e[e.Address=200]="Address",e[e.Address_Vec=201]="Address_Vec",e[e.PositiveNumber=202]="PositiveNumber",e[e.PositiveNumber_Vec=203]="PositiveNumber_Vec",e[e.String=204]="String",e[e.String_Vec=205]="String_Vec",e[e.Bool=206]="Bool"}(Do||(Do={}));const Ro=[{type:Do.String,name:"string",description:"String."},{type:Do.Address,name:"address",description:"Object id or Personal address."},{type:Do.PositiveNumber,name:"unsigned integer",description:"Including u8, u16 ,..., u256"},{type:Do.String_Vec,name:"string vector",description:"Vector of string."},{type:Do.Address_Vec,name:"address vector",description:"Vector of address."},{type:Do.PositiveNumber_Vec,name:"unsigned integer vector",description:"Vector of unsigned integer"},{type:Do.Bool,name:"bool",description:"True or False."}],No=Object.values(ko).filter((e=>"number"==typeof e)),Vo=Object.values(Yo).filter((e=>"number"==typeof e)),Xo=e=>No.includes(e),Jo=e=>Vo.includes(e),Fo=e=>e===Yo.TYPE_U128||e===Yo.TYPE_U256||e===Yo.TYPE_U64||e===Yo.TYPE_U8;var qo;!function(e){e[e.TYPE_SIGNER=60]="TYPE_SIGNER",e[e.TYPE_CLOCK=61]="TYPE_CLOCK",e[e.TYPE_GUARD=62]="TYPE_GUARD",e[e.TYPE_CONSTANT=80]="TYPE_CONSTANT"}(qo||(qo={}));const Lo=[{type:Yo.TYPE_BOOL,name:"bool",description:"boolean. eg:true or false",validator:e=>!0===e||!1===e},{type:Yo.TYPE_ADDRESS,name:"address",description:"address or object-id. eg:0x6789af",validator:oo},{type:qo.TYPE_SIGNER,name:"txn signer",description:"signer address of the transaction"},{type:qo.TYPE_GUARD,name:"guard address",description:"current guard address"},{type:qo.TYPE_CLOCK,name:"txn time",description:"unsigned-64 number for the transaction time"},{type:Yo.TYPE_U64,name:"number",description:"unsigned-64 number. eg:23870233",validator:lo},{type:Yo.TYPE_U8,name:"number",description:"unsigned-8 number. eg:255",validator:po},{type:Yo.TYPE_VEC_U8,name:"string",description:'string or unsigned-8 number array. eg:"[1,2,3]"'},{type:Yo.TYPE_U128,name:"number",description:"unsigned-8 number. eg:12348900999",validator:mo},{type:Yo.TYPE_VEC_ADDRESS,name:"[address]",description:"address array. eg:[0x2277f2, 0x3344af]"},{type:Yo.TYPE_VEC_BOOL,name:"[bool]",description:"boolean array. eg:[true, false, true]"},{type:Yo.TYPE_VEC_VEC_U8,name:"[[number]]",description:'array of unsigned-8 number array. eg:["i", "like", "wowok"]'},{type:Yo.TYPE_VEC_U64,name:"[number]",description:"unsigned-64 number array. eg:[123, 778888, 42312]"},{type:Yo.TYPE_VEC_U128,name:"[number]",description:"unsigned-128 number array. eg:[123, 778888, 42312]"},{type:Yo.TYPE_OPTION_ADDRESS,name:"option",description:"option of address. eg:none or address"},{type:Yo.TYPE_OPTION_BOOL,name:"option",description:"option of bool. eg:none or boolean value"},{type:Yo.TYPE_OPTION_U8,name:"option",description:"option of u8. eg:none or u8 value"},{type:Yo.TYPE_OPTION_U64,name:"option",description:"option of u64. eg:none or u64 value"},{type:Yo.TYPE_OPTION_U128,name:"option",description:"option of u128. eg:none or u128 value"},{type:Yo.TYPE_OPTION_U256,name:"option",description:"option of u256. eg:none or u256 value"},{type:Yo.TYPE_VEC_U256,name:"[number]",description:"unsigned-256 number array. eg:[123, 778888, 42312]"},{type:Yo.TYPE_VEC_STRING,name:"[string]",description:'ascii string array. eg:["abc", "hi"]'},{type:Yo.TYPE_STRING,name:"string",description:'eg:"wowok"'},{type:Yo.TYPE_OPTION_STRING,name:"option",description:"option of string. eg:none or string value"},{type:Yo.TYPE_U256,name:"number",description:"unsigned-256 number. eg:12345678901233",validator:_o}];var Mo;!function(e){e.mainnet="mainnet",e.testnet="testnet",e.devnet="devnet",e.localnet="localnet"}(Mo||(Mo={}));const Go="0xd9705a4f0b7ae3400d3af4ba781b2d2f6b4dc5dd81e2e1ce2bc949c16583df7f";class $o{constructor(e=Mo.testnet){this.network="",this.packages=new Map,this.signer="",this.wowok_object="",this.entity_object="",this.treasury_cap="",this.oracle_object="",this.machineFn=e=>`${this.packages.get("wowok")}::${jo.machine}::${e}`,this.progressFn=e=>`${this.packages.get("wowok")}::${jo.progress}::${e}`,this.repositoryFn=e=>`${this.packages.get("wowok")}::${jo.repository}::${e}`,this.permissionFn=e=>`${this.packages.get("wowok")}::${jo.permission}::${e}`,this.passportFn=e=>`${this.packages.get("wowok")}::${jo.passport}::${e}`,this.demandFn=e=>`${this.packages.get("wowok")}::${jo.demand}::${e}`,this.orderFn=e=>`${this.packages.get("wowok")}::${jo.order}::${e}`,this.serviceFn=e=>`${this.packages.get("wowok")}::${jo.service}::${e}`,this.resourceFn=e=>`${this.packages.get("wowok")}::${jo.resource}::${e}`,this.entityFn=e=>`${this.packages.get("wowok")}::${jo.entity}::${e}`,this.wowokFn=e=>`${this.packages.get("wowok")}::${jo.wowok}::${e}`,this.treasuryFn=e=>`${this.packages.get("wowok")}::${jo.treasury}::${e}`,this.paymentFn=e=>`${this.packages.get("wowok")}::${jo.payment}::${e}`,this.guardFn=e=>`${this.packages.get("base")}::${jo.guard}::${e}`,this.baseWowokFn=e=>`${this.packages.get("base")}::${jo.wowok}::${e}`,this.arbitrationFn=e=>`${this.packages.get("wowok")}::${jo.arbitration}::${e}`,this.arbFn=e=>`${this.packages.get("wowok")}::${jo.arb}::${e}`,this.query=async(e,t={showContent:!0})=>{const r=new Zs({url:this.networkUrl()}),s=e.map((e=>e.objectid)),i=await r.call("sui_multiGetObjects",[s,t]);for(let r=0;r<i.length;r++)e.forEach((e=>{e.callback(this,i[r],e,t)}));return i},this.query_raw=async(e,t={showContent:!0})=>{const r=new Zs({url:this.networkUrl()});return await r.call("sui_multiGetObjects",[e,t])},this.new_session=()=>(this.txb=new bs,this.txb),this.sessionCurrent=()=>this.txb?this.txb:this.new_session(),this.sign_excute=async(e,t,r,s={showObjectChanges:!0})=>{const i=new Zs({url:this.networkUrl()});e.forEach((e=>{e(this,r)}));const n=Zn(t),a=Qn.fromSecretKey(n),o=await i.signAndExecuteTransaction({transaction:this.sessionCurrent(),signer:a,options:s});return this.txb=void 0,o},this.WOWOK_TOKEN_TYPE=()=>this.packages.get("base")+"::wowok::WOWOK",this.WOWOK_COIN_TYPE=()=>"0x2::coin::Coin<"+this.packages.get("base")+"::wowok::WOWOK>",this.COINS_TYPE=()=>{switch(this.network){case Mo.testnet:return this.CoinTypes_Testnet.filter((e=>!0!==e.alias));case Mo.mainnet:return this.CoinTypes_Mainnet.filter((e=>!0!==e.alias))}return[]},this.update_coinType=(e,t,r)=>{if(r&&e)switch(this.network){case Mo.testnet:(s=this.CoinTypes_Testnet.filter((t=>t?.type!==e))).push({symbol:r,type:e,decimals:t}),this.CoinTypes_Testnet=s;break;case Mo.mainnet:var s;(s=this.CoinTypes_Mainnet.filter((t=>t?.type!==e))).push({symbol:r,type:e,decimals:t}),this.CoinTypes_Mainnet=s}},this.explorerUrl=(e,t="object")=>this.network===Mo.testnet?"https://testnet.suivision.xyz/"+t+"/"+e:this.network===Mo.mainnet?"https://suivision.xyz/"+t+"/"+e:"",this.CoinTypes_Testnet=[{symbol:"SUI",type:"0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",decimals:9,alias:!0},{symbol:"SUI",type:"0x2::sui::SUI",decimals:9},{symbol:"WOW",type:Go+"::wowok::WOWOK",decimals:9}],this.CoinTypes_Mainnet=[{symbol:"SUI",type:"0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",decimals:9,alias:!0},{symbol:"SUI",type:"0x2::sui::SUI",decimals:9},{symbol:"WOW",type:Go+"::wowok::WOWOK",decimals:9},{symbol:"USDT",type:"0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN",decimals:6},{symbol:"USDC",type:"0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN",decimals:6},{symbol:"WETH",type:"0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN",decimals:8},{symbol:"WBNB",type:"0xb848cce11ef3a8f62eccea6eb5b35a12c4c2b1ee1af7755d02d7bd6218e8226f::coin::COIN",decimals:8}],this.coinTypeInfo=(e,t)=>{if(!e)return"loading";return this.COINS_TYPE().find((t=>t?.type===e))||($o.Client().getCoinMetadata({coinType:e}).then((r=>{r?.decimals&&r?.symbol&&(this.update_coinType(e,r?.decimals,r?.symbol),t({symbol:r.symbol,decimals:r.decimals,type:e}))})).catch((e=>{console.log(e)})),"loading")},this.WOWOK_OBJECTS_TYPE=()=>Object.keys(jo).map((e=>(e===jo.guard?this.packages.get("base"):this.packages.get("wowok"))+"::"+e+"::"+Ga(e))),this.WOWOK_OBJECTS_PREFIX_TYPE=()=>Object.keys(jo).map((e=>(e===jo.guard?this.packages.get("base"):this.packages.get("wowok"))+"::"+e+"::")),this.object_name_from_type_repr=e=>{if(!e)return"";let t=e.indexOf("::");if(t>0&&this.hasPackage(e.slice(0,t))){t=e.indexOf("<"),t>0&&(e=e.slice(0,t));let r=e.lastIndexOf("::");if(r>0)return e.slice(r+2)}return""},this.module_object_name_from_type_repr=e=>{if(!e)return"";let t=e.indexOf("::");if(t>0&&this.hasPackage(e.slice(0,t))){t=e.indexOf("<"),t>0&&(e=e.slice(0,t));let r=e.indexOf("::");if(r>0)return e.slice(r+2)}return""},this.use_network(e),this.new_session()}static Instance(){return $o._instance||($o._instance=new $o),$o._instance}static Client(){return new Zs({url:$o.Instance().networkUrl()})}client(){return new Zs({url:this.networkUrl()})}use_network(e=Mo.testnet){switch(this.network=e,e){case Mo.localnet:case Mo.devnet:break;case Mo.testnet:this.packages.set("wowok","0xd1ed1921f385bb6c016070325950e87f1d0e3b6a5dcc67c7a9a7b66618f29239"),this.packages.set("base",Go),this.packages.set("wowok_origin","0xd1ed1921f385bb6c016070325950e87f1d0e3b6a5dcc67c7a9a7b66618f29239"),this.packages.set("base_origin","0xd9705a4f0b7ae3400d3af4ba781b2d2f6b4dc5dd81e2e1ce2bc949c16583df7f"),this.wowok_object="0x04bc9f2680baa9e1cc1e52b329f7d7790afeb95f097b704c10116c257c5d07c4",this.entity_object="0x70623568c63000b21b7b5e180c7e5415970763335c3e3b90b1795b0fc164c60d",this.treasury_cap="0xfe7b18c27914fef876dfefd018350cfe33c45b6c5fbe5931f9449048e834da5b",this.oracle_object="0x70b4a282626aef7d31822079a1727a6576c718e9640cb30ad4c385d632138689";break;case Mo.mainnet:this.packages.set("wowok",""),this.packages.set("base",""),this.packages.set("wowok_origin",""),this.packages.set("base_origin",""),this.wowok_object="",this.entity_object="",this.treasury_cap="",this.oracle_object=""}}package(e){return this.packages.get(e)??""}objectWowok(){return this.wowok_object}objectEntity(){return this.entity_object}objectOracle(){return this.oracle_object}objectTreasuryCap(){return this.treasury_cap}networkUrl(){switch(this.network){case Mo.localnet:return"http://127.0.0.1:9000";case Mo.devnet:return"https://fullnode.devnet.sui.io:443";case Mo.testnet:return"https://fullnode.testnet.sui.io:443";case Mo.mainnet:return"https://fullnode.mainnet.sui.io:443"}return""}static TXB_OBJECT(e,t){return"string"==typeof t?e.object(t):t}hasPackage(e){for(let t of this.packages.values())if(e.includes(t))return!0;return!1}}$o.SUI_TOKEN_TYPE="0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",$o.SUI_COIN_TYPE="0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<0x2::sui::SUI>",$o.CLOCK_OBJECT={objectId:"0x6",mutable:!1,initialSharedVersion:1},$o.IsValidObjects=e=>To(e,(e=>!(!e||"string"==typeof e&&!ae(e))));class zo{}zo.Object_Type_Extra=()=>{let e=Object.keys(jo).map((e=>e+"::"+Ga(e)));return e.push("order::Discount"),e},zo.objectids_from_response=(e,t,r)=>{let s=new Map;return t?.objectChanges&&t.objectChanges.forEach((t=>{zo.Object_Type_Extra().forEach((r=>{"created"==t.type&&e.module_object_name_from_type_repr(t.objectType)===r&&(s.has(r)?s.get(r)?.push(t.objectId):s.set(r,[t.objectId]))}))})),r&&s.forEach(((e,t)=>{r.has(t)?r.set(t,r.get(t).concat(e)):r.set(t,e)})),s};class Wo{get_bounty_type(){return this.bounty_type}get_object(){return this.object}static From(e,t,r,s){let i=new Wo(e,t,r);return i.object=$o.TXB_OBJECT(e,s),i}constructor(e,t,r){this.bounty_type=t,this.permission=r,this.txb=e,this.object=""}static New(e,t,r,s,i,n,a){so(n)||Ia(Ba.IsValidDesription),go(t)||Ia(Ba.IsValidArgType,t),lo(s)||Ia(Ba.IsValidUint,"time");let o=new Wo(e,t,i);const u=e.sharedObjectRef($o.CLOCK_OBJECT);return o.object=a?e.moveCall({target:$o.Instance().demandFn("new_with_passport"),arguments:[a,e.pure.string(n),e.pure.bool(r),e.pure.u64(s),e.object(u),$o.TXB_OBJECT(e,i)],typeArguments:[t]}):e.moveCall({target:$o.Instance().demandFn("new"),arguments:[e.pure.string(n),e.pure.bool(r),e.pure.u64(s),e.object(u),$o.TXB_OBJECT(e,i)],typeArguments:[t]}),o}launch(){return this.txb.moveCall({target:$o.Instance().demandFn("create"),arguments:[$o.TXB_OBJECT(this.txb,this.object)],typeArguments:[this.bounty_type]})}refund(e){const t=this.txb.sharedObjectRef($o.CLOCK_OBJECT);e?this.txb.moveCall({target:$o.Instance().demandFn("refund_with_passport"),arguments:[e,$o.TXB_OBJECT(this.txb,this.object),this.txb.object(t),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.bounty_type]}):this.txb.moveCall({target:$o.Instance().demandFn("refund"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.object(t),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.bounty_type]})}expand_time(e,t,r){lo(t)||Ia(Ba.IsValidUint,"time"),r?this.txb.moveCall({target:$o.Instance().demandFn("time_expand_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.bool(e),this.txb.pure.u64(t),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.bounty_type]}):this.txb.moveCall({target:$o.Instance().demandFn("time_expand"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.bool(e),this.txb.pure.u64(t),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.bounty_type]})}set_guard(e,t,r){e&&!$o.IsValidObjects([e])&&Ia(Ba.IsValidObjects,"guard"),void 0===t||po(t)||Ia(Ba.InvalidParam,"set_guard.service_identifier");let s=this.txb.pure.option("u8",void 0!==t?t:void 0);r?e?this.txb.moveCall({target:$o.Instance().demandFn("guard_set_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),s,$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.bounty_type]}):this.txb.moveCall({target:$o.Instance().demandFn("guard_none_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.bounty_type]}):e?this.txb.moveCall({target:$o.Instance().demandFn("guard_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),s,$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.bounty_type]}):this.txb.moveCall({target:$o.Instance().demandFn("guard_none"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.bounty_type]})}set_description(e,t){so(e)||Ia(Ba.IsValidDesription),t?this.txb.moveCall({target:$o.Instance().demandFn("description_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.bounty_type]}):this.txb.moveCall({target:$o.Instance().demandFn("description_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.bounty_type]})}yes(e,t){oo(e)||Ia(Ba.IsValidAddress),t?this.txb.moveCall({target:$o.Instance().demandFn("yes_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.bounty_type]}):this.txb.moveCall({target:$o.Instance().demandFn("yes"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.bounty_type]})}deposit(e){$o.IsValidObjects([e])||Ia(Ba.IsValidObjects),this.txb.moveCall({target:$o.Instance().demandFn("deposit"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e)],typeArguments:[this.bounty_type]})}present(e,t,r,s){so(r)||Ia(Ba.IsValidDesription,"present.tips"),t&&!go(t)&&Ia(Ba.IsValidArgType,"service_pay_type"),"number"==typeof e?po(e)&&s||Ia(Ba.IsValidU8,"present.service or present.passport"):$o.IsValidObjects([e])||Ia(Ba.IsValidObjects,"present.service"),s?"number"==typeof e?this.txb.moveCall({target:$o.Instance().demandFn("present_with_passport2"),arguments:[s,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(r)],typeArguments:[this.bounty_type]}):this.txb.moveCall({target:$o.Instance().demandFn("present_with_passport"),arguments:[s,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),this.txb.pure.string(r)],typeArguments:[this.bounty_type,t]}):"number"!=typeof e&&this.txb.moveCall({target:$o.Instance().demandFn("present"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),this.txb.pure.string(r)],typeArguments:[this.bounty_type,t]})}change_permission(e){$o.IsValidObjects([e])||Ia(Ba.IsValidObjects),this.txb.moveCall({target:$o.Instance().demandFn("permission_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission),$o.TXB_OBJECT(this.txb,e)],typeArguments:[this.bounty_type]}),this.permission=e}}var Ho;Wo.parseObjectType=e=>qa(e,"demand::Demand<"),Wo.MAX_BOUNTY_COUNT=300,Wo.MAX_PRESENTERS_COUNT=200,function(e){e[e.repository=100]="repository",e[e.repository_description=101]="repository_description",e[e.repository_mode=102]="repository_mode",e[e.repository_policies=103]="repository_policies",e[e.repository_reference=104]="repository_reference",e[e.service=200]="service",e[e.service_description=201]="service_description",e[e.service_sales=202]="service_sales",e[e.service_payee=203]="service_payee",e[e.service_repository=204]="service_repository",e[e.service_withdraw_guards=205]="service_withdraw_guards",e[e.service_refund_guards=206]="service_refund_guards",e[e.service_discount_transfer=207]="service_discount_transfer",e[e.service_withdraw=208]="service_withdraw",e[e.service_buyer_guard=209]="service_buyer_guard",e[e.service_machine=210]="service_machine",e[e.service_endpoint=211]="service_endpoint",e[e.service_publish=212]="service_publish",e[e.service_clone=213]="service_clone",e[e.service_customer_required=214]="service_customer_required",e[e.service_pause=215]="service_pause",e[e.service_treasury=216]="service_treasury",e[e.service_arbitration=217]="service_arbitration",e[e.demand=260]="demand",e[e.demand_refund=261]="demand_refund",e[e.demand_expand_time=262]="demand_expand_time",e[e.demand_guard=263]="demand_guard",e[e.demand_description=264]="demand_description",e[e.demand_yes=265]="demand_yes",e[e.machine=600]="machine",e[e.machine_description=601]="machine_description",e[e.machine_repository=602]="machine_repository",e[e.machine_clone=604]="machine_clone",e[e.machine_node=606]="machine_node",e[e.machine_endpoint=608]="machine_endpoint",e[e.machine_pause=609]="machine_pause",e[e.machine_publish=610]="machine_publish",e[e.progress=650]="progress",e[e.progress_namedOperator=651]="progress_namedOperator",e[e.progress_bind_task=652]="progress_bind_task",e[e.progress_context_repository=653]="progress_context_repository",e[e.progress_unhold=654]="progress_unhold",e[e.progress_parent=655]="progress_parent",e[e.treasury=700]="treasury",e[e.treasury_receive=701]="treasury_receive",e[e.treasury_deposit=702]="treasury_deposit",e[e.treasury_withdraw=703]="treasury_withdraw",e[e.treasury_descritption=704]="treasury_descritption",e[e.treasury_deposit_guard=705]="treasury_deposit_guard",e[e.treasury_withdraw_mode=706]="treasury_withdraw_mode",e[e.treasury_withdraw_guard=707]="treasury_withdraw_guard",e[e.arbitration=800]="arbitration",e[e.arbitration_description=801]="arbitration_description",e[e.arbitration_fee=802]="arbitration_fee",e[e.arbitration_voting_guard=803]="arbitration_voting_guard",e[e.arbitration_endpoint=804]="arbitration_endpoint",e[e.arbitration_guard=805]="arbitration_guard",e[e.arbitration_pause=806]="arbitration_pause",e[e.arbitration_vote=807]="arbitration_vote",e[e.arbitration_arbitration=808]="arbitration_arbitration",e[e.arbitration_withdraw=809]="arbitration_withdraw",e[e.arbitration_treasury=810]="arbitration_treasury",e[e.user_defined_start=1e3]="user_defined_start"}(Ho||(Ho={}));const Ko=[{index:Ho.repository,name:"Repository",description:"Launch new Repository",module:jo.repository},{index:Ho.repository_description,name:"Description",description:"Set Repository description",module:jo.repository},{index:Ho.repository_mode,name:"Policy mode",description:"Set Repository mode",module:jo.repository},{index:Ho.repository_policies,name:"Policy",description:"Set Repository policies",module:jo.repository},{index:Ho.repository_reference,name:"Reference",description:"Set Repository reference",module:jo.repository},{index:Ho.service,name:"Service",description:"Launch new Service",module:jo.service},{index:Ho.service_description,name:"Description",description:"Set Service description",module:jo.service},{index:Ho.service_sales,name:"Sales",description:"Set Service sales items",module:jo.service},{index:Ho.service_payee,name:"Payee",description:"Set Service payee",module:jo.service},{index:Ho.service_repository,name:"Repository",description:"Set Service repositories",module:jo.service},{index:Ho.service_withdraw_guards,name:"Withdraw Guard",description:"Set Service withdraw guards",module:jo.service},{index:Ho.service_refund_guards,name:"Refund Guard",description:"Set Service refund guards",module:jo.service},{index:Ho.service_discount_transfer,name:"Discount",description:"Launch discounts for Service",module:jo.service},{index:Ho.service_buyer_guard,name:"Buyer Guard",description:"Set Guard of buying for Service",module:jo.service},{index:Ho.service_machine,name:"Machine",description:"Set Machine for Service",module:jo.service},{index:Ho.service_endpoint,name:"Endpoint",description:"Set Service endpoint",module:jo.service},{index:Ho.service_publish,name:"Publish",description:"Allowing the creation of Order",module:jo.service},{index:Ho.service_clone,name:"Clone",description:"Clone Service",module:jo.service},{index:Ho.service_customer_required,name:"Buyer info",description:"Set Service buyer info required",module:jo.service},{index:Ho.service_pause,name:"Pause",description:"Pause/Unpause Service",module:jo.service},{index:Ho.service_treasury,name:"Treasury",description:"Externally withdrawable treasury for compensation or rewards",module:jo.service},{index:Ho.service_arbitration,name:"Arbitration",description:"Add/Remove arbitration that allows refunds from orders at any time based on arbitration results",module:jo.service},{index:Ho.demand,name:"Demand",description:"Launch new Demand",module:jo.demand},{index:Ho.demand_refund,name:"Refund",description:"Refund from Demand",module:jo.demand},{index:Ho.demand_expand_time,name:"Expand deadline",description:"Expand Demand deadline",module:jo.demand},{index:Ho.demand_guard,name:"Guard",description:"Set Demand guard",module:jo.demand},{index:Ho.demand_description,name:"Description",description:"Set Demand description",module:jo.demand},{index:Ho.demand_yes,name:"Yes",description:"Pick the Deamand serice",module:jo.demand},{index:Ho.machine,name:"Machine",description:"Launch new Machine",module:jo.machine},{index:Ho.machine_description,name:"Description",description:"Set Machine description",module:jo.machine},{index:Ho.machine_repository,name:"Repository",description:"Set Machine repository",module:jo.machine},{index:Ho.machine_clone,name:"Clone",description:"Clone Machine",module:jo.machine},{index:Ho.machine_node,name:"Node",description:"Set Machine nodes",module:jo.machine},{index:Ho.machine_endpoint,name:"Endpoint",description:"Set Machine endpoint",module:jo.machine},{index:Ho.machine_pause,name:"Pause",description:"Pause/Unpause Machine",module:jo.machine},{index:Ho.machine_publish,name:"Publish",description:"Allowing the creation of Progress",module:jo.machine},{index:Ho.progress,name:"Progress",description:"Launch new Progress",module:jo.progress},{index:Ho.progress_namedOperator,name:"Operator",description:"Set Progress operators",module:jo.progress},{index:Ho.progress_bind_task,name:"Bind",description:"Set Progress task",module:jo.progress},{index:Ho.progress_context_repository,name:"Repository",description:"Set Progress repository",module:jo.progress},{index:Ho.progress_unhold,name:"Unhold",description:"Release Progress holdings",module:jo.progress},{index:Ho.progress_parent,name:"Parent",description:"Set Progress parent",module:jo.progress},{index:Ho.treasury,name:"Treasury",description:"Launch new Treasury",module:jo.treasury},{index:Ho.treasury_deposit,name:"Deposit",description:"Deposit coins",module:jo.treasury},{index:Ho.treasury_receive,name:"Receive",description:"Receive coins from some address sent",module:jo.treasury},{index:Ho.treasury_withdraw,name:"Withdraw",description:"Withdraw coins",module:jo.treasury},{index:Ho.treasury_withdraw_guard,name:"Withdraw Guard",description:"Add/Remove Treasury withdraw guard",module:jo.treasury},{index:Ho.treasury_withdraw_mode,name:"Withdraw mode",description:"Set Treasury withdraw mode",module:jo.treasury},{index:Ho.treasury_deposit_guard,name:"Deposit Guard",description:"Set Treasury deposit guard",module:jo.treasury},{index:Ho.treasury_descritption,name:"Description",description:"Set Treasury description",module:jo.treasury},{index:Ho.arbitration,name:"Arbitration",description:"Launch new Arbitration",module:jo.arbitration},{index:Ho.arbitration_description,name:"Description",description:"Set Arbitration description",module:jo.arbitration},{index:Ho.arbitration_endpoint,name:"Endpoint",description:"Set Arbitration endpoint",module:jo.arbitration},{index:Ho.arbitration_fee,name:"Fee",description:"Set Arbitration fee",module:jo.arbitration},{index:Ho.arbitration_guard,name:"Guard",description:"Set Guard to apply for arbitration",module:jo.arbitration},{index:Ho.arbitration_arbitration,name:"Arbitrate",description:"Determine the outcome of arbitration",module:jo.arbitration},{index:Ho.arbitration_pause,name:"Pause",description:"Allowing/forbidding the creation of Arb",module:jo.arbitration},{index:Ho.arbitration_voting_guard,name:"Voting Guard",description:"Add/Remove voting Guard",module:jo.arbitration},{index:Ho.arbitration_vote,name:"Vote",description:"Vote on the application for arbitration",module:jo.arbitration},{index:Ho.arbitration_withdraw,name:"Withdraw",description:"Withdraw the arbitration fee",module:jo.arbitration},{index:Ho.arbitration_treasury,name:"Withdraw",description:"Set Treasury that fees was collected at the time of withdrawal",module:jo.arbitration}];class Qo{get_object(){return this.object}constructor(e){this.txb=e,this.object=""}static From(e,t){let r=new Qo(e);return r.object=$o.TXB_OBJECT(e,t),r}static New(e,t){so(t)||Ia(Ba.IsValidDesription);let r=new Qo(e);return r.object=e.moveCall({target:$o.Instance().permissionFn("new"),arguments:[e.pure.string(t)]}),r}launch(){return this.txb.moveCall({target:$o.Instance().permissionFn("create"),arguments:[$o.TXB_OBJECT(this.txb,this.object)]})}add_bizPermission(e,t){Qo.IsValidBizPermissionIndex(e)||Ia(Ba.IsValidBizPermissionIndex,"add_bizPermission"),io(t)||Ia(Ba.IsValidName,"add_bizPermission"),this.txb.moveCall({target:$o.Instance().permissionFn("user_define_add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.u64(e),this.txb.pure.string(t)]})}remove_bizPermission(e){Qo.IsValidBizPermissionIndex(e)||Ia(Ba.IsValidBizPermissionIndex,"remove_bizPermission"),this.txb.moveCall({target:$o.Instance().permissionFn("user_define_remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.u64(e)]})}transfer_permission(e,t){oo(e)&&oo(t)||Ia(Ba.IsValidAddress,"transfer_permission"),this.txb.moveCall({target:$o.Instance().permissionFn("change_entity"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e),this.txb.pure.address(t)]})}add_entity2(e,t){0!==e.length&&(To(e,oo)||Ia(Ba.IsValidArray,"add_entity2"),void 0!==t?this.txb.moveCall({target:$o.Instance().permissionFn("add_with_index"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.u64(t),this.txb.pure.vector("address",Ma(e))]}):this.txb.moveCall({target:$o.Instance().permissionFn("add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e))]}))}add_entity3(e){if(0===e.length)return;const t=[];e.forEach((e=>{e.entities.forEach((r=>{const s=t.find((e=>e.address===r.address));if(s){const t=s.permissions.find((t=>t.index===e.index));t?t.guard=r.guard:s.permissions.push({guard:r.guard,index:e.index})}else t.push({address:r.address,permissions:[{guard:r.guard,index:e.index}]})}))})),this.add_entity(t)}add_entity(e){if(0===e.length)return;let t=!0;e.forEach((e=>{oo(e.address)||(t=!1),e.permissions.forEach((e=>{Qo.IsValidPermissionIndex(e.index)||(t=!1),e?.guard&&!$o.IsValidObjects([e.guard])&&(t=!1)}))})),t||Ia(Ba.InvalidParam,"add_entity.entities");let r=[];for(let t=0;t<e.length;t++){let s=e[t],i=[];for(let e=0;e<s.permissions.length;e++){let t=s.permissions[e];Qo.IsValidPermissionIndex(t.index)&&(i.includes(t.index)||(i.push(t.index),t?.guard&&r.push({address:s.address,index:t.index,guard:t.guard})))}i.length>0&&this.txb.moveCall({target:$o.Instance().permissionFn("add_batch"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(s.address),this.txb.pure.vector("u64",i)]})}r.forEach((({address:e,index:t,guard:r})=>{this.txb.moveCall({target:$o.Instance().permissionFn("guard_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e),this.txb.pure.u64(t),$o.TXB_OBJECT(this.txb,r)]})}))}set_guard(e,t,r){oo(e)||Ia(Ba.IsValidAddress,"address"),Qo.IsValidPermissionIndex(t)||Qo.IsValidBizPermissionIndex(t)||Ia(Ba.IsValidPermissionIndex,"index"),r?this.txb.moveCall({target:$o.Instance().permissionFn("guard_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e),this.txb.pure.u64(t),$o.TXB_OBJECT(this.txb,r)]}):this.txb.moveCall({target:$o.Instance().permissionFn("guard_none"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e),this.txb.pure.u64(t)]})}remove_index(e,t){oo(e)||Ia(Ba.IsValidAddress),0!==t.length&&(To(t,Qo.IsValidPermissionIndex)||Ia(Ba.InvalidParam,"index"),this.txb.moveCall({target:$o.Instance().permissionFn("remove_index"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e),this.txb.pure.vector("u64",Ma(t))]}))}remove_entity(e){0!==e.length&&(To(e,oo)||Ia(Ba.IsValidArray),this.txb.moveCall({target:$o.Instance().permissionFn("remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e))]}))}set_description(e){so(e)||Ia(Ba.IsValidDesription),this.txb.moveCall({target:$o.Instance().permissionFn("description_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e)]})}add_admin(e){0!==e.length&&(To(e,oo)||Ia(Ba.IsValidArray),this.txb.moveCall({target:$o.Instance().permissionFn("admin_add_batch"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e))]}))}remove_admin(e,t){(t||0!==e.length)&&(To(e,oo)||Ia(Ba.IsValidArray,"admin"),t?this.txb.moveCall({target:$o.Instance().permissionFn("admins_clear"),arguments:[$o.TXB_OBJECT(this.txb,this.object)]}):e&&this.txb.moveCall({target:$o.Instance().permissionFn("admin_remove_batch"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e))]}))}change_owner(e){oo(e)||Ia(Ba.IsValidAddress),this.txb.moveCall({target:$o.Instance().permissionFn("builder_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e)]})}query_permissions_all(e){oo(e)||Ia(Ba.InvalidParam,"query_permissions"),this.txb.moveCall({target:$o.Instance().permissionFn("query_permissions_all"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e)]})}QueryPermissions(e,t,r,s){this.query_permissions_all(t),$o.Client().devInspectTransactionBlock({sender:s??t,transactionBlock:this.txb}).then((s=>{if(s.results&&s.results[0].returnValues&&2!==s.results[0].returnValues.length)return void r({who:t,object:e});const i=za.getInstance().de(Oa.U8,Uint8Array.from(s.results[0].returnValues[0][0]));if(i===Qo.PERMISSION_ADMIN||i===Qo.PERMISSION_OWNER_AND_ADMIN)r({who:t,admin:!0,owner:i%2==1,items:[],object:e});else{const n=za.getInstance().de_perms(Uint8Array.from(s.results[0].returnValues[1][0]));r({who:t,admin:!1,owner:i%2==1,items:n.map((e=>({query:e?.index,permission:!0,guard:e?.guard}))),object:e})}})).catch((s=>{console.log(s),r({who:t,object:e})}))}static HasPermission(e,t,r=!1){if(e){if(e.admin)return{has:!0,owner:e.owner};let r=e.items?.find((e=>e.query==t));return r?{has:r.permission,guard:r.guard,owner:e.owner}:{has:!1,guard:void 0,owner:e?.owner}}if(r)return{has:!1,guard:void 0,owner:!1}}}Qo.MAX_ADMIN_COUNT=64,Qo.MAX_ENTITY_COUNT=2e3,Qo.MAX_PERMISSION_INDEX_COUNT=200,Qo.MAX_PERSONAL_PERMISSION_COUNT=200,Qo.PERMISSION_NORMAL=0,Qo.PERMISSION_OWNER=1,Qo.PERMISSION_ADMIN=2,Qo.PERMISSION_OWNER_AND_ADMIN=3,Qo.BUSINESS_PERMISSIONS_START=Ho.user_defined_start,Qo.IsValidBizPermissionIndex=e=>e>=Qo.BUSINESS_PERMISSIONS_START&&lo(e),Qo.IsValidPermissionIndex=e=>!!Object.values(Ho).includes(e)||Qo.IsValidBizPermissionIndex(e);class Zo{get_object(){return this.object}static From(e,t,r){let s=new Zo(e,t);return s.object=$o.TXB_OBJECT(e,r),s}constructor(e,t){this.txb=e,this.permission=t,this.object=""}static New(e,t,r,s,i){$o.IsValidObjects([t])||Ia(Ba.IsValidObjects,"permission"),so(r)||Ia(Ba.IsValidDesription),s&&!ao(s)&&Ia(Ba.IsValidEndpoint);let n=new Zo(e,t),a=e.pure.option("string",s||void 0);return n.object=i?e.moveCall({target:$o.Instance().machineFn("new_with_passport"),arguments:[i,e.pure.string(r),a,$o.TXB_OBJECT(e,t)]}):e.moveCall({target:$o.Instance().machineFn("new"),arguments:[e.pure.string(r),a,$o.TXB_OBJECT(e,t)]}),n}add_node(e,t){if(0===e.length)return;let r=!0;e.forEach((e=>{io(e.name)||(r=!1),e.pairs.forEach((e=>{no(e.prior_node)||(r=!1),e?.threshold&&!yo(e.threshold)&&(r=!1),e.forwards.forEach((e=>{""!==Zo.checkValidForward(e)&&(r=!1)}))}))})),r||Ia(Ba.InvalidParam,"add_node");let s=[];e.forEach((e=>{let t=this.txb.moveCall({target:$o.Instance().machineFn("node_new"),arguments:[this.txb.pure.string(e.name)]});e.pairs.forEach((e=>{let r=this.txb.pure.option("u32",e?.threshold);e.forwards.forEach((s=>{this.txb.moveCall({target:$o.Instance().machineFn("forward_add"),arguments:[t,this.txb.pure.string(e.prior_node),this.txb.pure.string(s.name),r,this.forward(s)]})})),0===e.forwards.length&&this.txb.moveCall({target:$o.Instance().machineFn("forward_add_none"),arguments:[t,this.txb.pure.string(e.prior_node),r]})})),s.push(t)})),this.add_node2(s,t)}forward(e){let t,r=e?.weight?e.weight:1;return e?.namedOperator&&io(e.namedOperator)?t=e?.guard?this.txb.moveCall({target:$o.Instance().machineFn("forward"),arguments:[this.txb.pure.string(e.namedOperator),this.txb.pure.u16(r),this.txb.object($o.TXB_OBJECT(this.txb,e.guard))]}):this.txb.moveCall({target:$o.Instance().machineFn("forward2"),arguments:[this.txb.pure.string(e.namedOperator),this.txb.pure.u16(r)]}):void 0!==e?.permission&&lo(e.permission)?t=e?.guard?this.txb.moveCall({target:$o.Instance().machineFn("forward3"),arguments:[this.txb.pure.u64(e.permission),this.txb.pure.u16(r),this.txb.object($o.TXB_OBJECT(this.txb,e.guard))]}):this.txb.moveCall({target:$o.Instance().machineFn("forward4"),arguments:[this.txb.pure.u64(e.permission),this.txb.pure.u16(r)]}):Ia(Ba.InvalidParam,"forward"),e?.suppliers?.forEach((e=>{bo(e.pay_token_type)||Ia(Ba.IsValidTokenType,"forward.suppliers:"+e.object),this.txb.moveCall({target:$o.Instance().serviceFn("add_to"),arguments:[this.txb.object(e.object),this.txb.pure.bool(e.bRequired??!1),t],typeArguments:[e.pay_token_type]})})),t}add_node2(e,t){if(0===e.length)return;let r=e.map((e=>$o.TXB_OBJECT(this.txb,e)));t?this.txb.moveCall({target:$o.Instance().machineFn("node_add_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.makeMoveVec({elements:r}),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().machineFn("node_add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.makeMoveVec({elements:r}),$o.TXB_OBJECT(this.txb,this.permission)]})}fetch_node(e,t){return io(e)||Ia(Ba.IsValidName,"fetch_node"),t?this.txb.moveCall({target:$o.Instance().machineFn("node_fetch_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().machineFn("node_fetch"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)]})}rename_node(e,t,r){e!==t&&(io(e)||Ia(Ba.IsValidName,"rename_node"),io(t)||Ia(Ba.IsValidName,"rename_node"),r?this.txb.moveCall({target:$o.Instance().machineFn("node_rename_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.string(t),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().machineFn("node_rename"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.string(t),$o.TXB_OBJECT(this.txb,this.permission)]}))}remove_node(e,t=!1,r){0!==e.length&&(To(e,io)||Ia(Ba.IsValidArray,"nodes_name"),r?this.txb.moveCall({target:$o.Instance().machineFn("node_remove_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",e),this.txb.pure.bool(t),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().machineFn("node_remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",e),this.txb.pure.bool(t),$o.TXB_OBJECT(this.txb,this.permission)]}))}launch(){return this.txb.moveCall({target:$o.Instance().machineFn("create"),arguments:[$o.TXB_OBJECT(this.txb,this.object)]})}set_description(e,t){so(e)||Ia(Ba.IsValidDesription),t?this.txb.moveCall({target:$o.Instance().machineFn("description_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().machineFn("description_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)]})}add_repository(e,t){t?this.txb.moveCall({target:$o.Instance().machineFn("repository_add_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().machineFn("repository_add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),$o.TXB_OBJECT(this.txb,this.permission)]})}remove_repository(e,t,r){(t||0!==e.length)&&(To(e,oo)||Ia(Ba.IsValidArray,"remove_repository"),r?t?this.txb.moveCall({target:$o.Instance().machineFn("repository_remove_all_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.object)]}):this.txb.moveCall({target:$o.Instance().machineFn("repository_remove_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)]}):t?this.txb.moveCall({target:$o.Instance().machineFn("repository_remove_all"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().machineFn("repository_remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)]}))}clone(e,t){let r;return r=t?this.txb.moveCall({target:$o.Instance().machineFn("clone_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().machineFn("clone"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)]}),e?this.txb.moveCall({target:$o.Instance().machineFn("create"),arguments:[$o.TXB_OBJECT(this.txb,r)]}):r}set_endpoint(e,t){e&&!ao(e)&&Ia(Ba.IsValidEndpoint);let r=this.txb.pure.option("string",e||void 0);t?this.txb.moveCall({target:$o.Instance().machineFn("endpoint_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),r,$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().machineFn("endpoint_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),r,$o.TXB_OBJECT(this.txb,this.permission)]})}pause(e,t){t?this.txb.moveCall({target:$o.Instance().machineFn("pause_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.bool(e),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().machineFn("pause"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.bool(e),$o.TXB_OBJECT(this.txb,this.permission)]})}publish(e){e?this.txb.moveCall({target:$o.Instance().machineFn("publish_with_passport"),arguments:[e,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().machineFn("publish"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)]})}change_permission(e){$o.IsValidObjects([e])||Ia(Ba.IsValidObjects,"new_permission"),this.txb.moveCall({target:$o.Instance().machineFn("permission_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission),$o.TXB_OBJECT(this.txb,e)],typeArguments:[]}),this.permission=e}add_forward(e,t,r,s,i,n){no(e)||Ia(Ba.IsValidName_AllowEmpty,"add_forward"),io(t)||Ia(Ba.IsValidName,"add_forward");const a=Zo.checkValidForward(r);let o;a&&Ia(Ba.InvalidParam,a),o=n?this.txb.moveCall({target:$o.Instance().machineFn("node_fetch_with_passport"),arguments:[n,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().machineFn("node_fetch"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),$o.TXB_OBJECT(this.txb,this.permission)]});const u=this.forward(r),c=this.txb.pure.option("u32",s??void 0);this.txb.moveCall({target:$o.Instance().machineFn("forward_add"),arguments:[o,this.txb.pure.string(e),this.txb.pure.string(r.name),c,u]}),i&&i!==r.name&&this.txb.moveCall({target:$o.Instance().machineFn("forward_remove"),arguments:[o,this.txb.pure.string(e),this.txb.pure.string(i)]}),this.add_node2([o],n)}remove_pair(e,t,r){let s;no(e)||Ia(Ba.IsValidName_AllowEmpty,"remove_pair"),io(t)||Ia(Ba.IsValidName,"remove_pair"),s=r?this.txb.moveCall({target:$o.Instance().machineFn("node_fetch_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().machineFn("node_fetch"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),$o.TXB_OBJECT(this.txb,this.permission)]}),this.txb.moveCall({target:$o.Instance().machineFn("pair_remove"),arguments:[s,this.txb.pure.string(e)]}),this.add_node2([s],r)}remove_forward(e,t,r,s){let i;no(e)||Ia(Ba.IsValidName_AllowEmpty,"remove_forward"),io(t)||Ia(Ba.IsValidName,"remove_forward"),i=s?this.txb.moveCall({target:$o.Instance().machineFn("node_fetch_with_passport"),arguments:[s,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().machineFn("node_fetch"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(t),$o.TXB_OBJECT(this.txb,this.permission)]}),this.txb.moveCall({target:$o.Instance().machineFn("forward_remove"),arguments:[i,this.txb.pure.string(e),this.txb.pure.string(r)]}),this.add_node2([i],s)}static rpc_de_nodes(e){const t=[];return e.forEach((e=>{t.push({name:e.data.content.fields.name,pairs:Zo.rpc_de_pair(e?.data.content.fields.value)})})),t}static rpc_de_pair(e){let t=[];return e.fields.value.fields.contents.forEach((e=>{let r=[];e.fields.value.fields.forwards.fields.contents.forEach((e=>{let t=e.fields.key,s=e.fields.value.fields.weight,i=e.fields.value.fields.guard,n=e.fields.value.fields.namedOperator,a=e.fields.value.fields.permission_index;r.push({name:t,namedOperator:n,permission:a,weight:s,guard:i||"",suppliers:e.fields.value.fields.suppliers.fields.contents.map((e=>({object:e.fields.key,bRequired:e.fields.value,pay_token_type:""})))})})),t.push({prior_node:e.fields.key,threshold:e.fields.value.fields.threshold,forwards:r})})),t}static namedOperators(e){let t=[];return e.forEach((e=>{e.pairs.forEach((e=>{e.forwards.forEach((e=>{e?.namedOperator&&!t.find((t=>t===e.namedOperator))&&t.push(e.namedOperator)}))}))})),t}static checkValidForward(e){return io(e.name)?e?.namedOperator&&!no(e?.namedOperator)?"Progress Operator invalid":e?.permission&&!Qo.IsValidPermissionIndex(e?.permission)?"Permission index invalid":e?.permission||e?.namedOperator?e?.weight&&!lo(e.weight)?"Weight invalid":"":"Business-Permissions invalid":"Forward name invalid"}}var eu;Zo.INITIAL_NODE_NAME="",Zo.OPERATOR_ORDER_PAYER="OrderPayer";class tu{get_object(){return this.object}constructor(e,t,r){this.permission=r,this.txb=e,this.machine=t,this.object=""}static From(e,t,r,s){let i=new eu(e,t,r);return i.object=$o.TXB_OBJECT(e,s),i}static New(e,t,r,s,i){$o.IsValidObjects([t,r])||Ia(Ba.IsValidObjects,"machine & permission");let n=new eu(e,t,r),a=e.pure.option("address",s||void 0);return n.object=i?e.moveCall({target:$o.Instance().progressFn("new_with_passport"),arguments:[i,a,$o.TXB_OBJECT(e,t),$o.TXB_OBJECT(e,r)]}):e.moveCall({target:$o.Instance().progressFn("new"),arguments:[a,$o.TXB_OBJECT(e,t),$o.TXB_OBJECT(e,r)]}),n}launch(){return this.txb.moveCall({target:$o.Instance().progressFn("create"),arguments:[$o.TXB_OBJECT(this.txb,this.object)]})}set_namedOperator(e,t,r){io(e)||Ia(Ba.IsValidName,"name"),e===Zo.OPERATOR_ORDER_PAYER&&Ia(Ba.InvalidParam,"name cannot be "+Zo.OPERATOR_ORDER_PAYER),(t.length>eu.MAX_NAMED_OPERATOR_COUNT||!To(t,oo))&&Ia(Ba.InvalidParam,"addresses"),r?this.txb.moveCall({target:$o.Instance().progressFn("namedOperator_set_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.vector("address",Ma(t)),$o.TXB_OBJECT(this.txb,this.machine),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().progressFn("namedOperator_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.vector("address",Ma(t)),$o.TXB_OBJECT(this.txb,this.machine),$o.TXB_OBJECT(this.txb,this.permission)]})}bind_task(e,t){oo(e)||Ia(Ba.IsValidAddress),t?this.txb.moveCall({target:$o.Instance().progressFn("task_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e),$o.TXB_OBJECT(this.txb,this.machine),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().progressFn("task_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e),$o.TXB_OBJECT(this.txb,this.machine),$o.TXB_OBJECT(this.txb,this.permission)]})}set_context_repository(e,t){e&&!$o.IsValidObjects([e])&&Ia(Ba.IsValidObjects,"repository"),t?e?this.txb.moveCall({target:$o.Instance().progressFn("context_repository_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),$o.TXB_OBJECT(this.txb,this.machine),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().progressFn("context_repository_none_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.machine),$o.TXB_OBJECT(this.txb,this.permission)]}):e?this.txb.moveCall({target:$o.Instance().progressFn("context_repository_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),$o.TXB_OBJECT(this.txb,this.machine),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().progressFn("context_repository_none"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.machine),$o.TXB_OBJECT(this.txb,this.permission)]})}unhold(e,t){eu.IsValidProgressNext(e)||Ia(Ba.InvalidParam,"unhold");const r=this.txb.sharedObjectRef($o.CLOCK_OBJECT);t?this.txb.moveCall({target:$o.Instance().progressFn("unhold_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.machine),this.txb.pure.string(e.next_node_name),this.txb.pure.string(e.forward),$o.TXB_OBJECT(this.txb,this.permission),this.txb.object(r)]}):this.txb.moveCall({target:$o.Instance().progressFn("unhold"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.machine),this.txb.pure.string(e.next_node_name),this.txb.pure.string(e.forward),$o.TXB_OBJECT(this.txb,this.permission),this.txb.object(r)]})}parent_none(e){e?this.txb.moveCall({target:$o.Instance().progressFn("parent_none_with_passport"),arguments:[e,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.machine),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().progressFn("parent_none"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.machine),$o.TXB_OBJECT(this.txb,this.permission)]})}parent(e,t){oo(e.parent_id)&&yo(e.parent_session_id)||Ia(Ba.InvalidParam,"parent"),e.operation.next_node_name&&e.operation.forward||Ia(Ba.InvalidParam,"parent"),t?this.txb.moveCall({target:$o.Instance().progressFn("parent_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.machine),this.txb.object(e.parent_id),this.txb.pure.u64(e.parent_session_id),this.txb.pure.string(e.operation.next_node_name),this.txb.pure.string(e.operation.forward),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().progressFn("parent_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.machine),this.txb.object(e.parent_id),this.txb.pure.u64(e.parent_session_id),this.txb.pure.string(e.operation.next_node_name),this.txb.pure.string(e.operation.forward),$o.TXB_OBJECT(this.txb,this.permission)]})}deliverable(e){so(e.msg)||Ia(Ba.IsValidDesription,"deliverable.msg"),e.orders.length>0&&!$o.IsValidObjects(e.orders.map((e=>e.object)))&&Ia(Ba.IsValidObjects,"deliverable.orders");const t=this.txb.moveCall({target:$o.Instance().progressFn("deliverable_new"),arguments:[this.txb.pure.string(e.msg)]});return e.orders.forEach((e=>{bo(e.pay_token_type)||Ia(Ba.IsValidTokenType,"deliverable.orders:"+e.object),this.txb.moveCall({target:$o.Instance().orderFn("as_deliverable"),arguments:[this.txb.object(e.object),t],typeArguments:[e.pay_token_type]})})),t}next(e,t,r){eu.IsValidProgressNext(e)||Ia(Ba.InvalidParam,"next");const s=this.deliverable(t),i=this.txb.sharedObjectRef($o.CLOCK_OBJECT);return r?this.txb.moveCall({target:$o.Instance().progressFn("next_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.machine),this.txb.pure.string(e.next_node_name),this.txb.pure.string(e.forward),s,$o.TXB_OBJECT(this.txb,this.permission),this.txb.object(i)]}):this.txb.moveCall({target:$o.Instance().progressFn("next"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.machine),this.txb.pure.string(e.next_node_name),this.txb.pure.string(e.forward),s,$o.TXB_OBJECT(this.txb,this.permission),this.txb.object(i)]})}hold(e,t){eu.IsValidProgressNext(e)||Ia(Ba.InvalidParam,"hold");const r=this.txb.sharedObjectRef($o.CLOCK_OBJECT);return this.txb.moveCall({target:$o.Instance().progressFn("hold"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.machine),this.txb.pure.string(e.next_node_name),this.txb.pure.string(e.forward),this.txb.pure.bool(t),$o.TXB_OBJECT(this.txb,this.permission),this.txb.object(r)]})}}eu=tu,tu.QueryForwardGuard=async(e,t,r,s,i)=>{if(!(e&&t&&s&&i))return void Ia(Ba.InvalidParam,"QueryForwardGuard");const n=new bs;n.moveCall({target:$o.Instance().progressFn("query_guard"),arguments:[$o.TXB_OBJECT(n,e),$o.TXB_OBJECT(n,t),n.pure.string(s),n.pure.string(i)]});const a=await $o.Client().devInspectTransactionBlock({sender:r,transactionBlock:n});if(1===a.results?.length&&1===a.results[0].returnValues?.length){const e=za.getInstance().de("Option<address>",Uint8Array.from(a.results[0].returnValues[0][0]));return e?.some?"0x"+e?.some:void 0}},tu.DeSessions=e=>{let t=[];return e?.fields?.contents?.forEach((e=>{var r={next_node:e.fields.key,holders:[],weights:e.fields.value.fields.weights,threshold:e.fields.value.fields.threshold};e.fields.value.fields.forwards.fields.contents.forEach((e=>{r.holders.push({forward:e.fields.key,accomplished:e.fields.value.fields.accomplished,time:e.fields.value.fields.time,who:e.fields.value.fields.who,deliverable:{msg:e.fields.value.fields.msg,orders:e.fields.value.fields.orders??[]}})})),t.push(r)})),t},tu.DeHistories=e=>e?.map((e=>eu.DeHistory(e?.data?.content?.fields))),tu.DeHistory=e=>({id:parseInt(e?.name),node:e?.value?.fields?.node,next_node:e?.value?.fields?.next_node,sessions:eu.DeSessions(e?.value.fields?.session),time:e?.value?.fields?.time}),tu.MAX_NAMED_OPERATOR_COUNT=20,tu.MAX_DELEVERABLE_ORDER_COUNT=20,tu.IsValidProgressNext=e=>io(e.forward)&&io(e.next_node_name);const ru=[{module:jo.permission,query_name:"Owner",query_id:1,parameters:[],return:Yo.TYPE_ADDRESS,description:"Owner's address."},{module:jo.permission,query_name:"Is Admin",query_id:2,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Is a certain address an administrator?",parameters_description:["address"]},{module:jo.permission,query_name:"Has Rights",query_id:3,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_U64],return:Yo.TYPE_BOOL,description:"Does an address have a certain permission(Admin always have permissions)?",parameters_description:["address","permission index"]},{module:jo.permission,query_name:"Contains Address",query_id:4,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Whether an address is included in the personnel permission table?",parameters_description:["address"]},{module:jo.permission,query_name:"Contains Permission",query_id:5,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_U64],return:Yo.TYPE_BOOL,description:"Whether a certain permission for a certain address is defined in the personnel permission table?",parameters_description:["address","permission index"]},{module:jo.permission,query_name:"Contains Permission Guard",query_id:6,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_U64],return:Yo.TYPE_BOOL,description:"Whether a permission guard for a certain address is defined in the personnel permission table?",parameters_description:["address","permission index"]},{module:jo.permission,query_name:"Permission Guard",query_id:7,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_U64],return:Yo.TYPE_ADDRESS,description:"Permission guard for a certain address.",parameters_description:["address","permission index"]},{module:jo.permission,query_name:"Number of Entities",query_id:8,parameters:[],return:Yo.TYPE_U64,description:"Number of entities in the personnel permission table."},{module:jo.permission,query_name:"Number of Admin",query_id:9,parameters:[],return:Yo.TYPE_U64,description:"Number of administrators."},{module:jo.repository,query_name:"Permission",query_id:100,parameters:[],return:Yo.TYPE_ADDRESS,description:"Permission object address."},{module:jo.repository,query_name:"Contains Policy",query_id:101,parameters:[Yo.TYPE_STRING],return:Yo.TYPE_BOOL,description:"Is a consensus policy included?",parameters_description:["the filed name"]},{module:jo.repository,query_name:"Is Permission set of Policy",query_id:102,parameters:[Yo.TYPE_STRING],return:Yo.TYPE_BOOL,description:"Does a certain consensus policy set data operation permissions?",parameters_description:["the policy name"]},{module:jo.repository,query_name:"Permission of Policy",query_id:103,parameters:[Yo.TYPE_STRING],return:Yo.TYPE_U64,description:"The permission index of a certain consensus policy in the Permission object.",parameters_description:["the policy name"]},{module:jo.repository,query_name:"Value Type of Policy",query_id:104,parameters:[Yo.TYPE_STRING],return:Yo.TYPE_U8,description:"Data types defined by consensus policy.",parameters_description:["the policy name"]},{module:jo.repository,query_name:"Contains Data",query_id:105,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_STRING],return:Yo.TYPE_BOOL,description:"Does it contain data for a certain field of an address?",parameters_description:["address","the field name"]},{module:jo.repository,query_name:"Raw data without Type",query_id:106,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_STRING],return:Yo.TYPE_VEC_U8,description:"Data for a field at an address and does not contain data type information.",parameters_description:["address","the field name"]},{module:jo.repository,query_name:"Raw data",query_id:107,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_STRING],return:Yo.TYPE_VEC_U8,description:"Data for a field at an address, and the first byte contains data type information.",parameters_description:["address","the field name"]},{module:jo.repository,query_name:"Type",query_id:108,parameters:[],return:Yo.TYPE_U8,description:"The repository Type. 0: Normal; 1: Wowok greenee."},{module:jo.repository,query_name:"Policy Mode",query_id:109,parameters:[],return:Yo.TYPE_U8,description:"Policy Mode. 0: Free mode; 1: Strict mode."},{module:jo.repository,query_name:"Reference Count",query_id:110,parameters:[],return:Yo.TYPE_U64,description:"The number of times it is referenced by other objects."},{module:jo.repository,query_name:"Is Referenced by An Object",query_id:111,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Is it referenced by an object?",parameters_description:["address"]},{module:jo.repository,query_name:"Number Data",query_id:112,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_STRING],return:Yo.TYPE_U256,description:"Data for a field at an address and get unsigned integer type data.",parameters_description:["address","the field name"]},{module:jo.repository,query_name:"String Data",query_id:113,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_STRING],return:Yo.TYPE_STRING,description:"Data for a field at an address and get string type data.",parameters_description:["address","the field name"]},{module:jo.repository,query_name:"Address Data",query_id:114,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_STRING],return:Yo.TYPE_ADDRESS,description:"Data for a field at an address and get address type data.",parameters_description:["address","the field name"]},{module:jo.repository,query_name:"Bool Data",query_id:115,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_STRING],return:Yo.TYPE_BOOL,description:"Data for a field at an address and get bool type data.",parameters_description:["address","the field name"]},{module:jo.repository,query_name:"Number Vector Data",query_id:116,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_STRING],return:Yo.TYPE_VEC_U256,description:"Data for a field at an address and get unsigned integer vector type data.",parameters_description:["address","the field name"]},{module:jo.repository,query_name:"String Vector Data",query_id:117,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_STRING],return:Yo.TYPE_VEC_STRING,description:"Data for a field at an address and get string vector type data.",parameters_description:["address","the field name"]},{module:jo.repository,query_name:"Address Vector Data",query_id:118,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_STRING],return:Yo.TYPE_VEC_ADDRESS,description:"Data for a field at an address and get address vector type data.",parameters_description:["address","the field name"]},{module:jo.repository,query_name:"Bool Vector Data",query_id:119,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_STRING],return:Yo.TYPE_VEC_BOOL,description:"Data for a field at an address and get bool vector type data.",parameters_description:["address","the field name"]},{module:jo.entity,query_name:"Has Entity",query_id:200,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Is an entity already registered?",parameters_description:["address"]},{module:jo.entity,query_name:"Likes",query_id:201,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"The number of likes for an address by other addresses.",parameters_description:["address"]},{module:jo.entity,query_name:"Dislikes",query_id:202,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"The number of dislikes for an address by other addresses.",parameters_description:["address"]},{module:jo.entity,query_name:"Entity Info",query_id:203,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_VEC_U8,description:"Public information about an entity.",parameters_description:["address"]},{module:jo.entity,query_name:"Has Resource by Entity?",query_id:204,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Whether an entity created a resource?",parameters_description:["address"]},{module:jo.entity,query_name:"Entity Resource",query_id:205,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_ADDRESS,description:"The address of a resource object created by an entity.",parameters_description:["address"]},{module:jo.demand,query_name:"Permission",query_id:300,parameters:[],return:Yo.TYPE_ADDRESS,description:"Permission object address."},{module:jo.demand,query_name:"Deadline",query_id:302,parameters:[],return:Yo.TYPE_U64,description:"The expiration time of presenting."},{module:jo.demand,query_name:"Bounty Count",query_id:303,parameters:[],return:Yo.TYPE_U64,description:"Number of Bounties."},{module:jo.demand,query_name:"Has Guard",query_id:304,parameters:[],return:Yo.TYPE_BOOL,description:"Whether the present guard is set?"},{module:jo.demand,query_name:"Guard",query_id:305,parameters:[],return:Yo.TYPE_ADDRESS,description:"The present guard address."},{module:jo.demand,query_name:"Has Service Picked",query_id:306,parameters:[],return:Yo.TYPE_BOOL,description:"Whether a service has been picked and bounties given?"},{module:jo.demand,query_name:"Service Picked",query_id:307,parameters:[],return:Yo.TYPE_ADDRESS,description:"Service address that has been picked."},{module:jo.demand,query_name:"Presenter Count",query_id:308,parameters:[],return:Yo.TYPE_U64,description:"Number of presenters."},{module:jo.demand,query_name:"Has Presenter",query_id:309,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Is a certain address a presenter?",parameters_description:["address"]},{module:jo.demand,query_name:"Who Got Bounty",query_id:310,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_ADDRESS,description:"The address that bounties given.",parameters_description:["address"]},{module:jo.service,query_name:"Permission",query_id:400,parameters:[],return:Yo.TYPE_ADDRESS,description:"Permission object address."},{module:jo.service,query_name:"Payee",query_id:401,parameters:[],return:Yo.TYPE_ADDRESS,description:"Payee address, that all order withdrawals will be collected to this address."},{module:jo.service,query_name:"Has Buying Guard",query_id:402,parameters:[],return:Yo.TYPE_BOOL,description:"Is the guard condition of buying set?"},{module:jo.service,query_name:"Buying Guard",query_id:403,parameters:[],return:Yo.TYPE_ADDRESS,description:"Buying guard, that Purchase only if you meet the conditions of the guard."},{module:jo.service,query_name:"Contains Repository",query_id:404,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Is a certain repository one of the service's consensus repositories?",parameters_description:["address"]},{module:jo.service,query_name:"Has Withdrawing Guard",query_id:405,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Whether a certain guard is set when withdrawing money?",parameters_description:["address"]},{module:jo.service,query_name:"Withdrawing Guard Percent",query_id:406,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"The percentage of withdrawals allowed by a certain withdrawal guard.",parameters_description:["address"]},{module:jo.service,query_name:"Has Refunding Guard",query_id:407,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Whether a certain guard is set when refunding money?",parameters_description:["address"]},{module:jo.service,query_name:"Refunding Guard Percent",query_id:408,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"The percentage of refund allowed by a certain refund guard.",parameters_description:["address"]},{module:jo.service,query_name:"Has Sales Item",query_id:409,parameters:[Yo.TYPE_STRING],return:Yo.TYPE_BOOL,description:"Is there a sales item for the service?",parameters_description:["the item name"]},{module:jo.service,query_name:"Sale Item Price",query_id:410,parameters:[Yo.TYPE_STRING],return:Yo.TYPE_U64,description:"What is the price of a certain sale item?",parameters_description:["the item name"]},{module:jo.service,query_name:"Sale Item Inventory",query_id:411,parameters:[Yo.TYPE_STRING],return:Yo.TYPE_U64,description:"How much inventory is there for a certain sales item?",parameters_description:["the item name"]},{module:jo.service,query_name:"Has Machine",query_id:412,parameters:[],return:Yo.TYPE_BOOL,description:"Has the machine(progress generator) that serves the order been set up?"},{module:jo.service,query_name:"Machine",query_id:413,parameters:[],return:Yo.TYPE_ADDRESS,description:"Machine address, that generate progresses serving the execution process of order."},{module:jo.service,query_name:"Paused",query_id:414,parameters:[],return:Yo.TYPE_BOOL,description:"Pause the creation of new order?"},{module:jo.service,query_name:"Published",query_id:415,parameters:[],return:Yo.TYPE_BOOL,description:"Is it allowed to create orders?"},{module:jo.service,query_name:"Has Required Info",query_id:416,parameters:[],return:Yo.TYPE_BOOL,description:"Whether the necessary information that needs to be provided by the customer is set?"},{module:jo.service,query_name:"Required Info of Service-Pubkey",query_id:417,parameters:[],return:Yo.TYPE_STRING,description:"The public key used to encrypt customer information, and only the service provider can decrypt and view customer information."},{module:jo.service,query_name:"Required Info",query_id:418,parameters:[],return:Yo.TYPE_VEC_STRING,description:"Names of the required information item that needs to be provided by the customer."},{module:jo.service,query_name:"Number of Treasuries",query_id:419,parameters:[],return:Yo.TYPE_U64,description:"The number of treasuries that can be externally withdrawn for purposes such as compensation or incentives."},{module:jo.service,query_name:"Contains Treasury",query_id:420,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Does it contain externally withdrawable Treasury for purposes such as compensation or incentives?",parameters_description:["treasury address"]},{module:jo.service,query_name:"Number of Arbitrations",query_id:421,parameters:[],return:Yo.TYPE_U64,description:"The number of arbitrations that allows a refund to be made from the order at any time based on the arbitration result."},{module:jo.service,query_name:"Contains Arbitration",query_id:422,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Does it contain an arbitration that allows a refund to be made from the order at any time based on the arbitration result.?",parameters_description:["arbitration address"]},{module:jo.order,query_name:"Amount",query_id:500,parameters:[],return:Yo.TYPE_U64,description:"Order amount."},{module:jo.order,query_name:"Payer",query_id:501,parameters:[],return:Yo.TYPE_ADDRESS,description:"Order payer."},{module:jo.order,query_name:"Service",query_id:502,parameters:[],return:Yo.TYPE_ADDRESS,description:"Service for creating orders."},{module:jo.order,query_name:"Has Progress",query_id:503,parameters:[],return:Yo.TYPE_BOOL,description:"Is there a Progress for executing the order process?"},{module:jo.order,query_name:"Progress",query_id:504,parameters:[],return:Yo.TYPE_ADDRESS,description:"Progress address for executing the order process."},{module:jo.order,query_name:"Required Info",query_id:505,parameters:[],return:Yo.TYPE_BOOL,description:"Is Required Info set?"},{module:jo.order,query_name:"Discount Used",query_id:506,parameters:[],return:Yo.TYPE_BOOL,description:"Discount coupon used for this order?"},{module:jo.order,query_name:"Discount",query_id:507,parameters:[],return:Yo.TYPE_ADDRESS,description:"Discount address that already used."},{module:jo.order,query_name:"Balance",query_id:508,parameters:[],return:Yo.TYPE_U64,description:"The amount currently in the order."},{module:jo.order,query_name:"Number of Agents",query_id:511,parameters:[],return:Yo.TYPE_U64,description:"The number of agents for the order."},{module:jo.order,query_name:"Has Agent",query_id:512,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Whether an address is an order agent?",parameters_description:["agent address"]},{module:jo.order,query_name:"Number of Disputes",query_id:513,parameters:[],return:Yo.TYPE_U64,description:"Number of arbitrations for the order."},{module:jo.order,query_name:"Has Arb",query_id:514,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Does the order contain an Arb for arbitration?",parameters_description:["arb address"]},{module:jo.machine,query_name:"Permission",query_id:700,parameters:[],return:Yo.TYPE_ADDRESS,description:"Permission object address."},{module:jo.machine,query_name:"Paused",query_id:701,parameters:[],return:Yo.TYPE_BOOL,description:"Pause the creation of new Progress?"},{module:jo.machine,query_name:"Published",query_id:702,parameters:[],return:Yo.TYPE_BOOL,description:"Is it allowed to create Progress?"},{module:jo.machine,query_name:"Is Consensus Repository",query_id:703,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Whether an address is a consensus repository?",parameters_description:["adddress"]},{module:jo.machine,query_name:"Has Endpoint",query_id:704,parameters:[],return:Yo.TYPE_BOOL,description:"Is the endpoint set?"},{module:jo.machine,query_name:"Endpoint",query_id:705,parameters:[],return:Yo.TYPE_STRING,description:"Endpoint url/ipfs."},{module:jo.progress,query_name:"Machine",query_id:800,parameters:[],return:Yo.TYPE_ADDRESS,description:"The Machine object that created this Progress."},{module:jo.progress,query_name:"Current Node",query_id:801,parameters:[],return:Yo.TYPE_STRING,description:"The name of the currently running node."},{module:jo.progress,query_name:"Has Parent",query_id:802,parameters:[],return:Yo.TYPE_BOOL,description:"Is the parent Progress defined?"},{module:jo.progress,query_name:"Parent",query_id:803,parameters:[],return:Yo.TYPE_ADDRESS,description:"The parent Progress, that contains some child Progress."},{module:jo.progress,query_name:"Has Task",query_id:804,parameters:[],return:Yo.TYPE_BOOL,description:"Does it contain clear task(eg. an Order)?"},{module:jo.progress,query_name:"Task",query_id:805,parameters:[],return:Yo.TYPE_ADDRESS,description:"Task object address."},{module:jo.progress,query_name:"Has Unique Permission",query_id:806,parameters:[Yo.TYPE_STRING],return:Yo.TYPE_BOOL,description:"Does Progress define a unique operation permission?",parameters_description:["operator name"]},{module:jo.progress,query_name:"Is Unique Permission Operator",query_id:807,parameters:[Yo.TYPE_STRING,Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Is an address an operator with unique permissions?",parameters_description:["operator name","address"]},{module:jo.progress,query_name:"Has Context Repository",query_id:808,parameters:[],return:Yo.TYPE_BOOL,description:"Whether the repository reference for Progress is set?"},{module:jo.progress,query_name:"Context Repository",query_id:809,parameters:[],return:Yo.TYPE_ADDRESS,description:"Repository reference for Progress."},{module:jo.progress,query_name:"Last Session Time",query_id:810,parameters:[],return:Yo.TYPE_U64,description:"Time when the previous session was completed."},{module:jo.progress,query_name:"Last Session Node",query_id:811,parameters:[],return:Yo.TYPE_STRING,description:"The name of the last completed node."},{module:jo.progress,query_name:"Current Session-id",query_id:812,parameters:[],return:Yo.TYPE_U64,description:"The session id of ongoing node."},{module:jo.progress,query_name:"Parent Session-id",query_id:813,parameters:[],return:Yo.TYPE_U64,description:"The child process was started in the Session-id phase of the parent process."},{module:jo.progress,query_name:"Parent Next Node",query_id:814,parameters:[],return:Yo.TYPE_STRING,description:"The child process is started at the next node stage of the parent process."},{module:jo.progress,query_name:"Parent Forward",query_id:815,parameters:[],return:Yo.TYPE_STRING,description:"The child process is started in the Forward phase of the next node of the parent process."},{module:jo.progress,query_name:"Parent Node",query_id:816,parameters:[],return:Yo.TYPE_STRING,description:"The node name of the parent process where the child process is located."},{module:jo.progress,query_name:"Forward Accomplished",query_id:817,parameters:[Yo.TYPE_U64,Yo.TYPE_STRING,Yo.TYPE_STRING],return:Yo.TYPE_BOOL,description:"Has the forward been accomplished?",parameters_description:["session-id","next node name","forward name"]},{module:jo.progress,query_name:"Forward Operator",query_id:818,parameters:[Yo.TYPE_U64,Yo.TYPE_STRING,Yo.TYPE_STRING],return:Yo.TYPE_ADDRESS,description:"The forward operator.",parameters_description:["session-id","next node name","forward name"]},{module:jo.progress,query_name:"Forward Message",query_id:819,parameters:[Yo.TYPE_U64,Yo.TYPE_STRING,Yo.TYPE_STRING],return:Yo.TYPE_STRING,description:"The forward message.",parameters_description:["session-id","next node name","forward name"]},{module:jo.progress,query_name:"Forward Order Count",query_id:820,parameters:[Yo.TYPE_U64,Yo.TYPE_STRING,Yo.TYPE_STRING],return:Yo.TYPE_U64,description:"The forward Order count.",parameters_description:["session-id","next node name","forward name"]},{module:jo.progress,query_name:"Forward time",query_id:821,parameters:[Yo.TYPE_U64,Yo.TYPE_STRING,Yo.TYPE_STRING],return:Yo.TYPE_U64,description:"The time when the forward was last triggered.",parameters_description:["session-id","next node name","forward name"]},{module:jo.progress,query_name:"Closest Session Time",query_id:822,parameters:[Yo.TYPE_STRING],return:Yo.TYPE_U64,description:"The time a node that closest time to the current node completes its session.",parameters_description:["node name"]},{module:jo.progress,query_name:"Closest Forward Accomplished",query_id:823,parameters:[Yo.TYPE_STRING,Yo.TYPE_STRING,Yo.TYPE_STRING],return:Yo.TYPE_BOOL,description:"Has the forward been accomplished?",parameters_description:["node name","next node name","forward name"]},{module:jo.progress,query_name:"Closest Forward Operator",query_id:824,parameters:[Yo.TYPE_STRING,Yo.TYPE_STRING,Yo.TYPE_STRING],return:Yo.TYPE_ADDRESS,description:"The operator of the forward that closest time to the current node.",parameters_description:["node name","next node name","forward name"]},{module:jo.progress,query_name:"Closest Forward Message",query_id:825,parameters:[Yo.TYPE_STRING,Yo.TYPE_STRING,Yo.TYPE_STRING],return:Yo.TYPE_STRING,description:"The message of the forward that closest time to the current node.",parameters_description:["node name","next node name","forward name"]},{module:jo.progress,query_name:"Closest Forward Order Count",query_id:826,parameters:[Yo.TYPE_STRING,Yo.TYPE_STRING,Yo.TYPE_STRING],return:Yo.TYPE_U64,description:"The Order count of the forward that closest time to the current node.",parameters_description:["node name","next node name","forward name"]},{module:jo.progress,query_name:"Closest Forward time",query_id:827,parameters:[Yo.TYPE_STRING,Yo.TYPE_STRING,Yo.TYPE_STRING],return:Yo.TYPE_U64,description:"The time when the forward that closest time to the current node was last triggered.",parameters_description:["node name","next node name","forward name"]},{module:jo.wowok,query_name:"Builder",query_id:900,parameters:[],return:Yo.TYPE_ADDRESS,description:"Builder address of Wowok."},{module:jo.wowok,query_name:"Object of Entities",query_id:901,parameters:[],return:Yo.TYPE_ADDRESS,description:"The address of entity information object."},{module:jo.wowok,query_name:"Grantor Count",query_id:902,parameters:[],return:Yo.TYPE_U64,description:"Number of registered grantors."},{module:jo.wowok,query_name:"Has Grantor",query_id:903,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Whether an address has been registered as a grantor?",parameters_description:["address"]},{module:jo.wowok,query_name:"Grantor Name",query_id:904,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_STRING,description:"Name of a grantor.",parameters_description:["address"]},{module:jo.wowok,query_name:"Grantor Registration Time",query_id:905,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"Registration time of a grantor.",parameters_description:["address"]},{module:jo.wowok,query_name:"Grantor Expired Time",query_id:906,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"The expiration time of a grantor.",parameters_description:["address"]},{module:jo.wowok,query_name:"Grantee Object for Grantor",query_id:907,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_ADDRESS,description:"Grantee repository address of a grantor.",parameters_description:["address"]},{module:jo.payment,query_name:"Sender",query_id:1200,parameters:[],return:Yo.TYPE_ADDRESS,description:"Payment originator address."},{module:jo.payment,query_name:"Total Amount",query_id:1201,parameters:[],return:Yo.TYPE_U128,description:"Payment amount."},{module:jo.payment,query_name:"Remark",query_id:1202,parameters:[],return:Yo.TYPE_STRING,description:"Payment remark.",parameters_description:["address"]},{module:jo.payment,query_name:"Has Guard for Perpose",query_id:1203,parameters:[],return:Yo.TYPE_BOOL,description:"Whether the payment references a Guard?"},{module:jo.payment,query_name:"Has Object for Perpose",query_id:1204,parameters:[],return:Yo.TYPE_BOOL,description:"Whether the payment references an Object?"},{module:jo.payment,query_name:"Guard for Perpose",query_id:1205,parameters:[],return:Yo.TYPE_ADDRESS,description:"The Guard referenced by this payment."},{module:jo.payment,query_name:"Object for Perpose",query_id:1206,parameters:[],return:Yo.TYPE_ADDRESS,description:"The Object referenced by this payment."},{module:jo.payment,query_name:"Number of Recipients",query_id:1207,parameters:[],return:Yo.TYPE_U64,description:"Number of recipients to receive payment from."},{module:jo.payment,query_name:"Is a Recipient",query_id:1208,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Is a recipient received the payment?",parameters_description:["address"]},{module:jo.payment,query_name:"Amount for a Recipient",query_id:1209,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"The amount of payment received by an address.",parameters_description:["address"]},{module:jo.payment,query_name:"Time",query_id:1210,parameters:[],return:Yo.TYPE_U64,description:"Payment time"},{module:jo.payment,query_name:"Is from Treasury",query_id:1211,parameters:[],return:Yo.TYPE_BOOL,description:"Whether the payment comes from a Treasury?"},{module:jo.payment,query_name:"Treasury Address",query_id:1212,parameters:[],return:Yo.TYPE_ADDRESS,description:"The Treasury from which the payment comes."},{module:jo.payment,query_name:"Biz-ID",query_id:1213,parameters:[],return:Yo.TYPE_U64,description:"Bisiness ID number of the payment."},{module:jo.payment,query_name:"Check the purpose of payment",query_id:1214,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_ADDRESS,Yo.TYPE_U64],return:Yo.TYPE_BOOL,description:"Do Guard, Object Perpose, and Biz-ID match?",parameters_description:["guard address","object address","Biz-ID"]},{module:jo.payment,query_name:"Check & Amount for a Recipient",query_id:1215,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_ADDRESS,Yo.TYPE_U64,Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Check and get the amount of payment received by an address.",parameters_description:["guard address","object address","Biz-ID","recipient address"]},{module:jo.treasury,query_name:"Permission",query_id:1400,parameters:[],return:Yo.TYPE_ADDRESS,description:"Permission object address."},{module:jo.treasury,query_name:"Balance",query_id:1401,parameters:[],return:Yo.TYPE_U64,description:"Treasury balance."},{module:jo.treasury,query_name:"Number of Flow Records",query_id:1402,parameters:[],return:Yo.TYPE_U64,description:"Number of treasury transactions."},{module:jo.treasury,query_name:"Inflow Amount",query_id:1403,parameters:[],return:Yo.TYPE_U128,description:"Treasury inflow amount."},{module:jo.treasury,query_name:"Outflow Amount",query_id:1404,parameters:[],return:Yo.TYPE_U128,description:"Treasury outflow amount."},{module:jo.treasury,query_name:"Has Deposit Guard",query_id:1405,parameters:[],return:Yo.TYPE_BOOL,description:"Whether the deposit Guard set?"},{module:jo.treasury,query_name:"Deposit Guard",query_id:1406,parameters:[],return:Yo.TYPE_ADDRESS,description:"Deposit Guard address."},{module:jo.treasury,query_name:"Number of Withdraw Guards",query_id:1407,parameters:[],return:Yo.TYPE_U64,description:"Number of withdraw guards."},{module:jo.treasury,query_name:"Has Withdraw Guard",query_id:1408,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Has a Withdraw Guard added?",parameters_description:["guard address"]},{module:jo.treasury,query_name:"Withdrawal Amount with Guard",query_id:1409,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"withdrawal amount corresponding the Guard.",parameters_description:["guard address"]},{module:jo.treasury,query_name:"Recent Time with Operation",query_id:1410,parameters:[Yo.TYPE_U8],return:Yo.TYPE_U64,description:"Time of the most recent fund operation.",parameters_description:["operation"]},{module:jo.treasury,query_name:"Recent Signer with Operation",query_id:1411,parameters:[Yo.TYPE_U8],return:Yo.TYPE_ADDRESS,description:"Signer address of the most recent fund operation.",parameters_description:["operation"]},{module:jo.treasury,query_name:"Recent Payment with Operation",query_id:1412,parameters:[Yo.TYPE_U8],return:Yo.TYPE_ADDRESS,description:"Payment address of the most recent fund operation.",parameters_description:["operation"]},{module:jo.treasury,query_name:"Recent Amount with Operation",query_id:1413,parameters:[Yo.TYPE_U8],return:Yo.TYPE_U64,description:"Amount of the most recent fund operation.",parameters_description:["operation"]},{module:jo.treasury,query_name:"Recent Time with Op/Pmt",query_id:1414,parameters:[Yo.TYPE_U8,Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"Time of the most recent fund operation with payment specified.",parameters_description:["operation","payment address"]},{module:jo.treasury,query_name:"Recent Signer with Op&Pmt",query_id:1415,parameters:[Yo.TYPE_U8,Yo.TYPE_ADDRESS],return:Yo.TYPE_ADDRESS,description:"Signer of the most recent fund operationwith payment specified.",parameters_description:["operation","payment address"]},{module:jo.treasury,query_name:"Recent Amount with Op/Pmt",query_id:1416,parameters:[Yo.TYPE_U8,Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"Amount of the most recent fund operation with payment specified.",parameters_description:["operation","payment address"]},{module:jo.treasury,query_name:"Recent Time with Op/Sgr",query_id:1417,parameters:[Yo.TYPE_U8,Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"Time of the most recent fund operation with signer specified.",parameters_description:["operation","signer address"]},{module:jo.treasury,query_name:"Recent Payment with Op/Sgr",query_id:1418,parameters:[Yo.TYPE_U8,Yo.TYPE_ADDRESS],return:Yo.TYPE_ADDRESS,description:"Payment of the most recent fund operation with singner specified.",parameters_description:["operation","signer address"]},{module:jo.treasury,query_name:"Recent Amount with Op/Sgr",query_id:1419,parameters:[Yo.TYPE_U8,Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"Amount of the most recent fund operation with singer specified.",parameters_description:["operation","signer address"]},{module:jo.treasury,query_name:"Recent Time with Op/Pmt/Sgr",query_id:1420,parameters:[Yo.TYPE_U8,Yo.TYPE_ADDRESS,Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"Time of the most recent fund operation.",parameters_description:["operation","payment address","singer address"]},{module:jo.treasury,query_name:"Recent Amount with Op/Pmt/Sgr",query_id:1421,parameters:[Yo.TYPE_U8,Yo.TYPE_ADDRESS,Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"Amount of the most recent fund operation.",parameters_description:["operation","payment address","singer address"]},{module:jo.treasury,query_name:"Has Operation",query_id:1422,parameters:[Yo.TYPE_U8],return:Yo.TYPE_BOOL,description:"Whether there was a fund operation?",parameters_description:["operation"]},{module:jo.treasury,query_name:"Has Operation with Pmt",query_id:1423,parameters:[Yo.TYPE_U8,Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Whether there was a fund operation with payment specified?",parameters_description:["operation","payment address"]},{module:jo.treasury,query_name:"Has Operation with Sgr",query_id:1424,parameters:[Yo.TYPE_U8,Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Whether there was a fund operation with singer specified?",parameters_description:["operation","singer address"]},{module:jo.treasury,query_name:"Has Operation with Pmt/Sgr",query_id:1425,parameters:[Yo.TYPE_U8,Yo.TYPE_ADDRESS,Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Whether there was a fund operation?",parameters_description:["operation","payment address","singer address"]},{module:jo.treasury,query_name:"Operation at Least Times",query_id:1426,parameters:[Yo.TYPE_U8,Yo.TYPE_U8],return:Yo.TYPE_BOOL,description:"Does it operate at least a certain number of times?",parameters_description:["operation","at least times"]},{module:jo.treasury,query_name:"Operation at Least Times by a Signer",query_id:1427,parameters:[Yo.TYPE_U8,Yo.TYPE_ADDRESS,Yo.TYPE_U8],return:Yo.TYPE_BOOL,description:"Does it operate at least a certain number of times by a signer?",parameters_description:["operation","signer address","at least times"]},{module:jo.arbitration,query_name:"Permission",query_id:1500,parameters:[],return:Yo.TYPE_ADDRESS,description:"Permission object address."},{module:jo.arbitration,query_name:"Paused",query_id:1501,parameters:[],return:Yo.TYPE_BOOL,description:"Is it allowed to create Arb?"},{module:jo.arbitration,query_name:"Fee",query_id:1502,parameters:[],return:Yo.TYPE_U64,description:"Cost of arbitration."},{module:jo.arbitration,query_name:"Has Endpoint",query_id:1503,parameters:[],return:Yo.TYPE_BOOL,description:"Is the endpoint set?"},{module:jo.arbitration,query_name:"Endpoint",query_id:1504,parameters:[],return:Yo.TYPE_STRING,description:"Endpoint url/ipfs."},{module:jo.arbitration,query_name:"Has Customer Guard",query_id:1505,parameters:[],return:Yo.TYPE_BOOL,description:"Is there Guard set to apply for arbitration?"},{module:jo.arbitration,query_name:"Customer Guard",query_id:1506,parameters:[],return:Yo.TYPE_ADDRESS,description:"Guard to apply for arbitration."},{module:jo.arbitration,query_name:"Number of Voting Guard",query_id:1507,parameters:[],return:Yo.TYPE_U64,description:"Number of voting guards."},{module:jo.arbitration,query_name:"Has Voting Guard",query_id:1508,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Has the voting Guard added?",parameters_description:["guard address"]},{module:jo.arbitration,query_name:"Voting Weight",query_id:1509,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"Voting weight of the voting Guard.",parameters_description:["guard address"]},{module:jo.arbitration,query_name:"Treasury",query_id:1510,parameters:[],return:Yo.TYPE_ADDRESS,description:"The address of the Treasury where fees was collected at the time of withdrawal."},{module:jo.arb,query_name:"Order",query_id:1600,parameters:[],return:Yo.TYPE_ADDRESS,description:"Order under arbitration."},{module:jo.arb,query_name:"Arbitration",query_id:1601,parameters:[],return:Yo.TYPE_ADDRESS,description:"Arbitration object address."},{module:jo.arb,query_name:"Feedback",query_id:1602,parameters:[],return:Yo.TYPE_STRING,description:"Arbitration feedback."},{module:jo.arb,query_name:"Has Compensation",query_id:1603,parameters:[],return:Yo.TYPE_BOOL,description:"Whether there is an arbitration result?"},{module:jo.arb,query_name:"Compensation",query_id:1604,parameters:[],return:Yo.TYPE_U64,description:"Compensation should be given to the order payer."},{module:jo.arb,query_name:"Unclaimed Arbitration Costs",query_id:1605,parameters:[],return:Yo.TYPE_U64,description:"Unclaimed arbitration costs."},{module:jo.arb,query_name:"Turnout",query_id:1606,parameters:[],return:Yo.TYPE_U64,description:"The number of addresses have voted."},{module:jo.arb,query_name:"Has voted",query_id:1607,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_BOOL,description:"Has someone voted?",parameters_description:["voter address"]},{module:jo.arb,query_name:"Voting weight",query_id:1608,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"The weight of a complete vote for the address.",parameters_description:["voter address"]},{module:jo.arb,query_name:"Voting Time",query_id:1609,parameters:[Yo.TYPE_ADDRESS],return:Yo.TYPE_U64,description:"The time of a complete vote for the address.",parameters_description:["voter address"]},{module:jo.arb,query_name:"Voting Option",query_id:1610,parameters:[Yo.TYPE_ADDRESS,Yo.TYPE_U8],return:Yo.TYPE_BOOL,description:"Does an address complete voting for the option?",parameters_description:["voter address","option index"]},{module:jo.arb,query_name:"Number of Options",query_id:1611,parameters:[],return:Yo.TYPE_U64,description:"Number of voting options."},{module:jo.arb,query_name:"Number of Votes",query_id:1612,parameters:[Yo.TYPE_U8],return:Yo.TYPE_U64,description:"The number of votes received for an option.",parameters_description:["option index"]}];var su;!function(e){e.txn="Txn Functions",e.number="Number Crunching",e.logic="Compare or Logic"}(su||(su={}));const iu=[{from:"type",name:"Txn Signer",value:qo.TYPE_SIGNER,group:su.txn,return:Yo.TYPE_ADDRESS},{from:"type",name:"Txn Time",value:qo.TYPE_CLOCK,group:su.txn,return:Yo.TYPE_U64},{from:"type",name:"Guard Address",value:qo.TYPE_GUARD,group:su.txn,return:Yo.TYPE_ADDRESS},{from:"type",name:"PositiveNumber to Address",value:ko.TYPE_NUMBER_ADDRESS,group:su.number,return:Yo.TYPE_ADDRESS},{from:"type",name:"PositiveNumber Add (+)",value:ko.TYPE_NUMBER_ADD,group:su.number,return:"number"},{from:"type",name:"PositiveNumber Subtract (-)",value:ko.TYPE_NUMBER_SUBTRACT,group:su.number,return:"number"},{from:"type",name:"PositiveNumber Multiply (*)",value:ko.TYPE_NUMBER_MULTIPLY,group:su.number,return:"number"},{from:"type",name:"PositiveNumber Devide (/)",value:ko.TYPE_NUMBER_DEVIDE,group:su.number,return:"number"},{from:"type",name:"PositiveNumber Mod (%)",value:ko.TYPE_NUMBER_MOD,group:su.number,return:"number"}];class nu{get_object(){return this.object}static From(e,t){let r=new nu(e);return r.object=$o.TXB_OBJECT(e,t),r}constructor(e){this.txb=e,this.object=""}static New(e,t,r){r.IsReady()||Ia(Ba.InvalidParam,"launch maker"),so(t)||Ia(Ba.IsValidDesription);let s=r.get_input()[0],i=r.get_constant();(0==s.length||s.length>nu.MAX_INPUT_LENGTH)&&Ia(Ba.InvalidParam,"launch input");let n=!0;i?.forEach(((e,t)=>{ou.IsValidIndentifier(t)||(n=!1),e.value&&e.bWitness&&(n=!1),void 0!==e.value||e.bWitness||(n=!1)})),n||Ia(Ba.InvalidParam,"launch constants");let a=new Uint8Array(s),o=new nu(e);return o.object=e.moveCall({target:$o.Instance().guardFn("new"),arguments:[e.pure.string(t),e.pure.vector("u8",[].slice.call(a.reverse()))]}),i?.forEach(((t,r)=>{if(t.bWitness){const s=new Uint8Array(1);s.set([t.type],0),e.moveCall({target:$o.Instance().guardFn("constant_add"),arguments:[e.object(o.object),e.pure.u8(r),e.pure.bool(!0),e.pure.vector("u8",[].slice.call(s)),e.pure.bool(!0)]})}else{const s=wo(t.value,t.type);e.moveCall({target:$o.Instance().guardFn("constant_add"),arguments:[e.object(o.object),e.pure.u8(r),e.pure.bool(!1),e.pure.vector("u8",[].slice.call(s)),e.pure.bool(!0)]})}})),o}launch(){return this.txb.moveCall({target:$o.Instance().guardFn("create"),arguments:[this.txb.object(this.object)]})}static everyone_guard(e){return e.moveCall({target:$o.Instance().guardFn("everyone_guard"),arguments:[]})}static QueryAddressIdentifiers(e,t,r){const s=new bs;s.moveCall({target:$o.Instance().guardFn("query_address_identifiers"),arguments:[s.object(e)]}),$o.Client().devInspectTransactionBlock({sender:r,transactionBlock:s}).then((e=>{if(e.results&&e.results[0]?.returnValues&&1!==e.results[0]?.returnValues?.length)return void t({err:"not match",txb:s,identifiers:[]});const r=za.getInstance().de("vector<u8>",Uint8Array.from(e.results[0].returnValues[0][0]));t({identifiers:r,txb:s})})).catch((e=>{console.log(e),t({err:e,txb:s,identifiers:[]})}))}}nu.MAX_INPUT_LENGTH=10240,nu.BoolCmd=ru.filter((e=>e.return===Yo.TYPE_BOOL)),nu.IsBoolCmd=e=>nu.BoolCmd.some((t=>t.query_id==e)),nu.CmdFilter=e=>ru.filter((t=>t.return===e)),nu.GetCmd=e=>ru.find((t=>t.query_id==e)),nu.GetCmdOption=e=>{const t=nu.GetCmd(e);return t?{from:"query",name:t.query_name,value:t.query_id,group:So(t.module),return:t.return}:t},nu.GetInputParams=e=>{const t=nu.GetCmd(e);return t?t.parameters:[]},nu.GetModuleName=e=>{let t=nu.GetCmd(e);return t?So(t.module):""},nu.NumberOptions=()=>[...nu.CmdFilter(Yo.TYPE_U8),...nu.CmdFilter(Yo.TYPE_U64),...nu.CmdFilter(Yo.TYPE_U128),...nu.CmdFilter(Yo.TYPE_U256)].map((e=>({from:"query",name:e.query_name,value:e.query_id,group:So(e.module),return:e.return}))).concat(nu.Crunchings),nu.Signer=iu.find((e=>"Txn Signer"===e.name&&e.value===qo.TYPE_SIGNER)),nu.Time=iu.find((e=>"Txn Time"===e.name&&e.value===qo.TYPE_CLOCK)),nu.Guard=iu.find((e=>"Guard Address"===e.name&&e.value===qo.TYPE_GUARD)),nu.Logics=()=>Uo.map((e=>({from:"type",name:e[1],value:e[0],group:su.logic,return:Yo.TYPE_BOOL}))),nu.Crunchings=iu.filter((e=>e.value===ko.TYPE_NUMBER_ADD||e.value===ko.TYPE_NUMBER_SUBTRACT||e.value===ko.TYPE_NUMBER_MULTIPLY||e.value===ko.TYPE_NUMBER_DEVIDE||e.value===ko.TYPE_NUMBER_MOD||e.value===ko.TYPE_NUMBER_ADDRESS)),nu.CommonOptions=e=>nu.CmdFilter(e).map((e=>({from:"query",name:e.query_name,value:e.query_id,group:So(e.module),return:e.return}))),nu.AllOptions=()=>[...ru.map((e=>({from:"query",name:e.query_name,value:e.query_id,group:So(e.module),return:e.return}))),...iu],nu.StringOptions=()=>[...nu.CmdFilter(Yo.TYPE_STRING)].map((e=>({from:"query",name:e.query_name,value:e.query_id,group:So(e.module),return:e.return}))),nu.BoolOptions=()=>[...nu.BoolCmd.map((e=>({from:"query",name:e.query_name,value:e.query_id,group:So(e.module),return:e.return}))),...nu.Logics()],nu.AddressOptions=()=>[...ru.filter((e=>e.return===Yo.TYPE_ADDRESS)).map((e=>({from:"query",name:e.query_name,value:e.query_id,group:So(e.module),return:e.return}))),...iu.filter((e=>e.return===Yo.TYPE_ADDRESS))],nu.Options=e=>{if("number"===e)return nu.NumberOptions();if("any"===e)return nu.AllOptions();switch(e){case Yo.TYPE_BOOL:return nu.BoolOptions();case Yo.TYPE_STRING:return nu.StringOptions()}return nu.CommonOptions(e)};const au=e=>po(e)&&0!==e;class ou{static GetWitnessIndex(){return this._witness_index>=this._const_index&&Ia(Ba.Fail,"too many witness"),ou._witness_index++}static getConstIndex(){return this._const_index<=this._witness_index&&Ia(Ba.Fail,"too many const"),ou._const_index--}constructor(){this.data=[],this.type_validator=[],this.constant=new Map}add_constant(e,t,r,s=!0){return void 0===r&&(r=void 0===t?ou.GetWitnessIndex():ou.getConstIndex()),this.constant.get(r)||(s&&void 0!==t&&(t=za.getInstance().ser(e,t)),this.constant.set(r,{type:e,value:void 0===t?void 0:t,bWitness:void 0===t})),r}add_param(e,t){switch(e){case Yo.TYPE_ADDRESS:case Yo.TYPE_BOOL:case Yo.TYPE_U8:case Yo.TYPE_U64:case Yo.TYPE_U128:case Yo.TYPE_U256:case Yo.TYPE_VEC_ADDRESS:case Yo.TYPE_VEC_BOOL:case Yo.TYPE_VEC_U128:case Yo.TYPE_VEC_U64:case Yo.TYPE_VEC_VEC_U8:case Yo.TYPE_OPTION_U64:case Yo.TYPE_OPTION_ADDRESS:case Yo.TYPE_OPTION_BOOL:case Yo.TYPE_OPTION_U128:case Yo.TYPE_OPTION_U256:case Yo.TYPE_OPTION_U8:case Yo.TYPE_VEC_U256:this.data.push(za.getInstance().ser(Yo.TYPE_U8,e)),this.data.push(za.getInstance().ser(e,t)),this.type_validator.push(e);break;case Yo.TYPE_STRING:case Yo.TYPE_VEC_U8:t||Ia(Ba.InvalidParam,"param: "+e),this.data.push(za.getInstance().ser(Yo.TYPE_U8,e)),"string"==typeof t?this.data.push(za.getInstance().ser(Yo.TYPE_STRING,t)):this.data.push(za.getInstance().ser(Yo.TYPE_VEC_U8,t)),this.type_validator.push(e);break;case qo.TYPE_SIGNER:case qo.TYPE_GUARD:this.data.push(za.getInstance().ser(Yo.TYPE_U8,e)),this.type_validator.push(Yo.TYPE_ADDRESS);break;case qo.TYPE_CLOCK:this.data.push(za.getInstance().ser(Yo.TYPE_U8,e)),this.type_validator.push(Yo.TYPE_U64);break;case qo.TYPE_CONSTANT:au(t)||Ia(Ba.IsValidGuardIdentifier,"add_param param:"+e);var r=this.constant.get(t);r||Ia(Ba.Fail,"identifier not in constant:"+t),this.type_validator.push(r.type),this.data.push(za.getInstance().ser(Yo.TYPE_U8,e)),this.data.push(za.getInstance().ser(Yo.TYPE_U8,t));break;default:Ia(Ba.InvalidParam,"add_param type:"+e)}return this}add_query(e,t,r){const s=ru.filter((r=>r.module==e&&r.query_name==t));return 1!==s.length&&Ia(Ba.InvalidParam,"add_query2:"+t),this.add_query2(s[0].query_id,r)}add_query2(e,t){const r=ru.findIndex((t=>t.query_id==e));-1==r&&Ia(Ba.InvalidParam,"query_id:"+e),"number"==typeof t?ou.IsValidIndentifier(t)||Ia(Ba.InvalidParam,"object_address_from:"+e):oo(t)||Ia(Ba.InvalidParam,"object_address_from:"+e);let s=this.type_validator.length-ru[r].parameters.length;s<0&&Ia(Ba.InvalidParam,"offset:"+e);let i=this.type_validator.slice(s);if(La(i,ru[r].parameters)||Ia(Ba.Fail,"array_equal:"+e),this.data.push(za.getInstance().ser(Yo.TYPE_U8,ko.TYPE_QUERY)),"string"==typeof t)this.data.push(za.getInstance().ser(Yo.TYPE_U8,Yo.TYPE_ADDRESS)),this.data.push(za.getInstance().ser(Yo.TYPE_ADDRESS,t));else{let r=this.constant.get(t);r||Ia(Ba.Fail,"object_address_from not in constant:"+e),r?.type==Yo.TYPE_ADDRESS?(this.data.push(za.getInstance().ser(Yo.TYPE_U8,qo.TYPE_CONSTANT)),this.data.push(za.getInstance().ser(Yo.TYPE_U8,t))):Ia(Ba.Fail,"type bWitness not match:"+e)}return this.data.push(za.getInstance().ser("u16",ru[r].query_id)),this.type_validator.splice(s,ru[r].parameters.length),this.type_validator.push(ru[r].return),this}add_logic(e,t=2){var r=Uo.find((t=>t[0]===e));r&&(r=r[1]);let s,i=2,n=Yo.TYPE_BOOL;switch(e){case ko.TYPE_LOGIC_AS_U256_GREATER:case ko.TYPE_LOGIC_AS_U256_GREATER_EQUAL:case ko.TYPE_LOGIC_AS_U256_LESSER:case ko.TYPE_LOGIC_AS_U256_LESSER_EQUAL:case ko.TYPE_LOGIC_AS_U256_EQUAL:(!t||t<2)&&Ia(Ba.Fail,"logic param invalid:"+r),i=t,this.type_validator.length<i&&Ia(Ba.Fail,"type_validator.length:"+r);for(let e=1;e<=i;++e)ou.match_u256(this.type_validator[this.type_validator.length-e])||Ia(Ba.Fail,"type_validator check:"+r);break;case ko.TYPE_LOGIC_EQUAL:(!t||t<2)&&Ia(Ba.Fail,"logic param invalid:"+r),i=t,this.type_validator.length<i&&Ia(Ba.Fail,"type_validator.length:"+r),s=this.type_validator[this.type_validator.length-1];for(let e=2;e<=i;++e)this.type_validator[this.type_validator.length-e]!==s&&Ia(Ba.Fail,"type_validator check:"+r);break;case ko.TYPE_LOGIC_HAS_SUBSTRING:(!t||t<2)&&Ia(Ba.Fail,"logic param invalid:"+r),i=t,this.type_validator.length<i&&Ia(Ba.Fail,"type_validator.length:"+r);for(let e=1;e<=i;++e)this.type_validator[this.type_validator.length-e]!==Yo.TYPE_STRING&&Ia(Ba.Fail,"type_validator check:"+r);break;case ko.TYPE_LOGIC_NOT:i=1,this.type_validator.length<i&&Ia(Ba.Fail,"type_validator.length:"+r),this.type_validator[this.type_validator.length-1]!=Yo.TYPE_BOOL&&Ia(Ba.Fail,"type_validator check:"+r);break;case ko.TYPE_NUMBER_ADDRESS:i=1,n=Yo.TYPE_ADDRESS,this.type_validator.length<i&&Ia(Ba.Fail,"type_validator.length:"+r),ou.match_u256(this.type_validator[this.type_validator.length-1])||Ia(Ba.Fail,"type_validator check:"+r);break;case ko.TYPE_LOGIC_AND:case ko.TYPE_LOGIC_OR:(!t||t<2)&&Ia(Ba.Fail,"logic param invalid:"+r),i=t,this.type_validator.length<i&&Ia(Ba.Fail,"type_validator.length:"+r);for(let e=1;e<=i;++e)this.type_validator[this.type_validator.length-e]!=Yo.TYPE_BOOL&&Ia(Ba.Fail,"type_validator check:"+r);break;case ko.TYPE_NUMBER_ADD:case ko.TYPE_NUMBER_DEVIDE:case ko.TYPE_NUMBER_MULTIPLY:case ko.TYPE_NUMBER_SUBTRACT:case ko.TYPE_NUMBER_MOD:(!t||t<2)&&Ia(Ba.Fail,"logic param invalid:"+r),i=t,this.type_validator.length<i&&Ia(Ba.Fail,"type_validator.length:"+r);for(let e=1;e<=i;++e)ou.match_u256(this.type_validator[this.type_validator.length-1])||Ia(Ba.Fail,"type_validator check:"+r);n=Yo.TYPE_U256;break;default:Ia(Ba.InvalidParam,"add_logic type invalid:"+r)}return this.data.push(za.getInstance().ser(Yo.TYPE_U8,e)),ou.is_multi_input_op(e)&&this.data.push(za.getInstance().ser(Yo.TYPE_U8,t)),this.type_validator.splice(this.type_validator.length-i),this.type_validator.push(n),this}hasIdentifier(e){return this.constant.has(e)}build(e=!1){return 1==this.type_validator.length&&this.type_validator[0]==Yo.TYPE_BOOL||Ia(Ba.Fail,"type_validator check"),e&&this.add_logic(ko.TYPE_LOGIC_NOT),this.data.push(Fa(Uint8Array,...this.data)),this.data.splice(0,this.data.length-1),this}IsReady(){return 1==this.type_validator.length&&this.type_validator[0]==Yo.TYPE_BOOL&&1==this.data.length}combine(e,t=!0,r=!1){e.IsReady()&&this.IsReady()||Ia(Ba.Fail,"both should built yet");let s=new ou;this.constant.forEach(((e,t)=>{s.constant.set(t,{type:e.type,value:e.value,bWitness:e.bWitness})})),e.constant.forEach(((e,t)=>{s.constant.has(t)&&!r&&Ia(Ba.Fail,"constant identifier exist"),s.constant.set(t,{type:e.type,value:e.value,bWitness:e.bWitness})}));let i=t?ko.TYPE_LOGIC_AND:ko.TYPE_LOGIC_OR;return s.data.push(Fa(Uint8Array,...this.data,...e.data,za.getInstance().ser(Yo.TYPE_U8,i),za.getInstance().ser(Yo.TYPE_U8,2))),this.data.splice(0,this.data.length-1),s.type_validator=this.type_validator,s}get_constant(){return this.constant}get_input(){return this.data}static input_combine(e,t,r=!0){let s=r?ko.TYPE_LOGIC_AND:ko.TYPE_LOGIC_OR;return Fa(Uint8Array,e,t,za.getInstance().ser(Yo.TYPE_U8,s),za.getInstance().ser(Yo.TYPE_U8,2))}static input_not(e){return Fa(Uint8Array,e,za.getInstance().ser(Yo.TYPE_U8,ko.TYPE_LOGIC_NOT))}static match_u256(e){return e==Yo.TYPE_U8||e==Yo.TYPE_U64||e==Yo.TYPE_U128||e==Yo.TYPE_U256}static is_multi_input_op(e){return e===ko.TYPE_LOGIC_AS_U256_GREATER||e===ko.TYPE_LOGIC_AS_U256_GREATER_EQUAL||e===ko.TYPE_LOGIC_AS_U256_LESSER||e===ko.TYPE_LOGIC_AS_U256_LESSER||e===ko.TYPE_LOGIC_AS_U256_LESSER_EQUAL||e===ko.TYPE_LOGIC_AS_U256_EQUAL||e===ko.TYPE_LOGIC_EQUAL||e===ko.TYPE_LOGIC_HAS_SUBSTRING||e===ko.TYPE_LOGIC_AND||e===ko.TYPE_LOGIC_OR||e===ko.TYPE_NUMBER_ADD||e===ko.TYPE_NUMBER_DEVIDE||e===ko.TYPE_NUMBER_MULTIPLY||e===ko.TYPE_NUMBER_SUBTRACT||e===ko.TYPE_NUMBER_MOD}}var uu,cu,du,hu,pu,lu,mu,_u;ou._witness_index=1,ou._const_index=255,ou.IsValidIndentifier=e=>!(!po(e)||e<1),function(e){e[e.POLICY_MODE_FREE=0]="POLICY_MODE_FREE",e[e.POLICY_MODE_STRICT=1]="POLICY_MODE_STRICT"}(uu||(uu={})),function(e){e[e.NORMAL=0]="NORMAL",e[e.WOWOK_GRANTEE=1]="WOWOK_GRANTEE",e[e.WOWOK_ORACLE=2]="WOWOK_ORACLE"}(cu||(cu={}));class bu{get_object(){return this.object}constructor(e,t){this.txb=e,this.permission=t,this.object=""}static From(e,t,r){let s=new bu(e,t);return s.object=$o.TXB_OBJECT(e,r),s}static New(e,t,r,s=uu.POLICY_MODE_FREE,i){$o.IsValidObjects([t])||Ia(Ba.IsValidObjects,"permission"),so(r)||Ia(Ba.IsValidDesription);let n=new bu(e,t);return n.object=i?e.moveCall({target:$o.Instance().repositoryFn("new_with_passport"),arguments:[i,e.pure.string(r),e.pure.u8(s),$o.TXB_OBJECT(e,t)]}):e.moveCall({target:$o.Instance().repositoryFn("new"),arguments:[e.pure.string(r),e.pure.u8(s),$o.TXB_OBJECT(e,t)]}),n}launch(){return this.txb.moveCall({target:$o.Instance().repositoryFn("create"),arguments:[$o.TXB_OBJECT(this.txb,this.object)]})}add_data(e){bu.IsValidName(e.key)||Ia(Ba.IsValidName,"add_data");let t=!0;e.data.forEach((e=>{oo(e.address)||(t=!1),bu.IsValidValue(e.bcsBytes)||(t=!1)})),t||Ia(Ba.InvalidParam,"add_data"),void 0!==e?.value_type?e.data.forEach((t=>this.txb.moveCall({target:$o.Instance().repositoryFn("add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(t.address),this.txb.pure.string(e.key),this.txb.pure.u8(e.value_type),this.txb.pure.vector("u8",[...t.bcsBytes]),$o.TXB_OBJECT(this.txb,this.permission)]}))):e.data.forEach((t=>this.txb.moveCall({target:$o.Instance().repositoryFn("add_typed_data"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(t.address),this.txb.pure.string(e.key),this.txb.pure.vector("u8",[...t.bcsBytes]),$o.TXB_OBJECT(this.txb,this.permission)]})))}add_data2(e){oo(e.address)||Ia(Ba.IsValidAddress,"add_data2");let t=!0;e.data.forEach((e=>{bu.IsValidName(e.key)||(t=!1),bu.IsValidValue(e.bcsBytes)||(t=!1)})),t||Ia(Ba.InvalidParam,"add_data2"),void 0!==e?.value_type?e.data.forEach((t=>this.txb.moveCall({target:$o.Instance().repositoryFn("add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e.address),this.txb.pure.string(t.key),this.txb.pure.u8(e.value_type),this.txb.pure.vector("u8",[...t.bcsBytes]),$o.TXB_OBJECT(this.txb,this.permission)]}))):e.data.forEach((t=>this.txb.moveCall({target:$o.Instance().repositoryFn("add_typed_data"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e.address),this.txb.pure.string(t.key),this.txb.pure.vector("u8",[...t.bcsBytes]),$o.TXB_OBJECT(this.txb,this.permission)]})))}remove(e,t){bu.IsValidName(t)||Ia(Ba.IsValidName),oo(e)||Ia(Ba.IsValidAddress),this.txb.moveCall({target:$o.Instance().repositoryFn("remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e),this.txb.pure.string(t),$o.TXB_OBJECT(this.txb,this.permission)]})}add_reference(e,t){0!==e.length&&(To(e,oo)||Ia(Ba.IsValidArray,"add_reference"),t?this.txb.moveCall({target:$o.Instance().repositoryFn("reference_add_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().repositoryFn("reference_add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)]}))}remove_reference(e,t,r){(0!==e.length||t)&&(To(e,oo)||Ia(Ba.IsValidArray,"remove_reference"),t?r?this.txb.moveCall({target:$o.Instance().repositoryFn("reference_removeall_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().repositoryFn("reference_removeall"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)]}):r?this.txb.moveCall({target:$o.Instance().repositoryFn("reference_remove_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().repositoryFn("reference_remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)]}))}add_policies(e,t){if(0===e.length)return;let r=!0;e.forEach((e=>{so(e.description)&&bu.IsValidName(e.key)||(r=!1)})),r||Ia(Ba.InvalidParam,"policies"),e.forEach((e=>{let r=this.txb.pure.option("u64",e?.permissionIndex?e?.permissionIndex:void 0);t?this.txb.moveCall({target:$o.Instance().repositoryFn("policy_add_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e.key),this.txb.pure.string(e.description),r,this.txb.pure.u8(e.dataType),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().repositoryFn("policy_add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e.key),this.txb.pure.string(e.description),r,this.txb.pure.u8(e.dataType),$o.TXB_OBJECT(this.txb,this.permission)]})}))}remove_policies(e,t,r){0!==e.length&&(To(e,bu.IsValidName)||Ia(Ba.InvalidParam,"policy_keys"),r?t?this.txb.moveCall({target:$o.Instance().repositoryFn("policy_removeall_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().repositoryFn("policy_remove_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)]}):t?this.txb.moveCall({target:$o.Instance().repositoryFn("policy_removeall"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().repositoryFn("policy_remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)]}))}rename_policy(e,t,r){io(e)&&io(t)||Ia(Ba.IsValidName,"change_policy"),r?this.txb.moveCall({target:$o.Instance().repositoryFn("policy_rename_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.string(t),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().repositoryFn("policy_rename"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.string(t),$o.TXB_OBJECT(this.txb,this.permission)]})}set_description(e,t){so(e)||Ia(Ba.IsValidDesription),t?this.txb.moveCall({target:$o.Instance().repositoryFn("description_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().repositoryFn("description_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)]})}set_policy_mode(e,t){t?this.txb.moveCall({target:$o.Instance().repositoryFn("mode_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.u8(e),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().repositoryFn("mode_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.u8(e),$o.TXB_OBJECT(this.txb,this.permission)]})}set_policy_description(e,t,r){bu.IsValidName(e)||Ia(Ba.IsValidName,"policy"),so(t)||Ia(Ba.IsValidDesription),r?this.txb.moveCall({target:$o.Instance().repositoryFn("policy_description_set_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.string(t),$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().repositoryFn("policy_description_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.string(t),$o.TXB_OBJECT(this.txb,this.permission)]})}set_policy_permission(e,t,r){bu.IsValidName(e)||Ia(Ba.IsValidName,"policy");let s=this.txb.pure.option("u64",void 0);void 0!==t&&(Qo.IsValidPermissionIndex(t)||Ia(Ba.IsValidPermissionIndex),s=this.txb.pure.option("u64",t)),r?this.txb.moveCall({target:$o.Instance().repositoryFn("policy_permission_set_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),s,$o.TXB_OBJECT(this.txb,this.permission)]}):this.txb.moveCall({target:$o.Instance().repositoryFn("policy_permission_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),s,$o.TXB_OBJECT(this.txb,this.permission)]})}change_permission(e){$o.IsValidObjects([e])||Ia(Ba.IsValidObjects),this.txb.moveCall({target:$o.Instance().repositoryFn("permission_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission),$o.TXB_OBJECT(this.txb,e)],typeArguments:[]}),this.permission=e}static rpc_de_data(e){const t=e?.map((e=>{const t=new Uint8Array(e?.data?.content?.fields?.value),r=t?.length>0?t[0]:null;var s=t.length>0?t.slice(1):Uint8Array.from([]);return r===Yo.TYPE_STRING?(s=za.getInstance().de(Yo.TYPE_VEC_U8,s),s=(new TextDecoder).decode(Uint8Array.from(s))):r===Yo.TYPE_VEC_STRING?s=(s=za.getInstance().de(Yo.TYPE_VEC_VEC_U8,s)).map((e=>(new TextDecoder).decode(Uint8Array.from(e)))):(s=za.getInstance().de(t[0],s),r===Yo.TYPE_ADDRESS?s="0x"+s:r===Yo.TYPE_VEC_ADDRESS?s=s.map((e=>"0x"+e)):r===Yo.TYPE_BOOL&&(s=s?"True":"False")),{object:e?.data?.content?.fields?.id?.id,id:e?.data?.content?.fields?.name?.fields?.id,name:e?.data?.content?.fields?.name?.fields?.key,data:s,dataType:ka(r)}}));return t}static DataType2ValueType(e){try{const t=BigInt(e);if(Yo.TYPE_U8,t<=Ca);else if(t<=Pa)Yo.TYPE_U64;else if(t<=Sa)Yo.TYPE_U128;else{if(!(t<=Aa))return;Yo.TYPE_U256}}catch(e){console.log(e)}}}bu.MAX_POLICY_COUNT=120,bu.MAX_KEY_LENGTH=128,bu.MAX_VALUE_LENGTH=204800,bu.MAX_REFERENCE_COUNT=100,bu.IsValidName=e=>e.length<=bu.MAX_KEY_LENGTH&&0!=e.length,bu.IsValidValue=e=>e.length<bu.MAX_VALUE_LENGTH,bu.ResolveRepositoryData=(e,t)=>{if(e===Do.String)return{type:Yo.TYPE_STRING,data:za.getInstance().ser(Yo.TYPE_VEC_U8,(new TextEncoder).encode(t.toString()))};if(e===Do.PositiveNumber){const e=bu.DataType2ValueType(t);if(!e)return;return{type:e,data:za.getInstance().ser(e,t)}}if(e===Do.Address){if(!oo(t))return;return{type:Yo.TYPE_ADDRESS,data:za.getInstance().ser(Yo.TYPE_ADDRESS,t)}}if(e===Do.Address_Vec){for(let e=0;e<t.length;++e)if(!oo(t[e]))return;return{type:Yo.TYPE_VEC_ADDRESS,data:za.getInstance().ser(Yo.TYPE_VEC_ADDRESS,t)}}if(e===Do.PositiveNumber_Vec){let e=Yo.TYPE_U8;for(let r=0;r<t.length;++r){const r=bu.DataType2ValueType(t);if(!r)return;r>e&&(e=r)}return e=e===Yo.TYPE_U8?Yo.TYPE_VEC_U8:e===Yo.TYPE_U64?Yo.TYPE_VEC_U64:e===Yo.TYPE_U128?Yo.TYPE_VEC_U128:Yo.TYPE_VEC_U256,{type:e,data:za.getInstance().ser(e,t)}}if(e===Do.String_Vec){const e=t.map((e=>(new TextEncoder).encode(e)));return{type:Yo.TYPE_VEC_STRING,data:za.getInstance().ser(Yo.TYPE_VEC_VEC_U8,e)}}if(e===Do.Bool){if("boolean"!=typeof t)return;return{type:Yo.TYPE_BOOL,data:za.getInstance().ser(Yo.TYPE_BOOL,t)}}};class gu{constructor(e){this.guard_list=[],this.guardlist=()=>this.guard_list,this.future_fills=()=>{const e=[];return this.guard_list.forEach((t=>{t.constant.filter((e=>e.bWitness)).forEach((r=>{const s=t.input.filter((e=>e.identifier===r.identifier&&void 0!==e.cmd)).map((e=>e.cmd));let i=0;t.input.forEach((e=>{e.identifier===r.identifier&&i++})),e.push({guard:t.id,witness:void 0,identifier:r.identifier,type:r.type,cmd:s??[],cited:i})}))})),e},this.done=async(e,t)=>{let r=[];if(this.guard_list.forEach((t=>{t.constant.forEach((t=>{if(t.bWitness){const r=e?.find((e=>e.identifier===t.identifier));r?t.value=r.witness:Ia(Ba.Fail,"done: invalid witness "+t.identifier)}})),t.input.filter((e=>void 0!==e.cmd)).forEach((e=>{if(void 0!==e.identifier){const s=t.constant.find((t=>t.identifier===e.identifier&&t.type===Yo.TYPE_ADDRESS));s&&oo(s.value)||Ia(Ba.Fail,"done: invalid identifier "+e.identifier),r.push(s.value)}else r.push(e.value)}))})),t)return 0===r.length?void t(this.done_helper([])):void $o.Instance().query_raw(Ma(r),{showType:!0}).then((e=>{t(this.done_helper(e))})).catch((e=>{console.log(e),t(void 0)}));{let e=[];return r.length>0&&(e=await $o.Instance().query_raw(Ma(r),{showType:!0})),this.done_helper(e)}},this.object_query=(e,t="guard_query")=>{for(let r=0;r<$o.Instance().WOWOK_OBJECTS_TYPE().length;r++)if(e.type.includes($o.Instance().WOWOK_OBJECTS_TYPE()[r]))return{target:$o.Instance().WOWOK_OBJECTS_PREFIX_TYPE()[r]+t,object:ut({objectId:e.objectId,mutable:!1,initialSharedVersion:e.version}),types:$a(e.type),id:e.objectId}},this.guards=e}static Parse_Guard_Helper(e,t){const r=$o.Instance(),s=new du(e);return t.forEach((e=>{const t=e.data?.content;if(t||Ia(Ba.Fail,"Parse_Guard_Helper invalid content"),-1===r.WOWOK_OBJECTS_TYPE().findIndex((e=>e.includes("guard::Guard")&&e==t.type))&&Ia(Ba.Fail,"Parse_Guard_Helper invalid type: "+t.type),t.fields.input.type===r.package("base")+"::bcs::BCS"){const r=du.parse_constant(t.fields.constants),i=du.parse_bcs(r,Uint8Array.from(t.fields.input.fields.bytes));s.guard_list.push({id:t.fields.id.id,input:[...i],constant:[...r],digest:e.data?.digest??"",version:e.data?.version??""})}else Ia(Ba.Fail,"Parse_Guard_Helper invalid package: "+t.fields.input.type)})),s}done_helper(e){let t=[],r=[];return this.guard_list.forEach((s=>{r.push(s.id),s.input.filter((e=>void 0!==e.cmd)).forEach((r=>{let i=r.value;i||void 0===r.identifier||(i=s.constant.find((e=>e.identifier==r.identifier))?.value);let n=e.find((e=>e.data?.objectId==i));n||Ia(Ba.Fail,"query object not match");let a=this.object_query(n.data);a||Ia(Ba.Fail,"query object fail"),t.push(a)}))})),{query:t,info:this.guard_list}}}du=gu,gu.DeGuardObject_FromData=(e,t)=>{let r=du.parse_constant(e),s=du.parse_bcs(r,t);s&&0!=s.length||Ia(Ba.Fail,"GuardObject: data parsed error");let i=[];return s.forEach((e=>{du.ResolveData(r,i,{...e,child:[]})})),1!=i.length&&Ia(Ba.Fail,"GuardObject: parse error"),{object:i.pop(),constant:r}},gu.DeGuardObject=async(e,t)=>{oo(t)||Ia(Ba.IsValidAddress,"GuardObject guard");let r=await e.query_raw([t]);0!=r.length&&r[0].data&&r[0].data?.objectId==t||Ia(Ba.Fail,"GuardObject query error");let s=r[0].data.content;return s?.type!=e.package("base")+"::guard::Guard"&&Ia(Ba.Fail,"GuardObject object invalid"),du.DeGuardObject_FromData(s.fields.constants,s.fields.input.fields.bytes)},gu.ResolveData=(e,t,r)=>{switch(r.type){case ko.TYPE_LOGIC_NOT:return r.ret_type=Yo.TYPE_BOOL,t.length<1&&Ia(Ba.Fail,"ResolveData: TYPE_LOGIC_NOT"),(s=t.pop()).ret_type&&s.ret_type==Yo.TYPE_BOOL||Ia(Ba.Fail,"ResolveData: TYPE_LOGIC_NOT type invalid"),r.child.push(s),void t.push(r);case ko.TYPE_NUMBER_ADDRESS:var s;return r.ret_type=Yo.TYPE_ADDRESS,t.length<1&&Ia(Ba.Fail,"ResolveData: TYPE_NUMBER_ADDRESS"),(s=t.pop()).ret_type&&ou.match_u256(s.ret_type)||Ia(Ba.Fail,"ResolveData: TYPE_NUMBER_ADDRESS type invalid"),r.child.push(s),void t.push(r);case ko.TYPE_LOGIC_AS_U256_GREATER:case ko.TYPE_LOGIC_AS_U256_GREATER_EQUAL:case ko.TYPE_LOGIC_AS_U256_LESSER:case ko.TYPE_LOGIC_AS_U256_LESSER_EQUAL:case ko.TYPE_LOGIC_AS_U256_EQUAL:case ko.TYPE_NUMBER_ADD:case ko.TYPE_NUMBER_DEVIDE:case ko.TYPE_NUMBER_MOD:case ko.TYPE_NUMBER_MULTIPLY:case ko.TYPE_NUMBER_SUBTRACT:r.type===ko.TYPE_LOGIC_AS_U256_GREATER||r.type===ko.TYPE_LOGIC_AS_U256_GREATER_EQUAL||r.type===ko.TYPE_LOGIC_AS_U256_LESSER||r.type===ko.TYPE_LOGIC_AS_U256_LESSER_EQUAL||r.type===ko.TYPE_LOGIC_AS_U256_EQUAL?r.ret_type=Yo.TYPE_BOOL:r.ret_type=Yo.TYPE_U256,(t.length<r.value||r.value<2)&&Ia(Ba.Fail,"ResolveData: "+r.type);for(let e=0;e<r.value;++e)(n=t.pop()).ret_type&&ou.match_u256(n.ret_type)||Ia(Ba.Fail,"ResolveData: "+r.type+" INVALID param type"),r.child.push(n);return void t.push(r);case ko.TYPE_LOGIC_EQUAL:r.ret_type=Yo.TYPE_BOOL,(t.length<r.value||r.value<2)&&Ia(Ba.Fail,"ResolveData: "+r.type);var i=t.pop();r.child.push(i);for(let e=1;e<r.value;++e)(n=t.pop()).ret_type&&n.ret_type==i.ret_type||Ia(Ba.Fail,"ResolveData: "+r.type+" INVALID param type"),r.child.push(n);return void t.push(r);case ko.TYPE_LOGIC_HAS_SUBSTRING:r.ret_type=Yo.TYPE_BOOL,(t.length<r.value||r.value<2)&&Ia(Ba.Fail,"ResolveData: "+r.type);for(let e=0;e<r.value;++e)(n=t.pop()).ret_type&&n.ret_type==Yo.TYPE_STRING||Ia(Ba.Fail,"ResolveData: "+r.type+" INVALID param type"),r.child.push(n);return void t.push(r);case ko.TYPE_LOGIC_AND:case ko.TYPE_LOGIC_OR:r.ret_type=Yo.TYPE_BOOL,(t.length<r.value||r.value<2)&&Ia(Ba.Fail,"ResolveData: "+r.type);for(let e=0;e<r.value;++e){var n;(n=t.pop()).ret_type&&n.ret_type==Yo.TYPE_BOOL||Ia(Ba.Fail,"ResolveData: "+r.type+" INVALID param type"),r.child.push(n)}return void t.push(r);case ko.TYPE_QUERY:r?.cmd||Ia(Ba.Fail,"OperateParamCount: cmd invalid "+r.type);let a=nu.GetCmd(r.cmd);return a||Ia(Ba.Fail,"OperateParamCount: cmd not supported "+r.type),r.ret_type=a?.return,t.length<a.parameters.length&&Ia(Ba.Fail,"OperateParamCount: cmd param lost "+r.type),a.parameters.forEach((e=>{let s=t.pop();s?.ret_type&&s.ret_type==e||Ia(Ba.Fail,"OperateParamCount: cmd param not match "+r.type),r.child.push(s)})),void t.push(r);case Yo.TYPE_ADDRESS:case Yo.TYPE_BOOL:case Yo.TYPE_U128:case Yo.TYPE_U256:case Yo.TYPE_U64:case Yo.TYPE_U8:case Yo.TYPE_VEC_ADDRESS:case Yo.TYPE_VEC_BOOL:case Yo.TYPE_VEC_U128:case Yo.TYPE_VEC_U256:case Yo.TYPE_VEC_U64:case Yo.TYPE_VEC_U8:case Yo.TYPE_VEC_VEC_U8:case Yo.TYPE_OPTION_ADDRESS:case Yo.TYPE_OPTION_BOOL:case Yo.TYPE_OPTION_U128:case Yo.TYPE_OPTION_U256:case Yo.TYPE_OPTION_U64:case Yo.TYPE_OPTION_U8:case Yo.TYPE_STRING:return r.ret_type=r.type,void t.push(r);case qo.TYPE_CLOCK:return r.ret_type=Yo.TYPE_U64,void t.push(r);case qo.TYPE_SIGNER:case qo.TYPE_GUARD:return r.ret_type=Yo.TYPE_ADDRESS,void t.push(r);case qo.TYPE_CONSTANT:let o=e.find((e=>e.identifier==r?.identifier));return o||Ia(Ba.Fail,"OperateParamCount: identifier invalid "+r.type),r.ret_type=o?.type,void t.push(r)}Ia(Ba.Fail,"OperateParamCount: type invalid "+r.type)},gu.Create=async(e,t)=>{if(!To(e,oo))return void(t&&t(void 0));let r=Ma(e);if(!t){const t=await $o.Instance().query_raw(r);return du.Parse_Guard_Helper(e,t)}$o.Instance().query_raw(r).then((r=>{t(du.Parse_Guard_Helper(e,r))})).catch((e=>{console.log(e),t(void 0)}))},gu.parse_constant=e=>{let t=[];return e.forEach((e=>{let r=e?.fields??e;const s=Uint8Array.from(r.value),i=s.slice(0,1)[0];if(r.bWitness)t.push({identifier:r.identifier,type:i,bWitness:r.bWitness,value:void 0});else{var n=s.slice(1);switch(i){case Yo.TYPE_ADDRESS:n="0x"+za.getInstance().de(Yo.TYPE_ADDRESS,Uint8Array.from(n)).toString();break;case Yo.TYPE_BOOL:case Yo.TYPE_U8:case Yo.TYPE_U64:case Yo.TYPE_U128:case Yo.TYPE_U256:case Yo.TYPE_VEC_U8:case Yo.TYPE_VEC_U64:case Yo.TYPE_VEC_U128:case Yo.TYPE_VEC_ADDRESS:case Yo.TYPE_VEC_BOOL:case Yo.TYPE_VEC_VEC_U8:case Yo.TYPE_OPTION_ADDRESS:case Yo.TYPE_OPTION_BOOL:case Yo.TYPE_OPTION_U128:case Yo.TYPE_OPTION_U8:case Yo.TYPE_OPTION_U64:case Yo.TYPE_OPTION_U256:case Yo.TYPE_VEC_U256:case Yo.TYPE_STRING:case Yo.TYPE_OPTION_STRING:case Yo.TYPE_OPTION_VEC_U8:case Yo.TYPE_VEC_STRING:Lo.find((e=>e.type==i))||Ia(Ba.Fail,"GuardObject de error"),n=za.getInstance().de(i,Uint8Array.from(n));break;default:Ia(Ba.Fail,"GuardObject constant type invalid:"+i)}t.push({identifier:r.identifier,type:i,bWitness:r.bWitness,value:n})}})),t},gu.parse_bcs=(e,t)=>{let r=Uint8Array.from(t),s=[].slice.call(r.reverse()),i=[];for(;s.length>0;){let t,r,n,a=s.shift();switch(a){case qo.TYPE_SIGNER:case qo.TYPE_CLOCK:case qo.TYPE_GUARD:case ko.TYPE_LOGIC_NOT:case ko.TYPE_NUMBER_ADDRESS:break;case ko.TYPE_LOGIC_AS_U256_GREATER:case ko.TYPE_LOGIC_AS_U256_GREATER_EQUAL:case ko.TYPE_LOGIC_AS_U256_LESSER:case ko.TYPE_LOGIC_AS_U256_LESSER_EQUAL:case ko.TYPE_LOGIC_AS_U256_EQUAL:case ko.TYPE_LOGIC_EQUAL:case ko.TYPE_LOGIC_HAS_SUBSTRING:case ko.TYPE_NUMBER_ADD:case ko.TYPE_NUMBER_DEVIDE:case ko.TYPE_NUMBER_MOD:case ko.TYPE_NUMBER_MULTIPLY:case ko.TYPE_NUMBER_SUBTRACT:case ko.TYPE_LOGIC_AND:case ko.TYPE_LOGIC_OR:t=s.shift();break;case qo.TYPE_CONSTANT:n=s.shift();break;case Yo.TYPE_ADDRESS:t="0x"+za.getInstance().de(Yo.TYPE_ADDRESS,Uint8Array.from(s)).toString(),s.splice(0,32);break;case Yo.TYPE_BOOL:case Yo.TYPE_U8:t=za.getInstance().de(a,Uint8Array.from(s)),s.shift();break;case Yo.TYPE_U64:t=za.getInstance().de(a,Uint8Array.from(s)),s.splice(0,8);break;case Yo.TYPE_U128:t=za.getInstance().de(a,Uint8Array.from(s)),s.splice(0,16);break;case Yo.TYPE_U256:t=za.getInstance().de(a,Uint8Array.from(s)),s.splice(0,32);break;case Yo.TYPE_VEC_U8:case Yo.TYPE_VEC_BOOL:case Yo.TYPE_STRING:let i=Da(Uint8Array.from(s));t=za.getInstance().de(a,Uint8Array.from(s)),s.splice(0,i.value+i.length);break;case Yo.TYPE_VEC_ADDRESS:i=Da(Uint8Array.from(s)),t=za.getInstance().de(a,Uint8Array.from(s)),s.splice(0,32*i.value+i.length);break;case Yo.TYPE_VEC_U128:i=Da(Uint8Array.from(s)),t=za.getInstance().de(a,Uint8Array.from(s)),s.splice(0,16*i.value+i.length);break;case Yo.TYPE_VEC_U256:i=Da(Uint8Array.from(s)),t=za.getInstance().de(a,Uint8Array.from(s)),s.splice(0,32*i.value+i.length);break;case Yo.TYPE_VEC_U64:i=Da(Uint8Array.from(s)),t=za.getInstance().de(a,Uint8Array.from(s)),s.splice(0,8*i.value+i.length);break;case Yo.TYPE_VEC_VEC_U8:case Yo.TYPE_VEC_STRING:i=Da(Uint8Array.from(s)),s.splice(0,i.length);let o=[];for(let e=0;e<i.value;e++){let e=Da(Uint8Array.from(s));o.push(za.getInstance().de(Yo.TYPE_VEC_U8,Uint8Array.from(s))),s.splice(0,e.length+e.value)}t=o;break;case ko.TYPE_QUERY:let u=s.splice(0,1);if(u[0]==Yo.TYPE_ADDRESS){let e="0x"+za.getInstance().de(Yo.TYPE_ADDRESS,Uint8Array.from(s)).toString();s.splice(0,32),t=e,r=za.getInstance().de("u16",Uint8Array.from(s.splice(0,2)))}else if(u[0]==qo.TYPE_CONSTANT){let t=s.splice(0,1);e.find((e=>e.identifier==t[0]&&e.type==Yo.TYPE_ADDRESS))||Ia(Ba.Fail,"GuardObject: indentifier not in constant"),n=t[0],r=za.getInstance().de("u16",Uint8Array.from(s.splice(0,2)))}else Ia(Ba.Fail,"GuardObject: constant type invalid");break;case Yo.TYPE_OPTION_ADDRESS:let c=Ua(s,Yo.TYPE_ADDRESS);t=c.value,c.bNone||s.splice(0,32);break;case Yo.TYPE_OPTION_BOOL:c=Ua(s,Yo.TYPE_BOOL),t=c.value,c.bNone||s.splice(0,1);break;case Yo.TYPE_OPTION_U8:c=Ua(s,Yo.TYPE_U8),t=c.value,c.bNone||s.splice(0,1);break;case Yo.TYPE_OPTION_U128:c=Ua(s,Yo.TYPE_U128),t=c.value,c.bNone||s.splice(0,16);break;case Yo.TYPE_OPTION_U256:c=Ua(s,Yo.TYPE_U256),t=c.value,c.bNone||s.splice(0,32);break;case Yo.TYPE_OPTION_U64:c=Ua(s,Yo.TYPE_U64),t=c.value,c.bNone||s.splice(0,8);break;case Yo.TYPE_OPTION_STRING:c=Ya(s),t=c.value;break;default:Ia(Ba.Fail,"GuardObject: parse_bcs types "+a)}i.push({type:a,value:t,cmd:r,identifier:n})}return i};class yu{get_object(){return this.passport}constructor(e,t){this.query_result_async=async e=>{this.txb.moveCall({target:$o.Instance().passportFn("query_result"),arguments:[this.passport]});const t=await $o.Client().devInspectTransactionBlock({sender:e,transactionBlock:this.txb});return yu.ResolveQueryRes(this.txb,t)},(0===t.info.length||t.info.length>yu.MAX_GUARD_COUNT)&&Ia(Ba.InvalidParam,"guards"),this.txb=e,this.passport=this.txb.moveCall({target:$o.Instance().passportFn("new"),arguments:[]}),t.info.forEach((t=>{const r=t.constant.filter((e=>e.bWitness)).map((e=>e.identifier)),s=t.constant.filter((e=>e.bWitness)).map((e=>{const t=za.getInstance().ser(e.type,e.value);let r=new Uint8Array(t.length+1);return r.set([e.type],0),r.set(t,1),[].slice.call(r)})),i=void 0!==t.version&&void 0!==t.digest?e.objectRef({objectId:t.id,version:t.version,digest:t.digest}):e.object(t.id);this.txb.moveCall({target:$o.Instance().passportFn("guard_add"),arguments:[this.passport,i,this.txb.pure.vector("u8",[].slice.call(r)),this.txb.pure(za.getInstance().ser("vector<vector<u8>>",[...s]))]})}));const r=this.txb.sharedObjectRef($o.CLOCK_OBJECT);t?.query.forEach((e=>{this.txb.moveCall({target:$o.Instance().passportFn("passport_verify"),arguments:[this.passport,this.txb.object(r)]}),this.txb.moveCall({target:e.target,arguments:[this.txb.object(e.id),this.passport],typeArguments:e.types})})),this.txb.moveCall({target:$o.Instance().passportFn("passport_verify"),arguments:[this.passport,this.txb.object(r)]})}destroy(){this.txb.moveCall({target:$o.Instance().passportFn("destroy"),arguments:[this.passport]})}freeze(){this.txb.moveCall({target:$o.Instance().passportFn("freezen"),arguments:[this.passport]})}query_result(e,t){this.txb.moveCall({target:$o.Instance().passportFn("query_result"),arguments:[this.passport]}),$o.Client().devInspectTransactionBlock({sender:e,transactionBlock:this.txb}).then((e=>{const r=yu.ResolveQueryRes(this.txb,e);r&&t(r)})).catch((e=>{console.log(e)}))}static ResolveQueryRes(e,t){for(let r=0;r<t.results?.length;++r){const s=t.results[r];if(s?.returnValues&&2===s.returnValues.length&&"bool"===s.returnValues[0][1]&&"vector<address>"===s.returnValues[1][1])return{txb:e,result:za.getInstance().de("bool",Uint8Array.from(s.returnValues[0][0])),guards:za.getInstance().de("vector<address>",Uint8Array.from(s.returnValues[1][0])).map((e=>"0x"+e))}}}}yu.MAX_GUARD_COUNT=8,function(e){e[e.ratio=0]="ratio",e[e.minus=1]="minus"}(hu||(hu={})),function(e){e.address="address",e.phone="phone",e.name="name",e.postcode="postcode"}(pu||(pu={}));class fu{get_pay_type(){return this.pay_token_type}get_object(){return this.object}constructor(e,t,r){this.pay_token_type=t,this.txb=e,this.permission=r,this.object=""}static From(e,t,r,s){let i=new fu(e,t,r);return i.object=$o.TXB_OBJECT(e,s),i}static New(e,t,r,s,i,n){$o.IsValidObjects([r,i])||Ia(Ba.IsValidObjects),bo(t)||Ia(Ba.IsValidTokenType,"New: pay_token_type"),so(s)||Ia(Ba.IsValidDesription);let a=t,o=new fu(e,a,r);return o.object=n?e.moveCall({target:$o.Instance().serviceFn("new_with_passport"),arguments:[n,e.pure.string(s),e.object(i),$o.TXB_OBJECT(e,r)],typeArguments:[a]}):e.moveCall({target:$o.Instance().serviceFn("new"),arguments:[e.pure.string(s),e.object(i),$o.TXB_OBJECT(e,r)],typeArguments:[a]}),o}launch(){return this.txb.moveCall({target:$o.Instance().serviceFn("create"),arguments:[$o.TXB_OBJECT(this.txb,this.object)],typeArguments:[this.pay_token_type]})}set_description(e,t){so(e)||Ia(Ba.IsValidDesription),t?this.txb.moveCall({target:$o.Instance().serviceFn("description_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("description_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_price(e,t,r=!0,s){lo(t)||Ia(Ba.IsValidU64,"set_price price"),fu.IsValidItemName(e)||Ia(Ba.IsValidServiceItemName,"set_price item"),s?this.txb.moveCall({target:$o.Instance().serviceFn("price_set_with_passport"),arguments:[s,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.u64(t),this.txb.pure.bool(r),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("price_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.u64(t),this.txb.pure.bool(r),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_stock(e,t,r=!0,s){fu.IsValidItemName(e)||Ia(Ba.IsValidServiceItemName,"item"),lo(t)||Ia(Ba.IsValidU64,"stock"),s?this.txb.moveCall({target:$o.Instance().serviceFn("stock_set_with_passport"),arguments:[s,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.u64(t),this.txb.pure.bool(r),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("stock_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.u64(t),this.txb.pure.bool(r),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}add_stock(e,t,r=!0,s){fu.IsValidItemName(e)||Ia(Ba.IsValidServiceItemName,"add_stock item"),lo(t)||Ia(Ba.IsValidUint,"add_stock stock_add"),s?this.txb.moveCall({target:$o.Instance().serviceFn("stock_add_with_passport"),arguments:[s,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.u64(t),this.txb.pure.bool(r),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("stock_add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.u64(t),this.txb.pure.bool(r),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}reduce_stock(e,t,r=!0,s){fu.IsValidItemName(e)||Ia(Ba.IsValidServiceItemName,"reduce_stock item"),lo(t)||Ia(Ba.IsValidUint,"reduce_stock stock_reduce"),s?this.txb.moveCall({target:$o.Instance().serviceFn("stock_reduce_with_passport"),arguments:[s,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.u64(t),this.txb.pure.bool(r),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("stock_reduce"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.pure.u64(t),this.txb.pure.bool(r),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_sale_endpoint(e,t,r=!0,s){fu.IsValidItemName(e)||Ia(Ba.IsValidServiceItemName,"set_sale_endpoint item"),t&&!ao(t)&&Ia(Ba.IsValidEndpoint,"set_sale_endpoint endpoint");let i=this.txb.pure.option("string",t||void 0);s?this.txb.moveCall({target:$o.Instance().serviceFn("sale_endpoint_set_with_passport"),arguments:[s,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),i,this.txb.pure.bool(r),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("sale_endpoint_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),i,this.txb.pure.bool(r),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_payee(e,t){$o.IsValidObjects([e])||Ia(Ba.IsValidObjects,"set_payee"),t?this.txb.moveCall({target:$o.Instance().serviceFn("payee_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("payee_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}add_repository(e,t){$o.IsValidObjects([e])||Ia(Ba.IsValidObjects,"repository_add"),t?this.txb.moveCall({target:$o.Instance().serviceFn("repository_add_with_passport"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("repository_add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}remove_repository(e,t,r){(t||0!==e.length)&&(To(e,oo)||Ia(Ba.IsValidArray,"repository_address"),r?t?this.txb.moveCall({target:$o.Instance().serviceFn("repository_remove_all_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("repository_remove_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):t?this.txb.moveCall({target:$o.Instance().serviceFn("repository_remove_all"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("repository_remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}))}add_arbitration(e,t,r){$o.IsValidObjects([e])||Ia(Ba.IsValidObjects,"add_arbitration.arbitraion"),bo(t)||Ia(Ba.IsValidTokenType,"add_arbitration.arbitraion_token_type"),r?this.txb.moveCall({target:$o.Instance().serviceFn("arbitration_add_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type,t]}):this.txb.moveCall({target:$o.Instance().serviceFn("arbitration_add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type,t]})}remove_arbitration(e,t,r){(t||0!==e.length)&&(To(e,oo)||Ia(Ba.IsValidArray,"remove_arbitration.address"),r?t?this.txb.moveCall({target:$o.Instance().serviceFn("arbitration_remove_all_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("arbitration_remove_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):t?this.txb.moveCall({target:$o.Instance().serviceFn("arbitration_remove_all"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("arbitration_remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}))}add_withdraw_guards(e,t){if(0===e.length)return;let r=!0;e.forEach((e=>{$o.IsValidObjects([e.guard])||(r=!1),fo(e.percent)||(r=!1)})),r||Ia(Ba.InvalidParam,"guards"),e.forEach((e=>{t?this.txb.moveCall({target:$o.Instance().serviceFn("withdraw_guard_add_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e.guard),this.txb.pure.u8(e.percent),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("withdraw_guard_add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e.guard),this.txb.pure.u8(e.percent),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}))}remove_withdraw_guards(e,t,r){(t||0!==e.length)&&(To(e,oo)||Ia(Ba.IsValidArray,"guard_address"),r?t?this.txb.moveCall({target:$o.Instance().serviceFn("withdraw_guard_remove_all_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("withdraw_guard_remove_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):t?this.txb.moveCall({target:$o.Instance().serviceFn("withdraw_guard_remove_all"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("withdraw_guard_remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}))}add_refund_guards(e,t){if(0===e.length)return;let r=!0;e.forEach((e=>{$o.IsValidObjects([e.guard])||(r=!1),fo(e.percent)||(r=!1)})),r||Ia(Ba.InvalidParam,"guards"),e.forEach((e=>{t?this.txb.moveCall({target:$o.Instance().serviceFn("refund_guard_add_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e.guard),this.txb.pure.u8(e.percent),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("refund_guard_add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e.guard),this.txb.pure.u8(e.percent),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}))}remove_refund_guards(e,t,r){(0!==e.length||t)&&(To(e,oo)||Ia(Ba.InvalidParam,"guard_address"),r?t?this.txb.moveCall({target:$o.Instance().serviceFn("refund_guard_remove_all_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("refund_guard_remove_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):t?this.txb.moveCall({target:$o.Instance().serviceFn("refund_guard_remove_all"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("refund_guard_remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}))}is_valid_sale(e){let t=!0,r=[];return e.forEach((e=>{fu.IsValidItemName(e.item)||(t=!1),lo(e.price)||(t=!1),lo(e.stock)||(t=!1),r.includes(e.item)&&(t=!1),r.push(e.item)})),t}add_sales(e,t=!1,r){if(0===e.length)return;this.is_valid_sale(e)||Ia(Ba.InvalidParam,"add_sales");let s=[],i=[],n=[],a=[];e.forEach((e=>{e.endpoint&&!ao(e.endpoint)&&Ia(Ba.IsValidEndpoint,"add_sales"),s.push(e.item),i.push(e.price),n.push(e.stock),a.push(e.endpoint??"")})),r?this.txb.moveCall({target:$o.Instance().serviceFn("sales_add_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",s),this.txb.pure.vector("string",a),this.txb.pure.vector("u64",i),this.txb.pure.vector("u64",n),this.txb.pure.bool(t),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("sales_add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",s),this.txb.pure.vector("string",a),this.txb.pure.vector("u64",i),this.txb.pure.vector("u64",n),this.txb.pure.bool(t),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}remove_sales(e,t){0!==e.length&&(To(e,fu.IsValidItemName)||Ia(Ba.IsValidArray,"remove_sales"),t?this.txb.moveCall({target:$o.Instance().serviceFn("sales_remove_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("sales_remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",Ma(e)),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}))}discount_transfer(e,t){(!e||e.length>fu.MAX_DISCOUNT_RECEIVER_COUNT)&&Ia(Ba.InvalidParam,"discount_dispatch");let r=!0;e.forEach((e=>{oo(e.receiver)||(r=!1),(!lo(e.count)||e.count>fu.MAX_DISCOUNT_COUNT_ONCE)&&(r=!1),no(e.discount.name)||(r=!1),e.discount.type!=hu.ratio||fo(e.discount.off)||(r=!1),lo(e.discount.duration_minutes)||(r=!1),e.discount?.time_start&&!lo(e.discount.time_start)&&(r=!1),e.discount?.price_greater&&!lo(e.discount.price_greater)&&(r=!1)})),r||Ia(Ba.InvalidParam,"discount_dispatch");const s=this.txb.sharedObjectRef($o.CLOCK_OBJECT);e.forEach((e=>{let r=this.txb.pure.option("u64",e.discount?.price_greater?e.discount?.price_greater:void 0),i=this.txb.pure.option("u64",e.discount?.time_start?e.discount?.time_start:void 0);t?this.txb.moveCall({target:$o.Instance().serviceFn("dicscount_create_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e.discount.name),this.txb.pure.u8(e.discount.type),this.txb.pure.u64(e.discount.off),r,i,this.txb.pure.u64(e.discount.duration_minutes),this.txb.pure.u64(e.count),$o.TXB_OBJECT(this.txb,this.permission),this.txb.pure.address(e.receiver),this.txb.object(s)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("dicscount_create"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e.discount.name),this.txb.pure.u8(e.discount.type),this.txb.pure.u64(e.discount.off),r,i,this.txb.pure.u64(e.discount.duration_minutes),this.txb.pure.u64(e.count),$o.TXB_OBJECT(this.txb,this.permission),this.txb.pure.address(e.receiver),this.txb.object(s)],typeArguments:[this.pay_token_type]})}))}withdraw(e,t,r){$o.IsValidObjects([e,t.treasury,t.withdraw_guard,r])||Ia(Ba.IsValidObjects),t?.for_guard&&!$o.IsValidObjects([t.for_guard])&&Ia(Ba.IsValidObjects,"withdraw.param.for_guard"),t?.for_object&&!oo(t.for_object)&&Ia(Ba.IsValidAddress,"withdraw.param.for_object"),lo(t.index)||Ia(Ba.IsValidU64,"withdraw.param.index"),so(t.remark)||Ia(Ba.IsValidDesription,"withdraw.param.remark");const s=this.txb.pure.option("address",t.for_object?t.for_object:void 0),i=this.txb.sharedObjectRef($o.CLOCK_OBJECT);return t.for_guard?this.txb.moveCall({target:$o.Instance().serviceFn("withdraw_forGuard_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),this.txb.object(t.withdraw_guard),this.txb.object(t.treasury),s,this.txb.object(t.for_guard),this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),this.txb.object(i),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("withdraw_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),this.txb.object(t.withdraw_guard),this.txb.object(t.treasury),s,this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),this.txb.object(i),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_buy_guard(e,t){t?e?this.txb.moveCall({target:$o.Instance().serviceFn("buy_guard_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("buy_guard_none_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):e?this.txb.moveCall({target:$o.Instance().serviceFn("buy_guard_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("buy_guard_none"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_machine(e,t){t?e?this.txb.moveCall({target:$o.Instance().serviceFn("machine_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("machine_none_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):e?this.txb.moveCall({target:$o.Instance().serviceFn("machine_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("machine_none"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_endpoint(e,t){e&&!ao(e)&&Ia(Ba.IsValidEndpoint);let r=this.txb.pure.option("string",e||void 0);t?this.txb.moveCall({target:$o.Instance().serviceFn("endpoint_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),r,$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("endpoint_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),r,$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}publish(e){e?this.txb.moveCall({target:$o.Instance().serviceFn("publish_with_passport"),arguments:[e,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("publish"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}clone(e,t,r){let s;return s=r?this.txb.moveCall({target:$o.Instance().serviceFn("clone_withpassport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type,e||this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("clone"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type,e||this.pay_token_type]}),t?this.txb.moveCall({target:$o.Instance().serviceFn("create"),arguments:[$o.TXB_OBJECT(this.txb,s)],typeArguments:[e||this.pay_token_type]}):s}set_customer_required(e,t,r){t.length>0&&!e&&Ia(Ba.InvalidParam,"set_customer_required"),e.length>fu.MAX_PUBKEY_SIZE&&Ia(Ba.InvalidParam,"set_customer_required.pubkey"),t.length>fu.MAX_REQUIRES_COUNT&&Ia(Ba.InvalidParam,"set_customer_required.customer_required"),To(t,io)||Ia(Ba.IsValidArray,"set_customer_required.customer_required");let s=Ma(t);r?this.txb.moveCall({target:$o.Instance().serviceFn("required_set_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",s),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("required_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",s),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}remove_customer_required(e){e?this.txb.moveCall({target:$o.Instance().serviceFn("required_none_with_passport"),arguments:[e,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("required_none"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}change_required_pubkey(e,t){e||Ia(Ba.InvalidParam,"pubkey"),t?this.txb.moveCall({target:$o.Instance().serviceFn("required_pubkey_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("required_pubkey_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}pause(e,t){t?this.txb.moveCall({target:$o.Instance().serviceFn("pause_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.bool(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("pause"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.bool(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}refund_withArb(e,t,r){$o.IsValidObjects([e,t])||Ia(Ba.IsValidObjects,"refund_withArb.order or arb"),bo(r)||Ia(Ba.IsValidTokenType,"refund_withArb.arb_type");const s=this.txb.sharedObjectRef($o.CLOCK_OBJECT);this.txb.moveCall({target:$o.Instance().serviceFn("refund_with_arb"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),this.txb.object(t),this.txb.object(s)],typeArguments:[this.pay_token_type,r]})}refund(e,t,r){$o.IsValidObjects([e])||Ia(Ba.IsValidObjects,"refund.order"),t&&!$o.IsValidObjects([t])&&Ia(Ba.IsValidObjects,"refund.refund_guard"),r&&!t&&Ia(Ba.InvalidParam,"refund.passport need refund_guard");const s=this.txb.sharedObjectRef($o.CLOCK_OBJECT);r&&t?this.txb.moveCall({target:$o.Instance().serviceFn("refund_with_passport"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),this.txb.object(t),r,this.txb.object(s)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("refund"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e)],typeArguments:[this.pay_token_type]})}update_order_required_info(e,t){t.customer_pubkey&&($o.IsValidObjects([e])||Ia(Ba.IsValidObjects,"update_order_required_info.order"),this.txb.moveCall({target:$o.Instance().serviceFn("order_required_info_update"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),this.txb.pure.string(t.customer_pubkey),this.txb.pure.string(t.customer_info_crypt)],typeArguments:[this.pay_token_type]}))}order(e,t,r,s,i,n){0===e.length&&Ia(Ba.InvalidParam,"order.buy_items empty");let a=!0,o=[];e.forEach((e=>{fu.IsValidItemName(e.item)||(a=!1),lo(e.max_price)||(a=!1),lo(e.count)||(a=!1),o.includes(e.item)&&(a=!1),o.push(e.item)})),a||Ia(Ba.InvalidParam,"buy_items invalid");let u,c=[],d=[],h=[];e.forEach((e=>{c.push(e.item),d.push(BigInt(e.max_price)),h.push(BigInt(e.count))}));const p=this.txb.sharedObjectRef($o.CLOCK_OBJECT);u=n?r?this.txb.moveCall({target:$o.Instance().serviceFn("dicount_buy_with_passport"),arguments:[n,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",c),this.txb.pure.vector("u64",d),this.txb.pure.vector("u64",h),$o.TXB_OBJECT(this.txb,t),$o.TXB_OBJECT(this.txb,r),this.txb.object(p)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("buy_with_passport"),arguments:[n,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",c),this.txb.pure.vector("u64",d),this.txb.pure.vector("u64",h),$o.TXB_OBJECT(this.txb,t)],typeArguments:[this.pay_token_type]}):r?this.txb.moveCall({target:$o.Instance().serviceFn("disoucnt_buy"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",c),this.txb.pure.vector("u64",d),this.txb.pure.vector("u64",h),$o.TXB_OBJECT(this.txb,t),$o.TXB_OBJECT(this.txb,r),this.txb.object(p)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("buy"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("string",c),this.txb.pure.vector("u64",d),this.txb.pure.vector("u64",h),$o.TXB_OBJECT(this.txb,t)],typeArguments:[this.pay_token_type]}),i&&this.update_order_required_info(u,i);var l=void 0;return s&&(l=this.order_bind_machine(u,s)),{order:u,progress:l}}order_launch(e){var t;return e.progress&&(t=this.txb.moveCall({target:$o.Instance().progressFn("create"),arguments:[$o.TXB_OBJECT(this.txb,e.progress)]})),{order:this.txb.moveCall({target:$o.Instance().serviceFn("order_create"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e.order)],typeArguments:[this.pay_token_type]}),progress:t}}buy(e,t,r,s,i,n){const a=this.order(e,t,r,s,i,n);return this.order_launch(a)}order_bind_machine(e,t){return $o.IsValidObjects([e,t])||Ia(Ba.IsValidObjects,"order & machine"),this.txb.moveCall({target:$o.Instance().serviceFn("order_bind_machine"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e),$o.TXB_OBJECT(this.txb,t)],typeArguments:[this.pay_token_type]})}add_treasury(e,t,r){$o.IsValidObjects([t])||Ia(Ba.IsValidObjects,"add_treasury.treasury"),bo(e)||Ia(Ba.IsValidTokenType,"add_treasury.treasury_token_type"),r?this.txb.moveCall({target:$o.Instance().serviceFn("treasury_add_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.object(t),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type,e]}):this.txb.moveCall({target:$o.Instance().serviceFn("treasury_add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.object(t),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type,e]})}remove_treasury(e,t,r){(t||0!==e.length)&&(r?t?this.txb.moveCall({target:$o.Instance().serviceFn("treasury_remove_all_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("treasury_remove_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):t?this.txb.moveCall({target:$o.Instance().serviceFn("treasury_remove_all"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().serviceFn("treasury_remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}))}change_permission(e){$o.IsValidObjects([e])||Ia(Ba.IsValidObjects),this.txb.moveCall({target:$o.Instance().serviceFn("permission_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission),$o.TXB_OBJECT(this.txb,e)],typeArguments:[this.pay_token_type]}),this.permission=e}set_order_agent(e,t,r){fu.SetOrderAgent(this.txb,this.pay_token_type,e,t,r)}change_order_payer(e,t,r){fu.ChangeOrderPayer(this.txb,this.pay_token_type,e,t,r)}static IsValidItemName(e){return!!e&&(new TextEncoder).encode(e).length<=fu.MAX_ITEM_NAME_LENGTH}}fu.MAX_DISCOUNT_COUNT_ONCE=200,fu.MAX_DISCOUNT_RECEIVER_COUNT=20,fu.MAX_GUARD_COUNT=16,fu.MAX_REPOSITORY_COUNT=32,fu.MAX_ITEM_NAME_LENGTH=256,fu.MAX_TREASURY_COUNT=8,fu.MAX_ORDER_AGENT_COUNT=8,fu.MAX_ORDER_ARBS_COUNT=8,fu.MAX_ARBITRATION_COUNT=8,fu.MAX_REQUIRES_COUNT=16,fu.MAX_PUBKEY_SIZE=3e3,fu.parseObjectType=e=>qa(e,"service::Service<"),fu.parseOrderObjectType=e=>qa(e,"order::Order<"),fu.endpoint=(e,t,r)=>t||(e?e+"/sales/"+encodeURI(r):void 0),fu.DiscountObjects=(e,t)=>{$o.Client().getOwnedObjects({owner:e,filter:{MoveModule:{module:"order",package:$o.Instance().package("wowok")}},options:{showContent:!0,showType:!0}}).then((r=>{t(e,r.data.map((e=>e.data)))})).catch((e=>{console.log(e)}))},fu.SetOrderAgent=(e,t,r,s,i)=>{bo(t)||Ia(Ba.IsValidTokenType,"SetOrderAgent.order_token_type"),$o.IsValidObjects([r])||Ia(Ba.IsValidObjects,"SetOrderAgent.order"),To(s,oo)||Ia(Ba.IsValidArray,"SetOrderAgent.agent"),Ma(s).length>fu.MAX_ORDER_AGENT_COUNT&&Ia(Ba.Fail,"SetOrderAgent.agent count"),e.moveCall({target:$o.Instance().orderFn("agent_set"),arguments:[e.object(r),e.pure.vector("address",Ma(s))],typeArguments:[t]}),i&&e.moveCall({target:$o.Instance().orderFn("order_ops_to_progress"),arguments:[e.object(r),e.object(i)],typeArguments:[t]})},fu.ChangeOrderPayer=(e,t,r,s,i)=>{bo(t)||Ia(Ba.IsValidTokenType,"ChangeOrderPayer.order_token_type"),$o.IsValidObjects([r])||Ia(Ba.IsValidObjects,"ChangeOrderPayer.order"),oo(s)||Ia(Ba.IsValidAddress,"ChangeOrderPayer.new_addr"),e.moveCall({target:$o.Instance().orderFn("payer_change"),arguments:[e.object(r),e.pure.address(s)],typeArguments:[t]}),i&&e.moveCall({target:$o.Instance().orderFn("order_ops_to_progress"),arguments:[e.object(r),e.object(i)],typeArguments:[t]})};class Tu{get_object(){return this.object}constructor(e){this.txb=e,this.object=""}static From(e){let t=new Tu(e);return t.object=$o.TXB_OBJECT(e,$o.Instance().objectEntity()),t}mark(e,t,r){"string"!=typeof t||oo(t)||Ia(Ba.IsValidAddress,r),this.txb.moveCall({target:$o.Instance().entityFn(r),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e.get_object()),"string"==typeof t?this.txb.pure.address(t):t]})}update(e){e?.name&&!io(e.name)&&Ia(Ba.IsValidName,"update"),e?.description&&!so(e.description)&&Ia(Ba.IsValidDesription,"update"),e?.avatar&&!Io(e.avatar)&&Ia(Ba.isValidHttpUrl,"update:avatar"),e?.twitter&&!io(e.twitter)&&Ia(Ba.IsValidName,"update:twitter"),e?.homepage&&!Io(e.homepage)&&Ia(Ba.isValidHttpUrl,"update:homepage"),e?.discord&&!io(e.discord)&&Ia(Ba.IsValidName,"update:discord");const t=za.getInstance().bcs.ser("PersonalInfo",{name:e.name?(new TextEncoder).encode(e.name):"",description:e?.description?(new TextEncoder).encode(e.description):"",avatar:e?.avatar??"",twitter:e?.twitter??"",discord:e?.discord??"",homepage:e?.homepage??""}).toBytes();this.txb.moveCall({target:$o.Instance().entityFn("avatar_update"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("u8",[].slice.call(t))]})}create_resource(){return this.txb.moveCall({target:$o.Instance().entityFn("resource_create"),arguments:[$o.TXB_OBJECT(this.txb,this.object)]})}create_resource2(){return this.txb.moveCall({target:$o.Instance().entityFn("resource_create2"),arguments:[$o.TXB_OBJECT(this.txb,this.object)]})}destroy_resource(e){return this.txb.moveCall({target:$o.Instance().entityFn("resource_destroy"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e.get_object())]})}use_resource(e){return this.txb.moveCall({target:$o.Instance().entityFn("resource_use"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e.get_object())]})}transfer_resource(e,t){return oo(t)||Ia(Ba.IsValidAddress,"transfer_resource"),this.txb.moveCall({target:$o.Instance().entityFn("resource_transfer"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e.get_object()),this.txb.pure.address(t)]})}query_ent(e){oo(e)||Ia(Ba.InvalidParam,"query_ent"),this.txb.moveCall({target:$o.Instance().entityFn("QueryEnt"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e)]})}}class Eu{get_object(){return this.object}constructor(e){this.txb=e,this.object=""}static From(e){let t=new Eu(e);return t.object=$o.TXB_OBJECT(e,$o.Instance().objectWowok()),t}register_grantor(e,t){io(e)||Ia(Ba.IsValidName,"register_grantor"),$o.IsValidObjects([t])||Ia(Ba.IsValidObjects,"register_grantor");const r=this.txb.sharedObjectRef($o.CLOCK_OBJECT);this.txb.moveCall({target:$o.Instance().wowokFn("grantor_register"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),this.txb.object(r),$o.TXB_OBJECT(this.txb,t)]})}grantor_time_expand_1year(e){oo(e)||Ia(Ba.IsValidAddress,"grantor_time_expand_1year"),this.txb.moveCall({target:$o.Instance().wowokFn("grantor_time_expand_1year"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.address(e)]})}grantor_rename(e){io(e)||Ia(Ba.IsValidName,"grantor_rename"),this.txb.moveCall({target:$o.Instance().wowokFn("grantor_time_expand_1year"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e)]})}mint(e,t){oo(t)||Ia(Ba.IsValidAddress,"mint"),lo(e)||Ia(Ba.IsValidU64,"mint"),this.txb.moveCall({target:$o.Instance().baseWowokFn("mint"),arguments:[$o.TXB_OBJECT(this.txb,$o.Instance().objectTreasuryCap()),this.txb.pure.u64(e),this.txb.pure.address(t)]})}oracle(e,t){return so(e)||Ia(Ba.IsValidDesription,"oracle.description"),$o.IsValidObjects([t])||Ia(Ba.IsValidObjects,"oracle.permission"),this.txb.moveCall({target:$o.Instance().wowokFn("oracle_repository"),arguments:[$o.TXB_OBJECT(this.txb,$o.Instance().objectOracle()),this.txb.pure.string(e),this.txb.object(t)]})}}!function(e){e.Like="like",e.Dislike="dislike",e.Launch="launch",e.Order="order",e.Payment="payment"}(lu||(lu={}));class vu{get_object(){return this.object}constructor(e){this.txb=e,this.object=""}static From(e,t){let r=new vu(e);return r.object=$o.TXB_OBJECT(e,t),r}launch(){return this.object||Ia(Ba.Fail,"launch object Invalid"),this.txb.moveCall({target:$o.Instance().resourceFn("create"),arguments:[$o.TXB_OBJECT(this.txb,this.object)]})}resolve_add(e,t){return t.find((e=>e===lu.Like))&&Tu.From(this.txb).mark(this,e,lu.Like),t.find((e=>e===lu.Dislike))&&Tu.From(this.txb).mark(this,e,lu.Dislike),t.filter((e=>e!==lu.Like&&e!==lu.Dislike&&io(e)))}add(e,t,r){"string"!=typeof e||oo(e)||Ia(Ba.IsValidAddress,"Resource: add.address");var s=this.resolve_add(e,t);(r||0!==s.length)&&(r&&!io(r)&&Ia(Ba.IsValidName,"Resource: add.name"),s.length>vu.MAX_TAG_COUNT_FOR_ADDRESS&&(s=s.slice(0,vu.MAX_TAG_COUNT_FOR_ADDRESS)),this.txb.moveCall({target:$o.Instance().resourceFn("add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),"string"==typeof e?this.txb.pure.address(e):e,this.txb.pure.option("string",r),this.txb.pure.vector("string",s)]}))}remove(e,t){"string"!=typeof e||oo(e)||Ia(Ba.IsValidAddress,"Resource: remove.address"),this.txb.moveCall({target:$o.Instance().resourceFn("remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),"string"==typeof e?this.txb.pure.address(e):e,this.txb.pure.vector("string",t)]})}removeall(e){"string"!=typeof e||oo(e)||Ia(Ba.IsValidAddress,"Resource: removeall.address"),this.txb.moveCall({target:$o.Instance().resourceFn("removeall"),arguments:[$o.TXB_OBJECT(this.txb,this.object),"string"==typeof e?this.txb.pure.address(e):e]})}static TagData(e,t=!0){const r=[];return e.forEach((e=>{e.tags.forEach((t=>{const s=r.find((e=>e.tag===t));s?s.address.find((t=>t===e.address))||s.address.push(e.address):r.push({tag:t,address:[e.address]})}))})),t&&Object.keys(lu).forEach((e=>{r.find((t=>t.tag===lu[e]))||r.push({tag:lu[e],address:[]})})),r}static Tags(e){const t=[];return e.address.forEach((r=>{const s=t.find((e=>e.address===r));s?s.tags.find((t=>t===e.tag))||s.tags.push(e.tag):t.push({address:r,tags:[e.tag]})})),t}}vu.MAX_ADDRESS_COUNT_FOR_TAG=1e3,vu.MAX_TAG_COUNT_FOR_ADDRESS=64,function(e){e[e.PERMISSION=0]="PERMISSION",e[e.GUARD_ONLY_AND_IMMUTABLE=1]="GUARD_ONLY_AND_IMMUTABLE",e[e.BOTH_PERMISSION_AND_GUARD=2]="BOTH_PERMISSION_AND_GUARD"}(mu||(mu={})),function(e){e[e.WITHDRAW=1]="WITHDRAW",e[e.DEPOSIT=2]="DEPOSIT",e[e.RECEIVE=4]="RECEIVE"}(_u||(_u={}));class xu{get_token_type(){return this.token_type}get_object(){return this.object}static From(e,t,r,s){let i=new xu(e,t,r);return i.object=$o.TXB_OBJECT(e,s),i}constructor(e,t,r){this.token_type=t,this.permission=r,this.txb=e,this.object=""}static New(e,t,r,s,i){$o.IsValidObjects([r])||Ia(Ba.IsValidObjects,"Treasury.New permission, bounty"),so(s)||Ia(Ba.IsValidDesription,"Treasury.New.description"),go(t)||Ia(Ba.IsValidArgType,t);let n=new xu(e,t,r);return n.object=i?e.moveCall({target:$o.Instance().treasuryFn("new_with_passport"),arguments:[i,e.pure.string(s),$o.TXB_OBJECT(e,r)],typeArguments:[t]}):e.moveCall({target:$o.Instance().treasuryFn("new"),arguments:[e.pure.string(s),$o.TXB_OBJECT(e,r)],typeArguments:[t]}),n}launch(){return this.txb.moveCall({target:$o.Instance().treasuryFn("create"),arguments:[$o.TXB_OBJECT(this.txb,this.object)],typeArguments:[this.token_type]})}set_deposit_guard(e,t){e&&!oo(e)&&Ia(Ba.IsValidAddress,"set_deposit_guard.guard"),t?e?this.txb.moveCall({target:$o.Instance().treasuryFn("deposit_guard_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:$o.Instance().treasuryFn("deposit_guard_none_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):e?this.txb.moveCall({target:$o.Instance().treasuryFn("deposit_guard_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:$o.Instance().treasuryFn("deposit_guard_none"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]})}deposit(e,t){$o.IsValidObjects([e.coin])||Ia(Ba.IsValidObjects,"deposit.param.coin"),so(e.remark)||Ia(Ba.IsValidDesription,"deposit.param.remark"),e?.for_object&&!oo(e.for_object)&&Ia(Ba.IsValidAddress,"deposit.param.for_object"),e?.for_guard&&!oo(e.for_guard)&&Ia(Ba.IsValidAddress,"deposit.param.for_guard"),void 0===e.index||lo(e.index)||Ia(Ba.InvalidParam,"deposit.param.index");const r=this.txb.pure.option("address",e.for_object?e.for_object:void 0),s=this.txb.sharedObjectRef($o.CLOCK_OBJECT);return t?e.for_guard?this.txb.moveCall({target:$o.Instance().treasuryFn("deposit_forGuard_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e.coin),this.txb.pure.u64(e.index),this.txb.pure.string(e.remark),r,this.txb.object(e.for_guard),this.txb.object(s),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:$o.Instance().treasuryFn("deposit_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e.coin),this.txb.pure.u64(e.index),this.txb.pure.string(e.remark),r,this.txb.object(s),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):e.for_guard?this.txb.moveCall({target:$o.Instance().treasuryFn("deposit_forGuard"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e.coin),this.txb.pure.u64(e.index),this.txb.pure.string(e.remark),r,this.txb.object(e.for_guard),this.txb.object(s),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:$o.Instance().treasuryFn("deposit"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,e.coin),this.txb.pure.u64(e.index),this.txb.pure.string(e.remark),r,this.txb.object(s),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]})}receive(e,t,r){$o.IsValidObjects([e,t])||Ia(Ba.IsValidArray,"receive.payment&received");const s=this.txb.sharedObjectRef($o.CLOCK_OBJECT);return r?this.txb.moveCall({target:$o.Instance().treasuryFn("receive_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.object(t),this.txb.object(e),this.txb.object(s),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:$o.Instance().treasuryFn("receive"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.object(t),this.txb.object(e),this.txb.object(s),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]})}withdraw(e,t){if(0===e.items.length)return;To(e.items,(e=>lo(e.amount)&&oo(e.address)))||Ia(Ba.IsValidArray,"withdraw.param.items"),so(e.remark)||Ia(Ba.IsValidDesription,"withdraw.param.remark"),lo(e.index)||Ia(Ba.IsValidU64,"withdraw.param.index"),e?.for_guard&&!oo(e.for_guard)&&Ia(Ba.IsValidAddress,"withdraw.param.for_guard"),e?.for_object&&!oo(e.for_object)&&Ia(Ba.IsValidAddress,"withdraw.param.for_object"),e?.withdraw_guard&&!oo(e.withdraw_guard)&&Ia(Ba.IsValidAddress,"withdraw.param.withdraw_guard"),e?.withdraw_guard&&!t&&Ia(Ba.IsValidAddress,"withdraw.param.withdraw_guard");const r=this.txb.pure.option("address",e.for_object?e.for_object:void 0),s=this.txb.sharedObjectRef($o.CLOCK_OBJECT);return e.withdraw_guard&&t?e.for_guard?this.txb.moveCall({target:$o.Instance().treasuryFn("withdraw_useGuard_forGuard"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",e.items.map((e=>e.address))),this.txb.pure.vector("u64",e.items.map((e=>e.amount))),this.txb.pure.u64(e.index),this.txb.pure.string(e.remark),r,this.txb.object(e.for_guard),this.txb.object(s),this.txb.object(e.withdraw_guard)],typeArguments:[this.token_type]}):this.txb.moveCall({target:$o.Instance().treasuryFn("withdraw_useGuard"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",e.items.map((e=>e.address))),this.txb.pure.vector("u64",e.items.map((e=>e.amount))),this.txb.pure.u64(e.index),this.txb.pure.string(e.remark),r,this.txb.object(s),this.txb.object(e.withdraw_guard)],typeArguments:[this.token_type]}):t?e.for_guard?this.txb.moveCall({target:$o.Instance().treasuryFn("withdraw_forGuard_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",e.items.map((e=>e.address))),this.txb.pure.vector("u64",e.items.map((e=>e.amount))),this.txb.pure.u64(e.index),this.txb.pure.string(e.remark),r,this.txb.object(e.for_guard),this.txb.object(s),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:$o.Instance().treasuryFn("withdraw_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",e.items.map((e=>e.address))),this.txb.pure.vector("u64",e.items.map((e=>e.amount))),this.txb.pure.u64(e.index),this.txb.pure.string(e.remark),r,this.txb.object(s),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):e.for_guard?this.txb.moveCall({target:$o.Instance().treasuryFn("withdraw_forGuard"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",e.items.map((e=>e.address))),this.txb.pure.vector("u64",e.items.map((e=>e.amount))),this.txb.pure.u64(e.index),this.txb.pure.string(e.remark),r,this.txb.object(e.for_guard),this.txb.object(s),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:$o.Instance().treasuryFn("withdraw"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",e.items.map((e=>e.address))),this.txb.pure.vector("u64",e.items.map((e=>e.amount))),this.txb.pure.u64(e.index),this.txb.pure.string(e.remark),r,this.txb.object(s),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]})}set_description(e,t){so(e)||Ia(Ba.IsValidDesription,"set_description.description"),t?this.txb.moveCall({target:$o.Instance().treasuryFn("description_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:$o.Instance().treasuryFn("description_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]})}set_withdraw_mode(e,t){t?this.txb.moveCall({target:$o.Instance().treasuryFn("withdraw_mode_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.u8(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:$o.Instance().treasuryFn("withdraw_mode_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.u8(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]})}add_withdraw_guard(e,t,r){oo(e)||Ia(Ba.IsValidAddress,"add_withdraw_guard.guard"),lo(t)||Ia(Ba.IsValidU64,"add_withdraw_guard.amount"),r?this.txb.moveCall({target:$o.Instance().treasuryFn("withdraw_guard_add_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e),this.txb.pure.u64(t),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:$o.Instance().treasuryFn("withdraw_guard_add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e),this.txb.pure.u64(t),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]})}remove_withdraw_guard(e,t,r){(0!==e.length||t)&&(To(e,oo)||Ia(Ba.IsValidArray,"add_withdraw_guard.guard"),r?t?this.txb.moveCall({target:$o.Instance().treasuryFn("withdraw_guard_remove_all_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:$o.Instance().treasuryFn("withdraw_guard_remove_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):t?this.txb.moveCall({target:$o.Instance().treasuryFn("withdraw_guard_remove_all"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}):this.txb.moveCall({target:$o.Instance().treasuryFn("withdraw_guard_remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.token_type]}))}change_permission(e){$o.IsValidObjects([e])||Ia(Ba.IsValidObjects,"change_permission.new_permission"),this.txb.moveCall({target:$o.Instance().treasuryFn("permission_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission),$o.TXB_OBJECT(this.txb,e)],typeArguments:[this.token_type]}),this.permission=e}}xu.parseObjectType=e=>qa(e,"treasury::Treasury<"),xu.MAX_WITHDRAW_GUARD_COUNT=16;const Ou=200;function wu(e,t,r){t||Ia(Ba.InvalidParam,"Payment.New.pay_token_type"),r.receiver.length>Ou&&Ia(Ba.InvalidParam,"Payment.New.param.receiver"),To(r.receiver,(e=>oo(e.address)&&$o.IsValidObjects([e.coin])))||Ia(Ba.IsValidArray,"Payment.New.param.receiver"),r?.for_object&&!oo(r.for_object)&&Ia(Ba.IsValidAddress,"Payment.New.param.for_object"),r?.for_guard&&!oo(r.for_guard)&&Ia(Ba.IsValidAddress,"Payment.New.param.for_guard"),r?.business_remark&&!so(r?.business_remark)&&Ia(Ba.IsValidDesription,"Payment.New.param.business_remark");let s=e.pure.option("address",r.for_object?r.for_object:void 0);const i=e.sharedObjectRef($o.CLOCK_OBJECT);return r.for_guard?e.moveCall({target:$o.Instance().paymentFn("create_withGuard"),arguments:[e.pure.vector("address",r.receiver.map((e=>e.address))),e.makeMoveVec({elements:r.receiver.map((e=>e.coin))}),s,e.object(r.for_guard),e.pure.u64(r.business_index),e.pure.string(r.business_remark),e.object(i)],typeArguments:[t]}):e.moveCall({target:$o.Instance().paymentFn("create"),arguments:[e.pure.vector("address",r.receiver.map((e=>e.address))),e.makeMoveVec({elements:r.receiver.map((e=>e.coin))}),s,e.pure.u64(r.business_index),e.pure.string(r.business_remark),e.object(i)],typeArguments:[t]})}class Bu{get_pay_type(){return this.pay_token_type}get_object(){return this.object}constructor(e,t,r){this.pay_token_type=t,this.txb=e,this.permission=r,this.object=""}static From(e,t,r,s){let i=new Bu(e,t,r);return i.object=$o.TXB_OBJECT(e,s),i}static New(e,t,r,s,i,n,a){$o.IsValidObjects([r,n])||Ia(Ba.IsValidObjects),bo(t)||Ia(Ba.IsValidTokenType,"New.token_type"),so(s)||Ia(Ba.IsValidDesription),lo(i)||Ia(Ba.IsValidU64,"New.fee");let o=t,u=new Bu(e,o,r);return u.object=a?e.moveCall({target:$o.Instance().arbitrationFn("new_with_passport"),arguments:[a,e.pure.string(s),e.pure.u64(i),e.object(n),$o.TXB_OBJECT(e,r)],typeArguments:[o]}):e.moveCall({target:$o.Instance().arbitrationFn("new"),arguments:[e.pure.string(s),e.pure.u64(i),e.object(n),$o.TXB_OBJECT(e,r)],typeArguments:[o]}),u}launch(){return this.txb.moveCall({target:$o.Instance().arbitrationFn("create"),arguments:[$o.TXB_OBJECT(this.txb,this.object)],typeArguments:[this.pay_token_type]})}set_description(e,t){so(e)||Ia(Ba.IsValidDesription,"set_description.description"),t?this.txb.moveCall({target:$o.Instance().arbitrationFn("description_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("description_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_fee(e,t){lo(e)||Ia(Ba.IsValidU64,"set_fee.fee"),t?this.txb.moveCall({target:$o.Instance().arbitrationFn("fee_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.u64(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("fee_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.u64(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_endpoint(e,t){e&&!ao(e)&&Ia(Ba.IsValidEndpoint,"set_endpoint.endpoint"),t?e?this.txb.moveCall({target:$o.Instance().arbitrationFn("endpoint_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("endpoint_none_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):e?this.txb.moveCall({target:$o.Instance().arbitrationFn("endpoint_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.string(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("endpoint_none"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}add_voting_guard(e,t){0!==e.length&&(To(e,(e=>$o.IsValidObjects([e.guard])&&lo(e.voting_weight)))||Ia(Ba.IsValidArray,"add_voting_guard.guard"),t?e.forEach((e=>{this.txb.moveCall({target:$o.Instance().arbitrationFn("voting_guard_add_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e.guard),this.txb.pure.u64(e.voting_weight),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})})):e.forEach((e=>{this.txb.moveCall({target:$o.Instance().arbitrationFn("voting_guard_add"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e.guard),this.txb.pure.u64(e.voting_weight),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})})))}remove_voting_guard(e,t,r){(t||0!==e.length)&&(To(e,oo)||Ia(Ba.IsValidArray,"remove_voting_guard.guard"),r?t?this.txb.moveCall({target:$o.Instance().arbitrationFn("voting_guard_removeall_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("voting_guard_remove_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):t?this.txb.moveCall({target:$o.Instance().arbitrationFn("voting_guard_removeall"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("voting_guard_remove"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.vector("address",e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}))}set_guard(e,t){e&&!oo(e)&&Ia(Ba.IsValidAddress,"set_guard.apply_guard"),t?e?this.txb.moveCall({target:$o.Instance().arbitrationFn("usage_guard_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("usage_guard_none_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):e?this.txb.moveCall({target:$o.Instance().arbitrationFn("usage_guard_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("usage_guard_none"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}pause(e,t){t?this.txb.moveCall({target:$o.Instance().arbitrationFn("pause_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.bool(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("pause"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.pure.bool(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}vote(e,t){e.voting_guard&&!$o.IsValidObjects([e.voting_guard])&&Ia(Ba.IsValidObjects,"vote.param.voting_guard"),To(e.agrees,(e=>lo(e)&&e<Bu.MAX_PROPOSITION_COUNT))||Ia(Ba.IsValidArray,"vote.param.agrees"),$o.IsValidObjects([e.arb])||Ia(Ba.IsValidObjects,"vote.param.arb");const r=this.txb.sharedObjectRef($o.CLOCK_OBJECT);t?e.voting_guard?this.txb.moveCall({target:$o.Instance().arbitrationFn("vote_with_passport"),arguments:[t,this.txb.object(e.voting_guard),$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e.arb),this.txb.pure.vector("u8",e.agrees),this.txb.object(r),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("vote2_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e.arb),this.txb.pure.vector("u8",e.agrees),this.txb.object(r),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("vote"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e.arb),this.txb.pure.vector("u8",e.agrees),this.txb.object(r),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}arbitration(e,t){so(e.feedback)||Ia(Ba.IsValidDesription,"arbitration.param.feedback"),$o.IsValidObjects([e.arb])||Ia(Ba.IsValidObjects,"arbitration.param.arb"),e.indemnity&&!lo(e.indemnity)&&Ia(Ba.IsValidU64,"arbitration.param.indemnity");let r=this.txb.pure.option("u64",e.indemnity?e.indemnity:void 0);t?this.txb.moveCall({target:$o.Instance().arbitrationFn("arbitration_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e.arb),this.txb.pure.string(e.feedback),r,$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("arbitration"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e.arb),this.txb.pure.string(e.feedback),r,$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}withdraw_fee(e,t,r){$o.IsValidObjects([e,t.treasury])||Ia(Ba.IsValidObjects,"withdraw_fee.arb or treasury"),t?.for_guard&&!$o.IsValidObjects([t.for_guard])&&Ia(Ba.IsValidObjects,"withdraw_fee.param.for_guard"),t?.for_object&&!oo(t.for_object)&&Ia(Ba.IsValidAddress,"withdraw_fee.param.for_object"),so(t.remark)||Ia(Ba.IsValidDesription,"withdraw_fee.param.remark"),lo(t.index)||Ia(Ba.IsValidU64,"withdraw_fee.param.index");const s=this.txb.pure.option("address",t.for_object?t.for_object:void 0),i=this.txb.sharedObjectRef($o.CLOCK_OBJECT);return r?t.for_guard?this.txb.moveCall({target:$o.Instance().arbitrationFn("withdraw_forGuard_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e),this.txb.object(t.treasury),s,this.txb.object(t.for_guard),this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),this.txb.object(i),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("withdraw_with_passport"),arguments:[r,$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e),this.txb.object(t.treasury),s,this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),this.txb.object(i),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):t.for_guard?this.txb.moveCall({target:$o.Instance().arbitrationFn("withdraw_forGuard"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e),this.txb.object(t.treasury),s,this.txb.object(t.for_guard),this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),this.txb.object(i),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("withdraw"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e),this.txb.object(t.treasury),s,this.txb.pure.u64(t.index),this.txb.pure.string(t.remark),this.txb.object(i),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}set_withdrawTreasury(e,t){$o.IsValidObjects([e])||Ia(Ba.IsValidObjects,"set_withdrawTreasury.treasury"),t?this.txb.moveCall({target:$o.Instance().arbitrationFn("withdraw_treasury_set_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("withdraw_treasury_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e),$o.TXB_OBJECT(this.txb,this.permission)],typeArguments:[this.pay_token_type]})}arb(e,t){return $o.IsValidObjects([e.order])||Ia(Ba.IsValidObjects,"arb.param.order"),bo(e.order_token_type)||Ia(Ba.IsValidTokenType,"arb.param.order_token_type"),so(e.description)||Ia(Ba.IsValidDesription,"arb.param.description"),To(e.votable_proposition,io)||Ia(Ba.IsValidArray,"arb.param.votable_proposition"),t?e.fee?this.txb.moveCall({target:$o.Instance().arbitrationFn("dispute_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e.order),this.txb.pure.string(e.description),this.txb.pure.vector("string",Ma(e.votable_proposition)),this.txb.object(e.fee)],typeArguments:[this.pay_token_type,e.order_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("free_dispute_with_passport"),arguments:[t,$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e.order),this.txb.pure.string(e.description),this.txb.pure.vector("string",Ma(e.votable_proposition))],typeArguments:[this.pay_token_type,e.order_token_type]}):e.fee?this.txb.moveCall({target:$o.Instance().arbitrationFn("dispute"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e.order),this.txb.pure.string(e.description),this.txb.pure.vector("string",Ma(e.votable_proposition)),this.txb.object(e.fee)],typeArguments:[this.pay_token_type,e.order_token_type]}):this.txb.moveCall({target:$o.Instance().arbitrationFn("free_dispute"),arguments:[$o.TXB_OBJECT(this.txb,this.object),this.txb.object(e.order),this.txb.pure.string(e.description),this.txb.pure.vector("string",Ma(e.votable_proposition))],typeArguments:[this.pay_token_type,e.order_token_type]})}arb_launch(e){return this.txb.moveCall({target:$o.Instance().arbFn("create"),arguments:[$o.TXB_OBJECT(this.txb,e)],typeArguments:[this.pay_token_type]})}dispute(e,t){const r=this.arb(e,t);return this.arb_launch(r)}change_permission(e){$o.IsValidObjects([e])||Ia(Ba.IsValidObjects),this.txb.moveCall({target:$o.Instance().arbitrationFn("permission_set"),arguments:[$o.TXB_OBJECT(this.txb,this.object),$o.TXB_OBJECT(this.txb,this.permission),$o.TXB_OBJECT(this.txb,e)],typeArguments:[this.pay_token_type]}),this.permission=e}}Bu.parseObjectType=e=>qa(e,"arbitration::Arbitration<"),Bu.parseArbObjectType=e=>qa(e,"arb::Arb<"),Bu.queryArbVoted=()=>{},Bu.MAX_PROPOSITION_COUNT=16,Bu.MAX_VOTING_GUARD_COUNT=16;class Iu extends Error{}async function Cu({host:e,path:t,body:r,headers:s,method:i}){const n=new URL(t,e).toString(),a=await fetch(n,{method:i,body:r?JSON.stringify(r):void 0,headers:{"Content-Type":"application/json",...s||{}}});if(429===a.status)throw new Iu("Too many requests from this client have been sent to the faucet. Please retry later");try{const e=await a.json();if(e.error)throw new Error(`Faucet returns error: ${e.error}`);return e}catch(e){throw new Error(`Encountered error when parsing response from faucet, error: ${e}, status ${a.status}, response ${a}`)}}async function Pu(e){return Cu({host:e.host,path:"/gas",body:{FixedAmountRequest:{recipient:e.recipient}},headers:e.headers,method:"POST"})}async function Su(e){return Cu({host:e.host,path:"/v1/gas",body:{FixedAmountRequest:{recipient:e.recipient}},headers:e.headers,method:"POST"})}function Au(e){switch(e){case"testnet":return"https://faucet.testnet.sui.io";case"devnet":return"https://faucet.devnet.sui.io";case"localnet":return"http://127.0.0.1:9123";default:throw new Error(`Unknown network: ${e}`)}}})(),s})()));
|
|
1
|
+
export * from './demand.js';
|
|
2
|
+
export * from './progress.js';
|
|
3
|
+
export * from './utils.js';
|
|
4
|
+
export * from './permission.js';
|
|
5
|
+
export * from './guard.js';
|
|
6
|
+
export * from './repository.js';
|
|
7
|
+
export * from './protocol.js';
|
|
8
|
+
//export type { PermissionInfoType } from './permission';
|
|
9
|
+
//export { PermissionInfo, PermissionIndex } from './permission';
|
|
10
|
+
export * from './passport.js';
|
|
11
|
+
export * from './machine.js';
|
|
12
|
+
export * from './service.js';
|
|
13
|
+
export * from './entity.js';
|
|
14
|
+
export * from './wowok.js';
|
|
15
|
+
export * from './resource.js';
|
|
16
|
+
export * from './treasury.js';
|
|
17
|
+
export * from './payment.js';
|
|
18
|
+
export * from './arbitration.js';
|
|
19
|
+
export * from './exception.js';
|
|
20
|
+
export { BCS, getSuiMoveConfig, } from '@mysten/bcs';
|
|
21
|
+
export { Transaction as TransactionBlock } from '@mysten/sui/transactions';
|
|
22
|
+
export { SuiClient } from '@mysten/sui/client';
|
|
23
|
+
export { Ed25519Keypair, } from '@mysten/sui/keypairs/ed25519';
|
|
24
|
+
export { fromHEX, toHEX } from '@mysten/bcs';
|
|
25
|
+
export { decodeSuiPrivateKey, encodeSuiPrivateKey } from '@mysten/sui/cryptography';
|
|
26
|
+
export { getFaucetHost, requestSuiFromFaucetV0, requestSuiFromFaucetV1 } from '@mysten/sui/faucet';
|
|
27
|
+
export { normalizeSuiAddress } from '@mysten/sui/utils';
|
|
28
|
+
//# sourceMappingURL=index.js.map
|