@frak-labs/core-sdk 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cdn/bundle.js CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";var FrakSDK=(()=>{var Kr=Object.create;var Re=Object.defineProperty;var Jr=Object.getOwnPropertyDescriptor;var Gr=Object.getOwnPropertyNames;var Xr=Object.getPrototypeOf,Yr=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 k=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ut=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Zr=(e,t)=>{for(var r in t)Re(e,r,{get:t[r],enumerable:!0})},Dt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Gr(t))!Yr.call(e,a)&&a!==r&&Re(e,a,{get:()=>t[a],enumerable:!(n=Jr(t,a))||n.enumerable});return e};var Be=(e,t,r)=>(r=e!=null?Kr(Xr(e)):{},Dt(t||!e||!e.__esModule?Re(r,"default",{value:e,enumerable:!0}):r,e)),Qr=e=>Dt(Re({},"__esModule",{value:!0}),e);var st=Ut((me,it)=>{"use strict";(function(e,t){if(typeof me=="object"&&typeof it=="object")it.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var r=t();for(var n in r)(typeof me=="object"?me:e)[n]=r[n]}})(me,()=>(()=>{"use strict";var e={48:function(r,n,a){var u=this&&this.__awaiter||function(s,g,o,i){return new(o||(o=Promise))(function(T,A){function h(c){try{z(i.next(c))}catch(l){A(l)}}function S(c){try{z(i.throw(c))}catch(l){A(l)}}function z(c){var l;c.done?T(c.value):(l=c.value,l instanceof o?l:new o(function(F){F(l)})).then(h,S)}z((i=i.apply(s,g||[])).next())})},f=this&&this.__generator||function(s,g){var o,i,T,A,h={label:0,sent:function(){if(1&T[0])throw T[1];return T[1]},trys:[],ops:[]};return A={next:S(0),throw:S(1),return:S(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function S(z){return function(c){return function(l){if(o)throw new TypeError("Generator is already executing.");for(;A&&(A=0,l[0]&&(h=0)),h;)try{if(o=1,i&&(T=2&l[0]?i.return:l[0]?i.throw||((T=i.return)&&T.call(i),0):i.next)&&!(T=T.call(i,l[1])).done)return T;switch(i=0,T&&(l=[2&l[0],T.value]),l[0]){case 0:case 1:T=l;break;case 4:return h.label++,{value:l[1],done:!1};case 5:h.label++,i=l[1],l=[0];continue;case 7:l=h.ops.pop(),h.trys.pop();continue;default:if(!((T=(T=h.trys).length>0&&T[T.length-1])||l[0]!==6&&l[0]!==2)){h=0;continue}if(l[0]===3&&(!T||l[1]>T[0]&&l[1]<T[3])){h.label=l[1];break}if(l[0]===6&&h.label<T[1]){h.label=T[1],T=l;break}if(T&&h.label<T[2]){h.label=T[2],h.ops.push(l);break}T[2]&&h.ops.pop(),h.trys.pop();continue}l=g.call(s,h)}catch(F){l=[6,F],i=0}finally{o=T=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([z,c])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.decompressFromUTF16=n.compressToUTF16=n.decompressFromBase64=n.compressToBase64=void 0;var I=a(304),p=a(134),E=new I.CompressorImpl,d=new p.DecompressorImpl,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",x={};n.compressToBase64=function(s){return u(this,void 0,void 0,function(){var g;return f(this,function(o){switch(o.label){case 0:return s===null?[2,""]:[4,E.compress(s,6,function(i){return m.charAt(i)})];case 1:switch((g=o.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]}})})},n.decompressFromBase64=function(s){return u(this,void 0,void 0,function(){return f(this,function(g){switch(g.label){case 0:return s===null?[2,""]:s===""?[2,null]:[4,d.decompress(s.length,32,function(o){return function(i,T){if(!x[i]){x[i]={};for(var A=0;A<i.length;A++)x[i][i.charAt(A)]=A}return x[i][T]}(m,s.charAt(o))})];case 1:return[2,g.sent()]}})})},n.compressToUTF16=function(s){return u(this,void 0,void 0,function(){return f(this,function(g){switch(g.label){case 0:return s===null?[2,""]:[4,E.compress(s,15,function(o){return String.fromCharCode(o+32)})];case 1:return[2,g.sent()+" "]}})})},n.decompressFromUTF16=function(s){return u(this,void 0,void 0,function(){return f(this,function(g){switch(g.label){case 0:return s===null?[2,""]:s===""?[2,null]:[4,d.decompress(s.length,16384,function(o){return s.charCodeAt(o)-32})];case 1:return[2,g.sent()]}})})}},304:function(r,n,a){var u=this&&this.__awaiter||function(d,m,x,s){return new(x||(x=Promise))(function(g,o){function i(h){try{A(s.next(h))}catch(S){o(S)}}function T(h){try{A(s.throw(h))}catch(S){o(S)}}function A(h){var S;h.done?g(h.value):(S=h.value,S instanceof x?S:new x(function(z){z(S)})).then(i,T)}A((s=s.apply(d,m||[])).next())})},f=this&&this.__generator||function(d,m){var x,s,g,o,i={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return o={next:T(0),throw:T(1),return:T(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function T(A){return function(h){return function(S){if(x)throw new TypeError("Generator is already executing.");for(;o&&(o=0,S[0]&&(i=0)),i;)try{if(x=1,s&&(g=2&S[0]?s.return:S[0]?s.throw||((g=s.return)&&g.call(s),0):s.next)&&!(g=g.call(s,S[1])).done)return g;switch(s=0,g&&(S=[2&S[0],g.value]),S[0]){case 0:case 1:g=S;break;case 4:return i.label++,{value:S[1],done:!1};case 5:i.label++,s=S[1],S=[0];continue;case 7:S=i.ops.pop(),i.trys.pop();continue;default:if(!((g=(g=i.trys).length>0&&g[g.length-1])||S[0]!==6&&S[0]!==2)){i=0;continue}if(S[0]===3&&(!g||S[1]>g[0]&&S[1]<g[3])){i.label=S[1];break}if(S[0]===6&&i.label<g[1]){i.label=g[1],g=S;break}if(g&&i.label<g[2]){i.label=g[2],i.ops.push(S);break}g[2]&&i.ops.pop(),i.trys.pop();continue}S=m.call(d,i)}catch(z){S=[6,z],s=0}finally{x=g=0}if(5&S[0])throw S[1];return{value:S[0]?S[1]:void 0,done:!0}}([A,h])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.CompressorImpl=void 0;var I=a(658),p=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],E=function(){function d(){}return d.writeValueToData=function(m,x,s,g,o){if(s%4!=0||m.dataPosition+s>g-1)for(var i=0;i<s;i++)m.dataVal=m.dataVal<<1|1&x,m.dataPosition==g-1?(m.dataPosition=0,m.data.push(o(m.dataVal)),m.dataVal=0):m.dataPosition++,x>>=1;else m.dataVal<<=s,m.dataVal|=function(T,A){for(var h=0,S=0;S<A;++S)h<<=4,h|=p[15&T],T>>=4;return h}(x,s/4),m.dataPosition+=s},d.writeWToDataVal=function(m,x,s){m.dictionaryToCreate.has(m.w)?(m.w.charCodeAt(0)<256?(d.writeValueToData(m,0,m.numBits,x,s),d.writeValueToData(m,m.w.charCodeAt(0),8,x,s)):(d.writeValueToData(m,1,m.numBits,x,s),d.writeValueToData(m,m.w.charCodeAt(0),16,x,s)),m.enlargeIn--,m.enlargeIn==0&&(m.enlargeIn=Math.pow(2,m.numBits),m.numBits++),m.dictionaryToCreate.delete(m.w)):d.writeValueToData(m,m.dictionary.get(m.w),m.numBits,x,s),m.enlargeIn--,m.enlargeIn==0&&(m.enlargeIn=Math.pow(2,m.numBits),m.numBits++)},d.loopIteration=function(m,x,s,g,o){var i=m.charAt(x);o.dictionary.has(i)||(o.dictionary.set(i,o.dictSize++),o.dictionaryToCreate.set(i,!0));var T=o.w+i;o.dictionary.has(T)?o.w=T:(this.writeWToDataVal(o,s,g),o.dictionary.set(T,o.dictSize++),o.w=String(i))},d.prototype.compress=function(m,x,s){var g=this;return new Promise(function(o){return u(g,void 0,void 0,function(){var i,T;return f(this,function(A){switch(A.label){case 0:if(m==null)return o(""),[2];i={data:[],dataPosition:0,dataVal:0,dictionary:new Map,dictionaryToCreate:new Map,dictSize:3,enlargeIn:2,numBits:2,w:""},T=0,A.label=1;case 1:return T<m.length?(d.loopIteration(m,T,x,s,i),T%1e4!=0?[3,3]:[4,(0,I.wait)()]):[3,4];case 2:A.sent(),A.label=3;case 3:return T+=1,[3,1];case 4:return i.w!==""&&d.writeWToDataVal(i,x,s),d.writeValueToData(i,2,i.numBits,x,s),i.dataVal<<=x-i.dataPosition,i.data.push(s(i.dataVal)),o(i.data.join("")),[2]}})})})},d}();n.CompressorImpl=E},134:function(r,n,a){var u=this&&this.__awaiter||function(E,d,m,x){return new(m||(m=Promise))(function(s,g){function o(A){try{T(x.next(A))}catch(h){g(h)}}function i(A){try{T(x.throw(A))}catch(h){g(h)}}function T(A){var h;A.done?s(A.value):(h=A.value,h instanceof m?h:new m(function(S){S(h)})).then(o,i)}T((x=x.apply(E,d||[])).next())})},f=this&&this.__generator||function(E,d){var m,x,s,g,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return g={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function i(T){return function(A){return function(h){if(m)throw new TypeError("Generator is already executing.");for(;g&&(g=0,h[0]&&(o=0)),o;)try{if(m=1,x&&(s=2&h[0]?x.return:h[0]?x.throw||((s=x.return)&&s.call(x),0):x.next)&&!(s=s.call(x,h[1])).done)return s;switch(x=0,s&&(h=[2&h[0],s.value]),h[0]){case 0:case 1:s=h;break;case 4:return o.label++,{value:h[1],done:!1};case 5:o.label++,x=h[1],h=[0];continue;case 7:h=o.ops.pop(),o.trys.pop();continue;default:if(!((s=(s=o.trys).length>0&&s[s.length-1])||h[0]!==6&&h[0]!==2)){o=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){o.label=h[1];break}if(h[0]===6&&o.label<s[1]){o.label=s[1],s=h;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(h);break}s[2]&&o.ops.pop(),o.trys.pop();continue}h=d.call(E,o)}catch(S){h=[6,S],x=0}finally{m=s=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([T,A])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.DecompressorImpl=void 0;var I=a(658),p=function(){function E(){}return E.prototype.decompress=function(d,m,x){var s=this;return new Promise(function(g){return u(s,void 0,void 0,function(){var o,i,T;return f(this,function(A){switch(A.label){case 0:for(o={bits:0,c:null,dataIndex:1,dataPosition:m,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},i=0;i<3;i+=1)o.dictionary.set(i,i);for(;o.power!=o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=m,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;switch(o.bits){case 0:for(o.bits=0,o.maxPower=Math.pow(2,8),o.power=1;o.power!=o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=m,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.c=String.fromCharCode(o.bits);break;case 1:for(o.bits=0,o.maxPower=Math.pow(2,16),o.power=1;o.power!==o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition===0&&(o.dataPosition=m,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.c=String.fromCharCode(o.bits);break;case 2:return g(""),[2]}o.dictionary[3]=o.c,o.w=o.c,o.result.push(o.c),T=1,A.label=1;case 1:return T%2e4!=0?[3,3]:[4,(0,I.wait)()];case 2:A.sent(),A.label=3;case 3:if(o.dataIndex>d)return g(""),[2];for(o.bits=0,o.maxPower=Math.pow(2,o.numBits),o.power=1;o.power!=o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=m,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;switch(o.c=o.bits){case 0:for(o.bits=0,o.maxPower=Math.pow(2,8),o.power=1;o.power!==o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=m,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.dictionary[o.dictSize++]=String.fromCharCode(o.bits),o.c=o.dictSize-1,o.enlargeIn--;break;case 1:for(o.bits=0,o.maxPower=Math.pow(2,16),o.power=1;o.power!==o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=m,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.dictionary[o.dictSize++]=String.fromCharCode(o.bits),o.c=o.dictSize-1,o.enlargeIn--;break;case 2:return g(o.result.join("")),[2]}if(o.enlargeIn==0&&(o.enlargeIn=Math.pow(2,o.numBits),o.numBits++),o.dictionary[o.c])o.entry=o.dictionary[o.c];else{if(o.c!==o.dictSize)return g(null),[2];o.entry=o.w+o.w.charAt(0)}return o.result.push(o.entry),o.dictionary[o.dictSize++]=o.w+o.entry.charAt(0),o.enlargeIn--,o.w=o.entry,o.enlargeIn==0&&(o.enlargeIn=Math.pow(2,o.numBits),o.numBits++),T++,[3,1];case 4:return[2]}})})})},E}();n.DecompressorImpl=p},658:function(r,n){var a=this&&this.__awaiter||function(f,I,p,E){return new(p||(p=Promise))(function(d,m){function x(o){try{g(E.next(o))}catch(i){m(i)}}function s(o){try{g(E.throw(o))}catch(i){m(i)}}function g(o){var i;o.done?d(o.value):(i=o.value,i instanceof p?i:new p(function(T){T(i)})).then(x,s)}g((E=E.apply(f,I||[])).next())})},u=this&&this.__generator||function(f,I){var p,E,d,m,x={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return m={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function s(g){return function(o){return function(i){if(p)throw new TypeError("Generator is already executing.");for(;m&&(m=0,i[0]&&(x=0)),x;)try{if(p=1,E&&(d=2&i[0]?E.return:i[0]?E.throw||((d=E.return)&&d.call(E),0):E.next)&&!(d=d.call(E,i[1])).done)return d;switch(E=0,d&&(i=[2&i[0],d.value]),i[0]){case 0:case 1:d=i;break;case 4:return x.label++,{value:i[1],done:!1};case 5:x.label++,E=i[1],i=[0];continue;case 7:i=x.ops.pop(),x.trys.pop();continue;default:if(!((d=(d=x.trys).length>0&&d[d.length-1])||i[0]!==6&&i[0]!==2)){x=0;continue}if(i[0]===3&&(!d||i[1]>d[0]&&i[1]<d[3])){x.label=i[1];break}if(i[0]===6&&x.label<d[1]){x.label=d[1],d=i;break}if(d&&x.label<d[2]){x.label=d[2],x.ops.push(i);break}d[2]&&x.ops.pop(),x.trys.pop();continue}i=I.call(f,x)}catch(T){i=[6,T],E=0}finally{p=d=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([g,o])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.wait=void 0,n.wait=function(){return a(this,void 0,void 0,function(){return u(this,function(f){return[2,new Promise(function(I){setTimeout(I,0)})]})})}}},t={};return function r(n){var a=t[n];if(a!==void 0)return a.exports;var u=t[n]={exports:{}};return e[n].call(u.exports,u,u.exports,r),u.exports}(48)})())});var ct=Ut((No,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 n=!t&&typeof self=="object",a=!r.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;a?r=global:n&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&typeof Le=="object"&&Le.exports,f=typeof define=="function"&&define.amd,I=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),E=[-2147483648,8388608,32768,128],d=[24,16,8,0],m=[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],x=["hex","array","digest","arrayBuffer"],s=[];(r.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(c){return Object.prototype.toString.call(c)==="[object Array]"}),I&&(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(F){return new h(l,!0).update(F)[c]()}},o=function(c){var l=g("hex",c);a&&(l=i(l,c)),l.create=function(){return new h(c)},l.update=function(v){return l.create().update(v)};for(var F=0;F<x.length;++F){var w=x[F];l[w]=g(w,c)}return l},i=function(c,l){var F=zt("crypto"),w=zt("buffer").Buffer,v=l?"sha224":"sha256",b;w.from&&!r.JS_SHA256_NO_BUFFER_FROM?b=w.from:b=function(y){return new w(y)};var C=function(y){if(typeof y=="string")return F.createHash(v).update(y,"utf8").digest("hex");if(y==null)throw new Error(e);return y.constructor===ArrayBuffer&&(y=new Uint8Array(y)),Array.isArray(y)||ArrayBuffer.isView(y)||y.constructor===w?F.createHash(v).update(b(y)).digest("hex"):c(y)};return C},T=function(c,l){return function(F,w){return new S(F,l,!0).update(w)[c]()}},A=function(c){var l=T("hex",c);l.create=function(v){return new S(v,c)},l.update=function(v,b){return l.create(v).update(b)};for(var F=0;F<x.length;++F){var w=x[F];l[w]=T(w,c)}return l};function h(c,l){l?(s[0]=s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0,this.blocks=s):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}h.prototype.update=function(c){if(!this.finalized){var l,F=typeof c;if(F!=="string"){if(F==="object"){if(c===null)throw new Error(e);if(I&&c.constructor===ArrayBuffer)c=new Uint8Array(c);else if(!Array.isArray(c)&&(!I||!ArrayBuffer.isView(c)))throw new Error(e)}else throw new Error(e);l=!0}for(var w,v=0,b,C=c.length,y=this.blocks;v<C;){if(this.hashed&&(this.hashed=!1,y[0]=this.block,this.block=y[16]=y[1]=y[2]=y[3]=y[4]=y[5]=y[6]=y[7]=y[8]=y[9]=y[10]=y[11]=y[12]=y[13]=y[14]=y[15]=0),l)for(b=this.start;v<C&&b<64;++v)y[b>>>2]|=c[v]<<d[b++&3];else for(b=this.start;v<C&&b<64;++v)w=c.charCodeAt(v),w<128?y[b>>>2]|=w<<d[b++&3]:w<2048?(y[b>>>2]|=(192|w>>>6)<<d[b++&3],y[b>>>2]|=(128|w&63)<<d[b++&3]):w<55296||w>=57344?(y[b>>>2]|=(224|w>>>12)<<d[b++&3],y[b>>>2]|=(128|w>>>6&63)<<d[b++&3],y[b>>>2]|=(128|w&63)<<d[b++&3]):(w=65536+((w&1023)<<10|c.charCodeAt(++v)&1023),y[b>>>2]|=(240|w>>>18)<<d[b++&3],y[b>>>2]|=(128|w>>>12&63)<<d[b++&3],y[b>>>2]|=(128|w>>>6&63)<<d[b++&3],y[b>>>2]|=(128|w&63)<<d[b++&3]);this.lastByteIndex=b,this.bytes+=b-this.start,b>=64?(this.block=y[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}},h.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var c=this.blocks,l=this.lastByteIndex;c[16]=this.block,c[l>>>2]|=E[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()}},h.prototype.hash=function(){var c=this.h0,l=this.h1,F=this.h2,w=this.h3,v=this.h4,b=this.h5,C=this.h6,y=this.h7,P=this.blocks,R,_,N,X,M,Y,Z,fe,nt,at,ke;for(R=16;R<64;++R)M=P[R-15],_=(M>>>7|M<<25)^(M>>>18|M<<14)^M>>>3,M=P[R-2],N=(M>>>17|M<<15)^(M>>>19|M<<13)^M>>>10,P[R]=P[R-16]+_+P[R-7]+N<<0;for(ke=l&F,R=0;R<64;R+=4)this.first?(this.is224?(fe=300032,M=P[0]-1413257819,y=M-150054599<<0,w=M+24177077<<0):(fe=704751109,M=P[0]-210244248,y=M-1521486534<<0,w=M+143694565<<0),this.first=!1):(_=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),N=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),fe=c&l,X=fe^c&F^ke,Z=v&b^~v&C,M=y+N+Z+m[R]+P[R],Y=_+X,y=w+M<<0,w=M+Y<<0),_=(w>>>2|w<<30)^(w>>>13|w<<19)^(w>>>22|w<<10),N=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),nt=w&c,X=nt^w&l^fe,Z=y&v^~y&b,M=C+N+Z+m[R+1]+P[R+1],Y=_+X,C=F+M<<0,F=M+Y<<0,_=(F>>>2|F<<30)^(F>>>13|F<<19)^(F>>>22|F<<10),N=(C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7),at=F&w,X=at^F&c^nt,Z=C&y^~C&v,M=b+N+Z+m[R+2]+P[R+2],Y=_+X,b=l+M<<0,l=M+Y<<0,_=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),N=(b>>>6|b<<26)^(b>>>11|b<<21)^(b>>>25|b<<7),ke=l&F,X=ke^l&w^at,Z=b&C^~b&y,M=v+N+Z+m[R+3]+P[R+3],Y=_+X,v=c+M<<0,c=M+Y<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+c<<0,this.h1=this.h1+l<<0,this.h2=this.h2+F<<0,this.h3=this.h3+w<<0,this.h4=this.h4+v<<0,this.h5=this.h5+b<<0,this.h6=this.h6+C<<0,this.h7=this.h7+y<<0},h.prototype.hex=function(){this.finalize();var c=this.h0,l=this.h1,F=this.h2,w=this.h3,v=this.h4,b=this.h5,C=this.h6,y=this.h7,P=p[c>>>28&15]+p[c>>>24&15]+p[c>>>20&15]+p[c>>>16&15]+p[c>>>12&15]+p[c>>>8&15]+p[c>>>4&15]+p[c&15]+p[l>>>28&15]+p[l>>>24&15]+p[l>>>20&15]+p[l>>>16&15]+p[l>>>12&15]+p[l>>>8&15]+p[l>>>4&15]+p[l&15]+p[F>>>28&15]+p[F>>>24&15]+p[F>>>20&15]+p[F>>>16&15]+p[F>>>12&15]+p[F>>>8&15]+p[F>>>4&15]+p[F&15]+p[w>>>28&15]+p[w>>>24&15]+p[w>>>20&15]+p[w>>>16&15]+p[w>>>12&15]+p[w>>>8&15]+p[w>>>4&15]+p[w&15]+p[v>>>28&15]+p[v>>>24&15]+p[v>>>20&15]+p[v>>>16&15]+p[v>>>12&15]+p[v>>>8&15]+p[v>>>4&15]+p[v&15]+p[b>>>28&15]+p[b>>>24&15]+p[b>>>20&15]+p[b>>>16&15]+p[b>>>12&15]+p[b>>>8&15]+p[b>>>4&15]+p[b&15]+p[C>>>28&15]+p[C>>>24&15]+p[C>>>20&15]+p[C>>>16&15]+p[C>>>12&15]+p[C>>>8&15]+p[C>>>4&15]+p[C&15];return this.is224||(P+=p[y>>>28&15]+p[y>>>24&15]+p[y>>>20&15]+p[y>>>16&15]+p[y>>>12&15]+p[y>>>8&15]+p[y>>>4&15]+p[y&15]),P},h.prototype.toString=h.prototype.hex,h.prototype.digest=function(){this.finalize();var c=this.h0,l=this.h1,F=this.h2,w=this.h3,v=this.h4,b=this.h5,C=this.h6,y=this.h7,P=[c>>>24&255,c>>>16&255,c>>>8&255,c&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,F>>>24&255,F>>>16&255,F>>>8&255,F&255,w>>>24&255,w>>>16&255,w>>>8&255,w&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||P.push(y>>>24&255,y>>>16&255,y>>>8&255,y&255),P},h.prototype.array=h.prototype.digest,h.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 S(c,l,F){var w,v=typeof c;if(v==="string"){var b=[],C=c.length,y=0,P;for(w=0;w<C;++w)P=c.charCodeAt(w),P<128?b[y++]=P:P<2048?(b[y++]=192|P>>>6,b[y++]=128|P&63):P<55296||P>=57344?(b[y++]=224|P>>>12,b[y++]=128|P>>>6&63,b[y++]=128|P&63):(P=65536+((P&1023)<<10|c.charCodeAt(++w)&1023),b[y++]=240|P>>>18,b[y++]=128|P>>>12&63,b[y++]=128|P>>>6&63,b[y++]=128|P&63);c=b}else if(v==="object"){if(c===null)throw new Error(e);if(I&&c.constructor===ArrayBuffer)c=new Uint8Array(c);else if(!Array.isArray(c)&&(!I||!ArrayBuffer.isView(c)))throw new Error(e)}else throw new Error(e);c.length>64&&(c=new h(l,!0).update(c).array());var R=[],_=[];for(w=0;w<64;++w){var N=c[w]||0;R[w]=92^N,_[w]=54^N}h.call(this,l,F),this.update(_),this.oKeyPad=R,this.inner=!0,this.sharedMemory=F}S.prototype=new h,S.prototype.finalize=function(){if(h.prototype.finalize.call(this),this.inner){this.inner=!1;var c=this.array();h.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(c),h.prototype.finalize.call(this)}};var z=o();z.sha256=z,z.sha224=o(!0),z.sha256.hmac=A(),z.sha224.hmac=A(!0),u?Le.exports=z:(r.sha256=z.sha256,r.sha224=z.sha224,f&&define(function(){return z}))})()});function Q(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}var be=k(()=>{"use strict"});function U(e){return Q(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var we=k(()=>{"use strict";be()});var ft,Vt=k(()=>{"use strict";ft="2.21.55"});function Wt(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Wt(e.cause,t):t?null:e}var dt,L,ie=k(()=>{"use strict";Vt();dt={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${ft}`},L=class e extends Error{constructor(t,r={}){let n=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,u=dt.getDocsUrl?.({...r,docsPath:a}),f=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...u?[`Docs: ${u}`]:[],...n?[`Details: ${n}`]:[],...dt.version?[`Version: ${dt.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=n,this.docsPath=a,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=t,this.version=ft}walk(t){return Wt(this,t)}}});var ze,Ue,De,$e,Oe,qt=k(()=>{"use strict";we();ie();ze=class extends L{constructor({expectedLength:t,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${t}`,`Given length: ${r}`].join(`
3
- `),{name:"AbiEncodingArrayLengthMismatchError"})}},Ue=class extends L{constructor({expectedSize:t,value:r}){super(`Size of bytes "${r}" (bytes${U(r)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}},De=class extends L{constructor({expectedLength:t,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${r}`].join(`
4
- `),{name:"AbiEncodingLengthMismatchError"})}},$e=class extends L{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"})}},Oe=class extends L{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
6
- `),{name:"InvalidArrayError"})}}});var Ie,Te,mt=k(()=>{"use strict";ie();Ie=class extends L{constructor({offset:t,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}},Te=class extends L{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}});function D(e,{dir:t,size:r=32}={}){return typeof e=="string"?q(e,{dir:t,size:r}):Kt(e,{dir:t,size:r})}function q(e,{dir:t,size:r=32}={}){if(r===null)return e;let n=e.replace("0x","");if(n.length>r*2)throw new Te({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](r*2,"0")}`}function Kt(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 n=new Uint8Array(r);for(let a=0;a<r;a++){let u=t==="right";n[u?a:r-a-1]=e[u?a:e.length-a-1]}return n}var Se=k(()=>{"use strict";mt()});var ue,_e,Ne=k(()=>{"use strict";ie();ue=class extends L{constructor({max:t,min:r,signed:n,size:a,value:u}){super(`Number "${u}" is not in safe ${a?`${a*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${r} to ${t})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}},_e=class extends L{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}});function se(e,{size:t}){if(U(e)>t)throw new _e({givenSize:U(e),maxSize:t})}var ht=k(()=>{"use strict";Ne();we()});function $(e,t={}){return typeof e=="number"||typeof e=="bigint"?K(e,t):typeof e=="string"?Ve(e,t):typeof e=="boolean"?je(e,t):Fe(e,t)}function je(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(se(r,{size:t.size}),D(r,{size:t.size})):r}function Fe(e,t={}){let r="";for(let a=0;a<e.length;a++)r+=ro[e[a]];let n=`0x${r}`;return typeof t.size=="number"?(se(n,{size:t.size}),D(n,{dir:"right",size:t.size})):n}function K(e,t={}){let{signed:r,size:n}=t,a=BigInt(e),u;n?r?u=(1n<<BigInt(n)*8n-1n)-1n:u=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(u=BigInt(Number.MAX_SAFE_INTEGER));let f=typeof u=="bigint"&&r?-u-1n:0;if(u&&a>u||a<f){let p=typeof e=="bigint"?"n":"";throw new ue({max:u?`${u}${p}`:void 0,min:`${f}${p}`,signed:r,size:n,value:`${e}${p}`})}let I=`0x${(r&&a<0?(1n<<BigInt(n*8))+BigInt(a):a).toString(16)}`;return n?D(I,{size:n}):I}function Ve(e,t={}){let r=oo.encode(e);return Fe(r,t)}var ro,oo,Ee=k(()=>{"use strict";Ne();Se();ht();ro=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));oo=new TextEncoder});function xt(e,t={}){return typeof e=="number"||typeof e=="bigint"?Xt(e,t):typeof e=="boolean"?Gt(e,t):Q(e)?ve(e,t):We(e,t)}function Gt(e,t={}){let r=new Uint8Array(1);return r[0]=Number(e),typeof t.size=="number"?(se(r,{size:t.size}),D(r,{size:t.size})):r}function Jt(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 ve(e,t={}){let r=e;t.size&&(se(r,{size:t.size}),r=D(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let a=n.length/2,u=new Uint8Array(a);for(let f=0,I=0;f<a;f++){let p=Jt(n.charCodeAt(I++)),E=Jt(n.charCodeAt(I++));if(p===void 0||E===void 0)throw new L(`Invalid byte sequence ("${n[I-2]}${n[I-1]}" in "${n}").`);u[f]=p*16+E}return u}function Xt(e,t){let r=K(e,t);return ve(r)}function We(e,t={}){let r=no.encode(e);return typeof t.size=="number"?(se(r,{size:t.size}),D(r,{dir:"right",size:t.size})):r}var no,G,qe=k(()=>{"use strict";ie();be();Se();ht();Ee();no=new TextEncoder;G={zero:48,nine:57,A:65,F:70,a:97,f:102}});function yt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function ao(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Ae(e,...t){if(!ao(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 gt(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 Yt(e,t){Ae(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}var bt=k(()=>{"use strict"});function io(e,t=!1){return t?{h:Number(e&Ke),l:Number(e>>Zt&Ke)}:{h:Number(e>>Zt&Ke)|0,l:Number(e&Ke)|0}}function Qt(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let a=0;a<e.length;a++){let{h:u,l:f}=io(e[a],t);[r[a],n[a]]=[u,f]}return[r,n]}var Ke,Zt,er,tr,rr,or,nr=k(()=>{"use strict";Ke=BigInt(4294967295),Zt=BigInt(32);er=(e,t,r)=>e<<r|t>>>32-r,tr=(e,t,r)=>t<<r|e>>>32-r,rr=(e,t,r)=>t<<r-32|e>>>64-r,or=(e,t,r)=>e<<r-32|t>>>64-r});function It(e){for(let t=0;t<e.length;t++)e[t]=so(e[t])}function co(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Ge(e){return typeof e=="string"&&(e=co(e)),Ae(e),e}function ir(e){let t=n=>e().update(Ge(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function sr(e){let t=(n,a)=>e(a).update(Ge(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}var ar,wt,so,Je,cr=k(()=>{"use strict";bt();ar=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),wt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,so=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;Je=class{clone(){return this._cloneInto()}}});function yo(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){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 I=(f+8)%10,p=(f+2)%10,E=r[p],d=r[p+1],m=pr(E,d,1)^r[I],x=ur(E,d,1)^r[I+1];for(let s=0;s<50;s+=10)e[f+s]^=m,e[f+s+1]^=x}let a=e[2],u=e[3];for(let f=0;f<24;f++){let I=fr[f],p=pr(a,u,I),E=ur(a,u,I),d=lr[f];a=e[d],u=e[d+1],e[d]=p,e[d+1]=E}for(let f=0;f<50;f+=10){for(let I=0;I<10;I++)r[I]=e[f+I];for(let I=0;I<10;I++)e[f+I]^=~r[(I+2)%10]&r[(I+4)%10]}e[0]^=ho[n],e[1]^=xo[n]}r.fill(0)}var lr,fr,dr,po,Ce,uo,lo,fo,mo,ho,xo,pr,ur,Xe,ee,Yn,Zn,Qn,ea,ta,mr,ra,oa,hr,na,aa,xr=k(()=>{"use strict";bt();nr();cr();lr=[],fr=[],dr=[],po=BigInt(0),Ce=BigInt(1),uo=BigInt(2),lo=BigInt(7),fo=BigInt(256),mo=BigInt(113);for(let e=0,t=Ce,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],lr.push(2*(5*n+r)),fr.push((e+1)*(e+2)/2%64);let a=po;for(let u=0;u<7;u++)t=(t<<Ce^(t>>lo)*mo)%fo,t&uo&&(a^=Ce<<(Ce<<BigInt(u))-Ce);dr.push(a)}[ho,xo]=Qt(dr,!0),pr=(e,t,r)=>r>32?rr(e,t,r):er(e,t,r),ur=(e,t,r)=>r>32?or(e,t,r):tr(e,t,r);Xe=class e extends Je{constructor(t,r,n,a=!1,u=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=a,this.rounds=u,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,yt(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ar(this.state)}keccak(){wt||It(this.state32),yo(this.state32,this.rounds),wt||It(this.state32),this.posOut=0,this.pos=0}update(t){gt(this);let{blockLen:r,state:n}=this;t=Ge(t);let a=t.length;for(let u=0;u<a;){let f=Math.min(r-this.pos,a-u);for(let I=0;I<f;I++)n[this.pos++]^=t[u++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:a}=this;t[n]^=r,r&128&&n===a-1&&this.keccak(),t[a-1]^=128,this.keccak()}writeInto(t){gt(this,!1),Ae(t),this.finish();let r=this.state,{blockLen:n}=this;for(let a=0,u=t.length;a<u;){this.posOut>=n&&this.keccak();let f=Math.min(n-this.posOut,u-a);t.set(r.subarray(this.posOut,this.posOut+f),a),this.posOut+=f,a+=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 yt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Yt(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:n,outputLen:a,rounds:u,enableXOF:f}=this;return t||(t=new e(r,n,a,f,u)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=u,t.suffix=n,t.outputLen=a,t.enableXOF=f,t.destroyed=this.destroyed,t}},ee=(e,t,r)=>ir(()=>new Xe(t,e,r)),Yn=ee(6,144,224/8),Zn=ee(6,136,256/8),Qn=ee(6,104,384/8),ea=ee(6,72,512/8),ta=ee(1,144,224/8),mr=ee(1,136,256/8),ra=ee(1,104,384/8),oa=ee(1,72,512/8),hr=(e,t,r)=>sr((n={})=>new Xe(t,e,n.dkLen===void 0?r:n.dkLen,!0)),na=hr(31,168,128/8),aa=hr(31,136,256/8)});function Pe(e,t){let r=t||"hex",n=mr(Q(e,{strict:!1})?xt(e):e);return r==="bytes"?n:$(n)}var Tt=k(()=>{"use strict";xr();be();qe();Ee()});var ce,St=k(()=>{"use strict";ie();ce=class extends L{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 le,Ft=k(()=>{"use strict";le=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 n=this.keys().next().value;n&&this.delete(n)}return this}}});function yr(e,t){if(Et.has(`${e}.${t}`))return Et.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=Pe(We(r),"bytes"),a=(t?r.substring(`${t}0x`.length):r).split("");for(let f=0;f<40;f+=2)n[f>>1]>>4>=8&&a[f]&&(a[f]=a[f].toUpperCase()),(n[f>>1]&15)>=8&&a[f+1]&&(a[f+1]=a[f+1].toUpperCase());let u=`0x${a.join("")}`;return Et.set(`${e}.${t}`,u),u}var Et,gr=k(()=>{"use strict";qe();Tt();Ft();Et=new le(8192)});function Me(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(vt.has(n))return vt.get(n);let a=go.test(e)?e.toLowerCase()===e?!0:r?yr(e)===e:!0:!1;return vt.set(n,a),a}var go,vt,At=k(()=>{"use strict";Ft();gr();go=/^0x[a-fA-F0-9]{40}$/,vt=new le(8192)});function te(e){return typeof e[0]=="string"?j(e):br(e)}function br(e){let t=0;for(let a of e)t+=a.length;let r=new Uint8Array(t),n=0;for(let a of e)r.set(a,n),n+=a.length;return r}function j(e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}var Ct=k(()=>{"use strict"});function wr(e,t,r,{strict:n}={}){return Q(e,{strict:!1})?wo(e,t,r,{strict:n}):bo(e,t,r,{strict:n})}function Ir(e,t){if(typeof t=="number"&&t>0&&t>U(e)-1)throw new Ie({offset:t,position:"start",size:U(e)})}function Tr(e,t,r){if(typeof t=="number"&&typeof r=="number"&&U(e)!==r-t)throw new Ie({offset:r,position:"end",size:U(e)})}function bo(e,t,r,{strict:n}={}){Ir(e,t);let a=e.slice(t,r);return n&&Tr(a,t,r),a}function wo(e,t,r,{strict:n}={}){Ir(e,t);let a=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&Tr(a,t,r),a}var Sr=k(()=>{"use strict";mt();be();we()});var Fr,Er=k(()=>{"use strict";Fr=/^(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 De({expectedLength:e.length,givenLength:t.length});let r=Io({params:e,values:t}),n=kt(r);return n.length===0?"0x":n}function Io({params:e,values:t}){let r=[];for(let n=0;n<e.length;n++)r.push(Mt({param:e[n],value:t[n]}));return r}function Mt({param:e,value:t}){let r=Po(e.type);if(r){let[n,a]=r;return So(t,{length:n,param:{...e,type:a}})}if(e.type==="tuple")return Co(t,{param:e});if(e.type==="address")return To(t);if(e.type==="bool")return Eo(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let n=e.type.startsWith("int"),[,,a="256"]=Fr.exec(e.type)??[];return vo(t,{signed:n,size:Number(a)})}if(e.type.startsWith("bytes"))return Fo(t,{param:e});if(e.type==="string")return Ao(t);throw new $e(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function kt(e){let t=0;for(let u=0;u<e.length;u++){let{dynamic:f,encoded:I}=e[u];f?t+=32:t+=U(I)}let r=[],n=[],a=0;for(let u=0;u<e.length;u++){let{dynamic:f,encoded:I}=e[u];f?(r.push(K(t+a,{size:32})),n.push(I),a+=U(I)):r.push(I)}return te([...r,...n])}function To(e){if(!Me(e))throw new ce({address:e});return{dynamic:!1,encoded:q(e.toLowerCase())}}function So(e,{length:t,param:r}){let n=t===null;if(!Array.isArray(e))throw new Oe(e);if(!n&&e.length!==t)throw new ze({expectedLength:t,givenLength:e.length,type:`${r.type}[${t}]`});let a=!1,u=[];for(let f=0;f<e.length;f++){let I=Mt({param:r,value:e[f]});I.dynamic&&(a=!0),u.push(I)}if(n||a){let f=kt(u);if(n){let I=K(u.length,{size:32});return{dynamic:!0,encoded:u.length>0?te([I,f]):I}}if(a)return{dynamic:!0,encoded:f}}return{dynamic:!1,encoded:te(u.map(({encoded:f})=>f))}}function Fo(e,{param:t}){let[,r]=t.type.split("bytes"),n=U(e);if(!r){let a=e;return n%32!==0&&(a=q(a,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:te([q(K(n,{size:32})),a])}}if(n!==Number.parseInt(r))throw new Ue({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:q(e,{dir:"right"})}}function Eo(e){if(typeof e!="boolean")throw new L(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:q(je(e))}}function vo(e,{signed:t,size:r=256}){if(typeof r=="number"){let n=2n**(BigInt(r)-(t?1n:0n))-1n,a=t?-n-1n:0n;if(e>n||e<a)throw new ue({max:n.toString(),min:a.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:K(e,{size:32,signed:t})}}function Ao(e){let t=Ve(e),r=Math.ceil(U(t)/32),n=[];for(let a=0;a<r;a++)n.push(q(wr(t,a*32,(a+1)*32),{dir:"right"}));return{dynamic:!0,encoded:te([q(K(U(t),{size:32})),...n])}}function Co(e,{param:t}){let r=!1,n=[];for(let a=0;a<t.components.length;a++){let u=t.components[a],f=Array.isArray(e)?a:u.name,I=Mt({param:u,value:e[f]});n.push(I),I.dynamic&&(r=!0)}return{dynamic:r,encoded:r?kt(n):te(n.map(({encoded:a})=>a))}}function Po(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var vr=k(()=>{"use strict";qt();St();ie();Ne();At();Ct();Se();we();Sr();Ee();Er()});function Rt(e,t){if(!Me(e,{strict:!1}))throw new ce({address:e});if(!Me(t,{strict:!1}))throw new ce({address:t});return e.toLowerCase()===t.toLowerCase()}var Ar=k(()=>{"use strict";St();At()});var zo={};Zr(zo,{ClientNotFound:()=>de,Deferred:()=>W,FrakContextManager:()=>re,FrakRpcError:()=>B,PressInteractionEncoder:()=>jr,PurchaseInteractionEncoder:()=>Vr,ReferralInteractionEncoder:()=>rt,RpcErrorCodes:()=>H,WebShopInteractionEncoder:()=>Wr,baseIframeProps:()=>ae,compressJson:()=>he,createIFrameFrakClient:()=>ge,createIframe:()=>ye,decompressDataAndCheckHash:()=>ne,decompressJson:()=>xe,displayModal:()=>J,getProductInformation:()=>Dr,hashAndCompressData:()=>oe,interactionTypes:()=>V,modalBuilder:()=>Nr,openSso:()=>Ur,processReferral:()=>ot,productTypes:()=>O,productTypesMask:()=>Hr,referralInteraction:()=>qr,sendInteraction:()=>et,sendTransaction:()=>_r,setupClient:()=>Ht,siweAuthenticate:()=>Or,trackPurchaseStatus:()=>$r,watchWalletStatus:()=>Qe});var B=class extends Error{constructor(r,n,a){super(n);this.code=r;this.data=a}};var He=class extends B{constructor(t){super(H.internalError,t)}},de=class extends B{constructor(){super(H.clientNotConnected,"Client not found")}},H={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 $t=Be(st(),1),pt=Be(ct(),1);async function oe(e){let t=(0,pt.sha256)(JSON.stringify(e)),r={...e,validationHash:t},n=await he(r),a=(0,pt.sha256)(n);return{compressed:n,compressedHash:a}}async function he(e){return(0,$t.compressToBase64)(JSON.stringify(e))}var Ot=Be(st(),1),ut=Be(ct(),1);async function ne(e){if(!(e?.compressed&&e?.compressedHash))throw new B(H.corruptedResponse,"Missing compressed data");let t=await xe(e.compressed);if(!t)throw new B(H.corruptedResponse,"Invalid compressed data");if(!t?.validationHash)throw new B(H.corruptedResponse,"Missing validation hash");if((0,ut.sha256)(e.compressed)!==e.compressedHash)throw new B(H.corruptedResponse,"Invalid compressed hash");let{validationHash:n,...a}=t;if((0,ut.sha256)(JSON.stringify(a))!==t.validationHash)throw new B(H.corruptedResponse,"Invalid data validation hash");return t}async function xe(e){let t=await(0,Ot.decompressFromBase64)(e);try{return JSON.parse(t)}catch(r){return console.error("Invalid compressed data",{e:r,decompressed:t}),null}}var pe="nexus-wallet-backup";function _t(){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 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:1e3,top:"-1000px",left:"-1000px"}};function ye({walletBaseUrl:e,config:t}){let r=document.querySelector("#nexus-wallet");r&&r.remove();let n=document.createElement("iframe");return n.id=ae.id,n.name=ae.name,n.allow=ae.allow,n.style.zIndex=ae.style.zIndex.toString(),lt({iframe:n,isVisible:!1}),document.body.appendChild(n),new Promise(a=>{n?.addEventListener("load",()=>a(n)),n.src=`${t?.walletUrl??e??"https://wallet.frak.id"}/listener`})}function lt({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 Nt({iframe:e}){let t=new W;return{handleEvent:async n=>{switch(n.iframeLifecycle){case"connected":t.resolve(!0);break;case"do-backup":n.data.backup?localStorage.setItem(pe,n.data.backup):localStorage.removeItem(pe);break;case"remove-backup":localStorage.removeItem(pe);break;case"show":case"hide":lt({iframe:e,isVisible:n.iframeLifecycle==="show"});break}},isConnected:t.promise}}function jt({frakWalletUrl:e,iframe:t,channelManager:r,iframeLifecycleManager:n}){if(typeof window>"u")throw new B(H.configError,"iframe client should be used in the browser");if(!t.contentWindow)throw new B(H.configError,"The iframe does not have a product window");let a=t.contentWindow,u=async p=>{if(!(p.origin&&URL.canParse(p.origin))||new URL(p.origin).origin.toLowerCase()!==new URL(e).origin.toLowerCase()||typeof p.data!="object")return;if("iframeLifecycle"in p.data){await n.handleEvent(p.data);return}if("clientLifecycle"in p.data){console.error("Client lifecycle event received on the client side, dismissing it");return}let E=p.data.id,d=r.getRpcResolver(E);d&&await d(p.data)};return window.addEventListener("message",u),{sendEvent:p=>{a.postMessage(p,{targetOrigin:e})},cleanup:()=>{window.removeEventListener("message",u)}}}function ge({config:e,iframe:t}){let r=_t(),n=Nt({iframe:t}),a=jt({frakWalletUrl:e?.walletUrl??"https://wallet.frak.id",iframe:t,channelManager:r,iframeLifecycleManager:n}),u=async d=>{if(!await n.isConnected)throw new B(H.clientNotConnected,"The iframe provider isn't connected yet");let x=new W,s=r.createChannel(async o=>{let i=await ne(o.data);i.error?x.reject(new B(i.error.code,i.error.message,i.error?.data)):x.resolve(i.result),r.removeChannel(s)}),g=await oe(d);return a.sendEvent({id:s,topic:d.method,data:g}),x.promise},f=async(d,m)=>{if(!await n.isConnected)throw new B(H.clientNotConnected,"The iframe provider isn't connected yet");let s=r.createChannel(async o=>{let i=await ne(o.data);if(i.result)m(i.result);else throw new He("No valid result in the response")}),g=await oe(d);a.sendEvent({id:s,topic:d.method,data:g})},I=eo(a,n),p=async()=>{I(),r.destroy(),a.cleanup(),t.remove()},E=to({config:e,messageHandler:a,lifecycleManager:n});return{config:e,waitForConnection:n.isConnected,waitForSetup:E,request:u,listenerRequest:f,destroy:p}}function eo(e,t){let a,u,f=()=>e.sendEvent({iframeLifecycle:"heartbeat"});async function I(){f(),a=setInterval(f,100),u=setTimeout(()=>{p(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,p()}function p(){a&&clearInterval(a),u&&clearTimeout(u)}return I(),p}async function to({config:e,messageHandler:t,lifecycleManager:r}){await r.isConnected;let n=async()=>{let u=e.metadata.css;u&&t.sendEvent({clientLifecycle:"modal-css",data:{cssLink:u}})},a=async()=>{if(typeof window>"u")return;let u=window.localStorage.getItem(pe);u&&t.sendEvent({clientLifecycle:"restore-backup",data:{backup:u}})};await Promise.all([n(),a()])}var Ye=256,Ze;function Cr(e=11){if(!Ze||Ye+e>256*2){Ze="",Ye=0;for(let t=0;t<256;t++)Ze+=(256+Math.random()*256|0).toString(16).substring(1)}return Ze.substring(Ye,Ye+++e)}vr();qe();Ee();Ct();Ar();Tt();Se();var Bt="fCtx";function Mo(e){return btoa(Array.from(e,t=>String.fromCharCode(t)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function ko(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=ve(e.r);return Mo(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function Mr(e){if(!(!e||e.length===0))try{let t=ko(e);return{r:Fe(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function kr({url:e}){if(!e)return null;let r=new URL(e).searchParams.get(Bt);return r?Mr(r):null}function Rr({url:e,context:t}){if(!e)return null;let r=kr({url:e}),n=r?{...r,...t}:t;if(!n.r)return null;let a=Pr(n);if(!a)return null;let u=new URL(e);return u.searchParams.set(Bt,a),u.toString()}function Br(e){let t=new URL(e);return t.searchParams.delete(Bt),t.toString()}function Ro({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,n;t!==null?n=Rr({url:r,context:t}):n=Br(r),n&&window.history.replaceState(null,"",n.toString())}var re={compress:Pr,decompress:Mr,parse:kr,update:Rr,remove:Br,replaceUrl:Ro};async function Ht({config:e}){let t=await ye({config:e});if(!t){console.error("Failed to create iframe");return}let r=ge({config:e,iframe:t});if(await r.waitForSetup,!await r.waitForConnection){console.error("Failed to connect to client");return}return r}var O={dapp:1,press:2,webshop:3,referral:30,purchase:31},Hr=Object.entries(O).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{});var V={press:{openArticle:"0xc0a24ffb",readArticle:"0xd5bd0fbe"},dapp:{proofVerifiableStorageUpdate:"0x2ab2aeef",callableVerifiableStorageUpdate:"0xa07da986"},webshop:{open:"0xb311798f"},referral:{referred:"0x010cc3b9",createLink:"0xb2c0f17c"},purchase:{started:"0xd87e90c3",completed:"0x8403aeb4"}};function Qe(e,t){if(!t)return e.request({method:"frak_listenToWalletStatus"}).then(a=>(Lr(a.interactionToken),a));let r=new W,n=!1;return e.listenerRequest({method:"frak_listenToWalletStatus"},a=>{t(a),Lr(a.interactionToken),n||(r.resolve(a),n=!0)}).then(()=>r.promise)}function Lr(e){typeof window>"u"||(e?window.sessionStorage.setItem("frak-wallet-interaction-token",e):window.sessionStorage.removeItem("frak.interaction-token"))}function zr({domain:e}){let t=e??window.location.host;return Pe($(t))}async function et(e,{productId:t,interaction:r,validation:n}){let a=t??zr(e.config);return await e.request({method:"frak_sendInteraction",params:[a,r,n]})}async function J(e,{steps:t,metadata:r}){return await e.request({method:"frak_displayModal",params:[t,e.config.metadata.name,r]})}async function Ur(e,t){let{metadata:r}=e.config;await e.request({method:"frak_sso",params:[t,r.name,r.css]})}async function Dr(e){return await e.request({method:"frak_getProductInformation"})}async function $r(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 Cr(96)}async function Or(e,{siwe:t,metadata:r}){let n=e.config?.domain??window.location.host,a=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`,u={...t,statement:a,nonce:t?.nonce??Lt(),uri:t?.uri??`https://${n}`,version:t?.version??"1",domain:n};return(await J(e,{metadata:r,steps:{login:{},siweAuthenticate:{siwe:u}}})).siweAuthenticate}async function _r(e,{tx:t,metadata:r}){return(await J(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function Nr(e,{metadata:t,login:r,openSession:n}){return tt(e,{steps:{login:r??{},openSession:n??{}},metadata:t})}function tt(e,t){function r(f){return tt(e,{...t,steps:{...t.steps,sendTransaction:f}})}function n(f){return tt(e,{...t,steps:{...t.steps,final:{...f,action:{key:"reward"}}}})}function a(f,I){return tt(e,{...t,steps:{...t.steps,final:{...I,action:{key:"sharing",options:f}}}})}async function u(){return await J(e,t)}return{params:t,sendTx:r,reward:n,sharing:a,display:u}}var jr={openArticle({articleId:e}){let t=j([V.press.openArticle,D(e,{size:32})]);return{handlerTypeDenominator:$(O.press),interactionData:t}},readArticle({articleId:e}){let t=j([V.press.readArticle,D(e,{size:32})]);return{handlerTypeDenominator:$(O.press),interactionData:t}}};var rt={createLink(){let e=j([V.referral.createLink,"0x"]);return{handlerTypeDenominator:$(O.referral),interactionData:e}},referred({referrer:e}){let t=j([V.referral.referred,D(e,{size:32})]);return{handlerTypeDenominator:$(O.referral),interactionData:t}}};var Vr={startPurchase({purchaseId:e}){let t=j([V.purchase.started,D(e,{size:32})]);return{handlerTypeDenominator:$(O.purchase),interactionData:t}},completedPurchase({purchaseId:e,proof:t}){let r=Pt([{type:"uint256"},{type:"bytes32[]"}],[BigInt(e),t]),n=j([V.purchase.completed,r]);return{handlerTypeDenominator:$(O.purchase),interactionData:n}}};var Wr={open(){let e=j([V.webshop.open,"0x"]);return{handlerTypeDenominator:$(O.webshop),interactionData:e}}};async function ot(e,{walletStatus:t,frakContext:r,modalConfig:n,productId:a,options:u}){let f=!1;async function I(){if(!f)return f=!0,Ho(e,{modalConfig:n,walletStatus:t})}async function p(E){let d=rt.referred({referrer:E});await et(e,{productId:a,interaction:d})}try{let{status:E,currentWallet:d}=await Bo({initialWalletStatus:t,getFreshWalletStatus:I,pushReferralInteraction:p,frakContext:r});return re.replaceUrl({url:window.location?.href,context:u?.alwaysAppendUrl?{r:d}:null}),E}catch(E){return console.log("Error processing referral",{error:E}),re.replaceUrl({url:window.location?.href,context:u?.alwaysAppendUrl?{r:t?.wallet}:null}),Lo(E)}}async function Bo({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:r,frakContext:n}){let a=e?.wallet;return n?.r?(a||(a=await t()),a&&Rt(n.r,a)?{status:"self-referral",currentWallet:a}:(e?.interactionSession||(a=await t()),await r(n.r),{status:"success",currentWallet:a})):{status:"no-referrer",currentWallet:a}}async function Ho(e,{modalConfig:t,walletStatus:r}){return r?.interactionSession?r.wallet??void 0:t?(await J(e,t))?.login?.wallet??void 0:void 0}function Lo(e){if(e instanceof B)switch(e.code){case H.walletNotConnected:return"no-wallet";case H.serverErrorForInteractionDelegation:return"no-session";default:return"error"}return"error"}async function qr(e,{productId:t,modalConfig:r,options:n}={}){let a=re.parse({url:window.location.href}),u=await Qe(e);try{return await ot(e,{walletStatus:u,frakContext:a,modalConfig:r,productId:t,options:n})}catch(f){console.warn("Error processing referral",{error:f})}}return Qr(zo);})();
1
+ "use strict";var FrakSDK=(()=>{var Jr=Object.create;var Re=Object.defineProperty;var Gr=Object.getOwnPropertyDescriptor;var Xr=Object.getOwnPropertyNames;var Yr=Object.getPrototypeOf,Zr=Object.prototype.hasOwnProperty;var Lt=(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 k=(e,t)=>()=>(e&&(t=e(e=0)),t);var Dt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Qr=(e,t)=>{for(var r in t)Re(e,r,{get:t[r],enumerable:!0})},Ut=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Xr(t))!Zr.call(e,a)&&a!==r&&Re(e,a,{get:()=>t[a],enumerable:!(n=Gr(t,a))||n.enumerable});return e};var Be=(e,t,r)=>(r=e!=null?Jr(Yr(e)):{},Ut(t||!e||!e.__esModule?Re(r,"default",{value:e,enumerable:!0}):r,e)),eo=e=>Ut(Re({},"__esModule",{value:!0}),e);var st=Dt((me,it)=>{"use strict";(function(e,t){if(typeof me=="object"&&typeof it=="object")it.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var r=t();for(var n in r)(typeof me=="object"?me:e)[n]=r[n]}})(me,()=>(()=>{"use strict";var e={48:function(r,n,a){var u=this&&this.__awaiter||function(s,g,o,i){return new(o||(o=Promise))(function(T,A){function h(c){try{L(i.next(c))}catch(l){A(l)}}function S(c){try{L(i.throw(c))}catch(l){A(l)}}function L(c){var l;c.done?T(c.value):(l=c.value,l instanceof o?l:new o(function(F){F(l)})).then(h,S)}L((i=i.apply(s,g||[])).next())})},f=this&&this.__generator||function(s,g){var o,i,T,A,h={label:0,sent:function(){if(1&T[0])throw T[1];return T[1]},trys:[],ops:[]};return A={next:S(0),throw:S(1),return:S(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function S(L){return function(c){return function(l){if(o)throw new TypeError("Generator is already executing.");for(;A&&(A=0,l[0]&&(h=0)),h;)try{if(o=1,i&&(T=2&l[0]?i.return:l[0]?i.throw||((T=i.return)&&T.call(i),0):i.next)&&!(T=T.call(i,l[1])).done)return T;switch(i=0,T&&(l=[2&l[0],T.value]),l[0]){case 0:case 1:T=l;break;case 4:return h.label++,{value:l[1],done:!1};case 5:h.label++,i=l[1],l=[0];continue;case 7:l=h.ops.pop(),h.trys.pop();continue;default:if(!((T=(T=h.trys).length>0&&T[T.length-1])||l[0]!==6&&l[0]!==2)){h=0;continue}if(l[0]===3&&(!T||l[1]>T[0]&&l[1]<T[3])){h.label=l[1];break}if(l[0]===6&&h.label<T[1]){h.label=T[1],T=l;break}if(T&&h.label<T[2]){h.label=T[2],h.ops.push(l);break}T[2]&&h.ops.pop(),h.trys.pop();continue}l=g.call(s,h)}catch(F){l=[6,F],i=0}finally{o=T=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([L,c])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.decompressFromUTF16=n.compressToUTF16=n.decompressFromBase64=n.compressToBase64=void 0;var I=a(304),p=a(134),E=new I.CompressorImpl,d=new p.DecompressorImpl,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",x={};n.compressToBase64=function(s){return u(this,void 0,void 0,function(){var g;return f(this,function(o){switch(o.label){case 0:return s===null?[2,""]:[4,E.compress(s,6,function(i){return m.charAt(i)})];case 1:switch((g=o.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]}})})},n.decompressFromBase64=function(s){return u(this,void 0,void 0,function(){return f(this,function(g){switch(g.label){case 0:return s===null?[2,""]:s===""?[2,null]:[4,d.decompress(s.length,32,function(o){return function(i,T){if(!x[i]){x[i]={};for(var A=0;A<i.length;A++)x[i][i.charAt(A)]=A}return x[i][T]}(m,s.charAt(o))})];case 1:return[2,g.sent()]}})})},n.compressToUTF16=function(s){return u(this,void 0,void 0,function(){return f(this,function(g){switch(g.label){case 0:return s===null?[2,""]:[4,E.compress(s,15,function(o){return String.fromCharCode(o+32)})];case 1:return[2,g.sent()+" "]}})})},n.decompressFromUTF16=function(s){return u(this,void 0,void 0,function(){return f(this,function(g){switch(g.label){case 0:return s===null?[2,""]:s===""?[2,null]:[4,d.decompress(s.length,16384,function(o){return s.charCodeAt(o)-32})];case 1:return[2,g.sent()]}})})}},304:function(r,n,a){var u=this&&this.__awaiter||function(d,m,x,s){return new(x||(x=Promise))(function(g,o){function i(h){try{A(s.next(h))}catch(S){o(S)}}function T(h){try{A(s.throw(h))}catch(S){o(S)}}function A(h){var S;h.done?g(h.value):(S=h.value,S instanceof x?S:new x(function(L){L(S)})).then(i,T)}A((s=s.apply(d,m||[])).next())})},f=this&&this.__generator||function(d,m){var x,s,g,o,i={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return o={next:T(0),throw:T(1),return:T(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function T(A){return function(h){return function(S){if(x)throw new TypeError("Generator is already executing.");for(;o&&(o=0,S[0]&&(i=0)),i;)try{if(x=1,s&&(g=2&S[0]?s.return:S[0]?s.throw||((g=s.return)&&g.call(s),0):s.next)&&!(g=g.call(s,S[1])).done)return g;switch(s=0,g&&(S=[2&S[0],g.value]),S[0]){case 0:case 1:g=S;break;case 4:return i.label++,{value:S[1],done:!1};case 5:i.label++,s=S[1],S=[0];continue;case 7:S=i.ops.pop(),i.trys.pop();continue;default:if(!((g=(g=i.trys).length>0&&g[g.length-1])||S[0]!==6&&S[0]!==2)){i=0;continue}if(S[0]===3&&(!g||S[1]>g[0]&&S[1]<g[3])){i.label=S[1];break}if(S[0]===6&&i.label<g[1]){i.label=g[1],g=S;break}if(g&&i.label<g[2]){i.label=g[2],i.ops.push(S);break}g[2]&&i.ops.pop(),i.trys.pop();continue}S=m.call(d,i)}catch(L){S=[6,L],s=0}finally{x=g=0}if(5&S[0])throw S[1];return{value:S[0]?S[1]:void 0,done:!0}}([A,h])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.CompressorImpl=void 0;var I=a(658),p=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],E=function(){function d(){}return d.writeValueToData=function(m,x,s,g,o){if(s%4!=0||m.dataPosition+s>g-1)for(var i=0;i<s;i++)m.dataVal=m.dataVal<<1|1&x,m.dataPosition==g-1?(m.dataPosition=0,m.data.push(o(m.dataVal)),m.dataVal=0):m.dataPosition++,x>>=1;else m.dataVal<<=s,m.dataVal|=function(T,A){for(var h=0,S=0;S<A;++S)h<<=4,h|=p[15&T],T>>=4;return h}(x,s/4),m.dataPosition+=s},d.writeWToDataVal=function(m,x,s){m.dictionaryToCreate.has(m.w)?(m.w.charCodeAt(0)<256?(d.writeValueToData(m,0,m.numBits,x,s),d.writeValueToData(m,m.w.charCodeAt(0),8,x,s)):(d.writeValueToData(m,1,m.numBits,x,s),d.writeValueToData(m,m.w.charCodeAt(0),16,x,s)),m.enlargeIn--,m.enlargeIn==0&&(m.enlargeIn=Math.pow(2,m.numBits),m.numBits++),m.dictionaryToCreate.delete(m.w)):d.writeValueToData(m,m.dictionary.get(m.w),m.numBits,x,s),m.enlargeIn--,m.enlargeIn==0&&(m.enlargeIn=Math.pow(2,m.numBits),m.numBits++)},d.loopIteration=function(m,x,s,g,o){var i=m.charAt(x);o.dictionary.has(i)||(o.dictionary.set(i,o.dictSize++),o.dictionaryToCreate.set(i,!0));var T=o.w+i;o.dictionary.has(T)?o.w=T:(this.writeWToDataVal(o,s,g),o.dictionary.set(T,o.dictSize++),o.w=String(i))},d.prototype.compress=function(m,x,s){var g=this;return new Promise(function(o){return u(g,void 0,void 0,function(){var i,T;return f(this,function(A){switch(A.label){case 0:if(m==null)return o(""),[2];i={data:[],dataPosition:0,dataVal:0,dictionary:new Map,dictionaryToCreate:new Map,dictSize:3,enlargeIn:2,numBits:2,w:""},T=0,A.label=1;case 1:return T<m.length?(d.loopIteration(m,T,x,s,i),T%1e4!=0?[3,3]:[4,(0,I.wait)()]):[3,4];case 2:A.sent(),A.label=3;case 3:return T+=1,[3,1];case 4:return i.w!==""&&d.writeWToDataVal(i,x,s),d.writeValueToData(i,2,i.numBits,x,s),i.dataVal<<=x-i.dataPosition,i.data.push(s(i.dataVal)),o(i.data.join("")),[2]}})})})},d}();n.CompressorImpl=E},134:function(r,n,a){var u=this&&this.__awaiter||function(E,d,m,x){return new(m||(m=Promise))(function(s,g){function o(A){try{T(x.next(A))}catch(h){g(h)}}function i(A){try{T(x.throw(A))}catch(h){g(h)}}function T(A){var h;A.done?s(A.value):(h=A.value,h instanceof m?h:new m(function(S){S(h)})).then(o,i)}T((x=x.apply(E,d||[])).next())})},f=this&&this.__generator||function(E,d){var m,x,s,g,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return g={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function i(T){return function(A){return function(h){if(m)throw new TypeError("Generator is already executing.");for(;g&&(g=0,h[0]&&(o=0)),o;)try{if(m=1,x&&(s=2&h[0]?x.return:h[0]?x.throw||((s=x.return)&&s.call(x),0):x.next)&&!(s=s.call(x,h[1])).done)return s;switch(x=0,s&&(h=[2&h[0],s.value]),h[0]){case 0:case 1:s=h;break;case 4:return o.label++,{value:h[1],done:!1};case 5:o.label++,x=h[1],h=[0];continue;case 7:h=o.ops.pop(),o.trys.pop();continue;default:if(!((s=(s=o.trys).length>0&&s[s.length-1])||h[0]!==6&&h[0]!==2)){o=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){o.label=h[1];break}if(h[0]===6&&o.label<s[1]){o.label=s[1],s=h;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(h);break}s[2]&&o.ops.pop(),o.trys.pop();continue}h=d.call(E,o)}catch(S){h=[6,S],x=0}finally{m=s=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([T,A])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.DecompressorImpl=void 0;var I=a(658),p=function(){function E(){}return E.prototype.decompress=function(d,m,x){var s=this;return new Promise(function(g){return u(s,void 0,void 0,function(){var o,i,T;return f(this,function(A){switch(A.label){case 0:for(o={bits:0,c:null,dataIndex:1,dataPosition:m,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},i=0;i<3;i+=1)o.dictionary.set(i,i);for(;o.power!=o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=m,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;switch(o.bits){case 0:for(o.bits=0,o.maxPower=Math.pow(2,8),o.power=1;o.power!=o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=m,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.c=String.fromCharCode(o.bits);break;case 1:for(o.bits=0,o.maxPower=Math.pow(2,16),o.power=1;o.power!==o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition===0&&(o.dataPosition=m,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.c=String.fromCharCode(o.bits);break;case 2:return g(""),[2]}o.dictionary[3]=o.c,o.w=o.c,o.result.push(o.c),T=1,A.label=1;case 1:return T%2e4!=0?[3,3]:[4,(0,I.wait)()];case 2:A.sent(),A.label=3;case 3:if(o.dataIndex>d)return g(""),[2];for(o.bits=0,o.maxPower=Math.pow(2,o.numBits),o.power=1;o.power!=o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=m,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;switch(o.c=o.bits){case 0:for(o.bits=0,o.maxPower=Math.pow(2,8),o.power=1;o.power!==o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=m,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.dictionary[o.dictSize++]=String.fromCharCode(o.bits),o.c=o.dictSize-1,o.enlargeIn--;break;case 1:for(o.bits=0,o.maxPower=Math.pow(2,16),o.power=1;o.power!==o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=m,o.dataVal=x(o.dataIndex++)),o.bits|=(o.resb>0?1:0)*o.power,o.power<<=1;o.dictionary[o.dictSize++]=String.fromCharCode(o.bits),o.c=o.dictSize-1,o.enlargeIn--;break;case 2:return g(o.result.join("")),[2]}if(o.enlargeIn==0&&(o.enlargeIn=Math.pow(2,o.numBits),o.numBits++),o.dictionary[o.c])o.entry=o.dictionary[o.c];else{if(o.c!==o.dictSize)return g(null),[2];o.entry=o.w+o.w.charAt(0)}return o.result.push(o.entry),o.dictionary[o.dictSize++]=o.w+o.entry.charAt(0),o.enlargeIn--,o.w=o.entry,o.enlargeIn==0&&(o.enlargeIn=Math.pow(2,o.numBits),o.numBits++),T++,[3,1];case 4:return[2]}})})})},E}();n.DecompressorImpl=p},658:function(r,n){var a=this&&this.__awaiter||function(f,I,p,E){return new(p||(p=Promise))(function(d,m){function x(o){try{g(E.next(o))}catch(i){m(i)}}function s(o){try{g(E.throw(o))}catch(i){m(i)}}function g(o){var i;o.done?d(o.value):(i=o.value,i instanceof p?i:new p(function(T){T(i)})).then(x,s)}g((E=E.apply(f,I||[])).next())})},u=this&&this.__generator||function(f,I){var p,E,d,m,x={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return m={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function s(g){return function(o){return function(i){if(p)throw new TypeError("Generator is already executing.");for(;m&&(m=0,i[0]&&(x=0)),x;)try{if(p=1,E&&(d=2&i[0]?E.return:i[0]?E.throw||((d=E.return)&&d.call(E),0):E.next)&&!(d=d.call(E,i[1])).done)return d;switch(E=0,d&&(i=[2&i[0],d.value]),i[0]){case 0:case 1:d=i;break;case 4:return x.label++,{value:i[1],done:!1};case 5:x.label++,E=i[1],i=[0];continue;case 7:i=x.ops.pop(),x.trys.pop();continue;default:if(!((d=(d=x.trys).length>0&&d[d.length-1])||i[0]!==6&&i[0]!==2)){x=0;continue}if(i[0]===3&&(!d||i[1]>d[0]&&i[1]<d[3])){x.label=i[1];break}if(i[0]===6&&x.label<d[1]){x.label=d[1],d=i;break}if(d&&x.label<d[2]){x.label=d[2],x.ops.push(i);break}d[2]&&x.ops.pop(),x.trys.pop();continue}i=I.call(f,x)}catch(T){i=[6,T],E=0}finally{p=d=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([g,o])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.wait=void 0,n.wait=function(){return a(this,void 0,void 0,function(){return u(this,function(f){return[2,new Promise(function(I){setTimeout(I,0)})]})})}}},t={};return function r(n){var a=t[n];if(a!==void 0)return a.exports;var u=t[n]={exports:{}};return e[n].call(u.exports,u,u.exports,r),u.exports}(48)})())});var ct=Dt((jo,ze)=>{"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 n=!t&&typeof self=="object",a=!r.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;a?r=global:n&&(r=self);var u=!r.JS_SHA256_NO_COMMON_JS&&typeof ze=="object"&&ze.exports,f=typeof define=="function"&&define.amd,I=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),E=[-2147483648,8388608,32768,128],d=[24,16,8,0],m=[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],x=["hex","array","digest","arrayBuffer"],s=[];(r.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(c){return Object.prototype.toString.call(c)==="[object Array]"}),I&&(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(F){return new h(l,!0).update(F)[c]()}},o=function(c){var l=g("hex",c);a&&(l=i(l,c)),l.create=function(){return new h(c)},l.update=function(v){return l.create().update(v)};for(var F=0;F<x.length;++F){var w=x[F];l[w]=g(w,c)}return l},i=function(c,l){var F=Lt("crypto"),w=Lt("buffer").Buffer,v=l?"sha224":"sha256",b;w.from&&!r.JS_SHA256_NO_BUFFER_FROM?b=w.from:b=function(y){return new w(y)};var C=function(y){if(typeof y=="string")return F.createHash(v).update(y,"utf8").digest("hex");if(y==null)throw new Error(e);return y.constructor===ArrayBuffer&&(y=new Uint8Array(y)),Array.isArray(y)||ArrayBuffer.isView(y)||y.constructor===w?F.createHash(v).update(b(y)).digest("hex"):c(y)};return C},T=function(c,l){return function(F,w){return new S(F,l,!0).update(w)[c]()}},A=function(c){var l=T("hex",c);l.create=function(v){return new S(v,c)},l.update=function(v,b){return l.create(v).update(b)};for(var F=0;F<x.length;++F){var w=x[F];l[w]=T(w,c)}return l};function h(c,l){l?(s[0]=s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0,this.blocks=s):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}h.prototype.update=function(c){if(!this.finalized){var l,F=typeof c;if(F!=="string"){if(F==="object"){if(c===null)throw new Error(e);if(I&&c.constructor===ArrayBuffer)c=new Uint8Array(c);else if(!Array.isArray(c)&&(!I||!ArrayBuffer.isView(c)))throw new Error(e)}else throw new Error(e);l=!0}for(var w,v=0,b,C=c.length,y=this.blocks;v<C;){if(this.hashed&&(this.hashed=!1,y[0]=this.block,this.block=y[16]=y[1]=y[2]=y[3]=y[4]=y[5]=y[6]=y[7]=y[8]=y[9]=y[10]=y[11]=y[12]=y[13]=y[14]=y[15]=0),l)for(b=this.start;v<C&&b<64;++v)y[b>>>2]|=c[v]<<d[b++&3];else for(b=this.start;v<C&&b<64;++v)w=c.charCodeAt(v),w<128?y[b>>>2]|=w<<d[b++&3]:w<2048?(y[b>>>2]|=(192|w>>>6)<<d[b++&3],y[b>>>2]|=(128|w&63)<<d[b++&3]):w<55296||w>=57344?(y[b>>>2]|=(224|w>>>12)<<d[b++&3],y[b>>>2]|=(128|w>>>6&63)<<d[b++&3],y[b>>>2]|=(128|w&63)<<d[b++&3]):(w=65536+((w&1023)<<10|c.charCodeAt(++v)&1023),y[b>>>2]|=(240|w>>>18)<<d[b++&3],y[b>>>2]|=(128|w>>>12&63)<<d[b++&3],y[b>>>2]|=(128|w>>>6&63)<<d[b++&3],y[b>>>2]|=(128|w&63)<<d[b++&3]);this.lastByteIndex=b,this.bytes+=b-this.start,b>=64?(this.block=y[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}},h.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var c=this.blocks,l=this.lastByteIndex;c[16]=this.block,c[l>>>2]|=E[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()}},h.prototype.hash=function(){var c=this.h0,l=this.h1,F=this.h2,w=this.h3,v=this.h4,b=this.h5,C=this.h6,y=this.h7,P=this.blocks,R,N,j,X,M,Y,Z,fe,nt,at,ke;for(R=16;R<64;++R)M=P[R-15],N=(M>>>7|M<<25)^(M>>>18|M<<14)^M>>>3,M=P[R-2],j=(M>>>17|M<<15)^(M>>>19|M<<13)^M>>>10,P[R]=P[R-16]+N+P[R-7]+j<<0;for(ke=l&F,R=0;R<64;R+=4)this.first?(this.is224?(fe=300032,M=P[0]-1413257819,y=M-150054599<<0,w=M+24177077<<0):(fe=704751109,M=P[0]-210244248,y=M-1521486534<<0,w=M+143694565<<0),this.first=!1):(N=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),j=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),fe=c&l,X=fe^c&F^ke,Z=v&b^~v&C,M=y+j+Z+m[R]+P[R],Y=N+X,y=w+M<<0,w=M+Y<<0),N=(w>>>2|w<<30)^(w>>>13|w<<19)^(w>>>22|w<<10),j=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),nt=w&c,X=nt^w&l^fe,Z=y&v^~y&b,M=C+j+Z+m[R+1]+P[R+1],Y=N+X,C=F+M<<0,F=M+Y<<0,N=(F>>>2|F<<30)^(F>>>13|F<<19)^(F>>>22|F<<10),j=(C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7),at=F&w,X=at^F&c^nt,Z=C&y^~C&v,M=b+j+Z+m[R+2]+P[R+2],Y=N+X,b=l+M<<0,l=M+Y<<0,N=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),j=(b>>>6|b<<26)^(b>>>11|b<<21)^(b>>>25|b<<7),ke=l&F,X=ke^l&w^at,Z=b&C^~b&y,M=v+j+Z+m[R+3]+P[R+3],Y=N+X,v=c+M<<0,c=M+Y<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+c<<0,this.h1=this.h1+l<<0,this.h2=this.h2+F<<0,this.h3=this.h3+w<<0,this.h4=this.h4+v<<0,this.h5=this.h5+b<<0,this.h6=this.h6+C<<0,this.h7=this.h7+y<<0},h.prototype.hex=function(){this.finalize();var c=this.h0,l=this.h1,F=this.h2,w=this.h3,v=this.h4,b=this.h5,C=this.h6,y=this.h7,P=p[c>>>28&15]+p[c>>>24&15]+p[c>>>20&15]+p[c>>>16&15]+p[c>>>12&15]+p[c>>>8&15]+p[c>>>4&15]+p[c&15]+p[l>>>28&15]+p[l>>>24&15]+p[l>>>20&15]+p[l>>>16&15]+p[l>>>12&15]+p[l>>>8&15]+p[l>>>4&15]+p[l&15]+p[F>>>28&15]+p[F>>>24&15]+p[F>>>20&15]+p[F>>>16&15]+p[F>>>12&15]+p[F>>>8&15]+p[F>>>4&15]+p[F&15]+p[w>>>28&15]+p[w>>>24&15]+p[w>>>20&15]+p[w>>>16&15]+p[w>>>12&15]+p[w>>>8&15]+p[w>>>4&15]+p[w&15]+p[v>>>28&15]+p[v>>>24&15]+p[v>>>20&15]+p[v>>>16&15]+p[v>>>12&15]+p[v>>>8&15]+p[v>>>4&15]+p[v&15]+p[b>>>28&15]+p[b>>>24&15]+p[b>>>20&15]+p[b>>>16&15]+p[b>>>12&15]+p[b>>>8&15]+p[b>>>4&15]+p[b&15]+p[C>>>28&15]+p[C>>>24&15]+p[C>>>20&15]+p[C>>>16&15]+p[C>>>12&15]+p[C>>>8&15]+p[C>>>4&15]+p[C&15];return this.is224||(P+=p[y>>>28&15]+p[y>>>24&15]+p[y>>>20&15]+p[y>>>16&15]+p[y>>>12&15]+p[y>>>8&15]+p[y>>>4&15]+p[y&15]),P},h.prototype.toString=h.prototype.hex,h.prototype.digest=function(){this.finalize();var c=this.h0,l=this.h1,F=this.h2,w=this.h3,v=this.h4,b=this.h5,C=this.h6,y=this.h7,P=[c>>>24&255,c>>>16&255,c>>>8&255,c&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,F>>>24&255,F>>>16&255,F>>>8&255,F&255,w>>>24&255,w>>>16&255,w>>>8&255,w&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||P.push(y>>>24&255,y>>>16&255,y>>>8&255,y&255),P},h.prototype.array=h.prototype.digest,h.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 S(c,l,F){var w,v=typeof c;if(v==="string"){var b=[],C=c.length,y=0,P;for(w=0;w<C;++w)P=c.charCodeAt(w),P<128?b[y++]=P:P<2048?(b[y++]=192|P>>>6,b[y++]=128|P&63):P<55296||P>=57344?(b[y++]=224|P>>>12,b[y++]=128|P>>>6&63,b[y++]=128|P&63):(P=65536+((P&1023)<<10|c.charCodeAt(++w)&1023),b[y++]=240|P>>>18,b[y++]=128|P>>>12&63,b[y++]=128|P>>>6&63,b[y++]=128|P&63);c=b}else if(v==="object"){if(c===null)throw new Error(e);if(I&&c.constructor===ArrayBuffer)c=new Uint8Array(c);else if(!Array.isArray(c)&&(!I||!ArrayBuffer.isView(c)))throw new Error(e)}else throw new Error(e);c.length>64&&(c=new h(l,!0).update(c).array());var R=[],N=[];for(w=0;w<64;++w){var j=c[w]||0;R[w]=92^j,N[w]=54^j}h.call(this,l,F),this.update(N),this.oKeyPad=R,this.inner=!0,this.sharedMemory=F}S.prototype=new h,S.prototype.finalize=function(){if(h.prototype.finalize.call(this),this.inner){this.inner=!1;var c=this.array();h.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(c),h.prototype.finalize.call(this)}};var L=o();L.sha256=L,L.sha224=o(!0),L.sha256.hmac=A(),L.sha224.hmac=A(!0),u?ze.exports=L:(r.sha256=L.sha256,r.sha224=L.sha224,f&&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 be=k(()=>{"use strict"});function O(e){return Q(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var we=k(()=>{"use strict";be()});var ft,Vt=k(()=>{"use strict";ft="2.22.3"});function Wt(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Wt(e.cause,t):t?null:e}var dt,z,ie=k(()=>{"use strict";Vt();dt={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${ft}`},z=class e extends Error{constructor(t,r={}){let n=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,u=dt.getDocsUrl?.({...r,docsPath:a}),f=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...u?[`Docs: ${u}`]:[],...n?[`Details: ${n}`]:[],...dt.version?[`Version: ${dt.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=n,this.docsPath=a,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=t,this.version=ft}walk(t){return Wt(this,t)}}});var Le,De,Ue,$e,Oe,qt=k(()=>{"use strict";we();ie();Le=class extends z{constructor({expectedLength:t,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${t}`,`Given length: ${r}`].join(`
3
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}},De=class extends z{constructor({expectedSize:t,value:r}){super(`Size of bytes "${r}" (bytes${O(r)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}},Ue=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"})}},$e=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"})}},Oe=class extends z{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
6
+ `),{name:"InvalidArrayError"})}}});var Ie,Te,mt=k(()=>{"use strict";ie();Ie=class extends z{constructor({offset:t,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}},Te=class extends z{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}});function D(e,{dir:t,size:r=32}={}){return typeof e=="string"?q(e,{dir:t,size:r}):Kt(e,{dir:t,size:r})}function q(e,{dir:t,size:r=32}={}){if(r===null)return e;let n=e.replace("0x","");if(n.length>r*2)throw new Te({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](r*2,"0")}`}function Kt(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 n=new Uint8Array(r);for(let a=0;a<r;a++){let u=t==="right";n[u?a:r-a-1]=e[u?a:e.length-a-1]}return n}var Se=k(()=>{"use strict";mt()});var ue,_e,Ne=k(()=>{"use strict";ie();ue=class extends z{constructor({max:t,min:r,signed:n,size:a,value:u}){super(`Number "${u}" is not in safe ${a?`${a*8}-bit ${n?"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 se(e,{size:t}){if(O(e)>t)throw new _e({givenSize:O(e),maxSize:t})}var ht=k(()=>{"use strict";Ne();we()});function U(e,t={}){return typeof e=="number"||typeof e=="bigint"?K(e,t):typeof e=="string"?Ve(e,t):typeof e=="boolean"?je(e,t):Fe(e,t)}function je(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(se(r,{size:t.size}),D(r,{size:t.size})):r}function Fe(e,t={}){let r="";for(let a=0;a<e.length;a++)r+=oo[e[a]];let n=`0x${r}`;return typeof t.size=="number"?(se(n,{size:t.size}),D(n,{dir:"right",size:t.size})):n}function K(e,t={}){let{signed:r,size:n}=t,a=BigInt(e),u;n?r?u=(1n<<BigInt(n)*8n-1n)-1n:u=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(u=BigInt(Number.MAX_SAFE_INTEGER));let f=typeof u=="bigint"&&r?-u-1n:0;if(u&&a>u||a<f){let p=typeof e=="bigint"?"n":"";throw new ue({max:u?`${u}${p}`:void 0,min:`${f}${p}`,signed:r,size:n,value:`${e}${p}`})}let I=`0x${(r&&a<0?(1n<<BigInt(n*8))+BigInt(a):a).toString(16)}`;return n?D(I,{size:n}):I}function Ve(e,t={}){let r=no.encode(e);return Fe(r,t)}var oo,no,Ee=k(()=>{"use strict";Ne();Se();ht();oo=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));no=new TextEncoder});function xt(e,t={}){return typeof e=="number"||typeof e=="bigint"?Xt(e,t):typeof e=="boolean"?Gt(e,t):Q(e)?ve(e,t):We(e,t)}function Gt(e,t={}){let r=new Uint8Array(1);return r[0]=Number(e),typeof t.size=="number"?(se(r,{size:t.size}),D(r,{size:t.size})):r}function Jt(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 ve(e,t={}){let r=e;t.size&&(se(r,{size:t.size}),r=D(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let a=n.length/2,u=new Uint8Array(a);for(let f=0,I=0;f<a;f++){let p=Jt(n.charCodeAt(I++)),E=Jt(n.charCodeAt(I++));if(p===void 0||E===void 0)throw new z(`Invalid byte sequence ("${n[I-2]}${n[I-1]}" in "${n}").`);u[f]=p*16+E}return u}function Xt(e,t){let r=K(e,t);return ve(r)}function We(e,t={}){let r=ao.encode(e);return typeof t.size=="number"?(se(r,{size:t.size}),D(r,{dir:"right",size:t.size})):r}var ao,G,qe=k(()=>{"use strict";ie();be();Se();ht();Ee();ao=new TextEncoder;G={zero:48,nine:57,A:65,F:70,a:97,f:102}});function yt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function io(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Ae(e,...t){if(!io(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 gt(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 Yt(e,t){Ae(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}var bt=k(()=>{"use strict"});function so(e,t=!1){return t?{h:Number(e&Ke),l:Number(e>>Zt&Ke)}:{h:Number(e>>Zt&Ke)|0,l:Number(e&Ke)|0}}function Qt(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let a=0;a<e.length;a++){let{h:u,l:f}=so(e[a],t);[r[a],n[a]]=[u,f]}return[r,n]}var Ke,Zt,er,tr,rr,or,nr=k(()=>{"use strict";Ke=BigInt(4294967295),Zt=BigInt(32);er=(e,t,r)=>e<<r|t>>>32-r,tr=(e,t,r)=>t<<r|e>>>32-r,rr=(e,t,r)=>t<<r-32|e>>>64-r,or=(e,t,r)=>e<<r-32|t>>>64-r});function It(e){for(let t=0;t<e.length;t++)e[t]=co(e[t])}function po(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Ge(e){return typeof e=="string"&&(e=po(e)),Ae(e),e}function ir(e){let t=n=>e().update(Ge(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function sr(e){let t=(n,a)=>e(a).update(Ge(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}var ar,wt,co,Je,cr=k(()=>{"use strict";bt();ar=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),wt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,co=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;Je=class{clone(){return this._cloneInto()}}});function go(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){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 I=(f+8)%10,p=(f+2)%10,E=r[p],d=r[p+1],m=pr(E,d,1)^r[I],x=ur(E,d,1)^r[I+1];for(let s=0;s<50;s+=10)e[f+s]^=m,e[f+s+1]^=x}let a=e[2],u=e[3];for(let f=0;f<24;f++){let I=fr[f],p=pr(a,u,I),E=ur(a,u,I),d=lr[f];a=e[d],u=e[d+1],e[d]=p,e[d+1]=E}for(let f=0;f<50;f+=10){for(let I=0;I<10;I++)r[I]=e[f+I];for(let I=0;I<10;I++)e[f+I]^=~r[(I+2)%10]&r[(I+4)%10]}e[0]^=xo[n],e[1]^=yo[n]}r.fill(0)}var lr,fr,dr,uo,Ce,lo,fo,mo,ho,xo,yo,pr,ur,Xe,ee,Zn,Qn,ea,ta,ra,mr,oa,na,hr,aa,ia,xr=k(()=>{"use strict";bt();nr();cr();lr=[],fr=[],dr=[],uo=BigInt(0),Ce=BigInt(1),lo=BigInt(2),fo=BigInt(7),mo=BigInt(256),ho=BigInt(113);for(let e=0,t=Ce,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],lr.push(2*(5*n+r)),fr.push((e+1)*(e+2)/2%64);let a=uo;for(let u=0;u<7;u++)t=(t<<Ce^(t>>fo)*ho)%mo,t&lo&&(a^=Ce<<(Ce<<BigInt(u))-Ce);dr.push(a)}[xo,yo]=Qt(dr,!0),pr=(e,t,r)=>r>32?rr(e,t,r):er(e,t,r),ur=(e,t,r)=>r>32?or(e,t,r):tr(e,t,r);Xe=class e extends Je{constructor(t,r,n,a=!1,u=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=a,this.rounds=u,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,yt(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ar(this.state)}keccak(){wt||It(this.state32),go(this.state32,this.rounds),wt||It(this.state32),this.posOut=0,this.pos=0}update(t){gt(this);let{blockLen:r,state:n}=this;t=Ge(t);let a=t.length;for(let u=0;u<a;){let f=Math.min(r-this.pos,a-u);for(let I=0;I<f;I++)n[this.pos++]^=t[u++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:a}=this;t[n]^=r,r&128&&n===a-1&&this.keccak(),t[a-1]^=128,this.keccak()}writeInto(t){gt(this,!1),Ae(t),this.finish();let r=this.state,{blockLen:n}=this;for(let a=0,u=t.length;a<u;){this.posOut>=n&&this.keccak();let f=Math.min(n-this.posOut,u-a);t.set(r.subarray(this.posOut,this.posOut+f),a),this.posOut+=f,a+=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 yt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Yt(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:n,outputLen:a,rounds:u,enableXOF:f}=this;return t||(t=new e(r,n,a,f,u)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=u,t.suffix=n,t.outputLen=a,t.enableXOF=f,t.destroyed=this.destroyed,t}},ee=(e,t,r)=>ir(()=>new Xe(t,e,r)),Zn=ee(6,144,224/8),Qn=ee(6,136,256/8),ea=ee(6,104,384/8),ta=ee(6,72,512/8),ra=ee(1,144,224/8),mr=ee(1,136,256/8),oa=ee(1,104,384/8),na=ee(1,72,512/8),hr=(e,t,r)=>sr((n={})=>new Xe(t,e,n.dkLen===void 0?r:n.dkLen,!0)),aa=hr(31,168,128/8),ia=hr(31,136,256/8)});function Pe(e,t){let r=t||"hex",n=mr(Q(e,{strict:!1})?xt(e):e);return r==="bytes"?n:U(n)}var Tt=k(()=>{"use strict";xr();be();qe();Ee()});var ce,St=k(()=>{"use strict";ie();ce=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 le,Ft=k(()=>{"use strict";le=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 n=this.keys().next().value;n&&this.delete(n)}return this}}});function yr(e,t){if(Et.has(`${e}.${t}`))return Et.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=Pe(We(r),"bytes"),a=(t?r.substring(`${t}0x`.length):r).split("");for(let f=0;f<40;f+=2)n[f>>1]>>4>=8&&a[f]&&(a[f]=a[f].toUpperCase()),(n[f>>1]&15)>=8&&a[f+1]&&(a[f+1]=a[f+1].toUpperCase());let u=`0x${a.join("")}`;return Et.set(`${e}.${t}`,u),u}var Et,gr=k(()=>{"use strict";qe();Tt();Ft();Et=new le(8192)});function Me(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(vt.has(n))return vt.get(n);let a=bo.test(e)?e.toLowerCase()===e?!0:r?yr(e)===e:!0:!1;return vt.set(n,a),a}var bo,vt,At=k(()=>{"use strict";Ft();gr();bo=/^0x[a-fA-F0-9]{40}$/,vt=new le(8192)});function te(e){return typeof e[0]=="string"?V(e):br(e)}function br(e){let t=0;for(let a of e)t+=a.length;let r=new Uint8Array(t),n=0;for(let a of e)r.set(a,n),n+=a.length;return r}function V(e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}var Ct=k(()=>{"use strict"});function wr(e,t,r,{strict:n}={}){return Q(e,{strict:!1})?Io(e,t,r,{strict:n}):wo(e,t,r,{strict:n})}function Ir(e,t){if(typeof t=="number"&&t>0&&t>O(e)-1)throw new Ie({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 Ie({offset:r,position:"end",size:O(e)})}function wo(e,t,r,{strict:n}={}){Ir(e,t);let a=e.slice(t,r);return n&&Tr(a,t,r),a}function Io(e,t,r,{strict:n}={}){Ir(e,t);let a=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&Tr(a,t,r),a}var Sr=k(()=>{"use strict";mt();be();we()});var Fr,Er=k(()=>{"use strict";Fr=/^(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 Ue({expectedLength:e.length,givenLength:t.length});let r=To({params:e,values:t}),n=kt(r);return n.length===0?"0x":n}function To({params:e,values:t}){let r=[];for(let n=0;n<e.length;n++)r.push(Mt({param:e[n],value:t[n]}));return r}function Mt({param:e,value:t}){let r=Mo(e.type);if(r){let[n,a]=r;return Fo(t,{length:n,param:{...e,type:a}})}if(e.type==="tuple")return Po(t,{param:e});if(e.type==="address")return So(t);if(e.type==="bool")return vo(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let n=e.type.startsWith("int"),[,,a="256"]=Fr.exec(e.type)??[];return Ao(t,{signed:n,size:Number(a)})}if(e.type.startsWith("bytes"))return Eo(t,{param:e});if(e.type==="string")return Co(t);throw new $e(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function kt(e){let t=0;for(let u=0;u<e.length;u++){let{dynamic:f,encoded:I}=e[u];f?t+=32:t+=O(I)}let r=[],n=[],a=0;for(let u=0;u<e.length;u++){let{dynamic:f,encoded:I}=e[u];f?(r.push(K(t+a,{size:32})),n.push(I),a+=O(I)):r.push(I)}return te([...r,...n])}function So(e){if(!Me(e))throw new ce({address:e});return{dynamic:!1,encoded:q(e.toLowerCase())}}function Fo(e,{length:t,param:r}){let n=t===null;if(!Array.isArray(e))throw new Oe(e);if(!n&&e.length!==t)throw new Le({expectedLength:t,givenLength:e.length,type:`${r.type}[${t}]`});let a=!1,u=[];for(let f=0;f<e.length;f++){let I=Mt({param:r,value:e[f]});I.dynamic&&(a=!0),u.push(I)}if(n||a){let f=kt(u);if(n){let I=K(u.length,{size:32});return{dynamic:!0,encoded:u.length>0?te([I,f]):I}}if(a)return{dynamic:!0,encoded:f}}return{dynamic:!1,encoded:te(u.map(({encoded:f})=>f))}}function Eo(e,{param:t}){let[,r]=t.type.split("bytes"),n=O(e);if(!r){let a=e;return n%32!==0&&(a=q(a,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:te([q(K(n,{size:32})),a])}}if(n!==Number.parseInt(r))throw new De({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:q(e,{dir:"right"})}}function vo(e){if(typeof e!="boolean")throw new z(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:q(je(e))}}function Ao(e,{signed:t,size:r=256}){if(typeof r=="number"){let n=2n**(BigInt(r)-(t?1n:0n))-1n,a=t?-n-1n:0n;if(e>n||e<a)throw new ue({max:n.toString(),min:a.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:K(e,{size:32,signed:t})}}function Co(e){let t=Ve(e),r=Math.ceil(O(t)/32),n=[];for(let a=0;a<r;a++)n.push(q(wr(t,a*32,(a+1)*32),{dir:"right"}));return{dynamic:!0,encoded:te([q(K(O(t),{size:32})),...n])}}function Po(e,{param:t}){let r=!1,n=[];for(let a=0;a<t.components.length;a++){let u=t.components[a],f=Array.isArray(e)?a:u.name,I=Mt({param:u,value:e[f]});n.push(I),I.dynamic&&(r=!0)}return{dynamic:r,encoded:r?kt(n):te(n.map(({encoded:a})=>a))}}function Mo(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var vr=k(()=>{"use strict";qt();St();ie();Ne();At();Ct();Se();we();Sr();Ee();Er()});function Rt(e,t){if(!Me(e,{strict:!1}))throw new ce({address:e});if(!Me(t,{strict:!1}))throw new ce({address:t});return e.toLowerCase()===t.toLowerCase()}var Ar=k(()=>{"use strict";St();At()});var Do={};Qr(Do,{ClientNotFound:()=>de,Deferred:()=>W,FrakContextManager:()=>re,FrakRpcError:()=>B,PressInteractionEncoder:()=>jr,PurchaseInteractionEncoder:()=>Vr,ReferralInteractionEncoder:()=>rt,RetailInteractionEncoder:()=>qr,RpcErrorCodes:()=>H,WebShopInteractionEncoder:()=>Wr,baseIframeProps:()=>ae,compressJson:()=>he,createIFrameFrakClient:()=>ge,createIframe:()=>ye,decompressDataAndCheckHash:()=>ne,decompressJson:()=>xe,displayModal:()=>J,getProductInformation:()=>Ur,hashAndCompressData:()=>oe,interactionTypes:()=>_,modalBuilder:()=>Nr,openSso:()=>Dr,processReferral:()=>ot,productTypes:()=>$,productTypesMask:()=>Hr,referralInteraction:()=>Kr,sendInteraction:()=>et,sendTransaction:()=>_r,setupClient:()=>Ht,siweAuthenticate:()=>Or,trackPurchaseStatus:()=>$r,watchWalletStatus:()=>Qe});var B=class extends Error{constructor(r,n,a){super(n);this.code=r;this.data=a}};var He=class extends B{constructor(t){super(H.internalError,t)}},de=class extends B{constructor(){super(H.clientNotConnected,"Client not found")}},H={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 $t=Be(st(),1),pt=Be(ct(),1);async function oe(e){let t=(0,pt.sha256)(JSON.stringify(e)),r={...e,validationHash:t},n=await he(r),a=(0,pt.sha256)(n);return{compressed:n,compressedHash:a}}async function he(e){return(0,$t.compressToBase64)(JSON.stringify(e))}var Ot=Be(st(),1),ut=Be(ct(),1);async function ne(e){if(!(e?.compressed&&e?.compressedHash))throw new B(H.corruptedResponse,"Missing compressed data");let t=await xe(e.compressed);if(!t)throw new B(H.corruptedResponse,"Invalid compressed data");if(!t?.validationHash)throw new B(H.corruptedResponse,"Missing validation hash");if((0,ut.sha256)(e.compressed)!==e.compressedHash)throw new B(H.corruptedResponse,"Invalid compressed hash");let{validationHash:n,...a}=t;if((0,ut.sha256)(JSON.stringify(a))!==t.validationHash)throw new B(H.corruptedResponse,"Invalid data validation hash");return t}async function xe(e){let t=await(0,Ot.decompressFromBase64)(e);try{return JSON.parse(t)}catch(r){return console.error("Invalid compressed data",{e:r,decompressed:t}),null}}var pe="nexus-wallet-backup";function _t(){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 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:1e3,top:"-1000px",left:"-1000px"}};function ye({walletBaseUrl:e,config:t}){let r=document.querySelector("#nexus-wallet");r&&r.remove();let n=document.createElement("iframe");return n.id=ae.id,n.name=ae.name,n.allow=ae.allow,n.style.zIndex=ae.style.zIndex.toString(),lt({iframe:n,isVisible:!1}),document.body.appendChild(n),new Promise(a=>{n?.addEventListener("load",()=>a(n)),n.src=`${t?.walletUrl??e??"https://wallet.frak.id"}/listener`})}function lt({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 Nt({iframe:e}){let t=new W;return{handleEvent:async n=>{switch(n.iframeLifecycle){case"connected":t.resolve(!0);break;case"do-backup":n.data.backup?localStorage.setItem(pe,n.data.backup):localStorage.removeItem(pe);break;case"remove-backup":localStorage.removeItem(pe);break;case"show":case"hide":lt({iframe:e,isVisible:n.iframeLifecycle==="show"});break}},isConnected:t.promise}}function jt({frakWalletUrl:e,iframe:t,channelManager:r,iframeLifecycleManager:n}){if(typeof window>"u")throw new B(H.configError,"iframe client should be used in the browser");if(!t.contentWindow)throw new B(H.configError,"The iframe does not have a product window");let a=t.contentWindow,u=async p=>{if(!(p.origin&&URL.canParse(p.origin))||new URL(p.origin).origin.toLowerCase()!==new URL(e).origin.toLowerCase()||typeof p.data!="object")return;if("iframeLifecycle"in p.data){await n.handleEvent(p.data);return}if("clientLifecycle"in p.data){console.error("Client lifecycle event received on the client side, dismissing it");return}let E=p.data.id,d=r.getRpcResolver(E);d&&await d(p.data)};return window.addEventListener("message",u),{sendEvent:p=>{a.postMessage(p,{targetOrigin:e})},cleanup:()=>{window.removeEventListener("message",u)}}}function ge({config:e,iframe:t}){let r=_t(),n=Nt({iframe:t}),a=jt({frakWalletUrl:e?.walletUrl??"https://wallet.frak.id",iframe:t,channelManager:r,iframeLifecycleManager:n}),u=async d=>{if(!await n.isConnected)throw new B(H.clientNotConnected,"The iframe provider isn't connected yet");let x=new W,s=r.createChannel(async o=>{let i=await ne(o.data);i.error?x.reject(new B(i.error.code,i.error.message,i.error?.data)):x.resolve(i.result),r.removeChannel(s)}),g=await oe(d);return a.sendEvent({id:s,topic:d.method,data:g}),x.promise},f=async(d,m)=>{if(!await n.isConnected)throw new B(H.clientNotConnected,"The iframe provider isn't connected yet");let s=r.createChannel(async o=>{let i=await ne(o.data);if(i.result)m(i.result);else throw new He("No valid result in the response")}),g=await oe(d);a.sendEvent({id:s,topic:d.method,data:g})},I=to(a,n),p=async()=>{I(),r.destroy(),a.cleanup(),t.remove()},E=ro({config:e,messageHandler:a,lifecycleManager:n});return{config:e,waitForConnection:n.isConnected,waitForSetup:E,request:u,listenerRequest:f,destroy:p}}function to(e,t){let a,u,f=()=>e.sendEvent({iframeLifecycle:"heartbeat"});async function I(){f(),a=setInterval(f,100),u=setTimeout(()=>{p(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,p()}function p(){a&&clearInterval(a),u&&clearTimeout(u)}return I(),p}async function ro({config:e,messageHandler:t,lifecycleManager:r}){await r.isConnected;let n=async()=>{let u=e.metadata.css;u&&t.sendEvent({clientLifecycle:"modal-css",data:{cssLink:u}})},a=async()=>{if(typeof window>"u")return;let u=window.localStorage.getItem(pe);u&&t.sendEvent({clientLifecycle:"restore-backup",data:{backup:u}})};await Promise.all([n(),a()])}var Ye=256,Ze;function Cr(e=11){if(!Ze||Ye+e>256*2){Ze="",Ye=0;for(let t=0;t<256;t++)Ze+=(256+Math.random()*256|0).toString(16).substring(1)}return Ze.substring(Ye,Ye+++e)}vr();qe();Ee();Ct();Ar();Tt();Se();var Bt="fCtx";function ko(e){return btoa(Array.from(e,t=>String.fromCharCode(t)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ro(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=ve(e.r);return ko(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function Mr(e){if(!(!e||e.length===0))try{let t=Ro(e);return{r:Fe(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function kr({url:e}){if(!e)return null;let r=new URL(e).searchParams.get(Bt);return r?Mr(r):null}function Rr({url:e,context:t}){if(!e)return null;let r=kr({url:e}),n=r?{...r,...t}:t;if(!n.r)return null;let a=Pr(n);if(!a)return null;let u=new URL(e);return u.searchParams.set(Bt,a),u.toString()}function Br(e){let t=new URL(e);return t.searchParams.delete(Bt),t.toString()}function Bo({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,n;t!==null?n=Rr({url:r,context:t}):n=Br(r),n&&window.history.replaceState(null,"",n.toString())}var re={compress:Pr,decompress:Mr,parse:kr,update:Rr,remove:Br,replaceUrl:Bo};async function Ht({config:e}){let t=await ye({config:e});if(!t){console.error("Failed to create iframe");return}let r=ge({config:e,iframe:t});if(await r.waitForSetup,!await r.waitForConnection){console.error("Failed to connect to client");return}return r}var $={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},Hr=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 Qe(e,t){if(!t)return e.request({method:"frak_listenToWalletStatus"}).then(a=>(zr(a.interactionToken),a));let r=new W,n=!1;return e.listenerRequest({method:"frak_listenToWalletStatus"},a=>{t(a),zr(a.interactionToken),n||(r.resolve(a),n=!0)}).then(()=>r.promise)}function zr(e){typeof window>"u"||(e?window.sessionStorage.setItem("frak-wallet-interaction-token",e):window.sessionStorage.removeItem("frak.interaction-token"))}function Lr({domain:e}){let t=e??window.location.host;return Pe(U(t))}async function et(e,{productId:t,interaction:r,validation:n}){let a=t??Lr(e.config);return await e.request({method:"frak_sendInteraction",params:[a,r,n]})}async function J(e,{steps:t,metadata:r}){return await e.request({method:"frak_displayModal",params:[t,e.config.metadata.name,r]})}async function Dr(e,t){let{metadata:r}=e.config;await e.request({method:"frak_sso",params:[t,r.name,r.css]})}async function Ur(e){return await e.request({method:"frak_getProductInformation"})}async function $r(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 zt(){return Cr(96)}async function Or(e,{siwe:t,metadata:r}){let n=e.config?.domain??window.location.host,a=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`,u={...t,statement:a,nonce:t?.nonce??zt(),uri:t?.uri??`https://${n}`,version:t?.version??"1",domain:n};return(await J(e,{metadata:r,steps:{login:{},siweAuthenticate:{siwe:u}}})).siweAuthenticate}async function _r(e,{tx:t,metadata:r}){return(await J(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function Nr(e,{metadata:t,login:r,openSession:n}){return tt(e,{steps:{login:r??{},openSession:n??{}},metadata:t})}function tt(e,t){function r(f){return tt(e,{...t,steps:{...t.steps,sendTransaction:f}})}function n(f){return tt(e,{...t,steps:{...t.steps,final:{...f,action:{key:"reward"}}}})}function a(f,I){return tt(e,{...t,steps:{...t.steps,final:{...I,action:{key:"sharing",options:f}}}})}async function u(){return await J(e,t)}return{params:t,sendTx:r,reward:n,sharing:a,display:u}}var jr={openArticle({articleId:e}){let t=V([_.press.openArticle,D(e,{size:32})]);return{handlerTypeDenominator:U($.press),interactionData:t}},readArticle({articleId:e}){let t=V([_.press.readArticle,D(e,{size:32})]);return{handlerTypeDenominator:U($.press),interactionData:t}}};var rt={createLink(){return{handlerTypeDenominator:U($.referral),interactionData:_.referral.createLink}},referred({referrer:e}){let t=V([_.referral.referred,D(e,{size:32})]);return{handlerTypeDenominator:U($.referral),interactionData:t}}};var Vr={startPurchase({purchaseId:e}){let t=V([_.purchase.started,D(e,{size:32})]);return{handlerTypeDenominator:U($.purchase),interactionData:t}},completedPurchase({purchaseId:e,proof:t}){let r=Pt([{type:"uint256"},{type:"bytes32[]"}],[BigInt(e),t]),n=V([_.purchase.completed,r]);return{handlerTypeDenominator:U($.purchase),interactionData:n}},unsafeCompletedPurchase({purchaseId:e}){let t=V([_.purchase.unsafeCompleted,D(e,{size:32})]);return{handlerTypeDenominator:U($.purchase),interactionData:t}}};var Wr={open(){return{handlerTypeDenominator:U($.webshop),interactionData:_.webshop.open}}};var qr={customerMeeting({agencyId:e}){let t=V([_.retail.customerMeeting,D(e,{size:32})]);return{handlerTypeDenominator:U($.retail),interactionData:t}}};async function ot(e,{walletStatus:t,frakContext:r,modalConfig:n,productId:a,options:u}){let f=!1;async function I(){if(!f)return f=!0,zo(e,{modalConfig:n,walletStatus:t})}async function p(E){let d=rt.referred({referrer:E});await et(e,{productId:a,interaction:d})}try{let{status:E,currentWallet:d}=await Ho({initialWalletStatus:t,getFreshWalletStatus:I,pushReferralInteraction:p,frakContext:r});return re.replaceUrl({url:window.location?.href,context:u?.alwaysAppendUrl?{r:d}:null}),E}catch(E){return console.log("Error processing referral",{error:E}),re.replaceUrl({url:window.location?.href,context:u?.alwaysAppendUrl?{r:t?.wallet}:null}),Lo(E)}}async function Ho({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:r,frakContext:n}){let a=e?.wallet;return n?.r?(a||(a=await t()),a&&Rt(n.r,a)?{status:"self-referral",currentWallet:a}:(e?.interactionSession||(a=await t()),await r(n.r),{status:"success",currentWallet:a})):{status:"no-referrer",currentWallet:a}}async function zo(e,{modalConfig:t,walletStatus:r}){return r?.interactionSession?r.wallet??void 0:t?(await J(e,t))?.login?.wallet??void 0:void 0}function Lo(e){if(e instanceof B)switch(e.code){case H.walletNotConnected:return"no-wallet";case H.serverErrorForInteractionDelegation:return"no-session";default:return"error"}return"error"}async function Kr(e,{productId:t,modalConfig:r,options:n}={}){let a=re.parse({url:window.location.href}),u=await Qe(e);try{return await ot(e,{walletStatus:u,frakContext:a,modalConfig:r,productId:t,options:n})}catch(f){console.warn("Error processing referral",{error:f})}}return eo(Do);})();
7
7
  /*! Bundled license information:
8
8
 
9
9
  js-sha256/src/sha256.js:
@@ -3,11 +3,11 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkNJJQPEELcjs = require('../chunk-NJJQPEEL.cjs');
6
+ var _chunkHDFNBQ4Ecjs = require('../chunk-HDFNBQ4E.cjs');
7
7
 
8
8
 
9
- var _chunkRAPLRHQ4cjs = require('../chunk-RAPLRHQ4.cjs');
10
- require('../chunk-PR3T7O5I.cjs');
9
+ var _chunkZDGHKI3Scjs = require('../chunk-ZDGHKI3S.cjs');
10
+ require('../chunk-PO6YSB4Q.cjs');
11
11
 
12
12
  // src/actions/watchWalletStatus.ts
13
13
  function watchWalletStatus(client, callback) {
@@ -17,7 +17,7 @@ function watchWalletStatus(client, callback) {
17
17
  return result;
18
18
  });
19
19
  }
20
- const firstResult = new (0, _chunkNJJQPEELcjs.Deferred)();
20
+ const firstResult = new (0, _chunkHDFNBQ4Ecjs.Deferred)();
21
21
  let hasResolved = false;
22
22
  return client.listenerRequest(
23
23
  {
@@ -239,7 +239,7 @@ async function processReferral(client, {
239
239
  });
240
240
  }
241
241
  async function pushReferralInteraction(referrer) {
242
- const interaction = _chunkRAPLRHQ4cjs.ReferralInteractionEncoder.referred({
242
+ const interaction = _chunkZDGHKI3Scjs.ReferralInteractionEncoder.referred({
243
243
  referrer
244
244
  });
245
245
  await sendInteraction(client, { productId, interaction });
@@ -251,14 +251,14 @@ async function processReferral(client, {
251
251
  pushReferralInteraction,
252
252
  frakContext
253
253
  });
254
- _chunkNJJQPEELcjs.FrakContextManager.replaceUrl({
254
+ _chunkHDFNBQ4Ecjs.FrakContextManager.replaceUrl({
255
255
  url: _optionalChain([window, 'access', _7 => _7.location, 'optionalAccess', _8 => _8.href]),
256
256
  context: _optionalChain([options, 'optionalAccess', _9 => _9.alwaysAppendUrl]) ? { r: currentWallet } : null
257
257
  });
258
258
  return status;
259
259
  } catch (error) {
260
260
  console.log("Error processing referral", { error });
261
- _chunkNJJQPEELcjs.FrakContextManager.replaceUrl({
261
+ _chunkHDFNBQ4Ecjs.FrakContextManager.replaceUrl({
262
262
  url: _optionalChain([window, 'access', _10 => _10.location, 'optionalAccess', _11 => _11.href]),
263
263
  context: _optionalChain([options, 'optionalAccess', _12 => _12.alwaysAppendUrl]) ? { r: _optionalChain([walletStatus, 'optionalAccess', _13 => _13.wallet]) } : null
264
264
  });
@@ -301,11 +301,11 @@ async function ensureWalletConnected(client, {
301
301
  return _nullishCoalesce(walletStatus.wallet, () => ( void 0));
302
302
  }
303
303
  function mapErrorToState(error) {
304
- if (error instanceof _chunkNJJQPEELcjs.FrakRpcError) {
304
+ if (error instanceof _chunkHDFNBQ4Ecjs.FrakRpcError) {
305
305
  switch (error.code) {
306
- case _chunkNJJQPEELcjs.RpcErrorCodes.walletNotConnected:
306
+ case _chunkHDFNBQ4Ecjs.RpcErrorCodes.walletNotConnected:
307
307
  return "no-wallet";
308
- case _chunkNJJQPEELcjs.RpcErrorCodes.serverErrorForInteractionDelegation:
308
+ case _chunkHDFNBQ4Ecjs.RpcErrorCodes.serverErrorForInteractionDelegation:
309
309
  return "no-session";
310
310
  default:
311
311
  return "error";
@@ -320,7 +320,7 @@ async function referralInteraction(client, {
320
320
  modalConfig,
321
321
  options
322
322
  } = {}) {
323
- const frakContext = _chunkNJJQPEELcjs.FrakContextManager.parse({
323
+ const frakContext = _chunkHDFNBQ4Ecjs.FrakContextManager.parse({
324
324
  url: window.location.href
325
325
  });
326
326
  const currentWalletStatus = await watchWalletStatus(client);
@@ -1,4 +1,4 @@
1
- import { a as FrakClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, f as ModalRpcStepsResultType, O as OpenSsoParamsType, G as GetProductInformationReturnType, i as SiweAuthenticationParams, d as ModalRpcMetadata, j as SiweAuthenticateReturnType, l as SendTransactionModalStepType, m as SendTransactionReturnType, q as FinalModalStepType, r as FinalActionType, L as LoginModalStepType, o as OpenInteractionSessionModalStepType, b as FrakContext } from '../context-GkNATUkF.cjs';
1
+ import { a as FrakClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, f as ModalRpcStepsResultType, O as OpenSsoParamsType, G as GetProductInformationReturnType, i as SiweAuthenticationParams, d as ModalRpcMetadata, j as SiweAuthenticateReturnType, l as SendTransactionModalStepType, m as SendTransactionReturnType, q as FinalModalStepType, r as FinalActionType, L as LoginModalStepType, o as OpenInteractionSessionModalStepType, b as FrakContext } from '../context-BjKowynW.cjs';
2
2
  import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-CTQ5-kqe.cjs';
3
3
  import { Hex } from 'viem';
4
4
  import 'viem/chains';
@@ -1,4 +1,4 @@
1
- import { a as FrakClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, f as ModalRpcStepsResultType, O as OpenSsoParamsType, G as GetProductInformationReturnType, i as SiweAuthenticationParams, d as ModalRpcMetadata, j as SiweAuthenticateReturnType, l as SendTransactionModalStepType, m as SendTransactionReturnType, q as FinalModalStepType, r as FinalActionType, L as LoginModalStepType, o as OpenInteractionSessionModalStepType, b as FrakContext } from '../context-B0trlYGx.js';
1
+ import { a as FrakClient, W as WalletStatusReturnType, M as ModalStepTypes, D as DisplayModalParamsType, f as ModalRpcStepsResultType, O as OpenSsoParamsType, G as GetProductInformationReturnType, i as SiweAuthenticationParams, d as ModalRpcMetadata, j as SiweAuthenticateReturnType, l as SendTransactionModalStepType, m as SendTransactionReturnType, q as FinalModalStepType, r as FinalActionType, L as LoginModalStepType, o as OpenInteractionSessionModalStepType, b as FrakContext } from '../context-DjVVznrf.js';
2
2
  import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-CTQ5-kqe.js';
3
3
  import { Hex } from 'viem';
4
4
  import 'viem/chains';
@@ -3,11 +3,11 @@ import {
3
3
  FrakContextManager,
4
4
  FrakRpcError,
5
5
  RpcErrorCodes
6
- } from "../chunk-K5SAPMC2.js";
6
+ } from "../chunk-AFLVOY5H.js";
7
7
  import {
8
8
  ReferralInteractionEncoder
9
- } from "../chunk-VAINYZSV.js";
10
- import "../chunk-QZL2KCSB.js";
9
+ } from "../chunk-RMOFMRZR.js";
10
+ import "../chunk-GDH3M5ZC.js";
11
11
 
12
12
  // src/actions/watchWalletStatus.ts
13
13
  function watchWalletStatus(client, callback) {
@@ -2,7 +2,7 @@ import {
2
2
  __commonJS,
3
3
  __publicField,
4
4
  __toESM
5
- } from "./chunk-QZL2KCSB.js";
5
+ } from "./chunk-GDH3M5ZC.js";
6
6
 
7
7
  // ../../node_modules/async-lz-string/libs/async-lz-string.js
8
8
  var require_async_lz_string = __commonJS({
@@ -32,6 +32,7 @@ var productTypes = {
32
32
  dapp: 1,
33
33
  press: 2,
34
34
  webshop: 3,
35
+ retail: 4,
35
36
  // feature type
36
37
  referral: 30,
37
38
  purchase: 31
@@ -65,7 +66,11 @@ var interactionTypes = {
65
66
  },
66
67
  purchase: {
67
68
  started: "0xd87e90c3",
68
- completed: "0x8403aeb4"
69
+ completed: "0x8403aeb4",
70
+ unsafeCompleted: "0x4d5b14e0"
71
+ },
72
+ retail: {
73
+ customerMeeting: "0x74489004"
69
74
  }
70
75
  };
71
76
 
@@ -2,10 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkPR3T7O5Icjs = require('./chunk-PR3T7O5I.cjs');
5
+ var _chunkPO6YSB4Qcjs = require('./chunk-PO6YSB4Q.cjs');
6
6
 
7
7
  // ../../node_modules/async-lz-string/libs/async-lz-string.js
8
- var require_async_lz_string = _chunkPR3T7O5Icjs.__commonJS.call(void 0, {
8
+ var require_async_lz_string = _chunkPO6YSB4Qcjs.__commonJS.call(void 0, {
9
9
  "../../node_modules/async-lz-string/libs/async-lz-string.js"(exports, module) {
10
10
  "use strict";
11
11
  !function(t, e) {
@@ -587,13 +587,13 @@ var RpcErrorCodes = {
587
587
  // src/utils/Deferred.ts
588
588
  var Deferred = class {
589
589
  constructor() {
590
- _chunkPR3T7O5Icjs.__publicField.call(void 0, this, "_promise");
591
- _chunkPR3T7O5Icjs.__publicField.call(void 0, this, "_resolve");
592
- _chunkPR3T7O5Icjs.__publicField.call(void 0, this, "_reject");
593
- _chunkPR3T7O5Icjs.__publicField.call(void 0, this, "resolve", (value) => {
590
+ _chunkPO6YSB4Qcjs.__publicField.call(void 0, this, "_promise");
591
+ _chunkPO6YSB4Qcjs.__publicField.call(void 0, this, "_resolve");
592
+ _chunkPO6YSB4Qcjs.__publicField.call(void 0, this, "_reject");
593
+ _chunkPO6YSB4Qcjs.__publicField.call(void 0, this, "resolve", (value) => {
594
594
  _optionalChain([this, 'access', _2 => _2._resolve, 'optionalCall', _3 => _3(value)]);
595
595
  });
596
- _chunkPR3T7O5Icjs.__publicField.call(void 0, this, "reject", (reason) => {
596
+ _chunkPO6YSB4Qcjs.__publicField.call(void 0, this, "reject", (reason) => {
597
597
  _optionalChain([this, 'access', _4 => _4._reject, 'optionalCall', _5 => _5(reason)]);
598
598
  });
599
599
  this._promise = new Promise((resolve, reject) => {
@@ -607,7 +607,7 @@ var Deferred = class {
607
607
  };
608
608
 
609
609
  // src/utils/compression/compress.ts
610
- var import_async_lz_string = _chunkPR3T7O5Icjs.__toESM.call(void 0, require_async_lz_string(), 1);
610
+ var import_async_lz_string = _chunkPO6YSB4Qcjs.__toESM.call(void 0, require_async_lz_string(), 1);
611
611
  var _jssha256 = require('js-sha256');
612
612
  async function hashAndCompressData(data) {
613
613
  const validationHash = _jssha256.sha256.call(void 0, JSON.stringify(data));
@@ -627,7 +627,7 @@ async function compressJson(data) {
627
627
  }
628
628
 
629
629
  // src/utils/compression/decompress.ts
630
- var import_async_lz_string2 = _chunkPR3T7O5Icjs.__toESM.call(void 0, require_async_lz_string(), 1);
630
+ var import_async_lz_string2 = _chunkPO6YSB4Qcjs.__toESM.call(void 0, require_async_lz_string(), 1);
631
631
 
632
632
  async function decompressDataAndCheckHash(compressedData) {
633
633
  if (!(_optionalChain([compressedData, 'optionalAccess', _6 => _6.compressed]) && _optionalChain([compressedData, 'optionalAccess', _7 => _7.compressedHash]))) {
@@ -32,6 +32,7 @@ var productTypes = {
32
32
  dapp: 1,
33
33
  press: 2,
34
34
  webshop: 3,
35
+ retail: 4,
35
36
  // feature type
36
37
  referral: 30,
37
38
  purchase: 31
@@ -65,7 +66,11 @@ var interactionTypes = {
65
66
  },
66
67
  purchase: {
67
68
  started: "0xd87e90c3",
68
- completed: "0x8403aeb4"
69
+ completed: "0x8403aeb4",
70
+ unsafeCompleted: "0x4d5b14e0"
71
+ },
72
+ retail: {
73
+ customerMeeting: "0x74489004"
69
74
  }
70
75
  };
71
76
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  interactionTypes,
3
3
  productTypes
4
- } from "./chunk-QZL2KCSB.js";
4
+ } from "./chunk-GDH3M5ZC.js";
5
5
 
6
6
  // src/interactions/pressEncoder.ts
7
7
  import { concatHex, pad, toHex } from "viem";
@@ -45,13 +45,9 @@ var ReferralInteractionEncoder = {
45
45
  * Records the event of a user creating a referral link. Note that this interaction doesn't actually create the link itself; it only sends an event to track that a link was created.
46
46
  */
47
47
  createLink() {
48
- const interactionData = concatHex2([
49
- interactionTypes.referral.createLink,
50
- "0x"
51
- ]);
52
48
  return {
53
49
  handlerTypeDenominator: toHex2(productTypes.referral),
54
- interactionData
50
+ interactionData: interactionTypes.referral.createLink
55
51
  };
56
52
  },
57
53
  /**
@@ -111,22 +107,56 @@ var PurchaseInteractionEncoder = {
111
107
  handlerTypeDenominator: toHex3(productTypes.purchase),
112
108
  interactionData
113
109
  };
110
+ },
111
+ /**
112
+ * Encode an unsafe complete purchase interaction (when we can't provide the proof)
113
+ * @param args
114
+ * @param args.purchaseId - The id of the purchase that is being completed.
115
+ */
116
+ unsafeCompletedPurchase({
117
+ purchaseId
118
+ }) {
119
+ const interactionData = concatHex3([
120
+ interactionTypes.purchase.unsafeCompleted,
121
+ pad3(purchaseId, { size: 32 })
122
+ ]);
123
+ return {
124
+ handlerTypeDenominator: toHex3(productTypes.purchase),
125
+ interactionData
126
+ };
114
127
  }
115
128
  };
116
129
 
117
130
  // src/interactions/webshopEncoder.ts
118
- import { concatHex as concatHex4, toHex as toHex4 } from "viem";
131
+ import { toHex as toHex4 } from "viem";
119
132
  var WebShopInteractionEncoder = {
120
133
  /**
121
134
  * Encode an open webshop interaction
122
135
  */
123
136
  open() {
137
+ return {
138
+ handlerTypeDenominator: toHex4(productTypes.webshop),
139
+ interactionData: interactionTypes.webshop.open
140
+ };
141
+ }
142
+ };
143
+
144
+ // src/interactions/retailEncoder.ts
145
+ import { concatHex as concatHex4, pad as pad4, toHex as toHex5 } from "viem";
146
+ var RetailInteractionEncoder = {
147
+ /**
148
+ * Encode a customer meeting retail interaction
149
+ * @param args
150
+ * @param args.agencyId - The id of the agency that the customer is meeting with
151
+ *
152
+ */
153
+ customerMeeting({ agencyId }) {
124
154
  const interactionData = concatHex4([
125
- interactionTypes.webshop.open,
126
- "0x"
155
+ interactionTypes.retail.customerMeeting,
156
+ pad4(agencyId, { size: 32 })
127
157
  ]);
128
158
  return {
129
- handlerTypeDenominator: toHex4(productTypes.webshop),
159
+ handlerTypeDenominator: toHex5(productTypes.retail),
130
160
  interactionData
131
161
  };
132
162
  }
@@ -136,5 +166,6 @@ export {
136
166
  PressInteractionEncoder,
137
167
  ReferralInteractionEncoder,
138
168
  PurchaseInteractionEncoder,
139
- WebShopInteractionEncoder
169
+ WebShopInteractionEncoder,
170
+ RetailInteractionEncoder
140
171
  };
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkPR3T7O5Icjs = require('./chunk-PR3T7O5I.cjs');
4
+ var _chunkPO6YSB4Qcjs = require('./chunk-PO6YSB4Q.cjs');
5
5
 
6
6
  // src/interactions/pressEncoder.ts
7
7
  var _viem = require('viem');
@@ -13,11 +13,11 @@ var PressInteractionEncoder = {
13
13
  */
14
14
  openArticle({ articleId }) {
15
15
  const interactionData = _viem.concatHex.call(void 0, [
16
- _chunkPR3T7O5Icjs.interactionTypes.press.openArticle,
16
+ _chunkPO6YSB4Qcjs.interactionTypes.press.openArticle,
17
17
  _viem.pad.call(void 0, articleId, { size: 32 })
18
18
  ]);
19
19
  return {
20
- handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPR3T7O5Icjs.productTypes.press),
20
+ handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPO6YSB4Qcjs.productTypes.press),
21
21
  interactionData
22
22
  };
23
23
  },
@@ -28,11 +28,11 @@ var PressInteractionEncoder = {
28
28
  */
29
29
  readArticle({ articleId }) {
30
30
  const interactionData = _viem.concatHex.call(void 0, [
31
- _chunkPR3T7O5Icjs.interactionTypes.press.readArticle,
31
+ _chunkPO6YSB4Qcjs.interactionTypes.press.readArticle,
32
32
  _viem.pad.call(void 0, articleId, { size: 32 })
33
33
  ]);
34
34
  return {
35
- handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPR3T7O5Icjs.productTypes.press),
35
+ handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPO6YSB4Qcjs.productTypes.press),
36
36
  interactionData
37
37
  };
38
38
  }
@@ -45,13 +45,9 @@ var ReferralInteractionEncoder = {
45
45
  * Records the event of a user creating a referral link. Note that this interaction doesn't actually create the link itself; it only sends an event to track that a link was created.
46
46
  */
47
47
  createLink() {
48
- const interactionData = _viem.concatHex.call(void 0, [
49
- _chunkPR3T7O5Icjs.interactionTypes.referral.createLink,
50
- "0x"
51
- ]);
52
48
  return {
53
- handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPR3T7O5Icjs.productTypes.referral),
54
- interactionData
49
+ handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPO6YSB4Qcjs.productTypes.referral),
50
+ interactionData: _chunkPO6YSB4Qcjs.interactionTypes.referral.createLink
55
51
  };
56
52
  },
57
53
  /**
@@ -61,11 +57,11 @@ var ReferralInteractionEncoder = {
61
57
  */
62
58
  referred({ referrer }) {
63
59
  const interactionData = _viem.concatHex.call(void 0, [
64
- _chunkPR3T7O5Icjs.interactionTypes.referral.referred,
60
+ _chunkPO6YSB4Qcjs.interactionTypes.referral.referred,
65
61
  _viem.pad.call(void 0, referrer, { size: 32 })
66
62
  ]);
67
63
  return {
68
- handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPR3T7O5Icjs.productTypes.referral),
64
+ handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPO6YSB4Qcjs.productTypes.referral),
69
65
  interactionData
70
66
  };
71
67
  }
@@ -81,11 +77,11 @@ var PurchaseInteractionEncoder = {
81
77
  */
82
78
  startPurchase({ purchaseId }) {
83
79
  const interactionData = _viem.concatHex.call(void 0, [
84
- _chunkPR3T7O5Icjs.interactionTypes.purchase.started,
80
+ _chunkPO6YSB4Qcjs.interactionTypes.purchase.started,
85
81
  _viem.pad.call(void 0, purchaseId, { size: 32 })
86
82
  ]);
87
83
  return {
88
- handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPR3T7O5Icjs.productTypes.purchase),
84
+ handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPO6YSB4Qcjs.productTypes.purchase),
89
85
  interactionData
90
86
  };
91
87
  },
@@ -104,11 +100,28 @@ var PurchaseInteractionEncoder = {
104
100
  [BigInt(purchaseId), proof]
105
101
  );
106
102
  const interactionData = _viem.concatHex.call(void 0, [
107
- _chunkPR3T7O5Icjs.interactionTypes.purchase.completed,
103
+ _chunkPO6YSB4Qcjs.interactionTypes.purchase.completed,
108
104
  innerData
109
105
  ]);
110
106
  return {
111
- handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPR3T7O5Icjs.productTypes.purchase),
107
+ handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPO6YSB4Qcjs.productTypes.purchase),
108
+ interactionData
109
+ };
110
+ },
111
+ /**
112
+ * Encode an unsafe complete purchase interaction (when we can't provide the proof)
113
+ * @param args
114
+ * @param args.purchaseId - The id of the purchase that is being completed.
115
+ */
116
+ unsafeCompletedPurchase({
117
+ purchaseId
118
+ }) {
119
+ const interactionData = _viem.concatHex.call(void 0, [
120
+ _chunkPO6YSB4Qcjs.interactionTypes.purchase.unsafeCompleted,
121
+ _viem.pad.call(void 0, purchaseId, { size: 32 })
122
+ ]);
123
+ return {
124
+ handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPO6YSB4Qcjs.productTypes.purchase),
112
125
  interactionData
113
126
  };
114
127
  }
@@ -121,12 +134,29 @@ var WebShopInteractionEncoder = {
121
134
  * Encode an open webshop interaction
122
135
  */
123
136
  open() {
137
+ return {
138
+ handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPO6YSB4Qcjs.productTypes.webshop),
139
+ interactionData: _chunkPO6YSB4Qcjs.interactionTypes.webshop.open
140
+ };
141
+ }
142
+ };
143
+
144
+ // src/interactions/retailEncoder.ts
145
+
146
+ var RetailInteractionEncoder = {
147
+ /**
148
+ * Encode a customer meeting retail interaction
149
+ * @param args
150
+ * @param args.agencyId - The id of the agency that the customer is meeting with
151
+ *
152
+ */
153
+ customerMeeting({ agencyId }) {
124
154
  const interactionData = _viem.concatHex.call(void 0, [
125
- _chunkPR3T7O5Icjs.interactionTypes.webshop.open,
126
- "0x"
155
+ _chunkPO6YSB4Qcjs.interactionTypes.retail.customerMeeting,
156
+ _viem.pad.call(void 0, agencyId, { size: 32 })
127
157
  ]);
128
158
  return {
129
- handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPR3T7O5Icjs.productTypes.webshop),
159
+ handlerTypeDenominator: _viem.toHex.call(void 0, _chunkPO6YSB4Qcjs.productTypes.retail),
130
160
  interactionData
131
161
  };
132
162
  }
@@ -137,4 +167,5 @@ var WebShopInteractionEncoder = {
137
167
 
138
168
 
139
169
 
140
- exports.PressInteractionEncoder = PressInteractionEncoder; exports.ReferralInteractionEncoder = ReferralInteractionEncoder; exports.PurchaseInteractionEncoder = PurchaseInteractionEncoder; exports.WebShopInteractionEncoder = WebShopInteractionEncoder;
170
+
171
+ exports.PressInteractionEncoder = PressInteractionEncoder; exports.ReferralInteractionEncoder = ReferralInteractionEncoder; exports.PurchaseInteractionEncoder = PurchaseInteractionEncoder; exports.WebShopInteractionEncoder = WebShopInteractionEncoder; exports.RetailInteractionEncoder = RetailInteractionEncoder;
@@ -356,6 +356,7 @@ declare const productTypes: {
356
356
  dapp: number;
357
357
  press: number;
358
358
  webshop: number;
359
+ retail: number;
359
360
  referral: number;
360
361
  purchase: number;
361
362
  };
@@ -356,6 +356,7 @@ declare const productTypes: {
356
356
  dapp: number;
357
357
  press: number;
358
358
  webshop: number;
359
+ retail: number;
359
360
  referral: number;
360
361
  purchase: number;
361
362
  };
package/dist/index.cjs CHANGED
@@ -12,12 +12,12 @@
12
12
 
13
13
 
14
14
 
15
- var _chunkNJJQPEELcjs = require('./chunk-NJJQPEEL.cjs');
15
+ var _chunkHDFNBQ4Ecjs = require('./chunk-HDFNBQ4E.cjs');
16
16
 
17
17
 
18
18
 
19
19
 
20
- var _chunkPR3T7O5Icjs = require('./chunk-PR3T7O5I.cjs');
20
+ var _chunkPO6YSB4Qcjs = require('./chunk-PO6YSB4Q.cjs');
21
21
 
22
22
  // src/utils/constants.ts
23
23
  var BACKUP_KEY = "nexus-wallet-backup";
@@ -42,7 +42,7 @@ function createIFrameChannelManager() {
42
42
  function createIFrameLifecycleManager({
43
43
  iframe
44
44
  }) {
45
- const isConnectedDeferred = new (0, _chunkNJJQPEELcjs.Deferred)();
45
+ const isConnectedDeferred = new (0, _chunkHDFNBQ4Ecjs.Deferred)();
46
46
  const handler = async (messageEvent) => {
47
47
  switch (messageEvent.iframeLifecycle) {
48
48
  // Resolve the isConnected promise
@@ -64,7 +64,7 @@ function createIFrameLifecycleManager({
64
64
  // Change iframe visibility
65
65
  case "show":
66
66
  case "hide":
67
- _chunkNJJQPEELcjs.changeIframeVisibility.call(void 0, {
67
+ _chunkHDFNBQ4Ecjs.changeIframeVisibility.call(void 0, {
68
68
  iframe,
69
69
  isVisible: messageEvent.iframeLifecycle === "show"
70
70
  });
@@ -85,14 +85,14 @@ function createIFrameMessageHandler({
85
85
  iframeLifecycleManager
86
86
  }) {
87
87
  if (typeof window === "undefined") {
88
- throw new (0, _chunkNJJQPEELcjs.FrakRpcError)(
89
- _chunkNJJQPEELcjs.RpcErrorCodes.configError,
88
+ throw new (0, _chunkHDFNBQ4Ecjs.FrakRpcError)(
89
+ _chunkHDFNBQ4Ecjs.RpcErrorCodes.configError,
90
90
  "iframe client should be used in the browser"
91
91
  );
92
92
  }
93
93
  if (!iframe.contentWindow) {
94
- throw new (0, _chunkNJJQPEELcjs.FrakRpcError)(
95
- _chunkNJJQPEELcjs.RpcErrorCodes.configError,
94
+ throw new (0, _chunkHDFNBQ4Ecjs.FrakRpcError)(
95
+ _chunkHDFNBQ4Ecjs.RpcErrorCodes.configError,
96
96
  "The iframe does not have a product window"
97
97
  );
98
98
  }
@@ -155,17 +155,17 @@ function createIFrameFrakClient({
155
155
  const request = async (args) => {
156
156
  const isConnected = await lifecycleManager.isConnected;
157
157
  if (!isConnected) {
158
- throw new (0, _chunkNJJQPEELcjs.FrakRpcError)(
159
- _chunkNJJQPEELcjs.RpcErrorCodes.clientNotConnected,
158
+ throw new (0, _chunkHDFNBQ4Ecjs.FrakRpcError)(
159
+ _chunkHDFNBQ4Ecjs.RpcErrorCodes.clientNotConnected,
160
160
  "The iframe provider isn't connected yet"
161
161
  );
162
162
  }
163
- const result = new (0, _chunkNJJQPEELcjs.Deferred)();
163
+ const result = new (0, _chunkHDFNBQ4Ecjs.Deferred)();
164
164
  const channelId = channelManager.createChannel(async (message) => {
165
- const decompressed = await _chunkNJJQPEELcjs.decompressDataAndCheckHash.call(void 0, message.data);
165
+ const decompressed = await _chunkHDFNBQ4Ecjs.decompressDataAndCheckHash.call(void 0, message.data);
166
166
  if (decompressed.error) {
167
167
  result.reject(
168
- new (0, _chunkNJJQPEELcjs.FrakRpcError)(
168
+ new (0, _chunkHDFNBQ4Ecjs.FrakRpcError)(
169
169
  decompressed.error.code,
170
170
  decompressed.error.message,
171
171
  _optionalChain([decompressed, 'access', _2 => _2.error, 'optionalAccess', _3 => _3.data])
@@ -176,7 +176,7 @@ function createIFrameFrakClient({
176
176
  }
177
177
  channelManager.removeChannel(channelId);
178
178
  });
179
- const compressedMessage = await _chunkNJJQPEELcjs.hashAndCompressData.call(void 0, args);
179
+ const compressedMessage = await _chunkHDFNBQ4Ecjs.hashAndCompressData.call(void 0, args);
180
180
  messageHandler.sendEvent({
181
181
  id: channelId,
182
182
  topic: args.method,
@@ -187,20 +187,20 @@ function createIFrameFrakClient({
187
187
  const listenerRequest = async (args, callback) => {
188
188
  const isConnected = await lifecycleManager.isConnected;
189
189
  if (!isConnected) {
190
- throw new (0, _chunkNJJQPEELcjs.FrakRpcError)(
191
- _chunkNJJQPEELcjs.RpcErrorCodes.clientNotConnected,
190
+ throw new (0, _chunkHDFNBQ4Ecjs.FrakRpcError)(
191
+ _chunkHDFNBQ4Ecjs.RpcErrorCodes.clientNotConnected,
192
192
  "The iframe provider isn't connected yet"
193
193
  );
194
194
  }
195
195
  const channelId = channelManager.createChannel(async (message) => {
196
- const decompressed = await _chunkNJJQPEELcjs.decompressDataAndCheckHash.call(void 0, message.data);
196
+ const decompressed = await _chunkHDFNBQ4Ecjs.decompressDataAndCheckHash.call(void 0, message.data);
197
197
  if (decompressed.result) {
198
198
  callback(decompressed.result);
199
199
  } else {
200
- throw new (0, _chunkNJJQPEELcjs.InternalError)("No valid result in the response");
200
+ throw new (0, _chunkHDFNBQ4Ecjs.InternalError)("No valid result in the response");
201
201
  }
202
202
  });
203
- const compressedMessage = await _chunkNJJQPEELcjs.hashAndCompressData.call(void 0, args);
203
+ const compressedMessage = await _chunkHDFNBQ4Ecjs.hashAndCompressData.call(void 0, args);
204
204
  messageHandler.sendEvent({
205
205
  id: channelId,
206
206
  topic: args.method,
@@ -287,7 +287,7 @@ async function postConnectionSetup({
287
287
  async function setupClient({
288
288
  config
289
289
  }) {
290
- const iframe = await _chunkNJJQPEELcjs.createIframe.call(void 0, {
290
+ const iframe = await _chunkHDFNBQ4Ecjs.createIframe.call(void 0, {
291
291
  config
292
292
  });
293
293
  if (!iframe) {
@@ -323,4 +323,4 @@ async function setupClient({
323
323
 
324
324
 
325
325
 
326
- exports.ClientNotFound = _chunkNJJQPEELcjs.ClientNotFound; exports.Deferred = _chunkNJJQPEELcjs.Deferred; exports.FrakContextManager = _chunkNJJQPEELcjs.FrakContextManager; exports.FrakRpcError = _chunkNJJQPEELcjs.FrakRpcError; exports.RpcErrorCodes = _chunkNJJQPEELcjs.RpcErrorCodes; exports.baseIframeProps = _chunkNJJQPEELcjs.baseIframeProps; exports.compressJson = _chunkNJJQPEELcjs.compressJson; exports.createIFrameFrakClient = createIFrameFrakClient; exports.createIframe = _chunkNJJQPEELcjs.createIframe; exports.decompressDataAndCheckHash = _chunkNJJQPEELcjs.decompressDataAndCheckHash; exports.decompressJson = _chunkNJJQPEELcjs.decompressJson; exports.hashAndCompressData = _chunkNJJQPEELcjs.hashAndCompressData; exports.interactionTypes = _chunkPR3T7O5Icjs.interactionTypes; exports.productTypes = _chunkPR3T7O5Icjs.productTypes; exports.productTypesMask = _chunkPR3T7O5Icjs.productTypesMask; exports.setupClient = setupClient;
326
+ exports.ClientNotFound = _chunkHDFNBQ4Ecjs.ClientNotFound; exports.Deferred = _chunkHDFNBQ4Ecjs.Deferred; exports.FrakContextManager = _chunkHDFNBQ4Ecjs.FrakContextManager; exports.FrakRpcError = _chunkHDFNBQ4Ecjs.FrakRpcError; exports.RpcErrorCodes = _chunkHDFNBQ4Ecjs.RpcErrorCodes; exports.baseIframeProps = _chunkHDFNBQ4Ecjs.baseIframeProps; exports.compressJson = _chunkHDFNBQ4Ecjs.compressJson; exports.createIFrameFrakClient = createIFrameFrakClient; exports.createIframe = _chunkHDFNBQ4Ecjs.createIframe; exports.decompressDataAndCheckHash = _chunkHDFNBQ4Ecjs.decompressDataAndCheckHash; exports.decompressJson = _chunkHDFNBQ4Ecjs.decompressJson; exports.hashAndCompressData = _chunkHDFNBQ4Ecjs.hashAndCompressData; exports.interactionTypes = _chunkPO6YSB4Qcjs.interactionTypes; exports.productTypes = _chunkPO6YSB4Qcjs.productTypes; exports.productTypesMask = _chunkPO6YSB4Qcjs.productTypesMask; exports.setupClient = setupClient;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FrakWalletSdkConfig, a as FrakClient, b as FrakContext } from './context-GkNATUkF.cjs';
2
- export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, w as ExtractedReturnTypeFromRpc, r as FinalActionType, q as FinalModalStepType, G as GetProductInformationReturnType, u as IFrameEvent, v as IFrameLifecycleEvent, t as IFrameRpcEvent, I as IFrameRpcSchema, s as IFrameTransport, L as LoginModalStepType, d as ModalRpcMetadata, e as ModalRpcStepsInput, f as ModalRpcStepsResultType, g as ModalStepMetadata, M as ModalStepTypes, o as OpenInteractionSessionModalStepType, n as OpenInteractionSessionReturnType, O as OpenSsoParamsType, P as ProductTypesKey, R as RpcResponse, l as SendTransactionModalStepType, m as SendTransactionReturnType, k as SendTransactionTxType, h as SiweAuthenticateModalStepType, j as SiweAuthenticateReturnType, i as SiweAuthenticationParams, S as SsoMetadata, W as WalletStatusReturnType, p as productTypes, c as productTypesMask } from './context-GkNATUkF.cjs';
1
+ import { F as FrakWalletSdkConfig, a as FrakClient, b as FrakContext } from './context-BjKowynW.cjs';
2
+ export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, w as ExtractedReturnTypeFromRpc, r as FinalActionType, q as FinalModalStepType, G as GetProductInformationReturnType, u as IFrameEvent, v as IFrameLifecycleEvent, t as IFrameRpcEvent, I as IFrameRpcSchema, s as IFrameTransport, L as LoginModalStepType, d as ModalRpcMetadata, e as ModalRpcStepsInput, f as ModalRpcStepsResultType, g as ModalStepMetadata, M as ModalStepTypes, o as OpenInteractionSessionModalStepType, n as OpenInteractionSessionReturnType, O as OpenSsoParamsType, P as ProductTypesKey, R as RpcResponse, l as SendTransactionModalStepType, m as SendTransactionReturnType, k as SendTransactionTxType, h as SiweAuthenticateModalStepType, j as SiweAuthenticateReturnType, i as SiweAuthenticationParams, S as SsoMetadata, W as WalletStatusReturnType, p as productTypes, c as productTypesMask } from './context-BjKowynW.cjs';
3
3
  export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from './interaction-CTQ5-kqe.cjs';
4
4
  import 'viem';
5
5
  import 'viem/chains';
@@ -263,6 +263,10 @@ declare const interactionTypes: {
263
263
  readonly purchase: {
264
264
  readonly started: "0xd87e90c3";
265
265
  readonly completed: "0x8403aeb4";
266
+ readonly unsafeCompleted: "0x4d5b14e0";
267
+ };
268
+ readonly retail: {
269
+ readonly customerMeeting: "0x74489004";
266
270
  };
267
271
  };
268
272
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FrakWalletSdkConfig, a as FrakClient, b as FrakContext } from './context-B0trlYGx.js';
2
- export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, w as ExtractedReturnTypeFromRpc, r as FinalActionType, q as FinalModalStepType, G as GetProductInformationReturnType, u as IFrameEvent, v as IFrameLifecycleEvent, t as IFrameRpcEvent, I as IFrameRpcSchema, s as IFrameTransport, L as LoginModalStepType, d as ModalRpcMetadata, e as ModalRpcStepsInput, f as ModalRpcStepsResultType, g as ModalStepMetadata, M as ModalStepTypes, o as OpenInteractionSessionModalStepType, n as OpenInteractionSessionReturnType, O as OpenSsoParamsType, P as ProductTypesKey, R as RpcResponse, l as SendTransactionModalStepType, m as SendTransactionReturnType, k as SendTransactionTxType, h as SiweAuthenticateModalStepType, j as SiweAuthenticateReturnType, i as SiweAuthenticationParams, S as SsoMetadata, W as WalletStatusReturnType, p as productTypes, c as productTypesMask } from './context-B0trlYGx.js';
1
+ import { F as FrakWalletSdkConfig, a as FrakClient, b as FrakContext } from './context-DjVVznrf.js';
2
+ export { C as ClientLifecycleEvent, D as DisplayModalParamsType, E as ExtractedParametersFromRpc, w as ExtractedReturnTypeFromRpc, r as FinalActionType, q as FinalModalStepType, G as GetProductInformationReturnType, u as IFrameEvent, v as IFrameLifecycleEvent, t as IFrameRpcEvent, I as IFrameRpcSchema, s as IFrameTransport, L as LoginModalStepType, d as ModalRpcMetadata, e as ModalRpcStepsInput, f as ModalRpcStepsResultType, g as ModalStepMetadata, M as ModalStepTypes, o as OpenInteractionSessionModalStepType, n as OpenInteractionSessionReturnType, O as OpenSsoParamsType, P as ProductTypesKey, R as RpcResponse, l as SendTransactionModalStepType, m as SendTransactionReturnType, k as SendTransactionTxType, h as SiweAuthenticateModalStepType, j as SiweAuthenticateReturnType, i as SiweAuthenticationParams, S as SsoMetadata, W as WalletStatusReturnType, p as productTypes, c as productTypesMask } from './context-DjVVznrf.js';
3
3
  export { P as PreparedInteraction, S as SendInteractionParamsType, a as SendInteractionReturnType } from './interaction-CTQ5-kqe.js';
4
4
  import 'viem';
5
5
  import 'viem/chains';
@@ -263,6 +263,10 @@ declare const interactionTypes: {
263
263
  readonly purchase: {
264
264
  readonly started: "0xd87e90c3";
265
265
  readonly completed: "0x8403aeb4";
266
+ readonly unsafeCompleted: "0x4d5b14e0";
267
+ };
268
+ readonly retail: {
269
+ readonly customerMeeting: "0x74489004";
266
270
  };
267
271
  };
268
272
 
package/dist/index.js CHANGED
@@ -12,12 +12,12 @@ import {
12
12
  decompressDataAndCheckHash,
13
13
  decompressJson,
14
14
  hashAndCompressData
15
- } from "./chunk-K5SAPMC2.js";
15
+ } from "./chunk-AFLVOY5H.js";
16
16
  import {
17
17
  interactionTypes,
18
18
  productTypes,
19
19
  productTypesMask
20
- } from "./chunk-QZL2KCSB.js";
20
+ } from "./chunk-GDH3M5ZC.js";
21
21
 
22
22
  // src/utils/constants.ts
23
23
  var BACKUP_KEY = "nexus-wallet-backup";
@@ -3,11 +3,13 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkRAPLRHQ4cjs = require('../chunk-RAPLRHQ4.cjs');
7
- require('../chunk-PR3T7O5I.cjs');
8
6
 
7
+ var _chunkZDGHKI3Scjs = require('../chunk-ZDGHKI3S.cjs');
8
+ require('../chunk-PO6YSB4Q.cjs');
9
9
 
10
10
 
11
11
 
12
12
 
13
- exports.PressInteractionEncoder = _chunkRAPLRHQ4cjs.PressInteractionEncoder; exports.PurchaseInteractionEncoder = _chunkRAPLRHQ4cjs.PurchaseInteractionEncoder; exports.ReferralInteractionEncoder = _chunkRAPLRHQ4cjs.ReferralInteractionEncoder; exports.WebShopInteractionEncoder = _chunkRAPLRHQ4cjs.WebShopInteractionEncoder;
13
+
14
+
15
+ exports.PressInteractionEncoder = _chunkZDGHKI3Scjs.PressInteractionEncoder; exports.PurchaseInteractionEncoder = _chunkZDGHKI3Scjs.PurchaseInteractionEncoder; exports.ReferralInteractionEncoder = _chunkZDGHKI3Scjs.ReferralInteractionEncoder; exports.RetailInteractionEncoder = _chunkZDGHKI3Scjs.RetailInteractionEncoder; exports.WebShopInteractionEncoder = _chunkZDGHKI3Scjs.WebShopInteractionEncoder;
@@ -114,6 +114,14 @@ declare const PurchaseInteractionEncoder: {
114
114
  purchaseId: Hex;
115
115
  proof: Hex[];
116
116
  }): PreparedInteraction;
117
+ /**
118
+ * Encode an unsafe complete purchase interaction (when we can't provide the proof)
119
+ * @param args
120
+ * @param args.purchaseId - The id of the purchase that is being completed.
121
+ */
122
+ unsafeCompletedPurchase({ purchaseId, }: {
123
+ purchaseId: Hex;
124
+ }): PreparedInteraction;
117
125
  };
118
126
 
119
127
  /**
@@ -137,4 +145,30 @@ declare const WebShopInteractionEncoder: {
137
145
  open(): PreparedInteraction;
138
146
  };
139
147
 
140
- export { PressInteractionEncoder, PurchaseInteractionEncoder, ReferralInteractionEncoder, WebShopInteractionEncoder };
148
+ /**
149
+ * Retail interactions allow you to track user activities on your retails products.
150
+ *
151
+ * :::info
152
+ * To properly handle retail interactions, ensure that the "Retail" product type is enabled in your Business dashboard.
153
+ * :::
154
+ *
155
+ * @description Encode retail related user interactions
156
+ *
157
+ * @group Interactions Encoder
158
+ *
159
+ * @see {@link PreparedInteraction} The prepared interaction object that can be sent
160
+ * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
161
+ */
162
+ declare const RetailInteractionEncoder: {
163
+ /**
164
+ * Encode a customer meeting retail interaction
165
+ * @param args
166
+ * @param args.agencyId - The id of the agency that the customer is meeting with
167
+ *
168
+ */
169
+ customerMeeting({ agencyId }: {
170
+ agencyId: Hex;
171
+ }): PreparedInteraction;
172
+ };
173
+
174
+ export { PressInteractionEncoder, PurchaseInteractionEncoder, ReferralInteractionEncoder, RetailInteractionEncoder, WebShopInteractionEncoder };
@@ -114,6 +114,14 @@ declare const PurchaseInteractionEncoder: {
114
114
  purchaseId: Hex;
115
115
  proof: Hex[];
116
116
  }): PreparedInteraction;
117
+ /**
118
+ * Encode an unsafe complete purchase interaction (when we can't provide the proof)
119
+ * @param args
120
+ * @param args.purchaseId - The id of the purchase that is being completed.
121
+ */
122
+ unsafeCompletedPurchase({ purchaseId, }: {
123
+ purchaseId: Hex;
124
+ }): PreparedInteraction;
117
125
  };
118
126
 
119
127
  /**
@@ -137,4 +145,30 @@ declare const WebShopInteractionEncoder: {
137
145
  open(): PreparedInteraction;
138
146
  };
139
147
 
140
- export { PressInteractionEncoder, PurchaseInteractionEncoder, ReferralInteractionEncoder, WebShopInteractionEncoder };
148
+ /**
149
+ * Retail interactions allow you to track user activities on your retails products.
150
+ *
151
+ * :::info
152
+ * To properly handle retail interactions, ensure that the "Retail" product type is enabled in your Business dashboard.
153
+ * :::
154
+ *
155
+ * @description Encode retail related user interactions
156
+ *
157
+ * @group Interactions Encoder
158
+ *
159
+ * @see {@link PreparedInteraction} The prepared interaction object that can be sent
160
+ * @see {@link !actions.sendInteraction | `sendInteraction()`} Action used to send the prepared interaction to the Frak Wallet
161
+ */
162
+ declare const RetailInteractionEncoder: {
163
+ /**
164
+ * Encode a customer meeting retail interaction
165
+ * @param args
166
+ * @param args.agencyId - The id of the agency that the customer is meeting with
167
+ *
168
+ */
169
+ customerMeeting({ agencyId }: {
170
+ agencyId: Hex;
171
+ }): PreparedInteraction;
172
+ };
173
+
174
+ export { PressInteractionEncoder, PurchaseInteractionEncoder, ReferralInteractionEncoder, RetailInteractionEncoder, WebShopInteractionEncoder };
@@ -2,12 +2,14 @@ import {
2
2
  PressInteractionEncoder,
3
3
  PurchaseInteractionEncoder,
4
4
  ReferralInteractionEncoder,
5
+ RetailInteractionEncoder,
5
6
  WebShopInteractionEncoder
6
- } from "../chunk-VAINYZSV.js";
7
- import "../chunk-QZL2KCSB.js";
7
+ } from "../chunk-RMOFMRZR.js";
8
+ import "../chunk-GDH3M5ZC.js";
8
9
  export {
9
10
  PressInteractionEncoder,
10
11
  PurchaseInteractionEncoder,
11
12
  ReferralInteractionEncoder,
13
+ RetailInteractionEncoder,
12
14
  WebShopInteractionEncoder
13
15
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "url": "https://twitter.com/QNivelais"
12
12
  }
13
13
  ],
14
- "version": "0.0.2",
14
+ "version": "0.0.4",
15
15
  "description": "Core SDK of the Frak wallet, low level library to interact directly with the frak ecosystem.",
16
16
  "repository": {
17
17
  "url": "https://github.com/frak-id/wallet",
@@ -77,7 +77,9 @@
77
77
  "build": "tsup && bun run check-exports",
78
78
  "build:watch": "tsup --watch",
79
79
  "check-exports": "attw --pack --profile node16 .",
80
- "typecheck": "tsc --noEmit"
80
+ "typecheck": "tsc --noEmit",
81
+ "prepublish": "bun run lint && bun run build",
82
+ "publish": "bun publish"
81
83
  },
82
84
  "peerDependencies": {
83
85
  "viem": "^2.x"
@@ -87,9 +89,9 @@
87
89
  "js-sha256": "^0.11.0"
88
90
  },
89
91
  "devDependencies": {
90
- "@arethetypeswrong/cli": "^0.17.1",
92
+ "@arethetypeswrong/cli": "^0.17.2",
91
93
  "@types/node": "^22",
92
94
  "tsup": "^8.3.5",
93
95
  "typescript": "^5"
94
96
  }
95
- }
97
+ }