@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.cjs CHANGED
@@ -1,26 +1,2 @@
1
- "use strict";var Mu=Object.create;var Rr=Object.defineProperty;var Pu=Object.getOwnPropertyDescriptor;var Nu=Object.getOwnPropertyNames;var Ru=Object.getPrototypeOf,Hu=Object.prototype.hasOwnProperty;var W=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Wu=(t,e)=>{for(var r in e)Rr(t,r,{get:e[r],enumerable:!0})},Ja=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Nu(e))!Hu.call(t,s)&&s!==r&&Rr(t,s,{get:()=>e[s],enumerable:!(n=Pu(e,s))||n.enumerable});return t};var qe=(t,e,r)=>(r=t!=null?Mu(Ru(t)):{},Ja(e||!t||!t.__esModule?Rr(r,"default",{value:t,enumerable:!0}):r,t)),ju=t=>Ja(Rr({},"__esModule",{value:!0}),t);var ni=W(()=>{"use strict"});var q=W((Lr,si)=>{"use strict";(function(t,e){typeof Lr=="object"?si.exports=Lr=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})(Lr,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 require=="function")try{n=ni()}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 Kt=W((qr,ai)=>{"use strict";(function(t,e){typeof qr=="object"?ai.exports=qr=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(qr,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 oi=W((zr,ii)=>{"use strict";(function(t,e){typeof zr=="object"?ii.exports=zr=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(zr,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 ui=W((Ur,ci)=>{"use strict";(function(t,e){typeof Ur=="object"?ci.exports=Ur=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Ur,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 Ve=W((Vr,li)=>{"use strict";(function(t,e){typeof Vr=="object"?li.exports=Vr=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Vr,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 di=W((Gr,fi)=>{"use strict";(function(t,e){typeof Gr=="object"?fi.exports=Gr=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Gr,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 Ge=W((Kr,hi)=>{"use strict";(function(t,e){typeof Kr=="object"?hi.exports=Kr=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Kr,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 ps=W(($r,xi)=>{"use strict";(function(t,e){typeof $r=="object"?xi.exports=$r=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})($r,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 Yr=W((Zr,mi)=>{"use strict";(function(t,e){typeof Zr=="object"?mi.exports=Zr=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Zr,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 gi=W((Jr,pi)=>{"use strict";(function(t,e,r){typeof Jr=="object"?pi.exports=Jr=e(q(),Yr()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(Jr,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 gs=W((Xr,yi)=>{"use strict";(function(t,e,r){typeof Xr=="object"?yi.exports=Xr=e(q(),Kt()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(Xr,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,jt=E,pt=I,fs=P,Lt=T,ve=H,ce=N,Mr=j,qt=z,Pr=S,zt=D,ds=F,Ut=A,be=0;be<80;be++){var me,je,Nr=u[be];if(be<16)je=Nr.high=f[h+be*2]|0,me=Nr.low=f[h+be*2+1]|0;else{var Wa=u[be-15],gt=Wa.high,Vt=Wa.low,wu=(gt>>>1|Vt<<31)^(gt>>>8|Vt<<24)^gt>>>7,ja=(Vt>>>1|gt<<31)^(Vt>>>8|gt<<24)^(Vt>>>7|gt<<25),La=u[be-2],yt=La.high,Gt=La.low,Cu=(yt>>>19|Gt<<13)^(yt<<3|Gt>>>29)^yt>>>6,qa=(Gt>>>19|yt<<13)^(Gt<<3|yt>>>29)^(Gt>>>6|yt<<26),za=u[be-7],Eu=za.high,Su=za.low,Ua=u[be-16],Au=Ua.high,Va=Ua.low;me=ja+Su,je=wu+Eu+(me>>>0<ja>>>0?1:0),me=me+qa,je=je+Cu+(me>>>0<qa>>>0?1:0),me=me+Va,je=je+Au+(me>>>0<Va>>>0?1:0),Nr.high=je,Nr.low=me}var Du=ve&Mr^~ve&Pr,Ga=ce&qt^~ce&zt,Tu=Y&ie^Y&jt^ie&jt,Bu=Z&L^Z&pt^L&pt,Fu=(Y>>>28|Z<<4)^(Y<<30|Z>>>2)^(Y<<25|Z>>>7),Ka=(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),ku=(ce>>>14|ve<<18)^(ce>>>18|ve<<14)^(ce<<23|ve>>>9),$a=l[be],Ou=$a.high,Za=$a.low,ue=Ut+ku,Le=ds+Iu+(ue>>>0<Ut>>>0?1:0),ue=ue+Ga,Le=Le+Du+(ue>>>0<Ga>>>0?1:0),ue=ue+Za,Le=Le+Ou+(ue>>>0<Za>>>0?1:0),ue=ue+me,Le=Le+je+(ue>>>0<me>>>0?1:0),Ya=Ka+Bu,_u=Fu+Tu+(Ya>>>0<Ka>>>0?1:0);ds=Pr,Ut=zt,Pr=Mr,zt=qt,Mr=ve,qt=ce,ce=Lt+ue|0,ve=fs+Le+(ce>>>0<Lt>>>0?1:0)|0,fs=jt,Lt=pt,jt=ie,pt=L,ie=Y,L=Z,Z=ue+Ya|0,Y=Le+_u+(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+pt,x.high=E+jt+(I>>>0<pt>>>0?1:0),T=m.low=T+Lt,m.high=P+fs+(T>>>0<Lt>>>0?1:0),N=b.low=N+ce,b.high=H+ve+(N>>>0<ce>>>0?1:0),z=v.low=z+qt,v.high=j+Mr+(z>>>0<qt>>>0?1:0),D=w.low=D+zt,w.high=S+Pr+(D>>>0<zt>>>0?1:0),A=C.low=A+Ut,C.high=F+ds+(A>>>0<Ut>>>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 bi=W((Qr,vi)=>{"use strict";(function(t,e,r){typeof Qr=="object"?vi.exports=Qr=e(q(),Kt(),gs()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(Qr,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 Ci=W((en,wi)=>{"use strict";(function(t,e,r){typeof en=="object"?wi.exports=en=e(q(),Kt()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(en,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 Si=W((tn,Ei)=>{"use strict";(function(t,e){typeof tn=="object"?Ei.exports=tn=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(tn,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 nn=W((rn,Ai)=>{"use strict";(function(t,e){typeof rn=="object"?Ai.exports=rn=e(q()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(rn,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 Ti=W((sn,Di)=>{"use strict";(function(t,e,r){typeof sn=="object"?Di.exports=sn=e(q(),Yr(),nn()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(sn,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((an,Bi)=>{"use strict";(function(t,e,r){typeof an=="object"?Bi.exports=an=e(q(),ps(),nn()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(an,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((on,Fi)=>{"use strict";(function(t,e,r){typeof on=="object"?Fi.exports=on=e(q(),Ie()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(on,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 ki=W((cn,Ii)=>{"use strict";(function(t,e,r){typeof cn=="object"?Ii.exports=cn=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(cn,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 _i=W((un,Oi)=>{"use strict";(function(t,e,r){typeof un=="object"?Oi.exports=un=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(un,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 Pi=W((ln,Mi)=>{"use strict";(function(t,e,r){typeof ln=="object"?Mi.exports=ln=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(ln,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 Ri=W((fn,Ni)=>{"use strict";(function(t,e,r){typeof fn=="object"?Ni.exports=fn=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(fn,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 Wi=W((dn,Hi)=>{"use strict";(function(t,e,r){typeof dn=="object"?Hi.exports=dn=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(dn,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 Li=W((hn,ji)=>{"use strict";(function(t,e,r){typeof hn=="object"?ji.exports=hn=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(hn,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 zi=W((xn,qi)=>{"use strict";(function(t,e,r){typeof xn=="object"?qi.exports=xn=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(xn,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 Vi=W((mn,Ui)=>{"use strict";(function(t,e,r){typeof mn=="object"?Ui.exports=mn=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(mn,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 Ki=W((pn,Gi)=>{"use strict";(function(t,e,r){typeof pn=="object"?Gi.exports=pn=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(pn,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 Zi=W((gn,$i)=>{"use strict";(function(t,e,r){typeof gn=="object"?$i.exports=gn=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(gn,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var Ji=W((yn,Yi)=>{"use strict";(function(t,e,r){typeof yn=="object"?Yi.exports=yn=e(q(),ee()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(yn,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 Qi=W((vn,Xi)=>{"use strict";(function(t,e,r){typeof vn=="object"?Xi.exports=vn=e(q(),Ve(),Ge(),Ie(),ee()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(vn,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 t0=W((bn,e0)=>{"use strict";(function(t,e,r){typeof bn=="object"?e0.exports=bn=e(q(),Ve(),Ge(),Ie(),ee()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(bn,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 n0=W((wn,r0)=>{"use strict";(function(t,e,r){typeof wn=="object"?r0.exports=wn=e(q(),Ve(),Ge(),Ie(),ee()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(wn,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 a0=W((Cn,s0)=>{"use strict";(function(t,e,r){typeof Cn=="object"?s0.exports=Cn=e(q(),Ve(),Ge(),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 o0=W((En,i0)=>{"use strict";(function(t,e,r){typeof En=="object"?i0.exports=En=e(q(),Ve(),Ge(),Ie(),ee()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(En,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 u0=W((Sn,c0)=>{"use strict";(function(t,e,r){typeof Sn=="object"?c0.exports=Sn=e(q(),Ve(),Ge(),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;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 f0=W((An,l0)=>{"use strict";(function(t,e,r){typeof An=="object"?l0.exports=An=e(q(),Kt(),oi(),ui(),Ve(),di(),Ge(),ps(),Yr(),gi(),gs(),bi(),Ci(),Si(),nn(),Ti(),Ie(),ee(),ki(),_i(),Pi(),Ri(),Wi(),Li(),zi(),Vi(),Ki(),Zi(),Ji(),Qi(),t0(),n0(),a0(),o0(),u0()):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)})(An,function(t){return t})});var h0=W((Sh,d0)=>{"use strict";d0.exports=t=>{if(Object.prototype.toString.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}});var m0=W((Ah,x0)=>{"use strict";var ys=h0();x0.exports=(t,e={})=>{if(!ys(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):ys(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&&ys(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 y0=W((Dh,g0)=>{"use strict";var Yu=Object.prototype.toString;g0.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 tl(e)?"generatorfunction":"function";if(Ju(e))return"array";if(sl(e))return"buffer";if(nl(e))return"arguments";if(Qu(e))return"date";if(Xu(e))return"error";if(el(e))return"regexp";switch(p0(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(rl(e))return"generator";switch(r=Yu.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 p0(t){return typeof t.constructor=="function"?t.constructor.name:null}function Ju(t){return Array.isArray?Array.isArray(t):t instanceof Array}function Xu(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function Qu(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function el(t){return t instanceof RegExp?!0:typeof t.flags=="string"&&typeof t.ignoreCase=="boolean"&&typeof t.multiline=="boolean"&&typeof t.global=="boolean"}function tl(t,e){return p0(t)==="GeneratorFunction"}function rl(t){return typeof t.throw=="function"&&typeof t.return=="function"&&typeof t.next=="function"}function nl(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 sl(t){return t.constructor&&typeof t.constructor.isBuffer=="function"?t.constructor.isBuffer(t):!1}});var vt=W((Th,C0)=>{"use strict";var al=m0(),vs=y0(),v0=(t,e)=>!e||vs(e)!=="array"?!1:e.indexOf(t)>-1,il=(t,e)=>al(t,{compare:e}),b0=(t,e)=>{let r=e&&e.compareFunction;return t.slice().sort(r)};function w0(t,e){let r=e&&e.compareFunction,n=il(t,r);return Object.keys(t).forEach(function(s){let a=n[s],o=vs(a);if(o==="object"){(!e||!v0(s,e.ignoreObjectAtKeys))&&(n[s]=w0(a,e));return}o==="array"&&(!e||!v0(s,e.ignoreArrayAtKeys))&&(n[s]=b0(a,e))}),n}var $t=(t,e)=>{let r=vs(t);return $t[r]?$t[r](t,e):t};$t.array=b0;$t.object=w0;C0.exports=$t});var fh={};Wu(fh,{AddressBookSDK:()=>Ct,COIN_TYPE_ARG_REGEX:()=>Ta,Coin:()=>Or,CoinHelper:()=>kr,CreateHelper:()=>wt,DEV_API_URL:()=>mu,DEV_SYNCING_URL:()=>pu,ENV_CONFIGS:()=>vu,Formatter:()=>We,HexToUint8Array:()=>ts,LOCAL_API_URL:()=>Na,LOCAL_SYNCING_URL:()=>Ra,MAINNET_RPC_URL:()=>Pa,MSafeAccount:()=>mt,MSafeClient:()=>ls,MSafeEnv:()=>xu,MSafeGlobals:()=>_r,PREV_API_URL:()=>gu,PROD_API_URL:()=>yu,SUI_COIN:()=>ch,SignatureVerifier:()=>Fa,TESTNET_RPC_URL:()=>us,Uint8ArrayToHex:()=>oh,addPrefix:()=>Ba,getAllCoins:()=>lh,getMSafeConfig:()=>Ha,getPublicKeyFromChain:()=>Ia,stringToBuffer:()=>es});module.exports=ju(fh);var bs=require("@mysten/sui.js/keypairs/ed25519"),E0=require("@mysten/sui.js/multisig"),A0=require("@mysten/sui.js/cryptography"),cl=require("@mysten/sui.js/keypairs/ed25519"),ul=require("@mysten/sui.js/keypairs/secp256k1"),ll=require("@mysten/sui.js/keypairs/secp256r1"),fl=require("@mysten/sui.js/multisig"),D0=require("@mysten/sui.js/verify"),ws=require("@mysten/sui.js/cryptography"),T0=require("@mysten/sui.js/keypairs/ed25519"),B0=require("@mysten/sui.js/keypairs/secp256k1"),F0=require("@mysten/sui.js/keypairs/secp256r1"),I0=require("@mysten/sui.js/utils"),Es=require("buffer"),it=require("@mysten/sui.js/utils"),bt=require("@mysten/sui.js/transactions"),bl=require("@mysten/sui.js/bcs"),As=require("@mysten/sui.js/utils"),wl=require("@mysten/sui.js/utils"),M0=require("@mysten/sui.js/utils");function Lu(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function qu(t,...e){if(!Lu(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 hs(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 Xa(t,e){qu(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}function Qa(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var Wr=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),we=(t,e)=>t<<32-e|t>>>e,zu=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!zu)throw new Error("Non little-endian hardware is not supported");var Uu=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function ei(t){if(!Qa(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=Uu[t[r]];return e}function Vu(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function xs(t){if(typeof t=="string"&&(t=Vu(t)),!Qa(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}var Hr=class{clone(){return this._cloneInto()}},xh={}.toString;function ti(t){let e=n=>t().update(xs(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Gu(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 jr=class extends Hr{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=Wr(this.buffer)}update(e){hs(this);let{view:r,buffer:n,blockLen:s}=this;e=xs(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=Wr(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){hs(this),Xa(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;Gu(n,s-8,BigInt(this.length*8),a),this.process(n,0);let i=Wr(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 Ku=(t,e,r)=>t&e^~t&r,$u=(t,e,r)=>t&e^t&r^e&r,Zu=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]),ze=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ue=new Uint32Array(64),ms=class extends jr{constructor(){super(64,32,8,!1),this.A=ze[0]|0,this.B=ze[1]|0,this.C=ze[2]|0,this.D=ze[3]|0,this.E=ze[4]|0,this.F=ze[5]|0,this.G=ze[6]|0,this.H=ze[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)Ue[d]=e.getUint32(r,!1);for(let d=16;d<64;d++){let f=Ue[d-15],h=Ue[d-2],p=we(f,7)^we(f,18)^f>>>3,g=we(h,17)^we(h,19)^h>>>10;Ue[d]=g+Ue[d-7]+p+Ue[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+Ku(i,c,l)+Zu[d]+Ue[d]|0,g=(we(n,2)^we(n,13)^we(n,22))+$u(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(){Ue.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var ri=ti(()=>new ms);var P0=qe(f0(),1),N0=qe(vt(),1);var Cl=qe(vt(),1),ke={minWeight:0,maxWeight:255,maxOwnerWithNonce:9,maxOwnerWithoutNonce:10,nonce:{prefix:"maven",weight:1,maxSize:16}},ol="0x2::sui::SUI";var Dn=class S0{constructor(e){this.config=e,S0.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}),E0.MultiSigPublicKey.fromPublicKeys({threshold:n,publicKeys:a})}makeNoncePublicKey(e){let r=new ArrayBuffer(bs.Ed25519PublicKey.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 bs.Ed25519PublicKey(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")}},Ke=class{static ser(t){return{publicKeyEncoded:t.toBase64(),schema:ws.SIGNATURE_FLAG_TO_SCHEME[t.flag()]}}static de(t){let e=typeof t.publicKeyEncoded=="string"?(0,I0.fromB64)(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=ws.SIGNATURE_FLAG_TO_SCHEME[e[0]],e=e.slice(1)),r){case"ED25519":return new T0.Ed25519PublicKey(e);case"Secp256k1":return new B0.Secp256k1PublicKey(e);case"Secp256r1":return new F0.Secp256r1PublicKey(e);default:throw new Error("Unsupported signature scheme: $input.scheme")}}};function Be(t,e){return(0,it.normalizeSuiAddress)(t)===(0,it.normalizeSuiAddress)(e)}function k0(t,e){return(0,it.normalizeStructTag)(t)===(0,it.normalizeStructTag)(e)}function dl(t){return(0,it.normalizeStructTag)(t).startsWith("0x2::coin::Coin")}function hl(t){return Es.Buffer.from(t,"utf-8")}function xl(t){return Uint8Array.from(Es.Buffer.from(t.startsWith("0x")?t.slice(2):t,"hex"))}async function ml(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 Ss(t,e){let n=bt.TransactionBlock.from(xl(e)).blockData.gasConfig.payment;if(!n)throw new Error("No gas payment found for approve payload");let s=new bt.TransactionBlock;return s.setSender(t),s.setGasPayment(n),s}async function O0(t,e,r){return k0(e.coinType,ol)?pl(e,r):gl(t,e,r)}function pl(t,e){let r=new bt.TransactionBlock,[n]=r.splitCoins(r.gas,[r.pure(t.amount)]);return r.transferObjects([n],r.pure(t.recipient)),r.setSender(e),r}async function gl(t,e,r){let n=await ml(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 bt.TransactionBlock,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 _0(t,e,r){await yl(t,e,r);let n=new bt.TransactionBlock;return n.transferObjects([n.object(e.objectId)],n.pure(e.receiver)),n.setSender(r),n}async function yl(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(!k0(n.data.type,e.objectType))throw new Error("Object type not expected");if(dl(n.data.type))throw new Error("Can not transfer coin object in Object Transfer transactions");let s=vl(n);if(!Be(s,r))throw new Error("Object owner not match")}function vl(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 Zt=(t=>(t.active="ACTIVE",t.pending="PENDING",t.ignored="IGNORED",t))(Zt||{}),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 Cs{static createMSafeMessage(e){return`Create MSafe Account: ${e}`}static loginMessageWithTimestamp(e){return`Welcome to MSafe. ${e}`}static loginMessage(){return Cs.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,N0.default)(e),n=JSON.stringify(r),s=ri(n),a=ei(s);return`Submit a new transaction proposal [${e.sn}]: ${a}`}static updateAddressBookMessage(e){let r=e.map(o=>({...o,address:(0,M0.normalizeSuiAddress)(o.address)})).map(o=>Cs.sortObjectKeys(o)),n=JSON.stringify(r,null,2);return hl(n).length<=1e3?`Address book entry update: ${n}`:`Bulk address book update: ${(0,P0.MD5)(n)}`}static sortObjectKeys(e){return Object.keys(e).sort().reduce((r,n)=>({...r,[n]:e[n]}),{})}};var wt=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=Ke.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,...Ke.ser(n[a])})),threshold:e.threshold,name:e.name,description:e.description,creationNonce:e.creationNonce,signature:r})}};var Ct=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 Tn=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})}};var Oc=require("@mysten/sui.js/client"),He=qe(require("axios"),1),xt=require("@mysten/sui.js/utils"),Ht=require("@mysten/sui.js/utils");var Me=class extends Error{},Bn=class extends Me{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Fn=class extends Me{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},In=class extends Me{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Ce=class extends Me{},Et=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",$e={year:_,month:_,day:_},Yt={year:_,month:Se,day:_},Ds={year:_,month:Se,day:_,weekday:Se},Jt={year:_,month:fe,day:_},Xt={year:_,month:fe,day:_,weekday:fe},Qt={hour:_,minute:_},er={hour:_,minute:_,second:_},tr={hour:_,minute:_,second:_,timeZoneName:Se},rr={hour:_,minute:_,second:_,timeZoneName:fe},nr={hour:_,minute:_,hourCycle:"h23"},sr={hour:_,minute:_,second:_,hourCycle:"h23"},ar={hour:_,minute:_,second:_,hourCycle:"h23",timeZoneName:Se},ir={hour:_,minute:_,second:_,hourCycle:"h23",timeZoneName:fe},or={year:_,month:_,day:_,hour:_,minute:_},cr={year:_,month:_,day:_,hour:_,minute:_,second:_},ur={year:_,month:Se,day:_,hour:_,minute:_},lr={year:_,month:Se,day:_,hour:_,minute:_,second:_},Ts={year:_,month:Se,day:_,weekday:Se,hour:_,minute:_},fr={year:_,month:fe,day:_,hour:_,minute:_,timeZoneName:Se},dr={year:_,month:fe,day:_,hour:_,minute:_,second:_,timeZoneName:Se},hr={year:_,month:fe,day:_,weekday:fe,hour:_,minute:_,timeZoneName:fe},xr={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 Bs=null,Ze=class t extends oe{static get instance(){return Bs===null&&(Bs=new t),Bs}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return On(e,r,n)}formatOffset(e,r){return Ye(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var Mn={};function El(t){return Mn[t]||(Mn[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"})),Mn[t]}var Sl={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Al(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 Dl(t,e){let r=t.formatToParts(e),n=[];for(let s=0;s<r.length;s++){let{type:a,value:o}=r[s],i=Sl[a];a==="era"?n[i]=o:R(i)||(n[i]=parseInt(o,10))}return n}var _n={},ae=class t extends oe{static create(e){return _n[e]||(_n[e]=new t(e)),_n[e]}static resetCache(){_n={},Mn={}}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 On(e,r,n,this.name)}formatOffset(e,r){return Ye(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=El(this.name),[s,a,o,i,c,l,u]=n.formatToParts?Dl(n,r):Al(n,r);i==="BC"&&(s=-Math.abs(s)+1);let f=St({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 R0={};function Tl(t,e={}){let r=JSON.stringify([t,e]),n=R0[r];return n||(n=new Intl.ListFormat(t,e),R0[r]=n),n}var Fs={};function Is(t,e={}){let r=JSON.stringify([t,e]),n=Fs[r];return n||(n=new Intl.DateTimeFormat(t,e),Fs[r]=n),n}var ks={};function Bl(t,e={}){let r=JSON.stringify([t,e]),n=ks[r];return n||(n=new Intl.NumberFormat(t,e),ks[r]=n),n}var Os={};function Fl(t,e={}){let{base:r,...n}=e,s=JSON.stringify([t,n]),a=Os[s];return a||(a=new Intl.RelativeTimeFormat(t,e),Os[s]=a),a}var mr=null;function Il(){return mr||(mr=new Intl.DateTimeFormat().resolvedOptions().locale,mr)}var H0={};function kl(t){let e=H0[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,H0[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=Is(t).resolvedOptions(),s=t}catch{let c=t.substring(0,r);n=Is(c).resolvedOptions(),s=c}let{numberingSystem:a,calendar:o}=n;return[s,a,o]}}function _l(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function Ml(t){let e=[];for(let r=1;r<=12;r++){let n=U.utc(2009,r,1);e.push(t(n))}return e}function Pl(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 Pn(t,e,r,n){let s=t.listingMode();return s==="error"?null:s==="en"?r(e):n(e)}function Nl(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 _s=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=Bl(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):At(e,3);return J(r,this.padTo)}}},Ms=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=Is(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()}},Ps=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&Nn()&&(this.rtf=Fl(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):W0(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},Rl={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":Il()),c=r||V.defaultNumberingSystem,l=n||V.defaultOutputCalendar,u=pr(s)||V.defaultWeekSettings;return new t(i,c,l,u,o)}static resetCache(){mr=null,Fs={},ks={},Os={}}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=_l(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=Nl(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,pr(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 Pn(this,e,Ns,()=>{let n=r?{month:e,day:"numeric"}:{month:e},s=r?"format":"standalone";return this.monthsCache[s][e]||(this.monthsCache[s][e]=Ml(a=>this.extract(a,n,"month"))),this.monthsCache[s][e]})}weekdays(e,r=!1){return Pn(this,e,Rs,()=>{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]=Pl(a=>this.extract(a,n,"weekday"))),this.weekdaysCache[s][e]})}meridiems(){return Pn(this,void 0,()=>Hs,()=>{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 Pn(this,e,Ws,()=>{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 _s(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new Ms(e,this.intl,r)}relFormatter(e={}){return new Ps(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Tl(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:Rn()?kl(this.locale):Rl}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 Ls=null,te=class t extends oe{static get utcInstance(){return Ls===null&&(Ls=new t(0)),Ls}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(ot(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Ye(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Ye(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return Ye(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 Dt=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(j0(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?Ze.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 Dt(t)}var L0=()=>Date.now(),q0="system",z0=null,U0=null,V0=null,G0=60,K0,$0=null,V=class{static get now(){return L0}static set now(e){L0=e}static set defaultZone(e){q0=e}static get defaultZone(){return Ae(q0,Ze.instance)}static get defaultLocale(){return z0}static set defaultLocale(e){z0=e}static get defaultNumberingSystem(){return U0}static set defaultNumberingSystem(e){U0=e}static get defaultOutputCalendar(){return V0}static set defaultOutputCalendar(e){V0=e}static get defaultWeekSettings(){return $0}static set defaultWeekSettings(e){$0=pr(e)}static get twoDigitCutoffYear(){return G0}static set twoDigitCutoffYear(e){G0=e%100}static get throwOnInvalid(){return K0}static set throwOnInvalid(e){K0=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 Z0=[0,31,59,90,120,151,181,212,243,273,304,334],Y0=[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 Hn(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 J0(t,e,r){return r+(ut(t)?Y0:Z0)[e-1]}function X0(t,e){let r=ut(t)?Y0:Z0,n=r.findIndex(a=>a<e),s=e-r[n];return{month:n+1,day:s}}function Wn(t,e){return(t-e+7)%7+1}function gr(t,e=4,r=1){let{year:n,month:s,day:a}=t,o=J0(n,s,a),i=Wn(Hn(n,s,a),r),c=Math.floor((o-i+14-e)/7),l;return c<1?(l=n-1,c=ct(l,e,r)):c>ct(n,e,r)?(l=n+1,c=1):l=n,{weekYear:l,weekNumber:c,weekday:i,...vr(t)}}function qs(t,e=4,r=1){let{weekYear:n,weekNumber:s,weekday:a}=t,o=Wn(Hn(n,1,e),r),i=Je(n),c=s*7+a-o-7+e,l;c<1?(l=n-1,c+=Je(l)):c>i?(l=n+1,c-=Je(n)):l=n;let{month:u,day:d}=X0(l,c);return{year:l,month:u,day:d,...vr(t)}}function jn(t){let{year:e,month:r,day:n}=t,s=J0(e,r,n);return{year:e,ordinal:s,...vr(t)}}function zs(t){let{year:e,ordinal:r}=t,{month:n,day:s}=X0(e,r);return{year:e,month:n,day:s,...vr(t)}}function Us(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 Q0(t,e=4,r=1){let n=yr(t.weekYear),s=de(t.weekNumber,1,ct(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 eo(t){let e=yr(t.year),r=de(t.ordinal,1,Je(t.year));return e?r?!1:pe("ordinal",t.ordinal):pe("year",t.year)}function Vs(t){let e=yr(t.year),r=de(t.month,1,12),n=de(t.day,1,Tt(t.year,t.month));return e?r?n?!1:pe("day",t.day):pe("month",t.month):pe("year",t.year)}function Gs(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 yr(t){return typeof t=="number"&&t%1===0}function j0(t){return typeof t=="string"}function ro(t){return Object.prototype.toString.call(t)==="[object Date]"}function Nn(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Rn(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function no(t){return Array.isArray(t)?t:[t]}function Ks(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 so(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function Xe(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function pr(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 yr(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 Qe(t){if(!(R(t)||t===null||t===""))return parseFloat(t)}function br(t){if(!(R(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function At(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function ut(t){return t%4===0&&(t%100!==0||t%400===0)}function Je(t){return ut(t)?366:365}function Tt(t,e){let r=Hl(e-1,12)+1,n=t+(e-r)/12;return r===2?ut(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function St(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 to(t,e,r){return-Wn(Hn(t,1,e),r)+e-1}function ct(t,e=4,r=1){let n=to(t,e,r),s=to(t+1,e,r);return(Je(t)-n+s)/7}function wr(t){return t>99?t:t>V.twoDigitCutoffYear?1900+t:2e3+t}function On(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 ot(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 $s(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Q(`Invalid unit value ${t}`);return e}function Bt(t,e){let r={};for(let n in t)if(Xe(t,n)){let s=t[n];if(s==null)continue;r[e(n)]=$s(s)}return r}function Ye(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 vr(t){return so(t,["hour","minute","second","millisecond"])}var Wl=["January","February","March","April","May","June","July","August","September","October","November","December"],Zs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],jl=["J","F","M","A","M","J","J","A","S","O","N","D"];function Ns(t){switch(t){case"narrow":return[...jl];case"short":return[...Zs];case"long":return[...Wl];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 Ys=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Js=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ll=["M","T","W","T","F","S","S"];function Rs(t){switch(t){case"narrow":return[...Ll];case"short":return[...Js];case"long":return[...Ys];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var Hs=["AM","PM"],ql=["Before Christ","Anno Domini"],zl=["BC","AD"],Ul=["B","A"];function Ws(t){switch(t){case"narrow":return[...Ul];case"short":return[...zl];case"long":return[...ql];default:return null}}function ao(t){return Hs[t.hour<12?0:1]}function io(t,e){return Rs(e)[t.weekday-1]}function oo(t,e){return Ns(e)[t.month-1]}function co(t,e){return Ws(e)[t.year<0?0:1]}function W0(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 uo(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var Vl={D:$e,DD:Yt,DDD:Jt,DDDD:Xt,t:Qt,tt:er,ttt:tr,tttt:rr,T:nr,TT:sr,TTT:ar,TTTT:ir,f:or,ff:ur,fff:fr,ffff:hr,F:cr,FF:lr,FFF:dr,FFFF:xr},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 Vl[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?ao(e):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(h,p)=>n?oo(e,h):a(p?{month:h}:{month:h,day:"numeric"},"month"),l=(h,p)=>n?io(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?co(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 uo(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 uo(a,s(i))}};var fo=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function It(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function kt(...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 Ot(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 ho(...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 xo=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Gl=`(?:${xo.source}?(?:\\[(${fo.source})\\])?)?`,Xs=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,mo=RegExp(`${Xs.source}${Gl}`),Qs=RegExp(`(?:T${mo.source})?`),Kl=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,$l=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Zl=/(\d{4})-?(\d{3})/,Yl=ho("weekYear","weekNumber","weekDay"),Jl=ho("year","ordinal"),Xl=/(\d{4})-(\d\d)-(\d\d)/,po=RegExp(`${Xs.source} ?(?:${xo.source}|(${fo.source}))?`),Ql=RegExp(`(?: ${po.source})?`);function Ft(t,e,r){let n=t[e];return R(n)?r:Pe(n)}function ef(t,e){return[{year:Ft(t,e),month:Ft(t,e+1,1),day:Ft(t,e+2,1)},null,e+3]}function _t(t,e){return[{hours:Ft(t,e,0),minutes:Ft(t,e+1,0),seconds:Ft(t,e+2,0),milliseconds:br(t[e+3])},null,e+4]}function Cr(t,e){let r=!t[e]&&!t[e+1],n=ot(t[e+1],t[e+2]),s=r?null:te.instance(n);return[{},s,e+3]}function Er(t,e){let r=t[e]?ae.create(t[e]):null;return[{},r,e+1]}var tf=RegExp(`^T?${Xs.source}$`),rf=/^-?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 nf(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(Qe(r)),months:f(Qe(n)),weeks:f(Qe(s)),days:f(Qe(a)),hours:f(Qe(o)),minutes:f(Qe(i)),seconds:f(Qe(c),c==="-0"),milliseconds:f(br(l),d)}]}var sf={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 ea(t,e,r,n,s,a,o){let i={year:e.length===2?wr(Pe(e)):Pe(e),month:Zs.indexOf(r)+1,day:Pe(n),hour:Pe(s),minute:Pe(a)};return o&&(i.second=Pe(o)),t&&(i.weekday=t.length>3?Ys.indexOf(t)+1:Js.indexOf(t)+1),i}var af=/^(?:(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 of(t){let[,e,r,n,s,a,o,i,c,l,u,d]=t,f=ea(e,s,n,r,a,o,i),h;return c?h=sf[c]:l?h=0:h=ot(u,d),[f,new te(h)]}function cf(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var uf=/^(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$/,lf=/^(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$/,ff=/^(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 lo(t){let[,e,r,n,s,a,o,i]=t;return[ea(e,s,n,r,a,o,i),te.utcInstance]}function df(t){let[,e,r,n,s,a,o,i]=t;return[ea(e,i,r,n,s,a,o),te.utcInstance]}var hf=It(Kl,Qs),xf=It($l,Qs),mf=It(Zl,Qs),pf=It(mo),go=kt(ef,_t,Cr,Er),gf=kt(Yl,_t,Cr,Er),yf=kt(Jl,_t,Cr,Er),vf=kt(_t,Cr,Er);function yo(t){return Ot(t,[hf,go],[xf,gf],[mf,yf],[pf,vf])}function vo(t){return Ot(cf(t),[af,of])}function bo(t){return Ot(t,[uf,lo],[lf,lo],[ff,df])}function wo(t){return Ot(t,[rf,nf])}var bf=kt(_t);function Co(t){return Ot(t,[tf,bf])}var wf=It(Xl,Ql),Cf=It(po),Ef=kt(_t,Cr,Er);function Eo(t){return Ot(t,[wf,go],[Cf,Ef])}var So="Invalid Duration",Do={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}},Sf={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},...Do},ge=146097/400,Mt=146097/4800,Af={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:Mt/7,days:Mt,hours:Mt*24,minutes:Mt*24*60,seconds:Mt*24*60*60,milliseconds:Mt*24*60*60*1e3},...Do},lt=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Df=lt.slice(0).reverse();function et(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 To(t,e){let r=e.milliseconds??0;for(let n of Df.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function Ao(t,e){let r=To(t,e)<0?-1:1;lt.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),lt.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?Af:Sf;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:Bt(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]=wo(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]=Co(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 In(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 Et(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):So}toHuman(e={}){if(!this.isValid)return So;let r=lt.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+=At(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?To(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 lt)(Xe(r.values,s)||Xe(this.values,s))&&(n[s]=r.get(s)+this.get(s));return et(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]=$s(e(this.values[n],n));return et(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...Bt(e,t.normalizeUnit)};return et(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 et(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return Ao(this.matrix,e),et(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Tf(this.normalize().shiftToAll().toObject());return et(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 lt)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 Ao(this.matrix,r),et(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 et(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 lt)if(!r(this.values[n],e.values[n]))return!1;return!0}};var Pt="Invalid Interval";function Bf(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 Fn(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=Nt(e),s=Nt(r),a=Bf(n,s);return a??new t({start:n,end:s})}static after(e,r){let n=$.fromDurationLike(r),s=Nt(e);return t.fromDateTimes(s,s.plus(n))}static before(e,r){let n=$.fromDurationLike(r),s=Nt(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(Nt).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()})`:Pt}[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=$e,r={}){return this.isValid?ne.create(this.s.loc.clone(r),e).formatInterval(this):Pt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Pt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Pt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Pt}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:Pt}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:Nn(),localeWeek:Rn()}}};function Bo(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 Ff(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=Bo(c,l);return(u-u%7)/7}],["days",Bo]],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 Fo(t,e,r,n){let[s,a,o,i]=Ff(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 ta={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"},Io={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]},If=ta.hanidec.replace(/[\[|\]]/g,"").split("");function ko(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(ta.hanidec)!==-1)e+=If.indexOf(t[r]);else for(let s in Io){let[a,o]=Io[s];n>=a&&n<=o&&(e+=n-a)}}return parseInt(e,10)}else return e}function ye({numberingSystem:t},e=""){return new RegExp(`${ta[t||"latn"]}${e}`)}var kf="missing Intl.DateTimeFormat.formatToParts support";function G(t,e=r=>r){return{regex:t,deser:([r])=>e(ko(r))}}var Of="\xA0",Mo=`[ ${Of}]`,Po=new RegExp(Mo,"g");function _f(t){return t.replace(/\./g,"\\.?").replace(Po,Mo)}function Oo(t){return t.replace(/\./g,"").replace(Po," ").toLowerCase()}function De(t,e){return t===null?null:{regex:RegExp(t.map(_f).join("|")),deser:([r])=>t.findIndex(n=>Oo(r)===Oo(n))+e}}function _o(t,e){return{regex:t,deser:([,r,n])=>ot(r,n),groups:e}}function Ln(t){return{regex:t,deser:([e])=>e}}function Mf(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Pf(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(Mf(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,wr);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 Ln(u);case"uu":return Ln(i);case"uuu":return G(r);case"a":return De(e.meridiems(),0);case"kkkk":return G(a);case"kk":return G(d,wr);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 _o(new RegExp(`([+-]${i.source})(?::(${n.source}))?`),2);case"ZZZ":return _o(new RegExp(`([+-]${i.source})(${n.source})?`),2);case"z":return Ln(/[a-z_+-/]{1,256}?/i);case" ":return Ln(/[^\S\n\r]/);default:return h(y)}})(t)||{invalidReason:kf};return g.token=t,g}var Nf={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 Rf(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=Nf[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 Wf(t,e,r){let n=t.match(e);if(n){let s={},a=1;for(let o in r)if(Xe(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 jf(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=br(t.u)),[Object.keys(t).reduce((a,o)=>{let i=e(o);return i&&(a[i]=t[o]),a},{}),r,n]}var ra=null;function Lf(){return ra||(ra=U.fromMillis(1555555555555)),ra}function qf(t,e){if(t.literal)return t;let r=ne.macroTokenToFormatOpts(t.val),n=aa(r,e);return n==null||n.includes(void 0)?t:n}function na(t,e){return Array.prototype.concat(...t.map(r=>qf(r,e)))}function sa(t,e,r){let n=na(ne.parseFormat(r),t),s=n.map(o=>Pf(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]=Wf(e,c,i),[d,f,h]=u?jf(u):[null,null,void 0];if(Xe(u,"a")&&Xe(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 No(t,e,r){let{result:n,zone:s,specificOffset:a,invalidReason:o}=sa(t,e,r);return[n,s,a,o]}function aa(t,e){if(!t)return null;let n=ne.create(e,t).dtFormatter(Lf()),s=n.formatToParts(),a=n.resolvedOptions();return s.map(o=>Rf(o,t,a))}var ia="Invalid DateTime",Ro=864e13;function qn(t){return new re("unsupported zone",`the zone "${t.name}" is not supported`)}function oa(t){return t.weekData===null&&(t.weekData=gr(t.c)),t.weekData}function ca(t){return t.localWeekData===null&&(t.localWeekData=gr(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function ft(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 Uo(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 zn(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 Vn(t,e,r){return Uo(St(t),e,r)}function Ho(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,Tt(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=St(a),[c,l]=Uo(i,r,t.zone);return o!==0&&(c+=o,l=t.zone.offset(c)),{ts:c,o:l}}function Sr(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 Un(t,e,r=!0){return t.isValid?ne.create(K.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function ua(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 Wo(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 Vo={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},zf={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Uf={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Go=["year","month","day","hour","minute","second","millisecond"],Vf=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Gf=["year","ordinal","hour","minute","second","millisecond"];function Kf(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 Et(t);return e}function jo(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Kf(t)}}function Lo(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 Go)R(t[l])&&(t[l]=Vo[l]);let i=Vs(t)||Gs(t);if(i)return U.invalid(i);let c=r.offset(s);[a,o]=Vn(t,c,r)}return new U({ts:a,zone:r,loc:n,o})}function qo(t,e,r){let n=R(r.round)?!0:r.round,s=(o,i)=>(o=At(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 zo(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:qn(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=zn(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]=zo(arguments),[n,s,a,o,i,c,l]=r;return Lo({year:n,month:s,day:a,hour:o,minute:i,second:c,millisecond:l},e)}static utc(){let[e,r]=zo(arguments),[n,s,a,o,i,c,l]=r;return e.zone=te.utcInstance,Lo({year:n,month:s,day:a,hour:o,minute:i,second:c,millisecond:l},e)}static fromJSDate(e,r={}){let n=ro(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(qn(s))}static fromMillis(e,r={}){if(Fe(e))return e<-Ro||e>Ro?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(qn(n));let s=K.fromObject(r),a=Bt(e,jo),{minDaysInFirstWeek:o,startOfWeek:i}=Us(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=zn(c,l);g?(y=Vf,x=zf,m=gr(m,o,i)):u?(y=Gf,x=Uf,m=jn(m)):(y=Go,x=Vo);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?Q0(a,o,i):u?eo(a):Vs(a),w=v||Gs(a);if(w)return t.invalid(w);let C=g?qs(a,o,i):u?zs(a):a,[O,B]=Vn(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]=yo(e);return Sr(n,s,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,s]=vo(e);return Sr(n,s,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,s]=bo(e);return Sr(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]=No(o,e,r);return u?t.invalid(u):Sr(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]=Eo(e);return Sr(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 Bn(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=aa(e,K.fromObject(r));return n?n.map(s=>s?s.val:null).join(""):null}static expandFormat(e,r={}){return na(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?oa(this).weekYear:NaN}get weekNumber(){return this.isValid?oa(this).weekNumber:NaN}get weekday(){return this.isValid?oa(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?ca(this).weekday:NaN}get localWeekNumber(){return this.isValid?ca(this).weekNumber:NaN}get localWeekYear(){return this.isValid?ca(this).weekYear:NaN}get ordinal(){return this.isValid?jn(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=St(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=zn(c,o),d=zn(l,i);return u.hour===d.hour&&u.minute===d.minute&&u.second===d.second&&u.millisecond===d.millisecond?[ft(this,{ts:c}),ft(this,{ts:l})]:[this]}get isInLeapYear(){return ut(this.year)}get daysInMonth(){return Tt(this.year,this.month)}get daysInYear(){return this.isValid?Je(this.year):NaN}get weeksInWeekYear(){return this.isValid?ct(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?ct(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]=Vn(o,a,e)}return ft(this,{ts:s,zone:e})}else return t.invalid(qn(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let s=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return ft(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=Bt(e,jo),{minDaysInFirstWeek:n,startOfWeek:s}=Us(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=qs({...gr(this.c,n,s),...r},n,s):R(r.ordinal)?(d={...this.toObject(),...r},R(r.day)&&(d.day=Math.min(Tt(d.year,d.month),d.day))):d=zs({...jn(this.c),...r});let[f,h]=Vn(d,this.o,this.zone);return ft(this,{ts:f,o:h})}plus(e){if(!this.isValid)return this;let r=$.fromDurationLike(e);return ft(this,Ho(this,r))}minus(e){if(!this.isValid)return this;let r=$.fromDurationLike(e).negate();return ft(this,Ho(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):ia}toLocaleString(e=$e,r={}){return this.isValid?ne.create(this.loc.clone(r),e).formatDateTime(this):ia}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=ua(this,o);return i+="T",i+=Wo(this,o,r,n,s,a),i}toISODate({format:e="extended"}={}){return this.isValid?ua(this,e==="extended"):null}toISOWeekDate(){return Un(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":"")+Wo(this,o==="extended",r,e,n,a):null}toRFC2822(){return Un(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Un(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?ua(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")),Un(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():ia}[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=no(r).map($.normalizeUnit),o=e.valueOf()>this.valueOf(),i=o?this:e,c=o?e:this,l=Fo(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),qo(r,this.plus(n),{...e,numeric:"always",units:s,unit:a})}toRelativeCalendar(e={}){return this.isValid?qo(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 Ks(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Q("max requires all arguments be DateTimes");return Ks(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 sa(o,e,r)}static fromStringExplain(e,r,n={}){return t.fromFormatExplain(e,r,n)}static get DATE_SHORT(){return $e}static get DATE_MED(){return Yt}static get DATE_MED_WITH_WEEKDAY(){return Ds}static get DATE_FULL(){return Jt}static get DATE_HUGE(){return Xt}static get TIME_SIMPLE(){return Qt}static get TIME_WITH_SECONDS(){return er}static get TIME_WITH_SHORT_OFFSET(){return tr}static get TIME_WITH_LONG_OFFSET(){return rr}static get TIME_24_SIMPLE(){return nr}static get TIME_24_WITH_SECONDS(){return sr}static get TIME_24_WITH_SHORT_OFFSET(){return ar}static get TIME_24_WITH_LONG_OFFSET(){return ir}static get DATETIME_SHORT(){return or}static get DATETIME_SHORT_WITH_SECONDS(){return cr}static get DATETIME_MED(){return ur}static get DATETIME_MED_WITH_SECONDS(){return lr}static get DATETIME_MED_WITH_WEEKDAY(){return Ts}static get DATETIME_FULL(){return fr}static get DATETIME_FULL_WITH_SECONDS(){return dr}static get DATETIME_HUGE(){return hr}static get DATETIME_HUGE_WITH_SECONDS(){return xr}};function Nt(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}`)}var Ar=require("@mysten/sui.js/transactions"),ha=require("@mysten/sui.js/transactions"),Tr=require("@mysten/sui.js/utils"),xa=require("buffer"),Nc=require("@mysten/sui.js/utils"),Ca=require("@mysten/sui.js/bcs"),Br=require("@mysten/sui.js/utils");var Ko=(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),"");var ga=require("@mysten/sui.js/transactions"),st=require("@mysten/sui.js/utils");var Dr=require("@mysten/sui.js/transactions"),Fr=require("@mysten/sui.js/utils");var Xc=qe(vt(),1);var wa=require("@mysten/sui.js/bcs"),nt=require("@mysten/sui.js/utils");var eu=qe(vt(),1);var nu=require("@mysten/sui.js/transactions");var au=require("@mysten/sui.js/transactions"),Jn=require("@mysten/sui.js/utils"),up=qe(vt(),1),$f=Object.defineProperty,mc=(t,e)=>{for(var r in e)$f(t,r,{get:e[r],enumerable:!0})},pc={};mc(pc,{contractId:()=>vc,default:()=>Zf,feeObjId:()=>Cc,roleObjId:()=>bc,status:()=>yc,transaction:()=>gc,upgradeCapObjId:()=>Ec,vaultObjId:()=>wc});var gc="DiBZq4UmVVYiRL6ZJmFKYoHcxtxqrhsCXSkFyT7wUr3j",yc="success",vc="0x81c960dc653975fbd0072deca8afb92d322898c911622898ba1b2e3ad0c4bd8d",bc="0xc6ec0bdee0bb59a72077e9acd2f42457043cf47080b3d3fad4d39abf28bba63a",wc="0xbc4021387fbac149119fd24e92be9e58f745774292f3a2a12e2ac6daf5363e1d",Cc="0x4178f63970fe2daeb256dc5730ad172e82b3e8eb45f31b33e0daae72cd35e1e1",Ec="0xe1e9aa7d222d151bfe6dd83358b0d7fdcb11260f710800cfaf7ccc1b1e245115",Zf={transaction:gc,status:yc,contractId:vc,roleObjId:bc,vaultObjId:wc,feeObjId:Cc,upgradeCapObjId:Ec},Sc={};mc(Sc,{contractId:()=>Tc,default:()=>Yf,feeObjId:()=>Ic,roleObjId:()=>Bc,status:()=>Dc,transaction:()=>Ac,upgradeCapObjId:()=>kc,vaultObjId:()=>Fc});var Ac="855FNDV8o8Z3fWULPnQo9qdhLJpsg7wZrkCpNyfw9KfB",Dc="success",Tc="0xc357c3985e8fb875d6b37141497af660779aa1bab0ec489b2213efd74067d1fa",Bc="0x5ab49bdf9fd1413e328ef242b3f8d83dde791b38a0b627bfc87fb25c010d34f1",Fc="0xb483558770d8eb26007f193b75db40f0a45f2e36863a687625885d4de6993378",Ic="0x48453fc4d7cde3fe35aad89e5dfb496608a6a55ea529a1c0274681a808627f94",kc="0x34279779a0d0d36bd5044b04830d607fa1b0ecf316548c8ac3a44151e4f1a42a",Yf={transaction:Ac,status:Dc,contractId:Tc,roleObjId:Bc,vaultObjId:Fc,feeObjId:Ic,upgradeCapObjId:kc},Jf="https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD",Xf="https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD",Qf="https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7",ed="https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7",td="https://bc3p6l5unl.execute-api.us-west-1.amazonaws.com/prod",rd="https://rolsbkota7.execute-api.us-west-1.amazonaws.com/prod",nd="https://6p6mkx33ne.execute-api.us-west-1.amazonaws.com/prod",sd="https://xrae3mrjv5.execute-api.us-west-1.amazonaws.com/prod",$o=pc,Zo=Sc,ad=new Map([["dev",{env:"dev",rpc:{url:Jf},backend:{url:td},contract:$o}],["stg",{env:"stg",rpc:{url:Xf},backend:{url:rd},contract:$o}],["prev",{env:"prev",rpc:{url:Qf},backend:{url:nd},contract:Zo}],["prod",{env:"prod",rpc:{url:ed},backend:{url:sd},contract:Zo}]]);function id(t,e){let r=ad.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}},od=class extends xe{constructor(){super(11,"Backend is not specified")}},cd=class extends xe{constructor(){super(1,"Wallet not connected")}},la=class extends xe{constructor(t,e){super(10,t,{context:e})}},ud=class ht{constructor(e){this.apiURL=e}static parseResponseData(e){if(e instanceof He.AxiosError)throw new la(e.response?.statusText);if(e.status===200){if(e.data.success)return e.data.data;throw new la(e.data.code)}throw new la(e.status.toString())}async getIncomingStreams(e,r){let n=await He.default.post(`${this.apiURL}/stream`,{recipient:e,...r});return ht.parseResponseData(n)}async getOutgoingStreams(e,r){let n=await He.default.post(`${this.apiURL}/stream`,{sender:e,...r});return ht.parseResponseData(n)}async getStreamHistory(e){let r=await He.default.post(`${this.apiURL}/stream-events`,e),n=ht.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 He.default.post(`${this.apiURL}/stream-info`,{address:e});return ht.parseResponseData(r)}async getAllRecipients(e,r){let n=await He.default.post(`${this.apiURL}/stream-info`,{sender:e,status:r});return ht.parseResponseData(n)}async getAllSenders(e,r){let n=await He.default.post(`${this.apiURL}/stream-info`,{recipient:e,status:r});return ht.parseResponseData(n)}},_c=class Mc{signer;suiClient;envConfig;_backend;constructor(e){this.envConfig=e,this.suiClient=new Oc.SuiClient({url:e.rpc.url}),e.backend&&(this._backend=new ud(e.backend.url))}static new(e,r){let n=id(e,r);return new Mc(n)}get walletType(){return this.wallet?this.wallet.type:"disconnected"}get backend(){if(!this._backend)throw new od;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 cd;return this.signer}async walletAddress(){return this.wallet.address()}},Yo=50n,fa=10000n,ld=25n,Jo=100000000n,dt=class{constructor(t){this.object=t}moveArg(t){return t.object(this.object)}},Xo=class{constructor(t){this.objects=t}moveArgs(t){return t.makeMoveVec({objects:this.objects.map(e=>t.object(e))})}},$n=class Pc{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 Pc(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}},Qo=class extends xe{constructor(t,e){super(3,t,{context:e})}},fd=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 Qo("Invalid contract return type.",{ctx:{expectType:"address",gotType:n}});return(0,Nc.normalizeSuiAddress)(xa.Buffer.from(r).toString("hex"))}getU64(t=0,e=0){let[r,n]=this.getValue(t,e);if(n!=="u64")throw new Qo("Invalid contract return type.",{ctx:{expectType:"u64",gotType:n}});return xa.Buffer.from(r).readBigInt64LE()}},he=class extends xe{constructor(t,e,r){super(2,`Invalid input: ${t}`,{context:{fieldKey:e,fieldValue:r}})}},Rc={groupId:"string",name:"string"},dd=64;function hd(t){return Hc(t),Ca.bcs.ser(Rc,t).toString("base64")}function ma(t){let e=Ca.bcs.de(Rc,t,"base64");return Hc(e),e}function Hc(t){if(!ec(t.name))throw new he("Invalid metadata: Name contains unknown character");if(!ec(t.groupId))throw new he("Invalid metadata: Group ID contains unknown character");if(t.name.length>dd)throw new he("Invalid metadata: Name exceed max length 64")}function ec(t){return/^[\x00-\x7F]+$/.test(t)}function Wc(t,e){return(0,Br.normalizeStructTag)(t)===(0,Br.normalizeStructTag)(e)}function Rt(t,e){return(0,Br.normalizeStructTag)(t)===(0,Br.normalizeStructTag)(e)}var jc="txn.gas";function xd(){return Ko()}var pa=class Lc{constructor(e,r,n){this.globals=e,this.feeContract=r,this.streamContract=n}static convertCreateStreamInfoToInternal(e){return{metadata:hd({name:e.name,groupId:xd()}),coinType:(0,Tr.normalizeStructTag)(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 ha.TransactionBlock,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 $n(f),flatFeeCoin:new $n(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=Lc.convertCreateStreamInfoToInternal(e);return this.calculateFeesInternal(r)}feeParams(){return{createFeePercent:{numerator:Yo,denominator:fa},claimFeePercent:{numerator:ld,denominator:fa},flatFeePerStream:Jo}}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===jc?n=e.gas:n=e.object(r.primaryCoin),n}getCreateStreamCoinRequests(e,r){let n=e.coinType;return Wc(n,Tr.SUI_TYPE_ARG)?[{coinType:n,amount:r.totalAmount+r.streamFeeAmount+r.flatFeeAmount}]:[{coinType:n,amount:r.totalAmount+r.streamFeeAmount},{coinType:Tr.SUI_TYPE_ARG,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 Jo}getStreamFeeLocal(e){return e*Yo/fa}async getStreamFeeRemote(e){let r=this.feeContract.streamingFee(new ha.TransactionBlock,e),n=await this.globals.suiClient.devInspectTransactionBlock({sender:await this.globals.walletAddress(),transactionBlock:r});return new fd(n).getU64()}get wallet(){return this.globals.wallet}},md="0x0000000000000000000000000000000000000000000000000000000000000006",qc=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(ga.Transactions.MoveCall({target:r,arguments:e.arguments.map(n=>n instanceof Xo?n.moveArgs(t):n instanceof dt?n.moveArg(t):n instanceof $n?n.moveArg():t.pure(n)),typeArguments:e.typeArgs})),t}addTransactionBlock(t,e,r=[],n=[]){t.add(ga.Transactions.MoveCall({target:e,arguments:r.map(s=>s instanceof Xo?s.moveArgs(t):s instanceof dt?s.moveArg(t):s instanceof $n?s.moveArg():t.pure(s)),typeArguments:n}))}makeObject(t){return typeof t=="string"?new dt(t):t}vaultObject(){return new dt(this.config.vaultObjId)}roleObject(){return new dt(this.config.roleObjId)}feeObject(){return new dt(this.config.feeObjId)}clockObject(){return new dt(md)}},zc=class tt extends qc{constructor(e,r){super(tt.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:tt.MethodName.set_streaming_fee,arguments:[n,s,r],typeArgs:[]})}setStreamingFlatFee(e,r){let n=this.roleObject(),s=this.feeObject();return this.addContractCall(e,{method:tt.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:tt.MethodName.set_claim_fee,arguments:[n,s,r],typeArgs:[]})}streamingFee(e,r){let n=this.feeObject();return this.addContractCall(e,{method:tt.MethodName.streaming_fee,arguments:[n,r],typeArgs:[]})}claimFee(e,r){return this.addContractCall(e,{method:tt.MethodName.claim_fee,arguments:[this.feeObject(),r],typeArgs:[]})}feeDenominator(e){return this.addContractCall(e,{method:tt.MethodName.fee_denominator,arguments:[this.feeObject()],typeArgs:[]})}},Yn=class se extends qc{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}`}},Uc=class{constructor(t){this.globals=t;let e=t.envConfig.contract;this.feeContract=new zc(e,t),this.streamContract=new Yn(e,t)}feeContract;streamContract;async createStreams(t){let e=pa.convertCreateStreamInfoToInternal(t);return this.createStreamHelper().buildCreateStreamTransactionBlock(e)}createStreamHelper(){return new pa(this.globals,this.feeContract,this.streamContract)}setAutoClaim(t,e,r){let n=new Ar.TransactionBlock;return this.streamContract.setAutoClaim(n,{streamId:t,enabled:e,coinType:r})}claimStream(t,e){let r=new Ar.TransactionBlock;return this.streamContract.claimStream(r,{streamId:t,coinType:e})}claimStreamByProxy(t,e){let r=new Ar.TransactionBlock;return this.streamContract.claimStreamByProxy(r,{streamId:t,coinType:e})}cancelStream(t,e){let r=new Ar.TransactionBlock;return this.streamContract.cancelStream(r,{streamId:t,coinType:e}),r}},pd=class extends xe{constructor(t,e){super(12,`Transaction failed: ${e}`,{context:{status:t,msg:e}})}},gd=1e3,yd=class{constructor(t){this.globals=t,this.coinMetaHelper=new vd(t.suiClient),this.createStreamHelper=new Uc(t).createStreamHelper()}coinMetaHelper;createStreamHelper;getStreamIdsFromCreateStreamResponse(t){if(t.effects?.status.status!=="success")throw new pd(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:(0,Ht.normalizeStructTag)(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:(0,Ht.normalizeStructTag)(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()<gd)throw new he("Interval shall be at least 1 second","interval",t.interval)}},vd=class{constructor(t){this.suiClient=t,this.coinMetaReg=new Map}coinMetaReg;async getCoinMeta(t){let e=(0,Ht.normalizeStructTag)(t||Ht.SUI_TYPE_ARG);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}},bd=class extends xe{constructor(){super(7,"Connected wallet is not creator")}},tc=class extends xe{constructor(){super(8,"Connected wallet is not recipient")}},rc=class extends xe{constructor(t,e){super(6,t,{context:e})}},Te=class extends xe{constructor(t,e={}){super(0,t,e)}},wd=class extends xe{constructor(t){super(5,"Stream not found",{context:{streamId:t}})}},Cd=(1n<<64n)-1n,Zn=1e3;function nc(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/Zn);return U.fromMillis(r*Zn)}function sc(t){let e;typeof t=="number"?e=t:typeof t=="bigint"?e=Number(t):e=t.toMillis();let r=Math.round(e/Zn);return $.fromMillis(r*Zn)}var Ea=class rt{constructor(e,r,n){this.globals=e,this.streamId=r,this.rawData=n,this.streamContract=new Yn(e.envConfig.contract,e)}streamContract;type="Stream";static async new(e,r){let n=await rt.fetchStreamData(e,r);return new rt(e,r,n)}static fromObjectData(e,r,n){let s=rt.parseRawStreamData(r,n);return new rt(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 rt.fetchStreamData(this.globals,this.streamId)}refreshWithData(e){if(e.data?.objectId!==this.streamId)throw new Te("Object Id does not align");this.rawData=rt.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 bd;let e=new Dr.TransactionBlock;return this.streamContract.cancelStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async claim(){if(await this.globals.walletAddress()!==this.recipient)throw new tc;let e=new Dr.TransactionBlock;return this.streamContract.claimStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async setAutoClaim(e){if(await this.globals.walletAddress()!==this.recipient)throw new tc;let r=new Dr.TransactionBlock;return this.streamContract.setAutoClaim(r,{streamId:this.streamId,coinType:this.coinType,enabled:e}),r}async claimByProxy(){let e=new Dr.TransactionBlock;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(0,Fr.normalizeStructTag)(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 sc(this.rawData.config.epochInterval)}get groupId(){let{metadata:e}=this.rawData.config;return ma(e).groupId}get name(){let{metadata:e}=this.rawData.config;return ma(e).name}get recipient(){return this.rawData.config.recipient}get timeStart(){return nc(this.rawData.config.timeStart)}get duration(){let e=this.rawData.config,r=e.epochInterval*e.totalEpoch;return sc(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:nc((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===Cd?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 rt.parseRawStreamData(r,n)}static parseRawStreamData(e,r){if(r.error)throw r.error.code==="notExists"?new wd(e):new rc(`get stream data: ${r.error.code}`,{streamId:e,...r.error});let n=r.data.content;if(n.dataType!=="moveObject")throw new rc("Unexpected object type",{gotType:n.dataType});let{typeParams:s}=(0,Fr.parseStructTag)(n.type),a=(0,Fr.normalizeStructTag)(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)}}}},da=class extends xe{constructor(t,e){super(9,`Invalid stream group: ${t}`,{context:e})}};async function Ed(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 Sd=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)}},Vc=class{constructor(t){this.requester=t,this.pager=new Sd(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]}},Ad=25;async function ac(t,e,r){let n=new Gc(e),s=new Kc(t,n,r);return await Ed(s)}var Gc=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]}},Kc=class extends Vc{constructor(t,e,r){super(new Dd(t,e,r)),this.suiClient=t,this.idIter=e,this.options=r}},Dd=class{constructor(t,e,r){this.suiClient=t,this.stringIter=e,this.options=r,this.filter=r?.filter,this.pageSize=r?.pageSize||Ad,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()}}},Td=class Gn{constructor(e,r){if(this.globals=e,this.streams=r,r.length===0)throw new da("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 ac(e.suiClient,r);return n.forEach(s=>{if(!s)throw new Te("stream group object data undefined")}),Gn.newFromObjectResponse(e,r,n)}static async newFromObjectResponse(e,r,n){let s=await Gn.parseGroupStreams(e,r,n);return new Gn(e,s)}static checkStreamGroup(e){let r=e.map(a=>a.groupCommonInfo),n=r[0],s=!0;return r.forEach(a=>{Bd(n,a)||(s=!1)}),s}async refresh(){let e=await ac(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)=>Ea.fromObjectData(e,r[o],a)).filter(a=>!!a);if(new Set(s.map(a=>a.groupId)).size!==1)throw new da("Not same group ID");if(!this.checkStreamGroup(s))throw new da("Not same stream settings");return s}};function Bd(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 ic=class ya{constructor(e,r){this.it=e,this.pageSize=r}static async newIncoming(e){let r=await oc.newIncoming(e);return new ya(r,e.pageSize)}static async newOutgoing(e){let r=await oc.newOutgoing(e);return new ya(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}},oc=class va{constructor(e){this.requester=e}cachedNext;static async newIncoming(e){let r=await cc.newIncomingQuery(e);return new va(r)}static async newOutgoing(e){let r=await cc.newOutgoingQuery(e);return new va(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}},cc=class ba{constructor(e,r,n,s){this.globals=e,this.recipient=r,this.groupRefs=n,this.query=s,this.current=0;let a=new Gc(n.flat().map(o=>o.streamId));this.objectIter=new Kc(e.suiClient,a)}current=0;objectIter;static async newIncomingQuery(e){let r=_d(e.query),n=await e.globals.walletAddress(),s=(await e.globals.backend.getIncomingStreams(n,r)).filter(o=>(0,st.normalizeSuiAddress)(o.recipient)===(0,st.normalizeSuiAddress)(n)),a=uc(s);return new ba(e.globals,n,a,e.query)}static async newOutgoingQuery(e){let r=Md(e.query),n=await e.globals.walletAddress(),s=await e.globals.backend.getOutgoingStreams(n,r),a=uc(s);return new ba(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 kd(this.globals,e[0].streamId,this.objectIter);return this.current++,$c(r,this.query)?r:this.doNextRequest()}if(e.length>1){let r=await Od(this.globals,e.map(n=>n.streamId),this.objectIter);return this.current++,Id(r,this.query)?r:this.doNextRequest()}throw new Te("Stream group with no stream")}};function uc(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 $c(t,e){if(e===void 0)return!0;let r=Fd(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 Fd(t,e){return e===void 0?!0:Array.isArray(e)?e.includes(t.progress.status):t.progress.status===e}function Id(t,e){if(!e)return!0;let r=!1;return t.streams.forEach(n=>{$c(n,e)&&(r=!0)}),r}async function kd(t,e,r){let n=await Zc(r,e);return Ea.fromObjectData(t,e,n)}async function Od(t,e,r){let n=[];for(;n.length<e.length;){let s=await Zc(r,e[n.length]);n.push(s)}return Td.newFromObjectResponse(t,e,n)}async function Zc(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 _d(t){return{status:Sa(t?.status),coinType:Yc(t?.coinType),sender:Jc(t?.sender)}}function Md(t){return{status:Sa(t?.status),coinType:Yc(t?.coinType),recipient:Jc(t?.recipient)}}function Sa(t){return t===void 0||t.length===0?"all":Array.isArray(t)?t.reduce((e,r)=>{let n=Sa(r);return!e||e===n?n:"all"},void 0):Pd(t)}function Pd(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 Yc(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>(0,st.normalizeStructTag)(e)):void 0:(0,st.normalizeStructTag)(t)}function Jc(t){if(t)return Array.isArray(t)?t.length!==0?t.map(e=>(0,st.normalizeSuiAddress)(e)):void 0:(0,st.normalizeSuiAddress)(t)}var Nd=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}},Rd=25;async function Hd(t,e,r,n="0x2::sui::SUI",s=Rd){let a=new Wd(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 Nd(n,r,o);return i}var Wd=class extends Vc{constructor(t,e,r,n){super(new jd(t,e,r,n)),this.suiClient=t,this.owner=e,this.coinType=r,this.reqPageSize=n}},jd=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}}},Ld=class{constructor(t){this.msafe=t}get type(){return"msafe"}async address(){return this.msafe.address()}async requestCoins(t){return this.msafe.requestCoins(t)}},qd=class{constructor(t){this.account=t}async address(){return this.account.address}},zd=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(Wc(t.coinType,xt.SUI_TYPE_ARG))return{primaryCoin:jc};if(t.amount<=0)throw new he("Invalid coin request","coinAmount",t.amount);let e=await Hd(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)}}},Ud=class{globals;helper;constructor(t,e){this.globals=_c.new(t,e),this.helper=new yd(this.globals)}connectSingleWallet(t){let e=new zd(t,this.globals.suiClient);this.globals.connectWallet(e)}connectMSafeAccount(t){let e=new Ld(t);this.globals.connectWallet(e)}async createStream(t){return this.builder().createStreams(t)}async getStream(t){return Ea.new(this.globals,t)}async getIncomingStreams(t,e=10){return ic.newIncoming({globals:this.globals,query:t,pageSize:e})}async getOutgoingStreams(t,e=10){return ic.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=>(0,xt.normalizeStructTag)(e))}async getRecipientsForStreamFilter(t){let e=await this.wallet.address();return(await this.globals.backend.getAllRecipients(e,t)).map(r=>(0,xt.normalizeSuiAddress)(r))}async getCreatorsForStreamFilter(t){let e=await this.wallet.address();return(await this.globals.backend.getAllSenders(e,t)).map(r=>(0,xt.normalizeSuiAddress)(r))}get wallet(){return this.globals.wallet}builder(){return new Uc(this.globals)}},Vd=class{constructor(t){this.data=t}serialize(){return JSON.stringify((0,Xc.default)(this.data))}},Ir=class extends Vd{application="mpay";getClient(t,e){let r=new Ud(t==="sui:mainnet"?"prod":"dev");return r.connectSingleWallet(new qd(e)),r}},lc=class extends Ir{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()}},fc=class extends Ir{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()}},dc=class extends Ir{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()}},hc=class extends Ir{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)}},Qc=class Kn{constructor(e,r){this.moveCall=e,this.txb=r}decodeSharedObjectId(e){let r=this.getInputParam(e);return Kn.getSharedObjectId(r)}decodeOwnedObjectId(e){let r=this.getInputParam(e);return Kn.getOwnedObjectId(r)}decodeInputU64(e){let r=this.decodePureArg(e,"u64");return BigInt(r)}decodeInputAddress(e){let r=this.decodePureArg(e,"address");return(0,nt.normalizeSuiAddress)(r)}decodeInputString(e){return this.decodePureArg(e,"string")}decodeInputBool(e){return this.decodePureArg(e,"bool")}decodePureArg(e,r){let n=this.getInputParam(e);return Kn.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 wa.bcs.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(0,nt.normalizeSuiAddress)(e.value.Object.ImmOrOwned.objectId)}return(0,nt.normalizeSuiAddress)(e.value)}static getSharedObjectId(e){if(e.type!=="object")throw new Error(`not object argument: ${JSON.stringify(e)}`);if(typeof e.value!="object")return(0,nt.normalizeSuiAddress)(e.value);if(!("Object"in e.value)||!("Shared"in e.value.Object))throw new Error("not Shared");return(0,nt.normalizeSuiAddress)(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 wa.bcs.de(r,new Uint8Array(n))}typeArg(e){return(0,nt.normalizeStructTag)(this.moveCall.typeArguments[e])}txArg(e){return this.moveCall.arguments[e]}},Gd=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"&&Rt(e.target,this.contract.createStreamTarget));if(t.length===0)throw new Te("No create stream transactions");return t.map(e=>new Qc(e,this.txb))}getCreationInfoFromMoveCall(t){let e=t.decodeInputString(4),{name:r,groupId:n}=ma(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 Yn(this.globals.envConfig.contract,this.globals)}get feeContract(){return new zc(this.globals.envConfig.contract,this.globals)}createStreamHelper(){return new pa(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 Yn(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"&&Rt(t.target,this.contract.createStreamTarget))!==-1}isSetAutoClaimTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Rt(this.transactions[0].target,this.contract.setAutoClaimTarget)}isCancelStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Rt(this.transactions[0].target,this.contract.cancelStreamTarget)}isClaimStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Rt(this.transactions[0].target,this.contract.claimStreamTarget)}isClaimByProxyTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Rt(this.transactions[0].target,this.contract.claimStreamByProxyTarget)}decodeCreateStreamTransaction(){return new Gd(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 Qc(t,this.txb)}},xc=class extends Ir{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)}},$d=class{application="mpay";async deserialize(t){let{chain:e,transactionBlock:r}=t,n=_c.new(e==="sui:mainnet"?"prod":"dev"),s=new Kd(n,r).decode(),a;switch(s.type){case"CreateStream":a=new hc(s.info);break;case"SetAutoClaim":a=new xc({streamId:s.streamId,enabled:s.enabled});break;case"Claim":a=new dc({streamId:s.streamId});break;case"ClaimByProxy":a=new fc({streamId:s.streamId});break;case"Cancel":a=new lc({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 hc(e);break;case"Claim":r=new dc(e);break;case"ClaimByProxy":r=new fc(e);break;case"SetAutoClaim":r=new xc(e);break;case"Cancel":r=new lc(e);break;default:throw new Error("not implemented")}return r.build({...t})}},Aa=class{constructor(t){this.data=t}get application(){return"msafe-core"}serialize(){return JSON.stringify((0,eu.default)(this.data))}},Zd=class tu extends Aa{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 tu(e)}},Yd=class ru extends Aa{constructor(e){super(e),this.data=e}txType;txSubType;async build(e){let{suiClient:r,account:n}=e;return _0(r,this.data,n.address)}static fromData(e){return new ru(e)}},Jd=class su extends Aa{constructor(e){super(e),this.data=e}txType;txSubType;async build(e){let{account:r}=e,n=nu.TransactionBlock.from(this.data.content);if(!Be(n.blockData.sender,r.address))throw new Error("Invalid sender address");return n}static fromData(e){return new su(e)}},Xd=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=Zd.fromData(t.intentionData);break;case le.assets.object.send:n=Yd.fromData(t.intentionData);break;case le.others.plain:n=Jd.fromData(t.intentionData);break;default:throw new Error("not implemented")}return n.build({suiClient:e,account:r})}},Qd=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}},eh="msafe-plain-tx",th=le.others.plain,rh=class{application;constructor(){this.application=eh}async deserialize(t){let{transactionBlock:e,suiClient:r}=t,n=await e.build({client:r});return{txType:X.Other,txSubType:th,intentionData:{content:(0,Jn.toHEX)(n)}}}async build(t){let{suiClient:e,account:r}=t,n=au.TransactionBlock.from((0,Jn.fromHEX)(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}},Xn=new Qd([new Xd,new $d,new rh]);var Ma=require("@mysten/sui.js/transactions"),du=require("@mysten/sui.js/utils");var iu=require("@mysten/sui.js/transactions"),nh=1000n,sh=120n,ah=100n,ih={multiplier:{numerator:sh,denominator:ah}};var Qn=class{constructor(e){this.globals=e}async simulate(e,r=ih){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=nh*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 iu.TransactionBlock.from(e.serialize())}};var Da=require("buffer");function es(t){return Da.Buffer.from(t,"utf-8")}function oh(t){return`0x${Array.prototype.map.call(t,e=>`0${e.toString(16)}`.slice(-2)).join("")}`}function ts(t){return Uint8Array.from(Da.Buffer.from(t.startsWith("0x")?t.slice(2):t,"hex"))}var ns=require("@mysten/sui.js/verify");var at=require("@mysten/sui.js/utils");var rs=require("@mysten/sui.js/utils"),kr=class{_client;_coinMetaReg;constructor(e){this._client=e,this._coinMetaReg=new Map}async getCoinMeta(e){let r=(0,rs.normalizeStructTag)(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}},Ta=/^0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<(.+)>$/,Or=class t{static isCoin(e){return e?(0,rs.normalizeStructTag)(e).match(Ta)!=null:!1}static getCoinType(e){let[,r]=(0,rs.normalizeStructTag)(e).match(Ta)??[];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 We=class{static normalizeSuiAddress(e){return(0,at.normalizeSuiAddress)(e)}static normalizeStructTag(e){return(0,at.normalizeStructTag)(e)}static isSuiAddressEqual(e,r){return(0,at.normalizeSuiAddress)(e)===(0,at.normalizeSuiAddress)(r)}static isSuiStructEqual(e,r){return(0,at.normalizeStructTag)(e)===(0,at.normalizeStructTag)(r)}static isCoinObjectType(e){return Or.isCoin(e)}};function Ba(t,e){return t.startsWith(e)?t:e+t}var Fa=class t{static async getPublicKeyFromSignature(e){return e.messageType==="TransactionBlock"?(0,ns.verifyTransactionBlock)(e.message,e.signature):(0,ns.verifyPersonalMessage)(e.message,e.signature)}static async getPublicKeyFromPersonalSignature(e){let r=es(e.messageStr);return this.getPublicKeyFromSignature({message:r,messageType:"Personal",signature:e.signature})}static async verifySignature(e){let r=await t.getPublicKeyFromSignature(e);return We.isSuiAddressEqual(r.toSuiAddress(),e.targetAddress)}static async verifyPersonalSignature(e){let r=es(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})}};var ou=require("@mysten/sui.js/cryptography"),cu=require("@mysten/sui.js/multisig");var ch="0x2::sui::SUI";async function Ia(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=uh(o,e);if(i)return i}}function uh(t,e){let r=(0,ou.parseSerializedSignature)(t);switch(r.signatureScheme){case"MultiSig":{let n=new cu.MultiSigPublicKey(r.multisig.multisig_pk).toSuiAddress();if(We.isSuiAddressEqual(n,e))throw new Error("multi-sig wallet cannot be owner");return}case"ZkLogin":{if(We.isSuiAddressEqual(r.zkLogin.address,e))throw new Error("ZkLogin wallet cannot be owner");return}case"ED25519":case"Secp256k1":case"Secp256r1":{let n=Ke.de({publicKeyEncoded:r.publicKey,schema:r.signatureScheme});return We.isSuiAddressEqual(n.toSuiAddress(),e)?n:void 0}default:throw new Error("Unknown schema")}}async function lh(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 uu=25;async function lu(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 ka=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)}},ss=class{constructor(e){this.requester=e;this.pager=new ka(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 fu(t,e,r){let n=new Oa(t,e,r);return await lu(n)}var Oa=class extends ss{constructor(r,n,s){super(new _a(r,n,s));this.provider=r;this.owner=n;this.options=s}},_a=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||uu,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 mt=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 kr(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:(0,du.normalizeStructTag)(r.coinType),balance:BigInt(s),metadata:n}}))}async ownedObjects(e){let r={filter:n=>!n?.data?.type?.startsWith("0x2::coin::Coin"),...e};return fu(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=Xn.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=Ma.TransactionBlock.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=ts(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 Ma.TransactionBlock,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=Ss(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=Ss(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:",Xn.apps);let r=Xn.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:ts(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}};var hu=require("@mysten/sui.js/utils");var as=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((0,hu.normalizeSuiAddress)(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 Ia(this.globals.suiClient,e)}};var is=class{constructor(e){this.globals=e}async create(e){return this.globals.backend.submitReport(e)}};var bu=require("@mysten/sui.js/client");var Wt=qe(require("axios"),1);var os=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?Ke.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??Zt.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:Ke.de({publicKeyEncoded:r.publicKeyEncoded,schema:r.schema})}))}}async get(e,r){let n=this.getFullUrl(e),s=await Wt.default.get(n,r);if(Wt.default.isAxiosError(s))throw cs.fromError(s)??new Error(s.statusText);return s}async post(e,r,n){let s=this.getFullUrl(e),a=await Wt.default.post(s,r,n);if(Wt.default.isAxiosError(a))throw cs.fromError(a)??new Error(a.statusText);return a}getFullUrl(e){return e.startsWith(this.apiURL)?e:`${this.apiURL}${Ba(e,"/")}`}},cs=class t extends Error{constructor(r){super();this.e=r;Error.captureStackTrace(this,this.constructor)}name;static fromError(r){if(Wt.default.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 xu=(a=>(a.local="local",a.unit="unit",a.dev="dev",a.prev="prev",a.prod="prod",a))(xu||{}),us="https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD",Pa="https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7",Na="http://127.0.0.1:3000",Ra="http://127.0.0.1:3001",mu="https://sui-dev.m-safe.link",pu="http://13.56.226.148:81",gu="https://sui-preview.m-safe.link",yu="https://sui.m-safe.link",vu=new Map([["unit",{suiClient:{url:us},backend:{url:Na},syncingURL:Ra}],["local",{suiClient:{url:us},backend:{url:Na},syncingURL:Ra}],["dev",{suiClient:{url:us},backend:{url:mu},syncingURL:pu}],["prev",{suiClient:{url:Pa},backend:{url:gu},syncingURL:""}],["prod",{suiClient:{url:Pa},backend:{url:yu},syncingURL:""}]]);function Ha(t,e){let r=vu.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 _r=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=Ha(e,r),s=new bu.SuiClient(n.suiClient),a=new os(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 ls=class t{constructor(e){this.globals=e}_creationHelper;_publicKeyHelper;static async New(e,r){let n=await _r.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:Zt.active,pagination:e})}async createAccount(e){return this.creationHelper.submitMSafeCreation(e)}getMSafeAccount(e){return new mt(this.globals,e)}async getMSafeAccountFromAddress(e){let r=await this.backend.getMSafeAccountInfo(e);return new mt(this.globals,r)}get creationHelper(){return this._creationHelper||(this._creationHelper=new wt(this.globals,this.publicKeyHelper)),this._creationHelper}get publicKeyHelper(){return this._publicKeyHelper||(this._publicKeyHelper=new as(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 Ct(this.globals)}get Invitation(){return new Tn(this.globals)}get Report(){return new is(this.globals)}async walletAddress(){return this.wallet.address()}};
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
+ "use strict";var Ji=Object.create;var Dt=Object.defineProperty;var Qi=Object.getOwnPropertyDescriptor;var Xi=Object.getOwnPropertyNames;var eo=Object.getPrototypeOf,to=Object.prototype.hasOwnProperty;var Nt=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ro=(r,e)=>{for(var t in e)Dt(r,t,{get:e[t],enumerable:!0})},qn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Xi(e))!to.call(r,s)&&s!==t&&Dt(r,s,{get:()=>e[s],enumerable:!(n=Qi(e,s))||n.enumerable});return r};var Ie=(r,e,t)=>(t=r!=null?Ji(eo(r)):{},qn(e||!r||!r.__esModule?Dt(t,"default",{value:r,enumerable:!0}):t,r)),no=r=>qn(Dt({},"__esModule",{value:!0}),r);var ea=Nt((Sm,Xs)=>{"use strict";Xs.exports=r=>{if(Object.prototype.toString.call(r)!=="[object Object]")return!1;let e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}});var ra=Nt((bm,ta)=>{"use strict";var cn=ea();ta.exports=(r,e={})=>{if(!cn(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):cn(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&&cn(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 aa=Nt((Tm,sa)=>{"use strict";var Mc=Object.prototype.toString;sa.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 Fc(e)?"generatorfunction":"function";if(Ac(e))return"array";if(Wc(e))return"buffer";if(_c(e))return"arguments";if(Nc(e))return"date";if(Dc(e))return"error";if(Pc(e))return"regexp";switch(na(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(Rc(e))return"generator";switch(t=Mc.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 na(r){return typeof r.constructor=="function"?r.constructor.name:null}function Ac(r){return Array.isArray?Array.isArray(r):r instanceof Array}function Dc(r){return r instanceof Error||typeof r.message=="string"&&r.constructor&&typeof r.constructor.stackTraceLimit=="number"}function Nc(r){return r instanceof Date?!0:typeof r.toDateString=="function"&&typeof r.getDate=="function"&&typeof r.setDate=="function"}function Pc(r){return r instanceof RegExp?!0:typeof r.flags=="string"&&typeof r.ignoreCase=="boolean"&&typeof r.multiline=="boolean"&&typeof r.global=="boolean"}function Fc(r,e){return na(r)==="GeneratorFunction"}function Rc(r){return typeof r.throw=="function"&&typeof r.return=="function"&&typeof r.next=="function"}function _c(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 Wc(r){return r.constructor&&typeof r.constructor.isBuffer=="function"?r.constructor.isBuffer(r):!1}});var Qt=Nt((Im,ua)=>{"use strict";var jc=ra(),un=aa(),ia=(r,e)=>!e||un(e)!=="array"?!1:e.indexOf(r)>-1,Lc=(r,e)=>jc(r,{compare:e}),oa=(r,e)=>{let t=e&&e.compareFunction;return r.slice().sort(t)};function ca(r,e){let t=e&&e.compareFunction,n=Lc(r,t);return Object.keys(r).forEach(function(s){let a=n[s],i=un(a);if(i==="object"){(!e||!ia(s,e.ignoreObjectAtKeys))&&(n[s]=ca(a,e));return}i==="array"&&(!e||!ia(s,e.ignoreArrayAtKeys))&&(n[s]=oa(a,e))}),n}var St=(r,e)=>{let t=un(r);return St[t]?St[t](r,e):r};St.array=oa;St.object=ca;ua.exports=St});var nl={};ro(nl,{AddressBookSDK:()=>ke,COIN_TYPE_ARG_REGEX:()=>Cn,Coin:()=>Ct,CoinHelper:()=>Et,CreateHelper:()=>xe,DEV_API_URL:()=>Bi,DEV_SYNCING_URL:()=>qi,ENV_CONFIGS:()=>Vi,Formatter:()=>Q,HexToUint8Array:()=>ur,LOCAL_API_URL:()=>_n,LOCAL_SYNCING_URL:()=>Wn,MAINNET_RPC_URL:()=>Rn,MSafeAccount:()=>Se,MSafeClient:()=>br,MSafeEnv:()=>Li,MSafeGlobals:()=>At,PREV_API_URL:()=>Ui,PROD_API_URL:()=>Hi,SUI_COIN:()=>el,SignatureVerifier:()=>Mn,TESTNET_RPC_URL:()=>Sr,Uint8ArrayToHex:()=>Xu,addPrefix:()=>vn,getAllCoins:()=>rl,getMSafeConfig:()=>jn,getPublicKeyFromChain:()=>An,stringToBuffer:()=>cr});module.exports=no(nl);var z=require("@msafe/sui3-utils"),xe=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 z.MultiSigAccount(t).address}async validateCreateInfo(e){return this.calculateMSafeAddress(e)}addPublicKey(e,t){let n=z.PublicKeySerde.de(t);if(!(0,z.isSameAddress)(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=z.SigningMessageHelper.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,...z.PublicKeySerde.ser(n[a])})),threshold:e.threshold,name:e.name,description:e.description,creationNonce:e.creationNonce,signature:t})}};var Tr=require("@msafe/sui3-utils");var Un=require("@msafe/sui3-utils"),ke=class{constructor(e){this.globals=e}async getEntries(e){return this.globals.backend.getAddressBookEntries(e)}async update(e){let t=Un.SigningMessageHelper.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 Pt=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})}};var Na=require("@msafe/sui3-utils"),Ka=require("@mysten/sui.js/client"),J=Ie(require("axios"),1),we=require("@mysten/sui.js/utils"),qe=require("@mysten/sui.js/utils");var $=class extends Error{},Ft=class extends ${constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Rt=class extends ${constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},_t=class extends ${constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},j=class extends ${},Oe=class extends ${constructor(e){super(`Invalid unit ${e}`)}},x=class extends ${},L=class extends ${constructor(){super("Zone is an abstract class")}};var l="numeric",B="short",D="long",X={year:l,month:l,day:l},Ve={year:l,month:B,day:l},xr={year:l,month:B,day:l,weekday:B},Ge={year:l,month:D,day:l},ze={year:l,month:D,day:l,weekday:D},$e={hour:l,minute:l},Ze={hour:l,minute:l,second:l},Ke={hour:l,minute:l,second:l,timeZoneName:B},Ye={hour:l,minute:l,second:l,timeZoneName:D},Je={hour:l,minute:l,hourCycle:"h23"},Qe={hour:l,minute:l,second:l,hourCycle:"h23"},Xe={hour:l,minute:l,second:l,hourCycle:"h23",timeZoneName:B},et={hour:l,minute:l,second:l,hourCycle:"h23",timeZoneName:D},tt={year:l,month:l,day:l,hour:l,minute:l},rt={year:l,month:l,day:l,hour:l,minute:l,second:l},nt={year:l,month:B,day:l,hour:l,minute:l},st={year:l,month:B,day:l,hour:l,minute:l,second:l},kr={year:l,month:B,day:l,weekday:B,hour:l,minute:l},at={year:l,month:D,day:l,hour:l,minute:l,timeZoneName:B},it={year:l,month:D,day:l,hour:l,minute:l,second:l,timeZoneName:B},ot={year:l,month:D,day:l,weekday:D,hour:l,minute:l,timeZoneName:D},ct={year:l,month:D,day:l,weekday:D,hour:l,minute:l,second:l,timeZoneName:D};var A=class{get type(){throw new L}get name(){throw new L}get ianaName(){return this.name}get isUniversal(){throw new L}offsetName(e,t){throw new L}formatOffset(e,t){throw new L}offset(e){throw new L}equals(e){throw new L}get isValid(){throw new L}};var Or=null,ee=class r extends A{static get instance(){return Or===null&&(Or=new r),Or}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return jt(e,t,n)}formatOffset(e,t){return te(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var Bt={};function so(r){return Bt[r]||(Bt[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"})),Bt[r]}var ao={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function io(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 oo(r,e){let t=r.formatToParts(e),n=[];for(let s=0;s<t.length;s++){let{type:a,value:i}=t[s],o=ao[a];a==="era"?n[o]=i:h(o)||(n[o]=parseInt(i,10))}return n}var Lt={},M=class r extends A{static create(e){return Lt[e]||(Lt[e]=new r(e)),Lt[e]}static resetCache(){Lt={},Bt={}}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 jt(e,t,n,this.name)}formatOffset(e,t){return te(this.offset(e),t)}offset(e){let t=new Date(e);if(isNaN(t))return NaN;let n=so(this.name),[s,a,i,o,c,u,d]=n.formatToParts?oo(n,t):io(n,t);o==="BC"&&(s=-Math.abs(s)+1);let g=Ee({year:s,month:a,day:i,hour:c===24?0:c,minute:u,second:d,millisecond:0}),m=+t,k=m%1e3;return m-=k>=0?k:1e3+k,(g-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}};var Hn={};function co(r,e={}){let t=JSON.stringify([r,e]),n=Hn[t];return n||(n=new Intl.ListFormat(r,e),Hn[t]=n),n}var Er={};function Cr(r,e={}){let t=JSON.stringify([r,e]),n=Er[t];return n||(n=new Intl.DateTimeFormat(r,e),Er[t]=n),n}var vr={};function uo(r,e={}){let t=JSON.stringify([r,e]),n=vr[t];return n||(n=new Intl.NumberFormat(r,e),vr[t]=n),n}var Mr={};function lo(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 ut=null;function mo(){return ut||(ut=new Intl.DateTimeFormat().resolvedOptions().locale,ut)}var Vn={};function ho(r){let e=Vn[r];if(!e){let t=new Intl.Locale(r);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,Vn[r]=e}return e}function fo(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=Cr(r).resolvedOptions(),s=r}catch{let c=r.substring(0,t);n=Cr(c).resolvedOptions(),s=c}let{numberingSystem:a,calendar:i}=n;return[s,a,i]}}function po(r,e,t){return(t||e)&&(r.includes("-u-")||(r+="-u"),t&&(r+=`-ca-${t}`),e&&(r+=`-nu-${e}`)),r}function go(r){let e=[];for(let t=1;t<=12;t++){let n=p.utc(2009,t,1);e.push(r(n))}return e}function yo(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 qt(r,e,t,n){let s=r.listingMode();return s==="error"?null:s==="en"?t(e):n(e)}function wo(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 Ar=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=uo(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):Ce(e,3);return I(t,this.padTo)}}},Dr=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&&M.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=Cr(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()}},Nr=class{constructor(e,t,n){this.opts={style:"long",...n},!t&&Ut()&&(this.rtf=lo(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):Gn(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}},So={firstDay:1,minimalDays:4,weekend:[6,7]},b=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":mo()),c=t||y.defaultNumberingSystem,u=n||y.defaultOutputCalendar,d=lt(s)||y.defaultWeekSettings;return new r(o,c,u,d,i)}static resetCache(){ut=null,Er={},vr={},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]=fo(e);this.locale=i,this.numberingSystem=t||o||null,this.outputCalendar=n||c||null,this.weekSettings=s,this.intl=po(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=wo(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,lt(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 qt(this,e,Pr,()=>{let n=t?{month:e,day:"numeric"}:{month:e},s=t?"format":"standalone";return this.monthsCache[s][e]||(this.monthsCache[s][e]=go(a=>this.extract(a,n,"month"))),this.monthsCache[s][e]})}weekdays(e,t=!1){return qt(this,e,Fr,()=>{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]=yo(a=>this.extract(a,n,"weekday"))),this.weekdaysCache[s][e]})}meridiems(){return qt(this,void 0,()=>Rr,()=>{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 qt(this,e,_r,()=>{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 Ar(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Dr(e,this.intl,t)}relFormatter(e={}){return new Nr(this.intl,this.isEnglish(),e)}listFormatter(e={}){return co(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:Ht()?ho(this.locale):So}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 jr=null,O=class r extends A{static get utcInstance(){return jr===null&&(jr=new r(0)),jr}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(de(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${te(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${te(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return te(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 ve=class extends A{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 q(r,e){let t;if(h(r)||r===null)return e;if(r instanceof A)return r;if(zn(r)){let n=r.toLowerCase();return n==="default"?e:n==="local"||n==="system"?ee.instance:n==="utc"||n==="gmt"?O.utcInstance:O.parseSpecifier(n)||M.create(r)}else return G(r)?O.instance(r):typeof r=="object"&&"offset"in r&&typeof r.offset=="function"?r:new ve(r)}var $n=()=>Date.now(),Zn="system",Kn=null,Yn=null,Jn=null,Qn=60,Xn,es=null,y=class{static get now(){return $n}static set now(e){$n=e}static set defaultZone(e){Zn=e}static get defaultZone(){return q(Zn,ee.instance)}static get defaultLocale(){return Kn}static set defaultLocale(e){Kn=e}static get defaultNumberingSystem(){return Yn}static set defaultNumberingSystem(e){Yn=e}static get defaultOutputCalendar(){return Jn}static set defaultOutputCalendar(e){Jn=e}static get defaultWeekSettings(){return es}static set defaultWeekSettings(e){es=lt(e)}static get twoDigitCutoffYear(){return Qn}static set twoDigitCutoffYear(e){Qn=e%100}static get throwOnInvalid(){return Xn}static set throwOnInvalid(e){Xn=e}static resetCaches(){b.resetCache(),M.resetCache()}};var E=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var ts=[0,31,59,90,120,151,181,212,243,273,304,334],rs=[0,31,60,91,121,152,182,213,244,274,305,335];function R(r,e){return new E("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 ns(r,e,t){return t+(he(r)?rs:ts)[e-1]}function ss(r,e){let t=he(r)?rs:ts,n=t.findIndex(a=>a<e),s=e-t[n];return{month:n+1,day:s}}function Gt(r,e){return(r-e+7)%7+1}function dt(r,e=4,t=1){let{year:n,month:s,day:a}=r,i=ns(n,s,a),o=Gt(Vt(n,s,a),t),c=Math.floor((i-o+14-e)/7),u;return c<1?(u=n-1,c=me(u,e,t)):c>me(n,e,t)?(u=n+1,c=1):u=n,{weekYear:u,weekNumber:c,weekday:o,...ht(r)}}function Lr(r,e=4,t=1){let{weekYear:n,weekNumber:s,weekday:a}=r,i=Gt(Vt(n,1,e),t),o=re(n),c=s*7+a-i-7+e,u;c<1?(u=n-1,c+=re(u)):c>o?(u=n+1,c-=re(n)):u=n;let{month:d,day:f}=ss(u,c);return{year:u,month:d,day:f,...ht(r)}}function zt(r){let{year:e,month:t,day:n}=r,s=ns(e,t,n);return{year:e,ordinal:s,...ht(r)}}function Br(r){let{year:e,ordinal:t}=r,{month:n,day:s}=ss(e,t);return{year:e,month:n,day:s,...ht(r)}}function qr(r,e){if(!h(r.localWeekday)||!h(r.localWeekNumber)||!h(r.localWeekYear)){if(!h(r.weekday)||!h(r.weekNumber)||!h(r.weekYear))throw new j("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 as(r,e=4,t=1){let n=mt(r.weekYear),s=N(r.weekNumber,1,me(r.weekYear,e,t)),a=N(r.weekday,1,7);return n?s?a?!1:R("weekday",r.weekday):R("week",r.weekNumber):R("weekYear",r.weekYear)}function is(r){let e=mt(r.year),t=N(r.ordinal,1,re(r.year));return e?t?!1:R("ordinal",r.ordinal):R("year",r.year)}function Ur(r){let e=mt(r.year),t=N(r.month,1,12),n=N(r.day,1,Me(r.year,r.month));return e?t?n?!1:R("day",r.day):R("month",r.month):R("year",r.year)}function Hr(r){let{hour:e,minute:t,second:n,millisecond:s}=r,a=N(e,0,23)||e===24&&t===0&&n===0&&s===0,i=N(t,0,59),o=N(n,0,59),c=N(s,0,999);return a?i?o?c?!1:R("millisecond",s):R("second",n):R("minute",t):R("hour",e)}function h(r){return typeof r>"u"}function G(r){return typeof r=="number"}function mt(r){return typeof r=="number"&&r%1===0}function zn(r){return typeof r=="string"}function cs(r){return Object.prototype.toString.call(r)==="[object Date]"}function Ut(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Ht(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function us(r){return Array.isArray(r)?r:[r]}function Vr(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 ls(r,e){return e.reduce((t,n)=>(t[n]=r[n],t),{})}function ne(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function lt(r){if(r==null)return null;if(typeof r!="object")throw new x("Week settings must be an object");if(!N(r.firstDay,1,7)||!N(r.minimalDays,1,7)||!Array.isArray(r.weekend)||r.weekend.some(e=>!N(e,1,7)))throw new x("Invalid week settings");return{firstDay:r.firstDay,minimalDays:r.minimalDays,weekend:Array.from(r.weekend)}}function N(r,e,t){return mt(r)&&r>=e&&r<=t}function bo(r,e){return r-e*Math.floor(r/e)}function I(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 se(r){if(!(h(r)||r===null||r===""))return parseFloat(r)}function ft(r){if(!(h(r)||r===null||r==="")){let e=parseFloat("0."+r)*1e3;return Math.floor(e)}}function Ce(r,e,t=!1){let n=10**e;return(t?Math.trunc:Math.round)(r*n)/n}function he(r){return r%4===0&&(r%100!==0||r%400===0)}function re(r){return he(r)?366:365}function Me(r,e){let t=bo(e-1,12)+1,n=r+(e-t)/12;return t===2?he(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Ee(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 os(r,e,t){return-Gt(Vt(r,1,e),t)+e-1}function me(r,e=4,t=1){let n=os(r,e,t),s=os(r+1,e,t);return(re(r)-n+s)/7}function pt(r){return r>99?r:r>y.twoDigitCutoffYear?1900+r:2e3+r}function jt(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 de(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 Gr(r){let e=Number(r);if(typeof r=="boolean"||r===""||Number.isNaN(e))throw new x(`Invalid unit value ${r}`);return e}function Ae(r,e){let t={};for(let n in r)if(ne(r,n)){let s=r[n];if(s==null)continue;t[e(n)]=Gr(s)}return t}function te(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}${I(t,2)}:${I(n,2)}`;case"narrow":return`${s}${t}${n>0?`:${n}`:""}`;case"techie":return`${s}${I(t,2)}${I(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function ht(r){return ls(r,["hour","minute","second","millisecond"])}var To=["January","February","March","April","May","June","July","August","September","October","November","December"],zr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Io=["J","F","M","A","M","J","J","A","S","O","N","D"];function Pr(r){switch(r){case"narrow":return[...Io];case"short":return[...zr];case"long":return[...To];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 $r=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Zr=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],xo=["M","T","W","T","F","S","S"];function Fr(r){switch(r){case"narrow":return[...xo];case"short":return[...Zr];case"long":return[...$r];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var Rr=["AM","PM"],ko=["Before Christ","Anno Domini"],Oo=["BC","AD"],Eo=["B","A"];function _r(r){switch(r){case"narrow":return[...Eo];case"short":return[...Oo];case"long":return[...ko];default:return null}}function ds(r){return Rr[r.hour<12?0:1]}function ms(r,e){return Fr(e)[r.weekday-1]}function hs(r,e){return Pr(e)[r.month-1]}function fs(r,e){return _r(e)[r.year<0?0:1]}function Gn(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 ps(r,e){let t="";for(let n of r)n.literal?t+=n.val:t+=e(n.val);return t}var Co={D:X,DD:Ve,DDD:Ge,DDDD:ze,t:$e,tt:Ze,ttt:Ke,tttt:Ye,T:Je,TT:Qe,TTT:Xe,TTTT:et,f:tt,ff:nt,fff:at,ffff:ot,F:rt,FF:st,FFF:it,FFFF:ct},C=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 Co[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 I(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,k)=>this.loc.extract(e,m,k),i=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",o=()=>n?ds(e):a({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(m,k)=>n?hs(e,m):a(k?{month:m}:{month:m,day:"numeric"},"month"),u=(m,k)=>n?ms(e,m):a(k?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),d=m=>{let k=r.macroTokenToFormatOpts(m);return k?this.formatWithSystemDefault(e,k):m},f=m=>n?fs(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 ps(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 ps(a,s(o))}};var ys=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Ne(...r){let e=r.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function Pe(...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 Fe(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 ws(...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 Ss=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,vo=`(?:${Ss.source}?(?:\\[(${ys.source})\\])?)?`,Kr=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,bs=RegExp(`${Kr.source}${vo}`),Yr=RegExp(`(?:T${bs.source})?`),Mo=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Ao=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Do=/(\d{4})-?(\d{3})/,No=ws("weekYear","weekNumber","weekDay"),Po=ws("year","ordinal"),Fo=/(\d{4})-(\d\d)-(\d\d)/,Ts=RegExp(`${Kr.source} ?(?:${Ss.source}|(${ys.source}))?`),Ro=RegExp(`(?: ${Ts.source})?`);function De(r,e,t){let n=r[e];return h(n)?t:Z(n)}function _o(r,e){return[{year:De(r,e),month:De(r,e+1,1),day:De(r,e+2,1)},null,e+3]}function Re(r,e){return[{hours:De(r,e,0),minutes:De(r,e+1,0),seconds:De(r,e+2,0),milliseconds:ft(r[e+3])},null,e+4]}function gt(r,e){let t=!r[e]&&!r[e+1],n=de(r[e+1],r[e+2]),s=t?null:O.instance(n);return[{},s,e+3]}function yt(r,e){let t=r[e]?M.create(r[e]):null;return[{},t,e+1]}var Wo=RegExp(`^T?${Kr.source}$`),jo=/^-?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 Lo(r){let[e,t,n,s,a,i,o,c,u]=r,d=e[0]==="-",f=c&&c[0]==="-",g=(m,k=!1)=>m!==void 0&&(k||m&&d)?-m:m;return[{years:g(se(t)),months:g(se(n)),weeks:g(se(s)),days:g(se(a)),hours:g(se(i)),minutes:g(se(o)),seconds:g(se(c),c==="-0"),milliseconds:g(ft(u),f)}]}var Bo={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 Jr(r,e,t,n,s,a,i){let o={year:e.length===2?pt(Z(e)):Z(e),month:zr.indexOf(t)+1,day:Z(n),hour:Z(s),minute:Z(a)};return i&&(o.second=Z(i)),r&&(o.weekday=r.length>3?$r.indexOf(r)+1:Zr.indexOf(r)+1),o}var qo=/^(?:(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 Uo(r){let[,e,t,n,s,a,i,o,c,u,d,f]=r,g=Jr(e,s,n,t,a,i,o),m;return c?m=Bo[c]:u?m=0:m=de(d,f),[g,new O(m)]}function Ho(r){return r.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var Vo=/^(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$/,Go=/^(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$/,zo=/^(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 gs(r){let[,e,t,n,s,a,i,o]=r;return[Jr(e,s,n,t,a,i,o),O.utcInstance]}function $o(r){let[,e,t,n,s,a,i,o]=r;return[Jr(e,o,t,n,s,a,i),O.utcInstance]}var Zo=Ne(Mo,Yr),Ko=Ne(Ao,Yr),Yo=Ne(Do,Yr),Jo=Ne(bs),Is=Pe(_o,Re,gt,yt),Qo=Pe(No,Re,gt,yt),Xo=Pe(Po,Re,gt,yt),ec=Pe(Re,gt,yt);function xs(r){return Fe(r,[Zo,Is],[Ko,Qo],[Yo,Xo],[Jo,ec])}function ks(r){return Fe(Ho(r),[qo,Uo])}function Os(r){return Fe(r,[Vo,gs],[Go,gs],[zo,$o])}function Es(r){return Fe(r,[jo,Lo])}var tc=Pe(Re);function Cs(r){return Fe(r,[Wo,tc])}var rc=Ne(Fo,Ro),nc=Ne(Ts),sc=Pe(Re,gt,yt);function vs(r){return Fe(r,[rc,Is],[nc,sc])}var Ms="Invalid Duration",Ds={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}},ac={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},...Ds},_=146097/400,_e=146097/4800,ic={years:{quarters:4,months:12,weeks:_/7,days:_,hours:_*24,minutes:_*24*60,seconds:_*24*60*60,milliseconds:_*24*60*60*1e3},quarters:{months:3,weeks:_/28,days:_/4,hours:_*24/4,minutes:_*24*60/4,seconds:_*24*60*60/4,milliseconds:_*24*60*60*1e3/4},months:{weeks:_e/7,days:_e,hours:_e*24,minutes:_e*24*60,seconds:_e*24*60*60,milliseconds:_e*24*60*60*1e3},...Ds},fe=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],oc=fe.slice(0).reverse();function ae(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 T(n)}function Ns(r,e){let t=e.milliseconds??0;for(let n of oc.slice(1))e[n]&&(t+=e[n]*r[n].milliseconds);return t}function As(r,e){let t=Ns(r,e)<0?-1:1;fe.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),fe.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 cc(r){let e={};for(let[t,n]of Object.entries(r))n!==0&&(e[t]=n);return e}var T=class r{constructor(e){let t=e.conversionAccuracy==="longterm"||!1,n=t?ic:ac;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||b.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 x(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new r({values:Ae(e,r.normalizeUnit),loc:b.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(G(e))return r.fromMillis(e);if(r.isDuration(e))return e;if(typeof e=="object")return r.fromObject(e);throw new x(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){let[n]=Es(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]=Cs(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 x("need to specify a reason the Duration is invalid");let n=e instanceof E?e:new E(e,t);if(y.throwOnInvalid)throw new _t(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 Oe(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?C.create(this.loc,n).formatDurationFromString(this,e):Ms}toHuman(e={}){if(!this.isValid)return Ms;let t=fe.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+=Ce(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?Ns(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 fe)(ne(t.values,s)||ne(this.values,s))&&(n[s]=t.get(s)+this.get(s));return ae(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]=Gr(e(this.values[n],n));return ae(this,{values:t},!0)}get(e){return this[r.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let t={...this.values,...Ae(e,r.normalizeUnit)};return ae(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 ae(this,i)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return As(this.matrix,e),ae(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=cc(this.normalize().shiftToAll().toObject());return ae(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 fe)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;G(s[i])&&(o+=s[i]);let c=Math.trunc(o);t[i]=c,n[i]=(o*1e3-c*1e3)/1e3}else G(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 As(this.matrix,t),ae(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 ae(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 fe)if(!t(this.values[n],e.values[n]))return!1;return!0}};var We="Invalid Interval";function uc(r,e){return!r||!r.isValid?K.invalid("missing or invalid start"):!e||!e.isValid?K.invalid("missing or invalid end"):e<r?K.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 K=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 x("need to specify a reason the Interval is invalid");let n=e instanceof E?e:new E(e,t);if(y.throwOnInvalid)throw new Rt(n);return new r({invalid:n})}static fromDateTimes(e,t){let n=je(e),s=je(t),a=uc(n,s);return a??new r({start:n,end:s})}static after(e,t){let n=T.fromDurationLike(t),s=je(e);return r.fromDateTimes(s,s.plus(n))}static before(e,t){let n=T.fromDurationLike(t),s=je(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=T.fromISO(s,t);if(u.isValid)return r.after(a,u)}else if(c){let u=T.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(je).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=T.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()})`:We}[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=X,t={}){return this.isValid?C.create(this.s.loc.clone(t),e).formatInterval(this):We}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:We}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:We}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:We}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:We}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):T.invalid(this.invalidReason)}mapEndpoints(e){return r.fromDateTimes(e(this.s),e(this.e))}};var Y=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 M.isValidZone(e)}static normalizeZone(e){return q(e,y.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||b.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||b.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||b.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null,outputCalendar:a="gregory"}={}){return(s||b.create(t,n,a)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null,outputCalendar:a="gregory"}={}){return(s||b.create(t,n,a)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null}={}){return(s||b.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:s=null}={}){return(s||b.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return b.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return b.create(t,null,"gregory").eras(e)}static features(){return{relative:Ut(),localeWeek:Ht()}}};function Ps(r,e){let t=s=>s.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=t(e)-t(r);return Math.floor(T.fromMillis(n).as("days"))}function lc(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=Ps(c,u);return(d-d%7)/7}],["days",Ps]],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 Fs(r,e,t,n){let[s,a,i,o]=lc(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=T.fromObject(a,n);return u.length>0?T.fromMillis(c,n).shiftTo(...u).plus(d):d}var Qr={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"},Rs={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]},dc=Qr.hanidec.replace(/[\[|\]]/g,"").split("");function _s(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(Qr.hanidec)!==-1)e+=dc.indexOf(r[t]);else for(let s in Rs){let[a,i]=Rs[s];n>=a&&n<=i&&(e+=n-a)}}return parseInt(e,10)}else return e}function W({numberingSystem:r},e=""){return new RegExp(`${Qr[r||"latn"]}${e}`)}var mc="missing Intl.DateTimeFormat.formatToParts support";function w(r,e=t=>t){return{regex:r,deser:([t])=>e(_s(t))}}var hc="\xA0",Ls=`[ ${hc}]`,Bs=new RegExp(Ls,"g");function fc(r){return r.replace(/\./g,"\\.?").replace(Bs,Ls)}function Ws(r){return r.replace(/\./g,"").replace(Bs," ").toLowerCase()}function U(r,e){return r===null?null:{regex:RegExp(r.map(fc).join("|")),deser:([t])=>r.findIndex(n=>Ws(t)===Ws(n))+e}}function js(r,e){return{regex:r,deser:([,t,n])=>de(t,n),groups:e}}function $t(r){return{regex:r,deser:([e])=>e}}function pc(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function gc(r,e){let t=W(e),n=W(e,"{2}"),s=W(e,"{3}"),a=W(e,"{4}"),i=W(e,"{6}"),o=W(e,"{1,2}"),c=W(e,"{1,3}"),u=W(e,"{1,6}"),d=W(e,"{1,9}"),f=W(e,"{2,4}"),g=W(e,"{4,6}"),m=V=>({regex:RegExp(pc(V.val)),deser:([Te])=>Te,literal:!0}),be=(V=>{if(r.literal)return m(V);switch(V.val){case"G":return U(e.eras("short"),0);case"GG":return U(e.eras("long"),0);case"y":return w(u);case"yy":return w(f,pt);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 U(e.months("short",!0),1);case"MMMM":return U(e.months("long",!0),1);case"L":return w(o);case"LL":return w(n);case"LLL":return U(e.months("short",!1),1);case"LLLL":return U(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 $t(d);case"uu":return $t(o);case"uuu":return w(t);case"a":return U(e.meridiems(),0);case"kkkk":return w(a);case"kk":return w(f,pt);case"W":return w(o);case"WW":return w(n);case"E":case"c":return w(t);case"EEE":return U(e.weekdays("short",!1),1);case"EEEE":return U(e.weekdays("long",!1),1);case"ccc":return U(e.weekdays("short",!0),1);case"cccc":return U(e.weekdays("long",!0),1);case"Z":case"ZZ":return js(new RegExp(`([+-]${o.source})(?::(${n.source}))?`),2);case"ZZZ":return js(new RegExp(`([+-]${o.source})(${n.source})?`),2);case"z":return $t(/[a-z_+-/]{1,256}?/i);case" ":return $t(/[^\S\n\r]/);default:return m(V)}})(r)||{invalidReason:mc};return be.token=r,be}var yc={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 wc(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=yc[i];if(typeof o=="object"&&(o=o[a]),o)return{literal:!1,val:o}}function Sc(r){return[`^${r.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,r]}function bc(r,e,t){let n=r.match(e);if(n){let s={},a=1;for(let i in t)if(ne(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 Tc(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=M.create(r.z)),h(r.Z)||(t||(t=new O(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=ft(r.u)),[Object.keys(r).reduce((a,i)=>{let o=e(i);return o&&(a[o]=r[i]),a},{}),t,n]}var Xr=null;function Ic(){return Xr||(Xr=p.fromMillis(1555555555555)),Xr}function xc(r,e){if(r.literal)return r;let t=C.macroTokenToFormatOpts(r.val),n=rn(t,e);return n==null||n.includes(void 0)?r:n}function en(r,e){return Array.prototype.concat(...r.map(t=>xc(t,e)))}function tn(r,e,t){let n=en(C.parseFormat(t),r),s=n.map(i=>gc(i,r)),a=s.find(i=>i.invalidReason);if(a)return{input:e,tokens:n,invalidReason:a.invalidReason};{let[i,o]=Sc(s),c=RegExp(i,"i"),[u,d]=bc(e,c,o),[f,g,m]=d?Tc(d):[null,null,void 0];if(ne(d,"a")&&ne(d,"H"))throw new j("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 qs(r,e,t){let{result:n,zone:s,specificOffset:a,invalidReason:i}=tn(r,e,t);return[n,s,a,i]}function rn(r,e){if(!r)return null;let n=C.create(e,r).dtFormatter(Ic()),s=n.formatToParts(),a=n.resolvedOptions();return s.map(i=>wc(i,r,a))}var nn="Invalid DateTime",Us=864e13;function Zt(r){return new E("unsupported zone",`the zone "${r.name}" is not supported`)}function sn(r){return r.weekData===null&&(r.weekData=dt(r.c)),r.weekData}function an(r){return r.localWeekData===null&&(r.localWeekData=dt(r.c,r.loc.getMinDaysInFirstWeek(),r.loc.getStartOfWeek())),r.localWeekData}function pe(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 Ks(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 Kt(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 Jt(r,e,t){return Ks(Ee(r),e,t)}function Hs(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,Me(n,s))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},i=T.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=Ee(a),[c,u]=Ks(o,t,r.zone);return i!==0&&(c+=i,u=r.zone.offset(c)),{ts:c,o:u}}function wt(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 E("unparsable",`the input "${s}" can't be parsed as ${n}`))}function Yt(r,e,t=!0){return r.isValid?C.create(b.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(r,e):null}function on(r,e){let t=r.c.year>9999||r.c.year<0,n="";return t&&r.c.year>=0&&(n+="+"),n+=I(r.c.year,t?6:4),e?(n+="-",n+=I(r.c.month),n+="-",n+=I(r.c.day)):(n+=I(r.c.month),n+=I(r.c.day)),n}function Vs(r,e,t,n,s,a){let i=I(r.c.hour);return e?(i+=":",i+=I(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(i+=":")):i+=I(r.c.minute),(r.c.millisecond!==0||r.c.second!==0||!t)&&(i+=I(r.c.second),(r.c.millisecond!==0||!n)&&(i+=".",i+=I(r.c.millisecond,3))),s&&(r.isOffsetFixed&&r.offset===0&&!a?i+="Z":r.o<0?(i+="-",i+=I(Math.trunc(-r.o/60)),i+=":",i+=I(Math.trunc(-r.o%60))):(i+="+",i+=I(Math.trunc(r.o/60)),i+=":",i+=I(Math.trunc(r.o%60)))),a&&(i+="["+r.zone.ianaName+"]"),i}var Ys={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},kc={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Oc={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Js=["year","month","day","hour","minute","second","millisecond"],Ec=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Cc=["year","ordinal","hour","minute","second","millisecond"];function vc(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 Oe(r);return e}function Gs(r){switch(r.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return vc(r)}}function zs(r,e){let t=q(e.zone,y.defaultZone),n=b.fromObject(e),s=y.now(),a,i;if(h(r.year))a=s;else{for(let u of Js)h(r[u])&&(r[u]=Ys[u]);let o=Ur(r)||Hr(r);if(o)return p.invalid(o);let c=t.offset(s);[a,i]=Jt(r,c,t)}return new p({ts:a,zone:t,loc:n,o:i})}function $s(r,e,t){let n=h(t.round)?!0:t.round,s=(i,o)=>(i=Ce(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 Zs(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 E("invalid input"):null)||(t.isValid?null:Zt(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=Kt(this.ts,o),n=Number.isNaN(s.year)?new E("invalid input"):null,s=n?null:s,a=n?null:o}this._zone=t,this.loc=e.loc||b.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]=Zs(arguments),[n,s,a,i,o,c,u]=t;return zs({year:n,month:s,day:a,hour:i,minute:o,second:c,millisecond:u},e)}static utc(){let[e,t]=Zs(arguments),[n,s,a,i,o,c,u]=t;return e.zone=O.utcInstance,zs({year:n,month:s,day:a,hour:i,minute:o,second:c,millisecond:u},e)}static fromJSDate(e,t={}){let n=cs(e)?e.valueOf():NaN;if(Number.isNaN(n))return r.invalid("invalid input");let s=q(t.zone,y.defaultZone);return s.isValid?new r({ts:n,zone:s,loc:b.fromObject(t)}):r.invalid(Zt(s))}static fromMillis(e,t={}){if(G(e))return e<-Us||e>Us?r.invalid("Timestamp out of range"):new r({ts:e,zone:q(t.zone,y.defaultZone),loc:b.fromObject(t)});throw new x(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(G(e))return new r({ts:e*1e3,zone:q(t.zone,y.defaultZone),loc:b.fromObject(t)});throw new x("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};let n=q(t.zone,y.defaultZone);if(!n.isValid)return r.invalid(Zt(n));let s=b.fromObject(t),a=Ae(e,Gs),{minDaysInFirstWeek:i,startOfWeek:o}=qr(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,k=a.weekYear||a.weekNumber;if((m||d)&&k)throw new j("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(g&&d)throw new j("Can't mix ordinal dates with month/day");let be=k||a.weekday&&!m,V,Te,Ue=Kt(c,u);be?(V=Ec,Te=kc,Ue=dt(Ue,i,o)):d?(V=Cc,Te=Oc,Ue=zt(Ue)):(V=Js,Te=Ys);let Ln=!1;for(let He of V){let Yi=a[He];h(Yi)?Ln?a[He]=Te[He]:a[He]=Ue[He]:Ln=!0}let zi=be?as(a,i,o):d?is(a):Ur(a),Bn=zi||Hr(a);if(Bn)return r.invalid(Bn);let $i=be?Lr(a,i,o):d?Br(a):a,[Zi,Ki]=Jt($i,u,n),Ir=new r({ts:Zi,zone:n,o:Ki,loc:s});return a.weekday&&m&&e.weekday!==Ir.weekday?r.invalid("mismatched weekday",`you can't specify both a weekday of ${a.weekday} and a date of ${Ir.toISO()}`):Ir}static fromISO(e,t={}){let[n,s]=xs(e);return wt(n,s,t,"ISO 8601",e)}static fromRFC2822(e,t={}){let[n,s]=ks(e);return wt(n,s,t,"RFC 2822",e)}static fromHTTP(e,t={}){let[n,s]=Os(e);return wt(n,s,t,"HTTP",t)}static fromFormat(e,t,n={}){if(h(e)||h(t))throw new x("fromFormat requires an input string and a format");let{locale:s=null,numberingSystem:a=null}=n,i=b.fromOpts({locale:s,numberingSystem:a,defaultToEN:!0}),[o,c,u,d]=qs(i,e,t);return d?r.invalid(d):wt(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]=vs(e);return wt(n,s,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new x("need to specify a reason the DateTime is invalid");let n=e instanceof E?e:new E(e,t);if(y.throwOnInvalid)throw new Ft(n);return new r({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let n=rn(e,b.fromObject(t));return n?n.map(s=>s?s.val:null).join(""):null}static expandFormat(e,t={}){return en(C.parseFormat(e),b.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?sn(this).weekYear:NaN}get weekNumber(){return this.isValid?sn(this).weekNumber:NaN}get weekday(){return this.isValid?sn(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?an(this).weekday:NaN}get localWeekNumber(){return this.isValid?an(this).weekNumber:NaN}get localWeekYear(){return this.isValid?an(this).weekYear:NaN}get ordinal(){return this.isValid?zt(this.c).ordinal:NaN}get monthShort(){return this.isValid?Y.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Y.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Y.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Y.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=Ee(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=Kt(c,i),f=Kt(u,o);return d.hour===f.hour&&d.minute===f.minute&&d.second===f.second&&d.millisecond===f.millisecond?[pe(this,{ts:c}),pe(this,{ts:u})]:[this]}get isInLeapYear(){return he(this.year)}get daysInMonth(){return Me(this.year,this.month)}get daysInYear(){return this.isValid?re(this.year):NaN}get weeksInWeekYear(){return this.isValid?me(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?me(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:n,calendar:s}=C.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:s}}toUTC(e=0,t={}){return this.setZone(O.instance(e),t)}toLocal(){return this.setZone(y.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=q(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]=Jt(i,a,e)}return pe(this,{ts:s,zone:e})}else return r.invalid(Zt(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){let s=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return pe(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=Ae(e,Gs),{minDaysInFirstWeek:n,startOfWeek:s}=qr(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 j("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&i)throw new j("Can't mix ordinal dates with month/day");let f;a?f=Lr({...dt(this.c,n,s),...t},n,s):h(t.ordinal)?(f={...this.toObject(),...t},h(t.day)&&(f.day=Math.min(Me(f.year,f.month),f.day))):f=Br({...zt(this.c),...t});let[g,m]=Jt(f,this.o,this.zone);return pe(this,{ts:g,o:m})}plus(e){if(!this.isValid)return this;let t=T.fromDurationLike(e);return pe(this,Hs(this,t))}minus(e){if(!this.isValid)return this;let t=T.fromDurationLike(e).negate();return pe(this,Hs(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;let n={},s=T.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?C.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):nn}toLocaleString(e=X,t={}){return this.isValid?C.create(this.loc.clone(t),e).formatDateTime(this):nn}toLocaleParts(e={}){return this.isValid?C.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=on(this,i);return o+="T",o+=Vs(this,i,t,n,s,a),o}toISODate({format:e="extended"}={}){return this.isValid?on(this,e==="extended"):null}toISOWeekDate(){return Yt(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":"")+Vs(this,i==="extended",t,e,n,a):null}toRFC2822(){return Yt(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Yt(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?on(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")),Yt(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():nn}[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 T.invalid("created by diffing an invalid DateTime");let s={locale:this.locale,numberingSystem:this.numberingSystem,...n},a=us(t).map(T.normalizeUnit),i=e.valueOf()>this.valueOf(),o=i?this:e,c=i?e:this,u=Fs(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?K.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),$s(t,this.plus(n),{...e,numeric:"always",units:s,unit:a})}toRelativeCalendar(e={}){return this.isValid?$s(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 x("min requires all arguments be DateTimes");return Vr(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(r.isDateTime))throw new x("max requires all arguments be DateTimes");return Vr(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){let{locale:s=null,numberingSystem:a=null}=n,i=b.fromOpts({locale:s,numberingSystem:a,defaultToEN:!0});return tn(i,e,t)}static fromStringExplain(e,t,n={}){return r.fromFormatExplain(e,t,n)}static get DATE_SHORT(){return X}static get DATE_MED(){return Ve}static get DATE_MED_WITH_WEEKDAY(){return xr}static get DATE_FULL(){return Ge}static get DATE_HUGE(){return ze}static get TIME_SIMPLE(){return $e}static get TIME_WITH_SECONDS(){return Ze}static get TIME_WITH_SHORT_OFFSET(){return Ke}static get TIME_WITH_LONG_OFFSET(){return Ye}static get TIME_24_SIMPLE(){return Je}static get TIME_24_WITH_SECONDS(){return Qe}static get TIME_24_WITH_SHORT_OFFSET(){return Xe}static get TIME_24_WITH_LONG_OFFSET(){return et}static get DATETIME_SHORT(){return tt}static get DATETIME_SHORT_WITH_SECONDS(){return rt}static get DATETIME_MED(){return nt}static get DATETIME_MED_WITH_SECONDS(){return st}static get DATETIME_MED_WITH_WEEKDAY(){return kr}static get DATETIME_FULL(){return at}static get DATETIME_FULL_WITH_SECONDS(){return it}static get DATETIME_HUGE(){return ot}static get DATETIME_HUGE_WITH_SECONDS(){return ct}};function je(r){if(p.isDateTime(r))return r;if(r&&r.valueOf&&G(r.valueOf()))return p.fromJSDate(r);if(r&&typeof r=="object")return p.fromObject(r);throw new x(`Unknown datetime argument: ${r}, of type ${typeof r}`)}var bt=require("@mysten/sui.js/transactions"),hn=require("@mysten/sui.js/transactions"),It=require("@mysten/sui.js/utils"),fn=require("buffer"),Xa=require("@mysten/sui.js/utils"),In=require("@mysten/sui.js/bcs"),xt=require("@mysten/sui.js/utils");var Qs=(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),"");var yn=require("@mysten/sui.js/transactions"),ue=require("@mysten/sui.js/utils");var Tt=require("@mysten/sui.js/transactions"),kt=require("@mysten/sui.js/utils");var pi=Ie(Qt(),1),gi=require("@msafe/sui3-utils"),yi=require("@msafe/sui3-utils"),wi=require("@msafe/sui3-utils"),Tn=require("@mysten/sui.js/bcs"),ce=require("@mysten/sui.js/utils"),bi=require("@msafe/sui3-utils"),Be=require("@msafe/sui3-utils"),Ti=require("@msafe/sui3-utils"),Ii=Ie(Qt(),1),ki=require("@msafe/sui3-utils"),Ei=require("@msafe/sui3-utils"),Ci=require("@mysten/sui.js/transactions"),sr=require("@msafe/sui3-utils"),Mi=require("@mysten/sui.js/transactions"),ar=require("@mysten/sui.js/utils"),vm=Ie(Qt(),1),Bc=Object.defineProperty,Da=(r,e)=>{for(var t in e)Bc(r,t,{get:e[t],enumerable:!0})},Pa={};Da(Pa,{contractId:()=>_a,default:()=>qc,feeObjId:()=>La,roleObjId:()=>Wa,status:()=>Ra,transaction:()=>Fa,upgradeCapObjId:()=>Ba,vaultObjId:()=>ja});var Fa="DiBZq4UmVVYiRL6ZJmFKYoHcxtxqrhsCXSkFyT7wUr3j",Ra="success",_a="0x81c960dc653975fbd0072deca8afb92d322898c911622898ba1b2e3ad0c4bd8d",Wa="0xc6ec0bdee0bb59a72077e9acd2f42457043cf47080b3d3fad4d39abf28bba63a",ja="0xbc4021387fbac149119fd24e92be9e58f745774292f3a2a12e2ac6daf5363e1d",La="0x4178f63970fe2daeb256dc5730ad172e82b3e8eb45f31b33e0daae72cd35e1e1",Ba="0xe1e9aa7d222d151bfe6dd83358b0d7fdcb11260f710800cfaf7ccc1b1e245115",qc={transaction:Fa,status:Ra,contractId:_a,roleObjId:Wa,vaultObjId:ja,feeObjId:La,upgradeCapObjId:Ba},qa={};Da(qa,{contractId:()=>Va,default:()=>Uc,feeObjId:()=>$a,roleObjId:()=>Ga,status:()=>Ha,transaction:()=>Ua,upgradeCapObjId:()=>Za,vaultObjId:()=>za});var Ua="855FNDV8o8Z3fWULPnQo9qdhLJpsg7wZrkCpNyfw9KfB",Ha="success",Va="0xc357c3985e8fb875d6b37141497af660779aa1bab0ec489b2213efd74067d1fa",Ga="0x5ab49bdf9fd1413e328ef242b3f8d83dde791b38a0b627bfc87fb25c010d34f1",za="0xb483558770d8eb26007f193b75db40f0a45f2e36863a687625885d4de6993378",$a="0x48453fc4d7cde3fe35aad89e5dfb496608a6a55ea529a1c0274681a808627f94",Za="0x34279779a0d0d36bd5044b04830d607fa1b0ecf316548c8ac3a44151e4f1a42a",Uc={transaction:Ua,status:Ha,contractId:Va,roleObjId:Ga,vaultObjId:za,feeObjId:$a,upgradeCapObjId:Za},Hc="https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD",Vc="https://sui-testnet.blockvision.org/v1/2Sgk89ivT64MnKdcGzjmyjY2ndD",Gc="https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7",zc="https://sui-mainnet.blockvision.org/v1/2Sgk7NPvqkd7mESYkxF01yX15l7",$c="https://bc3p6l5unl.execute-api.us-west-1.amazonaws.com/prod",Zc="https://rolsbkota7.execute-api.us-west-1.amazonaws.com/prod",Kc="https://6p6mkx33ne.execute-api.us-west-1.amazonaws.com/prod",Yc="https://xrae3mrjv5.execute-api.us-west-1.amazonaws.com/prod",la=Pa,da=qa,Jc=new Map([["dev",{env:"dev",rpc:{url:Hc},backend:{url:$c},contract:la}],["stg",{env:"stg",rpc:{url:Vc},backend:{url:Zc},contract:la}],["prev",{env:"prev",rpc:{url:Gc},backend:{url:Kc},contract:da}],["prod",{env:"prod",rpc:{url:zc},backend:{url:Yc},contract:da}]]);function Qc(r,e){let t=Jc.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 F=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}},Xc=class extends F{constructor(){super(11,"Backend is not specified")}},eu=class extends F{constructor(){super(1,"Wallet not connected")}},ln=class extends F{constructor(r,e){super(10,r,{context:e})}},tu=class ye{constructor(e){this.apiURL=e}static parseResponseData(e){if(e instanceof J.AxiosError)throw new ln(e.response?.statusText);if(e.status===200){if(e.data.success)return e.data.data;throw new ln(e.data.code)}throw new ln(e.status.toString())}async getIncomingStreams(e,t){let n=await J.default.post(`${this.apiURL}/stream`,{recipient:e,...t});return ye.parseResponseData(n)}async getOutgoingStreams(e,t){let n=await J.default.post(`${this.apiURL}/stream`,{sender:e,...t});return ye.parseResponseData(n)}async getStreamHistory(e){let t=await J.default.post(`${this.apiURL}/stream-events`,e),n=ye.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 J.default.post(`${this.apiURL}/stream-info`,{address:e});return ye.parseResponseData(t)}async getAllRecipients(e,t){let n=await J.default.post(`${this.apiURL}/stream-info`,{sender:e,status:t});return ye.parseResponseData(n)}async getAllSenders(e,t){let n=await J.default.post(`${this.apiURL}/stream-info`,{recipient:e,status:t});return ye.parseResponseData(n)}},Ya=class Ja{signer;suiClient;envConfig;_backend;constructor(e){this.envConfig=e,this.suiClient=new Ka.SuiClient({url:e.rpc.url}),e.backend&&(this._backend=new tu(e.backend.url))}static new(e,t){let n=Qc(e,t);return new Ja(n)}get walletType(){return this.wallet?this.wallet.type:"disconnected"}get backend(){if(!this._backend)throw new Xc;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 eu;return this.signer}async walletAddress(){return this.wallet.address()}},ma=50n,dn=10000n,ru=25n,ha=100000000n,ge=class{constructor(r){this.object=r}moveArg(r){return r.object(this.object)}},fa=class{constructor(r){this.objects=r}moveArgs(r){return r.makeMoveVec({objects:this.objects.map(e=>r.object(e))})}},tr=class Qa{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 Qa(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}},pa=class extends F{constructor(r,e){super(3,r,{context:e})}},nu=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 pa("Invalid contract return type.",{ctx:{expectType:"address",gotType:n}});return(0,Xa.normalizeSuiAddress)(fn.Buffer.from(t).toString("hex"))}getU64(r=0,e=0){let[t,n]=this.getValue(r,e);if(n!=="u64")throw new pa("Invalid contract return type.",{ctx:{expectType:"u64",gotType:n}});return fn.Buffer.from(t).readBigInt64LE()}},P=class extends F{constructor(r,e,t){super(2,`Invalid input: ${r}`,{context:{fieldKey:e,fieldValue:t}})}},ei={groupId:"string",name:"string"},su=64;function au(r){return ti(r),In.bcs.ser(ei,r).toString("base64")}function pn(r){let e=In.bcs.de(ei,r,"base64");return ti(e),e}function ti(r){if(!ga(r.name))throw new P("Invalid metadata: Name contains unknown character");if(!ga(r.groupId))throw new P("Invalid metadata: Group ID contains unknown character");if(r.name.length>su)throw new P("Invalid metadata: Name exceed max length 64")}function ga(r){return/^[\x00-\x7F]+$/.test(r)}function ri(r,e){return(0,xt.normalizeStructTag)(r)===(0,xt.normalizeStructTag)(e)}function Le(r,e){return(0,xt.normalizeStructTag)(r)===(0,xt.normalizeStructTag)(e)}var ni="txn.gas";function iu(){return Qs()}var gn=class si{constructor(e,t,n){this.globals=e,this.feeContract=t,this.streamContract=n}static convertCreateStreamInfoToInternal(e){return{metadata:au({name:e.name,groupId:iu()}),coinType:(0,It.normalizeStructTag)(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 hn.TransactionBlock,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 tr(g),flatFeeCoin:new tr(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=si.convertCreateStreamInfoToInternal(e);return this.calculateFeesInternal(t)}feeParams(){return{createFeePercent:{numerator:ma,denominator:dn},claimFeePercent:{numerator:ru,denominator:dn},flatFeePerStream:ha}}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===ni?n=e.gas:n=e.object(t.primaryCoin),n}getCreateStreamCoinRequests(e,t){let n=e.coinType;return ri(n,It.SUI_TYPE_ARG)?[{coinType:n,amount:t.totalAmount+t.streamFeeAmount+t.flatFeeAmount}]:[{coinType:n,amount:t.totalAmount+t.streamFeeAmount},{coinType:It.SUI_TYPE_ARG,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 ha}getStreamFeeLocal(e){return e*ma/dn}async getStreamFeeRemote(e){let t=this.feeContract.streamingFee(new hn.TransactionBlock,e),n=await this.globals.suiClient.devInspectTransactionBlock({sender:await this.globals.walletAddress(),transactionBlock:t});return new nu(n).getU64()}get wallet(){return this.globals.wallet}},ou="0x0000000000000000000000000000000000000000000000000000000000000006",ai=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(yn.Transactions.MoveCall({target:t,arguments:e.arguments.map(n=>n instanceof fa?n.moveArgs(r):n instanceof ge?n.moveArg(r):n instanceof tr?n.moveArg():r.pure(n)),typeArguments:e.typeArgs})),r}addTransactionBlock(r,e,t=[],n=[]){r.add(yn.Transactions.MoveCall({target:e,arguments:t.map(s=>s instanceof fa?s.moveArgs(r):s instanceof ge?s.moveArg(r):s instanceof tr?s.moveArg():r.pure(s)),typeArguments:n}))}makeObject(r){return typeof r=="string"?new ge(r):r}vaultObject(){return new ge(this.config.vaultObjId)}roleObject(){return new ge(this.config.roleObjId)}feeObject(){return new ge(this.config.feeObjId)}clockObject(){return new ge(ou)}},ii=class ie extends ai{constructor(e,t){super(ie.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:ie.MethodName.set_streaming_fee,arguments:[n,s,t],typeArgs:[]})}setStreamingFlatFee(e,t){let n=this.roleObject(),s=this.feeObject();return this.addContractCall(e,{method:ie.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:ie.MethodName.set_claim_fee,arguments:[n,s,t],typeArgs:[]})}streamingFee(e,t){let n=this.feeObject();return this.addContractCall(e,{method:ie.MethodName.streaming_fee,arguments:[n,t],typeArgs:[]})}claimFee(e,t){return this.addContractCall(e,{method:ie.MethodName.claim_fee,arguments:[this.feeObject(),t],typeArgs:[]})}feeDenominator(e){return this.addContractCall(e,{method:ie.MethodName.fee_denominator,arguments:[this.feeObject()],typeArgs:[]})}},nr=class v extends ai{constructor(e,t){super(v.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:v.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:v.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:v.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:v.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:v.MethodName.claim_stream_by_proxy,arguments:[n,s,a,i],typeArgs:[t.coinType]})}get createStreamTarget(){return`${this.config.contractId}::${v.ModuleName}::${v.MethodName.create_stream}`}get setAutoClaimTarget(){return`${this.config.contractId}::${v.ModuleName}::${v.MethodName.set_auto_claim}`}get cancelStreamTarget(){return`${this.config.contractId}::${v.ModuleName}::${v.MethodName.cancel_stream}`}get claimStreamTarget(){return`${this.config.contractId}::${v.ModuleName}::${v.MethodName.claim_stream}`}get claimStreamByProxyTarget(){return`${this.config.contractId}::${v.ModuleName}::${v.MethodName.claim_stream_by_proxy}`}},oi=class{constructor(r){this.globals=r;let e=r.envConfig.contract;this.feeContract=new ii(e,r),this.streamContract=new nr(e,r)}feeContract;streamContract;async createStreams(r){let e=gn.convertCreateStreamInfoToInternal(r);return this.createStreamHelper().buildCreateStreamTransactionBlock(e)}createStreamHelper(){return new gn(this.globals,this.feeContract,this.streamContract)}setAutoClaim(r,e,t){let n=new bt.TransactionBlock;return this.streamContract.setAutoClaim(n,{streamId:r,enabled:e,coinType:t})}claimStream(r,e){let t=new bt.TransactionBlock;return this.streamContract.claimStream(t,{streamId:r,coinType:e})}claimStreamByProxy(r,e){let t=new bt.TransactionBlock;return this.streamContract.claimStreamByProxy(t,{streamId:r,coinType:e})}cancelStream(r,e){let t=new bt.TransactionBlock;return this.streamContract.cancelStream(t,{streamId:r,coinType:e}),t}},cu=class extends F{constructor(r,e){super(12,`Transaction failed: ${e}`,{context:{status:r,msg:e}})}},uu=1e3,lu=class{constructor(r){this.globals=r,this.coinMetaHelper=new du(r.suiClient),this.createStreamHelper=new oi(r).createStreamHelper()}coinMetaHelper;createStreamHelper;getStreamIdsFromCreateStreamResponse(r){if(r.effects?.status.status!=="success")throw new cu(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 P("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 P("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 P("Invalid stream steps: 0");let e=BigInt(r.total.toMillis())/r.steps,t=r.timeStart.plus(T.fromMillis(Number(e*r.steps))),n={timeStart:r.timeStart,timeEnd:t,interval:T.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:(0,qe.normalizeStructTag)(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:(0,qe.normalizeStructTag)(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 P("Stream amount too small","totalAmount",e);if(r.cliffAmount>r.realTotalAmount)throw new P("Invalid cliff settings")}validateTimeline(r){if(r.interval.toMillis()<uu)throw new P("Interval shall be at least 1 second","interval",r.interval)}},du=class{constructor(r){this.suiClient=r,this.coinMetaReg=new Map}coinMetaReg;async getCoinMeta(r){let e=(0,qe.normalizeStructTag)(r||qe.SUI_TYPE_ARG);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}},mu=class extends F{constructor(){super(7,"Connected wallet is not creator")}},ya=class extends F{constructor(){super(8,"Connected wallet is not recipient")}},wa=class extends F{constructor(r,e){super(6,r,{context:e})}},H=class extends F{constructor(r,e={}){super(0,r,e)}},hu=class extends F{constructor(r){super(5,"Stream not found",{context:{streamId:r}})}},fu=(1n<<64n)-1n,rr=1e3;function Sa(r){let e;typeof r=="number"?e=r:typeof r=="bigint"?e=Number(r):e=r.toMillis();let t=Math.round(e/rr);return p.fromMillis(t*rr)}function ba(r){let e;typeof r=="number"?e=r:typeof r=="bigint"?e=Number(r):e=r.toMillis();let t=Math.round(e/rr);return T.fromMillis(t*rr)}var xn=class oe{constructor(e,t,n){this.globals=e,this.streamId=t,this.rawData=n,this.streamContract=new nr(e.envConfig.contract,e)}streamContract;type="Stream";static async new(e,t){let n=await oe.fetchStreamData(e,t);return new oe(e,t,n)}static fromObjectData(e,t,n){let s=oe.parseRawStreamData(t,n);return new oe(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 oe.fetchStreamData(this.globals,this.streamId)}refreshWithData(e){if(e.data?.objectId!==this.streamId)throw new H("Object Id does not align");this.rawData=oe.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 mu;let e=new Tt.TransactionBlock;return this.streamContract.cancelStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async claim(){if(await this.globals.walletAddress()!==this.recipient)throw new ya;let e=new Tt.TransactionBlock;return this.streamContract.claimStream(e,{streamId:this.streamId,coinType:this.coinType}),e}async setAutoClaim(e){if(await this.globals.walletAddress()!==this.recipient)throw new ya;let t=new Tt.TransactionBlock;return this.streamContract.setAutoClaim(t,{streamId:this.streamId,coinType:this.coinType,enabled:e}),t}async claimByProxy(){let e=new Tt.TransactionBlock;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(0,kt.normalizeStructTag)(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 ba(this.rawData.config.epochInterval)}get groupId(){let{metadata:e}=this.rawData.config;return pn(e).groupId}get name(){let{metadata:e}=this.rawData.config;return pn(e).name}get recipient(){return this.rawData.config.recipient}get timeStart(){return Sa(this.rawData.config.timeStart)}get duration(){let e=this.rawData.config,t=e.epochInterval*e.totalEpoch;return ba(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:Sa((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===fu?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 oe.parseRawStreamData(t,n)}static parseRawStreamData(e,t){if(t.error)throw t.error.code==="notExists"?new hu(e):new wa(`get stream data: ${t.error.code}`,{streamId:e,...t.error});let n=t.data.content;if(n.dataType!=="moveObject")throw new wa("Unexpected object type",{gotType:n.dataType});let{typeParams:s}=(0,kt.parseStructTag)(n.type),a=(0,kt.normalizeStructTag)(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)}}}},mn=class extends F{constructor(r,e){super(9,`Invalid stream group: ${r}`,{context:e})}};async function pu(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 gu=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)}},ci=class{constructor(r){this.requester=r,this.pager=new gu(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]}},yu=25;async function Ta(r,e,t){let n=new ui(e),s=new li(r,n,t);return await pu(s)}var ui=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]}},li=class extends ci{constructor(r,e,t){super(new wu(r,e,t)),this.suiClient=r,this.idIter=e,this.options=t}},wu=class{constructor(r,e,t){this.suiClient=r,this.stringIter=e,this.options=t,this.filter=t?.filter,this.pageSize=t?.pageSize||yu,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()}}},Su=class Xt{constructor(e,t){if(this.globals=e,this.streams=t,t.length===0)throw new mn("stream size 0");let n=t.map(s=>s.groupId);if(new Set(n).size!==1)throw new P("Stream does not have same group ID")}type="StreamGroup";static async new(e,t){let n=await Ta(e.suiClient,t);return n.forEach(s=>{if(!s)throw new H("stream group object data undefined")}),Xt.newFromObjectResponse(e,t,n)}static async newFromObjectResponse(e,t,n){let s=await Xt.parseGroupStreams(e,t,n);return new Xt(e,s)}static checkStreamGroup(e){let t=e.map(a=>a.groupCommonInfo),n=t[0],s=!0;return t.forEach(a=>{bu(n,a)||(s=!1)}),s}async refresh(){let e=await Ta(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)=>xn.fromObjectData(e,t[i],a)).filter(a=>!!a);if(new Set(s.map(a=>a.groupId)).size!==1)throw new mn("Not same group ID");if(!this.checkStreamGroup(s))throw new mn("Not same stream settings");return s}};function bu(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 wn{constructor(e,t){this.it=e,this.pageSize=t}static async newIncoming(e){let t=await xa.newIncoming(e);return new wn(t,e.pageSize)}static async newOutgoing(e){let t=await xa.newOutgoing(e);return new wn(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}},xa=class Sn{constructor(e){this.requester=e}cachedNext;static async newIncoming(e){let t=await ka.newIncomingQuery(e);return new Sn(t)}static async newOutgoing(e){let t=await ka.newOutgoingQuery(e);return new Sn(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 H("No more results");return t}let e=this.cachedNext;if(this.cachedNext=void 0,e===null)throw new H("No more results");return e}},ka=class bn{constructor(e,t,n,s){this.globals=e,this.recipient=t,this.groupRefs=n,this.query=s,this.current=0;let a=new ui(n.flat().map(i=>i.streamId));this.objectIter=new li(e.suiClient,a)}current=0;objectIter;static async newIncomingQuery(e){let t=Ou(e.query),n=await e.globals.walletAddress(),s=(await e.globals.backend.getIncomingStreams(n,t)).filter(i=>(0,ue.normalizeSuiAddress)(i.recipient)===(0,ue.normalizeSuiAddress)(n)),a=Oa(s);return new bn(e.globals,n,a,e.query)}static async newOutgoingQuery(e){let t=Eu(e.query),n=await e.globals.walletAddress(),s=await e.globals.backend.getOutgoingStreams(n,t),a=Oa(s);return new bn(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 xu(this.globals,e[0].streamId,this.objectIter);return this.current++,di(t,this.query)?t:this.doNextRequest()}if(e.length>1){let t=await ku(this.globals,e.map(n=>n.streamId),this.objectIter);return this.current++,Iu(t,this.query)?t:this.doNextRequest()}throw new H("Stream group with no stream")}};function Oa(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 di(r,e){if(e===void 0)return!0;let t=Tu(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 Tu(r,e){return e===void 0?!0:Array.isArray(e)?e.includes(r.progress.status):r.progress.status===e}function Iu(r,e){if(!e)return!0;let t=!1;return r.streams.forEach(n=>{di(n,e)&&(t=!0)}),t}async function xu(r,e,t){let n=await mi(t,e);return xn.fromObjectData(r,e,n)}async function ku(r,e,t){let n=[];for(;n.length<e.length;){let s=await mi(t,e[n.length]);n.push(s)}return Su.newFromObjectResponse(r,e,n)}async function mi(r,e){if(!await r.hasNext())throw new H("object iterator has been consumed");let t=await r.next();if(!t||t.error||t.data===void 0||t.data===null)throw new H("object iterator undefined response",{cause:t?.error});if(t?.data?.objectId!==e)throw new H("stream id not aligned");return t}function Ou(r){return{status:kn(r?.status),coinType:hi(r?.coinType),sender:fi(r?.sender)}}function Eu(r){return{status:kn(r?.status),coinType:hi(r?.coinType),recipient:fi(r?.recipient)}}function kn(r){return r===void 0||r.length===0?"all":Array.isArray(r)?r.reduce((e,t)=>{let n=kn(t);return!e||e===n?n:"all"},void 0):Cu(r)}function Cu(r){switch(r){case"STREAMING":case"STREAMED":case"CANCELED":return"active";case"COMPLETED":case"SETTLED":return"inactive";default:throw new P("Unknown stream filtered status")}}function hi(r){if(r)return Array.isArray(r)?r.length!==0?r.map(e=>(0,ue.normalizeStructTag)(e)):void 0:(0,ue.normalizeStructTag)(r)}function fi(r){if(r)return Array.isArray(r)?r.length!==0?r.map(e=>(0,ue.normalizeSuiAddress)(e)):void 0:(0,ue.normalizeSuiAddress)(r)}var vu=class extends F{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}},Mu=25;async function Au(r,e,t,n="0x2::sui::SUI",s=Mu){let a=new Du(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 vu(n,t,i);return o}var Du=class extends ci{constructor(r,e,t,n){super(new Nu(r,e,t,n)),this.suiClient=r,this.owner=e,this.coinType=t,this.reqPageSize=n}},Nu=class{constructor(r,e,t,n){if(this.suiClient=r,this.owner=e,this.coinType=t,this.reqPageSize=n,n<=0)throw new H("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}}},Pu=class{constructor(r){this.msafe=r}get type(){return"msafe"}async address(){return this.msafe.address()}async requestCoins(r){return this.msafe.requestCoins(r)}},Fu=class{constructor(r){this.account=r}async address(){return this.account.address}},Ru=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(ri(r.coinType,we.SUI_TYPE_ARG))return{primaryCoin:ni};if(r.amount<=0)throw new P("Invalid coin request","coinAmount",r.amount);let e=await Au(this.suiClient,await this.address(),r.amount,r.coinType);if(e.length===0)throw new H("no coins available");return{primaryCoin:e[0].coinObjectId,mergedCoins:e.slice(1).map(t=>t.coinObjectId)}}},_u=class{globals;helper;constructor(r,e){this.globals=Ya.new(r,e),this.helper=new lu(this.globals)}connectSingleWallet(r){let e=new Ru(r,this.globals.suiClient);this.globals.connectWallet(e)}connectMSafeAccount(r){let e=new Pu(r);this.globals.connectWallet(e)}async createStream(r){return this.builder().createStreams(r)}async getStream(r){return xn.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=>(0,we.normalizeStructTag)(e))}async getRecipientsForStreamFilter(r){let e=await this.wallet.address();return(await this.globals.backend.getAllRecipients(e,r)).map(t=>(0,we.normalizeSuiAddress)(t))}async getCreatorsForStreamFilter(r){let e=await this.wallet.address();return(await this.globals.backend.getAllSenders(e,r)).map(t=>(0,we.normalizeSuiAddress)(t))}get wallet(){return this.globals.wallet}builder(){return new oi(this.globals)}},Wu=class{constructor(r){this.data=r}serialize(){return JSON.stringify((0,pi.default)(this.data))}},Ot=class extends Wu{application="mpay";getClient(r,e){let t=new _u(r==="sui:mainnet"?"prod":"dev");return t.connectSingleWallet(new Fu(e)),t}},Ea=class extends Ot{constructor(r){super(r),this.data=r}txType=Na.TransactionType.Stream;txSubType="Cancel";async build(r){let{network:e,account:t}=r;return(await this.getClient(e,t).getStream(this.data.streamId)).cancel()}},Ca=class extends Ot{constructor(r){super(r),this.data=r}txType=gi.TransactionType.Stream;txSubType="ClaimByProxy";async build(r){let{network:e,account:t}=r;return(await this.getClient(e,t).getStream(this.data.streamId)).claimByProxy()}},va=class extends Ot{constructor(r){super(r),this.data=r}txType=yi.TransactionType.Stream;txSubType="Claim";async build(r){let{network:e,account:t}=r;return(await this.getClient(e,t).getStream(this.data.streamId)).claim()}},Ma=class extends Ot{constructor(r){super(r),this.data=r}txType=wi.TransactionType.Stream;txSubType="CreateStream";async build(r){let{network:e,account:t}=r;return this.getClient(e,t).createStream(this.data)}},Si=class er{constructor(e,t){this.moveCall=e,this.txb=t}decodeSharedObjectId(e){let t=this.getInputParam(e);return er.getSharedObjectId(t)}decodeOwnedObjectId(e){let t=this.getInputParam(e);return er.getOwnedObjectId(t)}decodeInputU64(e){let t=this.decodePureArg(e,"u64");return BigInt(t)}decodeInputAddress(e){let t=this.decodePureArg(e,"address");return(0,ce.normalizeSuiAddress)(t)}decodeInputString(e){return this.decodePureArg(e,"string")}decodeInputBool(e){return this.decodePureArg(e,"bool")}decodePureArg(e,t){let n=this.getInputParam(e);return er.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 Tn.bcs.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(0,ce.normalizeSuiAddress)(e.value.Object.ImmOrOwned.objectId)}return(0,ce.normalizeSuiAddress)(e.value)}static getSharedObjectId(e){if(e.type!=="object")throw new Error(`not object argument: ${JSON.stringify(e)}`);if(typeof e.value!="object")return(0,ce.normalizeSuiAddress)(e.value);if(!("Object"in e.value)||!("Shared"in e.value.Object))throw new Error("not Shared");return(0,ce.normalizeSuiAddress)(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 Tn.bcs.de(t,new Uint8Array(n))}typeArg(e){return(0,ce.normalizeStructTag)(this.moveCall.typeArguments[e])}txArg(e){return this.moveCall.arguments[e]}},ju=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"&&Le(e.target,this.contract.createStreamTarget));if(r.length===0)throw new H("No create stream transactions");return r.map(e=>new Si(e,this.txb))}getCreationInfoFromMoveCall(r){let e=r.decodeInputString(4),{name:t,groupId:n}=pn(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 P("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 nr(this.globals.envConfig.contract,this.globals)}get feeContract(){return new ii(this.globals.envConfig.contract,this.globals)}createStreamHelper(){return new gn(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]}},Lu=class{constructor(r,e){this.globals=r,this.txb=e,this.contract=new nr(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"&&Le(r.target,this.contract.createStreamTarget))!==-1}isSetAutoClaimTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Le(this.transactions[0].target,this.contract.setAutoClaimTarget)}isCancelStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Le(this.transactions[0].target,this.contract.cancelStreamTarget)}isClaimStreamTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Le(this.transactions[0].target,this.contract.claimStreamTarget)}isClaimByProxyTransaction(){return this.transactions.length===1&&this.transactions[0].kind==="MoveCall"&&Le(this.transactions[0].target,this.contract.claimStreamByProxyTarget)}decodeCreateStreamTransaction(){return new ju(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 Si(r,this.txb)}},Aa=class extends Ot{constructor(r){super(r),this.data=r}txType=bi.TransactionType.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)}},Bu=class{application="mpay";async deserialize(r){let{chain:e,transactionBlock:t}=r,n=Ya.new(e==="sui:mainnet"?"prod":"dev"),s=new Lu(n,t).decode(),a;switch(s.type){case"CreateStream":a=new Ma(s.info);break;case"SetAutoClaim":a=new Aa({streamId:s.streamId,enabled:s.enabled});break;case"Claim":a=new va({streamId:s.streamId});break;case"ClaimByProxy":a=new Ca({streamId:s.streamId});break;case"Cancel":a=new Ea({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 Ma(e);break;case"Claim":t=new va(e);break;case"ClaimByProxy":t=new Ca(e);break;case"SetAutoClaim":t=new Aa(e);break;case"Cancel":t=new Ea(e);break;default:throw new Error("not implemented")}return t.build({...r})}},On=class{constructor(r){this.data=r}get application(){return"msafe-core"}serialize(){return JSON.stringify((0,Ii.default)(this.data))}},qu=class xi extends On{constructor(e){super(e),this.data=e}txType;txSubType;async build(e){let{suiClient:t,account:n}=e;return(0,Ti.buildCoinTransferTxb)(t,this.data,n.address)}static fromData(e){return new xi(e)}},Uu=class Oi extends On{constructor(e){super(e),this.data=e}txType;txSubType;async build(e){let{suiClient:t,account:n}=e;return(0,ki.buildObjectTransferTxb)(t,this.data,n.address)}static fromData(e){return new Oi(e)}},Hu=class vi extends On{constructor(e){super(e),this.data=e}txType;txSubType;async build(e){let{account:t}=e,n=Ci.TransactionBlock.from(this.data.content);if(!(0,Ei.isSameAddress)(n.blockData.sender,t.address))throw new Error("Invalid sender address");return n}static fromData(e){return new vi(e)}},Vu=class{application;constructor(){this.application=Be.TransactionDefaultApplication}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 Be.TransactionSubTypes.assets.coin.send:n=qu.fromData(r.intentionData);break;case Be.TransactionSubTypes.assets.object.send:n=Uu.fromData(r.intentionData);break;case Be.TransactionSubTypes.others.plain:n=Hu.fromData(r.intentionData);break;default:throw new Error("not implemented")}return n.build({suiClient:e,account:t})}},Gu=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}},zu="msafe-plain-tx",$u=sr.TransactionSubTypes.others.plain,Zu=class{application;constructor(){this.application=zu}async deserialize(r){let{transactionBlock:e,suiClient:t}=r,n=await e.build({client:t});return{txType:sr.TransactionType.Other,txSubType:$u,intentionData:{content:(0,ar.toHEX)(n)}}}async build(r){let{suiClient:e,account:t}=r,n=Mi.TransactionBlock.from((0,ar.fromHEX)(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}},ir=new Gu([new Vu,new Bu,new Zu]);var S=require("@msafe/sui3-utils"),Fn=require("@mysten/sui.js/transactions"),hr=require("@mysten/sui.js/utils");var Ai=require("@mysten/sui.js/transactions"),Ku=1000n,Yu=120n,Ju=100n,Qu={multiplier:{numerator:Yu,denominator:Ju}};var or=class{constructor(e){this.globals=e}async simulate(e,t=Qu){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=Ku*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 Ai.TransactionBlock.from(e.serialize())}};var En=require("buffer");function cr(r){return En.Buffer.from(r,"utf-8")}function Xu(r){return`0x${Array.prototype.map.call(r,e=>`0${e.toString(16)}`.slice(-2)).join("")}`}function ur(r){return Uint8Array.from(En.Buffer.from(r.startsWith("0x")?r.slice(2):r,"hex"))}var dr=require("@mysten/sui.js/verify");var le=require("@mysten/sui.js/utils");var lr=require("@mysten/sui.js/utils"),Et=class{_client;_coinMetaReg;constructor(e){this._client=e,this._coinMetaReg=new Map}async getCoinMeta(e){let t=(0,lr.normalizeStructTag)(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}},Cn=/^0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<(.+)>$/,Ct=class r{static isCoin(e){return e?(0,lr.normalizeStructTag)(e).match(Cn)!=null:!1}static getCoinType(e){let[,t]=(0,lr.normalizeStructTag)(e).match(Cn)??[];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 Q=class{static normalizeSuiAddress(e){return(0,le.normalizeSuiAddress)(e)}static normalizeStructTag(e){return(0,le.normalizeStructTag)(e)}static isSuiAddressEqual(e,t){return(0,le.normalizeSuiAddress)(e)===(0,le.normalizeSuiAddress)(t)}static isSuiStructEqual(e,t){return(0,le.normalizeStructTag)(e)===(0,le.normalizeStructTag)(t)}static isCoinObjectType(e){return Ct.isCoin(e)}};function vn(r,e){return r.startsWith(e)?r:e+r}var Mn=class r{static async getPublicKeyFromSignature(e){return e.messageType==="TransactionBlock"?(0,dr.verifyTransactionBlock)(e.message,e.signature):(0,dr.verifyPersonalMessage)(e.message,e.signature)}static async getPublicKeyFromPersonalSignature(e){let t=cr(e.messageStr);return this.getPublicKeyFromSignature({message:t,messageType:"Personal",signature:e.signature})}static async verifySignature(e){let t=await r.getPublicKeyFromSignature(e);return Q.isSuiAddressEqual(t.toSuiAddress(),e.targetAddress)}static async verifyPersonalSignature(e){let t=cr(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})}};var Di=require("@msafe/sui3-utils"),Ni=require("@mysten/sui.js/cryptography"),Pi=require("@mysten/sui.js/multisig");var el="0x2::sui::SUI";async function An(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=tl(i,e);if(o)return o}}function tl(r,e){let t=(0,Ni.parseSerializedSignature)(r);switch(t.signatureScheme){case"MultiSig":{let n=new Pi.MultiSigPublicKey(t.multisig.multisig_pk).toSuiAddress();if(Q.isSuiAddressEqual(n,e))throw new Error("multi-sig wallet cannot be owner");return}case"ZkLogin":{if(Q.isSuiAddressEqual(t.zkLogin.address,e))throw new Error("ZkLogin wallet cannot be owner");return}case"ED25519":case"Secp256k1":case"Secp256r1":{let n=Di.PublicKeySerde.de({publicKeyEncoded:t.publicKey,schema:t.signatureScheme});return Q.isSuiAddressEqual(n.toSuiAddress(),e)?n:void 0}default:throw new Error("Unknown schema")}}async function rl(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 Fi=25;async function Ri(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)}},mr=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 _i(r,e,t){let n=new Nn(r,e,t);return await Ri(n)}var Nn=class extends mr{constructor(t,n,s){super(new Pn(t,n,s));this.provider=t;this.owner=n;this.options=s}},Pn=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||Fi,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 Se=class r{constructor(e,t){this.globals=e;this.info=t;this.multiSig=new S.MultiSigAccount({threshold:t.threshold,ownersWithWeight:t.owners,creationNonce:t.creationNonce}),this.coinHelper=new Et(this.suiClient),this.simulator=new or(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:(0,hr.normalizeStructTag)(t.coinType),balance:BigInt(s),metadata:n}}))}async ownedObjects(e){let t={filter:n=>!n?.data?.type?.startsWith("0x2::coin::Coin"),...e};return _i(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=ir.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=S.SigningMessageHelper.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=ir.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:(0,hr.toHEX)(s),digest:a,msafeAddress:this.address,signature:i.signature})}async simulateCoinTransferIntention(e){let t=await this.nextSequenceNumber();return this.simulateIntention({application:S.TransactionDefaultApplication,txType:S.TransactionType.Assets,txSubType:S.TransactionSubTypes.assets.coin.send,sequenceNumber:t,intention:e})}async proposeCoinTransferIntention(e){let t=await this.nextSequenceNumber();return this.proposeIntention({application:S.TransactionDefaultApplication,txType:S.TransactionType.Assets,txSubType:S.TransactionSubTypes.assets.coin.send,sequenceNumber:t,intention:e})}async simulateObjectTransferIntention(e){let t=await this.nextSequenceNumber();return this.simulateIntention({application:S.TransactionDefaultApplication,txType:S.TransactionType.Assets,txSubType:S.TransactionSubTypes.assets.object.send,sequenceNumber:t,intention:e})}async proposeObjectTransferIntention(e){let t=await this.nextSequenceNumber();return this.proposeIntention({application:S.TransactionDefaultApplication,txType:S.TransactionType.Assets,txSubType:S.TransactionSubTypes.assets.object.send,sequenceNumber:t,intention:e})}async simulatePlainPayloadIntention(e){let t=await this.nextSequenceNumber();return this.simulateIntention({application:S.TransactionDefaultApplication,txType:S.TransactionType.Other,txSubType:S.TransactionSubTypes.others.plain,sequenceNumber:t,intention:e})}async proposePlainPayloadIntention(e){let t=await this.nextSequenceNumber(),n=Fn.TransactionBlock.from(e.payload);if(!n.blockData.sender||!(0,S.isSameAddress)(n.blockData.sender,this.address))throw new Error("Transaction sender is not same as the multisig address");return this.proposeIntention({application:S.TransactionDefaultApplication,txType:S.TransactionType.Other,txSubType:S.TransactionSubTypes.others.plain,sequenceNumber:t,intention:e})}async voteForTransaction(e,t){let n=ur(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 Fn.TransactionBlock,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=(0,S.buildRejectTxb)(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=(0,S.buildRejectTxb)(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=ir.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:ur(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=>(0,S.isSameAddress)(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}};var Wi=require("@msafe/sui3-utils"),ji=require("@mysten/sui.js/utils");var fr=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(!(0,Wi.isSameAddress)(e,t.toSuiAddress()))throw new Error("Invalid public key");this.knownPublicKeys.set((0,ji.normalizeSuiAddress)(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 An(this.globals.suiClient,e)}};var pr=class{constructor(e){this.globals=e}async create(e){return this.globals.backend.submitReport(e)}};var Gi=require("@mysten/sui.js/client");var Mt=require("@msafe/sui3-utils"),vt=Ie(require("axios"),1),wr=Ie(require("json-bigint"),1);var gr=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?Mt.PublicKeySerde.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??Mt.UserMSafeStatus.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:Mt.PublicKeySerde.de({publicKeyEncoded:t.publicKeyEncoded,schema:t.schema})}))}}async get(e,t){let n=this.getFullUrl(e);try{return await vt.default.get(n,t)}catch(s){throw yr.fromError(s)??s}}async post(e,t,n){let s=this.getFullUrl(e);try{return await vt.default.post(s,t,{...n,transformRequest:this.getTransformRequest()})}catch(a){throw yr.fromError(a)??a}}getFullUrl(e){return e.startsWith(this.apiURL)?e:`${this.apiURL}${vn(e,"/")}`}getTransformRequest(){let e=[],{transformRequest:t}=vt.default.defaults;return t?t instanceof Array?e=t:e=[t]:e=[],[n=>wr.parse(wr.stringify(n)),...e]}},yr=class r extends Error{constructor(t){super();this.e=t;Error.captureStackTrace(this,this.constructor)}name;static fromError(t){if(vt.default.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 Li=(a=>(a.local="local",a.unit="unit",a.dev="dev",a.prev="prev",a.prod="prod",a))(Li||{}),Sr="https://fullnode.testnet.sui.io",Rn="https://fullnode.mainnet.sui.io",_n="http://127.0.0.1:3000",Wn="http://127.0.0.1:3001",Bi="https://sui-dev.m-safe.link",qi="http://13.56.226.148:81",Ui="https://sui-preview.m-safe.link",Hi="https://sui.m-safe.link",Vi=new Map([["unit",{suiClient:{url:Sr},backend:{url:_n},syncingURL:Wn,network:"sui:testnet"}],["local",{suiClient:{url:Sr},backend:{url:_n},syncingURL:Wn,network:"sui:testnet"}],["dev",{suiClient:{url:Sr},backend:{url:Bi},syncingURL:qi,network:"sui:testnet"}],["prev",{suiClient:{url:Rn},backend:{url:Ui},syncingURL:"",network:"sui:mainnet"}],["prod",{suiClient:{url:Rn},backend:{url:Hi},syncingURL:"",network:"sui:mainnet"}]]);function jn(r,e){let t=Vi.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 At=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=jn(e,t),s=new Gi.SuiClient(n.suiClient),a=new gr(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 br=class r{constructor(e){this.globals=e}_creationHelper;_publicKeyHelper;static async New(e,t){let n=await At.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=Tr.SigningMessageHelper.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:Tr.UserMSafeStatus.active,pagination:e})}async createAccount(e){return this.creationHelper.submitMSafeCreation(e)}getMSafeAccount(e){return new Se(this.globals,e)}async getMSafeAccountFromAddress(e){let t=await this.backend.getMSafeAccountInfo(e);return new Se(this.globals,t)}get creationHelper(){return this._creationHelper||(this._creationHelper=new xe(this.globals,this.publicKeyHelper)),this._creationHelper}get publicKeyHelper(){return this._publicKeyHelper||(this._publicKeyHelper=new fr(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 ke(this.globals)}get Invitation(){return new Pt(this.globals)}get Report(){return new pr(this.globals)}async walletAddress(){return this.wallet.address()}};
26
2
  //# sourceMappingURL=index.cjs.map