@msafe/sui3-sdk 0.0.45 → 0.0.46

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 CHANGED
@@ -1,26 +1,2 @@
1
- var lu=Object.create;var Ta=Object.defineProperty;var fu=Object.getOwnPropertyDescriptor;var du=Object.getOwnPropertyNames;var hu=Object.getPrototypeOf,xu=Object.prototype.hasOwnProperty;var Ba=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var W=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var mu=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of du(e))!xu.call(t,s)&&s!==r&&Ta(t,s,{get:()=>e[s],enumerable:!(n=fu(e,s))||n.enumerable});return t};var ft=(t,e,r)=>(r=t!=null?lu(hu(t)):{},mu(e||!t||!t.__esModule?Ta(r,"default",{value:t,enumerable:!0}):r,t));var Ma=W(()=>{"use strict"});var q=W((Tr,Pa)=>{"use strict";(function(t,e){typeof Tr=="object"?Pa.exports=Tr=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})(Tr,function(){var t=t||function(e,r){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof global<"u"&&global.crypto&&(n=global.crypto),!n&&typeof Ba=="function")try{n=Ma()}catch{}var s=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function x(){}return function(m){var b;return x.prototype=m,b=new x,x.prototype=null,b}}(),o={},i=o.lib={},c=i.Base=function(){return{extend:function(x){var m=a(this);return x&&m.mixIn(x),(!m.hasOwnProperty("init")||this.init===m.init)&&(m.init=function(){m.$super.init.apply(this,arguments)}),m.init.prototype=m,m.$super=this,m},create:function(){var x=this.extend();return x.init.apply(x,arguments),x},init:function(){},mixIn:function(x){for(var m in x)x.hasOwnProperty(m)&&(this[m]=x[m]);x.hasOwnProperty("toString")&&(this.toString=x.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),l=i.WordArray=c.extend({init:function(x,m){x=this.words=x||[],m!=r?this.sigBytes=m:this.sigBytes=x.length*4},toString:function(x){return(x||d).stringify(this)},concat:function(x){var m=this.words,b=x.words,v=this.sigBytes,w=x.sigBytes;if(this.clamp(),v%4)for(var C=0;C<w;C++){var O=b[C>>>2]>>>24-C%4*8&255;m[v+C>>>2]|=O<<24-(v+C)%4*8}else for(var B=0;B<w;B+=4)m[v+B>>>2]=b[B>>>2];return this.sigBytes+=w,this},clamp:function(){var x=this.words,m=this.sigBytes;x[m>>>2]&=4294967295<<32-m%4*8,x.length=e.ceil(m/4)},clone:function(){var x=c.clone.call(this);return x.words=this.words.slice(0),x},random:function(x){for(var m=[],b=0;b<x;b+=4)m.push(s());return new l.init(m,x)}}),u=o.enc={},d=u.Hex={stringify:function(x){for(var m=x.words,b=x.sigBytes,v=[],w=0;w<b;w++){var C=m[w>>>2]>>>24-w%4*8&255;v.push((C>>>4).toString(16)),v.push((C&15).toString(16))}return v.join("")},parse:function(x){for(var m=x.length,b=[],v=0;v<m;v+=2)b[v>>>3]|=parseInt(x.substr(v,2),16)<<24-v%8*4;return new l.init(b,m/2)}},f=u.Latin1={stringify:function(x){for(var m=x.words,b=x.sigBytes,v=[],w=0;w<b;w++){var C=m[w>>>2]>>>24-w%4*8&255;v.push(String.fromCharCode(C))}return v.join("")},parse:function(x){for(var m=x.length,b=[],v=0;v<m;v++)b[v>>>2]|=(x.charCodeAt(v)&255)<<24-v%4*8;return new l.init(b,m)}},h=u.Utf8={stringify:function(x){try{return decodeURIComponent(escape(f.stringify(x)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(x){return f.parse(unescape(encodeURIComponent(x)))}},p=i.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(x){typeof x=="string"&&(x=h.parse(x)),this._data.concat(x),this._nDataBytes+=x.sigBytes},_process:function(x){var m,b=this._data,v=b.words,w=b.sigBytes,C=this.blockSize,O=C*4,B=w/O;x?B=e.ceil(B):B=e.max((B|0)-this._minBufferSize,0);var k=B*C,M=e.min(k*4,w);if(k){for(var E=0;E<k;E+=C)this._doProcessBlock(v,E);m=v.splice(0,k),b.sigBytes-=M}return new l.init(m,M)},clone:function(){var x=c.clone.call(this);return x._data=this._data.clone(),x},_minBufferSize:0}),g=i.Hasher=p.extend({cfg:c.extend(),init:function(x){this.cfg=this.cfg.extend(x),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(x){return this._append(x),this._process(),this},finalize:function(x){x&&this._append(x);var m=this._doFinalize();return m},blockSize:512/32,_createHelper:function(x){return function(m,b){return new x.init(b).finalize(m)}},_createHmacHelper:function(x){return function(m,b){return new y.HMAC.init(x,b).finalize(m)}}}),y=o.algo={};return o}(Math);return t})});var Rt=W((Br,Na)=>{"use strict";(function(t,e){typeof Br=="object"?Na.exports=Br=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Br,function(t){return function(e){var r=t,n=r.lib,s=n.Base,a=n.WordArray,o=r.x64={},i=o.Word=s.extend({init:function(l,u){this.high=l,this.low=u}}),c=o.WordArray=s.extend({init:function(l,u){l=this.words=l||[],u!=e?this.sigBytes=u:this.sigBytes=l.length*8},toX32:function(){for(var l=this.words,u=l.length,d=[],f=0;f<u;f++){var h=l[f];d.push(h.high),d.push(h.low)}return a.create(d,this.sigBytes)},clone:function(){for(var l=s.clone.call(this),u=l.words=this.words.slice(0),d=u.length,f=0;f<d;f++)u[f]=u[f].clone();return l}})}(),t})});var Ha=W((Fr,Ra)=>{"use strict";(function(t,e){typeof Fr=="object"?Ra.exports=Fr=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Fr,function(t){return function(){if(typeof ArrayBuffer=="function"){var e=t,r=e.lib,n=r.WordArray,s=n.init,a=n.init=function(o){if(o instanceof ArrayBuffer&&(o=new Uint8Array(o)),(o instanceof Int8Array||typeof Uint8ClampedArray<"u"&&o instanceof Uint8ClampedArray||o instanceof Int16Array||o instanceof Uint16Array||o instanceof Int32Array||o instanceof Uint32Array||o instanceof Float32Array||o instanceof Float64Array)&&(o=new Uint8Array(o.buffer,o.byteOffset,o.byteLength)),o instanceof Uint8Array){for(var i=o.byteLength,c=[],l=0;l<i;l++)c[l>>>2]|=o[l]<<24-l%4*8;s.call(this,c,i)}else s.apply(this,arguments)};a.prototype=n}}(),t.lib.WordArray})});var ja=W((Ir,Wa)=>{"use strict";(function(t,e){typeof Ir=="object"?Wa.exports=Ir=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Ir,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,s=e.enc,a=s.Utf16=s.Utf16BE={stringify:function(i){for(var c=i.words,l=i.sigBytes,u=[],d=0;d<l;d+=2){var f=c[d>>>2]>>>16-d%4*8&65535;u.push(String.fromCharCode(f))}return u.join("")},parse:function(i){for(var c=i.length,l=[],u=0;u<c;u++)l[u>>>1]|=i.charCodeAt(u)<<16-u%2*16;return n.create(l,c*2)}};s.Utf16LE={stringify:function(i){for(var c=i.words,l=i.sigBytes,u=[],d=0;d<l;d+=2){var f=o(c[d>>>2]>>>16-d%4*8&65535);u.push(String.fromCharCode(f))}return u.join("")},parse:function(i){for(var c=i.length,l=[],u=0;u<c;u++)l[u>>>1]|=o(i.charCodeAt(u)<<16-u%2*16);return n.create(l,c*2)}};function o(i){return i<<8&4278255360|i>>>8&16711935}}(),t.enc.Utf16})});var qe=W((kr,La)=>{"use strict";(function(t,e){typeof kr=="object"?La.exports=kr=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(kr,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,s=e.enc,a=s.Base64={stringify:function(i){var c=i.words,l=i.sigBytes,u=this._map;i.clamp();for(var d=[],f=0;f<l;f+=3)for(var h=c[f>>>2]>>>24-f%4*8&255,p=c[f+1>>>2]>>>24-(f+1)%4*8&255,g=c[f+2>>>2]>>>24-(f+2)%4*8&255,y=h<<16|p<<8|g,x=0;x<4&&f+x*.75<l;x++)d.push(u.charAt(y>>>6*(3-x)&63));var m=u.charAt(64);if(m)for(;d.length%4;)d.push(m);return d.join("")},parse:function(i){var c=i.length,l=this._map,u=this._reverseMap;if(!u){u=this._reverseMap=[];for(var d=0;d<l.length;d++)u[l.charCodeAt(d)]=d}var f=l.charAt(64);if(f){var h=i.indexOf(f);h!==-1&&(c=h)}return o(i,c,u)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function o(i,c,l){for(var u=[],d=0,f=0;f<c;f++)if(f%4){var h=l[i.charCodeAt(f-1)]<<f%4*2,p=l[i.charCodeAt(f)]>>>6-f%4*2,g=h|p;u[d>>>2]|=g<<24-d%4*8,d++}return n.create(u,d)}}(),t.enc.Base64})});var za=W((Or,qa)=>{"use strict";(function(t,e){typeof Or=="object"?qa.exports=Or=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Or,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,s=e.enc,a=s.Base64url={stringify:function(i,c){c===void 0&&(c=!0);var l=i.words,u=i.sigBytes,d=c?this._safe_map:this._map;i.clamp();for(var f=[],h=0;h<u;h+=3)for(var p=l[h>>>2]>>>24-h%4*8&255,g=l[h+1>>>2]>>>24-(h+1)%4*8&255,y=l[h+2>>>2]>>>24-(h+2)%4*8&255,x=p<<16|g<<8|y,m=0;m<4&&h+m*.75<u;m++)f.push(d.charAt(x>>>6*(3-m)&63));var b=d.charAt(64);if(b)for(;f.length%4;)f.push(b);return f.join("")},parse:function(i,c){c===void 0&&(c=!0);var l=i.length,u=c?this._safe_map:this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var f=0;f<u.length;f++)d[u.charCodeAt(f)]=f}var h=u.charAt(64);if(h){var p=i.indexOf(h);p!==-1&&(l=p)}return o(i,l,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function o(i,c,l){for(var u=[],d=0,f=0;f<c;f++)if(f%4){var h=l[i.charCodeAt(f-1)]<<f%4*2,p=l[i.charCodeAt(f)]>>>6-f%4*2,g=h|p;u[d>>>2]|=g<<24-d%4*8,d++}return n.create(u,d)}}(),t.enc.Base64url})});var ze=W((_r,Ua)=>{"use strict";(function(t,e){typeof _r=="object"?Ua.exports=_r=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(_r,function(t){return function(e){var r=t,n=r.lib,s=n.WordArray,a=n.Hasher,o=r.algo,i=[];(function(){for(var h=0;h<64;h++)i[h]=e.abs(e.sin(h+1))*4294967296|0})();var c=o.MD5=a.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(h,p){for(var g=0;g<16;g++){var y=p+g,x=h[y];h[y]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360}var m=this._hash.words,b=h[p+0],v=h[p+1],w=h[p+2],C=h[p+3],O=h[p+4],B=h[p+5],k=h[p+6],M=h[p+7],E=h[p+8],I=h[p+9],P=h[p+10],T=h[p+11],H=h[p+12],N=h[p+13],j=h[p+14],z=h[p+15],S=m[0],D=m[1],F=m[2],A=m[3];S=l(S,D,F,A,b,7,i[0]),A=l(A,S,D,F,v,12,i[1]),F=l(F,A,S,D,w,17,i[2]),D=l(D,F,A,S,C,22,i[3]),S=l(S,D,F,A,O,7,i[4]),A=l(A,S,D,F,B,12,i[5]),F=l(F,A,S,D,k,17,i[6]),D=l(D,F,A,S,M,22,i[7]),S=l(S,D,F,A,E,7,i[8]),A=l(A,S,D,F,I,12,i[9]),F=l(F,A,S,D,P,17,i[10]),D=l(D,F,A,S,T,22,i[11]),S=l(S,D,F,A,H,7,i[12]),A=l(A,S,D,F,N,12,i[13]),F=l(F,A,S,D,j,17,i[14]),D=l(D,F,A,S,z,22,i[15]),S=u(S,D,F,A,v,5,i[16]),A=u(A,S,D,F,k,9,i[17]),F=u(F,A,S,D,T,14,i[18]),D=u(D,F,A,S,b,20,i[19]),S=u(S,D,F,A,B,5,i[20]),A=u(A,S,D,F,P,9,i[21]),F=u(F,A,S,D,z,14,i[22]),D=u(D,F,A,S,O,20,i[23]),S=u(S,D,F,A,I,5,i[24]),A=u(A,S,D,F,j,9,i[25]),F=u(F,A,S,D,C,14,i[26]),D=u(D,F,A,S,E,20,i[27]),S=u(S,D,F,A,N,5,i[28]),A=u(A,S,D,F,w,9,i[29]),F=u(F,A,S,D,M,14,i[30]),D=u(D,F,A,S,H,20,i[31]),S=d(S,D,F,A,B,4,i[32]),A=d(A,S,D,F,E,11,i[33]),F=d(F,A,S,D,T,16,i[34]),D=d(D,F,A,S,j,23,i[35]),S=d(S,D,F,A,v,4,i[36]),A=d(A,S,D,F,O,11,i[37]),F=d(F,A,S,D,M,16,i[38]),D=d(D,F,A,S,P,23,i[39]),S=d(S,D,F,A,N,4,i[40]),A=d(A,S,D,F,b,11,i[41]),F=d(F,A,S,D,C,16,i[42]),D=d(D,F,A,S,k,23,i[43]),S=d(S,D,F,A,I,4,i[44]),A=d(A,S,D,F,H,11,i[45]),F=d(F,A,S,D,z,16,i[46]),D=d(D,F,A,S,w,23,i[47]),S=f(S,D,F,A,b,6,i[48]),A=f(A,S,D,F,M,10,i[49]),F=f(F,A,S,D,j,15,i[50]),D=f(D,F,A,S,B,21,i[51]),S=f(S,D,F,A,H,6,i[52]),A=f(A,S,D,F,C,10,i[53]),F=f(F,A,S,D,P,15,i[54]),D=f(D,F,A,S,v,21,i[55]),S=f(S,D,F,A,E,6,i[56]),A=f(A,S,D,F,z,10,i[57]),F=f(F,A,S,D,k,15,i[58]),D=f(D,F,A,S,N,21,i[59]),S=f(S,D,F,A,O,6,i[60]),A=f(A,S,D,F,T,10,i[61]),F=f(F,A,S,D,w,15,i[62]),D=f(D,F,A,S,I,21,i[63]),m[0]=m[0]+S|0,m[1]=m[1]+D|0,m[2]=m[2]+F|0,m[3]=m[3]+A|0},_doFinalize:function(){var h=this._data,p=h.words,g=this._nDataBytes*8,y=h.sigBytes*8;p[y>>>5]|=128<<24-y%32;var x=e.floor(g/4294967296),m=g;p[(y+64>>>9<<4)+15]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,p[(y+64>>>9<<4)+14]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360,h.sigBytes=(p.length+1)*4,this._process();for(var b=this._hash,v=b.words,w=0;w<4;w++){var C=v[w];v[w]=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360}return b},clone:function(){var h=a.clone.call(this);return h._hash=this._hash.clone(),h}});function l(h,p,g,y,x,m,b){var v=h+(p&g|~p&y)+x+b;return(v<<m|v>>>32-m)+p}function u(h,p,g,y,x,m,b){var v=h+(p&y|g&~y)+x+b;return(v<<m|v>>>32-m)+p}function d(h,p,g,y,x,m,b){var v=h+(p^g^y)+x+b;return(v<<m|v>>>32-m)+p}function f(h,p,g,y,x,m,b){var v=h+(g^(p|~y))+x+b;return(v<<m|v>>>32-m)+p}r.MD5=a._createHelper(c),r.HmacMD5=a._createHmacHelper(c)}(Math),t.MD5})});var rs=W((Mr,Va)=>{"use strict";(function(t,e){typeof Mr=="object"?Va.exports=Mr=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Mr,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,s=r.Hasher,a=e.algo,o=[],i=a.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(c,l){for(var u=this._hash.words,d=u[0],f=u[1],h=u[2],p=u[3],g=u[4],y=0;y<80;y++){if(y<16)o[y]=c[l+y]|0;else{var x=o[y-3]^o[y-8]^o[y-14]^o[y-16];o[y]=x<<1|x>>>31}var m=(d<<5|d>>>27)+g+o[y];y<20?m+=(f&h|~f&p)+1518500249:y<40?m+=(f^h^p)+1859775393:y<60?m+=(f&h|f&p|h&p)-1894007588:m+=(f^h^p)-899497514,g=p,p=h,h=f<<30|f>>>2,f=d,d=m}u[0]=u[0]+d|0,u[1]=u[1]+f|0,u[2]=u[2]+h|0,u[3]=u[3]+p|0,u[4]=u[4]+g|0},_doFinalize:function(){var c=this._data,l=c.words,u=this._nDataBytes*8,d=c.sigBytes*8;return l[d>>>5]|=128<<24-d%32,l[(d+64>>>9<<4)+14]=Math.floor(u/4294967296),l[(d+64>>>9<<4)+15]=u,c.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var c=s.clone.call(this);return c._hash=this._hash.clone(),c}});e.SHA1=s._createHelper(i),e.HmacSHA1=s._createHmacHelper(i)}(),t.SHA1})});var Nr=W((Pr,Ga)=>{"use strict";(function(t,e){typeof Pr=="object"?Ga.exports=Pr=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Pr,function(t){return function(e){var r=t,n=r.lib,s=n.WordArray,a=n.Hasher,o=r.algo,i=[],c=[];(function(){function d(g){for(var y=e.sqrt(g),x=2;x<=y;x++)if(!(g%x))return!1;return!0}function f(g){return(g-(g|0))*4294967296|0}for(var h=2,p=0;p<64;)d(h)&&(p<8&&(i[p]=f(e.pow(h,1/2))),c[p]=f(e.pow(h,1/3)),p++),h++})();var l=[],u=o.SHA256=a.extend({_doReset:function(){this._hash=new s.init(i.slice(0))},_doProcessBlock:function(d,f){for(var h=this._hash.words,p=h[0],g=h[1],y=h[2],x=h[3],m=h[4],b=h[5],v=h[6],w=h[7],C=0;C<64;C++){if(C<16)l[C]=d[f+C]|0;else{var O=l[C-15],B=(O<<25|O>>>7)^(O<<14|O>>>18)^O>>>3,k=l[C-2],M=(k<<15|k>>>17)^(k<<13|k>>>19)^k>>>10;l[C]=B+l[C-7]+M+l[C-16]}var E=m&b^~m&v,I=p&g^p&y^g&y,P=(p<<30|p>>>2)^(p<<19|p>>>13)^(p<<10|p>>>22),T=(m<<26|m>>>6)^(m<<21|m>>>11)^(m<<7|m>>>25),H=w+T+E+c[C]+l[C],N=P+I;w=v,v=b,b=m,m=x+H|0,x=y,y=g,g=p,p=H+N|0}h[0]=h[0]+p|0,h[1]=h[1]+g|0,h[2]=h[2]+y|0,h[3]=h[3]+x|0,h[4]=h[4]+m|0,h[5]=h[5]+b|0,h[6]=h[6]+v|0,h[7]=h[7]+w|0},_doFinalize:function(){var d=this._data,f=d.words,h=this._nDataBytes*8,p=d.sigBytes*8;return f[p>>>5]|=128<<24-p%32,f[(p+64>>>9<<4)+14]=e.floor(h/4294967296),f[(p+64>>>9<<4)+15]=h,d.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});r.SHA256=a._createHelper(u),r.HmacSHA256=a._createHmacHelper(u)}(Math),t.SHA256})});var $a=W((Rr,Ka)=>{"use strict";(function(t,e,r){typeof Rr=="object"?Ka.exports=Rr=e(q(),Nr()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(Rr,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,s=e.algo,a=s.SHA256,o=s.SHA224=a.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var i=a._doFinalize.call(this);return i.sigBytes-=4,i}});e.SHA224=a._createHelper(o),e.HmacSHA224=a._createHmacHelper(o)}(),t.SHA224})});var ns=W((Hr,Za)=>{"use strict";(function(t,e,r){typeof Hr=="object"?Za.exports=Hr=e(q(),Rt()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(Hr,function(t){return function(){var e=t,r=e.lib,n=r.Hasher,s=e.x64,a=s.Word,o=s.WordArray,i=e.algo;function c(){return a.create.apply(a,arguments)}var l=[c(1116352408,3609767458),c(1899447441,602891725),c(3049323471,3964484399),c(3921009573,2173295548),c(961987163,4081628472),c(1508970993,3053834265),c(2453635748,2937671579),c(2870763221,3664609560),c(3624381080,2734883394),c(310598401,1164996542),c(607225278,1323610764),c(1426881987,3590304994),c(1925078388,4068182383),c(2162078206,991336113),c(2614888103,633803317),c(3248222580,3479774868),c(3835390401,2666613458),c(4022224774,944711139),c(264347078,2341262773),c(604807628,2007800933),c(770255983,1495990901),c(1249150122,1856431235),c(1555081692,3175218132),c(1996064986,2198950837),c(2554220882,3999719339),c(2821834349,766784016),c(2952996808,2566594879),c(3210313671,3203337956),c(3336571891,1034457026),c(3584528711,2466948901),c(113926993,3758326383),c(338241895,168717936),c(666307205,1188179964),c(773529912,1546045734),c(1294757372,1522805485),c(1396182291,2643833823),c(1695183700,2343527390),c(1986661051,1014477480),c(2177026350,1206759142),c(2456956037,344077627),c(2730485921,1290863460),c(2820302411,3158454273),c(3259730800,3505952657),c(3345764771,106217008),c(3516065817,3606008344),c(3600352804,1432725776),c(4094571909,1467031594),c(275423344,851169720),c(430227734,3100823752),c(506948616,1363258195),c(659060556,3750685593),c(883997877,3785050280),c(958139571,3318307427),c(1322822218,3812723403),c(1537002063,2003034995),c(1747873779,3602036899),c(1955562222,1575990012),c(2024104815,1125592928),c(2227730452,2716904306),c(2361852424,442776044),c(2428436474,593698344),c(2756734187,3733110249),c(3204031479,2999351573),c(3329325298,3815920427),c(3391569614,3928383900),c(3515267271,566280711),c(3940187606,3454069534),c(4118630271,4000239992),c(116418474,1914138554),c(174292421,2731055270),c(289380356,3203993006),c(460393269,320620315),c(685471733,587496836),c(852142971,1086792851),c(1017036298,365543100),c(1126000580,2618297676),c(1288033470,3409855158),c(1501505948,4234509866),c(1607167915,987167468),c(1816402316,1246189591)],u=[];(function(){for(var f=0;f<80;f++)u[f]=c()})();var d=i.SHA512=n.extend({_doReset:function(){this._hash=new o.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(f,h){for(var p=this._hash.words,g=p[0],y=p[1],x=p[2],m=p[3],b=p[4],v=p[5],w=p[6],C=p[7],O=g.high,B=g.low,k=y.high,M=y.low,E=x.high,I=x.low,P=m.high,T=m.low,H=b.high,N=b.low,j=v.high,z=v.low,S=w.high,D=w.low,F=C.high,A=C.low,Y=O,Z=B,ie=k,L=M,It=E,ct=I,Jn=P,kt=T,ve=H,ce=N,wr=j,Ot=z,Cr=S,_t=D,Xn=F,Mt=A,be=0;be<80;be++){var me,He,Er=u[be];if(be<16)He=Er.high=f[h+be*2]|0,me=Er.low=f[h+be*2+1]|0;else{var ma=u[be-15],ut=ma.high,Pt=ma.low,Jc=(ut>>>1|Pt<<31)^(ut>>>8|Pt<<24)^ut>>>7,pa=(Pt>>>1|ut<<31)^(Pt>>>8|ut<<24)^(Pt>>>7|ut<<25),ga=u[be-2],lt=ga.high,Nt=ga.low,Xc=(lt>>>19|Nt<<13)^(lt<<3|Nt>>>29)^lt>>>6,ya=(Nt>>>19|lt<<13)^(Nt<<3|lt>>>29)^(Nt>>>6|lt<<26),va=u[be-7],Qc=va.high,eu=va.low,ba=u[be-16],tu=ba.high,wa=ba.low;me=pa+eu,He=Jc+Qc+(me>>>0<pa>>>0?1:0),me=me+ya,He=He+Xc+(me>>>0<ya>>>0?1:0),me=me+wa,He=He+tu+(me>>>0<wa>>>0?1:0),Er.high=He,Er.low=me}var ru=ve&wr^~ve&Cr,Ca=ce&Ot^~ce&_t,nu=Y&ie^Y&It^ie&It,su=Z&L^Z&ct^L&ct,au=(Y>>>28|Z<<4)^(Y<<30|Z>>>2)^(Y<<25|Z>>>7),Ea=(Z>>>28|Y<<4)^(Z<<30|Y>>>2)^(Z<<25|Y>>>7),iu=(ve>>>14|ce<<18)^(ve>>>18|ce<<14)^(ve<<23|ce>>>9),ou=(ce>>>14|ve<<18)^(ce>>>18|ve<<14)^(ce<<23|ve>>>9),Sa=l[be],cu=Sa.high,Aa=Sa.low,ue=Mt+ou,We=Xn+iu+(ue>>>0<Mt>>>0?1:0),ue=ue+Ca,We=We+ru+(ue>>>0<Ca>>>0?1:0),ue=ue+Aa,We=We+cu+(ue>>>0<Aa>>>0?1:0),ue=ue+me,We=We+He+(ue>>>0<me>>>0?1:0),Da=Ea+su,uu=au+nu+(Da>>>0<Ea>>>0?1:0);Xn=Cr,Mt=_t,Cr=wr,_t=Ot,wr=ve,Ot=ce,ce=kt+ue|0,ve=Jn+We+(ce>>>0<kt>>>0?1:0)|0,Jn=It,kt=ct,It=ie,ct=L,ie=Y,L=Z,Z=ue+Da|0,Y=We+uu+(Z>>>0<ue>>>0?1:0)|0}B=g.low=B+Z,g.high=O+Y+(B>>>0<Z>>>0?1:0),M=y.low=M+L,y.high=k+ie+(M>>>0<L>>>0?1:0),I=x.low=I+ct,x.high=E+It+(I>>>0<ct>>>0?1:0),T=m.low=T+kt,m.high=P+Jn+(T>>>0<kt>>>0?1:0),N=b.low=N+ce,b.high=H+ve+(N>>>0<ce>>>0?1:0),z=v.low=z+Ot,v.high=j+wr+(z>>>0<Ot>>>0?1:0),D=w.low=D+_t,w.high=S+Cr+(D>>>0<_t>>>0?1:0),A=C.low=A+Mt,C.high=F+Xn+(A>>>0<Mt>>>0?1:0)},_doFinalize:function(){var f=this._data,h=f.words,p=this._nDataBytes*8,g=f.sigBytes*8;h[g>>>5]|=128<<24-g%32,h[(g+128>>>10<<5)+30]=Math.floor(p/4294967296),h[(g+128>>>10<<5)+31]=p,f.sigBytes=h.length*4,this._process();var y=this._hash.toX32();return y},clone:function(){var f=n.clone.call(this);return f._hash=this._hash.clone(),f},blockSize:1024/32});e.SHA512=n._createHelper(d),e.HmacSHA512=n._createHmacHelper(d)}(),t.SHA512})});var Ja=W((Wr,Ya)=>{"use strict";(function(t,e,r){typeof Wr=="object"?Ya.exports=Wr=e(q(),Rt(),ns()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(Wr,function(t){return function(){var e=t,r=e.x64,n=r.Word,s=r.WordArray,a=e.algo,o=a.SHA512,i=a.SHA384=o.extend({_doReset:function(){this._hash=new s.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var c=o._doFinalize.call(this);return c.sigBytes-=16,c}});e.SHA384=o._createHelper(i),e.HmacSHA384=o._createHmacHelper(i)}(),t.SHA384})});var Qa=W((jr,Xa)=>{"use strict";(function(t,e,r){typeof jr=="object"?Xa.exports=jr=e(q(),Rt()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(jr,function(t){return function(e){var r=t,n=r.lib,s=n.WordArray,a=n.Hasher,o=r.x64,i=o.Word,c=r.algo,l=[],u=[],d=[];(function(){for(var p=1,g=0,y=0;y<24;y++){l[p+5*g]=(y+1)*(y+2)/2%64;var x=g%5,m=(2*p+3*g)%5;p=x,g=m}for(var p=0;p<5;p++)for(var g=0;g<5;g++)u[p+5*g]=g+(2*p+3*g)%5*5;for(var b=1,v=0;v<24;v++){for(var w=0,C=0,O=0;O<7;O++){if(b&1){var B=(1<<O)-1;B<32?C^=1<<B:w^=1<<B-32}b&128?b=b<<1^113:b<<=1}d[v]=i.create(w,C)}})();var f=[];(function(){for(var p=0;p<25;p++)f[p]=i.create()})();var h=c.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var p=this._state=[],g=0;g<25;g++)p[g]=new i.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(p,g){for(var y=this._state,x=this.blockSize/2,m=0;m<x;m++){var b=p[g+2*m],v=p[g+2*m+1];b=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,v=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360;var w=y[m];w.high^=v,w.low^=b}for(var C=0;C<24;C++){for(var O=0;O<5;O++){for(var B=0,k=0,M=0;M<5;M++){var w=y[O+5*M];B^=w.high,k^=w.low}var E=f[O];E.high=B,E.low=k}for(var O=0;O<5;O++)for(var I=f[(O+4)%5],P=f[(O+1)%5],T=P.high,H=P.low,B=I.high^(T<<1|H>>>31),k=I.low^(H<<1|T>>>31),M=0;M<5;M++){var w=y[O+5*M];w.high^=B,w.low^=k}for(var N=1;N<25;N++){var B,k,w=y[N],j=w.high,z=w.low,S=l[N];S<32?(B=j<<S|z>>>32-S,k=z<<S|j>>>32-S):(B=z<<S-32|j>>>64-S,k=j<<S-32|z>>>64-S);var D=f[u[N]];D.high=B,D.low=k}var F=f[0],A=y[0];F.high=A.high,F.low=A.low;for(var O=0;O<5;O++)for(var M=0;M<5;M++){var N=O+5*M,w=y[N],Y=f[N],Z=f[(O+1)%5+5*M],ie=f[(O+2)%5+5*M];w.high=Y.high^~Z.high&ie.high,w.low=Y.low^~Z.low&ie.low}var w=y[0],L=d[C];w.high^=L.high,w.low^=L.low}},_doFinalize:function(){var p=this._data,g=p.words,y=this._nDataBytes*8,x=p.sigBytes*8,m=this.blockSize*32;g[x>>>5]|=1<<24-x%32,g[(e.ceil((x+1)/m)*m>>>5)-1]|=128,p.sigBytes=g.length*4,this._process();for(var b=this._state,v=this.cfg.outputLength/8,w=v/8,C=[],O=0;O<w;O++){var B=b[O],k=B.high,M=B.low;k=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360,M=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360,C.push(M),C.push(k)}return new s.init(C,v)},clone:function(){for(var p=a.clone.call(this),g=p._state=this._state.slice(0),y=0;y<25;y++)g[y]=g[y].clone();return p}});r.SHA3=a._createHelper(h),r.HmacSHA3=a._createHmacHelper(h)}(Math),t.SHA3})});var ti=W((Lr,ei)=>{"use strict";(function(t,e){typeof Lr=="object"?ei.exports=Lr=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Lr,function(t){return function(e){var r=t,n=r.lib,s=n.WordArray,a=n.Hasher,o=r.algo,i=s.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),c=s.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=s.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),u=s.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=s.create([0,1518500249,1859775393,2400959708,2840853838]),f=s.create([1352829926,1548603684,1836072691,2053994217,0]),h=o.RIPEMD160=a.extend({_doReset:function(){this._hash=s.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(v,w){for(var C=0;C<16;C++){var O=w+C,B=v[O];v[O]=(B<<8|B>>>24)&16711935|(B<<24|B>>>8)&4278255360}var k=this._hash.words,M=d.words,E=f.words,I=i.words,P=c.words,T=l.words,H=u.words,N,j,z,S,D,F,A,Y,Z,ie;F=N=k[0],A=j=k[1],Y=z=k[2],Z=S=k[3],ie=D=k[4];for(var L,C=0;C<80;C+=1)L=N+v[w+I[C]]|0,C<16?L+=p(j,z,S)+M[0]:C<32?L+=g(j,z,S)+M[1]:C<48?L+=y(j,z,S)+M[2]:C<64?L+=x(j,z,S)+M[3]:L+=m(j,z,S)+M[4],L=L|0,L=b(L,T[C]),L=L+D|0,N=D,D=S,S=b(z,10),z=j,j=L,L=F+v[w+P[C]]|0,C<16?L+=m(A,Y,Z)+E[0]:C<32?L+=x(A,Y,Z)+E[1]:C<48?L+=y(A,Y,Z)+E[2]:C<64?L+=g(A,Y,Z)+E[3]:L+=p(A,Y,Z)+E[4],L=L|0,L=b(L,H[C]),L=L+ie|0,F=ie,ie=Z,Z=b(Y,10),Y=A,A=L;L=k[1]+z+Z|0,k[1]=k[2]+S+ie|0,k[2]=k[3]+D+F|0,k[3]=k[4]+N+A|0,k[4]=k[0]+j+Y|0,k[0]=L},_doFinalize:function(){var v=this._data,w=v.words,C=this._nDataBytes*8,O=v.sigBytes*8;w[O>>>5]|=128<<24-O%32,w[(O+64>>>9<<4)+14]=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360,v.sigBytes=(w.length+1)*4,this._process();for(var B=this._hash,k=B.words,M=0;M<5;M++){var E=k[M];k[M]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360}return B},clone:function(){var v=a.clone.call(this);return v._hash=this._hash.clone(),v}});function p(v,w,C){return v^w^C}function g(v,w,C){return v&w|~v&C}function y(v,w,C){return(v|~w)^C}function x(v,w,C){return v&C|w&~C}function m(v,w,C){return v^(w|~C)}function b(v,w){return v<<w|v>>>32-w}r.RIPEMD160=a._createHelper(h),r.HmacRIPEMD160=a._createHmacHelper(h)}(Math),t.RIPEMD160})});var zr=W((qr,ri)=>{"use strict";(function(t,e){typeof qr=="object"?ri.exports=qr=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(qr,function(t){(function(){var e=t,r=e.lib,n=r.Base,s=e.enc,a=s.Utf8,o=e.algo,i=o.HMAC=n.extend({init:function(c,l){c=this._hasher=new c.init,typeof l=="string"&&(l=a.parse(l));var u=c.blockSize,d=u*4;l.sigBytes>d&&(l=c.finalize(l)),l.clamp();for(var f=this._oKey=l.clone(),h=this._iKey=l.clone(),p=f.words,g=h.words,y=0;y<u;y++)p[y]^=1549556828,g[y]^=909522486;f.sigBytes=h.sigBytes=d,this.reset()},reset:function(){var c=this._hasher;c.reset(),c.update(this._iKey)},update:function(c){return this._hasher.update(c),this},finalize:function(c){var l=this._hasher,u=l.finalize(c);l.reset();var d=l.finalize(this._oKey.clone().concat(u));return d}})})()})});var si=W((Ur,ni)=>{"use strict";(function(t,e,r){typeof Ur=="object"?ni.exports=Ur=e(q(),Nr(),zr()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(Ur,function(t){return function(){var e=t,r=e.lib,n=r.Base,s=r.WordArray,a=e.algo,o=a.SHA256,i=a.HMAC,c=a.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:o,iterations:25e4}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,u){for(var d=this.cfg,f=i.create(d.hasher,l),h=s.create(),p=s.create([1]),g=h.words,y=p.words,x=d.keySize,m=d.iterations;g.length<x;){var b=f.update(u).finalize(p);f.reset();for(var v=b.words,w=v.length,C=b,O=1;O<m;O++){C=f.finalize(C),f.reset();for(var B=C.words,k=0;k<w;k++)v[k]^=B[k]}h.concat(b),y[0]++}return h.sigBytes=x*4,h}});e.PBKDF2=function(l,u,d){return c.create(d).compute(l,u)}}(),t.PBKDF2})});var Ie=W((Vr,ai)=>{"use strict";(function(t,e,r){typeof Vr=="object"?ai.exports=Vr=e(q(),rs(),zr()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(Vr,function(t){return function(){var e=t,r=e.lib,n=r.Base,s=r.WordArray,a=e.algo,o=a.MD5,i=a.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:o,iterations:1}),init:function(c){this.cfg=this.cfg.extend(c)},compute:function(c,l){for(var u,d=this.cfg,f=d.hasher.create(),h=s.create(),p=h.words,g=d.keySize,y=d.iterations;p.length<g;){u&&f.update(u),u=f.update(c).finalize(l),f.reset();for(var x=1;x<y;x++)u=f.finalize(u),f.reset();h.concat(u)}return h.sigBytes=g*4,h}});e.EvpKDF=function(c,l,u){return i.create(u).compute(c,l)}}(),t.EvpKDF})});var ee=W((Gr,ii)=>{"use strict";(function(t,e,r){typeof Gr=="object"?ii.exports=Gr=e(q(),Ie()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(Gr,function(t){t.lib.Cipher||function(e){var r=t,n=r.lib,s=n.Base,a=n.WordArray,o=n.BufferedBlockAlgorithm,i=r.enc,c=i.Utf8,l=i.Base64,u=r.algo,d=u.EvpKDF,f=n.Cipher=o.extend({cfg:s.extend(),createEncryptor:function(E,I){return this.create(this._ENC_XFORM_MODE,E,I)},createDecryptor:function(E,I){return this.create(this._DEC_XFORM_MODE,E,I)},init:function(E,I,P){this.cfg=this.cfg.extend(P),this._xformMode=E,this._key=I,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(E){return this._append(E),this._process()},finalize:function(E){E&&this._append(E);var I=this._doFinalize();return I},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function E(I){return typeof I=="string"?M:O}return function(I){return{encrypt:function(P,T,H){return E(T).encrypt(I,P,T,H)},decrypt:function(P,T,H){return E(T).decrypt(I,P,T,H)}}}}()}),h=n.StreamCipher=f.extend({_doFinalize:function(){var E=this._process(!0);return E},blockSize:1}),p=r.mode={},g=n.BlockCipherMode=s.extend({createEncryptor:function(E,I){return this.Encryptor.create(E,I)},createDecryptor:function(E,I){return this.Decryptor.create(E,I)},init:function(E,I){this._cipher=E,this._iv=I}}),y=p.CBC=function(){var E=g.extend();E.Encryptor=E.extend({processBlock:function(P,T){var H=this._cipher,N=H.blockSize;I.call(this,P,T,N),H.encryptBlock(P,T),this._prevBlock=P.slice(T,T+N)}}),E.Decryptor=E.extend({processBlock:function(P,T){var H=this._cipher,N=H.blockSize,j=P.slice(T,T+N);H.decryptBlock(P,T),I.call(this,P,T,N),this._prevBlock=j}});function I(P,T,H){var N,j=this._iv;j?(N=j,this._iv=e):N=this._prevBlock;for(var z=0;z<H;z++)P[T+z]^=N[z]}return E}(),x=r.pad={},m=x.Pkcs7={pad:function(E,I){for(var P=I*4,T=P-E.sigBytes%P,H=T<<24|T<<16|T<<8|T,N=[],j=0;j<T;j+=4)N.push(H);var z=a.create(N,T);E.concat(z)},unpad:function(E){var I=E.words[E.sigBytes-1>>>2]&255;E.sigBytes-=I}},b=n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:y,padding:m}),reset:function(){var E;f.reset.call(this);var I=this.cfg,P=I.iv,T=I.mode;this._xformMode==this._ENC_XFORM_MODE?E=T.createEncryptor:(E=T.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==E?this._mode.init(this,P&&P.words):(this._mode=E.call(T,this,P&&P.words),this._mode.__creator=E)},_doProcessBlock:function(E,I){this._mode.processBlock(E,I)},_doFinalize:function(){var E,I=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(I.pad(this._data,this.blockSize),E=this._process(!0)):(E=this._process(!0),I.unpad(E)),E},blockSize:128/32}),v=n.CipherParams=s.extend({init:function(E){this.mixIn(E)},toString:function(E){return(E||this.formatter).stringify(this)}}),w=r.format={},C=w.OpenSSL={stringify:function(E){var I,P=E.ciphertext,T=E.salt;return T?I=a.create([1398893684,1701076831]).concat(T).concat(P):I=P,I.toString(l)},parse:function(E){var I,P=l.parse(E),T=P.words;return T[0]==1398893684&&T[1]==1701076831&&(I=a.create(T.slice(2,4)),T.splice(0,4),P.sigBytes-=16),v.create({ciphertext:P,salt:I})}},O=n.SerializableCipher=s.extend({cfg:s.extend({format:C}),encrypt:function(E,I,P,T){T=this.cfg.extend(T);var H=E.createEncryptor(P,T),N=H.finalize(I),j=H.cfg;return v.create({ciphertext:N,key:P,iv:j.iv,algorithm:E,mode:j.mode,padding:j.padding,blockSize:E.blockSize,formatter:T.format})},decrypt:function(E,I,P,T){T=this.cfg.extend(T),I=this._parse(I,T.format);var H=E.createDecryptor(P,T).finalize(I.ciphertext);return H},_parse:function(E,I){return typeof E=="string"?I.parse(E,this):E}}),B=r.kdf={},k=B.OpenSSL={execute:function(E,I,P,T,H){if(T||(T=a.random(64/8)),H)var N=d.create({keySize:I+P,hasher:H}).compute(E,T);else var N=d.create({keySize:I+P}).compute(E,T);var j=a.create(N.words.slice(I),P*4);return N.sigBytes=I*4,v.create({key:N,iv:j,salt:T})}},M=n.PasswordBasedCipher=O.extend({cfg:O.cfg.extend({kdf:k}),encrypt:function(E,I,P,T){T=this.cfg.extend(T);var H=T.kdf.execute(P,E.keySize,E.ivSize,T.salt,T.hasher);T.iv=H.iv;var N=O.encrypt.call(this,E,I,H.key,T);return N.mixIn(H),N},decrypt:function(E,I,P,T){T=this.cfg.extend(T),I=this._parse(I,T.format);var H=T.kdf.execute(P,E.keySize,E.ivSize,I.salt,T.hasher);T.iv=H.iv;var N=O.decrypt.call(this,E,I,H.key,T);return N}})}()})});var ci=W((Kr,oi)=>{"use strict";(function(t,e,r){typeof Kr=="object"?oi.exports=Kr=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Kr,function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();e.Encryptor=e.extend({processBlock:function(n,s){var a=this._cipher,o=a.blockSize;r.call(this,n,s,o,a),this._prevBlock=n.slice(s,s+o)}}),e.Decryptor=e.extend({processBlock:function(n,s){var a=this._cipher,o=a.blockSize,i=n.slice(s,s+o);r.call(this,n,s,o,a),this._prevBlock=i}});function r(n,s,a,o){var i,c=this._iv;c?(i=c.slice(0),this._iv=void 0):i=this._prevBlock,o.encryptBlock(i,0);for(var l=0;l<a;l++)n[s+l]^=i[l]}return e}(),t.mode.CFB})});var li=W(($r,ui)=>{"use strict";(function(t,e,r){typeof $r=="object"?ui.exports=$r=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})($r,function(t){return t.mode.CTR=function(){var e=t.lib.BlockCipherMode.extend(),r=e.Encryptor=e.extend({processBlock:function(n,s){var a=this._cipher,o=a.blockSize,i=this._iv,c=this._counter;i&&(c=this._counter=i.slice(0),this._iv=void 0);var l=c.slice(0);a.encryptBlock(l,0),c[o-1]=c[o-1]+1|0;for(var u=0;u<o;u++)n[s+u]^=l[u]}});return e.Decryptor=r,e}(),t.mode.CTR})});var di=W((Zr,fi)=>{"use strict";(function(t,e,r){typeof Zr=="object"?fi.exports=Zr=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Zr,function(t){return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();function r(a){if((a>>24&255)===255){var o=a>>16&255,i=a>>8&255,c=a&255;o===255?(o=0,i===255?(i=0,c===255?c=0:++c):++i):++o,a=0,a+=o<<16,a+=i<<8,a+=c}else a+=1<<24;return a}function n(a){return(a[0]=r(a[0]))===0&&(a[1]=r(a[1])),a}var s=e.Encryptor=e.extend({processBlock:function(a,o){var i=this._cipher,c=i.blockSize,l=this._iv,u=this._counter;l&&(u=this._counter=l.slice(0),this._iv=void 0),n(u);var d=u.slice(0);i.encryptBlock(d,0);for(var f=0;f<c;f++)a[o+f]^=d[f]}});return e.Decryptor=s,e}(),t.mode.CTRGladman})});var xi=W((Yr,hi)=>{"use strict";(function(t,e,r){typeof Yr=="object"?hi.exports=Yr=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Yr,function(t){return t.mode.OFB=function(){var e=t.lib.BlockCipherMode.extend(),r=e.Encryptor=e.extend({processBlock:function(n,s){var a=this._cipher,o=a.blockSize,i=this._iv,c=this._keystream;i&&(c=this._keystream=i.slice(0),this._iv=void 0),a.encryptBlock(c,0);for(var l=0;l<o;l++)n[s+l]^=c[l]}});return e.Decryptor=r,e}(),t.mode.OFB})});var pi=W((Jr,mi)=>{"use strict";(function(t,e,r){typeof Jr=="object"?mi.exports=Jr=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Jr,function(t){return t.mode.ECB=function(){var e=t.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(r,n){this._cipher.encryptBlock(r,n)}}),e.Decryptor=e.extend({processBlock:function(r,n){this._cipher.decryptBlock(r,n)}}),e}(),t.mode.ECB})});var yi=W((Xr,gi)=>{"use strict";(function(t,e,r){typeof Xr=="object"?gi.exports=Xr=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Xr,function(t){return t.pad.AnsiX923={pad:function(e,r){var n=e.sigBytes,s=r*4,a=s-n%s,o=n+a-1;e.clamp(),e.words[o>>>2]|=a<<24-o%4*8,e.sigBytes+=a},unpad:function(e){var r=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=r}},t.pad.Ansix923})});var bi=W((Qr,vi)=>{"use strict";(function(t,e,r){typeof Qr=="object"?vi.exports=Qr=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Qr,function(t){return t.pad.Iso10126={pad:function(e,r){var n=r*4,s=n-e.sigBytes%n;e.concat(t.lib.WordArray.random(s-1)).concat(t.lib.WordArray.create([s<<24],1))},unpad:function(e){var r=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=r}},t.pad.Iso10126})});var Ci=W((en,wi)=>{"use strict";(function(t,e,r){typeof en=="object"?wi.exports=en=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(en,function(t){return t.pad.Iso97971={pad:function(e,r){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,r)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971})});var Si=W((tn,Ei)=>{"use strict";(function(t,e,r){typeof tn=="object"?Ei.exports=tn=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(tn,function(t){return t.pad.ZeroPadding={pad:function(e,r){var n=r*4;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){for(var r=e.words,n=e.sigBytes-1,n=e.sigBytes-1;n>=0;n--)if(r[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},t.pad.ZeroPadding})});var Di=W((rn,Ai)=>{"use strict";(function(t,e,r){typeof rn=="object"?Ai.exports=rn=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(rn,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var Bi=W((nn,Ti)=>{"use strict";(function(t,e,r){typeof nn=="object"?Ti.exports=nn=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(nn,function(t){return function(e){var r=t,n=r.lib,s=n.CipherParams,a=r.enc,o=a.Hex,i=r.format,c=i.Hex={stringify:function(l){return l.ciphertext.toString(o)},parse:function(l){var u=o.parse(l);return s.create({ciphertext:u})}}}(),t.format.Hex})});var Ii=W((sn,Fi)=>{"use strict";(function(t,e,r){typeof sn=="object"?Fi.exports=sn=e(q(),qe(),ze(),Ie(),ee()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(sn,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,s=e.algo,a=[],o=[],i=[],c=[],l=[],u=[],d=[],f=[],h=[],p=[];(function(){for(var x=[],m=0;m<256;m++)m<128?x[m]=m<<1:x[m]=m<<1^283;for(var b=0,v=0,m=0;m<256;m++){var w=v^v<<1^v<<2^v<<3^v<<4;w=w>>>8^w&255^99,a[b]=w,o[w]=b;var C=x[b],O=x[C],B=x[O],k=x[w]*257^w*16843008;i[b]=k<<24|k>>>8,c[b]=k<<16|k>>>16,l[b]=k<<8|k>>>24,u[b]=k;var k=B*16843009^O*65537^C*257^b*16843008;d[w]=k<<24|k>>>8,f[w]=k<<16|k>>>16,h[w]=k<<8|k>>>24,p[w]=k,b?(b=C^x[x[x[B^C]]],v^=x[x[v]]):b=v=1}})();var g=[0,1,2,4,8,16,32,64,128,27,54],y=s.AES=n.extend({_doReset:function(){var x;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var m=this._keyPriorReset=this._key,b=m.words,v=m.sigBytes/4,w=this._nRounds=v+6,C=(w+1)*4,O=this._keySchedule=[],B=0;B<C;B++)B<v?O[B]=b[B]:(x=O[B-1],B%v?v>6&&B%v==4&&(x=a[x>>>24]<<24|a[x>>>16&255]<<16|a[x>>>8&255]<<8|a[x&255]):(x=x<<8|x>>>24,x=a[x>>>24]<<24|a[x>>>16&255]<<16|a[x>>>8&255]<<8|a[x&255],x^=g[B/v|0]<<24),O[B]=O[B-v]^x);for(var k=this._invKeySchedule=[],M=0;M<C;M++){var B=C-M;if(M%4)var x=O[B];else var x=O[B-4];M<4||B<=4?k[M]=x:k[M]=d[a[x>>>24]]^f[a[x>>>16&255]]^h[a[x>>>8&255]]^p[a[x&255]]}}},encryptBlock:function(x,m){this._doCryptBlock(x,m,this._keySchedule,i,c,l,u,a)},decryptBlock:function(x,m){var b=x[m+1];x[m+1]=x[m+3],x[m+3]=b,this._doCryptBlock(x,m,this._invKeySchedule,d,f,h,p,o);var b=x[m+1];x[m+1]=x[m+3],x[m+3]=b},_doCryptBlock:function(x,m,b,v,w,C,O,B){for(var k=this._nRounds,M=x[m]^b[0],E=x[m+1]^b[1],I=x[m+2]^b[2],P=x[m+3]^b[3],T=4,H=1;H<k;H++){var N=v[M>>>24]^w[E>>>16&255]^C[I>>>8&255]^O[P&255]^b[T++],j=v[E>>>24]^w[I>>>16&255]^C[P>>>8&255]^O[M&255]^b[T++],z=v[I>>>24]^w[P>>>16&255]^C[M>>>8&255]^O[E&255]^b[T++],S=v[P>>>24]^w[M>>>16&255]^C[E>>>8&255]^O[I&255]^b[T++];M=N,E=j,I=z,P=S}var N=(B[M>>>24]<<24|B[E>>>16&255]<<16|B[I>>>8&255]<<8|B[P&255])^b[T++],j=(B[E>>>24]<<24|B[I>>>16&255]<<16|B[P>>>8&255]<<8|B[M&255])^b[T++],z=(B[I>>>24]<<24|B[P>>>16&255]<<16|B[M>>>8&255]<<8|B[E&255])^b[T++],S=(B[P>>>24]<<24|B[M>>>16&255]<<16|B[E>>>8&255]<<8|B[I&255])^b[T++];x[m]=N,x[m+1]=j,x[m+2]=z,x[m+3]=S},keySize:256/32});e.AES=n._createHelper(y)}(),t.AES})});var Oi=W((an,ki)=>{"use strict";(function(t,e,r){typeof an=="object"?ki.exports=an=e(q(),qe(),ze(),Ie(),ee()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(an,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,s=r.BlockCipher,a=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],i=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=a.DES=s.extend({_doReset:function(){for(var g=this._key,y=g.words,x=[],m=0;m<56;m++){var b=o[m]-1;x[m]=y[b>>>5]>>>31-b%32&1}for(var v=this._subKeys=[],w=0;w<16;w++){for(var C=v[w]=[],O=c[w],m=0;m<24;m++)C[m/6|0]|=x[(i[m]-1+O)%28]<<31-m%6,C[4+(m/6|0)]|=x[28+(i[m+24]-1+O)%28]<<31-m%6;C[0]=C[0]<<1|C[0]>>>31;for(var m=1;m<7;m++)C[m]=C[m]>>>(m-1)*4+3;C[7]=C[7]<<5|C[7]>>>27}for(var B=this._invSubKeys=[],m=0;m<16;m++)B[m]=v[15-m]},encryptBlock:function(g,y){this._doCryptBlock(g,y,this._subKeys)},decryptBlock:function(g,y){this._doCryptBlock(g,y,this._invSubKeys)},_doCryptBlock:function(g,y,x){this._lBlock=g[y],this._rBlock=g[y+1],f.call(this,4,252645135),f.call(this,16,65535),h.call(this,2,858993459),h.call(this,8,16711935),f.call(this,1,1431655765);for(var m=0;m<16;m++){for(var b=x[m],v=this._lBlock,w=this._rBlock,C=0,O=0;O<8;O++)C|=l[O][((w^b[O])&u[O])>>>0];this._lBlock=w,this._rBlock=v^C}var B=this._lBlock;this._lBlock=this._rBlock,this._rBlock=B,f.call(this,1,1431655765),h.call(this,8,16711935),h.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),g[y]=this._lBlock,g[y+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function f(g,y){var x=(this._lBlock>>>g^this._rBlock)&y;this._rBlock^=x,this._lBlock^=x<<g}function h(g,y){var x=(this._rBlock>>>g^this._lBlock)&y;this._lBlock^=x,this._rBlock^=x<<g}e.DES=s._createHelper(d);var p=a.TripleDES=s.extend({_doReset:function(){var g=this._key,y=g.words;if(y.length!==2&&y.length!==4&&y.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var x=y.slice(0,2),m=y.length<4?y.slice(0,2):y.slice(2,4),b=y.length<6?y.slice(0,2):y.slice(4,6);this._des1=d.createEncryptor(n.create(x)),this._des2=d.createEncryptor(n.create(m)),this._des3=d.createEncryptor(n.create(b))},encryptBlock:function(g,y){this._des1.encryptBlock(g,y),this._des2.decryptBlock(g,y),this._des3.encryptBlock(g,y)},decryptBlock:function(g,y){this._des3.decryptBlock(g,y),this._des2.encryptBlock(g,y),this._des1.decryptBlock(g,y)},keySize:192/32,ivSize:64/32,blockSize:64/32});e.TripleDES=s._createHelper(p)}(),t.TripleDES})});var Mi=W((on,_i)=>{"use strict";(function(t,e,r){typeof on=="object"?_i.exports=on=e(q(),qe(),ze(),Ie(),ee()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(on,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,s=e.algo,a=s.RC4=n.extend({_doReset:function(){for(var c=this._key,l=c.words,u=c.sigBytes,d=this._S=[],f=0;f<256;f++)d[f]=f;for(var f=0,h=0;f<256;f++){var p=f%u,g=l[p>>>2]>>>24-p%4*8&255;h=(h+d[f]+g)%256;var y=d[f];d[f]=d[h],d[h]=y}this._i=this._j=0},_doProcessBlock:function(c,l){c[l]^=o.call(this)},keySize:256/32,ivSize:0});function o(){for(var c=this._S,l=this._i,u=this._j,d=0,f=0;f<4;f++){l=(l+1)%256,u=(u+c[l])%256;var h=c[l];c[l]=c[u],c[u]=h,d|=c[(c[l]+c[u])%256]<<24-f*8}return this._i=l,this._j=u,d}e.RC4=n._createHelper(a);var i=s.RC4Drop=a.extend({cfg:a.cfg.extend({drop:192}),_doReset:function(){a._doReset.call(this);for(var c=this.cfg.drop;c>0;c--)o.call(this)}});e.RC4Drop=n._createHelper(i)}(),t.RC4})});var Ni=W((cn,Pi)=>{"use strict";(function(t,e,r){typeof cn=="object"?Pi.exports=cn=e(q(),qe(),ze(),Ie(),ee()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(cn,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,s=e.algo,a=[],o=[],i=[],c=s.Rabbit=n.extend({_doReset:function(){for(var u=this._key.words,d=this.cfg.iv,f=0;f<4;f++)u[f]=(u[f]<<8|u[f]>>>24)&16711935|(u[f]<<24|u[f]>>>8)&4278255360;var h=this._X=[u[0],u[3]<<16|u[2]>>>16,u[1],u[0]<<16|u[3]>>>16,u[2],u[1]<<16|u[0]>>>16,u[3],u[2]<<16|u[1]>>>16],p=this._C=[u[2]<<16|u[2]>>>16,u[0]&4294901760|u[1]&65535,u[3]<<16|u[3]>>>16,u[1]&4294901760|u[2]&65535,u[0]<<16|u[0]>>>16,u[2]&4294901760|u[3]&65535,u[1]<<16|u[1]>>>16,u[3]&4294901760|u[0]&65535];this._b=0;for(var f=0;f<4;f++)l.call(this);for(var f=0;f<8;f++)p[f]^=h[f+4&7];if(d){var g=d.words,y=g[0],x=g[1],m=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,b=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,v=m>>>16|b&4294901760,w=b<<16|m&65535;p[0]^=m,p[1]^=v,p[2]^=b,p[3]^=w,p[4]^=m,p[5]^=v,p[6]^=b,p[7]^=w;for(var f=0;f<4;f++)l.call(this)}},_doProcessBlock:function(u,d){var f=this._X;l.call(this),a[0]=f[0]^f[5]>>>16^f[3]<<16,a[1]=f[2]^f[7]>>>16^f[5]<<16,a[2]=f[4]^f[1]>>>16^f[7]<<16,a[3]=f[6]^f[3]>>>16^f[1]<<16;for(var h=0;h<4;h++)a[h]=(a[h]<<8|a[h]>>>24)&16711935|(a[h]<<24|a[h]>>>8)&4278255360,u[d+h]^=a[h]},blockSize:128/32,ivSize:64/32});function l(){for(var u=this._X,d=this._C,f=0;f<8;f++)o[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<o[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<o[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<o[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<o[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<o[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<o[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<o[6]>>>0?1:0)|0,this._b=d[7]>>>0<o[7]>>>0?1:0;for(var f=0;f<8;f++){var h=u[f]+d[f],p=h&65535,g=h>>>16,y=((p*p>>>17)+p*g>>>15)+g*g,x=((h&4294901760)*h|0)+((h&65535)*h|0);i[f]=y^x}u[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,u[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,u[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,u[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,u[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,u[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,u[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,u[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}e.Rabbit=n._createHelper(c)}(),t.Rabbit})});var Hi=W((un,Ri)=>{"use strict";(function(t,e,r){typeof un=="object"?Ri.exports=un=e(q(),qe(),ze(),Ie(),ee()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(un,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,s=e.algo,a=[],o=[],i=[],c=s.RabbitLegacy=n.extend({_doReset:function(){var u=this._key.words,d=this.cfg.iv,f=this._X=[u[0],u[3]<<16|u[2]>>>16,u[1],u[0]<<16|u[3]>>>16,u[2],u[1]<<16|u[0]>>>16,u[3],u[2]<<16|u[1]>>>16],h=this._C=[u[2]<<16|u[2]>>>16,u[0]&4294901760|u[1]&65535,u[3]<<16|u[3]>>>16,u[1]&4294901760|u[2]&65535,u[0]<<16|u[0]>>>16,u[2]&4294901760|u[3]&65535,u[1]<<16|u[1]>>>16,u[3]&4294901760|u[0]&65535];this._b=0;for(var p=0;p<4;p++)l.call(this);for(var p=0;p<8;p++)h[p]^=f[p+4&7];if(d){var g=d.words,y=g[0],x=g[1],m=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,b=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,v=m>>>16|b&4294901760,w=b<<16|m&65535;h[0]^=m,h[1]^=v,h[2]^=b,h[3]^=w,h[4]^=m,h[5]^=v,h[6]^=b,h[7]^=w;for(var p=0;p<4;p++)l.call(this)}},_doProcessBlock:function(u,d){var f=this._X;l.call(this),a[0]=f[0]^f[5]>>>16^f[3]<<16,a[1]=f[2]^f[7]>>>16^f[5]<<16,a[2]=f[4]^f[1]>>>16^f[7]<<16,a[3]=f[6]^f[3]>>>16^f[1]<<16;for(var h=0;h<4;h++)a[h]=(a[h]<<8|a[h]>>>24)&16711935|(a[h]<<24|a[h]>>>8)&4278255360,u[d+h]^=a[h]},blockSize:128/32,ivSize:64/32});function l(){for(var u=this._X,d=this._C,f=0;f<8;f++)o[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<o[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<o[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<o[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<o[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<o[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<o[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<o[6]>>>0?1:0)|0,this._b=d[7]>>>0<o[7]>>>0?1:0;for(var f=0;f<8;f++){var h=u[f]+d[f],p=h&65535,g=h>>>16,y=((p*p>>>17)+p*g>>>15)+g*g,x=((h&4294901760)*h|0)+((h&65535)*h|0);i[f]=y^x}u[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,u[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,u[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,u[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,u[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,u[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,u[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,u[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}e.RabbitLegacy=n._createHelper(c)}(),t.RabbitLegacy})});var ji=W((ln,Wi)=>{"use strict";(function(t,e,r){typeof ln=="object"?Wi.exports=ln=e(q(),qe(),ze(),Ie(),ee()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(ln,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,s=e.algo;let a=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],i=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var c={pbox:[],sbox:[]};function l(p,g){let y=g>>24&255,x=g>>16&255,m=g>>8&255,b=g&255,v=p.sbox[0][y]+p.sbox[1][x];return v=v^p.sbox[2][m],v=v+p.sbox[3][b],v}function u(p,g,y){let x=g,m=y,b;for(let v=0;v<a;++v)x=x^p.pbox[v],m=l(p,x)^m,b=x,x=m,m=b;return b=x,x=m,m=b,m=m^p.pbox[a],x=x^p.pbox[a+1],{left:x,right:m}}function d(p,g,y){let x=g,m=y,b;for(let v=a+1;v>1;--v)x=x^p.pbox[v],m=l(p,x)^m,b=x,x=m,m=b;return b=x,x=m,m=b,m=m^p.pbox[1],x=x^p.pbox[0],{left:x,right:m}}function f(p,g,y){for(let w=0;w<4;w++){p.sbox[w]=[];for(let C=0;C<256;C++)p.sbox[w][C]=i[w][C]}let x=0;for(let w=0;w<a+2;w++)p.pbox[w]=o[w]^g[x],x++,x>=y&&(x=0);let m=0,b=0,v=0;for(let w=0;w<a+2;w+=2)v=u(p,m,b),m=v.left,b=v.right,p.pbox[w]=m,p.pbox[w+1]=b;for(let w=0;w<4;w++)for(let C=0;C<256;C+=2)v=u(p,m,b),m=v.left,b=v.right,p.sbox[w][C]=m,p.sbox[w][C+1]=b;return!0}var h=s.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var p=this._keyPriorReset=this._key,g=p.words,y=p.sigBytes/4;f(c,g,y)}},encryptBlock:function(p,g){var y=u(c,p[g],p[g+1]);p[g]=y.left,p[g+1]=y.right},decryptBlock:function(p,g){var y=d(c,p[g],p[g+1]);p[g]=y.left,p[g+1]=y.right},blockSize:64/32,keySize:128/32,ivSize:64/32});e.Blowfish=n._createHelper(h)}(),t.Blowfish})});var qi=W((fn,Li)=>{"use strict";(function(t,e,r){typeof fn=="object"?Li.exports=fn=e(q(),Rt(),Ha(),ja(),qe(),za(),ze(),rs(),Nr(),$a(),ns(),Ja(),Qa(),ti(),zr(),si(),Ie(),ee(),ci(),li(),di(),xi(),pi(),yi(),bi(),Ci(),Si(),Di(),Bi(),Ii(),Oi(),Mi(),Ni(),Hi(),ji()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./enc-base64url","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy","./blowfish"],e):t.CryptoJS=e(t.CryptoJS)})(fn,function(t){return t})});var Ui=W((Eh,zi)=>{"use strict";zi.exports=t=>{if(Object.prototype.toString.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}});var Gi=W((Sh,Vi)=>{"use strict";var ss=Ui();Vi.exports=(t,e={})=>{if(!ss(t)&&!Array.isArray(t))throw new TypeError("Expected a plain object or array");let{deep:r}=e,n=[],s=[],a=i=>{let c=n.indexOf(i);if(c!==-1)return s[c];let l=[];return n.push(i),s.push(l),l.push(...i.map(u=>Array.isArray(u)?a(u):ss(u)?o(u):u)),l},o=i=>{let c=n.indexOf(i);if(c!==-1)return s[c];let l={},u=Object.keys(i).sort(e.compare);n.push(i),s.push(l);for(let d of u){let f=i[d],h;r&&Array.isArray(f)?h=a(f):h=r&&ss(f)?o(f):f,Object.defineProperty(l,d,{...Object.getOwnPropertyDescriptor(i,d),value:h})}return l};return Array.isArray(t)?r?a(t):t.slice():o(t)}});var Zi=W((Ah,$i)=>{"use strict";var Au=Object.prototype.toString;$i.exports=function(e){if(e===void 0)return"undefined";if(e===null)return"null";var r=typeof e;if(r==="boolean")return"boolean";if(r==="string")return"string";if(r==="number")return"number";if(r==="symbol")return"symbol";if(r==="function")return Iu(e)?"generatorfunction":"function";if(Du(e))return"array";if(_u(e))return"buffer";if(Ou(e))return"arguments";if(Bu(e))return"date";if(Tu(e))return"error";if(Fu(e))return"regexp";switch(Ki(e)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(ku(e))return"generator";switch(r=Au.call(e),r){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return r.slice(8,-1).toLowerCase().replace(/\s/g,"")};function Ki(t){return typeof t.constructor=="function"?t.constructor.name:null}function Du(t){return Array.isArray?Array.isArray(t):t instanceof Array}function Tu(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function Bu(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function Fu(t){return t instanceof RegExp?!0:typeof t.flags=="string"&&typeof t.ignoreCase=="boolean"&&typeof t.multiline=="boolean"&&typeof t.global=="boolean"}function Iu(t,e){return Ki(t)==="GeneratorFunction"}function ku(t){return typeof t.throw=="function"&&typeof t.return=="function"&&typeof t.next=="function"}function Ou(t){try{if(typeof t.length=="number"&&typeof t.callee=="function")return!0}catch(e){if(e.message.indexOf("callee")!==-1)return!0}return!1}function _u(t){return t.constructor&&typeof t.constructor.isBuffer=="function"?t.constructor.isBuffer(t):!1}});var dt=W((Dh,Qi)=>{"use strict";var Mu=Gi(),as=Zi(),Yi=(t,e)=>!e||as(e)!=="array"?!1:e.indexOf(t)>-1,Pu=(t,e)=>Mu(t,{compare:e}),Ji=(t,e)=>{let r=e&&e.compareFunction;return t.slice().sort(r)};function Xi(t,e){let r=e&&e.compareFunction,n=Pu(t,r);return Object.keys(t).forEach(function(s){let a=n[s],o=as(a);if(o==="object"){(!e||!Yi(s,e.ignoreObjectAtKeys))&&(n[s]=Xi(a,e));return}o==="array"&&(!e||!Yi(s,e.ignoreArrayAtKeys))&&(n[s]=Ji(a,e))}),n}var Ht=(t,e)=>{let r=as(t);return Ht[r]?Ht[r](t,e):t};Ht.array=Ji;Ht.object=Xi;Qi.exports=Ht});import{Ed25519PublicKey as e0}from"@mysten/sui.js/keypairs/ed25519";import{MultiSigPublicKey as Nu}from"@mysten/sui.js/multisig";import{SIGNATURE_FLAG_TO_SCHEME as Ih,parseSerializedSignature as kh}from"@mysten/sui.js/cryptography";import{Ed25519PublicKey as _h}from"@mysten/sui.js/keypairs/ed25519";import{Secp256k1PublicKey as Ph}from"@mysten/sui.js/keypairs/secp256k1";import{Secp256r1PublicKey as Rh}from"@mysten/sui.js/keypairs/secp256r1";import{MultiSigPublicKey as Wh}from"@mysten/sui.js/multisig";import{verifyPersonalMessage as Lh,verifyTransactionBlock as qh}from"@mysten/sui.js/verify";import{SIGNATURE_FLAG_TO_SCHEME as t0}from"@mysten/sui.js/cryptography";import{Ed25519PublicKey as Hu}from"@mysten/sui.js/keypairs/ed25519";import{Secp256k1PublicKey as Wu}from"@mysten/sui.js/keypairs/secp256k1";import{Secp256r1PublicKey as ju}from"@mysten/sui.js/keypairs/secp256r1";import{fromB64 as Lu}from"@mysten/sui.js/utils";import{Buffer as s0}from"buffer";import{normalizeStructTag as is,normalizeSuiAddress as r0}from"@mysten/sui.js/utils";import{TransactionBlock as Wt}from"@mysten/sui.js/transactions";import{bcs as Xh}from"@mysten/sui.js/bcs";import{normalizeSuiAddress as ex,normalizeSuiObjectId as tx,normalizeStructTag as rx}from"@mysten/sui.js/utils";import{normalizeStructTag as sx}from"@mysten/sui.js/utils";import{normalizeSuiAddress as Yu}from"@mysten/sui.js/utils";function pu(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function gu(t,...e){if(!pu(t))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function Qn(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Fa(t,e){gu(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}function Ia(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var Ar=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),we=(t,e)=>t<<32-e|t>>>e,yu=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!yu)throw new Error("Non little-endian hardware is not supported");var vu=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function ka(t){if(!Ia(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=vu[t[r]];return e}function bu(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function es(t){if(typeof t=="string"&&(t=bu(t)),!Ia(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}var Sr=class{clone(){return this._cloneInto()}},dh={}.toString;function Oa(t){let e=n=>t().update(es(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function wu(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let s=BigInt(32),a=BigInt(4294967295),o=Number(r>>s&a),i=Number(r&a),c=n?4:0,l=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+l,i,n)}var Dr=class extends Sr{constructor(e,r,n,s){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Ar(this.buffer)}update(e){Qn(this);let{view:r,buffer:n,blockLen:s}=this;e=es(e);let a=e.length;for(let o=0;o<a;){let i=Math.min(s-this.pos,a-o);if(i===s){let c=Ar(e);for(;s<=a-o;o+=s)this.process(c,o);continue}n.set(e.subarray(o,o+i),this.pos),this.pos+=i,o+=i,this.pos===s&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Qn(this),Fa(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:s,isLE:a}=this,{pos:o}=this;r[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(n,0),o=0);for(let d=o;d<s;d++)r[d]=0;wu(n,s-8,BigInt(this.length*8),a),this.process(n,0);let i=Ar(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=c/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)i.setUint32(4*d,u[d],a)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:s,finished:a,destroyed:o,pos:i}=this;return e.length=s,e.pos=i,e.finished=a,e.destroyed=o,s%r&&e.buffer.set(n),e}};var Cu=(t,e,r)=>t&e^~t&r,Eu=(t,e,r)=>t&e^t&r^e&r,Su=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),je=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Le=new Uint32Array(64),ts=class extends Dr{constructor(){super(64,32,8,!1),this.A=je[0]|0,this.B=je[1]|0,this.C=je[2]|0,this.D=je[3]|0,this.E=je[4]|0,this.F=je[5]|0,this.G=je[6]|0,this.H=je[7]|0}get(){let{A:e,B:r,C:n,D:s,E:a,F:o,G:i,H:c}=this;return[e,r,n,s,a,o,i,c]}set(e,r,n,s,a,o,i,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=s|0,this.E=a|0,this.F=o|0,this.G=i|0,this.H=c|0}process(e,r){for(let d=0;d<16;d++,r+=4)Le[d]=e.getUint32(r,!1);for(let d=16;d<64;d++){let f=Le[d-15],h=Le[d-2],p=we(f,7)^we(f,18)^f>>>3,g=we(h,17)^we(h,19)^h>>>10;Le[d]=g+Le[d-7]+p+Le[d-16]|0}let{A:n,B:s,C:a,D:o,E:i,F:c,G:l,H:u}=this;for(let d=0;d<64;d++){let f=we(i,6)^we(i,11)^we(i,25),h=u+f+Cu(i,c,l)+Su[d]+Le[d]|0,g=(we(n,2)^we(n,13)^we(n,22))+Eu(n,s,a)|0;u=l,l=c,c=i,i=o+h|0,o=a,a=s,s=n,n=h+g|0}n=n+this.A|0,s=s+this.B|0,a=a+this.C|0,o=o+this.D|0,i=i+this.E|0,c=c+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(n,s,a,o,i,c,l,u)}roundClean(){Le.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var _a=Oa(()=>new ts);var c0=ft(qi(),1),u0=ft(dt(),1);var Ju=ft(dt(),1),ke={minWeight:0,maxWeight:255,maxOwnerWithNonce:9,maxOwnerWithoutNonce:10,nonce:{prefix:"maven",weight:1,maxSize:16}},Ru="0x2::sui::SUI";var dn=class n0{constructor(e){this.config=e,n0.validate(e),this.publicKey=this.toMultisigPublicKey(e)}publicKey;get address(){return this.publicKey.toSuiAddress()}get publicKeys(){return this.publicKey.getPublicKeys()}combinePartialSignatures(e){return this.publicKey.combinePartialSignatures(e)}toMultisigPublicKey(e){let{ownersWithWeight:r,threshold:n,creationNonce:s}=e,a=r.map(o=>({...o}));return s!==void 0&&a.push({publicKey:this.makeNoncePublicKey(s),weight:ke.nonce.weight}),Nu.fromPublicKeys({threshold:n,publicKeys:a})}makeNoncePublicKey(e){let r=new ArrayBuffer(e0.SIZE);return new TextEncoder().encodeInto(ke.nonce.prefix,new Uint8Array(r,0,ke.nonce.maxSize)),new DataView(r,ke.nonce.maxSize,4).setUint32(0,e,!0),new e0(new Uint8Array(r))}static validate(e){e.ownersWithWeight.forEach(a=>{let{weight:o}=a;if(o<ke.minWeight||o>ke.maxWeight)throw new Error(`Invalid weight: ${o} (1-${ke.maxWeight})`)});let r=e.ownersWithWeight.reduce((a,o)=>a+o.weight,0);if(e.threshold<1||e.threshold>r)throw new Error(`Invalid threshold: ${e.threshold} (1-${r})`);let n=e.creationNonce===void 0?ke.maxOwnerWithoutNonce:ke.maxOwnerWithNonce;if(e.ownersWithWeight.length>n)throw new Error("Owner number bigger than upper capacity");if(new Set(e.ownersWithWeight.map(a=>a.publicKey.toSuiAddress())).size!==e.ownersWithWeight.length)throw new Error("Duplicate address detected")}},Ue=class{static ser(t){return{publicKeyEncoded:t.toBase64(),schema:t0[t.flag()]}}static de(t){let e=typeof t.publicKeyEncoded=="string"?Lu(t.publicKeyEncoded):t.publicKeyEncoded,{schema:r}=t;switch((e.length===34||t.schema==="ED25519"&&e.length===33)&&(e[0]===0||e[0]===1||e[0]===2)&&(r=t0[e[0]],e=e.slice(1)),r){case"ED25519":return new Hu(e);case"Secp256k1":return new Wu(e);case"Secp256r1":return new ju(e);default:throw new Error("Unsupported signature scheme: $input.scheme")}}};function Be(t,e){return r0(t)===r0(e)}function a0(t,e){return is(t)===is(e)}function qu(t){return is(t).startsWith("0x2::coin::Coin")}function zu(t){return s0.from(t,"utf-8")}function Uu(t){return Uint8Array.from(s0.from(t.startsWith("0x")?t.slice(2):t,"hex"))}async function Vu(t,e,r){let n=!0,s,a=[];for(;n;){let o=await t.getCoins({owner:e,coinType:r,cursor:s});a.push(...o.data),n=o.hasNextPage,s=o.nextCursor}return a}function cs(t,e){let n=Wt.from(Uu(e)).blockData.gasConfig.payment;if(!n)throw new Error("No gas payment found for approve payload");let s=new Wt;return s.setSender(t),s.setGasPayment(n),s}async function i0(t,e,r){return a0(e.coinType,Ru)?Gu(e,r):Ku(t,e,r)}function Gu(t,e){let r=new Wt,[n]=r.splitCoins(r.gas,[r.pure(t.amount)]);return r.transferObjects([n],r.pure(t.recipient)),r.setSender(e),r}async function Ku(t,e,r){let n=await Vu(t,r,e.coinType);if(n.length===0)throw new Error("No valid coin found to send");if(n.reduce((c,l)=>c+BigInt(l.balance),0n)<BigInt(e.amount))throw new Error("Not enough balance");let a=new Wt,o=a.object(n[0].coinObjectId);n.length>1&&a.mergeCoins(o,n.slice(1).map(c=>a.object(c.coinObjectId)));let[i]=a.splitCoins(o,[a.pure(e.amount)]);return a.transferObjects([i],a.pure(e.recipient)),a.setSender(r),a}async function o0(t,e,r){await $u(t,e,r);let n=new Wt;return n.transferObjects([n.object(e.objectId)],n.pure(e.receiver)),n.setSender(r),n}async function $u(t,e,r){let n=await t.getObject({id:e.objectId,options:{showType:!0,showOwner:!0}});if(n.data===void 0)throw new Error("Object not found");if(!n.data?.type)throw new Error("Object type is null");if(!a0(n.data.type,e.objectType))throw new Error("Object type not expected");if(qu(n.data.type))throw new Error("Can not transfer coin object in Object Transfer transactions");let s=Zu(n);if(!Be(s,r))throw new Error("Object owner not match")}function Zu(t){let e=t.data?.owner;if(!e)throw new Error("Object Owner not found");if(typeof e!="object"||!("AddressOwner"in e))throw new Error("Invalid object owner");return e.AddressOwner}var jt=(t=>(t.active="ACTIVE",t.pending="PENDING",t.ignored="IGNORED",t))(jt||{}),Oe="msafe-core",X=(t=>(t.Assets="Assets",t.NFT="NFT",t.Account="Account",t.Swap="Swap",t.Staking="Staking",t.Bridge="Bridge",t.Ending="Ending",t.Stream="Stream",t.Other="Other",t))(X||{}),le={assets:{coin:{send:"SendCoin",receive:"ReceiveCoin"},object:{send:"SendObject",receive:"ReceiveObject"}},account:{creation:"CreateAccount"},others:{plain:"PlainTransaction"},stream:{create:"CreateStream",claim:"Claim",claimByProxy:"ClaimByProxy",setAutoClaim:"SetAutoClaim",cancel:"Cancel"}};var _e=class os{static createMSafeMessage(e){return`Create MSafe Account: ${e}`}static loginMessageWithTimestamp(e){return`Welcome to MSafe. ${e}`}static loginMessage(){return os.loginMessageWithTimestamp(new Date().toUTCString())}static decodeLoginMessageTimestamp(e){let r=/Welcome to MSafe. (.+)/,n=e.match(r);return n?n[1]:void 0}static proposeIntentionMessage(e){let r=(0,u0.default)(e),n=JSON.stringify(r),s=_a(n),a=ka(s);return`Submit a new transaction proposal [${e.sn}]: ${a}`}static updateAddressBookMessage(e){let r=e.map(o=>({...o,address:Yu(o.address)})).map(o=>os.sortObjectKeys(o)),n=JSON.stringify(r,null,2);return zu(n).length<=1e3?`Address book entry update: ${n}`:`Bulk address book update: ${(0,c0.MD5)(n)}`}static sortObjectKeys(e){return Object.keys(e).sort().reduce((r,n)=>({...r,[n]:e[n]}),{})}};var Lt=class{constructor(e,r){this.globals=e;this.pkHelper=r}async getPublicKeyBatch(e){return this.pkHelper.getPublicKeyBatch(e)}async calculateMSafeAddress(e){let r=await this.reduceCreationInfoToRawConfig(e);return new dn(r).address}async validateCreateInfo(e){return this.calculateMSafeAddress(e)}addPublicKey(e,r){let n=Ue.de(r);if(!Be(e,n.toSuiAddress()))throw new Error("Public key not match");this.pkHelper.addPublicKey(e,n)}async submitMSafeCreation(e){let r=await this.validateCreateInfo(e),n=_e.createMSafeMessage(r),s=await this.globals.wallet.signPersonalMessage({messageStr:n});return await this.submitToBackend(e,s.signature),r}async reduceCreationInfoToRawConfig(e){let r=await this.getPublicKeyBatch(e.owners.map(n=>n.address));return r.forEach((n,s)=>{if(n===void 0)throw new Error(`Unknown public key for address: ${e.owners[s].address}`)}),{threshold:e.threshold,ownersWithWeight:e.owners.map((n,s)=>({publicKey:r[s],weight:n.weight})),creationNonce:e.creationNonce}}async submitToBackend(e,r){let n=await this.pkHelper.getPublicKeyBatch(e.owners.map(s=>s.address));await this.globals.backend.createMSafeAccount({owners:e.owners.map((s,a)=>({address:s.address,weight:s.weight,...Ue.ser(n[a])})),threshold:e.threshold,name:e.name,description:e.description,creationNonce:e.creationNonce,signature:r})}};var qt=class{constructor(e){this.globals=e}async getEntries(e){return this.globals.backend.getAddressBookEntries(e)}async update(e){let r=_e.updateAddressBookMessage(e),n=await this.globals.wallet.signPersonalMessage({messageStr:r});return this.globals.backend.updateAddressBook({updates:e,signature:n.signature})}async getMode(){return(await this.globals.backend.getAddressBookMode()).mode}async setMode(e){return this.globals.backend.setAddressBookMode({mode:e})}};var hn=class{constructor(e){this.globals=e}async getMSafeByStatus(e,r){return this.globals.backend.getOwnedMSafeByStatus({status:e,pagination:r})}async updateMSafeStatus(e,r){return this.globals.backend.updateMSafeStatus({msafeAddress:e,status:r})}};import{SuiClient as Nf}from"@mysten/sui.js/client";import Tt,{AxiosError as Wf}from"axios";import{SUI_TYPE_ARG as Lf,normalizeStructTag as qf,normalizeSuiAddress as Eo}from"@mysten/sui.js/utils";import{normalizeStructTag as Ys,SUI_TYPE_ARG as zf}from"@mysten/sui.js/utils";var Me=class extends Error{},xn=class extends Me{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},mn=class extends Me{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},pn=class extends Me{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Ce=class extends Me{},ht=class extends Me{constructor(e){super(`Invalid unit ${e}`)}},Q=class extends Me{},Ee=class extends Me{constructor(){super("Zone is an abstract class")}};var _="numeric",Se="short",fe="long",Ve={year:_,month:_,day:_},zt={year:_,month:Se,day:_},us={year:_,month:Se,day:_,weekday:Se},Ut={year:_,month:fe,day:_},Vt={year:_,month:fe,day:_,weekday:fe},Gt={hour:_,minute:_},Kt={hour:_,minute:_,second:_},$t={hour:_,minute:_,second:_,timeZoneName:Se},Zt={hour:_,minute:_,second:_,timeZoneName:fe},Yt={hour:_,minute:_,hourCycle:"h23"},Jt={hour:_,minute:_,second:_,hourCycle:"h23"},Xt={hour:_,minute:_,second:_,hourCycle:"h23",timeZoneName:Se},Qt={hour:_,minute:_,second:_,hourCycle:"h23",timeZoneName:fe},er={year:_,month:_,day:_,hour:_,minute:_},tr={year:_,month:_,day:_,hour:_,minute:_,second:_},rr={year:_,month:Se,day:_,hour:_,minute:_},nr={year:_,month:Se,day:_,hour:_,minute:_,second:_},ls={year:_,month:Se,day:_,weekday:Se,hour:_,minute:_},sr={year:_,month:fe,day:_,hour:_,minute:_,timeZoneName:Se},ar={year:_,month:fe,day:_,hour:_,minute:_,second:_,timeZoneName:Se},ir={year:_,month:fe,day:_,weekday:fe,hour:_,minute:_,timeZoneName:fe},or={year:_,month:fe,day:_,weekday:fe,hour:_,minute:_,second:_,timeZoneName:fe};var oe=class{get type(){throw new Ee}get name(){throw new Ee}get ianaName(){return this.name}get isUniversal(){throw new Ee}offsetName(e,r){throw new Ee}formatOffset(e,r){throw new Ee}offset(e){throw new Ee}equals(e){throw new Ee}get isValid(){throw new Ee}};var fs=null,Ge=class t extends oe{static get instance(){return fs===null&&(fs=new t),fs}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return yn(e,r,n)}formatOffset(e,r){return Ke(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var bn={};function Xu(t){return bn[t]||(bn[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),bn[t]}var Qu={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function el(t,e){let r=t.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,s,a,o,i,c,l,u]=n;return[o,s,a,i,c,l,u]}function tl(t,e){let r=t.formatToParts(e),n=[];for(let s=0;s<r.length;s++){let{type:a,value:o}=r[s],i=Qu[a];a==="era"?n[i]=o:R(i)||(n[i]=parseInt(o,10))}return n}var vn={},ae=class t extends oe{static create(e){return vn[e]||(vn[e]=new t(e)),vn[e]}static resetCache(){vn={},bn={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=t.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return yn(e,r,n,this.name)}formatOffset(e,r){return Ke(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=Xu(this.name),[s,a,o,i,c,l,u]=n.formatToParts?tl(n,r):el(n,r);i==="BC"&&(s=-Math.abs(s)+1);let f=xt({year:s,month:a,day:o,hour:c===24?0:c,minute:l,second:u,millisecond:0}),h=+r,p=h%1e3;return h-=p>=0?p:1e3+p,(f-h)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};var l0={};function rl(t,e={}){let r=JSON.stringify([t,e]),n=l0[r];return n||(n=new Intl.ListFormat(t,e),l0[r]=n),n}var ds={};function hs(t,e={}){let r=JSON.stringify([t,e]),n=ds[r];return n||(n=new Intl.DateTimeFormat(t,e),ds[r]=n),n}var xs={};function nl(t,e={}){let r=JSON.stringify([t,e]),n=xs[r];return n||(n=new Intl.NumberFormat(t,e),xs[r]=n),n}var ms={};function sl(t,e={}){let{base:r,...n}=e,s=JSON.stringify([t,n]),a=ms[s];return a||(a=new Intl.RelativeTimeFormat(t,e),ms[s]=a),a}var cr=null;function al(){return cr||(cr=new Intl.DateTimeFormat().resolvedOptions().locale,cr)}var f0={};function il(t){let e=f0[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,f0[t]=e}return e}function ol(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let r=t.indexOf("-u-");if(r===-1)return[t];{let n,s;try{n=hs(t).resolvedOptions(),s=t}catch{let c=t.substring(0,r);n=hs(c).resolvedOptions(),s=c}let{numberingSystem:a,calendar:o}=n;return[s,a,o]}}function cl(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function ul(t){let e=[];for(let r=1;r<=12;r++){let n=U.utc(2009,r,1);e.push(t(n))}return e}function ll(t){let e=[];for(let r=1;r<=7;r++){let n=U.utc(2016,11,13+r);e.push(t(n))}return e}function wn(t,e,r,n){let s=t.listingMode();return s==="error"?null:s==="en"?r(e):n(e)}function fl(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem==="latn"}var ps=class{constructor(e,r,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:s,floor:a,...o}=n;if(!r||Object.keys(o).length>0){let i={useGrouping:!1,...n};n.padTo>0&&(i.minimumIntegerDigits=n.padTo),this.inf=nl(e,i)}}format(e){if(this.inf){let r=this.floor?Math.floor(e):e;return this.inf.format(r)}else{let r=this.floor?Math.floor(e):mt(e,3);return J(r,this.padTo)}}},gs=class{constructor(e,r,n){this.opts=n,this.originalZone=void 0;let s;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let o=-1*(e.offset/60),i=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&ae.create(i).valid?(s=i,this.dt=e):(s="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,s=e.zone.name):(s="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let a={...this.opts};a.timeZone=a.timeZone||s,this.dtf=hs(r,a)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(r=>{if(r.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...r,value:n}}else return r}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},ys=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&Cn()&&(this.rtf=sl(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):d0(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},dl={firstDay:1,minimalDays:4,weekend:[6,7]},K=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,r,n,s,a=!1){let o=e||V.defaultLocale,i=o||(a?"en-US":al()),c=r||V.defaultNumberingSystem,l=n||V.defaultOutputCalendar,u=ur(s)||V.defaultWeekSettings;return new t(i,c,l,u,o)}static resetCache(){cr=null,ds={},xs={},ms={}}static fromObject({locale:e,numberingSystem:r,outputCalendar:n,weekSettings:s}={}){return t.create(e,r,n,s)}constructor(e,r,n,s,a){let[o,i,c]=ol(e);this.locale=o,this.numberingSystem=r||i||null,this.outputCalendar=n||c||null,this.weekSettings=s,this.intl=cl(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=a,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=fl(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),r=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&r?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:t.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,ur(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,r=!1){return wn(this,e,vs,()=>{let n=r?{month:e,day:"numeric"}:{month:e},s=r?"format":"standalone";return this.monthsCache[s][e]||(this.monthsCache[s][e]=ul(a=>this.extract(a,n,"month"))),this.monthsCache[s][e]})}weekdays(e,r=!1){return wn(this,e,bs,()=>{let n=r?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},s=r?"format":"standalone";return this.weekdaysCache[s][e]||(this.weekdaysCache[s][e]=ll(a=>this.extract(a,n,"weekday"))),this.weekdaysCache[s][e]})}meridiems(){return wn(this,void 0,()=>ws,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[U.utc(2016,11,13,9),U.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return wn(this,e,Cs,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[U.utc(-40,1,1),U.utc(2017,1,1)].map(n=>this.extract(n,r,"era"))),this.eraCache[e]})}extract(e,r,n){let s=this.dtFormatter(e,r),a=s.formatToParts(),o=a.find(i=>i.type.toLowerCase()===n);return o?o.value:null}numberFormatter(e={}){return new ps(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new gs(e,this.intl,r)}relFormatter(e={}){return new ys(this.intl,this.isEnglish(),e)}listFormatter(e={}){return rl(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:En()?il(this.locale):dl}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}};var Ss=null,te=class t extends oe{static get utcInstance(){return Ss===null&&(Ss=new t(0)),Ss}static instance(e){return e===0?t.utcInstance:new t(e)}static parseSpecifier(e){if(e){let r=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(r)return new t(tt(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Ke(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Ke(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return Ke(this.fixed,r)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}};var pt=class extends oe{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function Ae(t,e){let r;if(R(t)||t===null)return e;if(t instanceof oe)return t;if(h0(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?Ge.instance:n==="utc"||n==="gmt"?te.utcInstance:te.parseSpecifier(n)||ae.create(t)}else return Fe(t)?te.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new pt(t)}var x0=()=>Date.now(),m0="system",p0=null,g0=null,y0=null,v0=60,b0,w0=null,V=class{static get now(){return x0}static set now(e){x0=e}static set defaultZone(e){m0=e}static get defaultZone(){return Ae(m0,Ge.instance)}static get defaultLocale(){return p0}static set defaultLocale(e){p0=e}static get defaultNumberingSystem(){return g0}static set defaultNumberingSystem(e){g0=e}static get defaultOutputCalendar(){return y0}static set defaultOutputCalendar(e){y0=e}static get defaultWeekSettings(){return w0}static set defaultWeekSettings(e){w0=ur(e)}static get twoDigitCutoffYear(){return v0}static set twoDigitCutoffYear(e){v0=e%100}static get throwOnInvalid(){return b0}static set throwOnInvalid(e){b0=e}static resetCaches(){K.resetCache(),ae.resetCache()}};var re=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var C0=[0,31,59,90,120,151,181,212,243,273,304,334],E0=[0,31,60,91,121,152,182,213,244,274,305,335];function pe(t,e){return new re("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Sn(t,e,r){let n=new Date(Date.UTC(t,e-1,r));t<100&&t>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let s=n.getUTCDay();return s===0?7:s}function S0(t,e,r){return r+(nt(t)?E0:C0)[e-1]}function A0(t,e){let r=nt(t)?E0:C0,n=r.findIndex(a=>a<e),s=e-r[n];return{month:n+1,day:s}}function An(t,e){return(t-e+7)%7+1}function lr(t,e=4,r=1){let{year:n,month:s,day:a}=t,o=S0(n,s,a),i=An(Sn(n,s,a),r),c=Math.floor((o-i+14-e)/7),l;return c<1?(l=n-1,c=rt(l,e,r)):c>rt(n,e,r)?(l=n+1,c=1):l=n,{weekYear:l,weekNumber:c,weekday:i,...dr(t)}}function As(t,e=4,r=1){let{weekYear:n,weekNumber:s,weekday:a}=t,o=An(Sn(n,1,e),r),i=$e(n),c=s*7+a-o-7+e,l;c<1?(l=n-1,c+=$e(l)):c>i?(l=n+1,c-=$e(n)):l=n;let{month:u,day:d}=A0(l,c);return{year:l,month:u,day:d,...dr(t)}}function Dn(t){let{year:e,month:r,day:n}=t,s=S0(e,r,n);return{year:e,ordinal:s,...dr(t)}}function Ds(t){let{year:e,ordinal:r}=t,{month:n,day:s}=A0(e,r);return{year:e,month:n,day:s,...dr(t)}}function Ts(t,e){if(!R(t.localWeekday)||!R(t.localWeekNumber)||!R(t.localWeekYear)){if(!R(t.weekday)||!R(t.weekNumber)||!R(t.weekYear))throw new Ce("Cannot mix locale-based week fields with ISO-based week fields");return R(t.localWeekday)||(t.weekday=t.localWeekday),R(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),R(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function D0(t,e=4,r=1){let n=fr(t.weekYear),s=de(t.weekNumber,1,rt(t.weekYear,e,r)),a=de(t.weekday,1,7);return n?s?a?!1:pe("weekday",t.weekday):pe("week",t.weekNumber):pe("weekYear",t.weekYear)}function T0(t){let e=fr(t.year),r=de(t.ordinal,1,$e(t.year));return e?r?!1:pe("ordinal",t.ordinal):pe("year",t.year)}function Bs(t){let e=fr(t.year),r=de(t.month,1,12),n=de(t.day,1,gt(t.year,t.month));return e?r?n?!1:pe("day",t.day):pe("month",t.month):pe("year",t.year)}function Fs(t){let{hour:e,minute:r,second:n,millisecond:s}=t,a=de(e,0,23)||e===24&&r===0&&n===0&&s===0,o=de(r,0,59),i=de(n,0,59),c=de(s,0,999);return a?o?i?c?!1:pe("millisecond",s):pe("second",n):pe("minute",r):pe("hour",e)}function R(t){return typeof t>"u"}function Fe(t){return typeof t=="number"}function fr(t){return typeof t=="number"&&t%1===0}function h0(t){return typeof t=="string"}function F0(t){return Object.prototype.toString.call(t)==="[object Date]"}function Cn(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function En(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function I0(t){return Array.isArray(t)?t:[t]}function Is(t,e,r){if(t.length!==0)return t.reduce((n,s)=>{let a=[e(s),s];return n&&r(n[0],a[0])===n[0]?n:a},null)[1]}function k0(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function Ze(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ur(t){if(t==null)return null;if(typeof t!="object")throw new Q("Week settings must be an object");if(!de(t.firstDay,1,7)||!de(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!de(e,1,7)))throw new Q("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function de(t,e,r){return fr(t)&&t>=e&&t<=r}function hl(t,e){return t-e*Math.floor(t/e)}function J(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function Pe(t){if(!(R(t)||t===null||t===""))return parseInt(t,10)}function Ye(t){if(!(R(t)||t===null||t===""))return parseFloat(t)}function hr(t){if(!(R(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function mt(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function nt(t){return t%4===0&&(t%100!==0||t%400===0)}function $e(t){return nt(t)?366:365}function gt(t,e){let r=hl(e-1,12)+1,n=t+(e-r)/12;return r===2?nt(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function xt(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function B0(t,e,r){return-An(Sn(t,1,e),r)+e-1}function rt(t,e=4,r=1){let n=B0(t,e,r),s=B0(t+1,e,r);return($e(t)-n+s)/7}function xr(t){return t>99?t:t>V.twoDigitCutoffYear?1900+t:2e3+t}function yn(t,e,r,n=null){let s=new Date(t),a={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(a.timeZone=n);let o={timeZoneName:e,...a},i=new Intl.DateTimeFormat(r,o).formatToParts(s).find(c=>c.type.toLowerCase()==="timezonename");return i?i.value:null}function tt(t,e){let r=parseInt(t,10);Number.isNaN(r)&&(r=0);let n=parseInt(e,10)||0,s=r<0||Object.is(r,-0)?-n:n;return r*60+s}function ks(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Q(`Invalid unit value ${t}`);return e}function yt(t,e){let r={};for(let n in t)if(Ze(t,n)){let s=t[n];if(s==null)continue;r[e(n)]=ks(s)}return r}function Ke(t,e){let r=Math.trunc(Math.abs(t/60)),n=Math.trunc(Math.abs(t%60)),s=t>=0?"+":"-";switch(e){case"short":return`${s}${J(r,2)}:${J(n,2)}`;case"narrow":return`${s}${r}${n>0?`:${n}`:""}`;case"techie":return`${s}${J(r,2)}${J(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function dr(t){return k0(t,["hour","minute","second","millisecond"])}var xl=["January","February","March","April","May","June","July","August","September","October","November","December"],Os=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ml=["J","F","M","A","M","J","J","A","S","O","N","D"];function vs(t){switch(t){case"narrow":return[...ml];case"short":return[...Os];case"long":return[...xl];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var _s=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ms=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],pl=["M","T","W","T","F","S","S"];function bs(t){switch(t){case"narrow":return[...pl];case"short":return[...Ms];case"long":return[..._s];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var ws=["AM","PM"],gl=["Before Christ","Anno Domini"],yl=["BC","AD"],vl=["B","A"];function Cs(t){switch(t){case"narrow":return[...vl];case"short":return[...yl];case"long":return[...gl];default:return null}}function O0(t){return ws[t.hour<12?0:1]}function _0(t,e){return bs(e)[t.weekday-1]}function M0(t,e){return vs(e)[t.month-1]}function P0(t,e){return Cs(e)[t.year<0?0:1]}function d0(t,e,r="always",n=!1){let s={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},a=["hours","minutes","seconds"].indexOf(t)===-1;if(r==="auto"&&a){let d=t==="days";switch(e){case 1:return d?"tomorrow":`next ${s[t][0]}`;case-1:return d?"yesterday":`last ${s[t][0]}`;case 0:return d?"today":`this ${s[t][0]}`;default:}}let o=Object.is(e,-0)||e<0,i=Math.abs(e),c=i===1,l=s[t],u=n?c?l[1]:l[2]||l[1]:c?s[t][0]:t;return o?`${i} ${u} ago`:`in ${i} ${u}`}function N0(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var bl={D:Ve,DD:zt,DDD:Ut,DDDD:Vt,t:Gt,tt:Kt,ttt:$t,tttt:Zt,T:Yt,TT:Jt,TTT:Xt,TTTT:Qt,f:er,ff:rr,fff:sr,ffff:ir,F:tr,FF:nr,FFF:ar,FFFF:or},ne=class t{static create(e,r={}){return new t(e,r)}static parseFormat(e){let r=null,n="",s=!1,a=[];for(let o=0;o<e.length;o++){let i=e.charAt(o);i==="'"?(n.length>0&&a.push({literal:s||/^\s+$/.test(n),val:n}),r=null,n="",s=!s):s||i===r?n+=i:(n.length>0&&a.push({literal:/^\s+$/.test(n),val:n}),n=i,r=i)}return n.length>0&&a.push({literal:s||/^\s+$/.test(n),val:n}),a}static macroTokenToFormatOpts(e){return bl[e]}constructor(e,r){this.opts=r,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,r){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...r}).format()}dtFormatter(e,r={}){return this.loc.dtFormatter(e,{...this.opts,...r})}formatDateTime(e,r){return this.dtFormatter(e,r).format()}formatDateTimeParts(e,r){return this.dtFormatter(e,r).formatToParts()}formatInterval(e,r){return this.dtFormatter(e.start,r).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,r){return this.dtFormatter(e,r).resolvedOptions()}num(e,r=0){if(this.opts.forceSimple)return J(e,r);let n={...this.opts};return r>0&&(n.padTo=r),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,r){let n=this.loc.listingMode()==="en",s=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",a=(h,p)=>this.loc.extract(e,h,p),o=h=>e.isOffsetFixed&&e.offset===0&&h.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,h.format):"",i=()=>n?O0(e):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(h,p)=>n?M0(e,h):a(p?{month:h}:{month:h,day:"numeric"},"month"),l=(h,p)=>n?_0(e,h):a(p?{weekday:h}:{weekday:h,month:"long",day:"numeric"},"weekday"),u=h=>{let p=t.macroTokenToFormatOpts(h);return p?this.formatWithSystemDefault(e,p):h},d=h=>n?P0(e,h):a({era:h},"era"),f=h=>{switch(h){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return i();case"d":return s?a({day:"numeric"},"day"):this.num(e.day);case"dd":return s?a({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return s?a({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return s?a({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return c("short",!0);case"LLLL":return c("long",!0);case"LLLLL":return c("narrow",!0);case"M":return s?a({month:"numeric"},"month"):this.num(e.month);case"MM":return s?a({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return c("short",!1);case"MMMM":return c("long",!1);case"MMMMM":return c("narrow",!1);case"y":return s?a({year:"numeric"},"year"):this.num(e.year);case"yy":return s?a({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return s?a({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return s?a({year:"numeric"},"year"):this.num(e.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return u(h)}};return N0(t.parseFormat(r),f)}formatDurationFromString(e,r){let n=c=>{switch(c[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},s=c=>l=>{let u=n(l);return u?this.num(c.get(u),l.length):l},a=t.parseFormat(r),o=a.reduce((c,{literal:l,val:u})=>l?c:c.concat(u),[]),i=e.shiftTo(...o.map(n).filter(c=>c));return N0(a,s(i))}};var H0=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function bt(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function wt(...t){return e=>t.reduce(([r,n,s],a)=>{let[o,i,c]=a(e,s);return[{...r,...o},i||n,c]},[{},null,1]).slice(0,2)}function Ct(t,...e){if(t==null)return[null,null];for(let[r,n]of e){let s=r.exec(t);if(s)return n(s)}return[null,null]}function W0(...t){return(e,r)=>{let n={},s;for(s=0;s<t.length;s++)n[t[s]]=Pe(e[r+s]);return[n,null,r+s]}}var j0=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,wl=`(?:${j0.source}?(?:\\[(${H0.source})\\])?)?`,Ps=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,L0=RegExp(`${Ps.source}${wl}`),Ns=RegExp(`(?:T${L0.source})?`),Cl=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,El=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Sl=/(\d{4})-?(\d{3})/,Al=W0("weekYear","weekNumber","weekDay"),Dl=W0("year","ordinal"),Tl=/(\d{4})-(\d\d)-(\d\d)/,q0=RegExp(`${Ps.source} ?(?:${j0.source}|(${H0.source}))?`),Bl=RegExp(`(?: ${q0.source})?`);function vt(t,e,r){let n=t[e];return R(n)?r:Pe(n)}function Fl(t,e){return[{year:vt(t,e),month:vt(t,e+1,1),day:vt(t,e+2,1)},null,e+3]}function Et(t,e){return[{hours:vt(t,e,0),minutes:vt(t,e+1,0),seconds:vt(t,e+2,0),milliseconds:hr(t[e+3])},null,e+4]}function mr(t,e){let r=!t[e]&&!t[e+1],n=tt(t[e+1],t[e+2]),s=r?null:te.instance(n);return[{},s,e+3]}function pr(t,e){let r=t[e]?ae.create(t[e]):null;return[{},r,e+1]}var Il=RegExp(`^T?${Ps.source}$`),kl=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Ol(t){let[e,r,n,s,a,o,i,c,l]=t,u=e[0]==="-",d=c&&c[0]==="-",f=(h,p=!1)=>h!==void 0&&(p||h&&u)?-h:h;return[{years:f(Ye(r)),months:f(Ye(n)),weeks:f(Ye(s)),days:f(Ye(a)),hours:f(Ye(o)),minutes:f(Ye(i)),seconds:f(Ye(c),c==="-0"),milliseconds:f(hr(l),d)}]}var _l={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Rs(t,e,r,n,s,a,o){let i={year:e.length===2?xr(Pe(e)):Pe(e),month:Os.indexOf(r)+1,day:Pe(n),hour:Pe(s),minute:Pe(a)};return o&&(i.second=Pe(o)),t&&(i.weekday=t.length>3?_s.indexOf(t)+1:Ms.indexOf(t)+1),i}var Ml=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Pl(t){let[,e,r,n,s,a,o,i,c,l,u,d]=t,f=Rs(e,s,n,r,a,o,i),h;return c?h=_l[c]:l?h=0:h=tt(u,d),[f,new te(h)]}function Nl(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var Rl=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Hl=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Wl=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function R0(t){let[,e,r,n,s,a,o,i]=t;return[Rs(e,s,n,r,a,o,i),te.utcInstance]}function jl(t){let[,e,r,n,s,a,o,i]=t;return[Rs(e,i,r,n,s,a,o),te.utcInstance]}var Ll=bt(Cl,Ns),ql=bt(El,Ns),zl=bt(Sl,Ns),Ul=bt(L0),z0=wt(Fl,Et,mr,pr),Vl=wt(Al,Et,mr,pr),Gl=wt(Dl,Et,mr,pr),Kl=wt(Et,mr,pr);function U0(t){return Ct(t,[Ll,z0],[ql,Vl],[zl,Gl],[Ul,Kl])}function V0(t){return Ct(Nl(t),[Ml,Pl])}function G0(t){return Ct(t,[Rl,R0],[Hl,R0],[Wl,jl])}function K0(t){return Ct(t,[kl,Ol])}var $l=wt(Et);function $0(t){return Ct(t,[Il,$l])}var Zl=bt(Tl,Bl),Yl=bt(q0),Jl=wt(Et,mr,pr);function Z0(t){return Ct(t,[Zl,z0],[Yl,Jl])}var Y0="Invalid Duration",X0={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Xl={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...X0},ge=146097/400,St=146097/4800,Ql={years:{quarters:4,months:12,weeks:ge/7,days:ge,hours:ge*24,minutes:ge*24*60,seconds:ge*24*60*60,milliseconds:ge*24*60*60*1e3},quarters:{months:3,weeks:ge/28,days:ge/4,hours:ge*24/4,minutes:ge*24*60/4,seconds:ge*24*60*60/4,milliseconds:ge*24*60*60*1e3/4},months:{weeks:St/7,days:St,hours:St*24,minutes:St*24*60,seconds:St*24*60*60,milliseconds:St*24*60*60*1e3},...X0},st=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],ef=st.slice(0).reverse();function Je(t,e,r=!1){let n={values:r?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new $(n)}function Q0(t,e){let r=e.milliseconds??0;for(let n of ef.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function J0(t,e){let r=Q0(t,e)<0?-1:1;st.reduceRight((n,s)=>{if(R(e[s]))return n;if(n){let a=e[n]*r,o=t[s][n],i=Math.floor(a/o);e[s]+=i*r,e[n]-=i*o*r}return s},null),st.reduce((n,s)=>{if(R(e[s]))return n;if(n){let a=e[n]%1;e[n]-=a,e[s]+=a*t[n][s]}return s},null)}function tf(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var $=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?Ql:Xl;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||K.create(),this.conversionAccuracy=r?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,r){return t.fromObject({milliseconds:e},r)}static fromObject(e,r={}){if(e==null||typeof e!="object")throw new Q(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:yt(e,t.normalizeUnit),loc:K.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(Fe(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Q(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=K0(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,r){let[n]=$0(e);return n?t.fromObject(n,r):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,r=null){if(!e)throw new Q("need to specify a reason the Duration is invalid");let n=e instanceof re?e:new re(e,r);if(V.throwOnInvalid)throw new pn(n);return new t({invalid:n})}static normalizeUnit(e){let r={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!r)throw new ht(e);return r}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,r={}){let n={...r,floor:r.round!==!1&&r.floor!==!1};return this.isValid?ne.create(this.loc,n).formatDurationFromString(this,e):Y0}toHuman(e={}){if(!this.isValid)return Y0;let r=st.map(n=>{let s=this.values[n];return R(s)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(s)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(r)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=mt(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let r=this.toMillis();return r<0||r>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},U.fromMillis(r,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Q0(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e),n={};for(let s of st)(Ze(r.values,s)||Ze(this.values,s))&&(n[s]=r.get(s)+this.get(s));return Je(this,{values:n},!0)}minus(e){if(!this.isValid)return this;let r=t.fromDurationLike(e);return this.plus(r.negate())}mapUnits(e){if(!this.isValid)return this;let r={};for(let n of Object.keys(this.values))r[n]=ks(e(this.values[n],n));return Je(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...yt(e,t.normalizeUnit)};return Je(this,{values:r})}reconfigure({locale:e,numberingSystem:r,conversionAccuracy:n,matrix:s}={}){let o={loc:this.loc.clone({locale:e,numberingSystem:r}),matrix:s,conversionAccuracy:n};return Je(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return J0(this.matrix,e),Je(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=tf(this.normalize().shiftToAll().toObject());return Je(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>t.normalizeUnit(o));let r={},n={},s=this.toObject(),a;for(let o of st)if(e.indexOf(o)>=0){a=o;let i=0;for(let l in n)i+=this.matrix[l][o]*n[l],n[l]=0;Fe(s[o])&&(i+=s[o]);let c=Math.trunc(i);r[o]=c,n[o]=(i*1e3-c*1e3)/1e3}else Fe(s[o])&&(n[o]=s[o]);for(let o in n)n[o]!==0&&(r[a]+=o===a?n[o]:n[o]/this.matrix[a][o]);return J0(this.matrix,r),Je(this,{values:r},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let r of Object.keys(this.values))e[r]=this.values[r]===0?0:-this.values[r];return Je(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function r(n,s){return n===void 0||n===0?s===void 0||s===0:n===s}for(let n of st)if(!r(this.values[n],e.values[n]))return!1;return!0}};var At="Invalid Interval";function rf(t,e){return!t||!t.isValid?Ne.invalid("missing or invalid start"):!e||!e.isValid?Ne.invalid("missing or invalid end"):e<t?Ne.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null}var Ne=class t{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,r=null){if(!e)throw new Q("need to specify a reason the Interval is invalid");let n=e instanceof re?e:new re(e,r);if(V.throwOnInvalid)throw new mn(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=Dt(e),s=Dt(r),a=rf(n,s);return a??new t({start:n,end:s})}static after(e,r){let n=$.fromDurationLike(r),s=Dt(e);return t.fromDateTimes(s,s.plus(n))}static before(e,r){let n=$.fromDurationLike(r),s=Dt(e);return t.fromDateTimes(s.minus(n),s)}static fromISO(e,r){let[n,s]=(e||"").split("/",2);if(n&&s){let a,o;try{a=U.fromISO(n,r),o=a.isValid}catch{o=!1}let i,c;try{i=U.fromISO(s,r),c=i.isValid}catch{c=!1}if(o&&c)return t.fromDateTimes(a,i);if(o){let l=$.fromISO(s,r);if(l.isValid)return t.after(a,l)}else if(c){let l=$.fromISO(n,r);if(l.isValid)return t.before(i,l)}}return t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",r){if(!this.isValid)return NaN;let n=this.start.startOf(e,r),s;return r?.useLocaleWeeks?s=this.end.reconfigure({locale:n.locale}):s=this.end,s=s.startOf(e,r),Math.floor(s.diff(n,e).get(e))+(s.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:r}={}){return this.isValid?t.fromDateTimes(e||this.s,r||this.e):this}splitAt(...e){if(!this.isValid)return[];let r=e.map(Dt).filter(o=>this.contains(o)).sort((o,i)=>o.toMillis()-i.toMillis()),n=[],{s}=this,a=0;for(;s<this.e;){let o=r[a]||this.e,i=+o>+this.e?this.e:o;n.push(t.fromDateTimes(s,i)),s=i,a+=1}return n}splitBy(e){let r=$.fromDurationLike(e);if(!this.isValid||!r.isValid||r.as("milliseconds")===0)return[];let{s:n}=this,s=1,a,o=[];for(;n<this.e;){let i=this.start.plus(r.mapUnits(c=>c*s));a=+i>+this.e?this.e:i,o.push(t.fromDateTimes(n,a)),n=a,s+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let r=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return r>=n?null:t.fromDateTimes(r,n)}union(e){if(!this.isValid)return this;let r=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return t.fromDateTimes(r,n)}static merge(e){let[r,n]=e.sort((s,a)=>s.s-a.s).reduce(([s,a],o)=>a?a.overlaps(o)||a.abutsStart(o)?[s,a.union(o)]:[s.concat([a]),o]:[s,o],[[],null]);return n&&r.push(n),r}static xor(e){let r=null,n=0,s=[],a=e.map(c=>[{time:c.s,type:"s"},{time:c.e,type:"e"}]),o=Array.prototype.concat(...a),i=o.sort((c,l)=>c.time-l.time);for(let c of i)n+=c.type==="s"?1:-1,n===1?r=c.time:(r&&+r!=+c.time&&s.push(t.fromDateTimes(r,c.time)),r=null);return t.merge(s)}difference(...e){return t.xor([this].concat(e)).map(r=>this.intersection(r)).filter(r=>r&&!r.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:At}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Ve,r={}){return this.isValid?ne.create(this.s.loc.clone(r),e).formatInterval(this):At}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:At}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:At}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:At}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:At}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):$.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var Re=class{static hasDST(e=V.defaultZone){let r=U.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return ae.isValidZone(e)}static normalizeZone(e){return Ae(e,V.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||K.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||K.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||K.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:s=null,outputCalendar:a="gregory"}={}){return(s||K.create(r,n,a)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:s=null,outputCalendar:a="gregory"}={}){return(s||K.create(r,n,a)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:s=null}={}){return(s||K.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:s=null}={}){return(s||K.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return K.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return K.create(r,null,"gregory").eras(e)}static features(){return{relative:Cn(),localeWeek:En()}}};function eo(t,e){let r=s=>s.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor($.fromMillis(n).as("days"))}function nf(t,e,r){let n=[["years",(c,l)=>l.year-c.year],["quarters",(c,l)=>l.quarter-c.quarter+(l.year-c.year)*4],["months",(c,l)=>l.month-c.month+(l.year-c.year)*12],["weeks",(c,l)=>{let u=eo(c,l);return(u-u%7)/7}],["days",eo]],s={},a=t,o,i;for(let[c,l]of n)r.indexOf(c)>=0&&(o=c,s[c]=l(t,e),i=a.plus(s),i>e?(s[c]--,t=a.plus(s),t>e&&(i=t,s[c]--,t=a.plus(s))):t=i);return[t,s,i,o]}function to(t,e,r,n){let[s,a,o,i]=nf(t,e,r),c=e-s,l=r.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);l.length===0&&(o<e&&(o=s.plus({[i]:1})),o!==s&&(a[i]=(a[i]||0)+c/(o-s)));let u=$.fromObject(a,n);return l.length>0?$.fromMillis(c,n).shiftTo(...l).plus(u):u}var Hs={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},ro={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},sf=Hs.hanidec.replace(/[\[|\]]/g,"").split("");function no(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r);if(t[r].search(Hs.hanidec)!==-1)e+=sf.indexOf(t[r]);else for(let s in ro){let[a,o]=ro[s];n>=a&&n<=o&&(e+=n-a)}}return parseInt(e,10)}else return e}function ye({numberingSystem:t},e=""){return new RegExp(`${Hs[t||"latn"]}${e}`)}var af="missing Intl.DateTimeFormat.formatToParts support";function G(t,e=r=>r){return{regex:t,deser:([r])=>e(no(r))}}var of="\xA0",io=`[ ${of}]`,oo=new RegExp(io,"g");function cf(t){return t.replace(/\./g,"\\.?").replace(oo,io)}function so(t){return t.replace(/\./g,"").replace(oo," ").toLowerCase()}function De(t,e){return t===null?null:{regex:RegExp(t.map(cf).join("|")),deser:([r])=>t.findIndex(n=>so(r)===so(n))+e}}function ao(t,e){return{regex:t,deser:([,r,n])=>tt(r,n),groups:e}}function Tn(t){return{regex:t,deser:([e])=>e}}function uf(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function lf(t,e){let r=ye(e),n=ye(e,"{2}"),s=ye(e,"{3}"),a=ye(e,"{4}"),o=ye(e,"{6}"),i=ye(e,"{1,2}"),c=ye(e,"{1,3}"),l=ye(e,"{1,6}"),u=ye(e,"{1,9}"),d=ye(e,"{2,4}"),f=ye(e,"{4,6}"),h=y=>({regex:RegExp(uf(y.val)),deser:([x])=>x,literal:!0}),g=(y=>{if(t.literal)return h(y);switch(y.val){case"G":return De(e.eras("short"),0);case"GG":return De(e.eras("long"),0);case"y":return G(l);case"yy":return G(d,xr);case"yyyy":return G(a);case"yyyyy":return G(f);case"yyyyyy":return G(o);case"M":return G(i);case"MM":return G(n);case"MMM":return De(e.months("short",!0),1);case"MMMM":return De(e.months("long",!0),1);case"L":return G(i);case"LL":return G(n);case"LLL":return De(e.months("short",!1),1);case"LLLL":return De(e.months("long",!1),1);case"d":return G(i);case"dd":return G(n);case"o":return G(c);case"ooo":return G(s);case"HH":return G(n);case"H":return G(i);case"hh":return G(n);case"h":return G(i);case"mm":return G(n);case"m":return G(i);case"q":return G(i);case"qq":return G(n);case"s":return G(i);case"ss":return G(n);case"S":return G(c);case"SSS":return G(s);case"u":return Tn(u);case"uu":return Tn(i);case"uuu":return G(r);case"a":return De(e.meridiems(),0);case"kkkk":return G(a);case"kk":return G(d,xr);case"W":return G(i);case"WW":return G(n);case"E":case"c":return G(r);case"EEE":return De(e.weekdays("short",!1),1);case"EEEE":return De(e.weekdays("long",!1),1);case"ccc":return De(e.weekdays("short",!0),1);case"cccc":return De(e.weekdays("long",!0),1);case"Z":case"ZZ":return ao(new RegExp(`([+-]${i.source})(?::(${n.source}))?`),2);case"ZZZ":return ao(new RegExp(`([+-]${i.source})(${n.source})?`),2);case"z":return Tn(/[a-z_+-/]{1,256}?/i);case" ":return Tn(/[^\S\n\r]/);default:return h(y)}})(t)||{invalidReason:af};return g.token=t,g}var ff={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function df(t,e,r){let{type:n,value:s}=t;if(n==="literal"){let c=/^\s+$/.test(s);return{literal:!c,val:c?" ":s}}let a=e[n],o=n;n==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=r.hour12?"hour12":"hour24");let i=ff[o];if(typeof i=="object"&&(i=i[a]),i)return{literal:!1,val:i}}function hf(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function xf(t,e,r){let n=t.match(e);if(n){let s={},a=1;for(let o in r)if(Ze(r,o)){let i=r[o],c=i.groups?i.groups+1:1;!i.literal&&i.token&&(s[i.token.val[0]]=i.deser(n.slice(a,a+c))),a+=c}return[n,s]}else return[n,{}]}function mf(t){let e=a=>{switch(a){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},r=null,n;return R(t.z)||(r=ae.create(t.z)),R(t.Z)||(r||(r=new te(t.Z)),n=t.Z),R(t.q)||(t.M=(t.q-1)*3+1),R(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),R(t.u)||(t.S=hr(t.u)),[Object.keys(t).reduce((a,o)=>{let i=e(o);return i&&(a[i]=t[o]),a},{}),r,n]}var Ws=null;function pf(){return Ws||(Ws=U.fromMillis(1555555555555)),Ws}function gf(t,e){if(t.literal)return t;let r=ne.macroTokenToFormatOpts(t.val),n=qs(r,e);return n==null||n.includes(void 0)?t:n}function js(t,e){return Array.prototype.concat(...t.map(r=>gf(r,e)))}function Ls(t,e,r){let n=js(ne.parseFormat(r),t),s=n.map(o=>lf(o,t)),a=s.find(o=>o.invalidReason);if(a)return{input:e,tokens:n,invalidReason:a.invalidReason};{let[o,i]=hf(s),c=RegExp(o,"i"),[l,u]=xf(e,c,i),[d,f,h]=u?mf(u):[null,null,void 0];if(Ze(u,"a")&&Ze(u,"H"))throw new Ce("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:n,regex:c,rawMatches:l,matches:u,result:d,zone:f,specificOffset:h}}}function co(t,e,r){let{result:n,zone:s,specificOffset:a,invalidReason:o}=Ls(t,e,r);return[n,s,a,o]}function qs(t,e){if(!t)return null;let n=ne.create(e,t).dtFormatter(pf()),s=n.formatToParts(),a=n.resolvedOptions();return s.map(o=>df(o,t,a))}var zs="Invalid DateTime",uo=864e13;function Bn(t){return new re("unsupported zone",`the zone "${t.name}" is not supported`)}function Us(t){return t.weekData===null&&(t.weekData=lr(t.c)),t.weekData}function Vs(t){return t.localWeekData===null&&(t.localWeekData=lr(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function at(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new U({...r,...e,old:r})}function go(t,e,r){let n=t-e*60*1e3,s=r.offset(n);if(e===s)return[n,e];n-=(s-e)*60*1e3;let a=r.offset(n);return s===a?[n,s]:[t-Math.min(s,a)*60*1e3,Math.max(s,a)]}function Fn(t,e){t+=e*60*1e3;let r=new Date(t);return{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate(),hour:r.getUTCHours(),minute:r.getUTCMinutes(),second:r.getUTCSeconds(),millisecond:r.getUTCMilliseconds()}}function kn(t,e,r){return go(xt(t),e,r)}function lo(t,e){let r=t.o,n=t.c.year+Math.trunc(e.years),s=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,a={...t.c,year:n,month:s,day:Math.min(t.c.day,gt(n,s))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=$.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),i=xt(a),[c,l]=go(i,r,t.zone);return o!==0&&(c+=o,l=t.zone.offset(c)),{ts:c,o:l}}function gr(t,e,r,n,s,a){let{setZone:o,zone:i}=r;if(t&&Object.keys(t).length!==0||e){let c=e||i,l=U.fromObject(t,{...r,zone:c,specificOffset:a});return o?l:l.setZone(i)}else return U.invalid(new re("unparsable",`the input "${s}" can't be parsed as ${n}`))}function In(t,e,r=!0){return t.isValid?ne.create(K.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Gs(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=J(t.c.year,r?6:4),e?(n+="-",n+=J(t.c.month),n+="-",n+=J(t.c.day)):(n+=J(t.c.month),n+=J(t.c.day)),n}function fo(t,e,r,n,s,a){let o=J(t.c.hour);return e?(o+=":",o+=J(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(o+=":")):o+=J(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(o+=J(t.c.second),(t.c.millisecond!==0||!n)&&(o+=".",o+=J(t.c.millisecond,3))),s&&(t.isOffsetFixed&&t.offset===0&&!a?o+="Z":t.o<0?(o+="-",o+=J(Math.trunc(-t.o/60)),o+=":",o+=J(Math.trunc(-t.o%60))):(o+="+",o+=J(Math.trunc(t.o/60)),o+=":",o+=J(Math.trunc(t.o%60)))),a&&(o+="["+t.zone.ianaName+"]"),o}var yo={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},yf={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},vf={ordinal:1,hour:0,minute:0,second:0,millisecond:0},vo=["year","month","day","hour","minute","second","millisecond"],bf=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],wf=["year","ordinal","hour","minute","second","millisecond"];function Cf(t){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new ht(t);return e}function ho(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Cf(t)}}function xo(t,e){let r=Ae(e.zone,V.defaultZone),n=K.fromObject(e),s=V.now(),a,o;if(R(t.year))a=s;else{for(let l of vo)R(t[l])&&(t[l]=yo[l]);let i=Bs(t)||Fs(t);if(i)return U.invalid(i);let c=r.offset(s);[a,o]=kn(t,c,r)}return new U({ts:a,zone:r,loc:n,o})}function mo(t,e,r){let n=R(r.round)?!0:r.round,s=(o,i)=>(o=mt(o,n||r.calendary?0:2,!0),e.loc.clone(r).relFormatter(r).format(o,i)),a=o=>r.calendary?e.hasSame(t,o)?0:e.startOf(o).diff(t.startOf(o),o).get(o):e.diff(t,o).get(o);if(r.unit)return s(a(r.unit),r.unit);for(let o of r.units){let i=a(o);if(Math.abs(i)>=1)return s(i,o)}return s(t>e?-0:0,r.units[r.units.length-1])}function po(t){let e={},r;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],r=Array.from(t).slice(0,t.length-1)):r=Array.from(t),[e,r]}var U=class t{constructor(e){let r=e.zone||V.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new re("invalid input"):null)||(r.isValid?null:Bn(r));this.ts=R(e.ts)?V.now():e.ts;let s=null,a=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(r))[s,a]=[e.old.c,e.old.o];else{let i=r.offset(this.ts);s=Fn(this.ts,i),n=Number.isNaN(s.year)?new re("invalid input"):null,s=n?null:s,a=n?null:i}this._zone=r,this.loc=e.loc||K.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=s,this.o=a,this.isLuxonDateTime=!0}static now(){return new t({})}static local(){let[e,r]=po(arguments),[n,s,a,o,i,c,l]=r;return xo({year:n,month:s,day:a,hour:o,minute:i,second:c,millisecond:l},e)}static utc(){let[e,r]=po(arguments),[n,s,a,o,i,c,l]=r;return e.zone=te.utcInstance,xo({year:n,month:s,day:a,hour:o,minute:i,second:c,millisecond:l},e)}static fromJSDate(e,r={}){let n=F0(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let s=Ae(r.zone,V.defaultZone);return s.isValid?new t({ts:n,zone:s,loc:K.fromObject(r)}):t.invalid(Bn(s))}static fromMillis(e,r={}){if(Fe(e))return e<-uo||e>uo?t.invalid("Timestamp out of range"):new t({ts:e,zone:Ae(r.zone,V.defaultZone),loc:K.fromObject(r)});throw new Q(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(Fe(e))return new t({ts:e*1e3,zone:Ae(r.zone,V.defaultZone),loc:K.fromObject(r)});throw new Q("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=Ae(r.zone,V.defaultZone);if(!n.isValid)return t.invalid(Bn(n));let s=K.fromObject(r),a=yt(e,ho),{minDaysInFirstWeek:o,startOfWeek:i}=Ts(a,s),c=V.now(),l=R(r.specificOffset)?n.offset(c):r.specificOffset,u=!R(a.ordinal),d=!R(a.year),f=!R(a.month)||!R(a.day),h=d||f,p=a.weekYear||a.weekNumber;if((h||u)&&p)throw new Ce("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&u)throw new Ce("Can't mix ordinal dates with month/day");let g=p||a.weekday&&!h,y,x,m=Fn(c,l);g?(y=bf,x=yf,m=lr(m,o,i)):u?(y=wf,x=vf,m=Dn(m)):(y=vo,x=yo);let b=!1;for(let M of y){let E=a[M];R(E)?b?a[M]=x[M]:a[M]=m[M]:b=!0}let v=g?D0(a,o,i):u?T0(a):Bs(a),w=v||Fs(a);if(w)return t.invalid(w);let C=g?As(a,o,i):u?Ds(a):a,[O,B]=kn(C,l,n),k=new t({ts:O,zone:n,o:B,loc:s});return a.weekday&&h&&e.weekday!==k.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${a.weekday} and a date of ${k.toISO()}`):k}static fromISO(e,r={}){let[n,s]=U0(e);return gr(n,s,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,s]=V0(e);return gr(n,s,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,s]=G0(e);return gr(n,s,r,"HTTP",r)}static fromFormat(e,r,n={}){if(R(e)||R(r))throw new Q("fromFormat requires an input string and a format");let{locale:s=null,numberingSystem:a=null}=n,o=K.fromOpts({locale:s,numberingSystem:a,defaultToEN:!0}),[i,c,l,u]=co(o,e,r);return u?t.invalid(u):gr(i,c,n,`format ${r}`,e,l)}static fromString(e,r,n={}){return t.fromFormat(e,r,n)}static fromSQL(e,r={}){let[n,s]=Z0(e);return gr(n,s,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Q("need to specify a reason the DateTime is invalid");let n=e instanceof re?e:new re(e,r);if(V.throwOnInvalid)throw new xn(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=qs(e,K.fromObject(r));return n?n.map(s=>s?s.val:null).join(""):null}static expandFormat(e,r={}){return js(ne.parseFormat(e),K.fromObject(r)).map(s=>s.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Us(this).weekYear:NaN}get weekNumber(){return this.isValid?Us(this).weekNumber:NaN}get weekday(){return this.isValid?Us(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Vs(this).weekday:NaN}get localWeekNumber(){return this.isValid?Vs(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Vs(this).weekYear:NaN}get ordinal(){return this.isValid?Dn(this.c).ordinal:NaN}get monthShort(){return this.isValid?Re.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Re.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Re.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Re.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,r=6e4,n=xt(this.c),s=this.zone.offset(n-e),a=this.zone.offset(n+e),o=this.zone.offset(n-s*r),i=this.zone.offset(n-a*r);if(o===i)return[this];let c=n-o*r,l=n-i*r,u=Fn(c,o),d=Fn(l,i);return u.hour===d.hour&&u.minute===d.minute&&u.second===d.second&&u.millisecond===d.millisecond?[at(this,{ts:c}),at(this,{ts:l})]:[this]}get isInLeapYear(){return nt(this.year)}get daysInMonth(){return gt(this.year,this.month)}get daysInYear(){return this.isValid?$e(this.year):NaN}get weeksInWeekYear(){return this.isValid?rt(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?rt(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:s}=ne.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:s}}toUTC(e=0,r={}){return this.setZone(te.instance(e),r)}toLocal(){return this.setZone(V.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=Ae(e,V.defaultZone),e.equals(this.zone))return this;if(e.isValid){let s=this.ts;if(r||n){let a=e.offset(this.ts),o=this.toObject();[s]=kn(o,a,e)}return at(this,{ts:s,zone:e})}else return t.invalid(Bn(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let s=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return at(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=yt(e,ho),{minDaysInFirstWeek:n,startOfWeek:s}=Ts(r,this.loc),a=!R(r.weekYear)||!R(r.weekNumber)||!R(r.weekday),o=!R(r.ordinal),i=!R(r.year),c=!R(r.month)||!R(r.day),l=i||c,u=r.weekYear||r.weekNumber;if((l||o)&&u)throw new Ce("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&o)throw new Ce("Can't mix ordinal dates with month/day");let d;a?d=As({...lr(this.c,n,s),...r},n,s):R(r.ordinal)?(d={...this.toObject(),...r},R(r.day)&&(d.day=Math.min(gt(d.year,d.month),d.day))):d=Ds({...Dn(this.c),...r});let[f,h]=kn(d,this.o,this.zone);return at(this,{ts:f,o:h})}plus(e){if(!this.isValid)return this;let r=$.fromDurationLike(e);return at(this,lo(this,r))}minus(e){if(!this.isValid)return this;let r=$.fromDurationLike(e).negate();return at(this,lo(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},s=$.normalizeUnit(e);switch(s){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break;case"milliseconds":break}if(s==="weeks")if(r){let a=this.loc.getStartOfWeek(),{weekday:o}=this;o<a&&(n.weekNumber=this.weekNumber-1),n.weekday=a}else n.weekday=1;if(s==="quarters"){let a=Math.ceil(this.month/3);n.month=(a-1)*3+1}return this.set(n)}endOf(e,r){return this.isValid?this.plus({[e]:1}).startOf(e,r).minus(1):this}toFormat(e,r={}){return this.isValid?ne.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):zs}toLocaleString(e=Ve,r={}){return this.isValid?ne.create(this.loc.clone(r),e).formatDateTime(this):zs}toLocaleParts(e={}){return this.isValid?ne.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:r=!1,suppressMilliseconds:n=!1,includeOffset:s=!0,extendedZone:a=!1}={}){if(!this.isValid)return null;let o=e==="extended",i=Gs(this,o);return i+="T",i+=fo(this,o,r,n,s,a),i}toISODate({format:e="extended"}={}){return this.isValid?Gs(this,e==="extended"):null}toISOWeekDate(){return In(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:r=!1,includeOffset:n=!0,includePrefix:s=!1,extendedZone:a=!1,format:o="extended"}={}){return this.isValid?(s?"T":"")+fo(this,o==="extended",r,e,n,a):null}toRFC2822(){return In(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return In(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Gs(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:r=!1,includeOffsetSpace:n=!0}={}){let s="HH:mm:ss.SSS";return(r||e)&&(n&&(s+=" "),r?s+="z":e&&(s+="ZZ")),In(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():zs}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let r={...this.c};return e.includeConfig&&(r.outputCalendar=this.outputCalendar,r.numberingSystem=this.loc.numberingSystem,r.locale=this.loc.locale),r}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,r="milliseconds",n={}){if(!this.isValid||!e.isValid)return $.invalid("created by diffing an invalid DateTime");let s={locale:this.locale,numberingSystem:this.numberingSystem,...n},a=I0(r).map($.normalizeUnit),o=e.valueOf()>this.valueOf(),i=o?this:e,c=o?e:this,l=to(i,c,a,s);return o?l.negate():l}diffNow(e="milliseconds",r={}){return this.diff(t.now(),e,r)}until(e){return this.isValid?Ne.fromDateTimes(this,e):this}hasSame(e,r,n){if(!this.isValid)return!1;let s=e.valueOf(),a=this.setZone(e.zone,{keepLocalTime:!0});return a.startOf(r,n)<=s&&s<=a.endOf(r,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let r=e.base||t.fromObject({},{zone:this.zone}),n=e.padding?this<r?-e.padding:e.padding:0,s=["years","months","days","hours","minutes","seconds"],a=e.unit;return Array.isArray(e.unit)&&(s=e.unit,a=void 0),mo(r,this.plus(n),{...e,numeric:"always",units:s,unit:a})}toRelativeCalendar(e={}){return this.isValid?mo(e.base||t.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(t.isDateTime))throw new Q("min requires all arguments be DateTimes");return Is(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Q("max requires all arguments be DateTimes");return Is(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:s=null,numberingSystem:a=null}=n,o=K.fromOpts({locale:s,numberingSystem:a,defaultToEN:!0});return Ls(o,e,r)}static fromStringExplain(e,r,n={}){return t.fromFormatExplain(e,r,n)}static get DATE_SHORT(){return Ve}static get DATE_MED(){return zt}static get DATE_MED_WITH_WEEKDAY(){return us}static get DATE_FULL(){return Ut}static get DATE_HUGE(){return Vt}static get TIME_SIMPLE(){return Gt}static get TIME_WITH_SECONDS(){return Kt}static get TIME_WITH_SHORT_OFFSET(){return $t}static get TIME_WITH_LONG_OFFSET(){return Zt}static get TIME_24_SIMPLE(){return Yt}static get TIME_24_WITH_SECONDS(){return Jt}static get TIME_24_WITH_SHORT_OFFSET(){return Xt}static get TIME_24_WITH_LONG_OFFSET(){return Qt}static get DATETIME_SHORT(){return er}static get DATETIME_SHORT_WITH_SECONDS(){return tr}static get DATETIME_MED(){return rr}static get DATETIME_MED_WITH_SECONDS(){return nr}static get DATETIME_MED_WITH_WEEKDAY(){return ls}static get DATETIME_FULL(){return sr}static get DATETIME_FULL_WITH_SECONDS(){return ar}static get DATETIME_HUGE(){return ir}static get DATETIME_HUGE_WITH_SECONDS(){return or}};function Dt(t){if(U.isDateTime(t))return t;if(t&&t.valueOf&&Fe(t.valueOf()))return U.fromJSDate(t);if(t&&typeof t=="object")return U.fromObject(t);throw new Q(`Unknown datetime argument: ${t}, of type ${typeof t}`)}import{TransactionBlock as On}from"@mysten/sui.js/transactions";import{TransactionBlock as So}from"@mysten/sui.js/transactions";import{SUI_TYPE_ARG as Ao,normalizeStructTag as Uf}from"@mysten/sui.js/utils";import{Buffer as Fo}from"buffer";import{normalizeSuiAddress as Gf}from"@mysten/sui.js/utils";import{bcs as pc}from"@mysten/sui.js/bcs";import{normalizeStructTag as Rn}from"@mysten/sui.js/utils";var bo=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");import{Transactions as Oo}from"@mysten/sui.js/transactions";import{normalizeStructTag as _o,normalizeSuiAddress as Hn}from"@mysten/sui.js/utils";import{TransactionBlock as _n}from"@mysten/sui.js/transactions";import{normalizeStructTag as Mo,parseStructTag as rd}from"@mysten/sui.js/utils";var Oc=ft(dt(),1);import{bcs as $o}from"@mysten/sui.js/bcs";import{normalizeStructTag as Fd,normalizeSuiAddress as yr}from"@mysten/sui.js/utils";var Mc=ft(dt(),1);import{TransactionBlock as Pd}from"@mysten/sui.js/transactions";var o1=ft(dt(),1);import{TransactionBlock as Wd}from"@mysten/sui.js/transactions";import{fromHEX as jd,toHEX as Ld}from"@mysten/sui.js/utils";var Ef=Object.defineProperty,Yo=(t,e)=>{for(var r in e)Ef(t,r,{get:e[r],enumerable:!0})},Jo={};Yo(Jo,{contractId:()=>ec,default:()=>Sf,feeObjId:()=>nc,roleObjId:()=>tc,status:()=>Qo,transaction:()=>Xo,upgradeCapObjId:()=>sc,vaultObjId:()=>rc});var Xo="DiBZq4UmVVYiRL6ZJmFKYoHcxtxqrhsCXSkFyT7wUr3j",Qo="success",ec="0x81c960dc653975fbd0072deca8afb92d322898c911622898ba1b2e3ad0c4bd8d",tc="0xc6ec0bdee0bb59a72077e9acd2f42457043cf47080b3d3fad4d39abf28bba63a",rc="0xbc4021387fbac149119fd24e92be9e58f745774292f3a2a12e2ac6daf5363e1d",nc="0x4178f63970fe2daeb256dc5730ad172e82b3e8eb45f31b33e0daae72cd35e1e1",sc="0xe1e9aa7d222d151bfe6dd83358b0d7fdcb11260f710800cfaf7ccc1b1e245115",Sf={transaction:Xo,status:Qo,contractId:ec,roleObjId:tc,vaultObjId:rc,feeObjId:nc,upgradeCapObjId:sc},ac={};Yo(ac,{contractId:()=>cc,default:()=>Af,feeObjId:()=>fc,roleObjId:()=>uc,status:()=>oc,transaction:()=>ic,upgradeCapObjId:()=>dc,vaultObjId:()=>lc});var ic="855FNDV8o8Z3fWULPnQo9qdhLJpsg7wZrkCpNyfw9KfB",oc="success",cc="0xc357c3985e8fb875d6b37141497af660779aa1bab0ec489b2213efd74067d1fa",uc="0x5ab49bdf9fd1413e328ef242b3f8d83dde791b38a0b627bfc87fb25c010d34f1",lc="0xb483558770d8eb26007f193b75db40f0a45f2e36863a687625885d4de6993378",fc="0x48453fc4d7cde3fe35aad89e5dfb496608a6a55ea529a1c0274681a808627f94",dc="0x34279779a0d0d36bd5044b04830d607fa1b0ecf316548c8ac3a44151e4f1a42a",Af={transaction:ic,status:oc,contractId:cc,roleObjId:uc,vaultObjId:lc,feeObjId:fc,upgradeCapObjId:dc},Df="https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD",Tf="https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD",Bf="https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7",Ff="https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7",If="https://bc3p6l5unl.execute-api.us-west-1.amazonaws.com/prod",kf="https://rolsbkota7.execute-api.us-west-1.amazonaws.com/prod",Of="https://6p6mkx33ne.execute-api.us-west-1.amazonaws.com/prod",_f="https://xrae3mrjv5.execute-api.us-west-1.amazonaws.com/prod",wo=Jo,Co=ac,Mf=new Map([["dev",{env:"dev",rpc:{url:Df},backend:{url:If},contract:wo}],["stg",{env:"stg",rpc:{url:Tf},backend:{url:kf},contract:wo}],["prev",{env:"prev",rpc:{url:Bf},backend:{url:Of},contract:Co}],["prod",{env:"prod",rpc:{url:Ff},backend:{url:_f},contract:Co}]]);function Pf(t,e){let r=Mf.get(t);if(!r)throw new Error(`Env not supported: ${t}`);return e&&e.rpc&&(r.rpc=e.rpc),e&&e.backend&&(r.backend=e.backend),e&&e.contract&&(r.contract=e.contract),r}var xe=class extends Error{mpayErrorCode;context;constructor(t,e,r={}){let{cause:n,context:s}=r;n?super(`[MPay] ${e}: ${n}`):super(`[MPay] ${e}`),this.mpayErrorCode=t,this.context=s}},Rf=class extends xe{constructor(){super(11,"Backend is not specified")}},Hf=class extends xe{constructor(){super(1,"Wallet not connected")}},Ks=class extends xe{constructor(t,e){super(10,t,{context:e})}},jf=class ot{constructor(e){this.apiURL=e}static parseResponseData(e){if(e instanceof Wf)throw new Ks(e.response?.statusText);if(e.status===200){if(e.data.success)return e.data.data;throw new Ks(e.data.code)}throw new Ks(e.status.toString())}async getIncomingStreams(e,r){let n=await Tt.post(`${this.apiURL}/stream`,{recipient:e,...r});return ot.parseResponseData(n)}async getOutgoingStreams(e,r){let n=await Tt.post(`${this.apiURL}/stream`,{sender:e,...r});return ot.parseResponseData(n)}async getStreamHistory(e){let r=await Tt.post(`${this.apiURL}/stream-events`,e),n=ot.parseResponseData(r);return n.data.forEach(s=>{let a=s;return a.data.type==="create_stream"?a.data.balance=BigInt(a.data.balance):a.data.type==="cancel_stream"?a.data.withdrawAmount=BigInt(a.data.withdrawAmount):a.data.type==="claim"||a.data.type==="auto_claim"?a.data.claimAmount=BigInt(a.data.claimAmount):a.data.type==="set_auto_claim"&&(a.data.enabled=!!a.data.enabled),a.createdAt=new Date(a.createdAt),a}),n}async getAllCoinTypes(e){let r=await Tt.post(`${this.apiURL}/stream-info`,{address:e});return ot.parseResponseData(r)}async getAllRecipients(e,r){let n=await Tt.post(`${this.apiURL}/stream-info`,{sender:e,status:r});return ot.parseResponseData(n)}async getAllSenders(e,r){let n=await Tt.post(`${this.apiURL}/stream-info`,{recipient:e,status:r});return ot.parseResponseData(n)}},hc=class xc{signer;suiClient;envConfig;_backend;constructor(e){this.envConfig=e,this.suiClient=new Nf({url:e.rpc.url}),e.backend&&(this._backend=new jf(e.backend.url))}static new(e,r){let n=Pf(e,r);return new xc(n)}get walletType(){return this.wallet?this.wallet.type:"disconnected"}get backend(){if(!this._backend)throw new Rf;return this._backend}set backend(e){this._backend=e}connectWallet(e){this.signer=e}disconnect(){this.signer=void 0}get wallet(){if(!this.signer)throw new Hf;return this.signer}async walletAddress(){return this.wallet.address()}},Do=50n,$s=10000n,Vf=25n,To=100000000n,it=class{constructor(t){this.object=t}moveArg(t){return t.object(this.object)}},Bo=class{constructor(t){this.objects=t}moveArgs(t){return t.makeMoveVec({objects:this.objects.map(e=>t.object(e))})}},Nn=class mc{constructor(e){return this.result=e,new Proxy(this,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(r,n){if(n in r)return Reflect.get(r,n);let s=o=>new mc(r.result[o]);if(n===Symbol.iterator)return function*(){let o=0;for(;;)yield s(o),o++};if(typeof n=="symbol")return;let a=parseInt(n,10);if(!(Number.isNaN(a)||a<0))return s(a)}})}moveArg(){return this.result}},Io=class extends xe{constructor(t,e){super(3,t,{context:e})}},Kf=class{constructor(t){this.results=t}callResult(t){return this.results.results[t]}returnValue(t,e){return t.returnValues[e]}getValue(t=0,e=0){let r=this.callResult(t);return this.returnValue(r,e)}getAddress(t=0,e=0){let[r,n]=this.getValue(t,e);if(n!=="address")throw new Io("Invalid contract return type.",{ctx:{expectType:"address",gotType:n}});return Gf(Fo.from(r).toString("hex"))}getU64(t=0,e=0){let[r,n]=this.getValue(t,e);if(n!=="u64")throw new Io("Invalid contract return type.",{ctx:{expectType:"u64",gotType:n}});return Fo.from(r).readBigInt64LE()}},he=class extends xe{constructor(t,e,r){super(2,`Invalid input: ${t}`,{context:{fieldKey:e,fieldValue:r}})}},gc={groupId:"string",name:"string"},$f=64;function Zf(t){return yc(t),pc.ser(gc,t).toString("base64")}function Js(t){let e=pc.de(gc,t,"base64");return yc(e),e}function yc(t){if(!ko(t.name))throw new he("Invalid metadata: Name contains unknown character");if(!ko(t.groupId))throw new he("Invalid metadata: Group ID contains unknown character");if(t.name.length>$f)throw new he("Invalid metadata: Name exceed max length 64")}function ko(t){return/^[\x00-\x7F]+$/.test(t)}function vc(t,e){return Rn(t)===Rn(e)}function Bt(t,e){return Rn(t)===Rn(e)}var bc="txn.gas";function Yf(){return bo()}var Xs=class wc{constructor(e,r,n){this.globals=e,this.feeContract=r,this.streamContract=n}static convertCreateStreamInfoToInternal(e){return{metadata:Zf({name:e.name,groupId:Yf()}),coinType:Uf(e.coinType),recipients:e.recipients.map(r=>({address:r.address,cliffAmount:r.cliffAmount,amountPerEpoch:r.amountPerStep})),epochInterval:e.interval,numberEpoch:e.steps,startTime:e.startTimeMs,cancelable:e.cancelable}}async buildCreateStreamTransactionBlock(e){let r=new So,n=this.calculateFeesInternal(e),s=this.getCreateStreamCoinRequests(e,n),a=await this.wallet.requestCoins(s),o=await this.addMergeCoins(r,a[0]),i;s.length>1?i=await this.addMergeCoins(r,a[1]):i=o;for(let c=0;c<e.recipients.length;c++){let l=e.recipients[c],u=this.amountForRecipient(l,e.numberEpoch),d=this.getStreamFeeLocal(u),[f]=r.splitCoins(o,[r.pure(u+d,"u64")]),[h]=r.splitCoins(i,[r.pure(this.flatSuiFee,"u64")]);this.streamContract.createStream(r,{paymentCoin:new Nn(f),flatFeeCoin:new Nn(h),metadata:e.metadata,recipient:l.address,timeStart:e.startTime,cliff:l.cliffAmount,epochInterval:e.epochInterval,numEpoch:e.numberEpoch,amountPerEpoch:l.amountPerEpoch,cancelable:e.cancelable,coinType:e.coinType})}return r}calculateCreateStreamFees(e){let r=wc.convertCreateStreamInfoToInternal(e);return this.calculateFeesInternal(r)}feeParams(){return{createFeePercent:{numerator:Do,denominator:$s},claimFeePercent:{numerator:Vf,denominator:$s},flatFeePerStream:To}}async addMergeCoins(e,r){let n;return r.mergedCoins&&r.mergedCoins.length?(e.mergeCoins(e.object(r.primaryCoin),r.mergedCoins.map(s=>e.object(s))),n=e.object(r.primaryCoin)):r.primaryCoin===bc?n=e.gas:n=e.object(r.primaryCoin),n}getCreateStreamCoinRequests(e,r){let n=e.coinType;return vc(n,Ao)?[{coinType:n,amount:r.totalAmount+r.streamFeeAmount+r.flatFeeAmount}]:[{coinType:n,amount:r.totalAmount+r.streamFeeAmount},{coinType:Ao,amount:r.flatFeeAmount}]}calculateFeesInternal(e){let r=e.recipients.reduce((n,s)=>{let a=this.amountForRecipient(s,e.numberEpoch),o=this.getStreamFeeLocal(a);return{totalAmount:n.totalAmount+a,streamFeeAmount:n.streamFeeAmount+o}},{totalAmount:0n,streamFeeAmount:0n});return{flatFeeAmount:BigInt(e.recipients.length)*this.flatSuiFee,...r}}amountForRecipient(e,r){return BigInt(e.amountPerEpoch)*BigInt(r)+BigInt(e.cliffAmount)}get flatSuiFee(){return To}getStreamFeeLocal(e){return e*Do/$s}async getStreamFeeRemote(e){let r=this.feeContract.streamingFee(new So,e),n=await this.globals.suiClient.devInspectTransactionBlock({sender:await this.globals.walletAddress(),transactionBlock:r});return new Kf(n).getU64()}get wallet(){return this.globals.wallet}},Jf="0x0000000000000000000000000000000000000000000000000000000000000006",Cc=class{constructor(t,e,r){this.moduleName=t,this.config=e,this.globals=r}addContractCall(t,e){let r=`${this.config.contractId}::${this.moduleName}::${e.method}`;return t.add(Oo.MoveCall({target:r,arguments:e.arguments.map(n=>n instanceof Bo?n.moveArgs(t):n instanceof it?n.moveArg(t):n instanceof Nn?n.moveArg():t.pure(n)),typeArguments:e.typeArgs})),t}addTransactionBlock(t,e,r=[],n=[]){t.add(Oo.MoveCall({target:e,arguments:r.map(s=>s instanceof Bo?s.moveArgs(t):s instanceof it?s.moveArg(t):s instanceof Nn?s.moveArg():t.pure(s)),typeArguments:n}))}makeObject(t){return typeof t=="string"?new it(t):t}vaultObject(){return new it(this.config.vaultObjId)}roleObject(){return new it(this.config.roleObjId)}feeObject(){return new it(this.config.feeObjId)}clockObject(){return new it(Jf)}},Ec=class Xe extends Cc{constructor(e,r){super(Xe.ModuleName,e,r),this.config=e,this.globals=r}static ModuleName="fee_module";static MethodName={set_streaming_fee:"set_streaming_fee",set_claim_fee:"set_claim_fee",set_streaming_flat_fee:"set_streaming_flat_fee",streaming_flat_fee:"streaming_flat_fee",streaming_fee:"streaming_fee",claim_fee:"claim_fee",fee_denominator:"fee_denominator"};setStreamingFee(e,r){let n=this.roleObject(),s=this.feeObject();return this.addContractCall(e,{method:Xe.MethodName.set_streaming_fee,arguments:[n,s,r],typeArgs:[]})}setStreamingFlatFee(e,r){let n=this.roleObject(),s=this.feeObject();return this.addContractCall(e,{method:Xe.MethodName.set_streaming_flat_fee,arguments:[n,s,r],typeArgs:[]})}setClaimFee(e,r){let n=this.roleObject(),s=this.feeObject();return this.addContractCall(e,{method:Xe.MethodName.set_claim_fee,arguments:[n,s,r],typeArgs:[]})}streamingFee(e,r){let n=this.feeObject();return this.addContractCall(e,{method:Xe.MethodName.streaming_fee,arguments:[n,r],typeArgs:[]})}claimFee(e,r){return this.addContractCall(e,{method:Xe.MethodName.claim_fee,arguments:[this.feeObject(),r],typeArgs:[]})}feeDenominator(e){return this.addContractCall(e,{method:Xe.MethodName.fee_denominator,arguments:[this.feeObject()],typeArgs:[]})}},jn=class se extends Cc{constructor(e,r){super(se.ModuleName,e,r),this.config=e,this.globals=r}static ModuleName="stream";static MethodName={create_stream:"create_stream",set_auto_claim:"set_auto_claim",cancel_stream:"cancel_stream",claim_stream:"claim_stream",claim_stream_by_proxy:"claim_stream_by_proxy",stream_current_epoch:"stream_current_epoch",now_milli_seconds:"now_milli_seconds"};createStream(e,r){let n=this.feeObject(),s=this.vaultObject(),a=this.makeObject(r.paymentCoin),o=this.makeObject(r.flatFeeCoin),i=this.clockObject();return this.addContractCall(e,{method:se.MethodName.create_stream,arguments:[n,s,a,o,r.metadata,r.recipient,r.timeStart,r.cliff,r.epochInterval,r.numEpoch,r.amountPerEpoch,r.cancelable,i],typeArgs:[r.coinType]})}setAutoClaim(e,r){let n=this.makeObject(r.streamId);return this.addContractCall(e,{method:se.MethodName.set_auto_claim,arguments:[n,r.enabled],typeArgs:[r.coinType]})}cancelStream(e,r){let n=this.makeObject(r.streamId),s=this.clockObject();return this.addContractCall(e,{method:se.MethodName.cancel_stream,arguments:[n,s],typeArgs:[r.coinType]})}claimStream(e,r){let n=this.makeObject(r.streamId),s=this.clockObject();return this.addContractCall(e,{method:se.MethodName.claim_stream,arguments:[n,s],typeArgs:[r.coinType]})}claimStreamByProxy(e,r){let n=this.makeObject(r.streamId),s=this.vaultObject(),a=this.feeObject(),o=this.clockObject();return this.addContractCall(e,{method:se.MethodName.claim_stream_by_proxy,arguments:[n,s,a,o],typeArgs:[r.coinType]})}get createStreamTarget(){return`${this.config.contractId}::${se.ModuleName}::${se.MethodName.create_stream}`}get setAutoClaimTarget(){return`${this.config.contractId}::${se.ModuleName}::${se.MethodName.set_auto_claim}`}get cancelStreamTarget(){return`${this.config.contractId}::${se.ModuleName}::${se.MethodName.cancel_stream}`}get claimStreamTarget(){return`${this.config.contractId}::${se.ModuleName}::${se.MethodName.claim_stream}`}get claimStreamByProxyTarget(){return`${this.config.contractId}::${se.ModuleName}::${se.MethodName.claim_stream_by_proxy}`}},Sc=class{constructor(t){this.globals=t;let e=t.envConfig.contract;this.feeContract=new Ec(e,t),this.streamContract=new jn(e,t)}feeContract;streamContract;async createStreams(t){let e=Xs.convertCreateStreamInfoToInternal(t);return this.createStreamHelper().buildCreateStreamTransactionBlock(e)}createStreamHelper(){return new Xs(this.globals,this.feeContract,this.streamContract)}setAutoClaim(t,e,r){let n=new On;return this.streamContract.setAutoClaim(n,{streamId:t,enabled:e,coinType:r})}claimStream(t,e){let r=new On;return this.streamContract.claimStream(r,{streamId:t,coinType:e})}claimStreamByProxy(t,e){let r=new On;return this.streamContract.claimStreamByProxy(r,{streamId:t,coinType:e})}cancelStream(t,e){let r=new On;return this.streamContract.cancelStream(r,{streamId:t,coinType:e}),r}},Xf=class extends xe{constructor(t,e){super(12,`Transaction failed: ${e}`,{context:{status:t,msg:e}})}},Qf=1e3,ed=class{constructor(t){this.globals=t,this.coinMetaHelper=new td(t.suiClient),this.createStreamHelper=new Sc(t).createStreamHelper()}coinMetaHelper;createStreamHelper;getStreamIdsFromCreateStreamResponse(t){if(t.effects?.status.status!=="success")throw new Xf(t.effects?.status.status,t.effects?.status.error);return t.objectChanges.filter(e=>e.type==="created"&&e.objectType.startsWith(`${this.globals.envConfig.contract.contractId}::stream::Stream`)).map(e=>e.objectId)}calculateCreateStreamFees(t){return this.createStreamHelper.calculateCreateStreamFees(t)}feeParams(){return this.createStreamHelper.feeParams()}calculateStreamAmount(t){if(t.steps===0n)throw new he("Invalid stream steps: 0");let e=t.cliff?t.cliff:{numerator:0n,denominator:100n},r=t.totalAmount*e.numerator/e.denominator,n=(t.totalAmount-r)/t.steps,s={realTotalAmount:n*t.steps+r,cliffAmount:r,amountPerStep:n};return this.validateStreamAmount(s,t.totalAmount),s}calculateTimelineByInterval(t){if(t.steps===0n)throw new he("Invalid stream steps: 0");let e=t.timeStart.plus(t.interval.toMillis()*Number(t.steps)),r={timeStart:t.timeStart,timeEnd:e,interval:t.interval,steps:t.steps};return this.validateTimeline(r),r}calculateTimelineByTotalDuration(t){if(t.steps===0n)throw new he("Invalid stream steps: 0");let e=BigInt(t.total.toMillis())/t.steps,r=t.timeStart.plus($.fromMillis(Number(e*t.steps))),n={timeStart:t.timeStart,timeEnd:r,interval:$.fromMillis(Number(e)),steps:t.steps};return this.validateTimeline(n),n}async getBalance(t,e){let r=await this.globals.suiClient.getBalance({owner:t,coinType:e}),n=await this.getCoinMeta(e);return{...r,coinType:Ys(r.coinType),coinMeta:n}}async getAllBalance(t){let e=await this.globals.suiClient.getAllBalances({owner:t}),r=await Promise.all(e.map(n=>this.getCoinMeta(n.coinType)));return e.map((n,s)=>({...n,coinType:Ys(n.coinType),coinMeta:r[s]}))}async getCoinMeta(t){return this.coinMetaHelper.getCoinMeta(t)}async simulateTransactionBlock(t){return this.globals.suiClient.devInspectTransactionBlock({transactionBlock:t,sender:await this.globals.wallet.address()})}validateStreamAmount(t,e){if(t.amountPerStep===0n)throw new he("Stream amount too small","totalAmount",e);if(t.cliffAmount>t.realTotalAmount)throw new he("Invalid cliff settings")}validateTimeline(t){if(t.interval.toMillis()<Qf)throw new he("Interval shall be at least 1 second","interval",t.interval)}},td=class{constructor(t){this.suiClient=t,this.coinMetaReg=new Map}coinMetaReg;async getCoinMeta(t){let e=Ys(t||zf);if(this.coinMetaReg.has(e))return this.coinMetaReg.get(e);let r=await this.queryCoinMeta(e);return r&&this.coinMetaReg.set(e,r),r}async queryCoinMeta(t){return await this.suiClient.getCoinMetadata({coinType:t})||void 0}},nd=class extends xe{constructor(){super(7,"Connected wallet is not creator")}},Po=class extends xe{constructor(){super(8,"Connected wallet is not recipient")}},No=class extends xe{constructor(t,e){super(6,t,{context:e})}},Te=class extends xe{constructor(t,e={}){super(0,t,e)}},sd=class extends xe{constructor(t){super(5,"Stream not found",{context:{streamId:t}})}},ad=(1n<<64n)-1n,Wn=1e3;function Ro(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/Wn);return U.fromMillis(r*Wn)}function Ho(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/Wn);return $.fromMillis(r*Wn)}var ra=class Qe{constructor(e,r,n){this.globals=e,this.streamId=r,this.rawData=n,this.streamContract=new jn(e.envConfig.contract,e)}streamContract;type="Stream";static async new(e,r){let n=await Qe.fetchStreamData(e,r);return new Qe(e,r,n)}static fromObjectData(e,r,n){let s=Qe.parseRawStreamData(r,n);return new Qe(e,r,s)}get info(){return{name:this.name,creator:this.creator,coinType:this.coinType,totalAmount:this.totalAmount,start:this.timeStart,end:this.timeEnd,cancelable:this.cancelable,cliffAmount:this.cliff,duration:this.duration,interval:this.interval,steps:this.totalSteps,nextReleaseDate:this.nextReleaseDate,nextReleaseAmount:this.nextReleaseAmount,groupId:this.groupId,streamId:this.streamId,recipient:this.recipient,progress:this.progress,autoClaim:this.autoClaim}}get groupCommonInfo(){return{name:this.name,groupId:this.groupId,creator:this.creator,start:this.timeStart,interval:this.interval,steps:this.totalSteps,cancelable:this.cancelable}}async refresh(){this.rawData=await Qe.fetchStreamData(this.globals,this.streamId)}refreshWithData(e){if(e.data?.objectId!==this.streamId)throw new Te("Object Id does not align");this.rawData=Qe.parseRawStreamData(this.streamId,e)}async historyEvents(e){return this.globals.backend.getStreamHistory({streamId:this.streamId,pagination:e})}async cancel(){if(await this.globals.walletAddress()!==this.creator)throw new nd;let e=new _n;return this.streamContract.cancelStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async claim(){if(await this.globals.walletAddress()!==this.recipient)throw new Po;let e=new _n;return this.streamContract.claimStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async setAutoClaim(e){if(await this.globals.walletAddress()!==this.recipient)throw new Po;let r=new _n;return this.streamContract.setAutoClaim(r,{streamId:this.streamId,coinType:this.coinType,enabled:e}),r}async claimByProxy(){let e=new _n;return this.streamContract.claimStreamByProxy(e,{streamId:this.streamId,coinType:this.coinType}),e}get wallet(){return this.globals.wallet}get client(){return this.globals.suiClient}get coinType(){return Mo(this.rawData.coinType)}get progress(){return{status:this.streamStatus,total:this.totalAmount,streamed:this.streamedAmount,claimed:this.claimedAmount,claimable:this.claimable,canceled:this.canceledAmount}}get balance(){return this.rawData.balance}get autoClaim(){return this.rawData.autoClaim}get amountPerEpoch(){return this.rawData.config.amountPerEpoch}get cancelable(){return this.rawData.config.cancelable}get cliff(){return this.rawData.config.cliff}get creator(){return this.rawData.config.creator}get interval(){return Ho(this.rawData.config.epochInterval)}get groupId(){let{metadata:e}=this.rawData.config;return Js(e).groupId}get name(){let{metadata:e}=this.rawData.config;return Js(e).name}get recipient(){return this.rawData.config.recipient}get timeStart(){return Ro(this.rawData.config.timeStart)}get duration(){let e=this.rawData.config,r=e.epochInterval*e.totalEpoch;return Ho(r)}get timeEnd(){return this.timeStart.plus(this.duration)}get totalSteps(){return this.rawData.config.totalEpoch}get claimable(){return this.streamedAmount-this.claimedAmount}get nextReleaseDate(){return this.currentEpoch===-1n?this.timeStart:this.currentEpoch>=this.totalSteps||this.isCanceled?null:Ro((this.currentEpoch+1n)*this.rawData.config.epochInterval+this.rawData.config.timeStart)}get nextReleaseAmount(){return this.currentEpoch===-1n?this.cliff:this.currentEpoch>=this.totalSteps||this.isCanceled?null:this.amountPerEpoch}get streamStatus(){let e=this.rawData.status.status;return e===16?"CANCELED":e===17?"SETTLED":e===1?"COMPLETED":this.currentEpoch>=this.totalSteps?"STREAMED":"STREAMING"}get streamedAmount(){return this.currentEpoch===-1n?0n:this.isCanceled?this.rawData.status.epochCanceled*this.amountPerEpoch+this.cliff:this.currentEpoch*this.amountPerEpoch+this.cliff}get claimedAmount(){return this.rawData.status.epochClaimed===ad?0n:this.rawData.status.epochClaimed*this.amountPerEpoch+this.cliff}get currentEpoch(){let e=U.now().toMillis(),r=this.timeStart.toMillis();if(e<r)return-1n;let n=Math.floor((e-r)/Number(this.rawData.config.epochInterval));return BigInt(n)>Number(this.rawData.config.totalEpoch)?this.rawData.config.totalEpoch:BigInt(n)}get totalAmount(){let e=this.rawData.config;return e.amountPerEpoch*e.totalEpoch+e.cliff}get isCanceled(){let e=this.rawData.status.status;return e===16||e===17}get canceledAmount(){return this.isCanceled?this.totalAmount-this.streamedAmount:0n}static async fetchStreamData(e,r){let n=await e.suiClient.getObject({id:r,options:{showContent:!0,showType:!0}});return Qe.parseRawStreamData(r,n)}static parseRawStreamData(e,r){if(r.error)throw r.error.code==="notExists"?new sd(e):new No(`get stream data: ${r.error.code}`,{streamId:e,...r.error});let n=r.data.content;if(n.dataType!=="moveObject")throw new No("Unexpected object type",{gotType:n.dataType});let{typeParams:s}=rd(n.type),a=Mo(s[0]),o=n.fields,i=o.config.fields,c=o.status.fields;return{coinType:a,autoClaim:o.auto_claim,balance:BigInt(o.balance.fields.balance),config:{amountPerEpoch:BigInt(i.amount_per_epoch),cancelable:i.cancelable,cliff:BigInt(i.cliff),creator:i.creator,epochInterval:BigInt(i.epoch_interval),metadata:i.metadata,recipient:i.recipient,timeStart:BigInt(i.time_start),totalEpoch:BigInt(i.total_epoch)},status:{status:c.status,epochCanceled:BigInt(c.epoch_canceled),epochClaimed:BigInt(c.epoch_claimed)}}}},Zs=class extends xe{constructor(t,e){super(9,`Invalid stream group: ${t}`,{context:e})}};async function id(t){let e=[];for(;await t.hasNext();){let r=await t.next();e.push(r)}return e&&Array.isArray(e[0])?e.flat(1):e}var od=class{constructor(t){this.requester=t,this.curPage=void 0,this.init=!0}curPage;init;async hasNext(){if(this.init)return this.curPage||(this.curPage=await this.requester.doNextRequest()),!!this.curPage.data?.length||this.curPage.hasNext;if(!this.curPage)throw new Error("invalid implementation of iterator");return this.curPage.hasNext}async next(){return this.init?(this.init=!1,this.curPage||(this.curPage=await this.requester.doNextRequest()),this.curPage.data):(this.curPage=await this.requester.doNextRequest(),this.curPage.data)}},Ac=class{constructor(t){this.requester=t,this.pager=new od(t),this.curData=[],this.cursor=0}cursor;pager;curData;async hasNext(){return this.cursor<this.curData.length-1?!0:this.pager.hasNext()}async next(){for(this.cursor+=1;this.cursor>=this.curData.length;)if(await this.pager.hasNext())this.curData=await this.pager.next(),this.cursor=0;else throw new Error("not more data");return this.curData[this.cursor]}},cd=25;async function Wo(t,e,r){let n=new Dc(e),s=new Tc(t,n,r);return await id(s)}var Dc=class{constructor(t){this.ids=t,this.cursor=-1}cursor;async hasNext(){return this.cursor<this.ids.length-1}async next(){if(this.cursor+=1,this.cursor>=this.ids.length)throw new Error("invalid iterator implementation");return this.ids[this.cursor]}},Tc=class extends Ac{constructor(t,e,r){super(new ud(t,e,r)),this.suiClient=t,this.idIter=e,this.options=r}},ud=class{constructor(t,e,r){this.suiClient=t,this.stringIter=e,this.options=r,this.filter=r?.filter,this.pageSize=r?.pageSize||cd,this.objectOptions=r?.objectOptions||{showType:!0,showContent:!0}}filter;pageSize;objectOptions;async doNextRequest(){let t=[];for(;t.length<this.pageSize&&await this.stringIter.hasNext();){let n=await this.stringIter.next();n&&t.push(n)}let e=await this.suiClient.multiGetObjects({ids:t,options:this.objectOptions}),r;if(this.filter){let{filter:n}=this;r=e.filter(s=>n?.(s))}else r=e;return{data:r,hasNext:await this.stringIter.hasNext()}}},ld=class Mn{constructor(e,r){if(this.globals=e,this.streams=r,r.length===0)throw new Zs("stream size 0");let n=r.map(s=>s.groupId);if(new Set(n).size!==1)throw new he("Stream does not have same group ID")}type="StreamGroup";static async new(e,r){let n=await Wo(e.suiClient,r);return n.forEach(s=>{if(!s)throw new Te("stream group object data undefined")}),Mn.newFromObjectResponse(e,r,n)}static async newFromObjectResponse(e,r,n){let s=await Mn.parseGroupStreams(e,r,n);return new Mn(e,s)}static checkStreamGroup(e){let r=e.map(a=>a.groupCommonInfo),n=r[0],s=!0;return r.forEach(a=>{fd(n,a)||(s=!1)}),s}async refresh(){let e=await Wo(this.globals.suiClient,this.streams.map(r=>r.streamId));this.streams.forEach((r,n)=>{r.refreshWithData(e[n])})}get groupId(){return this.streams[0].groupId}get creator(){return this.streams[0].creator}get info(){return{groupId:this.groupId,streamIds:this.streams.map(e=>e.streamId),progress:this.progress,name:this.streams[0].name,creator:this.creator,coinType:this.streams[0].coinType,totalAmount:this.streams.reduce((e,r)=>e+r.totalAmount,0n),start:this.streams[0].timeStart,end:this.streams[0].timeEnd,cancelable:this.streams[0].cancelable,cliffAmount:this.streams.reduce((e,r)=>e+r.cliff,0n),duration:this.streams[0].duration,interval:this.streams[0].interval,steps:this.streams[0].totalSteps,nextReleaseAmount:this.streams.reduce((e,r)=>r.nextReleaseAmount===null?e:e+r.nextReleaseAmount,0n),nextReleaseDate:this.streams[0].nextReleaseDate}}get progress(){return{total:this.streams.reduce((e,r)=>e+r.totalAmount,0n),streamed:this.streams.reduce((e,r)=>e+r.streamedAmount,0n),claimed:this.streams.reduce((e,r)=>e+r.claimedAmount,0n),claimable:this.streams.reduce((e,r)=>e+r.claimable,0n),canceled:this.streams.reduce((e,r)=>e+r.canceledAmount,0n)}}async historyEvents(e){return this.globals.backend.getStreamHistory({groupId:this.groupId,pagination:e})}static async parseGroupStreams(e,r,n){let s=n.map((a,o)=>ra.fromObjectData(e,r[o],a)).filter(a=>!!a);if(new Set(s.map(a=>a.groupId)).size!==1)throw new Zs("Not same group ID");if(!this.checkStreamGroup(s))throw new Zs("Not same stream settings");return s}};function fd(t,e){return t.name===e.name&&t.groupId===e.groupId&&t.creator===e.creator&&t.start.toMillis()===e.start.toMillis()&&t.interval.toMillis()===e.interval.toMillis()&&t.steps===e.steps&&t.cancelable===e.cancelable}var jo=class Qs{constructor(e,r){this.it=e,this.pageSize=r}static async newIncoming(e){let r=await Lo.newIncoming(e);return new Qs(r,e.pageSize)}static async newOutgoing(e){let r=await Lo.newOutgoing(e);return new Qs(r,e.pageSize)}async hasNext(){return this.it.hasNext()}async next(){let e=[];for(;e.length<this.pageSize&&await this.it.hasNext();)e.push(await this.it.next());return e}},Lo=class ea{constructor(e){this.requester=e}cachedNext;static async newIncoming(e){let r=await qo.newIncomingQuery(e);return new ea(r)}static async newOutgoing(e){let r=await qo.newOutgoingQuery(e);return new ea(r)}async hasNext(){return this.cachedNext===void 0&&(this.cachedNext=await this.requester.doNextRequest()),this.cachedNext!==null}async next(){if(this.cachedNext===void 0){let r=await this.requester.doNextRequest();if(r===null)throw new Te("No more results");return r}let e=this.cachedNext;if(this.cachedNext=void 0,e===null)throw new Te("No more results");return e}},qo=class ta{constructor(e,r,n,s){this.globals=e,this.recipient=r,this.groupRefs=n,this.query=s,this.current=0;let a=new Dc(n.flat().map(o=>o.streamId));this.objectIter=new Tc(e.suiClient,a)}current=0;objectIter;static async newIncomingQuery(e){let r=pd(e.query),n=await e.globals.walletAddress(),s=(await e.globals.backend.getIncomingStreams(n,r)).filter(o=>Hn(o.recipient)===Hn(n)),a=zo(s);return new ta(e.globals,n,a,e.query)}static async newOutgoingQuery(e){let r=gd(e.query),n=await e.globals.walletAddress(),s=await e.globals.backend.getOutgoingStreams(n,r),a=zo(s);return new ta(e.globals,n,a,e.query)}async doNextRequest(){if(this.current>=this.groupRefs.length)return null;let e=this.groupRefs[this.current];if(e.length===1){let r=await xd(this.globals,e[0].streamId,this.objectIter);return this.current++,Bc(r,this.query)?r:this.doNextRequest()}if(e.length>1){let r=await md(this.globals,e.map(n=>n.streamId),this.objectIter);return this.current++,hd(r,this.query)?r:this.doNextRequest()}throw new Te("Stream group with no stream")}};function zo(t){let e=new Map;return t.forEach(r=>{let n=e.get(r.groupId);n?(n.push(r),e.set(r.groupId,n)):e.set(r.groupId,[r])}),Array.from(e.values()).sort((r,n)=>U.fromISO(n[0].createDate).toMillis()-U.fromISO(r[0].createDate).toMillis())}function Bc(t,e){if(e===void 0)return!0;let r=dd(t,e.status);if(e&&"claimable"in e&&e.claimable!==void 0){let n=e.claimable?t.progress.claimable!==0n:t.progress.claimable===0n;return r&&n}return r}function dd(t,e){return e===void 0?!0:Array.isArray(e)?e.includes(t.progress.status):t.progress.status===e}function hd(t,e){if(!e)return!0;let r=!1;return t.streams.forEach(n=>{Bc(n,e)&&(r=!0)}),r}async function xd(t,e,r){let n=await Fc(r,e);return ra.fromObjectData(t,e,n)}async function md(t,e,r){let n=[];for(;n.length<e.length;){let s=await Fc(r,e[n.length]);n.push(s)}return ld.newFromObjectResponse(t,e,n)}async function Fc(t,e){if(!await t.hasNext())throw new Te("object iterator has been consumed");let r=await t.next();if(!r||r.error||r.data===void 0||r.data===null)throw new Te("object iterator undefined response",{cause:r?.error});if(r?.data?.objectId!==e)throw new Te("stream id not aligned");return r}function pd(t){return{status:na(t?.status),coinType:Ic(t?.coinType),sender:kc(t?.sender)}}function gd(t){return{status:na(t?.status),coinType:Ic(t?.coinType),recipient:kc(t?.recipient)}}function na(t){return t===void 0||t.length===0?"all":Array.isArray(t)?t.reduce((e,r)=>{let n=na(r);return!e||e===n?n:"all"},void 0):yd(t)}function yd(t){switch(t){case"STREAMING":case"STREAMED":case"CANCELED":return"active";case"COMPLETED":case"SETTLED":return"inactive";default:throw new he("Unknown stream filtered status")}}function Ic(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>_o(e)):void 0:_o(t)}function kc(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>Hn(e)):void 0:Hn(t)}var vd=class extends xe{constructor(t,e,r){super(4,`Not enough balance: ${t}`,{context:{coinType:t,requestAmount:e,gotAmount:r}}),this.coinType=t,this.requestAmount=e,this.gotAmount=r}},bd=25;async function wd(t,e,r,n="0x2::sui::SUI",s=bd){let a=new Cd(t,e,n,s),o=BigInt(0),i=[];for(;await a.hasNext()&&o<r;){let c=await a.next();c&&(i.push(c),o+=BigInt(c.balance))}if(o<r)throw new vd(n,r,o);return i}var Cd=class extends Ac{constructor(t,e,r,n){super(new Ed(t,e,r,n)),this.suiClient=t,this.owner=e,this.coinType=r,this.reqPageSize=n}},Ed=class{constructor(t,e,r,n){if(this.suiClient=t,this.owner=e,this.coinType=r,this.reqPageSize=n,n<=0)throw new Te("Invalid reqPageSize")}nextCursor;async doNextRequest(){let t=await this.suiClient.getCoins({owner:this.owner,coinType:this.coinType,cursor:this.nextCursor,limit:this.reqPageSize});return this.nextCursor=t.nextCursor,{data:t.data,hasNext:t.hasNextPage}}},Sd=class{constructor(t){this.msafe=t}get type(){return"msafe"}async address(){return this.msafe.address()}async requestCoins(t){return this.msafe.requestCoins(t)}},Ad=class{constructor(t){this.account=t}async address(){return this.account.address}},Dd=class{constructor(t,e){this.singleWallet=t,this.suiClient=e}get type(){return"single"}async address(){return this.singleWallet.address()}async requestCoins(t){return Promise.all(t.map(e=>this.requestCoin(e)))}async requestCoin(t){if(vc(t.coinType,Lf))return{primaryCoin:bc};if(t.amount<=0)throw new he("Invalid coin request","coinAmount",t.amount);let e=await wd(this.suiClient,await this.address(),t.amount,t.coinType);if(e.length===0)throw new Te("no coins available");return{primaryCoin:e[0].coinObjectId,mergedCoins:e.slice(1).map(r=>r.coinObjectId)}}},Td=class{globals;helper;constructor(t,e){this.globals=hc.new(t,e),this.helper=new ed(this.globals)}connectSingleWallet(t){let e=new Dd(t,this.globals.suiClient);this.globals.connectWallet(e)}connectMSafeAccount(t){let e=new Sd(t);this.globals.connectWallet(e)}async createStream(t){return this.builder().createStreams(t)}async getStream(t){return ra.new(this.globals,t)}async getIncomingStreams(t,e=10){return jo.newIncoming({globals:this.globals,query:t,pageSize:e})}async getOutgoingStreams(t,e=10){return jo.newOutgoing({globals:this.globals,query:t,pageSize:e})}async getCoinTypesForStreamFilter(){let t=await this.wallet.address();return(await this.globals.backend.getAllCoinTypes(t)).map(e=>qf(e))}async getRecipientsForStreamFilter(t){let e=await this.wallet.address();return(await this.globals.backend.getAllRecipients(e,t)).map(r=>Eo(r))}async getCreatorsForStreamFilter(t){let e=await this.wallet.address();return(await this.globals.backend.getAllSenders(e,t)).map(r=>Eo(r))}get wallet(){return this.globals.wallet}builder(){return new Sc(this.globals)}},Bd=class{constructor(t){this.data=t}serialize(){return JSON.stringify((0,Oc.default)(this.data))}},vr=class extends Bd{application="mpay";getClient(t,e){let r=new Td(t==="sui:mainnet"?"prod":"dev");return r.connectSingleWallet(new Ad(e)),r}},Uo=class extends vr{constructor(t){super(t),this.data=t}txType=X.Stream;txSubType="Cancel";async build(t){let{network:e,account:r}=t;return(await this.getClient(e,r).getStream(this.data.streamId)).cancel()}},Vo=class extends vr{constructor(t){super(t),this.data=t}txType=X.Stream;txSubType="ClaimByProxy";async build(t){let{network:e,account:r}=t;return(await this.getClient(e,r).getStream(this.data.streamId)).claimByProxy()}},Go=class extends vr{constructor(t){super(t),this.data=t}txType=X.Stream;txSubType="Claim";async build(t){let{network:e,account:r}=t;return(await this.getClient(e,r).getStream(this.data.streamId)).claim()}},Ko=class extends vr{constructor(t){super(t),this.data=t}txType=X.Stream;txSubType="CreateStream";async build(t){let{network:e,account:r}=t;return this.getClient(e,r).createStream(this.data)}},_c=class Pn{constructor(e,r){this.moveCall=e,this.txb=r}decodeSharedObjectId(e){let r=this.getInputParam(e);return Pn.getSharedObjectId(r)}decodeOwnedObjectId(e){let r=this.getInputParam(e);return Pn.getOwnedObjectId(r)}decodeInputU64(e){let r=this.decodePureArg(e,"u64");return BigInt(r)}decodeInputAddress(e){let r=this.decodePureArg(e,"address");return yr(r)}decodeInputString(e){return this.decodePureArg(e,"string")}decodeInputBool(e){return this.decodePureArg(e,"bool")}decodePureArg(e,r){let n=this.getInputParam(e);return Pn.getPureInputValue(n,r)}getInputParam(e){let r=this.moveCall.arguments[e];if(r.kind!=="Input")throw new Error("not input type");return this.txb.blockData.inputs[r.index]}static getPureInputValue(e,r){if(e.type!=="pure")throw new Error("not pure argument");if(typeof e.value=="object"&&"Pure"in e.value){let n=e.value.Pure;return $o.de(r,new Uint8Array(n))}return e.value}static getOwnedObjectId(e){if(e.type!=="object")throw new Error(`not object argument: ${JSON.stringify(e)}`);if(typeof e.value=="object"){if(!("Object"in e.value)||!("ImmOrOwned"in e.value.Object))throw new Error("not ImmOrOwned");return yr(e.value.Object.ImmOrOwned.objectId)}return yr(e.value)}static getSharedObjectId(e){if(e.type!=="object")throw new Error(`not object argument: ${JSON.stringify(e)}`);if(typeof e.value!="object")return yr(e.value);if(!("Object"in e.value)||!("Shared"in e.value.Object))throw new Error("not Shared");return yr(e.value.Object.Shared.objectId)}static getPureInput(e,r){if(e.type!=="pure")throw new Error("not pure argument");if(typeof e.value!="object")return e.value;if(!("Pure"in e.value))throw new Error("Pure not in value");let n=e.value.Pure;return $o.de(r,new Uint8Array(n))}typeArg(e){return Fd(this.moveCall.typeArguments[e])}txArg(e){return this.moveCall.arguments[e]}},Id=class{constructor(t,e){this.globals=t,this.txb=e}decode(){let t=this.decodeCreateStreamInfo(),e=this.createStreamHelper().calculateCreateStreamFees(t);return{type:"CreateStream",info:t,fees:e}}decodeCreateStreamInfo(){let t=this.createStreamTransactions().map(e=>this.getCreationInfoFromMoveCall(e));return this.aggregateGroupStreamInfo(t)}createStreamTransactions(){let t=this.transactions.filter(e=>e.kind==="MoveCall"&&Bt(e.target,this.contract.createStreamTarget));if(t.length===0)throw new Te("No create stream transactions");return t.map(e=>new _c(e,this.txb))}getCreationInfoFromMoveCall(t){let e=t.decodeInputString(4),{name:r,groupId:n}=Js(e),s=t.decodeInputAddress(5),a=t.decodeInputU64(6),o=t.decodeInputU64(7),i=t.decodeInputU64(8),c=t.decodeInputU64(9),l=t.decodeInputU64(10),u=t.decodeInputBool(11),d=t.typeArg(0);return{name:r,groupId:n,recipient:s,timeStart:a,cliff:o,epochInterval:i,totalEpoch:c,amountPerEpoch:l,cancelable:u,coinType:d}}aggregateGroupStreamInfo(t){if(new Set(t.map(r=>JSON.stringify({name:r.name,groupId:r.groupId,timeStart:String(r.timeStart),epochInterval:String(r.epochInterval),totalEpoch:String(r.totalEpoch),cancelable:r.cancelable,coinType:r.coinType}))).size!==1)throw new he("Stream group not have common info");let e=t.map(r=>({address:r.recipient,amountPerStep:r.amountPerEpoch,cliffAmount:r.cliff}));return{name:t[0].name,coinType:t[0].coinType,recipients:e,interval:t[0].epochInterval,steps:t[0].totalEpoch,startTimeMs:t[0].timeStart,cancelable:t[0].cancelable}}mergeCoinTransactions(){return this.transactions.filter(t=>t.kind==="MergeCoins")}get transactions(){return this.txb.blockData.transactions}get contract(){return new jn(this.globals.envConfig.contract,this.globals)}get feeContract(){return new Ec(this.globals.envConfig.contract,this.globals)}createStreamHelper(){return new Xs(this.globals,this.feeContract,this.contract)}getInputArg(t){if(t.kind!=="Input")throw new Error("not input type");return"value"in t?t:this.txb.blockData.inputs[t.index]}},kd=class{constructor(t,e){this.globals=t,this.txb=e,this.contract=new jn(t.envConfig.contract,t)}contract;decode(){if(this.isCreateStreamTransaction())return this.decodeCreateStreamTransaction();if(this.isClaimByProxyTransaction())return this.decodeClaimByProxyTransaction();if(this.isSetAutoClaimTransaction())return this.decodeSetAutoClaimTransaction();if(this.isCancelStreamTransaction())return this.decodeCancelStreamTransaction();if(this.isClaimStreamTransaction())return this.decodeClaimTransaction()}get transactions(){return this.txb.blockData.transactions}isCreateStreamTransaction(){return this.transactions.findIndex(t=>t.kind==="MoveCall"&&Bt(t.target,this.contract.createStreamTarget))!==-1}isSetAutoClaimTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Bt(this.transactions[0].target,this.contract.setAutoClaimTarget)}isCancelStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Bt(this.transactions[0].target,this.contract.cancelStreamTarget)}isClaimStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Bt(this.transactions[0].target,this.contract.claimStreamTarget)}isClaimByProxyTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Bt(this.transactions[0].target,this.contract.claimStreamByProxyTarget)}decodeCreateStreamTransaction(){return new Id(this.globals,this.txb).decode()}decodeSetAutoClaimTransaction(){let t=this.helper.decodeSharedObjectId(0),e=this.helper.decodeInputBool(1);return{type:"SetAutoClaim",streamId:t,enabled:e}}decodeClaimTransaction(){return{type:"Claim",streamId:this.helper.decodeSharedObjectId(0)}}decodeClaimByProxyTransaction(){return{type:"ClaimByProxy",streamId:this.helper.decodeSharedObjectId(0)}}decodeCancelStreamTransaction(){return{type:"Cancel",streamId:this.helper.decodeSharedObjectId(0)}}get helper(){let t=this.transactions[0];return new _c(t,this.txb)}},Zo=class extends vr{constructor(t){super(t),this.data=t}txType=X.Stream;txSubType="SetAutoClaim";async build(t){let{network:e,account:r}=t;return(await this.getClient(e,r).getStream(this.data.streamId)).setAutoClaim(this.data.enabled)}},Od=class{application="mpay";async deserialize(t){let{chain:e,transactionBlock:r}=t,n=hc.new(e==="sui:mainnet"?"prod":"dev"),s=new kd(n,r).decode(),a;switch(s.type){case"CreateStream":a=new Ko(s.info);break;case"SetAutoClaim":a=new Zo({streamId:s.streamId,enabled:s.enabled});break;case"Claim":a=new Go({streamId:s.streamId});break;case"ClaimByProxy":a=new Vo({streamId:s.streamId});break;case"Cancel":a=new Uo({streamId:s.streamId});break;default:throw new Error(`Unknown transaction type: ${s}`)}return{txType:a.txType,txSubType:a.txSubType,intentionData:a.data}}async build(t){let{intentionData:e}=t,r;switch(t.txSubType){case"CreateStream":r=new Ko(e);break;case"Claim":r=new Go(e);break;case"ClaimByProxy":r=new Vo(e);break;case"SetAutoClaim":r=new Zo(e);break;case"Cancel":r=new Uo(e);break;default:throw new Error("not implemented")}return r.build({...t})}},sa=class{constructor(t){this.data=t}get application(){return"msafe-core"}serialize(){return JSON.stringify((0,Mc.default)(this.data))}},_d=class Pc extends sa{constructor(e){super(e),this.data=e}txType;txSubType;async build(e){let{suiClient:r,account:n}=e;return i0(r,this.data,n.address)}static fromData(e){return new Pc(e)}},Md=class Nc extends sa{constructor(e){super(e),this.data=e}txType;txSubType;async build(e){let{suiClient:r,account:n}=e;return o0(r,this.data,n.address)}static fromData(e){return new Nc(e)}},Nd=class Rc extends sa{constructor(e){super(e),this.data=e}txType;txSubType;async build(e){let{account:r}=e,n=Pd.from(this.data.content);if(!Be(n.blockData.sender,r.address))throw new Error("Invalid sender address");return n}static fromData(e){return new Rc(e)}},Rd=class{application;constructor(){this.application=Oe}deserialize(){throw new Error("MSafe core transaction intention should be build from API")}async build(t){let{suiClient:e,account:r}=t,n;switch(t.txSubType){case le.assets.coin.send:n=_d.fromData(t.intentionData);break;case le.assets.object.send:n=Md.fromData(t.intentionData);break;case le.others.plain:n=Nd.fromData(t.intentionData);break;default:throw new Error("not implemented")}return n.build({suiClient:e,account:r})}},Hd=class{apps;constructor(t){this.apps=new Map(t.map(e=>[e.application,e]))}getAppHelper(t){let e=this.apps.get(t);if(!e)throw new Error(`${t} not registered`);return e}},qd="msafe-plain-tx",zd=le.others.plain,Ud=class{application;constructor(){this.application=qd}async deserialize(t){let{transactionBlock:e,suiClient:r}=t,n=await e.build({client:r});return{txType:X.Other,txSubType:zd,intentionData:{content:Ld(n)}}}async build(t){let{suiClient:e,account:r}=t,n=Wd.from(jd(t.intentionData.content)),s=await e.devInspectTransactionBlock({transactionBlock:n,sender:r.address});if(s.effects.status.status!=="success")throw new Error(s.effects.status.error);return n}},Ln=new Hd([new Rd,new Od,new Ud]);import{TransactionBlock as Gc}from"@mysten/sui.js/transactions";import{normalizeStructTag as th}from"@mysten/sui.js/utils";import{TransactionBlock as Vd}from"@mysten/sui.js/transactions";var Gd=1000n,Kd=120n,$d=100n,Zd={multiplier:{numerator:Kd,denominator:$d}};var qn=class{constructor(e){this.globals=e}async simulate(e,r=Zd){let n=this.copyTransactionBlock(e.txb),{suiClient:s}=this.globals,a=await this.getGasPrice(r);n.setGasPrice(a);let o=await s.devInspectTransactionBlock({transactionBlock:n,sender:e.sender}),{gasUsed:i}=o.effects,c=this.toGasBudget(i,a),l=o.effects.status.status==="success",u;return l||(u=o.effects.status.error),{success:l,gasPrice:a,gasObject:o.effects.gasObject.reference,gasUsed:i,gasBudget:c,simulationError:u}}async getGasPrice(e){if(this.isFixedValue(e))return e.fixedVal;let r=await this.globals.suiClient.getReferenceGasPrice();return this.applyGasOption(r,e)}toGasBudget(e,r){let{computationCost:n,storageCost:s}=e,a=Gd*r,o=BigInt(n)+a,i=o+BigInt(s);return i>o?i:o}isFixedValue(e){return"fixedVal"in e}isMultiplier(e){return"multiplier"in e}applyGasOption(e,r){if(this.isFixedValue(r))return r.fixedVal;if(this.isMultiplier(r)){let{multiplier:n}=r;return e*n.numerator/n.denominator}throw new Error("Sanity: Unknown gas price option")}copyTransactionBlock(e){return Vd.from(e.serialize())}};import{Buffer as Hc}from"buffer";function aa(t){return Hc.from(t,"utf-8")}function ag(t){return`0x${Array.prototype.map.call(t,e=>`0${e.toString(16)}`.slice(-2)).join("")}`}function ia(t){return Uint8Array.from(Hc.from(t.startsWith("0x")?t.slice(2):t,"hex"))}import{verifyPersonalMessage as Yd,verifyTransactionBlock as Jd}from"@mysten/sui.js/verify";import{normalizeSuiAddress as ca,normalizeStructTag as ua}from"@mysten/sui.js/utils";import{normalizeStructTag as oa}from"@mysten/sui.js/utils";var zn=class{_client;_coinMetaReg;constructor(e){this._client=e,this._coinMetaReg=new Map}async getCoinMeta(e){let r=oa(e);if(this._coinMetaReg.has(r))return this._coinMetaReg.get(r);let n=await this.queryCoinMeta(r);return n&&this._coinMetaReg.set(r,n),n}async queryCoinMeta(e){return await this._client.getCoinMetadata({coinType:e})||void 0}},Wc=/^0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<(.+)>$/,Un=class t{static isCoin(e){return e?oa(e).match(Wc)!=null:!1}static getCoinType(e){let[,r]=oa(e).match(Wc)??[];return r||null}static getBalance(e){if(!t.isCoin(e.type)||e.content?.dataType!=="moveObject")return;let{balance:r}=e.content?.fields;if(r!==void 0)return BigInt(r)}};var et=class{static normalizeSuiAddress(e){return ca(e)}static normalizeStructTag(e){return ua(e)}static isSuiAddressEqual(e,r){return ca(e)===ca(r)}static isSuiStructEqual(e,r){return ua(e)===ua(r)}static isCoinObjectType(e){return Un.isCoin(e)}};function jc(t,e){return t.startsWith(e)?t:e+t}var Lc=class t{static async getPublicKeyFromSignature(e){return e.messageType==="TransactionBlock"?Jd(e.message,e.signature):Yd(e.message,e.signature)}static async getPublicKeyFromPersonalSignature(e){let r=aa(e.messageStr);return this.getPublicKeyFromSignature({message:r,messageType:"Personal",signature:e.signature})}static async verifySignature(e){let r=await t.getPublicKeyFromSignature(e);return et.isSuiAddressEqual(r.toSuiAddress(),e.targetAddress)}static async verifyPersonalSignature(e){let r=aa(e.messageStr);return this.verifySignature({message:r,messageType:"Personal",signature:e.signature,targetAddress:e.targetAddress})}static async verifyTransactionSignature(e){return this.verifySignature({messageType:"TransactionBlock",message:e.payload,signature:e.signature,targetAddress:e.targetAddress})}};import{parseSerializedSignature as Xd}from"@mysten/sui.js/cryptography";import{MultiSigPublicKey as Qd}from"@mysten/sui.js/multisig";var Cg="0x2::sui::SUI";async function qc(t,e){let r;try{r=await t.queryTransactionBlocks({filter:{FromAddress:e},options:{showInput:!0},limit:2})}catch{return}if(r.data.length===0||!r.data[0].transaction?.txSignatures)return;let s=r.data[0].transaction?.txSignatures;for(let a=0;a!==s.length;a++){let o=s[a],i=eh(o,e);if(i)return i}}function eh(t,e){let r=Xd(t);switch(r.signatureScheme){case"MultiSig":{let n=new Qd(r.multisig.multisig_pk).toSuiAddress();if(et.isSuiAddressEqual(n,e))throw new Error("multi-sig wallet cannot be owner");return}case"ZkLogin":{if(et.isSuiAddressEqual(r.zkLogin.address,e))throw new Error("ZkLogin wallet cannot be owner");return}case"ED25519":case"Secp256k1":case"Secp256r1":{let n=Ue.de({publicKeyEncoded:r.publicKey,schema:r.signatureScheme});return et.isSuiAddressEqual(n.toSuiAddress(),e)?n:void 0}default:throw new Error("Unknown schema")}}async function Eg(t){let e=!0,r,n=[];for(;e;){let s=await t.suiClient.getCoins({owner:t.owner,coinType:t.coinType,cursor:r});n.push(...s.data),e=s.hasNextPage,r=s.nextCursor}return n}var zc=25;async function Uc(t){let e=[];for(;await t.hasNext();){let r=await t.next();e.push(r)}return e&&Array.isArray(e[0])?e.flat(1):e}var la=class{constructor(e){this.requester=e;this.curPage=void 0,this.init=!0}curPage;init;async hasNext(){if(this.init)return this.curPage||(this.curPage=await this.requester.doNextRequest()),!!this.curPage.data?.length||this.curPage.hasNext;if(!this.curPage)throw new Error("invalid implementation of iterator");return this.curPage.hasNext}async next(){return this.init?(this.init=!1,this.curPage||(this.curPage=await this.requester.doNextRequest()),this.curPage.data):(this.curPage=await this.requester.doNextRequest(),this.curPage.data)}},Vn=class{constructor(e){this.requester=e;this.pager=new la(e),this.curData=[],this.cursor=0}cursor;pager;curData;async hasNext(){return this.cursor<this.curData.length-1?!0:this.pager.hasNext()}async next(){for(this.cursor+=1;this.cursor>=this.curData.length;)if(await this.pager.hasNext())this.curData=await this.pager.next(),this.cursor=0;else throw new Error("not more data");return this.curData[this.cursor]}};async function Vc(t,e,r){let n=new fa(t,e,r);return await Uc(n)}var fa=class extends Vn{constructor(r,n,s){super(new da(r,n,s));this.provider=r;this.owner=n;this.options=s}},da=class{constructor(e,r,n){this.provider=e;this.owner=r;this.options=n;this.nextCursor=null,this.filter=n?.filter,this.pageSize=n?.pageSize||zc,this.objectOptions=n?.objectOptions||{showType:!0,showContent:!0}}nextCursor;filter;pageSize;objectOptions;async doNextRequest(){let e=await this.provider.getOwnedObjects({owner:this.owner,options:this.objectOptions,cursor:this.nextCursor,limit:this.pageSize});this.nextCursor=e.nextCursor;let r;if(this.filter){let{filter:n}=this;r=e.data.filter(s=>n?.(s))}else r=e.data;return{data:r.map(n=>n.data).filter(n=>n),hasNext:e.hasNextPage}}};var Ft=class t{constructor(e,r){this.globals=e;this.info=r;this.multiSig=new dn({threshold:r.threshold,ownersWithWeight:r.owners,creationNonce:r.creationNonce}),this.coinHelper=new zn(this.suiClient),this.simulator=new qn(e)}multiSig;coinHelper;simulator;static async New(e,r){let n=await e.backend.getMSafeAccountInfo(r);if(new t(e,n).address!==r)throw new Error("Invalid msafe config with address")}async ownedCoins(){let e=await this.suiClient.getAllBalances({owner:this.address});return Promise.all(e.map(async r=>{let n=await this.coinHelper.getCoinMeta(r.coinType),s=r.lockedBalance.number?BigInt(r.totalBalance)-BigInt(r.lockedBalance.number):BigInt(r.totalBalance);return{type:th(r.coinType),balance:BigInt(s),metadata:n}}))}async ownedObjects(e){let r={filter:n=>!n?.data?.type?.startsWith("0x2::coin::Coin"),...e};return Vc(this.suiClient,this.address,r)}async pendingTransaction(){let e=await this.backend.getPendingTransactions({msafeAddress:this.address});if(!e.pending)return;let r=e.pending,n=e.reject;return{application:r.application,txType:r.txType,txSubType:r.txSubType,createdAt:r.createdAt,creator:r.creator,digest:r.digest,intention:r.intention,sequenceNumber:r.sequenceNumber,payload:r.payload,votes:r.votes,approvalWeight:this.calculateWeightFromVotes(r.votes),msafeAddress:r.msafeAddress,rejectDigest:n?.digest??"",rejectPayload:n?.payload??"",rejectVotes:n?.votes??[],rejectWeight:this.calculateWeightFromVotes(n?.votes??[])}}async historyTransaction(e){return this.backend.getHistoryTransactions({msafeAddress:this.address,...e})}async futureIntentions(e){return this.backend.getFutureIntentions({msafeAddress:this.address,...e})}async currentSequenceNumber(){return this.backend.getCurrentSequenceNumber(this.address)}async nextSequenceNumber(){return this.backend.getNextSequenceNumber(this.address)}async simulateIntention(e){let r=Ln.getAppHelper(e.application);if(!r)throw new Error(`Can't find app helper for application ${e.application}`);let n=await r.build({network:"sui:testnet",intentionData:e.intention,txType:e.txType,txSubType:e.txSubType,suiClient:this.globals.suiClient,account:{address:this.address}});return this.simulator.simulate({txb:n,sender:this.address})}async proposeIntention(e){let r=_e.proposeIntentionMessage({msafeAddress:this.address,intention:e.intention,sn:e.sequenceNumber}),n=await this.wallet.signPersonalMessage({messageStr:r});return this.backend.proposeIntention({...e,msafeAddress:this.address,signature:n.signature})}async proposeIntentionAndBuildVote(e){let r=_e.proposeIntentionMessage({msafeAddress:this.address,intention:e.intention,sn:e.sequenceNumber}),n=await this.wallet.signPersonalMessage({messageStr:r});return this.backend.proposeIntentionAndBuildVote({...e,msafeAddress:this.address,signature:n.signature})}async simulateCoinTransferIntention(e){let r=await this.nextSequenceNumber();return this.simulateIntention({application:Oe,txType:X.Assets,txSubType:le.assets.coin.send,sequenceNumber:r,intention:e})}async proposeCoinTransferIntention(e){let r=await this.nextSequenceNumber();return this.proposeIntention({application:Oe,txType:X.Assets,txSubType:le.assets.coin.send,sequenceNumber:r,intention:e})}async simulateObjectTransferIntention(e){let r=await this.nextSequenceNumber();return this.simulateIntention({application:Oe,txType:X.Assets,txSubType:le.assets.object.send,sequenceNumber:r,intention:e})}async proposeObjectTransferIntention(e){let r=await this.nextSequenceNumber();return this.proposeIntention({application:Oe,txType:X.Assets,txSubType:le.assets.object.send,sequenceNumber:r,intention:e})}async simulatePlainPayloadIntention(e){let r=await this.nextSequenceNumber();return this.simulateIntention({application:Oe,txType:X.Other,txSubType:le.others.plain,sequenceNumber:r,intention:e})}async proposePlainPayloadIntention(e){let r=await this.nextSequenceNumber(),n=Gc.from(e.payload);if(!n.blockData.sender||!Be(n.blockData.sender,this.address))throw new Error("Transaction sender is not same as the multisig address");return this.proposeIntention({application:Oe,txType:X.Other,txSubType:le.others.plain,sequenceNumber:r,intention:e})}async voteForTransaction(e,r){let n=ia(r),s=await this.wallet.signTransactionBlock({transactionBlock:n});return this.backend.voteForTransaction({msafeAddress:this.address,digest:e,signature:s.signature})}async proposePendingTransaction(e){let r=new Gc,n=await r.build({client:this.suiClient}),s=await r.getDigest({client:this.suiClient}),a=await this.wallet.signTransactionBlock({transactionBlock:n});return this.backend.proposePendingTransaction({msafeAddress:this.address,userAddress:await this.userAddress(),intention:e,digest:s,signature:a.signature})}async simulateRejectTx(){let e=await this.pendingTransaction();if(!e||e.rejectDigest!=="")throw new Error("Already rejected");let r=e.payload,n=cs(this.address,r);return this.simulator.simulate({txb:n,sender:this.address})}async rejectCurrentTx(e){let r=await this.pendingTransaction();if(!r||r.rejectDigest!=="")throw new Error("Already rejected");let n=r.payload,s=cs(this.address,n),a=await s.getDigest({client:this.suiClient}),o=await s.build({client:this.suiClient}),i=await this.wallet.signTransactionBlock({transactionBlock:o});return this.backend.rejectCurrentTx({msafeAddress:this.address,digest:a,signature:i.signature,...e})}async simulateBuildTransaction(){let e=await this.backend.getNextIntention({msafeAddress:this.address});console.log("\u{1F680} ~ MSafeAccount ~ simulateBuildTransaction ~ appHelper:",Ln.apps);let r=Ln.getAppHelper(e.application);if(!r)throw new Error(`Can't find app helper for application ${e.application}`);let n=await r.build({network:"sui:testnet",intentionData:e.intention,txType:e.txType,txSubType:e.txSubType,suiClient:this.globals.suiClient,account:{address:this.address}});return this.simulator.simulate({txb:n,sender:this.address})}async buildNextIntentionAndAddToPending(e){return this.backend.buildNextIntentionAndAddToPending({msafeAddress:this.address,forceBuild:e.forceBuild,gasPrice:e.gasPrice,gasBudget:e.gasBudget})}async skipNextFailedIntention(){return this.backend.skipNextFailedIntention({msafeAddress:this.address})}async executePendingTx(e,r=!1){let n=r?e.rejectVotes:e.votes,s=r?e.rejectPayload:e.payload;if(this.calculateWeightFromVotes(n)<this.info.threshold)throw new Error("Not enough signature");let a=[],o=new Map(n.map(c=>[c.userAddress,c.signature]));for(let c=0;c<this.info.owners.length;c++){let l=this.info.owners[c],u=o.get(l.address);u&&a.push(u)}let i=this.multiSig.combinePartialSignatures(a);return this.suiClient.executeTransactionBlock({transactionBlock:ia(s),signature:i,options:{showEffects:!0}})}async dashboard(){return this.backend.getDashboard({msafeAddress:this.address})}calculateWeightFromVotes(e){return this.calculateWeight(e.map(r=>r.userAddress))}calculateWeight(e){let r=0;for(let n=0;n<e.length;n++){let s=this.info.owners.find(a=>Be(a.address,e[n]));s&&(r+=s.weight)}return r}get address(){return this.multiSig.address}get backend(){return this.globals.backend}get wallet(){return this.globals.wallet}async userAddress(){return this.globals.wallet.address()}get suiClient(){return this.globals.suiClient}};import{normalizeSuiAddress as rh}from"@mysten/sui.js/utils";var Gn=class{constructor(e){this.globals=e;this.knownPublicKeys=new Map}knownPublicKeys;async getPublicKey(e){let r=this.knownPublicKeys.get(e);if(r)return r;let n=await this._getPublicKey(e);return n&&this.knownPublicKeys.set(e,n),n}async getPublicKeyBatch(e){let r=new Array(e.length).fill(void 0);for(let a=0;a<e.length;a++){let o=e[a];r[a]=this.knownPublicKeys.get(o)}let n=r.map((a,o)=>a===void 0?o:-1).filter(a=>a!==-1);if(n.length===0)return r;let s=await this.globals.backend.getPublicKeyBatch(n.map(a=>e[a]));for(let a=0;a<n.length;a++){let o=n[a];r[o]=s[a]}for(let a=0;a<r.length;a++)r[a]===void 0&&(r[a]=await this.getPublicKeyFromChain(e[a]));for(let a=0;a<e.length;a++)r[a]&&this.knownPublicKeys.set(e[a],r[a]);return r}addPublicKey(e,r){if(!Be(e,r.toSuiAddress()))throw new Error("Invalid public key");this.knownPublicKeys.set(rh(e),r)}async _getPublicKey(e){let r=await this.getPublicKeyFromBackend(e);if(r)return r;let n=await this.getPublicKeyFromChain(e);if(n)return n}async getPublicKeyFromBackend(e){try{return await this.globals.backend.getPublicKey(e)}catch{return}}async getPublicKeyFromChain(e){return qc(this.globals.suiClient,e)}};var Kn=class{constructor(e){this.globals=e}async create(e){return this.globals.backend.submitReport(e)}};import{SuiClient as uh}from"@mysten/sui.js/client";import br from"axios";var $n=class t{constructor(e){this.apiURL=e}_token;async authSign(e){let r=await this.post("/auth/login",e);return this._token=r.data.accessToken,this._token}async verifyToken(e){try{return(await this.get("/auth",{headers:this.headers(e)})).status===200}catch{return!1}}setJWTToken(e){this._token=e}async getPublicKey(e){return(await this.getPublicKeyBatch([e]))[0]}async getPublicKeyBatch(e){let r={userAddressList:e};return(await this.get("/user/public-keys",{params:r,headers:this.headers()})).data?.map(s=>s?Ue.de(s):void 0)}async getMSafeAccountInfo(e){let r={msafeAddress:e},n=await this.get("/msafe",{params:r,headers:this.headers()});return t.toMSafeConfig(n.data)}async getUserInfo(){return(await this.get("/user",{headers:this.headers()})).data}async getOwnedMSafeByStatus(e){let r={status:e.status??jt.active,...e.pagination?{page:e.pagination.page.toString(),limit:e.pagination.limit.toString()}:{}},n=await this.get("/msafe/owned",{params:r,headers:this.headers()});return{data:n.data.data.map(t.toMSafeConfig),meta:n.data.meta}}async updateMSafeStatus(e){let r=e;await this.post("/msafe/status",r,{headers:this.headers()})}async getPendingTransactions(e){return(await this.get("/transaction/pending",{params:e,headers:this.headers()})).data}async getHistoryTransactions(e){return(await this.get("/transaction/history",{params:e,headers:this.headers()})).data}async getFutureIntentions(e){return(await this.get("/transaction/intention",{params:e,headers:this.headers()})).data}async getNextIntention(e){return(await this.get("/transaction/intention/next",{params:e,headers:this.headers()})).data}async getCurrentSequenceNumber(e){return(await this.get("/transaction/sn/current",{params:{msafeAddress:e},headers:this.headers()})).data}async getNextSequenceNumber(e){return(await this.get("/transaction/sn/next",{params:{msafeAddress:e},headers:this.headers()})).data}async createMSafeAccount(e){await this.post("/msafe/create",e,{headers:this.headers()})}async proposeIntention(e){await this.post("/transaction/intention",e,{headers:this.headers()})}async proposePendingTransaction(e){}async rejectCurrentTx(e){await this.post("/transaction/pending/reject",{...e,gasPrice:e.gasPrice.toString(),gasBudget:e.gasBudget.toString()},{headers:this.headers()})}async voteForTransaction(e){await this.post("/transaction/pending/vote",e,{headers:this.headers()})}async buildNextIntentionAndAddToPending(e){await this.post("/transaction/pending/build",{...e,gasPrice:e.gasPrice.toString(),gasBudget:e.gasBudget.toString()},{headers:this.headers()})}async proposeIntentionAndBuildVote(e){await this.post("/transaction/intention/build",{...e,gasPrice:e.gasPrice.toString(),gasBudget:e.gasBudget.toString()},{headers:this.headers()})}async skipNextFailedIntention(e){await this.post("/transaction/pending/skip",e,{headers:this.headers()})}async getAddressBookEntries(e){return(await this.get("/address-book",{headers:this.headers(),params:e})).data}async updateAddressBook(e){await this.post("/address-book",e,{headers:this.headers()})}async getAddressBookMode(){return(await this.get("/address-book/mode",{headers:this.headers()})).data}async setAddressBookMode(e){await this.post("/address-book/mode",{mode:e.mode},{headers:this.headers()})}async submitReport(e){await this.post("/report",e)}async getDashboard(e){return(await this.get("/dashboard",{params:e,headers:this.headers()})).data}headers(e){return{Authorization:`Bearer ${e||this._token}`}}static toMSafeConfig(e){return{...e,owners:e.owners.map(r=>({address:r.address,weight:r.weight,publicKey:Ue.de({publicKeyEncoded:r.publicKeyEncoded,schema:r.schema})}))}}async get(e,r){let n=this.getFullUrl(e),s=await br.get(n,r);if(br.isAxiosError(s))throw Zn.fromError(s)??new Error(s.statusText);return s}async post(e,r,n){let s=this.getFullUrl(e),a=await br.post(s,r,n);if(br.isAxiosError(a))throw Zn.fromError(a)??new Error(a.statusText);return a}getFullUrl(e){return e.startsWith(this.apiURL)?e:`${this.apiURL}${jc(e,"/")}`}},Zn=class t extends Error{constructor(r){super();this.e=r;Error.captureStackTrace(this,this.constructor)}name;static fromError(r){if(br.isAxiosError(r)&&r?.response?.data&&"message"in r.response.data)return new t(r)}get status(){return this.e.response?.status??void 0}get message(){return`${this.respMessage()??"Unknown resp"}`}respMessage(){if(this.e.response?.data)return(this.e.response?.data).message??void 0}get endpoint(){return this.e.config?.url??""}toString(){return this.message}};var nh=(a=>(a.local="local",a.unit="unit",a.dev="dev",a.prev="prev",a.prod="prod",a))(nh||{}),ha="https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD",Kc="https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7",$c="http://127.0.0.1:3000",Zc="http://127.0.0.1:3001",sh="https://sui-dev.m-safe.link",ah="http://13.56.226.148:81",ih="https://sui-preview.m-safe.link",oh="https://sui.m-safe.link",ch=new Map([["unit",{suiClient:{url:ha},backend:{url:$c},syncingURL:Zc}],["local",{suiClient:{url:ha},backend:{url:$c},syncingURL:Zc}],["dev",{suiClient:{url:ha},backend:{url:sh},syncingURL:ah}],["prev",{suiClient:{url:Kc},backend:{url:ih},syncingURL:""}],["prod",{suiClient:{url:Kc},backend:{url:oh},syncingURL:""}]]);function Yc(t,e){let r=ch.get(t);if(!r)throw new Error("Unknown environment");return e?.suiClient?.url&&(r.suiClient.url=e.suiClient.url),e?.backend?.url&&(r.backend.url=e.backend.url),r}var Yn=class t{backend;suiClient;config;_wallet;constructor(e){this.backend=e.backend,this.suiClient=e.suiClient,this.config=e.config}static async New(e,r){let n=Yc(e,r),s=new uh(n.suiClient),a=new $n(n.backend.url);return new t({backend:a,suiClient:s,config:n})}connectWallet(e){this._wallet=e}get wallet(){if(!this._wallet)throw new Error("wallet not connected");return this._wallet}set wallet(e){this._wallet=e}};var xa=class t{constructor(e){this.globals=e}_creationHelper;_publicKeyHelper;static async New(e,r){let n=await Yn.New(e,r);return new t(n)}async connectWallet(e){if(e.jwtToken&&await this.backend.verifyToken(e.jwtToken))return this.globals.wallet=e.wallet,this.backend.setJWTToken(e.jwtToken),e.jwtToken;let r=await this.authSign(e.wallet);return this.globals.wallet=e.wallet,this.backend.setJWTToken(r),r}async authSign(e){let r=_e.loginMessageWithTimestamp(new Date().toUTCString()),n=await e.signPersonalMessage({messageStr:r});return this.backend.authSign({address:await e.address(),message:r,signature:n.signature,walletType:e.walletType})}async userInfo(){return this.globals.backend.getUserInfo()}async ownedMSafe(e){return this.globals.backend.getOwnedMSafeByStatus({status:jt.active,pagination:e})}async createAccount(e){return this.creationHelper.submitMSafeCreation(e)}getMSafeAccount(e){return new Ft(this.globals,e)}async getMSafeAccountFromAddress(e){let r=await this.backend.getMSafeAccountInfo(e);return new Ft(this.globals,r)}get creationHelper(){return this._creationHelper||(this._creationHelper=new Lt(this.globals,this.publicKeyHelper)),this._creationHelper}get publicKeyHelper(){return this._publicKeyHelper||(this._publicKeyHelper=new Gn(this.globals)),this._publicKeyHelper}get config(){return this.globals.config}get backend(){return this.globals.backend}get wallet(){return this.globals.wallet}get AddressBook(){return new qt(this.globals)}get Invitation(){return new hn(this.globals)}get Report(){return new Kn(this.globals)}async walletAddress(){return this.wallet.address()}};export{qt as AddressBookSDK,Wc as COIN_TYPE_ARG_REGEX,Un as Coin,zn as CoinHelper,Lt as CreateHelper,sh as DEV_API_URL,ah as DEV_SYNCING_URL,ch as ENV_CONFIGS,et as Formatter,ia as HexToUint8Array,$c as LOCAL_API_URL,Zc as LOCAL_SYNCING_URL,Kc as MAINNET_RPC_URL,Ft as MSafeAccount,xa as MSafeClient,nh as MSafeEnv,Yn as MSafeGlobals,ih as PREV_API_URL,oh as PROD_API_URL,Cg as SUI_COIN,Lc as SignatureVerifier,ha as TESTNET_RPC_URL,ag as Uint8ArrayToHex,jc as addPrefix,Eg as getAllCoins,Yc as getMSafeConfig,qc as getPublicKeyFromChain,aa as stringToBuffer};
2
- /*! Bundled license information:
3
-
4
- crypto-js/ripemd160.js:
5
- (** @preserve
6
- (c) 2012 by Cédric Mesnil. All rights reserved.
7
-
8
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
9
-
10
- - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
11
- - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12
-
13
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
- *)
15
-
16
- crypto-js/mode-ctr-gladman.js:
17
- (** @preserve
18
- * Counter block mode compatible with Dr Brian Gladman fileenc.c
19
- * derived from CryptoJS.mode.CTR
20
- * Jan Hruby jhruby.web@gmail.com
21
- *)
22
-
23
- @noble/hashes/esm/utils.js:
24
- (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
25
- */
1
+ var Oi=Object.create;var wn=Object.defineProperty;var Ei=Object.getOwnPropertyDescriptor;var Ci=Object.getOwnPropertyNames;var vi=Object.getPrototypeOf,Mi=Object.prototype.hasOwnProperty;var gt=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Ai=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Ci(e))!Mi.call(r,s)&&s!==t&&wn(r,s,{get:()=>e[s],enumerable:!(n=Ei(e,s))||n.enumerable});return r};var ar=(r,e,t)=>(t=r!=null?Oi(vi(r)):{},Ai(e||!r||!r.__esModule?wn(t,"default",{value:r,enumerable:!0}):t,r));var Ds=gt((Bm,As)=>{"use strict";As.exports=r=>{if(Object.prototype.toString.call(r)!=="[object Object]")return!1;let e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}});var Ps=gt((qm,Ns)=>{"use strict";var Vr=Ds();Ns.exports=(r,e={})=>{if(!Vr(r)&&!Array.isArray(r))throw new TypeError("Expected a plain object or array");let{deep:t}=e,n=[],s=[],a=o=>{let c=n.indexOf(o);if(c!==-1)return s[c];let u=[];return n.push(o),s.push(u),u.push(...o.map(d=>Array.isArray(d)?a(d):Vr(d)?i(d):d)),u},i=o=>{let c=n.indexOf(o);if(c!==-1)return s[c];let u={},d=Object.keys(o).sort(e.compare);n.push(o),s.push(u);for(let f of d){let g=o[f],m;t&&Array.isArray(g)?m=a(g):m=t&&Vr(g)?i(g):g,Object.defineProperty(u,f,{...Object.getOwnPropertyDescriptor(o,f),value:m})}return u};return Array.isArray(r)?t?a(r):r.slice():i(r)}});var _s=gt((Um,Rs)=>{"use strict";var ic=Object.prototype.toString;Rs.exports=function(e){if(e===void 0)return"undefined";if(e===null)return"null";var t=typeof e;if(t==="boolean")return"boolean";if(t==="string")return"string";if(t==="number")return"number";if(t==="symbol")return"symbol";if(t==="function")return dc(e)?"generatorfunction":"function";if(oc(e))return"array";if(fc(e))return"buffer";if(hc(e))return"arguments";if(uc(e))return"date";if(cc(e))return"error";if(lc(e))return"regexp";switch(Fs(e)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(mc(e))return"generator";switch(t=ic.call(e),t){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")};function Fs(r){return typeof r.constructor=="function"?r.constructor.name:null}function oc(r){return Array.isArray?Array.isArray(r):r instanceof Array}function cc(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function uc(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function lc(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function dc(r,e){return Fs(r)==="GeneratorFunction"}function mc(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function hc(r){try{if(typeof r.length=="number"&&typeof r.callee=="function")return!0}catch(e){if(e.message.indexOf("callee")!==-1)return!0}return!1}function fc(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var _t=gt((Hm,Bs)=>{"use strict";var pc=Ps(),Gr=_s(),Ws=(r,e)=>!e||Gr(e)!=="array"?!1:e.indexOf(r)>-1,gc=(r,e)=>pc(r,{compare:e}),js=(r,e)=>{let t=e&&e.compareFunction;return r.slice().sort(t)};function Ls(r,e){let t=e&&e.compareFunction,n=gc(r,t);return Object.keys(r).forEach(function(s){let a=n[s],i=Gr(a);if(i==="object"){(!e||!Ws(s,e.ignoreObjectAtKeys))&&(n[s]=Ls(a,e));return}i==="array"&&(!e||!Ws(s,e.ignoreArrayAtKeys))&&(n[s]=js(a,e))}),n}var ht=(r,e)=>{let t=Gr(r);return ht[t]?ht[t](r,e):r};ht.array=js;ht.object=Ls;Bs.exports=ht});import{isSameAddress as Di,MultiSigAccount as Ni,PublicKeySerde as Sn,SigningMessageHelper as Pi}from"@msafe/sui3-utils";var _e=class{constructor(e,t){this.globals=e;this.pkHelper=t}async getPublicKeyBatch(e){return this.pkHelper.getPublicKeyBatch(e)}async calculateMSafeAddress(e){let t=await this.reduceCreationInfoToRawConfig(e);return new Ni(t).address}async validateCreateInfo(e){return this.calculateMSafeAddress(e)}addPublicKey(e,t){let n=Sn.de(t);if(!Di(e,n.toSuiAddress()))throw new Error("Public key not match");this.pkHelper.addPublicKey(e,n)}async submitMSafeCreation(e){let t=await this.validateCreateInfo(e),n=Pi.createMSafeMessage(t),s=await this.globals.wallet.signPersonalMessage({messageStr:n});return await this.submitToBackend(e,s.signature),t}async reduceCreationInfoToRawConfig(e){let t=await this.getPublicKeyBatch(e.owners.map(n=>n.address));return t.forEach((n,s)=>{if(n===void 0)throw new Error(`Unknown public key for address: ${e.owners[s].address}`)}),{threshold:e.threshold,ownersWithWeight:e.owners.map((n,s)=>({publicKey:t[s],weight:n.weight})),creationNonce:e.creationNonce}}async submitToBackend(e,t){let n=await this.pkHelper.getPublicKeyBatch(e.owners.map(s=>s.address));await this.globals.backend.createMSafeAccount({owners:e.owners.map((s,a)=>({address:s.address,weight:s.weight,...Sn.ser(n[a])})),threshold:e.threshold,name:e.name,description:e.description,creationNonce:e.creationNonce,signature:t})}};import{SigningMessageHelper as Tl,UserMSafeStatus as Il}from"@msafe/sui3-utils";import{SigningMessageHelper as Fi}from"@msafe/sui3-utils";var We=class{constructor(e){this.globals=e}async getEntries(e){return this.globals.backend.getAddressBookEntries(e)}async update(e){let t=Fi.updateAddressBookMessage(e),n=await this.globals.wallet.signPersonalMessage({messageStr:t});return this.globals.backend.updateAddressBook({updates:e,signature:n.signature})}async getMode(){return(await this.globals.backend.getAddressBookMode()).mode}async setMode(e){return this.globals.backend.setAddressBookMode({mode:e})}};var yt=class{constructor(e){this.globals=e}async getMSafeByStatus(e,t){return this.globals.backend.getOwnedMSafeByStatus({status:e,pagination:t})}async updateMSafeStatus(e,t){return this.globals.backend.updateMSafeStatus({msafeAddress:e,status:t})}};import{TransactionType as wc}from"@msafe/sui3-utils";import{SuiClient as Dc}from"@mysten/sui.js/client";import ve,{AxiosError as Fc}from"axios";import{SUI_TYPE_ARG as _c,normalizeStructTag as Wc,normalizeSuiAddress as Hs}from"@mysten/sui.js/utils";import{normalizeStructTag as Yr,SUI_TYPE_ARG as jc}from"@mysten/sui.js/utils";var G=class extends Error{},wt=class extends G{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},St=class extends G{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},bt=class extends G{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},W=class extends G{},fe=class extends G{constructor(e){super(`Invalid unit ${e}`)}},I=class extends G{},j=class extends G{constructor(){super("Zone is an abstract class")}};var l="numeric",L="short",A="long",K={year:l,month:l,day:l},je={year:l,month:L,day:l},ir={year:l,month:L,day:l,weekday:L},Le={year:l,month:A,day:l},Be={year:l,month:A,day:l,weekday:A},qe={hour:l,minute:l},Ue={hour:l,minute:l,second:l},He={hour:l,minute:l,second:l,timeZoneName:L},Ve={hour:l,minute:l,second:l,timeZoneName:A},Ge={hour:l,minute:l,hourCycle:"h23"},ze={hour:l,minute:l,second:l,hourCycle:"h23"},$e={hour:l,minute:l,second:l,hourCycle:"h23",timeZoneName:L},Ze={hour:l,minute:l,second:l,hourCycle:"h23",timeZoneName:A},Ke={year:l,month:l,day:l,hour:l,minute:l},Ye={year:l,month:l,day:l,hour:l,minute:l,second:l},Je={year:l,month:L,day:l,hour:l,minute:l},Qe={year:l,month:L,day:l,hour:l,minute:l,second:l},or={year:l,month:L,day:l,weekday:L,hour:l,minute:l},Xe={year:l,month:A,day:l,hour:l,minute:l,timeZoneName:L},et={year:l,month:A,day:l,hour:l,minute:l,second:l,timeZoneName:L},tt={year:l,month:A,day:l,weekday:A,hour:l,minute:l,timeZoneName:A},rt={year:l,month:A,day:l,weekday:A,hour:l,minute:l,second:l,timeZoneName:A};var M=class{get type(){throw new j}get name(){throw new j}get ianaName(){return this.name}get isUniversal(){throw new j}offsetName(e,t){throw new j}formatOffset(e,t){throw new j}offset(e){throw new j}equals(e){throw new j}get isValid(){throw new j}};var cr=null,Y=class r extends M{static get instance(){return cr===null&&(cr=new r),cr}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return It(e,t,n)}formatOffset(e,t){return J(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var kt={};function Ri(r){return kt[r]||(kt[r]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),kt[r]}var _i={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Wi(r,e){let t=r.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,s,a,i,o,c,u,d]=n;return[i,s,a,o,c,u,d]}function ji(r,e){let t=r.formatToParts(e),n=[];for(let s=0;s<t.length;s++){let{type:a,value:i}=t[s],o=_i[a];a==="era"?n[o]=i:h(o)||(n[o]=parseInt(i,10))}return n}var xt={},v=class r extends M{static create(e){return xt[e]||(xt[e]=new r(e)),xt[e]}static resetCache(){xt={},kt={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=r.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return It(e,t,n,this.name)}formatOffset(e,t){return J(this.offset(e),t)}offset(e){let t=new Date(e);if(isNaN(t))return NaN;let n=Ri(this.name),[s,a,i,o,c,u,d]=n.formatToParts?ji(n,t):Wi(n,t);o==="BC"&&(s=-Math.abs(s)+1);let g=pe({year:s,month:a,day:i,hour:c===24?0:c,minute:u,second:d,millisecond:0}),m=+t,x=m%1e3;return m-=x>=0?x:1e3+x,(g-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};var bn={};function Li(r,e={}){let t=JSON.stringify([r,e]),n=bn[t];return n||(n=new Intl.ListFormat(r,e),bn[t]=n),n}var ur={};function lr(r,e={}){let t=JSON.stringify([r,e]),n=ur[t];return n||(n=new Intl.DateTimeFormat(r,e),ur[t]=n),n}var dr={};function Bi(r,e={}){let t=JSON.stringify([r,e]),n=dr[t];return n||(n=new Intl.NumberFormat(r,e),dr[t]=n),n}var mr={};function qi(r,e={}){let{base:t,...n}=e,s=JSON.stringify([r,n]),a=mr[s];return a||(a=new Intl.RelativeTimeFormat(r,e),mr[s]=a),a}var nt=null;function Ui(){return nt||(nt=new Intl.DateTimeFormat().resolvedOptions().locale,nt)}var Tn={};function Hi(r){let e=Tn[r];if(!e){let t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,Tn[r]=e}return e}function Vi(r){let e=r.indexOf("-x-");e!==-1&&(r=r.substring(0,e));let t=r.indexOf("-u-");if(t===-1)return[r];{let n,s;try{n=lr(r).resolvedOptions(),s=r}catch{let c=r.substring(0,t);n=lr(c).resolvedOptions(),s=c}let{numberingSystem:a,calendar:i}=n;return[s,a,i]}}function Gi(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function zi(r){let e=[];for(let t=1;t<=12;t++){let n=p.utc(2009,t,1);e.push(r(n))}return e}function $i(r){let e=[];for(let t=1;t<=7;t++){let n=p.utc(2016,11,13+t);e.push(r(n))}return e}function Ot(r,e,t,n){let s=r.listingMode();return s==="error"?null:s==="en"?t(e):n(e)}function Zi(r){return r.numberingSystem&&r.numberingSystem!=="latn"?!1:r.numberingSystem==="latn"||!r.locale||r.locale.startsWith("en")||new Intl.DateTimeFormat(r.intl).resolvedOptions().numberingSystem==="latn"}var hr=class{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:s,floor:a,...i}=n;if(!t||Object.keys(i).length>0){let o={useGrouping:!1,...n};n.padTo>0&&(o.minimumIntegerDigits=n.padTo),this.inf=Bi(e,o)}}format(e){if(this.inf){let t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{let t=this.floor?Math.floor(e):ge(e,3);return T(t,this.padTo)}}},fr=class{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let s;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let i=-1*(e.offset/60),o=i>=0?`Etc/GMT+${i}`:`Etc/GMT${i}`;e.offset!==0&&v.create(o).valid?(s=o,this.dt=e):(s="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,s=e.zone.name):(s="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);let a={...this.opts};a.timeZone=a.timeZone||s,this.dtf=lr(t,a)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){let n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:n}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},pr=class{constructor(e,t,n){this.opts={style:"long",...n},!t&&Et()&&(this.rtf=qi(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):In(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}},Ki={firstDay:1,minimalDays:4,weekend:[6,7]},S=class r{static fromOpts(e){return r.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,s,a=!1){let i=e||y.defaultLocale,o=i||(a?"en-US":Ui()),c=t||y.defaultNumberingSystem,u=n||y.defaultOutputCalendar,d=st(s)||y.defaultWeekSettings;return new r(o,c,u,d,i)}static resetCache(){nt=null,ur={},dr={},mr={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:s}={}){return r.create(e,t,n,s)}constructor(e,t,n,s,a){let[i,o,c]=Vi(e);this.locale=i,this.numberingSystem=t||o||null,this.outputCalendar=n||c||null,this.weekSettings=s,this.intl=Gi(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=a,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Zi(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:r.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,st(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return Ot(this,e,gr,()=>{let n=t?{month:e,day:"numeric"}:{month:e},s=t?"format":"standalone";return this.monthsCache[s][e]||(this.monthsCache[s][e]=zi(a=>this.extract(a,n,"month"))),this.monthsCache[s][e]})}weekdays(e,t=!1){return Ot(this,e,yr,()=>{let n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},s=t?"format":"standalone";return this.weekdaysCache[s][e]||(this.weekdaysCache[s][e]=$i(a=>this.extract(a,n,"weekday"))),this.weekdaysCache[s][e]})}meridiems(){return Ot(this,void 0,()=>wr,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[p.utc(2016,11,13,9),p.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Ot(this,e,Sr,()=>{let t={era:e};return this.eraCache[e]||(this.eraCache[e]=[p.utc(-40,1,1),p.utc(2017,1,1)].map(n=>this.extract(n,t,"era"))),this.eraCache[e]})}extract(e,t,n){let s=this.dtFormatter(e,t),a=s.formatToParts(),i=a.find(o=>o.type.toLowerCase()===n);return i?i.value:null}numberFormatter(e={}){return new hr(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new fr(e,this.intl,t)}relFormatter(e={}){return new pr(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Li(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Ct()?Hi(this.locale):Ki}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}};var Tr=null,k=class r extends M{static get utcInstance(){return Tr===null&&(Tr=new r(0)),Tr}static instance(e){return e===0?r.utcInstance:new r(e)}static parseSpecifier(e){if(e){let t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new r(ae(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${J(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${J(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return J(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}};var ye=class extends M{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function B(r,e){let t;if(h(r)||r===null)return e;if(r instanceof M)return r;if(xn(r)){let n=r.toLowerCase();return n==="default"?e:n==="local"||n==="system"?Y.instance:n==="utc"||n==="gmt"?k.utcInstance:k.parseSpecifier(n)||v.create(r)}else return V(r)?k.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new ye(r)}var kn=()=>Date.now(),On="system",En=null,Cn=null,vn=null,Mn=60,An,Dn=null,y=class{static get now(){return kn}static set now(e){kn=e}static set defaultZone(e){On=e}static get defaultZone(){return B(On,Y.instance)}static get defaultLocale(){return En}static set defaultLocale(e){En=e}static get defaultNumberingSystem(){return Cn}static set defaultNumberingSystem(e){Cn=e}static get defaultOutputCalendar(){return vn}static set defaultOutputCalendar(e){vn=e}static get defaultWeekSettings(){return Dn}static set defaultWeekSettings(e){Dn=st(e)}static get twoDigitCutoffYear(){return Mn}static set twoDigitCutoffYear(e){Mn=e%100}static get throwOnInvalid(){return An}static set throwOnInvalid(e){An=e}static resetCaches(){S.resetCache(),v.resetCache()}};var O=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var Nn=[0,31,59,90,120,151,181,212,243,273,304,334],Pn=[0,31,60,91,121,152,182,213,244,274,305,335];function F(r,e){return new O("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${r}, which is invalid`)}function vt(r,e,t){let n=new Date(Date.UTC(r,e-1,t));r<100&&r>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);let s=n.getUTCDay();return s===0?7:s}function Fn(r,e,t){return t+(oe(r)?Pn:Nn)[e-1]}function Rn(r,e){let t=oe(r)?Pn:Nn,n=t.findIndex(a=>a<e),s=e-t[n];return{month:n+1,day:s}}function Mt(r,e){return(r-e+7)%7+1}function at(r,e=4,t=1){let{year:n,month:s,day:a}=r,i=Fn(n,s,a),o=Mt(vt(n,s,a),t),c=Math.floor((i-o+14-e)/7),u;return c<1?(u=n-1,c=ie(u,e,t)):c>ie(n,e,t)?(u=n+1,c=1):u=n,{weekYear:u,weekNumber:c,weekday:o,...ot(r)}}function Ir(r,e=4,t=1){let{weekYear:n,weekNumber:s,weekday:a}=r,i=Mt(vt(n,1,e),t),o=Q(n),c=s*7+a-i-7+e,u;c<1?(u=n-1,c+=Q(u)):c>o?(u=n+1,c-=Q(n)):u=n;let{month:d,day:f}=Rn(u,c);return{year:u,month:d,day:f,...ot(r)}}function At(r){let{year:e,month:t,day:n}=r,s=Fn(e,t,n);return{year:e,ordinal:s,...ot(r)}}function xr(r){let{year:e,ordinal:t}=r,{month:n,day:s}=Rn(e,t);return{year:e,month:n,day:s,...ot(r)}}function kr(r,e){if(!h(r.localWeekday)||!h(r.localWeekNumber)||!h(r.localWeekYear)){if(!h(r.weekday)||!h(r.weekNumber)||!h(r.weekYear))throw new W("Cannot mix locale-based week fields with ISO-based week fields");return h(r.localWeekday)||(r.weekday=r.localWeekday),h(r.localWeekNumber)||(r.weekNumber=r.localWeekNumber),h(r.localWeekYear)||(r.weekYear=r.localWeekYear),delete r.localWeekday,delete r.localWeekNumber,delete r.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function _n(r,e=4,t=1){let n=it(r.weekYear),s=D(r.weekNumber,1,ie(r.weekYear,e,t)),a=D(r.weekday,1,7);return n?s?a?!1:F("weekday",r.weekday):F("week",r.weekNumber):F("weekYear",r.weekYear)}function Wn(r){let e=it(r.year),t=D(r.ordinal,1,Q(r.year));return e?t?!1:F("ordinal",r.ordinal):F("year",r.year)}function Or(r){let e=it(r.year),t=D(r.month,1,12),n=D(r.day,1,we(r.year,r.month));return e?t?n?!1:F("day",r.day):F("month",r.month):F("year",r.year)}function Er(r){let{hour:e,minute:t,second:n,millisecond:s}=r,a=D(e,0,23)||e===24&&t===0&&n===0&&s===0,i=D(t,0,59),o=D(n,0,59),c=D(s,0,999);return a?i?o?c?!1:F("millisecond",s):F("second",n):F("minute",t):F("hour",e)}function h(r){return typeof r>"u"}function V(r){return typeof r=="number"}function it(r){return typeof r=="number"&&r%1===0}function xn(r){return typeof r=="string"}function Ln(r){return Object.prototype.toString.call(r)==="[object Date]"}function Et(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Ct(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Bn(r){return Array.isArray(r)?r:[r]}function Cr(r,e,t){if(r.length!==0)return r.reduce((n,s)=>{let a=[e(s),s];return n&&t(n[0],a[0])===n[0]?n:a},null)[1]}function qn(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function X(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function st(r){if(r==null)return null;if(typeof r!="object")throw new I("Week settings must be an object");if(!D(r.firstDay,1,7)||!D(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!D(e,1,7)))throw new I("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}function D(r,e,t){return it(r)&&r>=e&&r<=t}function Yi(r,e){return r-e*Math.floor(r/e)}function T(r,e=2){let t=r<0,n;return t?n="-"+(""+-r).padStart(e,"0"):n=(""+r).padStart(e,"0"),n}function z(r){if(!(h(r)||r===null||r===""))return parseInt(r,10)}function ee(r){if(!(h(r)||r===null||r===""))return parseFloat(r)}function ct(r){if(!(h(r)||r===null||r==="")){let e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function ge(r,e,t=!1){let n=10**e;return(t?Math.trunc:Math.round)(r*n)/n}function oe(r){return r%4===0&&(r%100!==0||r%400===0)}function Q(r){return oe(r)?366:365}function we(r,e){let t=Yi(e-1,12)+1,n=r+(e-t)/12;return t===2?oe(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function pe(r){let e=Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.millisecond);return r.year<100&&r.year>=0&&(e=new Date(e),e.setUTCFullYear(r.year,r.month-1,r.day)),+e}function jn(r,e,t){return-Mt(vt(r,1,e),t)+e-1}function ie(r,e=4,t=1){let n=jn(r,e,t),s=jn(r+1,e,t);return(Q(r)-n+s)/7}function ut(r){return r>99?r:r>y.twoDigitCutoffYear?1900+r:2e3+r}function It(r,e,t,n=null){let s=new Date(r),a={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(a.timeZone=n);let i={timeZoneName:e,...a},o=new Intl.DateTimeFormat(t,i).formatToParts(s).find(c=>c.type.toLowerCase()==="timezonename");return o?o.value:null}function ae(r,e){let t=parseInt(r,10);Number.isNaN(t)&&(t=0);let n=parseInt(e,10)||0,s=t<0||Object.is(t,-0)?-n:n;return t*60+s}function vr(r){let e=Number(r);if(typeof r=="boolean"||r===""||Number.isNaN(e))throw new I(`Invalid unit value ${r}`);return e}function Se(r,e){let t={};for(let n in r)if(X(r,n)){let s=r[n];if(s==null)continue;t[e(n)]=vr(s)}return t}function J(r,e){let t=Math.trunc(Math.abs(r/60)),n=Math.trunc(Math.abs(r%60)),s=r>=0?"+":"-";switch(e){case"short":return`${s}${T(t,2)}:${T(n,2)}`;case"narrow":return`${s}${t}${n>0?`:${n}`:""}`;case"techie":return`${s}${T(t,2)}${T(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function ot(r){return qn(r,["hour","minute","second","millisecond"])}var Ji=["January","February","March","April","May","June","July","August","September","October","November","December"],Mr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Qi=["J","F","M","A","M","J","J","A","S","O","N","D"];function gr(r){switch(r){case"narrow":return[...Qi];case"short":return[...Mr];case"long":return[...Ji];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}var Ar=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Dr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Xi=["M","T","W","T","F","S","S"];function yr(r){switch(r){case"narrow":return[...Xi];case"short":return[...Dr];case"long":return[...Ar];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var wr=["AM","PM"],eo=["Before Christ","Anno Domini"],to=["BC","AD"],ro=["B","A"];function Sr(r){switch(r){case"narrow":return[...ro];case"short":return[...to];case"long":return[...eo];default:return null}}function Un(r){return wr[r.hour<12?0:1]}function Hn(r,e){return yr(e)[r.weekday-1]}function Vn(r,e){return gr(e)[r.month-1]}function Gn(r,e){return Sr(e)[r.year<0?0:1]}function In(r,e,t="always",n=!1){let s={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},a=["hours","minutes","seconds"].indexOf(r)===-1;if(t==="auto"&&a){let f=r==="days";switch(e){case 1:return f?"tomorrow":`next ${s[r][0]}`;case-1:return f?"yesterday":`last ${s[r][0]}`;case 0:return f?"today":`this ${s[r][0]}`;default:}}let i=Object.is(e,-0)||e<0,o=Math.abs(e),c=o===1,u=s[r],d=n?c?u[1]:u[2]||u[1]:c?s[r][0]:r;return i?`${o} ${d} ago`:`in ${o} ${d}`}function zn(r,e){let t="";for(let n of r)n.literal?t+=n.val:t+=e(n.val);return t}var no={D:K,DD:je,DDD:Le,DDDD:Be,t:qe,tt:Ue,ttt:He,tttt:Ve,T:Ge,TT:ze,TTT:$e,TTTT:Ze,f:Ke,ff:Je,fff:Xe,ffff:tt,F:Ye,FF:Qe,FFF:et,FFFF:rt},E=class r{static create(e,t={}){return new r(e,t)}static parseFormat(e){let t=null,n="",s=!1,a=[];for(let i=0;i<e.length;i++){let o=e.charAt(i);o==="'"?(n.length>0&&a.push({literal:s||/^\s+$/.test(n),val:n}),t=null,n="",s=!s):s||o===t?n+=o:(n.length>0&&a.push({literal:/^\s+$/.test(n),val:n}),n=o,t=o)}return n.length>0&&a.push({literal:s||/^\s+$/.test(n),val:n}),a}static macroTokenToFormatOpts(e){return no[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return T(e,t);let n={...this.opts};return t>0&&(n.padTo=t),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,t){let n=this.loc.listingMode()==="en",s=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",a=(m,x)=>this.loc.extract(e,m,x),i=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",o=()=>n?Un(e):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(m,x)=>n?Vn(e,m):a(x?{month:m}:{month:m,day:"numeric"},"month"),u=(m,x)=>n?Hn(e,m):a(x?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),d=m=>{let x=r.macroTokenToFormatOpts(m);return x?this.formatWithSystemDefault(e,x):m},f=m=>n?Gn(e,m):a({era:m},"era"),g=m=>{switch(m){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return i({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return i({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return i({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return o();case"d":return s?a({day:"numeric"},"day"):this.num(e.day);case"dd":return s?a({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return s?a({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return s?a({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return c("short",!0);case"LLLL":return c("long",!0);case"LLLLL":return c("narrow",!0);case"M":return s?a({month:"numeric"},"month"):this.num(e.month);case"MM":return s?a({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return c("short",!1);case"MMMM":return c("long",!1);case"MMMMM":return c("narrow",!1);case"y":return s?a({year:"numeric"},"year"):this.num(e.year);case"yy":return s?a({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return s?a({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return s?a({year:"numeric"},"year"):this.num(e.year,6);case"G":return f("short");case"GG":return f("long");case"GGGGG":return f("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return d(m)}};return zn(r.parseFormat(t),g)}formatDurationFromString(e,t){let n=c=>{switch(c[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},s=c=>u=>{let d=n(u);return d?this.num(c.get(d),u.length):u},a=r.parseFormat(t),i=a.reduce((c,{literal:u,val:d})=>u?c:c.concat(d),[]),o=e.shiftTo(...i.map(n).filter(c=>c));return zn(a,s(o))}};var Zn=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Te(...r){let e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function Ie(...r){return e=>r.reduce(([t,n,s],a)=>{let[i,o,c]=a(e,s);return[{...t,...i},o||n,c]},[{},null,1]).slice(0,2)}function xe(r,...e){if(r==null)return[null,null];for(let[t,n]of e){let s=t.exec(r);if(s)return n(s)}return[null,null]}function Kn(...r){return(e,t)=>{let n={},s;for(s=0;s<r.length;s++)n[r[s]]=z(e[t+s]);return[n,null,t+s]}}var Yn=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,so=`(?:${Yn.source}?(?:\\[(${Zn.source})\\])?)?`,Nr=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Jn=RegExp(`${Nr.source}${so}`),Pr=RegExp(`(?:T${Jn.source})?`),ao=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,io=/(\d{4})-?W(\d\d)(?:-?(\d))?/,oo=/(\d{4})-?(\d{3})/,co=Kn("weekYear","weekNumber","weekDay"),uo=Kn("year","ordinal"),lo=/(\d{4})-(\d\d)-(\d\d)/,Qn=RegExp(`${Nr.source} ?(?:${Yn.source}|(${Zn.source}))?`),mo=RegExp(`(?: ${Qn.source})?`);function be(r,e,t){let n=r[e];return h(n)?t:z(n)}function ho(r,e){return[{year:be(r,e),month:be(r,e+1,1),day:be(r,e+2,1)},null,e+3]}function ke(r,e){return[{hours:be(r,e,0),minutes:be(r,e+1,0),seconds:be(r,e+2,0),milliseconds:ct(r[e+3])},null,e+4]}function lt(r,e){let t=!r[e]&&!r[e+1],n=ae(r[e+1],r[e+2]),s=t?null:k.instance(n);return[{},s,e+3]}function dt(r,e){let t=r[e]?v.create(r[e]):null;return[{},t,e+1]}var fo=RegExp(`^T?${Nr.source}$`),po=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function go(r){let[e,t,n,s,a,i,o,c,u]=r,d=e[0]==="-",f=c&&c[0]==="-",g=(m,x=!1)=>m!==void 0&&(x||m&&d)?-m:m;return[{years:g(ee(t)),months:g(ee(n)),weeks:g(ee(s)),days:g(ee(a)),hours:g(ee(i)),minutes:g(ee(o)),seconds:g(ee(c),c==="-0"),milliseconds:g(ct(u),f)}]}var yo={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Fr(r,e,t,n,s,a,i){let o={year:e.length===2?ut(z(e)):z(e),month:Mr.indexOf(t)+1,day:z(n),hour:z(s),minute:z(a)};return i&&(o.second=z(i)),r&&(o.weekday=r.length>3?Ar.indexOf(r)+1:Dr.indexOf(r)+1),o}var wo=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function So(r){let[,e,t,n,s,a,i,o,c,u,d,f]=r,g=Fr(e,s,n,t,a,i,o),m;return c?m=yo[c]:u?m=0:m=ae(d,f),[g,new k(m)]}function bo(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var To=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Io=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,xo=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function $n(r){let[,e,t,n,s,a,i,o]=r;return[Fr(e,s,n,t,a,i,o),k.utcInstance]}function ko(r){let[,e,t,n,s,a,i,o]=r;return[Fr(e,o,t,n,s,a,i),k.utcInstance]}var Oo=Te(ao,Pr),Eo=Te(io,Pr),Co=Te(oo,Pr),vo=Te(Jn),Xn=Ie(ho,ke,lt,dt),Mo=Ie(co,ke,lt,dt),Ao=Ie(uo,ke,lt,dt),Do=Ie(ke,lt,dt);function es(r){return xe(r,[Oo,Xn],[Eo,Mo],[Co,Ao],[vo,Do])}function ts(r){return xe(bo(r),[wo,So])}function rs(r){return xe(r,[To,$n],[Io,$n],[xo,ko])}function ns(r){return xe(r,[po,go])}var No=Ie(ke);function ss(r){return xe(r,[fo,No])}var Po=Te(lo,mo),Fo=Te(Qn),Ro=Ie(ke,lt,dt);function as(r){return xe(r,[Po,Xn],[Fo,Ro])}var is="Invalid Duration",cs={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},_o={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...cs},R=146097/400,Oe=146097/4800,Wo={years:{quarters:4,months:12,weeks:R/7,days:R,hours:R*24,minutes:R*24*60,seconds:R*24*60*60,milliseconds:R*24*60*60*1e3},quarters:{months:3,weeks:R/28,days:R/4,hours:R*24/4,minutes:R*24*60/4,seconds:R*24*60*60/4,milliseconds:R*24*60*60*1e3/4},months:{weeks:Oe/7,days:Oe,hours:Oe*24,minutes:Oe*24*60,seconds:Oe*24*60*60,milliseconds:Oe*24*60*60*1e3},...cs},ce=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],jo=ce.slice(0).reverse();function te(r,e,t=!1){let n={values:t?e.values:{...r.values,...e.values||{}},loc:r.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||r.conversionAccuracy,matrix:e.matrix||r.matrix};return new b(n)}function us(r,e){let t=e.milliseconds??0;for(let n of jo.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function os(r,e){let t=us(r,e)<0?-1:1;ce.reduceRight((n,s)=>{if(h(e[s]))return n;if(n){let a=e[n]*t,i=r[s][n],o=Math.floor(a/i);e[s]+=o*t,e[n]-=o*i*t}return s},null),ce.reduce((n,s)=>{if(h(e[s]))return n;if(n){let a=e[n]%1;e[n]-=a,e[s]+=a*r[n][s]}return s},null)}function Lo(r){let e={};for(let[t,n]of Object.entries(r))n!==0&&(e[t]=n);return e}var b=class r{constructor(e){let t=e.conversionAccuracy==="longterm"||!1,n=t?Wo:_o;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||S.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return r.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new I(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new r({values:Se(e,r.normalizeUnit),loc:S.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(V(e))return r.fromMillis(e);if(r.isDuration(e))return e;if(typeof e=="object")return r.fromObject(e);throw new I(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){let[n]=ns(e);return n?r.fromObject(n,t):r.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){let[n]=ss(e);return n?r.fromObject(n,t):r.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new I("need to specify a reason the Duration is invalid");let n=e instanceof O?e:new O(e,t);if(y.throwOnInvalid)throw new bt(n);return new r({invalid:n})}static normalizeUnit(e){let t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new fe(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){let n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?E.create(this.loc,n).formatDurationFromString(this,e):is}toHuman(e={}){if(!this.isValid)return is;let t=ce.map(n=>{let s=this.values[n];return h(s)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(s)}).filter(n=>n);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=ge(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},p.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?us(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let t=r.fromDurationLike(e),n={};for(let s of ce)(X(t.values,s)||X(this.values,s))&&(n[s]=t.get(s)+this.get(s));return te(this,{values:n},!0)}minus(e){if(!this.isValid)return this;let t=r.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;let t={};for(let n of Object.keys(this.values))t[n]=vr(e(this.values[n],n));return te(this,{values:t},!0)}get(e){return this[r.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let t={...this.values,...Se(e,r.normalizeUnit)};return te(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:s}={}){let i={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:s,conversionAccuracy:n};return te(this,i)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return os(this.matrix,e),te(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Lo(this.normalize().shiftToAll().toObject());return te(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(i=>r.normalizeUnit(i));let t={},n={},s=this.toObject(),a;for(let i of ce)if(e.indexOf(i)>=0){a=i;let o=0;for(let u in n)o+=this.matrix[u][i]*n[u],n[u]=0;V(s[i])&&(o+=s[i]);let c=Math.trunc(o);t[i]=c,n[i]=(o*1e3-c*1e3)/1e3}else V(s[i])&&(n[i]=s[i]);for(let i in n)n[i]!==0&&(t[a]+=i===a?n[i]:n[i]/this.matrix[a][i]);return os(this.matrix,t),te(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;let e={};for(let t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return te(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(n,s){return n===void 0||n===0?s===void 0||s===0:n===s}for(let n of ce)if(!t(this.values[n],e.values[n]))return!1;return!0}};var Ee="Invalid Interval";function Bo(r,e){return!r||!r.isValid?$.invalid("missing or invalid start"):!e||!e.isValid?$.invalid("missing or invalid end"):e<r?$.invalid("end before start",`The end of an interval must be after its start, but you had start=${r.toISO()} and end=${e.toISO()}`):null}var $=class r{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new I("need to specify a reason the Interval is invalid");let n=e instanceof O?e:new O(e,t);if(y.throwOnInvalid)throw new St(n);return new r({invalid:n})}static fromDateTimes(e,t){let n=Ce(e),s=Ce(t),a=Bo(n,s);return a??new r({start:n,end:s})}static after(e,t){let n=b.fromDurationLike(t),s=Ce(e);return r.fromDateTimes(s,s.plus(n))}static before(e,t){let n=b.fromDurationLike(t),s=Ce(e);return r.fromDateTimes(s.minus(n),s)}static fromISO(e,t){let[n,s]=(e||"").split("/",2);if(n&&s){let a,i;try{a=p.fromISO(n,t),i=a.isValid}catch{i=!1}let o,c;try{o=p.fromISO(s,t),c=o.isValid}catch{c=!1}if(i&&c)return r.fromDateTimes(a,o);if(i){let u=b.fromISO(s,t);if(u.isValid)return r.after(a,u)}else if(c){let u=b.fromISO(n,t);if(u.isValid)return r.before(o,u)}}return r.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;let n=this.start.startOf(e,t),s;return t?.useLocaleWeeks?s=this.end.reconfigure({locale:n.locale}):s=this.end,s=s.startOf(e,t),Math.floor(s.diff(n,e).get(e))+(s.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?r.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];let t=e.map(Ce).filter(i=>this.contains(i)).sort((i,o)=>i.toMillis()-o.toMillis()),n=[],{s}=this,a=0;for(;s<this.e;){let i=t[a]||this.e,o=+i>+this.e?this.e:i;n.push(r.fromDateTimes(s,o)),s=o,a+=1}return n}splitBy(e){let t=b.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:n}=this,s=1,a,i=[];for(;n<this.e;){let o=this.start.plus(t.mapUnits(c=>c*s));a=+o>+this.e?this.e:o,i.push(r.fromDateTimes(n,a)),n=a,s+=1}return i}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;let t=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return t>=n?null:r.fromDateTimes(t,n)}union(e){if(!this.isValid)return this;let t=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return r.fromDateTimes(t,n)}static merge(e){let[t,n]=e.sort((s,a)=>s.s-a.s).reduce(([s,a],i)=>a?a.overlaps(i)||a.abutsStart(i)?[s,a.union(i)]:[s.concat([a]),i]:[s,i],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0,s=[],a=e.map(c=>[{time:c.s,type:"s"},{time:c.e,type:"e"}]),i=Array.prototype.concat(...a),o=i.sort((c,u)=>c.time-u.time);for(let c of o)n+=c.type==="s"?1:-1,n===1?t=c.time:(t&&+t!=+c.time&&s.push(r.fromDateTimes(t,c.time)),t=null);return r.merge(s)}difference(...e){return r.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Ee}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=K,t={}){return this.isValid?E.create(this.s.loc.clone(t),e).formatInterval(this):Ee}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Ee}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Ee}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Ee}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Ee}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):b.invalid(this.invalidReason)}mapEndpoints(e){return r.fromDateTimes(e(this.s),e(this.e))}};var Z=class{static hasDST(e=y.defaultZone){let t=p.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return v.isValidZone(e)}static normalizeZone(e){return B(e,y.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||S.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||S.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||S.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null,outputCalendar:a="gregory"}={}){return(s||S.create(t,n,a)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null,outputCalendar:a="gregory"}={}){return(s||S.create(t,n,a)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null}={}){return(s||S.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null}={}){return(s||S.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return S.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return S.create(t,null,"gregory").eras(e)}static features(){return{relative:Et(),localeWeek:Ct()}}};function ls(r,e){let t=s=>s.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=t(e)-t(r);return Math.floor(b.fromMillis(n).as("days"))}function qo(r,e,t){let n=[["years",(c,u)=>u.year-c.year],["quarters",(c,u)=>u.quarter-c.quarter+(u.year-c.year)*4],["months",(c,u)=>u.month-c.month+(u.year-c.year)*12],["weeks",(c,u)=>{let d=ls(c,u);return(d-d%7)/7}],["days",ls]],s={},a=r,i,o;for(let[c,u]of n)t.indexOf(c)>=0&&(i=c,s[c]=u(r,e),o=a.plus(s),o>e?(s[c]--,r=a.plus(s),r>e&&(o=r,s[c]--,r=a.plus(s))):r=o);return[r,s,o,i]}function ds(r,e,t,n){let[s,a,i,o]=qo(r,e,t),c=e-s,u=t.filter(f=>["hours","minutes","seconds","milliseconds"].indexOf(f)>=0);u.length===0&&(i<e&&(i=s.plus({[o]:1})),i!==s&&(a[o]=(a[o]||0)+c/(i-s)));let d=b.fromObject(a,n);return u.length>0?b.fromMillis(c,n).shiftTo(...u).plus(d):d}var Rr={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},ms={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Uo=Rr.hanidec.replace(/[\[|\]]/g,"").split("");function hs(r){let e=parseInt(r,10);if(isNaN(e)){e="";for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(r[t].search(Rr.hanidec)!==-1)e+=Uo.indexOf(r[t]);else for(let s in ms){let[a,i]=ms[s];n>=a&&n<=i&&(e+=n-a)}}return parseInt(e,10)}else return e}function _({numberingSystem:r},e=""){return new RegExp(`${Rr[r||"latn"]}${e}`)}var Ho="missing Intl.DateTimeFormat.formatToParts support";function w(r,e=t=>t){return{regex:r,deser:([t])=>e(hs(t))}}var Vo="\xA0",gs=`[ ${Vo}]`,ys=new RegExp(gs,"g");function Go(r){return r.replace(/\./g,"\\.?").replace(ys,gs)}function fs(r){return r.replace(/\./g,"").replace(ys," ").toLowerCase()}function q(r,e){return r===null?null:{regex:RegExp(r.map(Go).join("|")),deser:([t])=>r.findIndex(n=>fs(t)===fs(n))+e}}function ps(r,e){return{regex:r,deser:([,t,n])=>ae(t,n),groups:e}}function Dt(r){return{regex:r,deser:([e])=>e}}function zo(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function $o(r,e){let t=_(e),n=_(e,"{2}"),s=_(e,"{3}"),a=_(e,"{4}"),i=_(e,"{6}"),o=_(e,"{1,2}"),c=_(e,"{1,3}"),u=_(e,"{1,6}"),d=_(e,"{1,9}"),f=_(e,"{2,4}"),g=_(e,"{4,6}"),m=H=>({regex:RegExp(zo(H.val)),deser:([he])=>he,literal:!0}),me=(H=>{if(r.literal)return m(H);switch(H.val){case"G":return q(e.eras("short"),0);case"GG":return q(e.eras("long"),0);case"y":return w(u);case"yy":return w(f,ut);case"yyyy":return w(a);case"yyyyy":return w(g);case"yyyyyy":return w(i);case"M":return w(o);case"MM":return w(n);case"MMM":return q(e.months("short",!0),1);case"MMMM":return q(e.months("long",!0),1);case"L":return w(o);case"LL":return w(n);case"LLL":return q(e.months("short",!1),1);case"LLLL":return q(e.months("long",!1),1);case"d":return w(o);case"dd":return w(n);case"o":return w(c);case"ooo":return w(s);case"HH":return w(n);case"H":return w(o);case"hh":return w(n);case"h":return w(o);case"mm":return w(n);case"m":return w(o);case"q":return w(o);case"qq":return w(n);case"s":return w(o);case"ss":return w(n);case"S":return w(c);case"SSS":return w(s);case"u":return Dt(d);case"uu":return Dt(o);case"uuu":return w(t);case"a":return q(e.meridiems(),0);case"kkkk":return w(a);case"kk":return w(f,ut);case"W":return w(o);case"WW":return w(n);case"E":case"c":return w(t);case"EEE":return q(e.weekdays("short",!1),1);case"EEEE":return q(e.weekdays("long",!1),1);case"ccc":return q(e.weekdays("short",!0),1);case"cccc":return q(e.weekdays("long",!0),1);case"Z":case"ZZ":return ps(new RegExp(`([+-]${o.source})(?::(${n.source}))?`),2);case"ZZZ":return ps(new RegExp(`([+-]${o.source})(${n.source})?`),2);case"z":return Dt(/[a-z_+-/]{1,256}?/i);case" ":return Dt(/[^\S\n\r]/);default:return m(H)}})(r)||{invalidReason:Ho};return me.token=r,me}var Zo={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Ko(r,e,t){let{type:n,value:s}=r;if(n==="literal"){let c=/^\s+$/.test(s);return{literal:!c,val:c?" ":s}}let a=e[n],i=n;n==="hour"&&(e.hour12!=null?i=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?i="hour12":i="hour24":i=t.hour12?"hour12":"hour24");let o=Zo[i];if(typeof o=="object"&&(o=o[a]),o)return{literal:!1,val:o}}function Yo(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function Jo(r,e,t){let n=r.match(e);if(n){let s={},a=1;for(let i in t)if(X(t,i)){let o=t[i],c=o.groups?o.groups+1:1;!o.literal&&o.token&&(s[o.token.val[0]]=o.deser(n.slice(a,a+c))),a+=c}return[n,s]}else return[n,{}]}function Qo(r){let e=a=>{switch(a){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}},t=null,n;return h(r.z)||(t=v.create(r.z)),h(r.Z)||(t||(t=new k(r.Z)),n=r.Z),h(r.q)||(r.M=(r.q-1)*3+1),h(r.h)||(r.h<12&&r.a===1?r.h+=12:r.h===12&&r.a===0&&(r.h=0)),r.G===0&&r.y&&(r.y=-r.y),h(r.u)||(r.S=ct(r.u)),[Object.keys(r).reduce((a,i)=>{let o=e(i);return o&&(a[o]=r[i]),a},{}),t,n]}var _r=null;function Xo(){return _r||(_r=p.fromMillis(1555555555555)),_r}function ec(r,e){if(r.literal)return r;let t=E.macroTokenToFormatOpts(r.val),n=Lr(t,e);return n==null||n.includes(void 0)?r:n}function Wr(r,e){return Array.prototype.concat(...r.map(t=>ec(t,e)))}function jr(r,e,t){let n=Wr(E.parseFormat(t),r),s=n.map(i=>$o(i,r)),a=s.find(i=>i.invalidReason);if(a)return{input:e,tokens:n,invalidReason:a.invalidReason};{let[i,o]=Yo(s),c=RegExp(i,"i"),[u,d]=Jo(e,c,o),[f,g,m]=d?Qo(d):[null,null,void 0];if(X(d,"a")&&X(d,"H"))throw new W("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:n,regex:c,rawMatches:u,matches:d,result:f,zone:g,specificOffset:m}}}function ws(r,e,t){let{result:n,zone:s,specificOffset:a,invalidReason:i}=jr(r,e,t);return[n,s,a,i]}function Lr(r,e){if(!r)return null;let n=E.create(e,r).dtFormatter(Xo()),s=n.formatToParts(),a=n.resolvedOptions();return s.map(i=>Ko(i,r,a))}var Br="Invalid DateTime",Ss=864e13;function Nt(r){return new O("unsupported zone",`the zone "${r.name}" is not supported`)}function qr(r){return r.weekData===null&&(r.weekData=at(r.c)),r.weekData}function Ur(r){return r.localWeekData===null&&(r.localWeekData=at(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}function ue(r,e){let t={ts:r.ts,zone:r.zone,c:r.c,o:r.o,loc:r.loc,invalid:r.invalid};return new p({...t,...e,old:t})}function Es(r,e,t){let n=r-e*60*1e3,s=t.offset(n);if(e===s)return[n,e];n-=(s-e)*60*1e3;let a=t.offset(n);return s===a?[n,s]:[r-Math.min(s,a)*60*1e3,Math.max(s,a)]}function Pt(r,e){r+=e*60*1e3;let t=new Date(r);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Rt(r,e,t){return Es(pe(r),e,t)}function bs(r,e){let t=r.o,n=r.c.year+Math.trunc(e.years),s=r.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,a={...r.c,year:n,month:s,day:Math.min(r.c.day,we(n,s))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},i=b.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),o=pe(a),[c,u]=Es(o,t,r.zone);return i!==0&&(c+=i,u=r.zone.offset(c)),{ts:c,o:u}}function mt(r,e,t,n,s,a){let{setZone:i,zone:o}=t;if(r&&Object.keys(r).length!==0||e){let c=e||o,u=p.fromObject(r,{...t,zone:c,specificOffset:a});return i?u:u.setZone(o)}else return p.invalid(new O("unparsable",`the input "${s}" can't be parsed as ${n}`))}function Ft(r,e,t=!0){return r.isValid?E.create(S.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function Hr(r,e){let t=r.c.year>9999||r.c.year<0,n="";return t&&r.c.year>=0&&(n+="+"),n+=T(r.c.year,t?6:4),e?(n+="-",n+=T(r.c.month),n+="-",n+=T(r.c.day)):(n+=T(r.c.month),n+=T(r.c.day)),n}function Ts(r,e,t,n,s,a){let i=T(r.c.hour);return e?(i+=":",i+=T(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(i+=":")):i+=T(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(i+=T(r.c.second),(r.c.millisecond!==0||!n)&&(i+=".",i+=T(r.c.millisecond,3))),s&&(r.isOffsetFixed&&r.offset===0&&!a?i+="Z":r.o<0?(i+="-",i+=T(Math.trunc(-r.o/60)),i+=":",i+=T(Math.trunc(-r.o%60))):(i+="+",i+=T(Math.trunc(r.o/60)),i+=":",i+=T(Math.trunc(r.o%60)))),a&&(i+="["+r.zone.ianaName+"]"),i}var Cs={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},tc={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},rc={ordinal:1,hour:0,minute:0,second:0,millisecond:0},vs=["year","month","day","hour","minute","second","millisecond"],nc=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],sc=["year","ordinal","hour","minute","second","millisecond"];function ac(r){let e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[r.toLowerCase()];if(!e)throw new fe(r);return e}function Is(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return ac(r)}}function xs(r,e){let t=B(e.zone,y.defaultZone),n=S.fromObject(e),s=y.now(),a,i;if(h(r.year))a=s;else{for(let u of vs)h(r[u])&&(r[u]=Cs[u]);let o=Or(r)||Er(r);if(o)return p.invalid(o);let c=t.offset(s);[a,i]=Rt(r,c,t)}return new p({ts:a,zone:t,loc:n,o:i})}function ks(r,e,t){let n=h(t.round)?!0:t.round,s=(i,o)=>(i=ge(i,n||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(i,o)),a=i=>t.calendary?e.hasSame(r,i)?0:e.startOf(i).diff(r.startOf(i),i).get(i):e.diff(r,i).get(i);if(t.unit)return s(a(t.unit),t.unit);for(let i of t.units){let o=a(i);if(Math.abs(o)>=1)return s(o,i)}return s(r>e?-0:0,t.units[t.units.length-1])}function Os(r){let e={},t;return r.length>0&&typeof r[r.length-1]=="object"?(e=r[r.length-1],t=Array.from(r).slice(0,r.length-1)):t=Array.from(r),[e,t]}var p=class r{constructor(e){let t=e.zone||y.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new O("invalid input"):null)||(t.isValid?null:Nt(t));this.ts=h(e.ts)?y.now():e.ts;let s=null,a=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[s,a]=[e.old.c,e.old.o];else{let o=t.offset(this.ts);s=Pt(this.ts,o),n=Number.isNaN(s.year)?new O("invalid input"):null,s=n?null:s,a=n?null:o}this._zone=t,this.loc=e.loc||S.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=s,this.o=a,this.isLuxonDateTime=!0}static now(){return new r({})}static local(){let[e,t]=Os(arguments),[n,s,a,i,o,c,u]=t;return xs({year:n,month:s,day:a,hour:i,minute:o,second:c,millisecond:u},e)}static utc(){let[e,t]=Os(arguments),[n,s,a,i,o,c,u]=t;return e.zone=k.utcInstance,xs({year:n,month:s,day:a,hour:i,minute:o,second:c,millisecond:u},e)}static fromJSDate(e,t={}){let n=Ln(e)?e.valueOf():NaN;if(Number.isNaN(n))return r.invalid("invalid input");let s=B(t.zone,y.defaultZone);return s.isValid?new r({ts:n,zone:s,loc:S.fromObject(t)}):r.invalid(Nt(s))}static fromMillis(e,t={}){if(V(e))return e<-Ss||e>Ss?r.invalid("Timestamp out of range"):new r({ts:e,zone:B(t.zone,y.defaultZone),loc:S.fromObject(t)});throw new I(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(V(e))return new r({ts:e*1e3,zone:B(t.zone,y.defaultZone),loc:S.fromObject(t)});throw new I("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};let n=B(t.zone,y.defaultZone);if(!n.isValid)return r.invalid(Nt(n));let s=S.fromObject(t),a=Se(e,Is),{minDaysInFirstWeek:i,startOfWeek:o}=kr(a,s),c=y.now(),u=h(t.specificOffset)?n.offset(c):t.specificOffset,d=!h(a.ordinal),f=!h(a.year),g=!h(a.month)||!h(a.day),m=f||g,x=a.weekYear||a.weekNumber;if((m||d)&&x)throw new W("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(g&&d)throw new W("Can't mix ordinal dates with month/day");let me=x||a.weekday&&!m,H,he,Fe=Pt(c,u);me?(H=nc,he=tc,Fe=at(Fe,i,o)):d?(H=sc,he=rc,Fe=At(Fe)):(H=vs,he=Cs);let gn=!1;for(let Re of H){let ki=a[Re];h(ki)?gn?a[Re]=he[Re]:a[Re]=Fe[Re]:gn=!0}let bi=me?_n(a,i,o):d?Wn(a):Or(a),yn=bi||Er(a);if(yn)return r.invalid(yn);let Ti=me?Ir(a,i,o):d?xr(a):a,[Ii,xi]=Rt(Ti,u,n),sr=new r({ts:Ii,zone:n,o:xi,loc:s});return a.weekday&&m&&e.weekday!==sr.weekday?r.invalid("mismatched weekday",`you can't specify both a weekday of ${a.weekday} and a date of ${sr.toISO()}`):sr}static fromISO(e,t={}){let[n,s]=es(e);return mt(n,s,t,"ISO 8601",e)}static fromRFC2822(e,t={}){let[n,s]=ts(e);return mt(n,s,t,"RFC 2822",e)}static fromHTTP(e,t={}){let[n,s]=rs(e);return mt(n,s,t,"HTTP",t)}static fromFormat(e,t,n={}){if(h(e)||h(t))throw new I("fromFormat requires an input string and a format");let{locale:s=null,numberingSystem:a=null}=n,i=S.fromOpts({locale:s,numberingSystem:a,defaultToEN:!0}),[o,c,u,d]=ws(i,e,t);return d?r.invalid(d):mt(o,c,n,`format ${t}`,e,u)}static fromString(e,t,n={}){return r.fromFormat(e,t,n)}static fromSQL(e,t={}){let[n,s]=as(e);return mt(n,s,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new I("need to specify a reason the DateTime is invalid");let n=e instanceof O?e:new O(e,t);if(y.throwOnInvalid)throw new wt(n);return new r({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let n=Lr(e,S.fromObject(t));return n?n.map(s=>s?s.val:null).join(""):null}static expandFormat(e,t={}){return Wr(E.parseFormat(e),S.fromObject(t)).map(s=>s.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?qr(this).weekYear:NaN}get weekNumber(){return this.isValid?qr(this).weekNumber:NaN}get weekday(){return this.isValid?qr(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Ur(this).weekday:NaN}get localWeekNumber(){return this.isValid?Ur(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Ur(this).weekYear:NaN}get ordinal(){return this.isValid?At(this.c).ordinal:NaN}get monthShort(){return this.isValid?Z.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Z.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Z.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Z.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,t=6e4,n=pe(this.c),s=this.zone.offset(n-e),a=this.zone.offset(n+e),i=this.zone.offset(n-s*t),o=this.zone.offset(n-a*t);if(i===o)return[this];let c=n-i*t,u=n-o*t,d=Pt(c,i),f=Pt(u,o);return d.hour===f.hour&&d.minute===f.minute&&d.second===f.second&&d.millisecond===f.millisecond?[ue(this,{ts:c}),ue(this,{ts:u})]:[this]}get isInLeapYear(){return oe(this.year)}get daysInMonth(){return we(this.year,this.month)}get daysInYear(){return this.isValid?Q(this.year):NaN}get weeksInWeekYear(){return this.isValid?ie(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?ie(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:n,calendar:s}=E.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:s}}toUTC(e=0,t={}){return this.setZone(k.instance(e),t)}toLocal(){return this.setZone(y.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=B(e,y.defaultZone),e.equals(this.zone))return this;if(e.isValid){let s=this.ts;if(t||n){let a=e.offset(this.ts),i=this.toObject();[s]=Rt(i,a,e)}return ue(this,{ts:s,zone:e})}else return r.invalid(Nt(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){let s=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return ue(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=Se(e,Is),{minDaysInFirstWeek:n,startOfWeek:s}=kr(t,this.loc),a=!h(t.weekYear)||!h(t.weekNumber)||!h(t.weekday),i=!h(t.ordinal),o=!h(t.year),c=!h(t.month)||!h(t.day),u=o||c,d=t.weekYear||t.weekNumber;if((u||i)&&d)throw new W("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&i)throw new W("Can't mix ordinal dates with month/day");let f;a?f=Ir({...at(this.c,n,s),...t},n,s):h(t.ordinal)?(f={...this.toObject(),...t},h(t.day)&&(f.day=Math.min(we(f.year,f.month),f.day))):f=xr({...At(this.c),...t});let[g,m]=Rt(f,this.o,this.zone);return ue(this,{ts:g,o:m})}plus(e){if(!this.isValid)return this;let t=b.fromDurationLike(e);return ue(this,bs(this,t))}minus(e){if(!this.isValid)return this;let t=b.fromDurationLike(e).negate();return ue(this,bs(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;let n={},s=b.normalizeUnit(e);switch(s){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break;case"milliseconds":break}if(s==="weeks")if(t){let a=this.loc.getStartOfWeek(),{weekday:i}=this;i<a&&(n.weekNumber=this.weekNumber-1),n.weekday=a}else n.weekday=1;if(s==="quarters"){let a=Math.ceil(this.month/3);n.month=(a-1)*3+1}return this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?E.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Br}toLocaleString(e=K,t={}){return this.isValid?E.create(this.loc.clone(t),e).formatDateTime(this):Br}toLocaleParts(e={}){return this.isValid?E.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:s=!0,extendedZone:a=!1}={}){if(!this.isValid)return null;let i=e==="extended",o=Hr(this,i);return o+="T",o+=Ts(this,i,t,n,s,a),o}toISODate({format:e="extended"}={}){return this.isValid?Hr(this,e==="extended"):null}toISOWeekDate(){return Ft(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:s=!1,extendedZone:a=!1,format:i="extended"}={}){return this.isValid?(s?"T":"")+Ts(this,i==="extended",t,e,n,a):null}toRFC2822(){return Ft(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Ft(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Hr(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let s="HH:mm:ss.SSS";return(t||e)&&(n&&(s+=" "),t?s+="z":e&&(s+="ZZ")),Ft(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Br}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",n={}){if(!this.isValid||!e.isValid)return b.invalid("created by diffing an invalid DateTime");let s={locale:this.locale,numberingSystem:this.numberingSystem,...n},a=Bn(t).map(b.normalizeUnit),i=e.valueOf()>this.valueOf(),o=i?this:e,c=i?e:this,u=ds(o,c,a,s);return i?u.negate():u}diffNow(e="milliseconds",t={}){return this.diff(r.now(),e,t)}until(e){return this.isValid?$.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;let s=e.valueOf(),a=this.setZone(e.zone,{keepLocalTime:!0});return a.startOf(t,n)<=s&&s<=a.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;let t=e.base||r.fromObject({},{zone:this.zone}),n=e.padding?this<t?-e.padding:e.padding:0,s=["years","months","days","hours","minutes","seconds"],a=e.unit;return Array.isArray(e.unit)&&(s=e.unit,a=void 0),ks(t,this.plus(n),{...e,numeric:"always",units:s,unit:a})}toRelativeCalendar(e={}){return this.isValid?ks(e.base||r.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(r.isDateTime))throw new I("min requires all arguments be DateTimes");return Cr(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(r.isDateTime))throw new I("max requires all arguments be DateTimes");return Cr(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){let{locale:s=null,numberingSystem:a=null}=n,i=S.fromOpts({locale:s,numberingSystem:a,defaultToEN:!0});return jr(i,e,t)}static fromStringExplain(e,t,n={}){return r.fromFormatExplain(e,t,n)}static get DATE_SHORT(){return K}static get DATE_MED(){return je}static get DATE_MED_WITH_WEEKDAY(){return ir}static get DATE_FULL(){return Le}static get DATE_HUGE(){return Be}static get TIME_SIMPLE(){return qe}static get TIME_WITH_SECONDS(){return Ue}static get TIME_WITH_SHORT_OFFSET(){return He}static get TIME_WITH_LONG_OFFSET(){return Ve}static get TIME_24_SIMPLE(){return Ge}static get TIME_24_WITH_SECONDS(){return ze}static get TIME_24_WITH_SHORT_OFFSET(){return $e}static get TIME_24_WITH_LONG_OFFSET(){return Ze}static get DATETIME_SHORT(){return Ke}static get DATETIME_SHORT_WITH_SECONDS(){return Ye}static get DATETIME_MED(){return Je}static get DATETIME_MED_WITH_SECONDS(){return Qe}static get DATETIME_MED_WITH_WEEKDAY(){return or}static get DATETIME_FULL(){return Xe}static get DATETIME_FULL_WITH_SECONDS(){return et}static get DATETIME_HUGE(){return tt}static get DATETIME_HUGE_WITH_SECONDS(){return rt}};function Ce(r){if(p.isDateTime(r))return r;if(r&&r.valueOf&&V(r.valueOf()))return p.fromJSDate(r);if(r&&typeof r=="object")return p.fromObject(r);throw new I(`Unknown datetime argument: ${r}, of type ${typeof r}`)}import{TransactionBlock as Wt}from"@mysten/sui.js/transactions";import{TransactionBlock as Vs}from"@mysten/sui.js/transactions";import{SUI_TYPE_ARG as Gs,normalizeStructTag as Lc}from"@mysten/sui.js/utils";import{Buffer as Ks}from"buffer";import{normalizeSuiAddress as qc}from"@mysten/sui.js/utils";import{bcs as _a}from"@mysten/sui.js/bcs";import{normalizeStructTag as Ut}from"@mysten/sui.js/utils";var Ms=(r=21)=>crypto.getRandomValues(new Uint8Array(r)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");import{Transactions as Qs}from"@mysten/sui.js/transactions";import{normalizeStructTag as Xs,normalizeSuiAddress as Ht}from"@mysten/sui.js/utils";import{TransactionBlock as jt}from"@mysten/sui.js/transactions";import{normalizeStructTag as ea,parseStructTag as Jc}from"@mysten/sui.js/utils";var Qa=ar(_t(),1),ei=ar(_t(),1),Oh=ar(_t(),1);import{TransactionType as ku}from"@msafe/sui3-utils";import{TransactionType as Ou}from"@msafe/sui3-utils";import{TransactionType as Eu}from"@msafe/sui3-utils";import{bcs as fa}from"@mysten/sui.js/bcs";import{normalizeStructTag as Cu,normalizeSuiAddress as ft}from"@mysten/sui.js/utils";import{TransactionType as Au}from"@msafe/sui3-utils";import{TransactionDefaultApplication as Nu,TransactionSubTypes as Kr}from"@msafe/sui3-utils";import{buildCoinTransferTxb as Pu}from"@msafe/sui3-utils";import{buildObjectTransferTxb as Ru}from"@msafe/sui3-utils";import{isSameAddress as Wu}from"@msafe/sui3-utils";import{TransactionBlock as ju}from"@mysten/sui.js/transactions";import{TransactionSubTypes as Uu,TransactionType as Hu}from"@msafe/sui3-utils";import{TransactionBlock as Vu}from"@mysten/sui.js/transactions";import{fromHEX as Gu,toHEX as zu}from"@mysten/sui.js/utils";var yc=Object.defineProperty,ga=(r,e)=>{for(var t in e)yc(r,t,{get:e[t],enumerable:!0})},ya={};ga(ya,{contractId:()=>ba,default:()=>Sc,feeObjId:()=>xa,roleObjId:()=>Ta,status:()=>Sa,transaction:()=>wa,upgradeCapObjId:()=>ka,vaultObjId:()=>Ia});var wa="DiBZq4UmVVYiRL6ZJmFKYoHcxtxqrhsCXSkFyT7wUr3j",Sa="success",ba="0x81c960dc653975fbd0072deca8afb92d322898c911622898ba1b2e3ad0c4bd8d",Ta="0xc6ec0bdee0bb59a72077e9acd2f42457043cf47080b3d3fad4d39abf28bba63a",Ia="0xbc4021387fbac149119fd24e92be9e58f745774292f3a2a12e2ac6daf5363e1d",xa="0x4178f63970fe2daeb256dc5730ad172e82b3e8eb45f31b33e0daae72cd35e1e1",ka="0xe1e9aa7d222d151bfe6dd83358b0d7fdcb11260f710800cfaf7ccc1b1e245115",Sc={transaction:wa,status:Sa,contractId:ba,roleObjId:Ta,vaultObjId:Ia,feeObjId:xa,upgradeCapObjId:ka},Oa={};ga(Oa,{contractId:()=>va,default:()=>bc,feeObjId:()=>Da,roleObjId:()=>Ma,status:()=>Ca,transaction:()=>Ea,upgradeCapObjId:()=>Na,vaultObjId:()=>Aa});var Ea="855FNDV8o8Z3fWULPnQo9qdhLJpsg7wZrkCpNyfw9KfB",Ca="success",va="0xc357c3985e8fb875d6b37141497af660779aa1bab0ec489b2213efd74067d1fa",Ma="0x5ab49bdf9fd1413e328ef242b3f8d83dde791b38a0b627bfc87fb25c010d34f1",Aa="0xb483558770d8eb26007f193b75db40f0a45f2e36863a687625885d4de6993378",Da="0x48453fc4d7cde3fe35aad89e5dfb496608a6a55ea529a1c0274681a808627f94",Na="0x34279779a0d0d36bd5044b04830d607fa1b0ecf316548c8ac3a44151e4f1a42a",bc={transaction:Ea,status:Ca,contractId:va,roleObjId:Ma,vaultObjId:Aa,feeObjId:Da,upgradeCapObjId:Na},Tc="https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD",Ic="https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD",xc="https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7",kc="https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7",Oc="https://bc3p6l5unl.execute-api.us-west-1.amazonaws.com/prod",Ec="https://rolsbkota7.execute-api.us-west-1.amazonaws.com/prod",Cc="https://6p6mkx33ne.execute-api.us-west-1.amazonaws.com/prod",vc="https://xrae3mrjv5.execute-api.us-west-1.amazonaws.com/prod",qs=ya,Us=Oa,Mc=new Map([["dev",{env:"dev",rpc:{url:Tc},backend:{url:Oc},contract:qs}],["stg",{env:"stg",rpc:{url:Ic},backend:{url:Ec},contract:qs}],["prev",{env:"prev",rpc:{url:xc},backend:{url:Cc},contract:Us}],["prod",{env:"prod",rpc:{url:kc},backend:{url:vc},contract:Us}]]);function Ac(r,e){let t=Mc.get(r);if(!t)throw new Error(`Env not supported: ${r}`);return e&&e.rpc&&(t.rpc=e.rpc),e&&e.backend&&(t.backend=e.backend),e&&e.contract&&(t.contract=e.contract),t}var P=class extends Error{mpayErrorCode;context;constructor(r,e,t={}){let{cause:n,context:s}=t;n?super(`[MPay] ${e}: ${n}`):super(`[MPay] ${e}`),this.mpayErrorCode=r,this.context=s}},Nc=class extends P{constructor(){super(11,"Backend is not specified")}},Pc=class extends P{constructor(){super(1,"Wallet not connected")}},zr=class extends P{constructor(r,e){super(10,r,{context:e})}},Rc=class de{constructor(e){this.apiURL=e}static parseResponseData(e){if(e instanceof Fc)throw new zr(e.response?.statusText);if(e.status===200){if(e.data.success)return e.data.data;throw new zr(e.data.code)}throw new zr(e.status.toString())}async getIncomingStreams(e,t){let n=await ve.post(`${this.apiURL}/stream`,{recipient:e,...t});return de.parseResponseData(n)}async getOutgoingStreams(e,t){let n=await ve.post(`${this.apiURL}/stream`,{sender:e,...t});return de.parseResponseData(n)}async getStreamHistory(e){let t=await ve.post(`${this.apiURL}/stream-events`,e),n=de.parseResponseData(t);return n.data.forEach(s=>{let a=s;return a.data.type==="create_stream"?a.data.balance=BigInt(a.data.balance):a.data.type==="cancel_stream"?a.data.withdrawAmount=BigInt(a.data.withdrawAmount):a.data.type==="claim"||a.data.type==="auto_claim"?a.data.claimAmount=BigInt(a.data.claimAmount):a.data.type==="set_auto_claim"&&(a.data.enabled=!!a.data.enabled),a.createdAt=new Date(a.createdAt),a}),n}async getAllCoinTypes(e){let t=await ve.post(`${this.apiURL}/stream-info`,{address:e});return de.parseResponseData(t)}async getAllRecipients(e,t){let n=await ve.post(`${this.apiURL}/stream-info`,{sender:e,status:t});return de.parseResponseData(n)}async getAllSenders(e,t){let n=await ve.post(`${this.apiURL}/stream-info`,{recipient:e,status:t});return de.parseResponseData(n)}},Pa=class Fa{signer;suiClient;envConfig;_backend;constructor(e){this.envConfig=e,this.suiClient=new Dc({url:e.rpc.url}),e.backend&&(this._backend=new Rc(e.backend.url))}static new(e,t){let n=Ac(e,t);return new Fa(n)}get walletType(){return this.wallet?this.wallet.type:"disconnected"}get backend(){if(!this._backend)throw new Nc;return this._backend}set backend(e){this._backend=e}connectWallet(e){this.signer=e}disconnect(){this.signer=void 0}get wallet(){if(!this.signer)throw new Pc;return this.signer}async walletAddress(){return this.wallet.address()}},zs=50n,$r=10000n,Bc=25n,$s=100000000n,le=class{constructor(r){this.object=r}moveArg(r){return r.object(this.object)}},Zs=class{constructor(r){this.objects=r}moveArgs(r){return r.makeMoveVec({objects:this.objects.map(e=>r.object(e))})}},qt=class Ra{constructor(e){return this.result=e,new Proxy(this,{set(){throw new Error("The transaction result is a proxy, and does not support setting properties directly")},get(t,n){if(n in t)return Reflect.get(t,n);let s=i=>new Ra(t.result[i]);if(n===Symbol.iterator)return function*(){let i=0;for(;;)yield s(i),i++};if(typeof n=="symbol")return;let a=parseInt(n,10);if(!(Number.isNaN(a)||a<0))return s(a)}})}moveArg(){return this.result}},Ys=class extends P{constructor(r,e){super(3,r,{context:e})}},Uc=class{constructor(r){this.results=r}callResult(r){return this.results.results[r]}returnValue(r,e){return r.returnValues[e]}getValue(r=0,e=0){let t=this.callResult(r);return this.returnValue(t,e)}getAddress(r=0,e=0){let[t,n]=this.getValue(r,e);if(n!=="address")throw new Ys("Invalid contract return type.",{ctx:{expectType:"address",gotType:n}});return qc(Ks.from(t).toString("hex"))}getU64(r=0,e=0){let[t,n]=this.getValue(r,e);if(n!=="u64")throw new Ys("Invalid contract return type.",{ctx:{expectType:"u64",gotType:n}});return Ks.from(t).readBigInt64LE()}},N=class extends P{constructor(r,e,t){super(2,`Invalid input: ${r}`,{context:{fieldKey:e,fieldValue:t}})}},Wa={groupId:"string",name:"string"},Hc=64;function Vc(r){return ja(r),_a.ser(Wa,r).toString("base64")}function Jr(r){let e=_a.de(Wa,r,"base64");return ja(e),e}function ja(r){if(!Js(r.name))throw new N("Invalid metadata: Name contains unknown character");if(!Js(r.groupId))throw new N("Invalid metadata: Group ID contains unknown character");if(r.name.length>Hc)throw new N("Invalid metadata: Name exceed max length 64")}function Js(r){return/^[\x00-\x7F]+$/.test(r)}function La(r,e){return Ut(r)===Ut(e)}function Me(r,e){return Ut(r)===Ut(e)}var Ba="txn.gas";function Gc(){return Ms()}var Qr=class qa{constructor(e,t,n){this.globals=e,this.feeContract=t,this.streamContract=n}static convertCreateStreamInfoToInternal(e){return{metadata:Vc({name:e.name,groupId:Gc()}),coinType:Lc(e.coinType),recipients:e.recipients.map(t=>({address:t.address,cliffAmount:t.cliffAmount,amountPerEpoch:t.amountPerStep})),epochInterval:e.interval,numberEpoch:e.steps,startTime:e.startTimeMs,cancelable:e.cancelable}}async buildCreateStreamTransactionBlock(e){let t=new Vs,n=this.calculateFeesInternal(e),s=this.getCreateStreamCoinRequests(e,n),a=await this.wallet.requestCoins(s),i=await this.addMergeCoins(t,a[0]),o;s.length>1?o=await this.addMergeCoins(t,a[1]):o=i;for(let c=0;c<e.recipients.length;c++){let u=e.recipients[c],d=this.amountForRecipient(u,e.numberEpoch),f=this.getStreamFeeLocal(d),[g]=t.splitCoins(i,[t.pure(d+f,"u64")]),[m]=t.splitCoins(o,[t.pure(this.flatSuiFee,"u64")]);this.streamContract.createStream(t,{paymentCoin:new qt(g),flatFeeCoin:new qt(m),metadata:e.metadata,recipient:u.address,timeStart:e.startTime,cliff:u.cliffAmount,epochInterval:e.epochInterval,numEpoch:e.numberEpoch,amountPerEpoch:u.amountPerEpoch,cancelable:e.cancelable,coinType:e.coinType})}return t}calculateCreateStreamFees(e){let t=qa.convertCreateStreamInfoToInternal(e);return this.calculateFeesInternal(t)}feeParams(){return{createFeePercent:{numerator:zs,denominator:$r},claimFeePercent:{numerator:Bc,denominator:$r},flatFeePerStream:$s}}async addMergeCoins(e,t){let n;return t.mergedCoins&&t.mergedCoins.length?(e.mergeCoins(e.object(t.primaryCoin),t.mergedCoins.map(s=>e.object(s))),n=e.object(t.primaryCoin)):t.primaryCoin===Ba?n=e.gas:n=e.object(t.primaryCoin),n}getCreateStreamCoinRequests(e,t){let n=e.coinType;return La(n,Gs)?[{coinType:n,amount:t.totalAmount+t.streamFeeAmount+t.flatFeeAmount}]:[{coinType:n,amount:t.totalAmount+t.streamFeeAmount},{coinType:Gs,amount:t.flatFeeAmount}]}calculateFeesInternal(e){let t=e.recipients.reduce((n,s)=>{let a=this.amountForRecipient(s,e.numberEpoch),i=this.getStreamFeeLocal(a);return{totalAmount:n.totalAmount+a,streamFeeAmount:n.streamFeeAmount+i}},{totalAmount:0n,streamFeeAmount:0n});return{flatFeeAmount:BigInt(e.recipients.length)*this.flatSuiFee,...t}}amountForRecipient(e,t){return BigInt(e.amountPerEpoch)*BigInt(t)+BigInt(e.cliffAmount)}get flatSuiFee(){return $s}getStreamFeeLocal(e){return e*zs/$r}async getStreamFeeRemote(e){let t=this.feeContract.streamingFee(new Vs,e),n=await this.globals.suiClient.devInspectTransactionBlock({sender:await this.globals.walletAddress(),transactionBlock:t});return new Uc(n).getU64()}get wallet(){return this.globals.wallet}},zc="0x0000000000000000000000000000000000000000000000000000000000000006",Ua=class{constructor(r,e,t){this.moduleName=r,this.config=e,this.globals=t}addContractCall(r,e){let t=`${this.config.contractId}::${this.moduleName}::${e.method}`;return r.add(Qs.MoveCall({target:t,arguments:e.arguments.map(n=>n instanceof Zs?n.moveArgs(r):n instanceof le?n.moveArg(r):n instanceof qt?n.moveArg():r.pure(n)),typeArguments:e.typeArgs})),r}addTransactionBlock(r,e,t=[],n=[]){r.add(Qs.MoveCall({target:e,arguments:t.map(s=>s instanceof Zs?s.moveArgs(r):s instanceof le?s.moveArg(r):s instanceof qt?s.moveArg():r.pure(s)),typeArguments:n}))}makeObject(r){return typeof r=="string"?new le(r):r}vaultObject(){return new le(this.config.vaultObjId)}roleObject(){return new le(this.config.roleObjId)}feeObject(){return new le(this.config.feeObjId)}clockObject(){return new le(zc)}},Ha=class re extends Ua{constructor(e,t){super(re.ModuleName,e,t),this.config=e,this.globals=t}static ModuleName="fee_module";static MethodName={set_streaming_fee:"set_streaming_fee",set_claim_fee:"set_claim_fee",set_streaming_flat_fee:"set_streaming_flat_fee",streaming_flat_fee:"streaming_flat_fee",streaming_fee:"streaming_fee",claim_fee:"claim_fee",fee_denominator:"fee_denominator"};setStreamingFee(e,t){let n=this.roleObject(),s=this.feeObject();return this.addContractCall(e,{method:re.MethodName.set_streaming_fee,arguments:[n,s,t],typeArgs:[]})}setStreamingFlatFee(e,t){let n=this.roleObject(),s=this.feeObject();return this.addContractCall(e,{method:re.MethodName.set_streaming_flat_fee,arguments:[n,s,t],typeArgs:[]})}setClaimFee(e,t){let n=this.roleObject(),s=this.feeObject();return this.addContractCall(e,{method:re.MethodName.set_claim_fee,arguments:[n,s,t],typeArgs:[]})}streamingFee(e,t){let n=this.feeObject();return this.addContractCall(e,{method:re.MethodName.streaming_fee,arguments:[n,t],typeArgs:[]})}claimFee(e,t){return this.addContractCall(e,{method:re.MethodName.claim_fee,arguments:[this.feeObject(),t],typeArgs:[]})}feeDenominator(e){return this.addContractCall(e,{method:re.MethodName.fee_denominator,arguments:[this.feeObject()],typeArgs:[]})}},Gt=class C extends Ua{constructor(e,t){super(C.ModuleName,e,t),this.config=e,this.globals=t}static ModuleName="stream";static MethodName={create_stream:"create_stream",set_auto_claim:"set_auto_claim",cancel_stream:"cancel_stream",claim_stream:"claim_stream",claim_stream_by_proxy:"claim_stream_by_proxy",stream_current_epoch:"stream_current_epoch",now_milli_seconds:"now_milli_seconds"};createStream(e,t){let n=this.feeObject(),s=this.vaultObject(),a=this.makeObject(t.paymentCoin),i=this.makeObject(t.flatFeeCoin),o=this.clockObject();return this.addContractCall(e,{method:C.MethodName.create_stream,arguments:[n,s,a,i,t.metadata,t.recipient,t.timeStart,t.cliff,t.epochInterval,t.numEpoch,t.amountPerEpoch,t.cancelable,o],typeArgs:[t.coinType]})}setAutoClaim(e,t){let n=this.makeObject(t.streamId);return this.addContractCall(e,{method:C.MethodName.set_auto_claim,arguments:[n,t.enabled],typeArgs:[t.coinType]})}cancelStream(e,t){let n=this.makeObject(t.streamId),s=this.clockObject();return this.addContractCall(e,{method:C.MethodName.cancel_stream,arguments:[n,s],typeArgs:[t.coinType]})}claimStream(e,t){let n=this.makeObject(t.streamId),s=this.clockObject();return this.addContractCall(e,{method:C.MethodName.claim_stream,arguments:[n,s],typeArgs:[t.coinType]})}claimStreamByProxy(e,t){let n=this.makeObject(t.streamId),s=this.vaultObject(),a=this.feeObject(),i=this.clockObject();return this.addContractCall(e,{method:C.MethodName.claim_stream_by_proxy,arguments:[n,s,a,i],typeArgs:[t.coinType]})}get createStreamTarget(){return`${this.config.contractId}::${C.ModuleName}::${C.MethodName.create_stream}`}get setAutoClaimTarget(){return`${this.config.contractId}::${C.ModuleName}::${C.MethodName.set_auto_claim}`}get cancelStreamTarget(){return`${this.config.contractId}::${C.ModuleName}::${C.MethodName.cancel_stream}`}get claimStreamTarget(){return`${this.config.contractId}::${C.ModuleName}::${C.MethodName.claim_stream}`}get claimStreamByProxyTarget(){return`${this.config.contractId}::${C.ModuleName}::${C.MethodName.claim_stream_by_proxy}`}},Va=class{constructor(r){this.globals=r;let e=r.envConfig.contract;this.feeContract=new Ha(e,r),this.streamContract=new Gt(e,r)}feeContract;streamContract;async createStreams(r){let e=Qr.convertCreateStreamInfoToInternal(r);return this.createStreamHelper().buildCreateStreamTransactionBlock(e)}createStreamHelper(){return new Qr(this.globals,this.feeContract,this.streamContract)}setAutoClaim(r,e,t){let n=new Wt;return this.streamContract.setAutoClaim(n,{streamId:r,enabled:e,coinType:t})}claimStream(r,e){let t=new Wt;return this.streamContract.claimStream(t,{streamId:r,coinType:e})}claimStreamByProxy(r,e){let t=new Wt;return this.streamContract.claimStreamByProxy(t,{streamId:r,coinType:e})}cancelStream(r,e){let t=new Wt;return this.streamContract.cancelStream(t,{streamId:r,coinType:e}),t}},$c=class extends P{constructor(r,e){super(12,`Transaction failed: ${e}`,{context:{status:r,msg:e}})}},Zc=1e3,Kc=class{constructor(r){this.globals=r,this.coinMetaHelper=new Yc(r.suiClient),this.createStreamHelper=new Va(r).createStreamHelper()}coinMetaHelper;createStreamHelper;getStreamIdsFromCreateStreamResponse(r){if(r.effects?.status.status!=="success")throw new $c(r.effects?.status.status,r.effects?.status.error);return r.objectChanges.filter(e=>e.type==="created"&&e.objectType.startsWith(`${this.globals.envConfig.contract.contractId}::stream::Stream`)).map(e=>e.objectId)}calculateCreateStreamFees(r){return this.createStreamHelper.calculateCreateStreamFees(r)}feeParams(){return this.createStreamHelper.feeParams()}calculateStreamAmount(r){if(r.steps===0n)throw new N("Invalid stream steps: 0");let e=r.cliff?r.cliff:{numerator:0n,denominator:100n},t=r.totalAmount*e.numerator/e.denominator,n=(r.totalAmount-t)/r.steps,s={realTotalAmount:n*r.steps+t,cliffAmount:t,amountPerStep:n};return this.validateStreamAmount(s,r.totalAmount),s}calculateTimelineByInterval(r){if(r.steps===0n)throw new N("Invalid stream steps: 0");let e=r.timeStart.plus(r.interval.toMillis()*Number(r.steps)),t={timeStart:r.timeStart,timeEnd:e,interval:r.interval,steps:r.steps};return this.validateTimeline(t),t}calculateTimelineByTotalDuration(r){if(r.steps===0n)throw new N("Invalid stream steps: 0");let e=BigInt(r.total.toMillis())/r.steps,t=r.timeStart.plus(b.fromMillis(Number(e*r.steps))),n={timeStart:r.timeStart,timeEnd:t,interval:b.fromMillis(Number(e)),steps:r.steps};return this.validateTimeline(n),n}async getBalance(r,e){let t=await this.globals.suiClient.getBalance({owner:r,coinType:e}),n=await this.getCoinMeta(e);return{...t,coinType:Yr(t.coinType),coinMeta:n}}async getAllBalance(r){let e=await this.globals.suiClient.getAllBalances({owner:r}),t=await Promise.all(e.map(n=>this.getCoinMeta(n.coinType)));return e.map((n,s)=>({...n,coinType:Yr(n.coinType),coinMeta:t[s]}))}async getCoinMeta(r){return this.coinMetaHelper.getCoinMeta(r)}async simulateTransactionBlock(r){return this.globals.suiClient.devInspectTransactionBlock({transactionBlock:r,sender:await this.globals.wallet.address()})}validateStreamAmount(r,e){if(r.amountPerStep===0n)throw new N("Stream amount too small","totalAmount",e);if(r.cliffAmount>r.realTotalAmount)throw new N("Invalid cliff settings")}validateTimeline(r){if(r.interval.toMillis()<Zc)throw new N("Interval shall be at least 1 second","interval",r.interval)}},Yc=class{constructor(r){this.suiClient=r,this.coinMetaReg=new Map}coinMetaReg;async getCoinMeta(r){let e=Yr(r||jc);if(this.coinMetaReg.has(e))return this.coinMetaReg.get(e);let t=await this.queryCoinMeta(e);return t&&this.coinMetaReg.set(e,t),t}async queryCoinMeta(r){return await this.suiClient.getCoinMetadata({coinType:r})||void 0}},Qc=class extends P{constructor(){super(7,"Connected wallet is not creator")}},ta=class extends P{constructor(){super(8,"Connected wallet is not recipient")}},ra=class extends P{constructor(r,e){super(6,r,{context:e})}},U=class extends P{constructor(r,e={}){super(0,r,e)}},Xc=class extends P{constructor(r){super(5,"Stream not found",{context:{streamId:r}})}},eu=(1n<<64n)-1n,Vt=1e3;function na(r){let e;typeof r=="number"?e=r:typeof r=="bigint"?e=Number(r):e=r.toMillis();let t=Math.round(e/Vt);return p.fromMillis(t*Vt)}function sa(r){let e;typeof r=="number"?e=r:typeof r=="bigint"?e=Number(r):e=r.toMillis();let t=Math.round(e/Vt);return b.fromMillis(t*Vt)}var rn=class ne{constructor(e,t,n){this.globals=e,this.streamId=t,this.rawData=n,this.streamContract=new Gt(e.envConfig.contract,e)}streamContract;type="Stream";static async new(e,t){let n=await ne.fetchStreamData(e,t);return new ne(e,t,n)}static fromObjectData(e,t,n){let s=ne.parseRawStreamData(t,n);return new ne(e,t,s)}get info(){return{name:this.name,creator:this.creator,coinType:this.coinType,totalAmount:this.totalAmount,start:this.timeStart,end:this.timeEnd,cancelable:this.cancelable,cliffAmount:this.cliff,duration:this.duration,interval:this.interval,steps:this.totalSteps,nextReleaseDate:this.nextReleaseDate,nextReleaseAmount:this.nextReleaseAmount,groupId:this.groupId,streamId:this.streamId,recipient:this.recipient,progress:this.progress,autoClaim:this.autoClaim}}get groupCommonInfo(){return{name:this.name,groupId:this.groupId,creator:this.creator,start:this.timeStart,interval:this.interval,steps:this.totalSteps,cancelable:this.cancelable}}async refresh(){this.rawData=await ne.fetchStreamData(this.globals,this.streamId)}refreshWithData(e){if(e.data?.objectId!==this.streamId)throw new U("Object Id does not align");this.rawData=ne.parseRawStreamData(this.streamId,e)}async historyEvents(e){return this.globals.backend.getStreamHistory({streamId:this.streamId,pagination:e})}async cancel(){if(await this.globals.walletAddress()!==this.creator)throw new Qc;let e=new jt;return this.streamContract.cancelStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async claim(){if(await this.globals.walletAddress()!==this.recipient)throw new ta;let e=new jt;return this.streamContract.claimStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async setAutoClaim(e){if(await this.globals.walletAddress()!==this.recipient)throw new ta;let t=new jt;return this.streamContract.setAutoClaim(t,{streamId:this.streamId,coinType:this.coinType,enabled:e}),t}async claimByProxy(){let e=new jt;return this.streamContract.claimStreamByProxy(e,{streamId:this.streamId,coinType:this.coinType}),e}get wallet(){return this.globals.wallet}get client(){return this.globals.suiClient}get coinType(){return ea(this.rawData.coinType)}get progress(){return{status:this.streamStatus,total:this.totalAmount,streamed:this.streamedAmount,claimed:this.claimedAmount,claimable:this.claimable,canceled:this.canceledAmount}}get balance(){return this.rawData.balance}get autoClaim(){return this.rawData.autoClaim}get amountPerEpoch(){return this.rawData.config.amountPerEpoch}get cancelable(){return this.rawData.config.cancelable}get cliff(){return this.rawData.config.cliff}get creator(){return this.rawData.config.creator}get interval(){return sa(this.rawData.config.epochInterval)}get groupId(){let{metadata:e}=this.rawData.config;return Jr(e).groupId}get name(){let{metadata:e}=this.rawData.config;return Jr(e).name}get recipient(){return this.rawData.config.recipient}get timeStart(){return na(this.rawData.config.timeStart)}get duration(){let e=this.rawData.config,t=e.epochInterval*e.totalEpoch;return sa(t)}get timeEnd(){return this.timeStart.plus(this.duration)}get totalSteps(){return this.rawData.config.totalEpoch}get claimable(){return this.streamedAmount-this.claimedAmount}get nextReleaseDate(){return this.currentEpoch===-1n?this.timeStart:this.currentEpoch>=this.totalSteps||this.isCanceled?null:na((this.currentEpoch+1n)*this.rawData.config.epochInterval+this.rawData.config.timeStart)}get nextReleaseAmount(){return this.currentEpoch===-1n?this.cliff:this.currentEpoch>=this.totalSteps||this.isCanceled?null:this.amountPerEpoch}get streamStatus(){let e=this.rawData.status.status;return e===16?"CANCELED":e===17?"SETTLED":e===1?"COMPLETED":this.currentEpoch>=this.totalSteps?"STREAMED":"STREAMING"}get streamedAmount(){return this.currentEpoch===-1n?0n:this.isCanceled?this.rawData.status.epochCanceled*this.amountPerEpoch+this.cliff:this.currentEpoch*this.amountPerEpoch+this.cliff}get claimedAmount(){return this.rawData.status.epochClaimed===eu?0n:this.rawData.status.epochClaimed*this.amountPerEpoch+this.cliff}get currentEpoch(){let e=p.now().toMillis(),t=this.timeStart.toMillis();if(e<t)return-1n;let n=Math.floor((e-t)/Number(this.rawData.config.epochInterval));return BigInt(n)>Number(this.rawData.config.totalEpoch)?this.rawData.config.totalEpoch:BigInt(n)}get totalAmount(){let e=this.rawData.config;return e.amountPerEpoch*e.totalEpoch+e.cliff}get isCanceled(){let e=this.rawData.status.status;return e===16||e===17}get canceledAmount(){return this.isCanceled?this.totalAmount-this.streamedAmount:0n}static async fetchStreamData(e,t){let n=await e.suiClient.getObject({id:t,options:{showContent:!0,showType:!0}});return ne.parseRawStreamData(t,n)}static parseRawStreamData(e,t){if(t.error)throw t.error.code==="notExists"?new Xc(e):new ra(`get stream data: ${t.error.code}`,{streamId:e,...t.error});let n=t.data.content;if(n.dataType!=="moveObject")throw new ra("Unexpected object type",{gotType:n.dataType});let{typeParams:s}=Jc(n.type),a=ea(s[0]),i=n.fields,o=i.config.fields,c=i.status.fields;return{coinType:a,autoClaim:i.auto_claim,balance:BigInt(i.balance.fields.balance),config:{amountPerEpoch:BigInt(o.amount_per_epoch),cancelable:o.cancelable,cliff:BigInt(o.cliff),creator:o.creator,epochInterval:BigInt(o.epoch_interval),metadata:o.metadata,recipient:o.recipient,timeStart:BigInt(o.time_start),totalEpoch:BigInt(o.total_epoch)},status:{status:c.status,epochCanceled:BigInt(c.epoch_canceled),epochClaimed:BigInt(c.epoch_claimed)}}}},Zr=class extends P{constructor(r,e){super(9,`Invalid stream group: ${r}`,{context:e})}};async function tu(r){let e=[];for(;await r.hasNext();){let t=await r.next();e.push(t)}return e&&Array.isArray(e[0])?e.flat(1):e}var ru=class{constructor(r){this.requester=r,this.curPage=void 0,this.init=!0}curPage;init;async hasNext(){if(this.init)return this.curPage||(this.curPage=await this.requester.doNextRequest()),!!this.curPage.data?.length||this.curPage.hasNext;if(!this.curPage)throw new Error("invalid implementation of iterator");return this.curPage.hasNext}async next(){return this.init?(this.init=!1,this.curPage||(this.curPage=await this.requester.doNextRequest()),this.curPage.data):(this.curPage=await this.requester.doNextRequest(),this.curPage.data)}},Ga=class{constructor(r){this.requester=r,this.pager=new ru(r),this.curData=[],this.cursor=0}cursor;pager;curData;async hasNext(){return this.cursor<this.curData.length-1?!0:this.pager.hasNext()}async next(){for(this.cursor+=1;this.cursor>=this.curData.length;)if(await this.pager.hasNext())this.curData=await this.pager.next(),this.cursor=0;else throw new Error("not more data");return this.curData[this.cursor]}},nu=25;async function aa(r,e,t){let n=new za(e),s=new $a(r,n,t);return await tu(s)}var za=class{constructor(r){this.ids=r,this.cursor=-1}cursor;async hasNext(){return this.cursor<this.ids.length-1}async next(){if(this.cursor+=1,this.cursor>=this.ids.length)throw new Error("invalid iterator implementation");return this.ids[this.cursor]}},$a=class extends Ga{constructor(r,e,t){super(new su(r,e,t)),this.suiClient=r,this.idIter=e,this.options=t}},su=class{constructor(r,e,t){this.suiClient=r,this.stringIter=e,this.options=t,this.filter=t?.filter,this.pageSize=t?.pageSize||nu,this.objectOptions=t?.objectOptions||{showType:!0,showContent:!0}}filter;pageSize;objectOptions;async doNextRequest(){let r=[];for(;r.length<this.pageSize&&await this.stringIter.hasNext();){let n=await this.stringIter.next();n&&r.push(n)}let e=await this.suiClient.multiGetObjects({ids:r,options:this.objectOptions}),t;if(this.filter){let{filter:n}=this;t=e.filter(s=>n?.(s))}else t=e;return{data:t,hasNext:await this.stringIter.hasNext()}}},au=class Lt{constructor(e,t){if(this.globals=e,this.streams=t,t.length===0)throw new Zr("stream size 0");let n=t.map(s=>s.groupId);if(new Set(n).size!==1)throw new N("Stream does not have same group ID")}type="StreamGroup";static async new(e,t){let n=await aa(e.suiClient,t);return n.forEach(s=>{if(!s)throw new U("stream group object data undefined")}),Lt.newFromObjectResponse(e,t,n)}static async newFromObjectResponse(e,t,n){let s=await Lt.parseGroupStreams(e,t,n);return new Lt(e,s)}static checkStreamGroup(e){let t=e.map(a=>a.groupCommonInfo),n=t[0],s=!0;return t.forEach(a=>{iu(n,a)||(s=!1)}),s}async refresh(){let e=await aa(this.globals.suiClient,this.streams.map(t=>t.streamId));this.streams.forEach((t,n)=>{t.refreshWithData(e[n])})}get groupId(){return this.streams[0].groupId}get creator(){return this.streams[0].creator}get info(){return{groupId:this.groupId,streamIds:this.streams.map(e=>e.streamId),progress:this.progress,name:this.streams[0].name,creator:this.creator,coinType:this.streams[0].coinType,totalAmount:this.streams.reduce((e,t)=>e+t.totalAmount,0n),start:this.streams[0].timeStart,end:this.streams[0].timeEnd,cancelable:this.streams[0].cancelable,cliffAmount:this.streams.reduce((e,t)=>e+t.cliff,0n),duration:this.streams[0].duration,interval:this.streams[0].interval,steps:this.streams[0].totalSteps,nextReleaseAmount:this.streams.reduce((e,t)=>t.nextReleaseAmount===null?e:e+t.nextReleaseAmount,0n),nextReleaseDate:this.streams[0].nextReleaseDate}}get progress(){return{total:this.streams.reduce((e,t)=>e+t.totalAmount,0n),streamed:this.streams.reduce((e,t)=>e+t.streamedAmount,0n),claimed:this.streams.reduce((e,t)=>e+t.claimedAmount,0n),claimable:this.streams.reduce((e,t)=>e+t.claimable,0n),canceled:this.streams.reduce((e,t)=>e+t.canceledAmount,0n)}}async historyEvents(e){return this.globals.backend.getStreamHistory({groupId:this.groupId,pagination:e})}static async parseGroupStreams(e,t,n){let s=n.map((a,i)=>rn.fromObjectData(e,t[i],a)).filter(a=>!!a);if(new Set(s.map(a=>a.groupId)).size!==1)throw new Zr("Not same group ID");if(!this.checkStreamGroup(s))throw new Zr("Not same stream settings");return s}};function iu(r,e){return r.name===e.name&&r.groupId===e.groupId&&r.creator===e.creator&&r.start.toMillis()===e.start.toMillis()&&r.interval.toMillis()===e.interval.toMillis()&&r.steps===e.steps&&r.cancelable===e.cancelable}var ia=class Xr{constructor(e,t){this.it=e,this.pageSize=t}static async newIncoming(e){let t=await oa.newIncoming(e);return new Xr(t,e.pageSize)}static async newOutgoing(e){let t=await oa.newOutgoing(e);return new Xr(t,e.pageSize)}async hasNext(){return this.it.hasNext()}async next(){let e=[];for(;e.length<this.pageSize&&await this.it.hasNext();)e.push(await this.it.next());return e}},oa=class en{constructor(e){this.requester=e}cachedNext;static async newIncoming(e){let t=await ca.newIncomingQuery(e);return new en(t)}static async newOutgoing(e){let t=await ca.newOutgoingQuery(e);return new en(t)}async hasNext(){return this.cachedNext===void 0&&(this.cachedNext=await this.requester.doNextRequest()),this.cachedNext!==null}async next(){if(this.cachedNext===void 0){let t=await this.requester.doNextRequest();if(t===null)throw new U("No more results");return t}let e=this.cachedNext;if(this.cachedNext=void 0,e===null)throw new U("No more results");return e}},ca=class tn{constructor(e,t,n,s){this.globals=e,this.recipient=t,this.groupRefs=n,this.query=s,this.current=0;let a=new za(n.flat().map(i=>i.streamId));this.objectIter=new $a(e.suiClient,a)}current=0;objectIter;static async newIncomingQuery(e){let t=du(e.query),n=await e.globals.walletAddress(),s=(await e.globals.backend.getIncomingStreams(n,t)).filter(i=>Ht(i.recipient)===Ht(n)),a=ua(s);return new tn(e.globals,n,a,e.query)}static async newOutgoingQuery(e){let t=mu(e.query),n=await e.globals.walletAddress(),s=await e.globals.backend.getOutgoingStreams(n,t),a=ua(s);return new tn(e.globals,n,a,e.query)}async doNextRequest(){if(this.current>=this.groupRefs.length)return null;let e=this.groupRefs[this.current];if(e.length===1){let t=await uu(this.globals,e[0].streamId,this.objectIter);return this.current++,Za(t,this.query)?t:this.doNextRequest()}if(e.length>1){let t=await lu(this.globals,e.map(n=>n.streamId),this.objectIter);return this.current++,cu(t,this.query)?t:this.doNextRequest()}throw new U("Stream group with no stream")}};function ua(r){let e=new Map;return r.forEach(t=>{let n=e.get(t.groupId);n?(n.push(t),e.set(t.groupId,n)):e.set(t.groupId,[t])}),Array.from(e.values()).sort((t,n)=>p.fromISO(n[0].createDate).toMillis()-p.fromISO(t[0].createDate).toMillis())}function Za(r,e){if(e===void 0)return!0;let t=ou(r,e.status);if(e&&"claimable"in e&&e.claimable!==void 0){let n=e.claimable?r.progress.claimable!==0n:r.progress.claimable===0n;return t&&n}return t}function ou(r,e){return e===void 0?!0:Array.isArray(e)?e.includes(r.progress.status):r.progress.status===e}function cu(r,e){if(!e)return!0;let t=!1;return r.streams.forEach(n=>{Za(n,e)&&(t=!0)}),t}async function uu(r,e,t){let n=await Ka(t,e);return rn.fromObjectData(r,e,n)}async function lu(r,e,t){let n=[];for(;n.length<e.length;){let s=await Ka(t,e[n.length]);n.push(s)}return au.newFromObjectResponse(r,e,n)}async function Ka(r,e){if(!await r.hasNext())throw new U("object iterator has been consumed");let t=await r.next();if(!t||t.error||t.data===void 0||t.data===null)throw new U("object iterator undefined response",{cause:t?.error});if(t?.data?.objectId!==e)throw new U("stream id not aligned");return t}function du(r){return{status:nn(r?.status),coinType:Ya(r?.coinType),sender:Ja(r?.sender)}}function mu(r){return{status:nn(r?.status),coinType:Ya(r?.coinType),recipient:Ja(r?.recipient)}}function nn(r){return r===void 0||r.length===0?"all":Array.isArray(r)?r.reduce((e,t)=>{let n=nn(t);return!e||e===n?n:"all"},void 0):hu(r)}function hu(r){switch(r){case"STREAMING":case"STREAMED":case"CANCELED":return"active";case"COMPLETED":case"SETTLED":return"inactive";default:throw new N("Unknown stream filtered status")}}function Ya(r){if(r)return Array.isArray(r)?r.length!==0?r.map(e=>Xs(e)):void 0:Xs(r)}function Ja(r){if(r)return Array.isArray(r)?r.length!==0?r.map(e=>Ht(e)):void 0:Ht(r)}var fu=class extends P{constructor(r,e,t){super(4,`Not enough balance: ${r}`,{context:{coinType:r,requestAmount:e,gotAmount:t}}),this.coinType=r,this.requestAmount=e,this.gotAmount=t}},pu=25;async function gu(r,e,t,n="0x2::sui::SUI",s=pu){let a=new yu(r,e,n,s),i=BigInt(0),o=[];for(;await a.hasNext()&&i<t;){let c=await a.next();c&&(o.push(c),i+=BigInt(c.balance))}if(i<t)throw new fu(n,t,i);return o}var yu=class extends Ga{constructor(r,e,t,n){super(new wu(r,e,t,n)),this.suiClient=r,this.owner=e,this.coinType=t,this.reqPageSize=n}},wu=class{constructor(r,e,t,n){if(this.suiClient=r,this.owner=e,this.coinType=t,this.reqPageSize=n,n<=0)throw new U("Invalid reqPageSize")}nextCursor;async doNextRequest(){let r=await this.suiClient.getCoins({owner:this.owner,coinType:this.coinType,cursor:this.nextCursor,limit:this.reqPageSize});return this.nextCursor=r.nextCursor,{data:r.data,hasNext:r.hasNextPage}}},Su=class{constructor(r){this.msafe=r}get type(){return"msafe"}async address(){return this.msafe.address()}async requestCoins(r){return this.msafe.requestCoins(r)}},bu=class{constructor(r){this.account=r}async address(){return this.account.address}},Tu=class{constructor(r,e){this.singleWallet=r,this.suiClient=e}get type(){return"single"}async address(){return this.singleWallet.address()}async requestCoins(r){return Promise.all(r.map(e=>this.requestCoin(e)))}async requestCoin(r){if(La(r.coinType,_c))return{primaryCoin:Ba};if(r.amount<=0)throw new N("Invalid coin request","coinAmount",r.amount);let e=await gu(this.suiClient,await this.address(),r.amount,r.coinType);if(e.length===0)throw new U("no coins available");return{primaryCoin:e[0].coinObjectId,mergedCoins:e.slice(1).map(t=>t.coinObjectId)}}},Iu=class{globals;helper;constructor(r,e){this.globals=Pa.new(r,e),this.helper=new Kc(this.globals)}connectSingleWallet(r){let e=new Tu(r,this.globals.suiClient);this.globals.connectWallet(e)}connectMSafeAccount(r){let e=new Su(r);this.globals.connectWallet(e)}async createStream(r){return this.builder().createStreams(r)}async getStream(r){return rn.new(this.globals,r)}async getIncomingStreams(r,e=10){return ia.newIncoming({globals:this.globals,query:r,pageSize:e})}async getOutgoingStreams(r,e=10){return ia.newOutgoing({globals:this.globals,query:r,pageSize:e})}async getCoinTypesForStreamFilter(){let r=await this.wallet.address();return(await this.globals.backend.getAllCoinTypes(r)).map(e=>Wc(e))}async getRecipientsForStreamFilter(r){let e=await this.wallet.address();return(await this.globals.backend.getAllRecipients(e,r)).map(t=>Hs(t))}async getCreatorsForStreamFilter(r){let e=await this.wallet.address();return(await this.globals.backend.getAllSenders(e,r)).map(t=>Hs(t))}get wallet(){return this.globals.wallet}builder(){return new Va(this.globals)}},xu=class{constructor(r){this.data=r}serialize(){return JSON.stringify((0,Qa.default)(this.data))}},pt=class extends xu{application="mpay";getClient(r,e){let t=new Iu(r==="sui:mainnet"?"prod":"dev");return t.connectSingleWallet(new bu(e)),t}},la=class extends pt{constructor(r){super(r),this.data=r}txType=wc.Stream;txSubType="Cancel";async build(r){let{network:e,account:t}=r;return(await this.getClient(e,t).getStream(this.data.streamId)).cancel()}},da=class extends pt{constructor(r){super(r),this.data=r}txType=ku.Stream;txSubType="ClaimByProxy";async build(r){let{network:e,account:t}=r;return(await this.getClient(e,t).getStream(this.data.streamId)).claimByProxy()}},ma=class extends pt{constructor(r){super(r),this.data=r}txType=Ou.Stream;txSubType="Claim";async build(r){let{network:e,account:t}=r;return(await this.getClient(e,t).getStream(this.data.streamId)).claim()}},ha=class extends pt{constructor(r){super(r),this.data=r}txType=Eu.Stream;txSubType="CreateStream";async build(r){let{network:e,account:t}=r;return this.getClient(e,t).createStream(this.data)}},Xa=class Bt{constructor(e,t){this.moveCall=e,this.txb=t}decodeSharedObjectId(e){let t=this.getInputParam(e);return Bt.getSharedObjectId(t)}decodeOwnedObjectId(e){let t=this.getInputParam(e);return Bt.getOwnedObjectId(t)}decodeInputU64(e){let t=this.decodePureArg(e,"u64");return BigInt(t)}decodeInputAddress(e){let t=this.decodePureArg(e,"address");return ft(t)}decodeInputString(e){return this.decodePureArg(e,"string")}decodeInputBool(e){return this.decodePureArg(e,"bool")}decodePureArg(e,t){let n=this.getInputParam(e);return Bt.getPureInputValue(n,t)}getInputParam(e){let t=this.moveCall.arguments[e];if(t.kind!=="Input")throw new Error("not input type");return this.txb.blockData.inputs[t.index]}static getPureInputValue(e,t){if(e.type!=="pure")throw new Error("not pure argument");if(typeof e.value=="object"&&"Pure"in e.value){let n=e.value.Pure;return fa.de(t,new Uint8Array(n))}return e.value}static getOwnedObjectId(e){if(e.type!=="object")throw new Error(`not object argument: ${JSON.stringify(e)}`);if(typeof e.value=="object"){if(!("Object"in e.value)||!("ImmOrOwned"in e.value.Object))throw new Error("not ImmOrOwned");return ft(e.value.Object.ImmOrOwned.objectId)}return ft(e.value)}static getSharedObjectId(e){if(e.type!=="object")throw new Error(`not object argument: ${JSON.stringify(e)}`);if(typeof e.value!="object")return ft(e.value);if(!("Object"in e.value)||!("Shared"in e.value.Object))throw new Error("not Shared");return ft(e.value.Object.Shared.objectId)}static getPureInput(e,t){if(e.type!=="pure")throw new Error("not pure argument");if(typeof e.value!="object")return e.value;if(!("Pure"in e.value))throw new Error("Pure not in value");let n=e.value.Pure;return fa.de(t,new Uint8Array(n))}typeArg(e){return Cu(this.moveCall.typeArguments[e])}txArg(e){return this.moveCall.arguments[e]}},vu=class{constructor(r,e){this.globals=r,this.txb=e}decode(){let r=this.decodeCreateStreamInfo(),e=this.createStreamHelper().calculateCreateStreamFees(r);return{type:"CreateStream",info:r,fees:e}}decodeCreateStreamInfo(){let r=this.createStreamTransactions().map(e=>this.getCreationInfoFromMoveCall(e));return this.aggregateGroupStreamInfo(r)}createStreamTransactions(){let r=this.transactions.filter(e=>e.kind==="MoveCall"&&Me(e.target,this.contract.createStreamTarget));if(r.length===0)throw new U("No create stream transactions");return r.map(e=>new Xa(e,this.txb))}getCreationInfoFromMoveCall(r){let e=r.decodeInputString(4),{name:t,groupId:n}=Jr(e),s=r.decodeInputAddress(5),a=r.decodeInputU64(6),i=r.decodeInputU64(7),o=r.decodeInputU64(8),c=r.decodeInputU64(9),u=r.decodeInputU64(10),d=r.decodeInputBool(11),f=r.typeArg(0);return{name:t,groupId:n,recipient:s,timeStart:a,cliff:i,epochInterval:o,totalEpoch:c,amountPerEpoch:u,cancelable:d,coinType:f}}aggregateGroupStreamInfo(r){if(new Set(r.map(t=>JSON.stringify({name:t.name,groupId:t.groupId,timeStart:String(t.timeStart),epochInterval:String(t.epochInterval),totalEpoch:String(t.totalEpoch),cancelable:t.cancelable,coinType:t.coinType}))).size!==1)throw new N("Stream group not have common info");let e=r.map(t=>({address:t.recipient,amountPerStep:t.amountPerEpoch,cliffAmount:t.cliff}));return{name:r[0].name,coinType:r[0].coinType,recipients:e,interval:r[0].epochInterval,steps:r[0].totalEpoch,startTimeMs:r[0].timeStart,cancelable:r[0].cancelable}}mergeCoinTransactions(){return this.transactions.filter(r=>r.kind==="MergeCoins")}get transactions(){return this.txb.blockData.transactions}get contract(){return new Gt(this.globals.envConfig.contract,this.globals)}get feeContract(){return new Ha(this.globals.envConfig.contract,this.globals)}createStreamHelper(){return new Qr(this.globals,this.feeContract,this.contract)}getInputArg(r){if(r.kind!=="Input")throw new Error("not input type");return"value"in r?r:this.txb.blockData.inputs[r.index]}},Mu=class{constructor(r,e){this.globals=r,this.txb=e,this.contract=new Gt(r.envConfig.contract,r)}contract;decode(){if(this.isCreateStreamTransaction())return this.decodeCreateStreamTransaction();if(this.isClaimByProxyTransaction())return this.decodeClaimByProxyTransaction();if(this.isSetAutoClaimTransaction())return this.decodeSetAutoClaimTransaction();if(this.isCancelStreamTransaction())return this.decodeCancelStreamTransaction();if(this.isClaimStreamTransaction())return this.decodeClaimTransaction()}get transactions(){return this.txb.blockData.transactions}isCreateStreamTransaction(){return this.transactions.findIndex(r=>r.kind==="MoveCall"&&Me(r.target,this.contract.createStreamTarget))!==-1}isSetAutoClaimTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Me(this.transactions[0].target,this.contract.setAutoClaimTarget)}isCancelStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Me(this.transactions[0].target,this.contract.cancelStreamTarget)}isClaimStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Me(this.transactions[0].target,this.contract.claimStreamTarget)}isClaimByProxyTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Me(this.transactions[0].target,this.contract.claimStreamByProxyTarget)}decodeCreateStreamTransaction(){return new vu(this.globals,this.txb).decode()}decodeSetAutoClaimTransaction(){let r=this.helper.decodeSharedObjectId(0),e=this.helper.decodeInputBool(1);return{type:"SetAutoClaim",streamId:r,enabled:e}}decodeClaimTransaction(){return{type:"Claim",streamId:this.helper.decodeSharedObjectId(0)}}decodeClaimByProxyTransaction(){return{type:"ClaimByProxy",streamId:this.helper.decodeSharedObjectId(0)}}decodeCancelStreamTransaction(){return{type:"Cancel",streamId:this.helper.decodeSharedObjectId(0)}}get helper(){let r=this.transactions[0];return new Xa(r,this.txb)}},pa=class extends pt{constructor(r){super(r),this.data=r}txType=Au.Stream;txSubType="SetAutoClaim";async build(r){let{network:e,account:t}=r;return(await this.getClient(e,t).getStream(this.data.streamId)).setAutoClaim(this.data.enabled)}},Du=class{application="mpay";async deserialize(r){let{chain:e,transactionBlock:t}=r,n=Pa.new(e==="sui:mainnet"?"prod":"dev"),s=new Mu(n,t).decode(),a;switch(s.type){case"CreateStream":a=new ha(s.info);break;case"SetAutoClaim":a=new pa({streamId:s.streamId,enabled:s.enabled});break;case"Claim":a=new ma({streamId:s.streamId});break;case"ClaimByProxy":a=new da({streamId:s.streamId});break;case"Cancel":a=new la({streamId:s.streamId});break;default:throw new Error(`Unknown transaction type: ${s}`)}return{txType:a.txType,txSubType:a.txSubType,intentionData:a.data}}async build(r){let{intentionData:e}=r,t;switch(r.txSubType){case"CreateStream":t=new ha(e);break;case"Claim":t=new ma(e);break;case"ClaimByProxy":t=new da(e);break;case"SetAutoClaim":t=new pa(e);break;case"Cancel":t=new la(e);break;default:throw new Error("not implemented")}return t.build({...r})}},sn=class{constructor(r){this.data=r}get application(){return"msafe-core"}serialize(){return JSON.stringify((0,ei.default)(this.data))}},Fu=class ti extends sn{constructor(e){super(e),this.data=e}txType;txSubType;async build(e){let{suiClient:t,account:n}=e;return Pu(t,this.data,n.address)}static fromData(e){return new ti(e)}},_u=class ri extends sn{constructor(e){super(e),this.data=e}txType;txSubType;async build(e){let{suiClient:t,account:n}=e;return Ru(t,this.data,n.address)}static fromData(e){return new ri(e)}},Lu=class ni extends sn{constructor(e){super(e),this.data=e}txType;txSubType;async build(e){let{account:t}=e,n=ju.from(this.data.content);if(!Wu(n.blockData.sender,t.address))throw new Error("Invalid sender address");return n}static fromData(e){return new ni(e)}},Bu=class{application;constructor(){this.application=Nu}deserialize(){throw new Error("MSafe core transaction intention should be build from API")}async build(r){let{suiClient:e,account:t}=r,n;switch(r.txSubType){case Kr.assets.coin.send:n=Fu.fromData(r.intentionData);break;case Kr.assets.object.send:n=_u.fromData(r.intentionData);break;case Kr.others.plain:n=Lu.fromData(r.intentionData);break;default:throw new Error("not implemented")}return n.build({suiClient:e,account:t})}},qu=class{apps;constructor(r){this.apps=new Map(r.map(e=>[e.application,e]))}getAppHelper(r){let e=this.apps.get(r);if(!e)throw new Error(`${r} not registered`);return e}},$u="msafe-plain-tx",Zu=Uu.others.plain,Ku=class{application;constructor(){this.application=$u}async deserialize(r){let{transactionBlock:e,suiClient:t}=r,n=await e.build({client:t});return{txType:Hu.Other,txSubType:Zu,intentionData:{content:zu(n)}}}async build(r){let{suiClient:e,account:t}=r,n=Vu.from(Gu(r.intentionData.content)),s=await e.devInspectTransactionBlock({transactionBlock:n,sender:t.address});if(s.effects.status.status!=="success")throw new Error(s.effects.status.error);return n}},zt=new qu([new Bu,new Du,new Ku]);import{MultiSigAccount as ol,SigningMessageHelper as cl,TransactionDefaultApplication as Ae,TransactionSubTypes as De,TransactionType as Ne,buildRejectTxb as mi,isSameAddress as hi}from"@msafe/sui3-utils";import{TransactionBlock as fi}from"@mysten/sui.js/transactions";import{normalizeStructTag as ul,toHEX as ll}from"@mysten/sui.js/utils";import{TransactionBlock as Yu}from"@mysten/sui.js/transactions";var Ju=1000n,Qu=120n,Xu=100n,el={multiplier:{numerator:Qu,denominator:Xu}};var $t=class{constructor(e){this.globals=e}async simulate(e,t=el){let n=this.copyTransactionBlock(e.txb),{suiClient:s}=this.globals,a=await this.getGasPrice(t);n.setGasPrice(a);let i=await s.devInspectTransactionBlock({transactionBlock:n,sender:e.sender}),{gasUsed:o}=i.effects,c=this.toGasBudget(o,a),u=i.effects.status.status==="success",d;return u||(d=i.effects.status.error),{success:u,gasPrice:a,gasObject:i.effects.gasObject.reference,gasUsed:o,gasBudget:c,simulationError:d}}async getGasPrice(e){if(this.isFixedValue(e))return e.fixedVal;let t=await this.globals.suiClient.getReferenceGasPrice();return this.applyGasOption(t,e)}toGasBudget(e,t){let{computationCost:n,storageCost:s}=e,a=Ju*t,i=BigInt(n)+a,o=i+BigInt(s);return o>i?o:i}isFixedValue(e){return"fixedVal"in e}isMultiplier(e){return"multiplier"in e}applyGasOption(e,t){if(this.isFixedValue(t))return t.fixedVal;if(this.isMultiplier(t)){let{multiplier:n}=t;return e*n.numerator/n.denominator}throw new Error("Sanity: Unknown gas price option")}copyTransactionBlock(e){return Yu.from(e.serialize())}};import{Buffer as si}from"buffer";function an(r){return si.from(r,"utf-8")}function kf(r){return`0x${Array.prototype.map.call(r,e=>`0${e.toString(16)}`.slice(-2)).join("")}`}function on(r){return Uint8Array.from(si.from(r.startsWith("0x")?r.slice(2):r,"hex"))}import{verifyPersonalMessage as tl,verifyTransactionBlock as rl}from"@mysten/sui.js/verify";import{normalizeSuiAddress as un,normalizeStructTag as ln}from"@mysten/sui.js/utils";import{normalizeStructTag as cn}from"@mysten/sui.js/utils";var Zt=class{_client;_coinMetaReg;constructor(e){this._client=e,this._coinMetaReg=new Map}async getCoinMeta(e){let t=cn(e);if(this._coinMetaReg.has(t))return this._coinMetaReg.get(t);let n=await this.queryCoinMeta(t);return n&&this._coinMetaReg.set(t,n),n}async queryCoinMeta(e){return await this._client.getCoinMetadata({coinType:e})||void 0}},ai=/^0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<(.+)>$/,Kt=class r{static isCoin(e){return e?cn(e).match(ai)!=null:!1}static getCoinType(e){let[,t]=cn(e).match(ai)??[];return t||null}static getBalance(e){if(!r.isCoin(e.type)||e.content?.dataType!=="moveObject")return;let{balance:t}=e.content?.fields;if(t!==void 0)return BigInt(t)}};var se=class{static normalizeSuiAddress(e){return un(e)}static normalizeStructTag(e){return ln(e)}static isSuiAddressEqual(e,t){return un(e)===un(t)}static isSuiStructEqual(e,t){return ln(e)===ln(t)}static isCoinObjectType(e){return Kt.isCoin(e)}};function ii(r,e){return r.startsWith(e)?r:e+r}var oi=class r{static async getPublicKeyFromSignature(e){return e.messageType==="TransactionBlock"?rl(e.message,e.signature):tl(e.message,e.signature)}static async getPublicKeyFromPersonalSignature(e){let t=an(e.messageStr);return this.getPublicKeyFromSignature({message:t,messageType:"Personal",signature:e.signature})}static async verifySignature(e){let t=await r.getPublicKeyFromSignature(e);return se.isSuiAddressEqual(t.toSuiAddress(),e.targetAddress)}static async verifyPersonalSignature(e){let t=an(e.messageStr);return this.verifySignature({message:t,messageType:"Personal",signature:e.signature,targetAddress:e.targetAddress})}static async verifyTransactionSignature(e){return this.verifySignature({messageType:"TransactionBlock",message:e.payload,signature:e.signature,targetAddress:e.targetAddress})}};import{PublicKeySerde as nl}from"@msafe/sui3-utils";import{parseSerializedSignature as sl}from"@mysten/sui.js/cryptography";import{MultiSigPublicKey as al}from"@mysten/sui.js/multisig";var qf="0x2::sui::SUI";async function ci(r,e){let t;try{t=await r.queryTransactionBlocks({filter:{FromAddress:e},options:{showInput:!0},limit:2})}catch{return}if(t.data.length===0||!t.data[0].transaction?.txSignatures)return;let s=t.data[0].transaction?.txSignatures;for(let a=0;a!==s.length;a++){let i=s[a],o=il(i,e);if(o)return o}}function il(r,e){let t=sl(r);switch(t.signatureScheme){case"MultiSig":{let n=new al(t.multisig.multisig_pk).toSuiAddress();if(se.isSuiAddressEqual(n,e))throw new Error("multi-sig wallet cannot be owner");return}case"ZkLogin":{if(se.isSuiAddressEqual(t.zkLogin.address,e))throw new Error("ZkLogin wallet cannot be owner");return}case"ED25519":case"Secp256k1":case"Secp256r1":{let n=nl.de({publicKeyEncoded:t.publicKey,schema:t.signatureScheme});return se.isSuiAddressEqual(n.toSuiAddress(),e)?n:void 0}default:throw new Error("Unknown schema")}}async function Uf(r){let e=!0,t,n=[];for(;e;){let s=await r.suiClient.getCoins({owner:r.owner,coinType:r.coinType,cursor:t});n.push(...s.data),e=s.hasNextPage,t=s.nextCursor}return n}var ui=25;async function li(r){let e=[];for(;await r.hasNext();){let t=await r.next();e.push(t)}return e&&Array.isArray(e[0])?e.flat(1):e}var dn=class{constructor(e){this.requester=e;this.curPage=void 0,this.init=!0}curPage;init;async hasNext(){if(this.init)return this.curPage||(this.curPage=await this.requester.doNextRequest()),!!this.curPage.data?.length||this.curPage.hasNext;if(!this.curPage)throw new Error("invalid implementation of iterator");return this.curPage.hasNext}async next(){return this.init?(this.init=!1,this.curPage||(this.curPage=await this.requester.doNextRequest()),this.curPage.data):(this.curPage=await this.requester.doNextRequest(),this.curPage.data)}},Yt=class{constructor(e){this.requester=e;this.pager=new dn(e),this.curData=[],this.cursor=0}cursor;pager;curData;async hasNext(){return this.cursor<this.curData.length-1?!0:this.pager.hasNext()}async next(){for(this.cursor+=1;this.cursor>=this.curData.length;)if(await this.pager.hasNext())this.curData=await this.pager.next(),this.cursor=0;else throw new Error("not more data");return this.curData[this.cursor]}};async function di(r,e,t){let n=new mn(r,e,t);return await li(n)}var mn=class extends Yt{constructor(t,n,s){super(new hn(t,n,s));this.provider=t;this.owner=n;this.options=s}},hn=class{constructor(e,t,n){this.provider=e;this.owner=t;this.options=n;this.nextCursor=null,this.filter=n?.filter,this.pageSize=n?.pageSize||ui,this.objectOptions=n?.objectOptions||{showType:!0,showContent:!0}}nextCursor;filter;pageSize;objectOptions;async doNextRequest(){let e=await this.provider.getOwnedObjects({owner:this.owner,options:this.objectOptions,cursor:this.nextCursor,limit:this.pageSize});this.nextCursor=e.nextCursor;let t;if(this.filter){let{filter:n}=this;t=e.data.filter(s=>n?.(s))}else t=e.data;return{data:t.map(n=>n.data).filter(n=>n),hasNext:e.hasNextPage}}};var Pe=class r{constructor(e,t){this.globals=e;this.info=t;this.multiSig=new ol({threshold:t.threshold,ownersWithWeight:t.owners,creationNonce:t.creationNonce}),this.coinHelper=new Zt(this.suiClient),this.simulator=new $t(e)}multiSig;coinHelper;simulator;static async New(e,t){let n=await e.backend.getMSafeAccountInfo(t);if(new r(e,n).address!==t)throw new Error("Invalid msafe config with address")}async ownedCoins(){let e=await this.suiClient.getAllBalances({owner:this.address});return Promise.all(e.map(async t=>{let n=await this.coinHelper.getCoinMeta(t.coinType),s=t.lockedBalance.number?BigInt(t.totalBalance)-BigInt(t.lockedBalance.number):BigInt(t.totalBalance);return{type:ul(t.coinType),balance:BigInt(s),metadata:n}}))}async ownedObjects(e){let t={filter:n=>!n?.data?.type?.startsWith("0x2::coin::Coin"),...e};return di(this.suiClient,this.address,t)}async pendingTransaction(){let e=await this.backend.getPendingTransactions({msafeAddress:this.address});if(!e.pending)return;let t=e.pending,n=e.reject;return{application:t.application,txType:t.txType,txSubType:t.txSubType,createdAt:t.createdAt,creator:t.creator,digest:t.digest,intention:t.intention,sequenceNumber:t.sequenceNumber,payload:t.payload,votes:t.votes,approvalWeight:this.calculateWeightFromVotes(t.votes),msafeAddress:t.msafeAddress,rejectDigest:n?.digest??"",rejectPayload:n?.payload??"",rejectVotes:n?.votes??[],rejectWeight:this.calculateWeightFromVotes(n?.votes??[])}}async historyTransaction(e){return this.backend.getHistoryTransactions({msafeAddress:this.address,...e})}async futureIntentions(e){return this.backend.getFutureIntentions({msafeAddress:this.address,...e})}async currentSequenceNumber(){return this.backend.getCurrentSequenceNumber(this.address)}async nextSequenceNumber(){return this.backend.getNextSequenceNumber(this.address)}async simulateIntention(e){let t=zt.getAppHelper(e.application);if(!t)throw new Error(`Can't find app helper for application ${e.application}`);let n=await t.build({network:this.globals.config.network,intentionData:e.intention,txType:e.txType,txSubType:e.txSubType,suiClient:this.globals.suiClient,account:{address:this.address}});return this.simulator.simulate({txb:n,sender:this.address})}async proposeIntention(e){let t=cl.proposeIntentionMessage({msafeAddress:this.address,intention:e.intention,sn:e.sequenceNumber}),n=await this.wallet.signPersonalMessage({messageStr:t});return this.backend.proposeIntention({...e,msafeAddress:this.address,signature:n.signature})}async proposeIntentionAndBuildVote(e){let t=zt.getAppHelper(e.application);if(!t)throw new Error(`Can't find app helper for application ${e.application}`);let n=await t.build({network:this.globals.config.network,intentionData:e.intention,txType:e.txType,txSubType:e.txSubType,suiClient:this.globals.suiClient,account:{address:this.address}});n.setGasPrice(e.gasPrice),n.setGasBudget(e.gasBudget),n.setSender(this.address);let s=await n.build({client:this.globals.suiClient}),a=await n.getDigest({client:this.globals.suiClient}),i=await this.wallet.signTransactionBlock({transactionBlock:s});return this.backend.proposeIntentionAndBuildVote({...e,payload:ll(s),digest:a,msafeAddress:this.address,signature:i.signature})}async simulateCoinTransferIntention(e){let t=await this.nextSequenceNumber();return this.simulateIntention({application:Ae,txType:Ne.Assets,txSubType:De.assets.coin.send,sequenceNumber:t,intention:e})}async proposeCoinTransferIntention(e){let t=await this.nextSequenceNumber();return this.proposeIntention({application:Ae,txType:Ne.Assets,txSubType:De.assets.coin.send,sequenceNumber:t,intention:e})}async simulateObjectTransferIntention(e){let t=await this.nextSequenceNumber();return this.simulateIntention({application:Ae,txType:Ne.Assets,txSubType:De.assets.object.send,sequenceNumber:t,intention:e})}async proposeObjectTransferIntention(e){let t=await this.nextSequenceNumber();return this.proposeIntention({application:Ae,txType:Ne.Assets,txSubType:De.assets.object.send,sequenceNumber:t,intention:e})}async simulatePlainPayloadIntention(e){let t=await this.nextSequenceNumber();return this.simulateIntention({application:Ae,txType:Ne.Other,txSubType:De.others.plain,sequenceNumber:t,intention:e})}async proposePlainPayloadIntention(e){let t=await this.nextSequenceNumber(),n=fi.from(e.payload);if(!n.blockData.sender||!hi(n.blockData.sender,this.address))throw new Error("Transaction sender is not same as the multisig address");return this.proposeIntention({application:Ae,txType:Ne.Other,txSubType:De.others.plain,sequenceNumber:t,intention:e})}async voteForTransaction(e,t){let n=on(t),s=await this.wallet.signTransactionBlock({transactionBlock:n});return this.backend.voteForTransaction({msafeAddress:this.address,digest:e,signature:s.signature})}async proposePendingTransaction(e){let t=new fi,n=await t.build({client:this.suiClient}),s=await t.getDigest({client:this.suiClient}),a=await this.wallet.signTransactionBlock({transactionBlock:n});return this.backend.proposePendingTransaction({msafeAddress:this.address,userAddress:await this.userAddress(),intention:e,digest:s,signature:a.signature})}async simulateRejectTx(){let e=await this.pendingTransaction();if(!e||e.rejectDigest!=="")throw new Error("Already rejected");let t=e.payload,n=mi(this.address,t);return this.simulator.simulate({txb:n,sender:this.address})}async rejectCurrentTx(e){let t=await this.pendingTransaction();if(!t||t.rejectDigest!=="")throw new Error("Already rejected");let n=t.payload,s=mi(this.address,n),a=await s.getDigest({client:this.suiClient}),i=await s.build({client:this.suiClient}),o=await this.wallet.signTransactionBlock({transactionBlock:i});return this.backend.rejectCurrentTx({msafeAddress:this.address,digest:a,signature:o.signature,...e})}async simulateBuildTransaction(){let e=await this.backend.getNextIntention({msafeAddress:this.address}),t=zt.getAppHelper(e.application);if(!t)throw new Error(`Can't find app helper for application ${e.application}`);let n=await t.build({network:this.globals.config.network,intentionData:e.intention,txType:e.txType,txSubType:e.txSubType,suiClient:this.globals.suiClient,account:{address:this.address}});return this.simulator.simulate({txb:n,sender:this.address})}async buildNextIntentionAndAddToPending(e){return this.backend.buildNextIntentionAndAddToPending({msafeAddress:this.address,forceBuild:e.forceBuild,gasPrice:e.gasPrice,gasBudget:e.gasBudget})}async skipNextFailedIntention(){return this.backend.skipNextFailedIntention({msafeAddress:this.address})}async executePendingTx(e,t=!1){let n=t?e.rejectVotes:e.votes,s=t?e.rejectPayload:e.payload;if(this.calculateWeightFromVotes(n)<this.info.threshold)throw new Error("Not enough signature");let a=[],i=new Map(n.map(c=>[c.userAddress,c.signature]));for(let c=0;c<this.info.owners.length;c++){let u=this.info.owners[c],d=i.get(u.address);d&&a.push(d)}let o=this.multiSig.combinePartialSignatures(a);return this.suiClient.executeTransactionBlock({transactionBlock:on(s),signature:o,options:{showEffects:!0}})}async dashboard(){return this.backend.getDashboard({msafeAddress:this.address})}calculateWeightFromVotes(e){return this.calculateWeight(e.map(t=>t.userAddress))}calculateWeight(e){let t=0;for(let n=0;n<e.length;n++){let s=this.info.owners.find(a=>hi(a.address,e[n]));s&&(t+=s.weight)}return t}get address(){return this.multiSig.address}get backend(){return this.globals.backend}get wallet(){return this.globals.wallet}async userAddress(){return this.globals.wallet.address()}get suiClient(){return this.globals.suiClient}};import{isSameAddress as dl}from"@msafe/sui3-utils";import{normalizeSuiAddress as ml}from"@mysten/sui.js/utils";var Jt=class{constructor(e){this.globals=e;this.knownPublicKeys=new Map}knownPublicKeys;async getPublicKey(e){let t=this.knownPublicKeys.get(e);if(t)return t;let n=await this._getPublicKey(e);return n&&this.knownPublicKeys.set(e,n),n}async getPublicKeyBatch(e){let t=new Array(e.length).fill(void 0);for(let a=0;a<e.length;a++){let i=e[a];t[a]=this.knownPublicKeys.get(i)}let n=t.map((a,i)=>a===void 0?i:-1).filter(a=>a!==-1);if(n.length===0)return t;let s=await this.globals.backend.getPublicKeyBatch(n.map(a=>e[a]));for(let a=0;a<n.length;a++){let i=n[a];t[i]=s[a]}for(let a=0;a<t.length;a++)t[a]===void 0&&(t[a]=await this.getPublicKeyFromChain(e[a]));for(let a=0;a<e.length;a++)t[a]&&this.knownPublicKeys.set(e[a],t[a]);return t}addPublicKey(e,t){if(!dl(e,t.toSuiAddress()))throw new Error("Invalid public key");this.knownPublicKeys.set(ml(e),t)}async _getPublicKey(e){let t=await this.getPublicKeyFromBackend(e);if(t)return t;let n=await this.getPublicKeyFromChain(e);if(n)return n}async getPublicKeyFromBackend(e){try{return await this.globals.backend.getPublicKey(e)}catch{return}}async getPublicKeyFromChain(e){return ci(this.globals.suiClient,e)}};var Qt=class{constructor(e){this.globals=e}async create(e){return this.globals.backend.submitReport(e)}};import{SuiClient as bl}from"@mysten/sui.js/client";import{PublicKeySerde as pi,UserMSafeStatus as hl}from"@msafe/sui3-utils";import Xt from"axios";import*as rr from"json-bigint";var er=class r{constructor(e){this.apiURL=e}_token;async authSign(e){let t=await this.post("/auth/login",e);return this._token=t.data.accessToken,this._token}async verifyToken(e){try{return(await this.get("/auth",{headers:this.headers(e)})).status===200}catch{return!1}}setJWTToken(e){this._token=e}async getPublicKey(e){return(await this.getPublicKeyBatch([e]))[0]}async getPublicKeyBatch(e){let t={userAddressList:e};return(await this.get("/user/public-keys",{params:t,headers:this.headers()})).data?.map(s=>s?pi.de(s):void 0)}async getMSafeAccountInfo(e){let t={msafeAddress:e},n=await this.get("/msafe",{params:t,headers:this.headers()});return r.toMSafeConfig(n.data)}async getUserInfo(){return(await this.get("/user",{headers:this.headers()})).data}async getOwnedMSafeByStatus(e){let t={status:e.status??hl.active,...e.pagination?{page:e.pagination.page.toString(),limit:e.pagination.limit.toString()}:{}},n=await this.get("/msafe/owned",{params:t,headers:this.headers()});return{data:n.data.data.map(r.toMSafeConfig),meta:n.data.meta}}async updateMSafeStatus(e){let t=e;await this.post("/msafe/status",t,{headers:this.headers()})}async getPendingTransactions(e){return(await this.get("/transaction/pending",{params:e,headers:this.headers()})).data}async getHistoryTransactions(e){return(await this.get("/transaction/history",{params:e,headers:this.headers()})).data}async getFutureIntentions(e){return(await this.get("/transaction/intention",{params:e,headers:this.headers()})).data}async getNextIntention(e){return(await this.get("/transaction/intention/next",{params:e,headers:this.headers()})).data}async getCurrentSequenceNumber(e){return(await this.get("/transaction/sn/current",{params:{msafeAddress:e},headers:this.headers()})).data}async getNextSequenceNumber(e){return(await this.get("/transaction/sn/next",{params:{msafeAddress:e},headers:this.headers()})).data}async createMSafeAccount(e){await this.post("/msafe/create",e,{headers:this.headers()})}async proposeIntention(e){await this.post("/transaction/intention",e,{headers:this.headers()})}async proposePendingTransaction(e){}async rejectCurrentTx(e){await this.post("/transaction/pending/reject",{...e,gasPrice:e.gasPrice.toString(),gasBudget:e.gasBudget.toString()},{headers:this.headers()})}async voteForTransaction(e){await this.post("/transaction/pending/vote",e,{headers:this.headers()})}async buildNextIntentionAndAddToPending(e){await this.post("/transaction/pending/build",{...e,gasPrice:e.gasPrice.toString(),gasBudget:e.gasBudget.toString()},{headers:this.headers()})}async proposeIntentionAndBuildVote(e){await this.post("/transaction/intention/build",{...e,gasPrice:e.gasPrice.toString(),gasBudget:e.gasBudget.toString()},{headers:this.headers()})}async skipNextFailedIntention(e){await this.post("/transaction/pending/skip",e,{headers:this.headers()})}async getAddressBookEntries(e){return(await this.get("/address-book",{headers:this.headers(),params:e})).data}async updateAddressBook(e){await this.post("/address-book",e,{headers:this.headers()})}async getAddressBookMode(){return(await this.get("/address-book/mode",{headers:this.headers()})).data}async setAddressBookMode(e){await this.post("/address-book/mode",{mode:e.mode},{headers:this.headers()})}async submitReport(e){await this.post("/report",e)}async getDashboard(e){return(await this.get("/dashboard",{params:e,headers:this.headers()})).data}headers(e){return{Authorization:`Bearer ${e||this._token}`}}static toMSafeConfig(e){return{...e,owners:e.owners.map(t=>({address:t.address,weight:t.weight,publicKey:pi.de({publicKeyEncoded:t.publicKeyEncoded,schema:t.schema})}))}}async get(e,t){let n=this.getFullUrl(e);try{return await Xt.get(n,t)}catch(s){throw tr.fromError(s)??s}}async post(e,t,n){let s=this.getFullUrl(e);try{return await Xt.post(s,t,{...n,transformRequest:this.getTransformRequest()})}catch(a){throw tr.fromError(a)??a}}getFullUrl(e){return e.startsWith(this.apiURL)?e:`${this.apiURL}${ii(e,"/")}`}getTransformRequest(){let e=[],{transformRequest:t}=Xt.defaults;return t?t instanceof Array?e=t:e=[t]:e=[],[n=>rr.parse(rr.stringify(n)),...e]}},tr=class r extends Error{constructor(t){super();this.e=t;Error.captureStackTrace(this,this.constructor)}name;static fromError(t){if(Xt.isAxiosError(t)&&t?.response?.data&&"message"in t.response.data)return new r(t)}get status(){return this.e.response?.status??void 0}get message(){return`${this.respMessage()??"Unknown resp"}`}respMessage(){if(this.e.response?.data)return(this.e.response?.data).message??void 0}get endpoint(){return this.e.config?.url??""}toString(){return this.message}};var fl=(a=>(a.local="local",a.unit="unit",a.dev="dev",a.prev="prev",a.prod="prod",a))(fl||{}),fn="https://fullnode.testnet.sui.io",gi="https://fullnode.mainnet.sui.io",yi="http://127.0.0.1:3000",wi="http://127.0.0.1:3001",pl="https://sui-dev.m-safe.link",gl="http://13.56.226.148:81",yl="https://sui-preview.m-safe.link",wl="https://sui.m-safe.link",Sl=new Map([["unit",{suiClient:{url:fn},backend:{url:yi},syncingURL:wi,network:"sui:testnet"}],["local",{suiClient:{url:fn},backend:{url:yi},syncingURL:wi,network:"sui:testnet"}],["dev",{suiClient:{url:fn},backend:{url:pl},syncingURL:gl,network:"sui:testnet"}],["prev",{suiClient:{url:gi},backend:{url:yl},syncingURL:"",network:"sui:mainnet"}],["prod",{suiClient:{url:gi},backend:{url:wl},syncingURL:"",network:"sui:mainnet"}]]);function Si(r,e){let t=Sl.get(r);if(!t)throw new Error("Unknown environment");return e?.suiClient?.url&&(t.suiClient.url=e.suiClient.url),e?.backend?.url&&(t.backend.url=e.backend.url),t}var nr=class r{backend;suiClient;config;_wallet;constructor(e){this.backend=e.backend,this.suiClient=e.suiClient,this.config=e.config}static async New(e,t){let n=Si(e,t),s=new bl(n.suiClient),a=new er(n.backend.url);return new r({backend:a,suiClient:s,config:n})}connectWallet(e){this._wallet=e}get wallet(){if(!this._wallet)throw new Error("wallet not connected");return this._wallet}set wallet(e){this._wallet=e}};var pn=class r{constructor(e){this.globals=e}_creationHelper;_publicKeyHelper;static async New(e,t){let n=await nr.New(e,t);return new r(n)}async connectWallet(e){if(e.jwtToken&&await this.backend.verifyToken(e.jwtToken))return this.globals.wallet=e.wallet,this.backend.setJWTToken(e.jwtToken),e.jwtToken;let t=await this.authSign(e.wallet);return this.globals.wallet=e.wallet,this.backend.setJWTToken(t),t}async authSign(e){let t=Tl.loginMessageWithTimestamp(new Date().toUTCString()),n=await e.signPersonalMessage({messageStr:t});return this.backend.authSign({address:await e.address(),message:t,signature:n.signature,walletType:e.walletType})}async userInfo(){return this.globals.backend.getUserInfo()}async ownedMSafe(e){return this.globals.backend.getOwnedMSafeByStatus({status:Il.active,pagination:e})}async createAccount(e){return this.creationHelper.submitMSafeCreation(e)}getMSafeAccount(e){return new Pe(this.globals,e)}async getMSafeAccountFromAddress(e){let t=await this.backend.getMSafeAccountInfo(e);return new Pe(this.globals,t)}get creationHelper(){return this._creationHelper||(this._creationHelper=new _e(this.globals,this.publicKeyHelper)),this._creationHelper}get publicKeyHelper(){return this._publicKeyHelper||(this._publicKeyHelper=new Jt(this.globals)),this._publicKeyHelper}get config(){return this.globals.config}get backend(){return this.globals.backend}get wallet(){return this.globals.wallet}get AddressBook(){return new We(this.globals)}get Invitation(){return new yt(this.globals)}get Report(){return new Qt(this.globals)}async walletAddress(){return this.wallet.address()}};export{We as AddressBookSDK,ai as COIN_TYPE_ARG_REGEX,Kt as Coin,Zt as CoinHelper,_e as CreateHelper,pl as DEV_API_URL,gl as DEV_SYNCING_URL,Sl as ENV_CONFIGS,se as Formatter,on as HexToUint8Array,yi as LOCAL_API_URL,wi as LOCAL_SYNCING_URL,gi as MAINNET_RPC_URL,Pe as MSafeAccount,pn as MSafeClient,fl as MSafeEnv,nr as MSafeGlobals,yl as PREV_API_URL,wl as PROD_API_URL,qf as SUI_COIN,oi as SignatureVerifier,fn as TESTNET_RPC_URL,kf as Uint8ArrayToHex,ii as addPrefix,Uf as getAllCoins,Si as getMSafeConfig,ci as getPublicKeyFromChain,an as stringToBuffer};
26
2
  //# sourceMappingURL=index.js.map