@frak-labs/nexus-sdk 0.0.28 → 0.0.29

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.
@@ -1,9 +1,9 @@
1
- "use strict";var NexusSDK=(()=>{var to=Object.create;var Be=Object.defineProperty;var ro=Object.getOwnPropertyDescriptor;var oo=Object.getOwnPropertyNames;var no=Object.getPrototypeOf,ao=Object.prototype.hasOwnProperty;var zt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var M=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ut=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),io=(e,t)=>{for(var r in t)Be(e,r,{get:t[r],enumerable:!0})},$t=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of oo(t))!ao.call(e,a)&&a!==r&&Be(e,a,{get:()=>t[a],enumerable:!(o=ro(t,a))||o.enumerable});return e};var De=(e,t,r)=>(r=e!=null?to(no(e)):{},$t(t||!e||!e.__esModule?Be(r,"default",{value:e,enumerable:!0}):r,e)),so=e=>$t(Be({},"__esModule",{value:!0}),e);var ct=Ut((xe,st)=>{"use strict";(function(e,t){if(typeof xe=="object"&&typeof st=="object")st.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var r=t();for(var o in r)(typeof xe=="object"?xe:e)[o]=r[o]}})(xe,()=>(()=>{"use strict";var e={48:function(r,o,a){var p=this&&this.__awaiter||function(i,g,n,s){return new(n||(n=Promise))(function(w,A){function m(c){try{L(s.next(c))}catch(l){A(l)}}function F(c){try{L(s.throw(c))}catch(l){A(l)}}function L(c){var l;c.done?w(c.value):(l=c.value,l instanceof n?l:new n(function(E){E(l)})).then(m,F)}L((s=s.apply(i,g||[])).next())})},u=this&&this.__generator||function(i,g){var n,s,w,A,m={label:0,sent:function(){if(1&w[0])throw w[1];return w[1]},trys:[],ops:[]};return A={next:F(0),throw:F(1),return:F(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function F(L){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;A&&(A=0,l[0]&&(m=0)),m;)try{if(n=1,s&&(w=2&l[0]?s.return:l[0]?s.throw||((w=s.return)&&w.call(s),0):s.next)&&!(w=w.call(s,l[1])).done)return w;switch(s=0,w&&(l=[2&l[0],w.value]),l[0]){case 0:case 1:w=l;break;case 4:return m.label++,{value:l[1],done:!1};case 5:m.label++,s=l[1],l=[0];continue;case 7:l=m.ops.pop(),m.trys.pop();continue;default:if(!((w=(w=m.trys).length>0&&w[w.length-1])||l[0]!==6&&l[0]!==2)){m=0;continue}if(l[0]===3&&(!w||l[1]>w[0]&&l[1]<w[3])){m.label=l[1];break}if(l[0]===6&&m.label<w[1]){m.label=w[1],w=l;break}if(w&&m.label<w[2]){m.label=w[2],m.ops.push(l);break}w[2]&&m.ops.pop(),m.trys.pop();continue}l=g.call(i,m)}catch(E){l=[6,E],s=0}finally{n=w=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([L,c])}}};Object.defineProperty(o,"__esModule",{value:!0}),o.decompressFromUTF16=o.compressToUTF16=o.decompressFromBase64=o.compressToBase64=void 0;var S=a(304),d=a(134),T=new S.CompressorImpl,y=new d.DecompressorImpl,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h={};o.compressToBase64=function(i){return p(this,void 0,void 0,function(){var g;return u(this,function(n){switch(n.label){case 0:return i===null?[2,""]:[4,T.compress(i,6,function(s){return f.charAt(s)})];case 1:switch((g=n.sent()).length%4){default:case 0:return[2,g];case 1:return[2,g+"==="];case 2:return[2,g+"=="];case 3:return[2,g+"="]}return[2]}})})},o.decompressFromBase64=function(i){return p(this,void 0,void 0,function(){return u(this,function(g){switch(g.label){case 0:return i===null?[2,""]:i===""?[2,null]:[4,y.decompress(i.length,32,function(n){return function(s,w){if(!h[s]){h[s]={};for(var A=0;A<s.length;A++)h[s][s.charAt(A)]=A}return h[s][w]}(f,i.charAt(n))})];case 1:return[2,g.sent()]}})})},o.compressToUTF16=function(i){return p(this,void 0,void 0,function(){return u(this,function(g){switch(g.label){case 0:return i===null?[2,""]:[4,T.compress(i,15,function(n){return String.fromCharCode(n+32)})];case 1:return[2,g.sent()+" "]}})})},o.decompressFromUTF16=function(i){return p(this,void 0,void 0,function(){return u(this,function(g){switch(g.label){case 0:return i===null?[2,""]:i===""?[2,null]:[4,y.decompress(i.length,16384,function(n){return i.charCodeAt(n)-32})];case 1:return[2,g.sent()]}})})}},304:function(r,o,a){var p=this&&this.__awaiter||function(y,f,h,i){return new(h||(h=Promise))(function(g,n){function s(m){try{A(i.next(m))}catch(F){n(F)}}function w(m){try{A(i.throw(m))}catch(F){n(F)}}function A(m){var F;m.done?g(m.value):(F=m.value,F instanceof h?F:new h(function(L){L(F)})).then(s,w)}A((i=i.apply(y,f||[])).next())})},u=this&&this.__generator||function(y,f){var h,i,g,n,s={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return n={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function w(A){return function(m){return function(F){if(h)throw new TypeError("Generator is already executing.");for(;n&&(n=0,F[0]&&(s=0)),s;)try{if(h=1,i&&(g=2&F[0]?i.return:F[0]?i.throw||((g=i.return)&&g.call(i),0):i.next)&&!(g=g.call(i,F[1])).done)return g;switch(i=0,g&&(F=[2&F[0],g.value]),F[0]){case 0:case 1:g=F;break;case 4:return s.label++,{value:F[1],done:!1};case 5:s.label++,i=F[1],F=[0];continue;case 7:F=s.ops.pop(),s.trys.pop();continue;default:if(!((g=(g=s.trys).length>0&&g[g.length-1])||F[0]!==6&&F[0]!==2)){s=0;continue}if(F[0]===3&&(!g||F[1]>g[0]&&F[1]<g[3])){s.label=F[1];break}if(F[0]===6&&s.label<g[1]){s.label=g[1],g=F;break}if(g&&s.label<g[2]){s.label=g[2],s.ops.push(F);break}g[2]&&s.ops.pop(),s.trys.pop();continue}F=f.call(y,s)}catch(L){F=[6,L],i=0}finally{h=g=0}if(5&F[0])throw F[1];return{value:F[0]?F[1]:void 0,done:!0}}([A,m])}}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompressorImpl=void 0;var S=a(658),d=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],T=function(){function y(){}return y.writeValueToData=function(f,h,i,g,n){if(i%4!=0||f.dataPosition+i>g-1)for(var s=0;s<i;s++)f.dataVal=f.dataVal<<1|1&h,f.dataPosition==g-1?(f.dataPosition=0,f.data.push(n(f.dataVal)),f.dataVal=0):f.dataPosition++,h>>=1;else f.dataVal<<=i,f.dataVal|=function(w,A){for(var m=0,F=0;F<A;++F)m<<=4,m|=d[15&w],w>>=4;return m}(h,i/4),f.dataPosition+=i},y.writeWToDataVal=function(f,h,i){f.dictionaryToCreate.has(f.w)?(f.w.charCodeAt(0)<256?(y.writeValueToData(f,0,f.numBits,h,i),y.writeValueToData(f,f.w.charCodeAt(0),8,h,i)):(y.writeValueToData(f,1,f.numBits,h,i),y.writeValueToData(f,f.w.charCodeAt(0),16,h,i)),f.enlargeIn--,f.enlargeIn==0&&(f.enlargeIn=Math.pow(2,f.numBits),f.numBits++),f.dictionaryToCreate.delete(f.w)):y.writeValueToData(f,f.dictionary.get(f.w),f.numBits,h,i),f.enlargeIn--,f.enlargeIn==0&&(f.enlargeIn=Math.pow(2,f.numBits),f.numBits++)},y.loopIteration=function(f,h,i,g,n){var s=f.charAt(h);n.dictionary.has(s)||(n.dictionary.set(s,n.dictSize++),n.dictionaryToCreate.set(s,!0));var w=n.w+s;n.dictionary.has(w)?n.w=w:(this.writeWToDataVal(n,i,g),n.dictionary.set(w,n.dictSize++),n.w=String(s))},y.prototype.compress=function(f,h,i){var g=this;return new Promise(function(n){return p(g,void 0,void 0,function(){var s,w;return u(this,function(A){switch(A.label){case 0:if(f==null)return n(""),[2];s={data:[],dataPosition:0,dataVal:0,dictionary:new Map,dictionaryToCreate:new Map,dictSize:3,enlargeIn:2,numBits:2,w:""},w=0,A.label=1;case 1:return w<f.length?(y.loopIteration(f,w,h,i,s),w%1e4!=0?[3,3]:[4,(0,S.wait)()]):[3,4];case 2:A.sent(),A.label=3;case 3:return w+=1,[3,1];case 4:return s.w!==""&&y.writeWToDataVal(s,h,i),y.writeValueToData(s,2,s.numBits,h,i),s.dataVal<<=h-s.dataPosition,s.data.push(i(s.dataVal)),n(s.data.join("")),[2]}})})})},y}();o.CompressorImpl=T},134:function(r,o,a){var p=this&&this.__awaiter||function(T,y,f,h){return new(f||(f=Promise))(function(i,g){function n(A){try{w(h.next(A))}catch(m){g(m)}}function s(A){try{w(h.throw(A))}catch(m){g(m)}}function w(A){var m;A.done?i(A.value):(m=A.value,m instanceof f?m:new f(function(F){F(m)})).then(n,s)}w((h=h.apply(T,y||[])).next())})},u=this&&this.__generator||function(T,y){var f,h,i,g,n={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return g={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function s(w){return function(A){return function(m){if(f)throw new TypeError("Generator is already executing.");for(;g&&(g=0,m[0]&&(n=0)),n;)try{if(f=1,h&&(i=2&m[0]?h.return:m[0]?h.throw||((i=h.return)&&i.call(h),0):h.next)&&!(i=i.call(h,m[1])).done)return i;switch(h=0,i&&(m=[2&m[0],i.value]),m[0]){case 0:case 1:i=m;break;case 4:return n.label++,{value:m[1],done:!1};case 5:n.label++,h=m[1],m=[0];continue;case 7:m=n.ops.pop(),n.trys.pop();continue;default:if(!((i=(i=n.trys).length>0&&i[i.length-1])||m[0]!==6&&m[0]!==2)){n=0;continue}if(m[0]===3&&(!i||m[1]>i[0]&&m[1]<i[3])){n.label=m[1];break}if(m[0]===6&&n.label<i[1]){n.label=i[1],i=m;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(m);break}i[2]&&n.ops.pop(),n.trys.pop();continue}m=y.call(T,n)}catch(F){m=[6,F],h=0}finally{f=i=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([w,A])}}};Object.defineProperty(o,"__esModule",{value:!0}),o.DecompressorImpl=void 0;var S=a(658),d=function(){function T(){}return T.prototype.decompress=function(y,f,h){var i=this;return new Promise(function(g){return p(i,void 0,void 0,function(){var n,s,w;return u(this,function(A){switch(A.label){case 0:for(n={bits:0,c:null,dataIndex:1,dataPosition:f,dataVal:h(0),dictionary:new Map,dictSize:4,enlargeIn:4,entry:"",maxPower:Math.pow(2,2),numBits:3,power:1,resb:null,result:[],w:null},s=0;s<3;s+=1)n.dictionary.set(s,s);for(;n.power!=n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=f,n.dataVal=h(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;switch(n.bits){case 0:for(n.bits=0,n.maxPower=Math.pow(2,8),n.power=1;n.power!=n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=f,n.dataVal=h(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.c=String.fromCharCode(n.bits);break;case 1:for(n.bits=0,n.maxPower=Math.pow(2,16),n.power=1;n.power!==n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition===0&&(n.dataPosition=f,n.dataVal=h(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.c=String.fromCharCode(n.bits);break;case 2:return g(""),[2]}n.dictionary[3]=n.c,n.w=n.c,n.result.push(n.c),w=1,A.label=1;case 1:return w%2e4!=0?[3,3]:[4,(0,S.wait)()];case 2:A.sent(),A.label=3;case 3:if(n.dataIndex>y)return g(""),[2];for(n.bits=0,n.maxPower=Math.pow(2,n.numBits),n.power=1;n.power!=n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=f,n.dataVal=h(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;switch(n.c=n.bits){case 0:for(n.bits=0,n.maxPower=Math.pow(2,8),n.power=1;n.power!==n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=f,n.dataVal=h(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.dictionary[n.dictSize++]=String.fromCharCode(n.bits),n.c=n.dictSize-1,n.enlargeIn--;break;case 1:for(n.bits=0,n.maxPower=Math.pow(2,16),n.power=1;n.power!==n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=f,n.dataVal=h(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.dictionary[n.dictSize++]=String.fromCharCode(n.bits),n.c=n.dictSize-1,n.enlargeIn--;break;case 2:return g(n.result.join("")),[2]}if(n.enlargeIn==0&&(n.enlargeIn=Math.pow(2,n.numBits),n.numBits++),n.dictionary[n.c])n.entry=n.dictionary[n.c];else{if(n.c!==n.dictSize)return g(null),[2];n.entry=n.w+n.w.charAt(0)}return n.result.push(n.entry),n.dictionary[n.dictSize++]=n.w+n.entry.charAt(0),n.enlargeIn--,n.w=n.entry,n.enlargeIn==0&&(n.enlargeIn=Math.pow(2,n.numBits),n.numBits++),w++,[3,1];case 4:return[2]}})})})},T}();o.DecompressorImpl=d},658:function(r,o){var a=this&&this.__awaiter||function(u,S,d,T){return new(d||(d=Promise))(function(y,f){function h(n){try{g(T.next(n))}catch(s){f(s)}}function i(n){try{g(T.throw(n))}catch(s){f(s)}}function g(n){var s;n.done?y(n.value):(s=n.value,s instanceof d?s:new d(function(w){w(s)})).then(h,i)}g((T=T.apply(u,S||[])).next())})},p=this&&this.__generator||function(u,S){var d,T,y,f,h={label:0,sent:function(){if(1&y[0])throw y[1];return y[1]},trys:[],ops:[]};return f={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function i(g){return function(n){return function(s){if(d)throw new TypeError("Generator is already executing.");for(;f&&(f=0,s[0]&&(h=0)),h;)try{if(d=1,T&&(y=2&s[0]?T.return:s[0]?T.throw||((y=T.return)&&y.call(T),0):T.next)&&!(y=y.call(T,s[1])).done)return y;switch(T=0,y&&(s=[2&s[0],y.value]),s[0]){case 0:case 1:y=s;break;case 4:return h.label++,{value:s[1],done:!1};case 5:h.label++,T=s[1],s=[0];continue;case 7:s=h.ops.pop(),h.trys.pop();continue;default:if(!((y=(y=h.trys).length>0&&y[y.length-1])||s[0]!==6&&s[0]!==2)){h=0;continue}if(s[0]===3&&(!y||s[1]>y[0]&&s[1]<y[3])){h.label=s[1];break}if(s[0]===6&&h.label<y[1]){h.label=y[1],y=s;break}if(y&&h.label<y[2]){h.label=y[2],h.ops.push(s);break}y[2]&&h.ops.pop(),h.trys.pop();continue}s=S.call(u,h)}catch(w){s=[6,w],T=0}finally{d=y=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([g,n])}}};Object.defineProperty(o,"__esModule",{value:!0}),o.wait=void 0,o.wait=function(){return a(this,void 0,void 0,function(){return p(this,function(u){return[2,new Promise(function(S){setTimeout(S,0)})]})})}}},t={};return function r(o){var a=t[o];if(a!==void 0)return a.exports;var p=t[o]={exports:{}};return e[o].call(p.exports,p,p.exports,r),p.exports}(48)})())});var pt=Ut((rn,Le)=>{"use strict";(function(){"use strict";var e="input is invalid type",t=typeof window=="object",r=t?window:{};r.JS_SHA256_NO_WINDOW&&(t=!1);var o=!t&&typeof self=="object",a=!r.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;a?r=global:o&&(r=self);var p=!r.JS_SHA256_NO_COMMON_JS&&typeof Le=="object"&&Le.exports,u=typeof define=="function"&&define.amd,S=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),T=[-2147483648,8388608,32768,128],y=[24,16,8,0],f=[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],h=["hex","array","digest","arrayBuffer"],i=[];(r.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(c){return Object.prototype.toString.call(c)==="[object Array]"}),S&&(r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(c){return typeof c=="object"&&c.buffer&&c.buffer.constructor===ArrayBuffer});var g=function(c,l){return function(E){return new m(l,!0).update(E)[c]()}},n=function(c){var l=g("hex",c);a&&(l=s(l,c)),l.create=function(){return new m(c)},l.update=function(v){return l.create().update(v)};for(var E=0;E<h.length;++E){var I=h[E];l[I]=g(I,c)}return l},s=function(c,l){var E=zt("crypto"),I=zt("buffer").Buffer,v=l?"sha224":"sha256",b;I.from&&!r.JS_SHA256_NO_BUFFER_FROM?b=I.from:b=function(x){return new I(x)};var C=function(x){if(typeof x=="string")return E.createHash(v).update(x,"utf8").digest("hex");if(x==null)throw new Error(e);return x.constructor===ArrayBuffer&&(x=new Uint8Array(x)),Array.isArray(x)||ArrayBuffer.isView(x)||x.constructor===I?E.createHash(v).update(b(x)).digest("hex"):c(x)};return C},w=function(c,l){return function(E,I){return new F(E,l,!0).update(I)[c]()}},A=function(c){var l=w("hex",c);l.create=function(v){return new F(v,c)},l.update=function(v,b){return l.create(v).update(b)};for(var E=0;E<h.length;++E){var I=h[E];l[I]=w(I,c)}return l};function m(c,l){l?(i[0]=i[16]=i[1]=i[2]=i[3]=i[4]=i[5]=i[6]=i[7]=i[8]=i[9]=i[10]=i[11]=i[12]=i[13]=i[14]=i[15]=0,this.blocks=i):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=c}m.prototype.update=function(c){if(!this.finalized){var l,E=typeof c;if(E!=="string"){if(E==="object"){if(c===null)throw new Error(e);if(S&&c.constructor===ArrayBuffer)c=new Uint8Array(c);else if(!Array.isArray(c)&&(!S||!ArrayBuffer.isView(c)))throw new Error(e)}else throw new Error(e);l=!0}for(var I,v=0,b,C=c.length,x=this.blocks;v<C;){if(this.hashed&&(this.hashed=!1,x[0]=this.block,this.block=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0),l)for(b=this.start;v<C&&b<64;++v)x[b>>>2]|=c[v]<<y[b++&3];else for(b=this.start;v<C&&b<64;++v)I=c.charCodeAt(v),I<128?x[b>>>2]|=I<<y[b++&3]:I<2048?(x[b>>>2]|=(192|I>>>6)<<y[b++&3],x[b>>>2]|=(128|I&63)<<y[b++&3]):I<55296||I>=57344?(x[b>>>2]|=(224|I>>>12)<<y[b++&3],x[b>>>2]|=(128|I>>>6&63)<<y[b++&3],x[b>>>2]|=(128|I&63)<<y[b++&3]):(I=65536+((I&1023)<<10|c.charCodeAt(++v)&1023),x[b>>>2]|=(240|I>>>18)<<y[b++&3],x[b>>>2]|=(128|I>>>12&63)<<y[b++&3],x[b>>>2]|=(128|I>>>6&63)<<y[b++&3],x[b>>>2]|=(128|I&63)<<y[b++&3]);this.lastByteIndex=b,this.bytes+=b-this.start,b>=64?(this.block=x[16],this.start=b-64,this.hash(),this.hashed=!0):this.start=b}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},m.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var c=this.blocks,l=this.lastByteIndex;c[16]=this.block,c[l>>>2]|=T[l&3],this.block=c[16],l>=56&&(this.hashed||this.hash(),c[0]=this.block,c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0),c[14]=this.hBytes<<3|this.bytes>>>29,c[15]=this.bytes<<3,this.hash()}},m.prototype.hash=function(){var c=this.h0,l=this.h1,E=this.h2,I=this.h3,v=this.h4,b=this.h5,C=this.h6,x=this.h7,k=this.blocks,B,N,V,X,P,Y,Z,me,at,it,Re;for(B=16;B<64;++B)P=k[B-15],N=(P>>>7|P<<25)^(P>>>18|P<<14)^P>>>3,P=k[B-2],V=(P>>>17|P<<15)^(P>>>19|P<<13)^P>>>10,k[B]=k[B-16]+N+k[B-7]+V<<0;for(Re=l&E,B=0;B<64;B+=4)this.first?(this.is224?(me=300032,P=k[0]-1413257819,x=P-150054599<<0,I=P+24177077<<0):(me=704751109,P=k[0]-210244248,x=P-1521486534<<0,I=P+143694565<<0),this.first=!1):(N=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),V=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),me=c&l,X=me^c&E^Re,Z=v&b^~v&C,P=x+V+Z+f[B]+k[B],Y=N+X,x=I+P<<0,I=P+Y<<0),N=(I>>>2|I<<30)^(I>>>13|I<<19)^(I>>>22|I<<10),V=(x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7),at=I&c,X=at^I&l^me,Z=x&v^~x&b,P=C+V+Z+f[B+1]+k[B+1],Y=N+X,C=E+P<<0,E=P+Y<<0,N=(E>>>2|E<<30)^(E>>>13|E<<19)^(E>>>22|E<<10),V=(C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7),it=E&I,X=it^E&c^at,Z=C&x^~C&v,P=b+V+Z+f[B+2]+k[B+2],Y=N+X,b=l+P<<0,l=P+Y<<0,N=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),V=(b>>>6|b<<26)^(b>>>11|b<<21)^(b>>>25|b<<7),Re=l&E,X=Re^l&I^it,Z=b&C^~b&x,P=v+V+Z+f[B+3]+k[B+3],Y=N+X,v=c+P<<0,c=P+Y<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+c<<0,this.h1=this.h1+l<<0,this.h2=this.h2+E<<0,this.h3=this.h3+I<<0,this.h4=this.h4+v<<0,this.h5=this.h5+b<<0,this.h6=this.h6+C<<0,this.h7=this.h7+x<<0},m.prototype.hex=function(){this.finalize();var c=this.h0,l=this.h1,E=this.h2,I=this.h3,v=this.h4,b=this.h5,C=this.h6,x=this.h7,k=d[c>>>28&15]+d[c>>>24&15]+d[c>>>20&15]+d[c>>>16&15]+d[c>>>12&15]+d[c>>>8&15]+d[c>>>4&15]+d[c&15]+d[l>>>28&15]+d[l>>>24&15]+d[l>>>20&15]+d[l>>>16&15]+d[l>>>12&15]+d[l>>>8&15]+d[l>>>4&15]+d[l&15]+d[E>>>28&15]+d[E>>>24&15]+d[E>>>20&15]+d[E>>>16&15]+d[E>>>12&15]+d[E>>>8&15]+d[E>>>4&15]+d[E&15]+d[I>>>28&15]+d[I>>>24&15]+d[I>>>20&15]+d[I>>>16&15]+d[I>>>12&15]+d[I>>>8&15]+d[I>>>4&15]+d[I&15]+d[v>>>28&15]+d[v>>>24&15]+d[v>>>20&15]+d[v>>>16&15]+d[v>>>12&15]+d[v>>>8&15]+d[v>>>4&15]+d[v&15]+d[b>>>28&15]+d[b>>>24&15]+d[b>>>20&15]+d[b>>>16&15]+d[b>>>12&15]+d[b>>>8&15]+d[b>>>4&15]+d[b&15]+d[C>>>28&15]+d[C>>>24&15]+d[C>>>20&15]+d[C>>>16&15]+d[C>>>12&15]+d[C>>>8&15]+d[C>>>4&15]+d[C&15];return this.is224||(k+=d[x>>>28&15]+d[x>>>24&15]+d[x>>>20&15]+d[x>>>16&15]+d[x>>>12&15]+d[x>>>8&15]+d[x>>>4&15]+d[x&15]),k},m.prototype.toString=m.prototype.hex,m.prototype.digest=function(){this.finalize();var c=this.h0,l=this.h1,E=this.h2,I=this.h3,v=this.h4,b=this.h5,C=this.h6,x=this.h7,k=[c>>>24&255,c>>>16&255,c>>>8&255,c&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,E>>>24&255,E>>>16&255,E>>>8&255,E&255,I>>>24&255,I>>>16&255,I>>>8&255,I&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255,b>>>24&255,b>>>16&255,b>>>8&255,b&255,C>>>24&255,C>>>16&255,C>>>8&255,C&255];return this.is224||k.push(x>>>24&255,x>>>16&255,x>>>8&255,x&255),k},m.prototype.array=m.prototype.digest,m.prototype.arrayBuffer=function(){this.finalize();var c=new ArrayBuffer(this.is224?28:32),l=new DataView(c);return l.setUint32(0,this.h0),l.setUint32(4,this.h1),l.setUint32(8,this.h2),l.setUint32(12,this.h3),l.setUint32(16,this.h4),l.setUint32(20,this.h5),l.setUint32(24,this.h6),this.is224||l.setUint32(28,this.h7),c};function F(c,l,E){var I,v=typeof c;if(v==="string"){var b=[],C=c.length,x=0,k;for(I=0;I<C;++I)k=c.charCodeAt(I),k<128?b[x++]=k:k<2048?(b[x++]=192|k>>>6,b[x++]=128|k&63):k<55296||k>=57344?(b[x++]=224|k>>>12,b[x++]=128|k>>>6&63,b[x++]=128|k&63):(k=65536+((k&1023)<<10|c.charCodeAt(++I)&1023),b[x++]=240|k>>>18,b[x++]=128|k>>>12&63,b[x++]=128|k>>>6&63,b[x++]=128|k&63);c=b}else if(v==="object"){if(c===null)throw new Error(e);if(S&&c.constructor===ArrayBuffer)c=new Uint8Array(c);else if(!Array.isArray(c)&&(!S||!ArrayBuffer.isView(c)))throw new Error(e)}else throw new Error(e);c.length>64&&(c=new m(l,!0).update(c).array());var B=[],N=[];for(I=0;I<64;++I){var V=c[I]||0;B[I]=92^V,N[I]=54^V}m.call(this,l,E),this.update(N),this.oKeyPad=B,this.inner=!0,this.sharedMemory=E}F.prototype=new m,F.prototype.finalize=function(){if(m.prototype.finalize.call(this),this.inner){this.inner=!1;var c=this.array();m.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(c),m.prototype.finalize.call(this)}};var L=n();L.sha256=L,L.sha224=n(!0),L.sha256.hmac=A(),L.sha224.hmac=A(!0),p?Le.exports=L:(r.sha256=L.sha256,r.sha224=L.sha224,u&&define(function(){return L}))})()});function Q(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}var we=M(()=>{"use strict"});function O(e){return Q(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var Ie=M(()=>{"use strict";we()});var ft,Wt=M(()=>{"use strict";ft="2.22.10"});function qt(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?qt(e.cause,t):t?null:e}var mt,H,ce=M(()=>{"use strict";Wt();mt={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${ft}`},H=class e extends Error{constructor(t,r={}){let o=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,a=r.cause instanceof e&&r.cause.docsPath||r.docsPath,p=mt.getDocsUrl?.({...r,docsPath:a}),u=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...p?[`Docs: ${p}`]:[],...o?[`Details: ${o}`]:[],...mt.version?[`Version: ${mt.version}`]:[]].join(`
2
- `);super(u,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=o,this.docsPath=a,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=t,this.version=ft}walk(t){return qt(this,t)}}});var ze,Ue,$e,Oe,_e,Kt=M(()=>{"use strict";Ie();ce();ze=class extends H{constructor({expectedLength:t,givenLength:r,type:o}){super([`ABI encoding array length mismatch for type ${o}.`,`Expected length: ${t}`,`Given length: ${r}`].join(`
3
- `),{name:"AbiEncodingArrayLengthMismatchError"})}},Ue=class extends H{constructor({expectedSize:t,value:r}){super(`Size of bytes "${r}" (bytes${O(r)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}},$e=class extends H{constructor({expectedLength:t,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${r}`].join(`
4
- `),{name:"AbiEncodingLengthMismatchError"})}},Oe=class extends H{constructor(t,{docsPath:r}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
5
- `),{docsPath:r,name:"InvalidAbiEncodingType"})}},_e=class extends H{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
6
- `),{name:"InvalidArrayError"})}}});var Se,Te,ht=M(()=>{"use strict";ce();Se=class extends H{constructor({offset:t,position:r,size:o}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${o}).`,{name:"SliceOffsetOutOfBoundsError"})}},Te=class extends H{constructor({size:t,targetSize:r,type:o}){super(`${o.charAt(0).toUpperCase()}${o.slice(1).toLowerCase()} size (${t}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}});function z(e,{dir:t,size:r=32}={}){return typeof e=="string"?q(e,{dir:t,size:r}):Jt(e,{dir:t,size:r})}function q(e,{dir:t,size:r=32}={}){if(r===null)return e;let o=e.replace("0x","");if(o.length>r*2)throw new Te({size:Math.ceil(o.length/2),targetSize:r,type:"hex"});return`0x${o[t==="right"?"padEnd":"padStart"](r*2,"0")}`}function Jt(e,{dir:t,size:r=32}={}){if(r===null)return e;if(e.length>r)throw new Te({size:e.length,targetSize:r,type:"bytes"});let o=new Uint8Array(r);for(let a=0;a<r;a++){let p=t==="right";o[p?a:r-a-1]=e[p?a:e.length-a-1]}return o}var Fe=M(()=>{"use strict";ht()});var de,Ne,Ve=M(()=>{"use strict";ce();de=class extends H{constructor({max:t,min:r,signed:o,size:a,value:p}){super(`Number "${p}" is not in safe ${a?`${a*8}-bit ${o?"signed":"unsigned"} `:""}integer range ${t?`(${r} to ${t})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}},Ne=class extends H{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}});function pe(e,{size:t}){if(O(e)>t)throw new Ne({givenSize:O(e),maxSize:t})}var xt=M(()=>{"use strict";Ve();Ie()});function U(e,t={}){return typeof e=="number"||typeof e=="bigint"?K(e,t):typeof e=="string"?We(e,t):typeof e=="boolean"?je(e,t):Ee(e,t)}function je(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(pe(r,{size:t.size}),z(r,{size:t.size})):r}function Ee(e,t={}){let r="";for(let a=0;a<e.length;a++)r+=uo[e[a]];let o=`0x${r}`;return typeof t.size=="number"?(pe(o,{size:t.size}),z(o,{dir:"right",size:t.size})):o}function K(e,t={}){let{signed:r,size:o}=t,a=BigInt(e),p;o?r?p=(1n<<BigInt(o)*8n-1n)-1n:p=2n**(BigInt(o)*8n)-1n:typeof e=="number"&&(p=BigInt(Number.MAX_SAFE_INTEGER));let u=typeof p=="bigint"&&r?-p-1n:0;if(p&&a>p||a<u){let d=typeof e=="bigint"?"n":"";throw new de({max:p?`${p}${d}`:void 0,min:`${u}${d}`,signed:r,size:o,value:`${e}${d}`})}let S=`0x${(r&&a<0?(1n<<BigInt(o*8))+BigInt(a):a).toString(16)}`;return o?z(S,{size:o}):S}function We(e,t={}){let r=lo.encode(e);return Ee(r,t)}var uo,lo,ve=M(()=>{"use strict";Ve();Fe();xt();uo=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));lo=new TextEncoder});function yt(e,t={}){return typeof e=="number"||typeof e=="bigint"?Yt(e,t):typeof e=="boolean"?Xt(e,t):Q(e)?Ae(e,t):qe(e,t)}function Xt(e,t={}){let r=new Uint8Array(1);return r[0]=Number(e),typeof t.size=="number"?(pe(r,{size:t.size}),z(r,{size:t.size})):r}function Gt(e){if(e>=G.zero&&e<=G.nine)return e-G.zero;if(e>=G.A&&e<=G.F)return e-(G.A-10);if(e>=G.a&&e<=G.f)return e-(G.a-10)}function Ae(e,t={}){let r=e;t.size&&(pe(r,{size:t.size}),r=z(r,{dir:"right",size:t.size}));let o=r.slice(2);o.length%2&&(o=`0${o}`);let a=o.length/2,p=new Uint8Array(a);for(let u=0,S=0;u<a;u++){let d=Gt(o.charCodeAt(S++)),T=Gt(o.charCodeAt(S++));if(d===void 0||T===void 0)throw new H(`Invalid byte sequence ("${o[S-2]}${o[S-1]}" in "${o}").`);p[u]=d*16+T}return p}function Yt(e,t){let r=K(e,t);return Ae(r)}function qe(e,t={}){let r=fo.encode(e);return typeof t.size=="number"?(pe(r,{size:t.size}),z(r,{dir:"right",size:t.size})):r}var fo,G,Ke=M(()=>{"use strict";ce();we();Fe();xt();ve();fo=new TextEncoder;G={zero:48,nine:57,A:65,F:70,a:97,f:102}});function gt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function mo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Ce(e,...t){if(!mo(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function bt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Zt(e,t){Ce(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}var wt=M(()=>{"use strict"});function ho(e,t=!1){return t?{h:Number(e&Je),l:Number(e>>Qt&Je)}:{h:Number(e>>Qt&Je)|0,l:Number(e&Je)|0}}function er(e,t=!1){let r=new Uint32Array(e.length),o=new Uint32Array(e.length);for(let a=0;a<e.length;a++){let{h:p,l:u}=ho(e[a],t);[r[a],o[a]]=[p,u]}return[r,o]}var Je,Qt,tr,rr,or,nr,ar=M(()=>{"use strict";Je=BigInt(4294967295),Qt=BigInt(32);tr=(e,t,r)=>e<<r|t>>>32-r,rr=(e,t,r)=>t<<r|e>>>32-r,or=(e,t,r)=>t<<r-32|e>>>64-r,nr=(e,t,r)=>e<<r-32|t>>>64-r});function St(e){for(let t=0;t<e.length;t++)e[t]=xo(e[t])}function yo(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Xe(e){return typeof e=="string"&&(e=yo(e)),Ce(e),e}function sr(e){let t=o=>e().update(Xe(o)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function cr(e){let t=(o,a)=>e(a).update(Xe(o)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=o=>e(o),t}var ir,It,xo,Ge,pr=M(()=>{"use strict";wt();ir=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),It=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,xo=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;Ge=class{clone(){return this._cloneInto()}}});function Eo(e,t=24){let r=new Uint32Array(10);for(let o=24-t;o<24;o++){for(let u=0;u<10;u++)r[u]=e[u]^e[u+10]^e[u+20]^e[u+30]^e[u+40];for(let u=0;u<10;u+=2){let S=(u+8)%10,d=(u+2)%10,T=r[d],y=r[d+1],f=ur(T,y,1)^r[S],h=lr(T,y,1)^r[S+1];for(let i=0;i<50;i+=10)e[u+i]^=f,e[u+i+1]^=h}let a=e[2],p=e[3];for(let u=0;u<24;u++){let S=fr[u],d=ur(a,p,S),T=lr(a,p,S),y=dr[u];a=e[y],p=e[y+1],e[y]=d,e[y+1]=T}for(let u=0;u<50;u+=10){for(let S=0;S<10;S++)r[S]=e[u+S];for(let S=0;S<10;S++)e[u+S]^=~r[(S+2)%10]&r[(S+4)%10]}e[0]^=To[o],e[1]^=Fo[o]}r.fill(0)}var dr,fr,mr,go,ke,bo,wo,Io,So,To,Fo,ur,lr,Ye,ee,ma,ha,xa,ya,ga,hr,ba,wa,xr,Ia,Sa,yr=M(()=>{"use strict";wt();ar();pr();dr=[],fr=[],mr=[],go=BigInt(0),ke=BigInt(1),bo=BigInt(2),wo=BigInt(7),Io=BigInt(256),So=BigInt(113);for(let e=0,t=ke,r=1,o=0;e<24;e++){[r,o]=[o,(2*r+3*o)%5],dr.push(2*(5*o+r)),fr.push((e+1)*(e+2)/2%64);let a=go;for(let p=0;p<7;p++)t=(t<<ke^(t>>wo)*So)%Io,t&bo&&(a^=ke<<(ke<<BigInt(p))-ke);mr.push(a)}[To,Fo]=er(mr,!0),ur=(e,t,r)=>r>32?or(e,t,r):tr(e,t,r),lr=(e,t,r)=>r>32?nr(e,t,r):rr(e,t,r);Ye=class e extends Ge{constructor(t,r,o,a=!1,p=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=o,this.enableXOF=a,this.rounds=p,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,gt(o),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ir(this.state)}keccak(){It||St(this.state32),Eo(this.state32,this.rounds),It||St(this.state32),this.posOut=0,this.pos=0}update(t){bt(this);let{blockLen:r,state:o}=this;t=Xe(t);let a=t.length;for(let p=0;p<a;){let u=Math.min(r-this.pos,a-p);for(let S=0;S<u;S++)o[this.pos++]^=t[p++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:o,blockLen:a}=this;t[o]^=r,r&128&&o===a-1&&this.keccak(),t[a-1]^=128,this.keccak()}writeInto(t){bt(this,!1),Ce(t),this.finish();let r=this.state,{blockLen:o}=this;for(let a=0,p=t.length;a<p;){this.posOut>=o&&this.keccak();let u=Math.min(o-this.posOut,p-a);t.set(r.subarray(this.posOut,this.posOut+u),a),this.posOut+=u,a+=u}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return gt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Zt(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:r,suffix:o,outputLen:a,rounds:p,enableXOF:u}=this;return t||(t=new e(r,o,a,u,p)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=p,t.suffix=o,t.outputLen=a,t.enableXOF=u,t.destroyed=this.destroyed,t}},ee=(e,t,r)=>sr(()=>new Ye(t,e,r)),ma=ee(6,144,224/8),ha=ee(6,136,256/8),xa=ee(6,104,384/8),ya=ee(6,72,512/8),ga=ee(1,144,224/8),hr=ee(1,136,256/8),ba=ee(1,104,384/8),wa=ee(1,72,512/8),xr=(e,t,r)=>cr((o={})=>new Ye(t,e,o.dkLen===void 0?r:o.dkLen,!0)),Ia=xr(31,168,128/8),Sa=xr(31,136,256/8)});function Pe(e,t){let r=t||"hex",o=hr(Q(e,{strict:!1})?yt(e):e);return r==="bytes"?o:U(o)}var Tt=M(()=>{"use strict";yr();we();Ke();ve()});var ue,Ft=M(()=>{"use strict";ce();ue=class extends H{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}});var fe,Et=M(()=>{"use strict";fe=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){let r=super.get(t);return super.has(t)&&r!==void 0&&(this.delete(t),super.set(t,r)),r}set(t,r){if(super.set(t,r),this.maxSize&&this.size>this.maxSize){let o=this.keys().next().value;o&&this.delete(o)}return this}}});function gr(e,t){if(vt.has(`${e}.${t}`))return vt.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),o=Pe(qe(r),"bytes"),a=(t?r.substring(`${t}0x`.length):r).split("");for(let u=0;u<40;u+=2)o[u>>1]>>4>=8&&a[u]&&(a[u]=a[u].toUpperCase()),(o[u>>1]&15)>=8&&a[u+1]&&(a[u+1]=a[u+1].toUpperCase());let p=`0x${a.join("")}`;return vt.set(`${e}.${t}`,p),p}var vt,br=M(()=>{"use strict";Ke();Tt();Et();vt=new fe(8192)});function Me(e,t){let{strict:r=!0}=t??{},o=`${e}.${r}`;if(At.has(o))return At.get(o);let a=vo.test(e)?e.toLowerCase()===e?!0:r?gr(e)===e:!0:!1;return At.set(o,a),a}var vo,At,Ct=M(()=>{"use strict";Et();br();vo=/^0x[a-fA-F0-9]{40}$/,At=new fe(8192)});function te(e){return typeof e[0]=="string"?j(e):wr(e)}function wr(e){let t=0;for(let a of e)t+=a.length;let r=new Uint8Array(t),o=0;for(let a of e)r.set(a,o),o+=a.length;return r}function j(e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}var kt=M(()=>{"use strict"});function Ir(e,t,r,{strict:o}={}){return Q(e,{strict:!1})?Co(e,t,r,{strict:o}):Ao(e,t,r,{strict:o})}function Sr(e,t){if(typeof t=="number"&&t>0&&t>O(e)-1)throw new Se({offset:t,position:"start",size:O(e)})}function Tr(e,t,r){if(typeof t=="number"&&typeof r=="number"&&O(e)!==r-t)throw new Se({offset:r,position:"end",size:O(e)})}function Ao(e,t,r,{strict:o}={}){Sr(e,t);let a=e.slice(t,r);return o&&Tr(a,t,r),a}function Co(e,t,r,{strict:o}={}){Sr(e,t);let a=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return o&&Tr(a,t,r),a}var Fr=M(()=>{"use strict";ht();we();Ie()});var Er,vr=M(()=>{"use strict";Er=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/});function Pt(e,t){if(e.length!==t.length)throw new $e({expectedLength:e.length,givenLength:t.length});let r=ko({params:e,values:t}),o=Rt(r);return o.length===0?"0x":o}function ko({params:e,values:t}){let r=[];for(let o=0;o<e.length;o++)r.push(Mt({param:e[o],value:t[o]}));return r}function Mt({param:e,value:t}){let r=zo(e.type);if(r){let[o,a]=r;return Mo(t,{length:o,param:{...e,type:a}})}if(e.type==="tuple")return Lo(t,{param:e});if(e.type==="address")return Po(t);if(e.type==="bool")return Bo(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let o=e.type.startsWith("int"),[,,a="256"]=Er.exec(e.type)??[];return Do(t,{signed:o,size:Number(a)})}if(e.type.startsWith("bytes"))return Ro(t,{param:e});if(e.type==="string")return Ho(t);throw new Oe(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Rt(e){let t=0;for(let p=0;p<e.length;p++){let{dynamic:u,encoded:S}=e[p];u?t+=32:t+=O(S)}let r=[],o=[],a=0;for(let p=0;p<e.length;p++){let{dynamic:u,encoded:S}=e[p];u?(r.push(K(t+a,{size:32})),o.push(S),a+=O(S)):r.push(S)}return te([...r,...o])}function Po(e){if(!Me(e))throw new ue({address:e});return{dynamic:!1,encoded:q(e.toLowerCase())}}function Mo(e,{length:t,param:r}){let o=t===null;if(!Array.isArray(e))throw new _e(e);if(!o&&e.length!==t)throw new ze({expectedLength:t,givenLength:e.length,type:`${r.type}[${t}]`});let a=!1,p=[];for(let u=0;u<e.length;u++){let S=Mt({param:r,value:e[u]});S.dynamic&&(a=!0),p.push(S)}if(o||a){let u=Rt(p);if(o){let S=K(p.length,{size:32});return{dynamic:!0,encoded:p.length>0?te([S,u]):S}}if(a)return{dynamic:!0,encoded:u}}return{dynamic:!1,encoded:te(p.map(({encoded:u})=>u))}}function Ro(e,{param:t}){let[,r]=t.type.split("bytes"),o=O(e);if(!r){let a=e;return o%32!==0&&(a=q(a,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:te([q(K(o,{size:32})),a])}}if(o!==Number.parseInt(r))throw new Ue({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:q(e,{dir:"right"})}}function Bo(e){if(typeof e!="boolean")throw new H(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:q(je(e))}}function Do(e,{signed:t,size:r=256}){if(typeof r=="number"){let o=2n**(BigInt(r)-(t?1n:0n))-1n,a=t?-o-1n:0n;if(e>o||e<a)throw new de({max:o.toString(),min:a.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:K(e,{size:32,signed:t})}}function Ho(e){let t=We(e),r=Math.ceil(O(t)/32),o=[];for(let a=0;a<r;a++)o.push(q(Ir(t,a*32,(a+1)*32),{dir:"right"}));return{dynamic:!0,encoded:te([q(K(O(t),{size:32})),...o])}}function Lo(e,{param:t}){let r=!1,o=[];for(let a=0;a<t.components.length;a++){let p=t.components[a],u=Array.isArray(e)?a:p.name,S=Mt({param:p,value:e[u]});o.push(S),S.dynamic&&(r=!0)}return{dynamic:r,encoded:r?Rt(o):te(o.map(({encoded:a})=>a))}}function zo(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var Ar=M(()=>{"use strict";Kt();Ft();ce();Ve();Ct();kt();Fe();Ie();Fr();ve();vr()});function Bt(e,t){if(!Me(e,{strict:!1}))throw new ue({address:e});if(!Me(t,{strict:!1}))throw new ue({address:t});return e.toLowerCase()===t.toLowerCase()}var Cr=M(()=>{"use strict";Ft();Ct()});var Xo={};io(Xo,{ClientNotFound:()=>he,DebugInfoGatherer:()=>ae,Deferred:()=>W,FrakContextManager:()=>re,FrakRpcError:()=>R,PressInteractionEncoder:()=>Xr,PurchaseInteractionEncoder:()=>Yr,ReferralInteractionEncoder:()=>ot,RetailInteractionEncoder:()=>Qr,RpcErrorCodes:()=>D,WebShopInteractionEncoder:()=>Zr,baseIframeProps:()=>ie,compressJson:()=>ye,createIFrameFrakClient:()=>se,createIFrameNexusClient:()=>Go,createIframe:()=>be,decompressDataAndCheckHash:()=>ne,decompressJson:()=>ge,displayEmbededWallet:()=>Vr,displayModal:()=>J,getProductInformation:()=>Wr,hashAndCompressData:()=>oe,interactionTypes:()=>_,modalBuilder:()=>Gr,openSso:()=>jr,processReferral:()=>nt,productTypes:()=>$,productTypesMask:()=>Or,referralInteraction:()=>eo,sendInteraction:()=>tt,sendTransaction:()=>Jr,setupClient:()=>Ht,siweAuthenticate:()=>Kr,trackPurchaseStatus:()=>qr,watchWalletStatus:()=>et});var R=class extends Error{constructor(r,o,a){super(o);this.code=r;this.data=a}};var He=class extends R{constructor(t){super(D.internalError,t)}},he=class extends R{constructor(){super(D.clientNotConnected,"Client not found")}},D={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006};var W=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}get promise(){return this._promise}resolve=t=>{this._resolve?.(t)};reject=t=>{this._reject?.(t)}};var Ot=De(ct(),1),ut=De(pt(),1);async function oe(e){let t=(0,ut.sha256)(JSON.stringify(e)),r={...e,validationHash:t},o=await ye(r),a=(0,ut.sha256)(o);return{compressed:o,compressedHash:a}}async function ye(e){return(0,Ot.compressToBase64)(JSON.stringify(e))}var _t=De(ct(),1),lt=De(pt(),1);async function ne(e){if(!(e?.compressed&&e?.compressedHash))throw new R(D.corruptedResponse,"Missing compressed data");let t=await ge(e.compressed);if(!t)throw new R(D.corruptedResponse,"Invalid compressed data");if(!t?.validationHash)throw new R(D.corruptedResponse,"Missing validation hash");if((0,lt.sha256)(e.compressed)!==e.compressedHash)throw new R(D.corruptedResponse,"Invalid compressed hash");let{validationHash:o,...a}=t;if((0,lt.sha256)(JSON.stringify(a))!==t.validationHash)throw new R(D.corruptedResponse,"Invalid data validation hash");return t}async function ge(e){let t=await(0,_t.decompressFromBase64)(e);try{return JSON.parse(t)}catch(r){return console.error("Invalid compressed data",{e:r,decompressed:t}),null}}var le="nexus-wallet-backup";var ae=class e{config;iframe;isSetupDone=!1;lastResponse=null;lastRequest=null;constructor(t,r){this.config=t,this.iframe=r,this.lastRequest=null,this.lastResponse=null}setLastResponse(t){this.lastResponse={event:t.data,origin:t.origin,timestamp:Date.now()}}setLastRequest(t,r){this.lastRequest={event:t,target:r,timestamp:Date.now()}}updateSetupStatus(t){this.isSetupDone=t}base64Encode(t){try{return btoa(JSON.stringify(t))}catch(r){return console.warn("Failed to encode debug data",r),btoa("Failed to encode data")}}getIframeStatus(){return this.iframe?{loading:this.iframe.hasAttribute("loading"),url:this.iframe.src,readyState:this.iframe.contentDocument?.readyState?this.iframe.contentDocument.readyState==="complete"?1:0:-1,contentWindow:!!this.iframe.contentWindow,isConnected:this.iframe.isConnected}:null}getNavigatorInfo(){return navigator?{userAgent:navigator.userAgent,language:navigator.language,onLine:navigator.onLine,screenWidth:window.screen.width,screenHeight:window.screen.height,pixelRatio:window.devicePixelRatio}:null}gatherDebugInfo(t){let r=this.getIframeStatus(),o=this.getNavigatorInfo(),a="Unknown";return t instanceof R?a=`FrakRpcError: ${t.code} '${t.message}'`:t instanceof Error?a=t.message:typeof t=="string"&&(a=t),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):"no-config",navigatorInfo:o?this.base64Encode(o):"no-navigator",iframeStatus:r?this.base64Encode(r):"not-iframe",lastRequest:this.lastRequest?this.base64Encode(this.lastRequest):"No Frak request logged",lastResponse:this.lastResponse?this.base64Encode(this.lastResponse):"No Frak response logged",clientStatus:this.isSetupDone?"setup":"not-setup",error:a}}static empty(){return new e}formatDebugInfo(t){let r=this.gatherDebugInfo(t);return`
1
+ "use strict";var NexusSDK=(()=>{var Dr=Object.create;var Fe=Object.defineProperty;var Hr=Object.getOwnPropertyDescriptor;var Or=Object.getOwnPropertyNames;var Nr=Object.getPrototypeOf,jr=Object.prototype.hasOwnProperty;var St=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var R=(e,t)=>()=>(e&&(t=e(e=0)),t);var Vr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),qr=(e,t)=>{for(var r in t)Fe(e,r,{get:t[r],enumerable:!0})},Ft=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Or(t))!jr.call(e,i)&&i!==r&&Fe(e,i,{get:()=>t[i],enumerable:!(o=Hr(t,i))||o.enumerable});return e};var Wr=(e,t,r)=>(r=e!=null?Dr(Nr(e)):{},Ft(t||!e||!e.__esModule?Fe(r,"default",{value:e,enumerable:!0}):r,e)),Jr=e=>Ft(Fe({},"__esModule",{value:!0}),e);var Pt=Vr((no,Te)=>{"use strict";(function(){"use strict";var e="input is invalid type",t=typeof window=="object",r=t?window:{};r.JS_SHA256_NO_WINDOW&&(t=!1);var o=!t&&typeof self=="object",i=!r.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;i?r=global:o&&(r=self);var s=!r.JS_SHA256_NO_COMMON_JS&&typeof Te=="object"&&Te.exports,f=typeof define=="function"&&define.amd,E=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),F=[-2147483648,8388608,32768,128],k=[24,16,8,0],T=[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],v=["hex","array","digest","arrayBuffer"],l=[];(r.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"}),E&&(r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(a){return typeof a=="object"&&a.buffer&&a.buffer.constructor===ArrayBuffer});var x=function(a,g){return function(I){return new m(g,!0).update(I)[a]()}},p=function(a){var g=x("hex",a);i&&(g=y(g,a)),g.create=function(){return new m(a)},g.update=function(A){return g.create().update(A)};for(var I=0;I<v.length;++I){var u=v[I];g[u]=x(u,a)}return g},y=function(a,g){var I=St("crypto"),u=St("buffer").Buffer,A=g?"sha224":"sha256",w;u.from&&!r.JS_SHA256_NO_BUFFER_FROM?w=u.from:w=function(h){return new u(h)};var B=function(h){if(typeof h=="string")return I.createHash(A).update(h,"utf8").digest("hex");if(h==null)throw new Error(e);return h.constructor===ArrayBuffer&&(h=new Uint8Array(h)),Array.isArray(h)||ArrayBuffer.isView(h)||h.constructor===u?I.createHash(A).update(w(h)).digest("hex"):a(h)};return B},n=function(a,g){return function(I,u){return new S(I,g,!0).update(u)[a]()}},c=function(a){var g=n("hex",a);g.create=function(A){return new S(A,a)},g.update=function(A,w){return g.create(A).update(w)};for(var I=0;I<v.length;++I){var u=v[I];g[u]=n(u,a)}return g};function m(a,g){g?(l[0]=l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0,this.blocks=l):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],a?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=a}m.prototype.update=function(a){if(!this.finalized){var g,I=typeof a;if(I!=="string"){if(I==="object"){if(a===null)throw new Error(e);if(E&&a.constructor===ArrayBuffer)a=new Uint8Array(a);else if(!Array.isArray(a)&&(!E||!ArrayBuffer.isView(a)))throw new Error(e)}else throw new Error(e);g=!0}for(var u,A=0,w,B=a.length,h=this.blocks;A<B;){if(this.hashed&&(this.hashed=!1,h[0]=this.block,this.block=h[16]=h[1]=h[2]=h[3]=h[4]=h[5]=h[6]=h[7]=h[8]=h[9]=h[10]=h[11]=h[12]=h[13]=h[14]=h[15]=0),g)for(w=this.start;A<B&&w<64;++A)h[w>>>2]|=a[A]<<k[w++&3];else for(w=this.start;A<B&&w<64;++A)u=a.charCodeAt(A),u<128?h[w>>>2]|=u<<k[w++&3]:u<2048?(h[w>>>2]|=(192|u>>>6)<<k[w++&3],h[w>>>2]|=(128|u&63)<<k[w++&3]):u<55296||u>=57344?(h[w>>>2]|=(224|u>>>12)<<k[w++&3],h[w>>>2]|=(128|u>>>6&63)<<k[w++&3],h[w>>>2]|=(128|u&63)<<k[w++&3]):(u=65536+((u&1023)<<10|a.charCodeAt(++A)&1023),h[w>>>2]|=(240|u>>>18)<<k[w++&3],h[w>>>2]|=(128|u>>>12&63)<<k[w++&3],h[w>>>2]|=(128|u>>>6&63)<<k[w++&3],h[w>>>2]|=(128|u&63)<<k[w++&3]);this.lastByteIndex=w,this.bytes+=w-this.start,w>=64?(this.block=h[16],this.start=w-64,this.hash(),this.hashed=!0):this.start=w}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},m.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var a=this.blocks,g=this.lastByteIndex;a[16]=this.block,a[g>>>2]|=F[g&3],this.block=a[16],g>=56&&(this.hashed||this.hash(),a[0]=this.block,a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),a[14]=this.hBytes<<3|this.bytes>>>29,a[15]=this.bytes<<3,this.hash()}},m.prototype.hash=function(){var a=this.h0,g=this.h1,I=this.h2,u=this.h3,A=this.h4,w=this.h5,B=this.h6,h=this.h7,C=this.blocks,_,H,O,G,P,K,X,ce,Xe,Ye,Se;for(_=16;_<64;++_)P=C[_-15],H=(P>>>7|P<<25)^(P>>>18|P<<14)^P>>>3,P=C[_-2],O=(P>>>17|P<<15)^(P>>>19|P<<13)^P>>>10,C[_]=C[_-16]+H+C[_-7]+O<<0;for(Se=g&I,_=0;_<64;_+=4)this.first?(this.is224?(ce=300032,P=C[0]-1413257819,h=P-150054599<<0,u=P+24177077<<0):(ce=704751109,P=C[0]-210244248,h=P-1521486534<<0,u=P+143694565<<0),this.first=!1):(H=(a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10),O=(A>>>6|A<<26)^(A>>>11|A<<21)^(A>>>25|A<<7),ce=a&g,G=ce^a&I^Se,X=A&w^~A&B,P=h+O+X+T[_]+C[_],K=H+G,h=u+P<<0,u=P+K<<0),H=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),O=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),Xe=u&a,G=Xe^u&g^ce,X=h&A^~h&w,P=B+O+X+T[_+1]+C[_+1],K=H+G,B=I+P<<0,I=P+K<<0,H=(I>>>2|I<<30)^(I>>>13|I<<19)^(I>>>22|I<<10),O=(B>>>6|B<<26)^(B>>>11|B<<21)^(B>>>25|B<<7),Ye=I&u,G=Ye^I&a^Xe,X=B&h^~B&A,P=w+O+X+T[_+2]+C[_+2],K=H+G,w=g+P<<0,g=P+K<<0,H=(g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10),O=(w>>>6|w<<26)^(w>>>11|w<<21)^(w>>>25|w<<7),Se=g&I,G=Se^g&u^Ye,X=w&B^~w&h,P=A+O+X+T[_+3]+C[_+3],K=H+G,A=a+P<<0,a=P+K<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+a<<0,this.h1=this.h1+g<<0,this.h2=this.h2+I<<0,this.h3=this.h3+u<<0,this.h4=this.h4+A<<0,this.h5=this.h5+w<<0,this.h6=this.h6+B<<0,this.h7=this.h7+h<<0},m.prototype.hex=function(){this.finalize();var a=this.h0,g=this.h1,I=this.h2,u=this.h3,A=this.h4,w=this.h5,B=this.h6,h=this.h7,C=d[a>>>28&15]+d[a>>>24&15]+d[a>>>20&15]+d[a>>>16&15]+d[a>>>12&15]+d[a>>>8&15]+d[a>>>4&15]+d[a&15]+d[g>>>28&15]+d[g>>>24&15]+d[g>>>20&15]+d[g>>>16&15]+d[g>>>12&15]+d[g>>>8&15]+d[g>>>4&15]+d[g&15]+d[I>>>28&15]+d[I>>>24&15]+d[I>>>20&15]+d[I>>>16&15]+d[I>>>12&15]+d[I>>>8&15]+d[I>>>4&15]+d[I&15]+d[u>>>28&15]+d[u>>>24&15]+d[u>>>20&15]+d[u>>>16&15]+d[u>>>12&15]+d[u>>>8&15]+d[u>>>4&15]+d[u&15]+d[A>>>28&15]+d[A>>>24&15]+d[A>>>20&15]+d[A>>>16&15]+d[A>>>12&15]+d[A>>>8&15]+d[A>>>4&15]+d[A&15]+d[w>>>28&15]+d[w>>>24&15]+d[w>>>20&15]+d[w>>>16&15]+d[w>>>12&15]+d[w>>>8&15]+d[w>>>4&15]+d[w&15]+d[B>>>28&15]+d[B>>>24&15]+d[B>>>20&15]+d[B>>>16&15]+d[B>>>12&15]+d[B>>>8&15]+d[B>>>4&15]+d[B&15];return this.is224||(C+=d[h>>>28&15]+d[h>>>24&15]+d[h>>>20&15]+d[h>>>16&15]+d[h>>>12&15]+d[h>>>8&15]+d[h>>>4&15]+d[h&15]),C},m.prototype.toString=m.prototype.hex,m.prototype.digest=function(){this.finalize();var a=this.h0,g=this.h1,I=this.h2,u=this.h3,A=this.h4,w=this.h5,B=this.h6,h=this.h7,C=[a>>>24&255,a>>>16&255,a>>>8&255,a&255,g>>>24&255,g>>>16&255,g>>>8&255,g&255,I>>>24&255,I>>>16&255,I>>>8&255,I&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,A>>>24&255,A>>>16&255,A>>>8&255,A&255,w>>>24&255,w>>>16&255,w>>>8&255,w&255,B>>>24&255,B>>>16&255,B>>>8&255,B&255];return this.is224||C.push(h>>>24&255,h>>>16&255,h>>>8&255,h&255),C},m.prototype.array=m.prototype.digest,m.prototype.arrayBuffer=function(){this.finalize();var a=new ArrayBuffer(this.is224?28:32),g=new DataView(a);return g.setUint32(0,this.h0),g.setUint32(4,this.h1),g.setUint32(8,this.h2),g.setUint32(12,this.h3),g.setUint32(16,this.h4),g.setUint32(20,this.h5),g.setUint32(24,this.h6),this.is224||g.setUint32(28,this.h7),a};function S(a,g,I){var u,A=typeof a;if(A==="string"){var w=[],B=a.length,h=0,C;for(u=0;u<B;++u)C=a.charCodeAt(u),C<128?w[h++]=C:C<2048?(w[h++]=192|C>>>6,w[h++]=128|C&63):C<55296||C>=57344?(w[h++]=224|C>>>12,w[h++]=128|C>>>6&63,w[h++]=128|C&63):(C=65536+((C&1023)<<10|a.charCodeAt(++u)&1023),w[h++]=240|C>>>18,w[h++]=128|C>>>12&63,w[h++]=128|C>>>6&63,w[h++]=128|C&63);a=w}else if(A==="object"){if(a===null)throw new Error(e);if(E&&a.constructor===ArrayBuffer)a=new Uint8Array(a);else if(!Array.isArray(a)&&(!E||!ArrayBuffer.isView(a)))throw new Error(e)}else throw new Error(e);a.length>64&&(a=new m(g,!0).update(a).array());var _=[],H=[];for(u=0;u<64;++u){var O=a[u]||0;_[u]=92^O,H[u]=54^O}m.call(this,g,I),this.update(H),this.oKeyPad=_,this.inner=!0,this.sharedMemory=I}S.prototype=new m,S.prototype.finalize=function(){if(m.prototype.finalize.call(this),this.inner){this.inner=!1;var a=this.array();m.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(a),m.prototype.finalize.call(this)}};var b=p();b.sha256=b,b.sha224=p(!0),b.sha256.hmac=c(),b.sha224.hmac=c(!0),s?Te.exports=b:(r.sha256=b.sha256,r.sha224=b.sha224,f&&define(function(){return b}))})()});function Y(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}var ue=R(()=>{"use strict"});function L(e){return Y(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var fe=R(()=>{"use strict";ue()});var Qe,Rt=R(()=>{"use strict";Qe="2.22.23"});function _t(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?_t(e.cause,t):t?null:e}var et,z,ee=R(()=>{"use strict";Rt();et={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${Qe}`},z=class e extends Error{constructor(t,r={}){let o=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,i=r.cause instanceof e&&r.cause.docsPath||r.docsPath,s=et.getDocsUrl?.({...r,docsPath:i}),f=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...o?[`Details: ${o}`]:[],...et.version?[`Version: ${et.version}`]:[]].join(`
2
+ `);super(f,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=o,this.docsPath=i,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=t,this.version=Qe}walk(t){return _t(this,t)}}});var ke,Be,Ce,Pe,Re,zt=R(()=>{"use strict";fe();ee();ke=class extends z{constructor({expectedLength:t,givenLength:r,type:o}){super([`ABI encoding array length mismatch for type ${o}.`,`Expected length: ${t}`,`Given length: ${r}`].join(`
3
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}},Be=class extends z{constructor({expectedSize:t,value:r}){super(`Size of bytes "${r}" (bytes${L(r)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}},Ce=class extends z{constructor({expectedLength:t,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${r}`].join(`
4
+ `),{name:"AbiEncodingLengthMismatchError"})}},Pe=class extends z{constructor(t,{docsPath:r}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
5
+ `),{docsPath:r,name:"InvalidAbiEncodingType"})}},Re=class extends z{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
6
+ `),{name:"InvalidArrayError"})}}});var le,de,tt=R(()=>{"use strict";ee();le=class extends z{constructor({offset:t,position:r,size:o}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${o}).`,{name:"SliceOffsetOutOfBoundsError"})}},de=class extends z{constructor({size:t,targetSize:r,type:o}){super(`${o.charAt(0).toUpperCase()}${o.slice(1).toLowerCase()} size (${t}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}});function M(e,{dir:t,size:r=32}={}){return typeof e=="string"?V(e,{dir:t,size:r}):$t(e,{dir:t,size:r})}function V(e,{dir:t,size:r=32}={}){if(r===null)return e;let o=e.replace("0x","");if(o.length>r*2)throw new de({size:Math.ceil(o.length/2),targetSize:r,type:"hex"});return`0x${o[t==="right"?"padEnd":"padStart"](r*2,"0")}`}function $t(e,{dir:t,size:r=32}={}){if(r===null)return e;if(e.length>r)throw new de({size:e.length,targetSize:r,type:"bytes"});let o=new Uint8Array(r);for(let i=0;i<r;i++){let s=t==="right";o[s?i:r-i-1]=e[s?i:e.length-i-1]}return o}var pe=R(()=>{"use strict";tt()});var oe,_e,ze=R(()=>{"use strict";ee();oe=class extends z{constructor({max:t,min:r,signed:o,size:i,value:s}){super(`Number "${s}" is not in safe ${i?`${i*8}-bit ${o?"signed":"unsigned"} `:""}integer range ${t?`(${r} to ${t})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}},_e=class extends z{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}});function te(e,{size:t}){if(L(e)>t)throw new _e({givenSize:L(e),maxSize:t})}var rt=R(()=>{"use strict";ze();fe()});function D(e,t={}){return typeof e=="number"||typeof e=="bigint"?q(e,t):typeof e=="string"?Ue(e,t):typeof e=="boolean"?$e(e,t):he(e,t)}function $e(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(te(r,{size:t.size}),M(r,{size:t.size})):r}function he(e,t={}){let r="";for(let i=0;i<e.length;i++)r+=Qr[e[i]];let o=`0x${r}`;return typeof t.size=="number"?(te(o,{size:t.size}),M(o,{dir:"right",size:t.size})):o}function q(e,t={}){let{signed:r,size:o}=t,i=BigInt(e),s;o?r?s=(1n<<BigInt(o)*8n-1n)-1n:s=2n**(BigInt(o)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));let f=typeof s=="bigint"&&r?-s-1n:0;if(s&&i>s||i<f){let d=typeof e=="bigint"?"n":"";throw new oe({max:s?`${s}${d}`:void 0,min:`${f}${d}`,signed:r,size:o,value:`${e}${d}`})}let E=`0x${(r&&i<0?(1n<<BigInt(o*8))+BigInt(i):i).toString(16)}`;return o?M(E,{size:o}):E}function Ue(e,t={}){let r=en.encode(e);return he(r,t)}var Qr,en,me=R(()=>{"use strict";ze();pe();rt();Qr=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));en=new TextEncoder});function nt(e,t={}){return typeof e=="number"||typeof e=="bigint"?Mt(e,t):typeof e=="boolean"?Lt(e,t):Y(e)?xe(e,t):Le(e,t)}function Lt(e,t={}){let r=new Uint8Array(1);return r[0]=Number(e),typeof t.size=="number"?(te(r,{size:t.size}),M(r,{size:t.size})):r}function Ut(e){if(e>=J.zero&&e<=J.nine)return e-J.zero;if(e>=J.A&&e<=J.F)return e-(J.A-10);if(e>=J.a&&e<=J.f)return e-(J.a-10)}function xe(e,t={}){let r=e;t.size&&(te(r,{size:t.size}),r=M(r,{dir:"right",size:t.size}));let o=r.slice(2);o.length%2&&(o=`0${o}`);let i=o.length/2,s=new Uint8Array(i);for(let f=0,E=0;f<i;f++){let d=Ut(o.charCodeAt(E++)),F=Ut(o.charCodeAt(E++));if(d===void 0||F===void 0)throw new z(`Invalid byte sequence ("${o[E-2]}${o[E-1]}" in "${o}").`);s[f]=d*16+F}return s}function Mt(e,t){let r=q(e,t);return xe(r)}function Le(e,t={}){let r=tn.encode(e);return typeof t.size=="number"?(te(r,{size:t.size}),M(r,{dir:"right",size:t.size})):r}var tn,J,Me=R(()=>{"use strict";ee();ue();pe();rt();me();tn=new TextEncoder;J={zero:48,nine:57,A:65,F:70,a:97,f:102}});function ot(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function rn(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ye(e,...t){if(!rn(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function it(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Dt(e,t){ye(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}var at=R(()=>{"use strict"});function nn(e,t=!1){return t?{h:Number(e&De),l:Number(e>>Ht&De)}:{h:Number(e>>Ht&De)|0,l:Number(e&De)|0}}function Ot(e,t=!1){let r=new Uint32Array(e.length),o=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:s,l:f}=nn(e[i],t);[r[i],o[i]]=[s,f]}return[r,o]}var De,Ht,Nt,jt,Vt,qt,Wt=R(()=>{"use strict";De=BigInt(4294967295),Ht=BigInt(32);Nt=(e,t,r)=>e<<r|t>>>32-r,jt=(e,t,r)=>t<<r|e>>>32-r,Vt=(e,t,r)=>t<<r-32|e>>>64-r,qt=(e,t,r)=>e<<r-32|t>>>64-r});function Jt(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function on(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function ct(e){for(let t=0;t<e.length;t++)e[t]=on(e[t])}function an(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Oe(e){return typeof e=="string"&&(e=an(e)),ye(e),e}function Gt(e){let t=o=>e().update(Oe(o)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Kt(e){let t=(o,i)=>e(i).update(Oe(o)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=o=>e(o),t}var st,He,Xt=R(()=>{"use strict";at();st=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;He=class{clone(){return this._cloneInto()}}});function hn(e,t=24){let r=new Uint32Array(10);for(let o=24-t;o<24;o++){for(let f=0;f<10;f++)r[f]=e[f]^e[f+10]^e[f+20]^e[f+30]^e[f+40];for(let f=0;f<10;f+=2){let E=(f+8)%10,d=(f+2)%10,F=r[d],k=r[d+1],T=Yt(F,k,1)^r[E],v=Zt(F,k,1)^r[E+1];for(let l=0;l<50;l+=10)e[f+l]^=T,e[f+l+1]^=v}let i=e[2],s=e[3];for(let f=0;f<24;f++){let E=er[f],d=Yt(i,s,E),F=Zt(i,s,E),k=Qt[f];i=e[k],s=e[k+1],e[k]=d,e[k+1]=F}for(let f=0;f<50;f+=10){for(let E=0;E<10;E++)r[E]=e[f+E];for(let E=0;E<10;E++)e[f+E]^=~r[(E+2)%10]&r[(E+4)%10]}e[0]^=dn[o],e[1]^=pn[o]}r.fill(0)}var Qt,er,tr,sn,be,cn,un,fn,ln,dn,pn,Yt,Zt,Ne,Z,Oo,No,jo,Vo,qo,rr,Wo,Jo,nr,Go,Ko,or=R(()=>{"use strict";at();Wt();Xt();Qt=[],er=[],tr=[],sn=BigInt(0),be=BigInt(1),cn=BigInt(2),un=BigInt(7),fn=BigInt(256),ln=BigInt(113);for(let e=0,t=be,r=1,o=0;e<24;e++){[r,o]=[o,(2*r+3*o)%5],Qt.push(2*(5*o+r)),er.push((e+1)*(e+2)/2%64);let i=sn;for(let s=0;s<7;s++)t=(t<<be^(t>>un)*ln)%fn,t&cn&&(i^=be<<(be<<BigInt(s))-be);tr.push(i)}[dn,pn]=Ot(tr,!0),Yt=(e,t,r)=>r>32?Vt(e,t,r):Nt(e,t,r),Zt=(e,t,r)=>r>32?qt(e,t,r):jt(e,t,r);Ne=class e extends He{constructor(t,r,o,i=!1,s=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=o,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ot(o),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Jt(this.state)}keccak(){st||ct(this.state32),hn(this.state32,this.rounds),st||ct(this.state32),this.posOut=0,this.pos=0}update(t){it(this);let{blockLen:r,state:o}=this;t=Oe(t);let i=t.length;for(let s=0;s<i;){let f=Math.min(r-this.pos,i-s);for(let E=0;E<f;E++)o[this.pos++]^=t[s++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:o,blockLen:i}=this;t[o]^=r,r&128&&o===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){it(this,!1),ye(t),this.finish();let r=this.state,{blockLen:o}=this;for(let i=0,s=t.length;i<s;){this.posOut>=o&&this.keccak();let f=Math.min(o-this.posOut,s-i);t.set(r.subarray(this.posOut,this.posOut+f),i),this.posOut+=f,i+=f}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return ot(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Dt(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:r,suffix:o,outputLen:i,rounds:s,enableXOF:f}=this;return t||(t=new e(r,o,i,f,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=o,t.outputLen=i,t.enableXOF=f,t.destroyed=this.destroyed,t}},Z=(e,t,r)=>Gt(()=>new Ne(t,e,r)),Oo=Z(6,144,224/8),No=Z(6,136,256/8),jo=Z(6,104,384/8),Vo=Z(6,72,512/8),qo=Z(1,144,224/8),rr=Z(1,136,256/8),Wo=Z(1,104,384/8),Jo=Z(1,72,512/8),nr=(e,t,r)=>Kt((o={})=>new Ne(t,e,o.dkLen===void 0?r:o.dkLen,!0)),Go=nr(31,168,128/8),Ko=nr(31,136,256/8)});function ge(e,t){let r=t||"hex",o=rr(Y(e,{strict:!1})?nt(e):e);return r==="bytes"?o:D(o)}var ut=R(()=>{"use strict";or();ue();Me();me()});var re,ft=R(()=>{"use strict";ee();re=class extends z{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}});var ie,lt=R(()=>{"use strict";ie=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){let r=super.get(t);return super.has(t)&&r!==void 0&&(this.delete(t),super.set(t,r)),r}set(t,r){if(super.set(t,r),this.maxSize&&this.size>this.maxSize){let o=this.keys().next().value;o&&this.delete(o)}return this}}});function ir(e,t){if(dt.has(`${e}.${t}`))return dt.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),o=ge(Le(r),"bytes"),i=(t?r.substring(`${t}0x`.length):r).split("");for(let f=0;f<40;f+=2)o[f>>1]>>4>=8&&i[f]&&(i[f]=i[f].toUpperCase()),(o[f>>1]&15)>=8&&i[f+1]&&(i[f+1]=i[f+1].toUpperCase());let s=`0x${i.join("")}`;return dt.set(`${e}.${t}`,s),s}var dt,ar=R(()=>{"use strict";Me();ut();lt();dt=new ie(8192)});function we(e,t){let{strict:r=!0}=t??{},o=`${e}.${r}`;if(pt.has(o))return pt.get(o);let i=mn.test(e)?e.toLowerCase()===e?!0:r?ir(e)===e:!0:!1;return pt.set(o,i),i}var mn,pt,ht=R(()=>{"use strict";lt();ar();mn=/^0x[a-fA-F0-9]{40}$/,pt=new ie(8192)});function Q(e){return typeof e[0]=="string"?W(e):sr(e)}function sr(e){let t=0;for(let i of e)t+=i.length;let r=new Uint8Array(t),o=0;for(let i of e)r.set(i,o),o+=i.length;return r}function W(e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}var mt=R(()=>{"use strict"});function cr(e,t,r,{strict:o}={}){return Y(e,{strict:!1})?yn(e,t,r,{strict:o}):xn(e,t,r,{strict:o})}function ur(e,t){if(typeof t=="number"&&t>0&&t>L(e)-1)throw new le({offset:t,position:"start",size:L(e)})}function fr(e,t,r){if(typeof t=="number"&&typeof r=="number"&&L(e)!==r-t)throw new le({offset:r,position:"end",size:L(e)})}function xn(e,t,r,{strict:o}={}){ur(e,t);let i=e.slice(t,r);return o&&fr(i,t,r),i}function yn(e,t,r,{strict:o}={}){ur(e,t);let i=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return o&&fr(i,t,r),i}var lr=R(()=>{"use strict";tt();ue();fe()});var dr,pr=R(()=>{"use strict";dr=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/});function xt(e,t){if(e.length!==t.length)throw new Ce({expectedLength:e.length,givenLength:t.length});let r=bn({params:e,values:t}),o=bt(r);return o.length===0?"0x":o}function bn({params:e,values:t}){let r=[];for(let o=0;o<e.length;o++)r.push(yt({param:e[o],value:t[o]}));return r}function yt({param:e,value:t}){let r=Fn(e.type);if(r){let[o,i]=r;return wn(t,{length:o,param:{...e,type:i}})}if(e.type==="tuple")return Sn(t,{param:e});if(e.type==="address")return gn(t);if(e.type==="bool")return vn(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let o=e.type.startsWith("int"),[,,i="256"]=dr.exec(e.type)??[];return In(t,{signed:o,size:Number(i)})}if(e.type.startsWith("bytes"))return En(t,{param:e});if(e.type==="string")return An(t);throw new Pe(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function bt(e){let t=0;for(let s=0;s<e.length;s++){let{dynamic:f,encoded:E}=e[s];f?t+=32:t+=L(E)}let r=[],o=[],i=0;for(let s=0;s<e.length;s++){let{dynamic:f,encoded:E}=e[s];f?(r.push(q(t+i,{size:32})),o.push(E),i+=L(E)):r.push(E)}return Q([...r,...o])}function gn(e){if(!we(e))throw new re({address:e});return{dynamic:!1,encoded:V(e.toLowerCase())}}function wn(e,{length:t,param:r}){let o=t===null;if(!Array.isArray(e))throw new Re(e);if(!o&&e.length!==t)throw new ke({expectedLength:t,givenLength:e.length,type:`${r.type}[${t}]`});let i=!1,s=[];for(let f=0;f<e.length;f++){let E=yt({param:r,value:e[f]});E.dynamic&&(i=!0),s.push(E)}if(o||i){let f=bt(s);if(o){let E=q(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?Q([E,f]):E}}if(i)return{dynamic:!0,encoded:f}}return{dynamic:!1,encoded:Q(s.map(({encoded:f})=>f))}}function En(e,{param:t}){let[,r]=t.type.split("bytes"),o=L(e);if(!r){let i=e;return o%32!==0&&(i=V(i,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Q([V(q(o,{size:32})),i])}}if(o!==Number.parseInt(r))throw new Be({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:V(e,{dir:"right"})}}function vn(e){if(typeof e!="boolean")throw new z(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:V($e(e))}}function In(e,{signed:t,size:r=256}){if(typeof r=="number"){let o=2n**(BigInt(r)-(t?1n:0n))-1n,i=t?-o-1n:0n;if(e>o||e<i)throw new oe({max:o.toString(),min:i.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:q(e,{size:32,signed:t})}}function An(e){let t=Ue(e),r=Math.ceil(L(t)/32),o=[];for(let i=0;i<r;i++)o.push(V(cr(t,i*32,(i+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Q([V(q(L(t),{size:32})),...o])}}function Sn(e,{param:t}){let r=!1,o=[];for(let i=0;i<t.components.length;i++){let s=t.components[i],f=Array.isArray(e)?i:s.name,E=yt({param:s,value:e[f]});o.push(E),E.dynamic&&(r=!0)}return{dynamic:r,encoded:r?bt(o):Q(o.map(({encoded:i})=>i))}}function Fn(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var hr=R(()=>{"use strict";zt();ft();ee();ze();ht();mt();pe();fe();lr();me();pr()});function gt(e,t){if(!we(e,{strict:!1}))throw new re({address:e});if(!we(t,{strict:!1}))throw new re({address:t});return e.toLowerCase()===t.toLowerCase()}var mr=R(()=>{"use strict";ft();ht()});var eo={};qr(eo,{ClientNotFound:()=>gr,DebugInfoGatherer:()=>Sr,Deferred:()=>ne,FrakContextManager:()=>se,FrakRpcError:()=>$,PressInteractionEncoder:()=>Pr,PurchaseInteractionEncoder:()=>Rr,ReferralInteractionEncoder:()=>Ge,RetailInteractionEncoder:()=>zr,RpcErrorCodes:()=>U,WebShopInteractionEncoder:()=>_r,baseIframeProps:()=>ae,compressJson:()=>wt,createIFrameFrakClient:()=>Je,createIFrameNexusClient:()=>Qn,createIframe:()=>qe,decompressDataAndCheckHash:()=>Ie,decompressJson:()=>Et,displayEmbededWallet:()=>Nn,displayModal:()=>Ae,getProductInformation:()=>Vn,hashAndCompressData:()=>ve,interactionTypes:()=>j,modalBuilder:()=>Gn,openSso:()=>jn,processReferral:()=>Mr,productTypes:()=>N,productTypesMask:()=>Ct,referralInteraction:()=>Zn,sendInteraction:()=>Lr,sendTransaction:()=>Jn,setupClient:()=>Ln,siweAuthenticate:()=>Wn,trackPurchaseStatus:()=>qn,watchWalletStatus:()=>Ur});var Gr=Object.create,Tt=Object.defineProperty,Kr=Object.getOwnPropertyDescriptor,kt=Object.getOwnPropertyNames,Xr=Object.getPrototypeOf,Yr=Object.prototype.hasOwnProperty,Bt=(e,t)=>function(){return t||(0,e[kt(e)[0]])((t={exports:{}}).exports,t),t.exports},Zr=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of kt(t))!Yr.call(e,i)&&i!==r&&Tt(e,i,{get:()=>t[i],enumerable:!(o=Kr(t,i))||o.enumerable});return e},Ze=(e,t,r)=>(r=e!=null?Gr(Xr(e)):{},Zr(t||!e||!e.__esModule?Tt(r,"default",{value:e,enumerable:!0}):r,e)),N={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},Ct=Object.entries(N).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{}),j={press:{openArticle:"0xc0a24ffb",readArticle:"0xd5bd0fbe"},dapp:{proofVerifiableStorageUpdate:"0x2ab2aeef",callableVerifiableStorageUpdate:"0xa07da986"},webshop:{open:"0xb311798f"},referral:{referred:"0x010cc3b9",createLink:"0xb2c0f17c"},purchase:{started:"0xd87e90c3",completed:"0x8403aeb4",unsafeCompleted:"0x4d5b14e0"},retail:{customerMeeting:"0x74489004"}};var Ee=Wr(Pt(),1);var je=256,Ve;function xr(e=11){if(!Ve||je+e>256*2){Ve="",je=0;for(let t=0;t<256;t++)Ve+=(256+Math.random()*256|0).toString(16).substring(1)}return Ve.substring(je,je+++e)}hr();Me();me();mt();mr();ut();pe();var yr=Bt({"../../node_modules/async-lz-string/libs/async-lz-string.js"(e,t){(function(r,o){if(typeof e=="object"&&typeof t=="object")t.exports=o();else if(typeof define=="function"&&define.amd)define([],o);else{var i=o();for(var s in i)(typeof e=="object"?e:r)[s]=i[s]}})(e,()=>(()=>{var r={48:function(i,s,f){var E=this&&this.__awaiter||function(p,y,n,c){return new(n||(n=Promise))(function(m,S){function b(I){try{g(c.next(I))}catch(u){S(u)}}function a(I){try{g(c.throw(I))}catch(u){S(u)}}function g(I){var u;I.done?m(I.value):(u=I.value,u instanceof n?u:new n(function(A){A(u)})).then(b,a)}g((c=c.apply(p,y||[])).next())})},d=this&&this.__generator||function(p,y){var n,c,m,S,b={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return S={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function a(g){return function(I){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;S&&(S=0,u[0]&&(b=0)),b;)try{if(n=1,c&&(m=2&u[0]?c.return:u[0]?c.throw||((m=c.return)&&m.call(c),0):c.next)&&!(m=m.call(c,u[1])).done)return m;switch(c=0,m&&(u=[2&u[0],m.value]),u[0]){case 0:case 1:m=u;break;case 4:return b.label++,{value:u[1],done:!1};case 5:b.label++,c=u[1],u=[0];continue;case 7:u=b.ops.pop(),b.trys.pop();continue;default:if(!((m=(m=b.trys).length>0&&m[m.length-1])||u[0]!==6&&u[0]!==2)){b=0;continue}if(u[0]===3&&(!m||u[1]>m[0]&&u[1]<m[3])){b.label=u[1];break}if(u[0]===6&&b.label<m[1]){b.label=m[1],m=u;break}if(m&&b.label<m[2]){b.label=m[2],b.ops.push(u);break}m[2]&&b.ops.pop(),b.trys.pop();continue}u=y.call(p,b)}catch(A){u=[6,A],c=0}finally{n=m=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([g,I])}}};Object.defineProperty(s,"__esModule",{value:!0}),s.decompressFromUTF16=s.compressToUTF16=s.decompressFromBase64=s.compressToBase64=void 0;var F=f(304),k=f(134),T=new F.CompressorImpl,v=new k.DecompressorImpl,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",x={};s.compressToBase64=function(p){return E(this,void 0,void 0,function(){var y;return d(this,function(n){switch(n.label){case 0:return p===null?[2,""]:[4,T.compress(p,6,function(c){return l.charAt(c)})];case 1:switch((y=n.sent()).length%4){default:case 0:return[2,y];case 1:return[2,y+"==="];case 2:return[2,y+"=="];case 3:return[2,y+"="]}return[2]}})})},s.decompressFromBase64=function(p){return E(this,void 0,void 0,function(){return d(this,function(y){switch(y.label){case 0:return p===null?[2,""]:p===""?[2,null]:[4,v.decompress(p.length,32,function(n){return function(c,m){if(!x[c]){x[c]={};for(var S=0;S<c.length;S++)x[c][c.charAt(S)]=S}return x[c][m]}(l,p.charAt(n))})];case 1:return[2,y.sent()]}})})},s.compressToUTF16=function(p){return E(this,void 0,void 0,function(){return d(this,function(y){switch(y.label){case 0:return p===null?[2,""]:[4,T.compress(p,15,function(n){return String.fromCharCode(n+32)})];case 1:return[2,y.sent()+" "]}})})},s.decompressFromUTF16=function(p){return E(this,void 0,void 0,function(){return d(this,function(y){switch(y.label){case 0:return p===null?[2,""]:p===""?[2,null]:[4,v.decompress(p.length,16384,function(n){return p.charCodeAt(n)-32})];case 1:return[2,y.sent()]}})})}},304:function(i,s,f){var E=this&&this.__awaiter||function(v,l,x,p){return new(x||(x=Promise))(function(y,n){function c(b){try{S(p.next(b))}catch(a){n(a)}}function m(b){try{S(p.throw(b))}catch(a){n(a)}}function S(b){var a;b.done?y(b.value):(a=b.value,a instanceof x?a:new x(function(g){g(a)})).then(c,m)}S((p=p.apply(v,l||[])).next())})},d=this&&this.__generator||function(v,l){var x,p,y,n,c={label:0,sent:function(){if(1&y[0])throw y[1];return y[1]},trys:[],ops:[]};return n={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function m(S){return function(b){return function(a){if(x)throw new TypeError("Generator is already executing.");for(;n&&(n=0,a[0]&&(c=0)),c;)try{if(x=1,p&&(y=2&a[0]?p.return:a[0]?p.throw||((y=p.return)&&y.call(p),0):p.next)&&!(y=y.call(p,a[1])).done)return y;switch(p=0,y&&(a=[2&a[0],y.value]),a[0]){case 0:case 1:y=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++,p=a[1],a=[0];continue;case 7:a=c.ops.pop(),c.trys.pop();continue;default:if(!((y=(y=c.trys).length>0&&y[y.length-1])||a[0]!==6&&a[0]!==2)){c=0;continue}if(a[0]===3&&(!y||a[1]>y[0]&&a[1]<y[3])){c.label=a[1];break}if(a[0]===6&&c.label<y[1]){c.label=y[1],y=a;break}if(y&&c.label<y[2]){c.label=y[2],c.ops.push(a);break}y[2]&&c.ops.pop(),c.trys.pop();continue}a=l.call(v,c)}catch(g){a=[6,g],p=0}finally{x=y=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([S,b])}}};Object.defineProperty(s,"__esModule",{value:!0}),s.CompressorImpl=void 0;var F=f(658),k=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],T=function(){function v(){}return v.writeValueToData=function(l,x,p,y,n){if(p%4!=0||l.dataPosition+p>y-1)for(var c=0;c<p;c++)l.dataVal=l.dataVal<<1|1&x,l.dataPosition==y-1?(l.dataPosition=0,l.data.push(n(l.dataVal)),l.dataVal=0):l.dataPosition++,x>>=1;else l.dataVal<<=p,l.dataVal|=function(m,S){for(var b=0,a=0;a<S;++a)b<<=4,b|=k[15&m],m>>=4;return b}(x,p/4),l.dataPosition+=p},v.writeWToDataVal=function(l,x,p){l.dictionaryToCreate.has(l.w)?(l.w.charCodeAt(0)<256?(v.writeValueToData(l,0,l.numBits,x,p),v.writeValueToData(l,l.w.charCodeAt(0),8,x,p)):(v.writeValueToData(l,1,l.numBits,x,p),v.writeValueToData(l,l.w.charCodeAt(0),16,x,p)),l.enlargeIn--,l.enlargeIn==0&&(l.enlargeIn=Math.pow(2,l.numBits),l.numBits++),l.dictionaryToCreate.delete(l.w)):v.writeValueToData(l,l.dictionary.get(l.w),l.numBits,x,p),l.enlargeIn--,l.enlargeIn==0&&(l.enlargeIn=Math.pow(2,l.numBits),l.numBits++)},v.loopIteration=function(l,x,p,y,n){var c=l.charAt(x);n.dictionary.has(c)||(n.dictionary.set(c,n.dictSize++),n.dictionaryToCreate.set(c,!0));var m=n.w+c;n.dictionary.has(m)?n.w=m:(this.writeWToDataVal(n,p,y),n.dictionary.set(m,n.dictSize++),n.w=String(c))},v.prototype.compress=function(l,x,p){var y=this;return new Promise(function(n){return E(y,void 0,void 0,function(){var c,m;return d(this,function(S){switch(S.label){case 0:if(l==null)return n(""),[2];c={data:[],dataPosition:0,dataVal:0,dictionary:new Map,dictionaryToCreate:new Map,dictSize:3,enlargeIn:2,numBits:2,w:""},m=0,S.label=1;case 1:return m<l.length?(v.loopIteration(l,m,x,p,c),m%1e4!=0?[3,3]:[4,(0,F.wait)()]):[3,4];case 2:S.sent(),S.label=3;case 3:return m+=1,[3,1];case 4:return c.w!==""&&v.writeWToDataVal(c,x,p),v.writeValueToData(c,2,c.numBits,x,p),c.dataVal<<=x-c.dataPosition,c.data.push(p(c.dataVal)),n(c.data.join("")),[2]}})})})},v}();s.CompressorImpl=T},134:function(i,s,f){var E=this&&this.__awaiter||function(T,v,l,x){return new(l||(l=Promise))(function(p,y){function n(S){try{m(x.next(S))}catch(b){y(b)}}function c(S){try{m(x.throw(S))}catch(b){y(b)}}function m(S){var b;S.done?p(S.value):(b=S.value,b instanceof l?b:new l(function(a){a(b)})).then(n,c)}m((x=x.apply(T,v||[])).next())})},d=this&&this.__generator||function(T,v){var l,x,p,y,n={label:0,sent:function(){if(1&p[0])throw p[1];return p[1]},trys:[],ops:[]};return y={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function c(m){return function(S){return function(b){if(l)throw new TypeError("Generator is already executing.");for(;y&&(y=0,b[0]&&(n=0)),n;)try{if(l=1,x&&(p=2&b[0]?x.return:b[0]?x.throw||((p=x.return)&&p.call(x),0):x.next)&&!(p=p.call(x,b[1])).done)return p;switch(x=0,p&&(b=[2&b[0],p.value]),b[0]){case 0:case 1:p=b;break;case 4:return n.label++,{value:b[1],done:!1};case 5:n.label++,x=b[1],b=[0];continue;case 7:b=n.ops.pop(),n.trys.pop();continue;default:if(!((p=(p=n.trys).length>0&&p[p.length-1])||b[0]!==6&&b[0]!==2)){n=0;continue}if(b[0]===3&&(!p||b[1]>p[0]&&b[1]<p[3])){n.label=b[1];break}if(b[0]===6&&n.label<p[1]){n.label=p[1],p=b;break}if(p&&n.label<p[2]){n.label=p[2],n.ops.push(b);break}p[2]&&n.ops.pop(),n.trys.pop();continue}b=v.call(T,n)}catch(a){b=[6,a],x=0}finally{l=p=0}if(5&b[0])throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}([m,S])}}};Object.defineProperty(s,"__esModule",{value:!0}),s.DecompressorImpl=void 0;var F=f(658),k=function(){function T(){}return T.prototype.decompress=function(v,l,x){var p=this;return new Promise(function(y){return E(p,void 0,void 0,function(){var n,c,m;return d(this,function(S){switch(S.label){case 0:for(n={bits:0,c:null,dataIndex:1,dataPosition:l,dataVal:x(0),dictionary:new Map,dictSize:4,enlargeIn:4,entry:"",maxPower:Math.pow(2,2),numBits:3,power:1,resb:null,result:[],w:null},c=0;c<3;c+=1)n.dictionary.set(c,c);for(;n.power!=n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=l,n.dataVal=x(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;switch(n.bits){case 0:for(n.bits=0,n.maxPower=Math.pow(2,8),n.power=1;n.power!=n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=l,n.dataVal=x(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.c=String.fromCharCode(n.bits);break;case 1:for(n.bits=0,n.maxPower=Math.pow(2,16),n.power=1;n.power!==n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition===0&&(n.dataPosition=l,n.dataVal=x(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.c=String.fromCharCode(n.bits);break;case 2:return y(""),[2]}n.dictionary[3]=n.c,n.w=n.c,n.result.push(n.c),m=1,S.label=1;case 1:return m%2e4!=0?[3,3]:[4,(0,F.wait)()];case 2:S.sent(),S.label=3;case 3:if(n.dataIndex>v)return y(""),[2];for(n.bits=0,n.maxPower=Math.pow(2,n.numBits),n.power=1;n.power!=n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=l,n.dataVal=x(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;switch(n.c=n.bits){case 0:for(n.bits=0,n.maxPower=Math.pow(2,8),n.power=1;n.power!==n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=l,n.dataVal=x(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.dictionary[n.dictSize++]=String.fromCharCode(n.bits),n.c=n.dictSize-1,n.enlargeIn--;break;case 1:for(n.bits=0,n.maxPower=Math.pow(2,16),n.power=1;n.power!==n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=l,n.dataVal=x(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.dictionary[n.dictSize++]=String.fromCharCode(n.bits),n.c=n.dictSize-1,n.enlargeIn--;break;case 2:return y(n.result.join("")),[2]}if(n.enlargeIn==0&&(n.enlargeIn=Math.pow(2,n.numBits),n.numBits++),n.dictionary[n.c])n.entry=n.dictionary[n.c];else{if(n.c!==n.dictSize)return y(null),[2];n.entry=n.w+n.w.charAt(0)}return n.result.push(n.entry),n.dictionary[n.dictSize++]=n.w+n.entry.charAt(0),n.enlargeIn--,n.w=n.entry,n.enlargeIn==0&&(n.enlargeIn=Math.pow(2,n.numBits),n.numBits++),m++,[3,1];case 4:return[2]}})})})},T}();s.DecompressorImpl=k},658:function(i,s){var f=this&&this.__awaiter||function(d,F,k,T){return new(k||(k=Promise))(function(v,l){function x(n){try{y(T.next(n))}catch(c){l(c)}}function p(n){try{y(T.throw(n))}catch(c){l(c)}}function y(n){var c;n.done?v(n.value):(c=n.value,c instanceof k?c:new k(function(m){m(c)})).then(x,p)}y((T=T.apply(d,F||[])).next())})},E=this&&this.__generator||function(d,F){var k,T,v,l,x={label:0,sent:function(){if(1&v[0])throw v[1];return v[1]},trys:[],ops:[]};return l={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function p(y){return function(n){return function(c){if(k)throw new TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(x=0)),x;)try{if(k=1,T&&(v=2&c[0]?T.return:c[0]?T.throw||((v=T.return)&&v.call(T),0):T.next)&&!(v=v.call(T,c[1])).done)return v;switch(T=0,v&&(c=[2&c[0],v.value]),c[0]){case 0:case 1:v=c;break;case 4:return x.label++,{value:c[1],done:!1};case 5:x.label++,T=c[1],c=[0];continue;case 7:c=x.ops.pop(),x.trys.pop();continue;default:if(!((v=(v=x.trys).length>0&&v[v.length-1])||c[0]!==6&&c[0]!==2)){x=0;continue}if(c[0]===3&&(!v||c[1]>v[0]&&c[1]<v[3])){x.label=c[1];break}if(c[0]===6&&x.label<v[1]){x.label=v[1],v=c;break}if(v&&x.label<v[2]){x.label=v[2],x.ops.push(c);break}v[2]&&x.ops.pop(),x.trys.pop();continue}c=F.call(d,x)}catch(m){c=[6,m],T=0}finally{k=v=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([y,n])}}};Object.defineProperty(s,"__esModule",{value:!0}),s.wait=void 0,s.wait=function(){return f(this,void 0,void 0,function(){return E(this,function(d){return[2,new Promise(function(F){setTimeout(F,0)})]})})}}},o={};return function i(s){var f=o[s];if(f!==void 0)return f.exports;var E=o[s]={exports:{}};return r[s].call(E.exports,E,E.exports,i),E.exports}(48)})())}}),$=class extends Error{constructor(e,t,r){super(t),this.code=e,this.data=r}},br=class extends ${constructor(e){super(U.internalError,e)}},gr=class extends ${constructor(){super(U.clientNotConnected,"Client not found")}},U={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006},ne=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve=e=>{this._resolve?.(e)};reject=e=>{this._reject?.(e)}},Tn=Ze(yr(),1);async function ve(e){let t=(0,Ee.sha256)(JSON.stringify(e)),r={...e,validationHash:t},o=await wt(r),i=(0,Ee.sha256)(o);return{compressed:o,compressedHash:i}}async function wt(e){return(0,Tn.compressToBase64)(JSON.stringify(e))}var kn=Ze(yr(),1);async function Ie(e){if(!(e?.compressed&&e?.compressedHash))throw new $(U.corruptedResponse,"Missing compressed data");let t=await Et(e.compressed);if(!t)throw new $(U.corruptedResponse,"Invalid compressed data");if(!t?.validationHash)throw new $(U.corruptedResponse,"Missing validation hash");if((0,Ee.sha256)(e.compressed)!==e.compressedHash)throw new $(U.corruptedResponse,"Invalid compressed hash");let{validationHash:o,...i}=t;if((0,Ee.sha256)(JSON.stringify(i))!==t.validationHash)throw new $(U.corruptedResponse,"Invalid data validation hash");return t}async function Et(e){let t=await(0,kn.decompressFromBase64)(e);try{return JSON.parse(t)}catch(r){return console.error("Invalid compressed data",{e:r,decompressed:t}),null}}var ae={id:"nexus-wallet",name:"nexus-wallet",allow:"publickey-credentials-get *; clipboard-write; web-share *",style:{width:"0",height:"0",border:"0",position:"absolute",zIndex:2000001,top:"-1000px",left:"-1000px"}};function qe({walletBaseUrl:e,config:t}){let r=document.querySelector("#nexus-wallet");r&&r.remove();let o=document.createElement("iframe");return o.id=ae.id,o.name=ae.name,o.allow=ae.allow,o.style.zIndex=ae.style.zIndex.toString(),vt({iframe:o,isVisible:!1}),document.body.appendChild(o),new Promise(i=>{o?.addEventListener("load",()=>i(o)),o.src=`${t?.walletUrl??e??"https://wallet.frak.id"}/listener`})}function vt({iframe:e,isVisible:t}){if(!t){e.style.width="0",e.style.height="0",e.style.border="0",e.style.position="fixed",e.style.top="-1000px",e.style.left="-1000px";return}e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.pointerEvents="auto"}var It="fCtx";function Bn(e){return btoa(Array.from(e,t=>String.fromCharCode(t)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Cn(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(t===0?0:4-t),"=")),r=>r.charCodeAt(0))}function wr(e){if(e?.r)try{let t=xe(e.r);return Bn(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function Er(e){if(!(!e||e.length===0))try{let t=Cn(e);return{r:he(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function vr({url:e}){if(!e)return null;let r=new URL(e).searchParams.get(It);return r?Er(r):null}function Ir({url:e,context:t}){if(!e)return null;let r=vr({url:e}),o=r?{...r,...t}:t;if(!o.r)return null;let i=wr(o);if(!i)return null;let s=new URL(e);return s.searchParams.set(It,i),s.toString()}function Ar(e){let t=new URL(e);return t.searchParams.delete(It),t.toString()}function Pn({url:e,context:t}){if(!window.location?.href||typeof window>"u"){console.error("No window found, can't update context");return}let r=e??window.location.href,o;t!==null?o=Ir({url:r,context:t}):o=Ar(r),o&&window.history.replaceState(null,"",o.toString())}var se={compress:wr,decompress:Er,parse:vr,update:Ir,remove:Ar,replaceUrl:Pn};var We="nexus-wallet-backup",Sr=class Fr{config;iframe;isSetupDone=!1;lastResponse=null;lastRequest=null;constructor(t,r){this.config=t,this.iframe=r,this.lastRequest=null,this.lastResponse=null}setLastResponse(t){this.lastResponse={event:t.data,origin:t.origin,timestamp:Date.now()}}setLastRequest(t,r){this.lastRequest={event:t,target:r,timestamp:Date.now()}}updateSetupStatus(t){this.isSetupDone=t}base64Encode(t){try{return btoa(JSON.stringify(t))}catch(r){return console.warn("Failed to encode debug data",r),btoa("Failed to encode data")}}getIframeStatus(){return this.iframe?{loading:this.iframe.hasAttribute("loading"),url:this.iframe.src,readyState:this.iframe.contentDocument?.readyState?this.iframe.contentDocument.readyState==="complete"?1:0:-1,contentWindow:!!this.iframe.contentWindow,isConnected:this.iframe.isConnected}:null}getNavigatorInfo(){return navigator?{userAgent:navigator.userAgent,language:navigator.language,onLine:navigator.onLine,screenWidth:window.screen.width,screenHeight:window.screen.height,pixelRatio:window.devicePixelRatio}:null}gatherDebugInfo(t){let r=this.getIframeStatus(),o=this.getNavigatorInfo(),i="Unknown";return t instanceof $?i=`FrakRpcError: ${t.code} '${t.message}'`:t instanceof Error?i=t.message:typeof t=="string"&&(i=t),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):"no-config",navigatorInfo:o?this.base64Encode(o):"no-navigator",iframeStatus:r?this.base64Encode(r):"not-iframe",lastRequest:this.lastRequest?this.base64Encode(this.lastRequest):"No Frak request logged",lastResponse:this.lastResponse?this.base64Encode(this.lastResponse):"No Frak response logged",clientStatus:this.isSetupDone?"setup":"not-setup",error:i}}static empty(){return new Fr}formatDebugInfo(t){let r=this.gatherDebugInfo(t);return`
7
7
  Debug Information:
8
8
  -----------------
9
9
  Timestamp: ${r.timestamp}
@@ -15,7 +15,7 @@
15
15
  Last Response: ${r.lastResponse}
16
16
  Client Status: ${r.clientStatus}
17
17
  Error: ${r.error}
18
- `.trim()}};function Nt(){let e=new Map;return{createChannel:t=>{let r=Math.random().toString(36).substring(7);return e.set(r,t),r},getRpcResolver:t=>e.get(t),removeChannel:t=>e.delete(t),destroy:()=>e.clear()}}var ie={id:"nexus-wallet",name:"nexus-wallet",allow:"publickey-credentials-get *; clipboard-write; web-share *",style:{width:"0",height:"0",border:"0",position:"absolute",zIndex:1e3,top:"-1000px",left:"-1000px"}};function be({walletBaseUrl:e,config:t}){let r=document.querySelector("#nexus-wallet");r&&r.remove();let o=document.createElement("iframe");return o.id=ie.id,o.name=ie.name,o.allow=ie.allow,o.style.zIndex=ie.style.zIndex.toString(),dt({iframe:o,isVisible:!1}),document.body.appendChild(o),new Promise(a=>{o?.addEventListener("load",()=>a(o)),o.src=`${t?.walletUrl??e??"https://wallet.frak.id"}/listener`})}function dt({iframe:e,isVisible:t}){if(!t){e.style.width="0",e.style.height="0",e.style.border="0",e.style.position="fixed",e.style.top="-1000px",e.style.left="-1000px";return}e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.pointerEvents="auto"}function Vt({iframe:e}){let t=new W;return{handleEvent:async o=>{switch(o.iframeLifecycle){case"connected":t.resolve(!0);break;case"do-backup":o.data.backup?localStorage.setItem(le,o.data.backup):localStorage.removeItem(le);break;case"remove-backup":localStorage.removeItem(le);break;case"show":case"hide":dt({iframe:e,isVisible:o.iframeLifecycle==="show"});break;case"handshake":{console.log("Received handshake event",{token:o.data.token}),e.contentWindow?.postMessage({clientLifecycle:"handshake-response",data:{token:o.data.token,currentUrl:window.location.href}},"*");break}}},isConnected:t.promise}}function jt({frakWalletUrl:e,iframe:t,channelManager:r,iframeLifecycleManager:o,debugInfo:a}){if(typeof window>"u")throw new R(D.configError,"iframe client should be used in the browser");if(!t.contentWindow)throw new R(D.configError,"The iframe does not have a product window");let p=t.contentWindow;async function u(T){if(!T.origin)return;try{if(new URL(T.origin).origin.toLowerCase()!==new URL(e).origin.toLowerCase())return}catch(h){console.log("Unable to check frak msg origin",h);return}if(typeof T.data!="object")return;if(a.setLastResponse(T),"iframeLifecycle"in T.data){await o.handleEvent(T.data);return}if("clientLifecycle"in T.data){console.error("Client lifecycle event received on the client side, dismissing it");return}let y=T.data.id,f=r.getRpcResolver(y);f&&await f(T.data)}window.addEventListener("message",u);function S(T){p.postMessage(T,{targetOrigin:e}),a.setLastRequest(T,e)}function d(){window.removeEventListener("message",u)}return{sendEvent:S,cleanup:d}}function se({config:e,iframe:t}){let r=Nt(),o=Vt({iframe:t}),a=new ae(e,t),p=jt({frakWalletUrl:e?.walletUrl??"https://wallet.frak.id",iframe:t,channelManager:r,iframeLifecycleManager:o,debugInfo:a}),u=async f=>{if(!await o.isConnected)throw new R(D.clientNotConnected,"The iframe provider isn't connected yet");let i=new W,g=r.createChannel(async s=>{let w=await ne(s.data);w.error?i.reject(new R(w.error.code,w.error.message,w.error?.data)):i.resolve(w.result),r.removeChannel(g)}),n=await oe(f);return p.sendEvent({id:g,topic:f.method,data:n}),i.promise},S=async(f,h)=>{if(!await o.isConnected)throw new R(D.clientNotConnected,"The iframe provider isn't connected yet");let g=r.createChannel(async s=>{let w=await ne(s.data);if(w.result)h(w.result);else throw new He("No valid result in the response")}),n=await oe(f);p.sendEvent({id:g,topic:f.method,data:n})},d=co(p,o),T=async()=>{d(),r.destroy(),p.cleanup(),t.remove()},y=po({config:e,messageHandler:p,lifecycleManager:o}).then(()=>a.updateSetupStatus(!0));return{config:e,debugInfo:a,waitForConnection:o.isConnected,waitForSetup:y,request:u,listenerRequest:S,destroy:T}}function co(e,t){let a,p,u=()=>e.sendEvent({clientLifecycle:"heartbeat"});async function S(){u(),a=setInterval(u,100),p=setTimeout(()=>{d(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,d()}function d(){a&&clearInterval(a),p&&clearTimeout(p)}return S(),d}async function po({config:e,messageHandler:t,lifecycleManager:r}){await r.isConnected;let o=async()=>{let p=e.metadata.css;p&&t.sendEvent({clientLifecycle:"modal-css",data:{cssLink:p}})},a=async()=>{if(typeof window>"u")return;let p=window.localStorage.getItem(le);p&&t.sendEvent({clientLifecycle:"restore-backup",data:{backup:p}})};await Promise.all([o(),a()])}var Ze=256,Qe;function kr(e=11){if(!Qe||Ze+e>256*2){Qe="",Ze=0;for(let t=0;t<256;t++)Qe+=(256+Math.random()*256|0).toString(16).substring(1)}return Qe.substring(Ze,Ze+++e)}Ar();Ke();ve();kt();Cr();Tt();Fe();var Dt="fCtx";function Uo(e){return btoa(Array.from(e,t=>String.fromCharCode(t)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function $o(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(t===0?0:4-t),"=")),r=>r.charCodeAt(0))}function Pr(e){if(e?.r)try{let t=Ae(e.r);return Uo(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function Mr(e){if(!(!e||e.length===0))try{let t=$o(e);return{r:Ee(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function Rr({url:e}){if(!e)return null;let r=new URL(e).searchParams.get(Dt);return r?Mr(r):null}function Br({url:e,context:t}){if(!e)return null;let r=Rr({url:e}),o=r?{...r,...t}:t;if(!o.r)return null;let a=Pr(o);if(!a)return null;let p=new URL(e);return p.searchParams.set(Dt,a),p.toString()}function Dr(e){let t=new URL(e);return t.searchParams.delete(Dt),t.toString()}function Oo({url:e,context:t}){if(!window.location?.href||typeof window>"u"){console.error("No window found, can't update context");return}let r=e??window.location.href,o;t!==null?o=Br({url:r,context:t}):o=Dr(r),o&&window.history.replaceState(null,"",o.toString())}var re={compress:Pr,decompress:Mr,parse:Rr,update:Br,remove:Dr,replaceUrl:Oo};async function Ht({config:e}){let t=await be({config:e});if(!t){console.error("Failed to create iframe");return}let r=se({config:e,iframe:t});if(await r.waitForSetup,!await r.waitForConnection){console.error("Failed to connect to client");return}return r}function Hr(e){document.readyState==="complete"||document.readyState==="interactive"?setTimeout(e,1):document.addEventListener?document.addEventListener("DOMContentLoaded",e):document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&e()})}async function Lr(e,t){return document.getElementById(e)?Promise.resolve(!0):new Promise((r,o)=>{let a=document.createElement("script");a.id=e,a.src=t,a.async=!0,a.onload=()=>r(!0),a.onerror=()=>o(new Error(`Script load error for ${t}`)),document.head.appendChild(a)})}function zr(){_o(),No()}function _o(){let e="https://gapianne.com/cdn/shop/files/logo-gapianne_7a65f4c4-54e8-4831-afa2-0849e4c5f8de.png";window.FrakSetup.config={walletUrl:"https://wallet.frak.id",metadata:{name:"Gapianne"},domain:window.location.host},window.FrakSetup.modalConfig={login:{allowSso:!0,ssoMetadata:{logoUrl:e,homepageLink:"https://gapianne.com/"}},metadata:{header:{icon:e},isDismissible:!0,lang:"fr"}},window.FrakSetup.modalShareConfig={popupTitle:"Pr\xEAt(e) \xE0 r\xE9v\xE9ler un secret bien-\xEAtre ?",text:"D\xE9couvre ce produit chez Gapianne",link:window.location.href}}function No(){let e=document.querySelectorAll("#nexus-share-button > button");for(let t of Array.from(e)){let r=document.createElement("frak-button-share");r.setAttribute("text","PARTAGE ET GAGNE"),r.setAttribute("classname","button w-full"),t.replaceWith(r)}}function Ur(){Vo(),jo()}function Vo(){window.FrakSetup.config={walletUrl:"https://wallet.frak.id",metadata:{name:"Moov360"},domain:window.location.host},window.FrakSetup.modalConfig={login:{allowSso:!0,ssoMetadata:{logoUrl:"https://moov360.com/wp-content/uploads/2022/07/MOOV360noir-1.png",homepageLink:"https://moov360.com/"}},metadata:{header:{icon:"https://moov360.com/wp-content/uploads/2022/07/MOOV360noir-1.png"},lang:"fr"}},window.FrakSetup.modalShareConfig={popupTitle:"Partage ce produit avec tes amis",text:"D\xE9couvre ce produit chez Moov360!",link:window.location.href}}function jo(){let e=document.querySelectorAll("a.frak-link");for(let t of Array.from(e)){let r=document.createElement("frak-button-share");r.setAttribute("text","Partage et gagne {REWARD}!"),r.setAttribute("no-reward-text","Partage et gagne"),r.setAttribute("use-reward","true"),r.setAttribute("classname","button"),r.style.display="block",r.style.marginTop="20px",t.replaceWith(r)}}var Wo={"moov360.com":Ur,"gapianne.com":zr};function $r(){let e=Wo[window.location.host];e&&(e(),Lr("frak-components","https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/cdn/components.js"))}var $={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},Or=Object.entries($).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{});var _={press:{openArticle:"0xc0a24ffb",readArticle:"0xd5bd0fbe"},dapp:{proofVerifiableStorageUpdate:"0x2ab2aeef",callableVerifiableStorageUpdate:"0xa07da986"},webshop:{open:"0xb311798f"},referral:{referred:"0x010cc3b9",createLink:"0xb2c0f17c"},purchase:{started:"0xd87e90c3",completed:"0x8403aeb4",unsafeCompleted:"0x4d5b14e0"},retail:{customerMeeting:"0x74489004"}};function et(e,t){if(!t)return e.request({method:"frak_listenToWalletStatus"}).then(a=>(_r(a.interactionToken),a));let r=new W,o=!1;return e.listenerRequest({method:"frak_listenToWalletStatus"},a=>{t(a),_r(a.interactionToken),o||(r.resolve(a),o=!0)}).then(()=>r.promise)}function _r(e){typeof window>"u"||(e?window.sessionStorage.setItem("frak-wallet-interaction-token",e):window.sessionStorage.removeItem("frak.interaction-token"))}function Nr({domain:e}){let t=e??window.location.host;return Pe(U(t))}async function tt(e,{productId:t,interaction:r,validation:o}){let a=t??Nr(e.config);return await e.request({method:"frak_sendInteraction",params:[a,r,o]})}async function J(e,{steps:t,metadata:r}){return await e.request({method:"frak_displayModal",params:[t,e.config.metadata.name,r]})}async function Vr(e,t){await e.request({method:"frak_displayEmbededWallet",params:[t,e.config.metadata.name]})}async function jr(e,t){let{metadata:r}=e.config;await e.request({method:"frak_sso",params:[t,r.name,r.css]})}async function Wr(e){return await e.request({method:"frak_getProductInformation"})}async function qr(e){if(typeof window>"u"){console.warn("[Frak] No window found, can't track purchase");return}let t=window.sessionStorage.getItem("frak-wallet-interaction-token");if(!t){console.warn("[Frak] No frak session found, skipping purchase check");return}await fetch("https://backend.frak.id/interactions/listenForPurchase",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","x-wallet-sdk-auth":t},body:JSON.stringify(e)})}function Lt(){return kr(96)}async function Kr(e,{siwe:t,metadata:r}){let o=e.config?.domain??window.location.host,a=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`,p={...t,statement:a,nonce:t?.nonce??Lt(),uri:t?.uri??`https://${o}`,version:t?.version??"1",domain:o};return(await J(e,{metadata:r,steps:{login:{},siweAuthenticate:{siwe:p}}})).siweAuthenticate}async function Jr(e,{tx:t,metadata:r}){return(await J(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function Gr(e,{metadata:t,login:r,openSession:o}){return rt(e,{steps:{login:r??{},openSession:o??{}},metadata:t})}function rt(e,t){function r(u){return rt(e,{...t,steps:{...t.steps,sendTransaction:u}})}function o(u){return rt(e,{...t,steps:{...t.steps,final:{...u,action:{key:"reward"}}}})}function a(u,S){return rt(e,{...t,steps:{...t.steps,final:{...S,action:{key:"sharing",options:u}}}})}async function p(u){return u&&(t.metadata=u(t.metadata??{})),await J(e,t)}return{params:t,sendTx:r,reward:o,sharing:a,display:p}}var Xr={openArticle({articleId:e}){let t=j([_.press.openArticle,z(e,{size:32})]);return{handlerTypeDenominator:U($.press),interactionData:t}},readArticle({articleId:e}){let t=j([_.press.readArticle,z(e,{size:32})]);return{handlerTypeDenominator:U($.press),interactionData:t}}};var ot={createLink(){return{handlerTypeDenominator:U($.referral),interactionData:_.referral.createLink}},referred({referrer:e}){let t=j([_.referral.referred,z(e,{size:32})]);return{handlerTypeDenominator:U($.referral),interactionData:t}}};var Yr={startPurchase({purchaseId:e}){let t=j([_.purchase.started,z(e,{size:32})]);return{handlerTypeDenominator:U($.purchase),interactionData:t}},completedPurchase({purchaseId:e,proof:t}){let r=Pt([{type:"uint256"},{type:"bytes32[]"}],[BigInt(e),t]),o=j([_.purchase.completed,r]);return{handlerTypeDenominator:U($.purchase),interactionData:o}},unsafeCompletedPurchase({purchaseId:e}){let t=j([_.purchase.unsafeCompleted,z(e,{size:32})]);return{handlerTypeDenominator:U($.purchase),interactionData:t}}};var Zr={open(){return{handlerTypeDenominator:U($.webshop),interactionData:_.webshop.open}}};var Qr={customerMeeting({agencyId:e}){let t=j([_.retail.customerMeeting,z(e,{size:32})]);return{handlerTypeDenominator:U($.retail),interactionData:t}}};async function nt(e,{walletStatus:t,frakContext:r,modalConfig:o,productId:a,options:p}){let u=!1;async function S(){if(!u)return u=!0,Ko(e,{modalConfig:o,walletStatus:t})}async function d(T){let y=ot.referred({referrer:T});await tt(e,{productId:a,interaction:y})}try{let{status:T,currentWallet:y}=await qo({initialWalletStatus:t,getFreshWalletStatus:S,pushReferralInteraction:d,frakContext:r});return re.replaceUrl({url:window.location?.href,context:p?.alwaysAppendUrl?{r:y}:null}),T}catch(T){return console.log("Error processing referral",{error:T}),re.replaceUrl({url:window.location?.href,context:p?.alwaysAppendUrl?{r:t?.wallet}:null}),Jo(T)}}async function qo({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:r,frakContext:o}){let a=e?.wallet;return o?.r?(a||(a=await t()),a&&Bt(o.r,a)?{status:"self-referral",currentWallet:a}:(e?.interactionSession||(a=await t()),await r(o.r),{status:"success",currentWallet:a})):{status:"no-referrer",currentWallet:a}}async function Ko(e,{modalConfig:t,walletStatus:r}){return r?.interactionSession?r.wallet??void 0:t?(await J(e,t))?.login?.wallet??void 0:void 0}function Jo(e){if(e instanceof R)switch(e.code){case D.walletNotConnected:return"no-wallet";case D.serverErrorForInteractionDelegation:return"no-session";default:return"error"}return"error"}async function eo(e,{productId:t,modalConfig:r,options:o}={}){let a=re.parse({url:window.location.href}),p=await et(e);try{return await nt(e,{walletStatus:p,frakContext:a,modalConfig:r,productId:t,options:o})}catch(u){console.warn("Error processing referral",{error:u})}}var Go=se;Hr(()=>$r());return so(Xo);})();
18
+ `.trim()}};function Rn(){let e=new Map;return{createChannel:t=>{let r=Math.random().toString(36).substring(7);return e.set(r,t),r},getRpcResolver:t=>e.get(t),removeChannel:t=>e.delete(t),destroy:()=>e.clear()}}function _n({iframe:e}){let t=new ne;return{handleEvent:async o=>{switch(o.iframeLifecycle){case"connected":t.resolve(!0);break;case"do-backup":o.data.backup?localStorage.setItem(We,o.data.backup):localStorage.removeItem(We);break;case"remove-backup":localStorage.removeItem(We);break;case"show":case"hide":vt({iframe:e,isVisible:o.iframeLifecycle==="show"});break;case"handshake":{e.contentWindow?.postMessage({clientLifecycle:"handshake-response",data:{token:o.data.token,currentUrl:window.location.href}},"*");break}}},isConnected:t.promise}}function zn({frakWalletUrl:e,iframe:t,channelManager:r,iframeLifecycleManager:o,debugInfo:i}){if(typeof window>"u")throw new $(U.configError,"iframe client should be used in the browser");if(!t.contentWindow)throw new $(U.configError,"The iframe does not have a product window");let s=t.contentWindow;async function f(F){if(!F.origin)return;try{if(new URL(F.origin).origin.toLowerCase()!==new URL(e).origin.toLowerCase())return}catch(v){console.log("Unable to check frak msg origin",v);return}if(typeof F.data!="object")return;if(i.setLastResponse(F),"iframeLifecycle"in F.data){await o.handleEvent(F.data);return}if("clientLifecycle"in F.data){console.error("Client lifecycle event received on the client side, dismissing it");return}let k=F.data.id,T=r.getRpcResolver(k);T&&await T(F.data)}window.addEventListener("message",f);function E(F){s.postMessage(F,{targetOrigin:e}),i.setLastRequest(F,e)}function d(){window.removeEventListener("message",f)}return{sendEvent:E,cleanup:d}}function Je({config:e,iframe:t}){let r=Rn(),o=_n({iframe:t}),i=new Sr(e,t),s=zn({frakWalletUrl:e?.walletUrl??"https://wallet.frak.id",iframe:t,channelManager:r,iframeLifecycleManager:o,debugInfo:i}),f=async T=>{if(!await o.isConnected)throw new $(U.clientNotConnected,"The iframe provider isn't connected yet");let l=new ne,x=r.createChannel(async y=>{let n=await Ie(y.data);n.error?l.reject(new $(n.error.code,n.error.message,n.error?.data)):l.resolve(n.result),r.removeChannel(x)}),p=await ve(T);return s.sendEvent({id:x,topic:T.method,data:p}),l.promise},E=async(T,v)=>{if(!await o.isConnected)throw new $(U.clientNotConnected,"The iframe provider isn't connected yet");let x=r.createChannel(async y=>{let n=await Ie(y.data);if(n.result)v(n.result);else throw new br("No valid result in the response")}),p=await ve(T);s.sendEvent({id:x,topic:T.method,data:p})},d=$n(s,o),F=async()=>{d(),r.destroy(),s.cleanup(),t.remove()},k=Un({config:e,messageHandler:s,lifecycleManager:o}).then(()=>i.updateSetupStatus(!0));return{config:e,debugInfo:i,waitForConnection:o.isConnected,waitForSetup:k,request:f,listenerRequest:E,destroy:F}}function $n(e,t){let i,s,f=()=>e.sendEvent({clientLifecycle:"heartbeat"});async function E(){f(),i=setInterval(f,100),s=setTimeout(()=>{d(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,d()}function d(){i&&clearInterval(i),s&&clearTimeout(s)}return E(),d}async function Un({config:e,messageHandler:t,lifecycleManager:r}){await r.isConnected;let o=async()=>{let s=e.metadata.css;s&&t.sendEvent({clientLifecycle:"modal-css",data:{cssLink:s}})},i=async()=>{if(typeof window>"u")return;let s=window.localStorage.getItem(We);s&&t.sendEvent({clientLifecycle:"restore-backup",data:{backup:s}})};await Promise.all([o(),i()])}async function Ln({config:e}){let t=await qe({config:e});if(!t){console.error("Failed to create iframe");return}let r=Je({config:e,iframe:t});if(await r.waitForSetup,!await r.waitForConnection){console.error("Failed to connect to client");return}return r}function Tr(e){document.readyState==="complete"||document.readyState==="interactive"?setTimeout(e,1):document.addEventListener?document.addEventListener("DOMContentLoaded",e):document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&e()})}async function kr(e,t){return document.getElementById(e)?Promise.resolve(!0):new Promise((r,o)=>{let i=document.createElement("script");i.id=e,i.src=t,i.async=!0,i.onload=()=>r(!0),i.onerror=()=>o(new Error(`Script load error for ${t}`)),document.head.appendChild(i)})}function Br(){Mn(),Dn()}function Mn(){let e="https://gapianne.com/cdn/shop/files/logo-gapianne_7a65f4c4-54e8-4831-afa2-0849e4c5f8de.png";window.FrakSetup.config={walletUrl:"https://wallet.frak.id",metadata:{name:"Gapianne"},domain:window.location.host},window.FrakSetup.modalConfig={login:{allowSso:!0,ssoMetadata:{logoUrl:e,homepageLink:"https://gapianne.com/"}},metadata:{header:{icon:e},isDismissible:!0,lang:"fr"}},window.FrakSetup.modalShareConfig={popupTitle:"Pr\xEAt(e) \xE0 r\xE9v\xE9ler un secret bien-\xEAtre ?",text:"D\xE9couvre ce produit chez Gapianne",link:window.location.href},window.FrakSetup.modalWalletConfig={metadata:{logo:e,homepageLink:"https://gapianne.com/",lang:"fr",position:"left"}}}function Dn(){let e=document.querySelectorAll("#nexus-share-button > button");for(let t of Array.from(e)){let r=document.createElement("frak-button-share");r.setAttribute("text","PARTAGE ET GAGNE {REWARD} !"),r.setAttribute("no-reward-text","PARTAGE ET GAGNE"),r.setAttribute("use-reward","true"),r.setAttribute("classname","button w-full"),t.replaceWith(r)}}var Hn={"gapianne.com":Br};function Cr(){let e=Hn[window.location.host];e&&(e(),kr("frak-components","https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/cdn/components.js"))}var Pr={openArticle({articleId:e}){let t=W([j.press.openArticle,M(e,{size:32})]);return{handlerTypeDenominator:D(N.press),interactionData:t}},readArticle({articleId:e}){let t=W([j.press.readArticle,M(e,{size:32})]);return{handlerTypeDenominator:D(N.press),interactionData:t}}},Ge={createLink(){return{handlerTypeDenominator:D(N.referral),interactionData:j.referral.createLink}},referred({referrer:e}){let t=W([j.referral.referred,M(e,{size:32})]);return{handlerTypeDenominator:D(N.referral),interactionData:t}}},Rr={startPurchase({purchaseId:e}){let t=W([j.purchase.started,M(e,{size:32})]);return{handlerTypeDenominator:D(N.purchase),interactionData:t}},completedPurchase({purchaseId:e,proof:t}){let r=xt([{type:"uint256"},{type:"bytes32[]"}],[BigInt(e),t]),o=W([j.purchase.completed,r]);return{handlerTypeDenominator:D(N.purchase),interactionData:o}},unsafeCompletedPurchase({purchaseId:e}){let t=W([j.purchase.unsafeCompleted,M(e,{size:32})]);return{handlerTypeDenominator:D(N.purchase),interactionData:t}}},_r={open(){return{handlerTypeDenominator:D(N.webshop),interactionData:j.webshop.open}}},zr={customerMeeting({agencyId:e}){let t=W([j.retail.customerMeeting,M(e,{size:32})]);return{handlerTypeDenominator:D(N.retail),interactionData:t}}};function At(){return xr(96)}function Ur(e,t){if(!t)return e.request({method:"frak_listenToWalletStatus"}).then(i=>($r(i.interactionToken),i));let r=new ne,o=!1;return e.listenerRequest({method:"frak_listenToWalletStatus"},i=>{t(i),$r(i.interactionToken),o||(r.resolve(i),o=!0)}).then(()=>r.promise)}function $r(e){typeof window>"u"||(e?window.sessionStorage.setItem("frak-wallet-interaction-token",e):window.sessionStorage.removeItem("frak.interaction-token"))}function On({domain:e}){let t=e??window.location.host;return ge(D(t))}async function Lr(e,{productId:t,interaction:r,validation:o}){let i=t??On(e.config);return await e.request({method:"frak_sendInteraction",params:[i,r,o]})}async function Ae(e,{steps:t,metadata:r}){return await e.request({method:"frak_displayModal",params:[t,e.config.metadata.name,r]})}async function Nn(e,t){await e.request({method:"frak_displayEmbededWallet",params:[t,e.config.metadata.name]})}async function jn(e,t){let{metadata:r}=e.config;await e.request({method:"frak_sso",params:[t,r.name,r.css]})}async function Vn(e){return await e.request({method:"frak_getProductInformation"})}async function qn(e){if(typeof window>"u"){console.warn("[Frak] No window found, can't track purchase");return}let t=window.sessionStorage.getItem("frak-wallet-interaction-token");if(!t){console.warn("[Frak] No frak session found, skipping purchase check");return}await fetch("https://backend.frak.id/interactions/listenForPurchase",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","x-wallet-sdk-auth":t},body:JSON.stringify(e)})}async function Wn(e,{siwe:t,metadata:r}){let o=e.config?.domain??window.location.host,i=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`,s={...t,statement:i,nonce:t?.nonce??At(),uri:t?.uri??`https://${o}`,version:t?.version??"1",domain:o};return(await Ae(e,{metadata:r,steps:{login:{},siweAuthenticate:{siwe:s}}})).siweAuthenticate}async function Jn(e,{tx:t,metadata:r}){return(await Ae(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function Gn(e,{metadata:t,login:r,openSession:o}){return Ke(e,{steps:{login:r??{},openSession:o??{}},metadata:t})}function Ke(e,t){function r(f){return Ke(e,{...t,steps:{...t.steps,sendTransaction:f}})}function o(f){return Ke(e,{...t,steps:{...t.steps,final:{...f,action:{key:"reward"}}}})}function i(f,E){return Ke(e,{...t,steps:{...t.steps,final:{...E,action:{key:"sharing",options:f}}}})}async function s(f){return f&&(t.metadata=f(t.metadata??{})),await Ae(e,t)}return{params:t,sendTx:r,reward:o,sharing:i,display:s}}async function Mr(e,{walletStatus:t,frakContext:r,modalConfig:o,productId:i,options:s}){let f=!1;async function E(){if(!f)return f=!0,Xn(e,{modalConfig:o,walletStatus:t})}async function d(F){let k=Ge.referred({referrer:F});await Lr(e,{productId:i,interaction:k})}try{let{status:F,currentWallet:k}=await Kn({initialWalletStatus:t,getFreshWalletStatus:E,pushReferralInteraction:d,frakContext:r});return se.replaceUrl({url:window.location?.href,context:s?.alwaysAppendUrl?{r:k}:null}),F}catch(F){return console.log("Error processing referral",{error:F}),se.replaceUrl({url:window.location?.href,context:s?.alwaysAppendUrl?{r:t?.wallet}:null}),Yn(F)}}async function Kn({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:r,frakContext:o}){let i=e?.wallet;return o?.r?(i||(i=await t()),i&&gt(o.r,i)?{status:"self-referral",currentWallet:i}:(e?.interactionSession||(i=await t()),await r(o.r),{status:"success",currentWallet:i})):{status:"no-referrer",currentWallet:i}}async function Xn(e,{modalConfig:t,walletStatus:r}){return r?.interactionSession?r.wallet??void 0:t?(await Ae(e,t))?.login?.wallet??void 0:void 0}function Yn(e){if(e instanceof $)switch(e.code){case U.walletNotConnected:return"no-wallet";case U.serverErrorForInteractionDelegation:return"no-session";default:return"error"}return"error"}async function Zn(e,{productId:t,modalConfig:r,options:o}={}){let i=se.parse({url:window.location.href}),s=await Ur(e);try{return await Mr(e,{walletStatus:s,frakContext:i,modalConfig:r,productId:t,options:o})}catch(f){console.warn("Error processing referral",{error:f})}}var Qn=Je;Tr(()=>Cr());return Jr(eo);})();
19
19
  /*! Bundled license information:
20
20
 
21
21
  js-sha256/src/sha256.js:
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "url": "https://twitter.com/QNivelais"
12
12
  }
13
13
  ],
14
- "version": "0.0.28",
14
+ "version": "0.0.29",
15
15
  "description": "Legacy SDK, only used here to provide nice wrapper and redirection for older implementation, to not break anything and keep them updated with latest security updates.",
16
16
  "repository": {
17
17
  "url": "https://github.com/frak-id/wallet",
@@ -45,6 +45,13 @@
45
45
  "build": "tsup",
46
46
  "build:watch": "tsup --watch",
47
47
  "prepublish": "bun run lint && bun run build",
48
- "publish": "bun publish"
48
+ "publish": "echo 'Publishing legacy...'"
49
+ },
50
+ "browserslist": [
51
+ "extends @frak-labs/browserslist-config"
52
+ ],
53
+ "devDependencies": {
54
+ "browserslist": "^4.24.4",
55
+ "browserslist-to-esbuild": "^2.1.1"
49
56
  }
50
57
  }