@frak-labs/nexus-sdk 0.0.25 → 0.0.27

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.
Files changed (37) hide show
  1. package/README.md +2 -72
  2. package/dist/bundle/bundle.js +6 -6
  3. package/package.json +11 -64
  4. package/dist/FrakContext-DKSVaeVb.d.cts +0 -450
  5. package/dist/FrakContext-DjeuWC2U.d.ts +0 -450
  6. package/dist/chunk-2VNIEGOJ.js +0 -864
  7. package/dist/chunk-4MMSQL44.js +0 -351
  8. package/dist/chunk-4PVF24BB.cjs +0 -114
  9. package/dist/chunk-BOGCLEPR.js +0 -80
  10. package/dist/chunk-DE2KWQVP.cjs +0 -351
  11. package/dist/chunk-FETGS7X7.js +0 -114
  12. package/dist/chunk-H4BK3CNV.cjs +0 -864
  13. package/dist/chunk-P3J2BIUT.cjs +0 -80
  14. package/dist/chunk-QLM5NFMZ.cjs +0 -245
  15. package/dist/chunk-YPQA63LW.js +0 -245
  16. package/dist/core/actions/index.cjs +0 -29
  17. package/dist/core/actions/index.d.cts +0 -92
  18. package/dist/core/actions/index.d.ts +0 -92
  19. package/dist/core/actions/index.js +0 -29
  20. package/dist/core/index.cjs +0 -34
  21. package/dist/core/index.d.cts +0 -167
  22. package/dist/core/index.d.ts +0 -167
  23. package/dist/core/index.js +0 -34
  24. package/dist/core/interactions/index.cjs +0 -13
  25. package/dist/core/interactions/index.d.cts +0 -65
  26. package/dist/core/interactions/index.d.ts +0 -65
  27. package/dist/core/interactions/index.js +0 -13
  28. package/dist/error-Dflr3G5x.d.cts +0 -27
  29. package/dist/error-Dflr3G5x.d.ts +0 -27
  30. package/dist/interaction-BngPoHA0.d.cts +0 -22
  31. package/dist/interaction-BngPoHA0.d.ts +0 -22
  32. package/dist/processReferral-CJI_Rc4K.d.ts +0 -53
  33. package/dist/processReferral-DUP8imQV.d.cts +0 -53
  34. package/dist/react/index.cjs +0 -366
  35. package/dist/react/index.d.cts +0 -167
  36. package/dist/react/index.d.ts +0 -167
  37. package/dist/react/index.js +0 -366
package/README.md CHANGED
@@ -1,74 +1,4 @@
1
- # Frak Wallet SDK
1
+ # Frak Legacy SDK
2
2
 
3
- This SDK help any dApps, or gated content provider, use the [Frak Wallet](https://wallet.frak.id/) as a regular wallet, with smoother UX for your end-users (pay for his gas fees, check the paywall options, track his consumption etc.)
4
-
5
- Checkout our documentation for more informations about the usage:
6
- - [React client usage](https://docs.frak.id/wallet-sdk/how-to/client-react)
7
- - [Core client usage](https://docs.frak.id/wallet-sdk/how-to/client-core)
8
-
9
- To have more info about how does it works under the hood, you can check [this](https://docs.frak.id/wallet-sdk/under-the-hood)
10
-
11
- > :warning: **This is in active development**: Only supporting testnets at the moment, **DO NOT USE IN PROD**
12
-
13
-
14
- ## Installation
15
-
16
- ```bash
17
- bun add viem @frak-labs/nexus-sdk
18
- ```
19
-
20
- ## Setup
21
-
22
- ```ts
23
- import {
24
- createIframe,
25
- createIFrameNexusClient,
26
- } from "@frak-labs/nexus-sdk/core";
27
- import type { NexusClient, NexusWalletSdkConfig } from "@frak-labs/nexus-sdk/core";
28
-
29
- // Create the config for the Frak Wallet SDK
30
- export const nexusConfig: NexusWalletSdkConfig = {
31
- // The current url for the wallet sdk
32
- walletUrl: "https://wallet-dev.frak.id",
33
- // The name of your dapp
34
- metadata: {
35
- // Your app name
36
- name: string,
37
- },
38
- }
39
-
40
- // Create the iFrame and the associated NexusClient
41
- async function createClient(): Promise<NexusClient> {
42
- // Create the iFrame that will be used for the communication with the nexus wallet
43
- const iframe = await createIframe(nexusConfig);
44
-
45
- // Build the client
46
- const client = createIFrameNexusClient(nexusConfig, iframe);
47
-
48
- // Wait for it to be ready
49
- await client.waitForConnection();
50
-
51
- // And then return it
52
- return client;
53
- }
54
-
55
- // Create the client and use it
56
- export const nexusClient = await createClient();
57
- ```
58
-
59
- ## Sample usage
60
-
61
- Sample code to watch the current user wallet status:
62
-
63
- ```ts
64
- import { nexusClient } from "./client";
65
- import { watchWalletStatus } from "@frak-labs/nexus-sdk/actions";
66
- import type { WalletStatusReturnType } from "@frak-labs/nexus-sdk/core";
67
-
68
- // Watch the wallet status
69
- watchWalletStatus(nexusClient, (walletStatus: WalletStatusReturnType) => {
70
- console.log("Wallet status changed", { walletStatus });
71
- // You can now use the status to update your UI
72
- });
73
- ```
3
+ > :warning: **This is the legacy version of the SDK**: checkout `/core` or `/react` for the latest version.
74
4
 
@@ -1,9 +1,9 @@
1
- "use strict";var NexusSDK=(()=>{var Zr=Object.create;var Ce=Object.defineProperty;var Qr=Object.getOwnPropertyDescriptor;var eo=Object.getOwnPropertyNames;var to=Object.getPrototypeOf,ro=Object.prototype.hasOwnProperty;var Ht=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var R=(e,t)=>()=>(e&&(t=e(e=0)),t);var Lt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),oo=(e,t)=>{for(var r in t)Ce(e,r,{get:t[r],enumerable:!0})},zt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of eo(t))!ro.call(e,a)&&a!==r&&Ce(e,a,{get:()=>t[a],enumerable:!(n=Qr(t,a))||n.enumerable});return e};var Pe=(e,t,r)=>(r=e!=null?Zr(to(e)):{},zt(t||!e||!e.__esModule?Ce(r,"default",{value:e,enumerable:!0}):r,e)),no=e=>zt(Ce({},"__esModule",{value:!0}),e);var nt=Lt((fe,ot)=>{"use strict";(function(e,t){if(typeof fe=="object"&&typeof ot=="object")ot.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var r=t();for(var n in r)(typeof fe=="object"?fe:e)[n]=r[n]}})(fe,()=>(()=>{"use strict";var e={48:function(r,n,a){var l=this&&this.__awaiter||function(i,g,o,c){return new(o||(o=Promise))(function(I,A){function m(s){try{L(c.next(s))}catch(u){A(u)}}function T(s){try{L(c.throw(s))}catch(u){A(u)}}function L(s){var u;s.done?I(s.value):(u=s.value,u instanceof o?u:new o(function(v){v(u)})).then(m,T)}L((c=c.apply(i,g||[])).next())})},f=this&&this.__generator||function(i,g){var o,c,I,A,m={label:0,sent:function(){if(1&I[0])throw I[1];return I[1]},trys:[],ops:[]};return A={next:T(0),throw:T(1),return:T(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function T(L){return function(s){return function(u){if(o)throw new TypeError("Generator is already executing.");for(;A&&(A=0,u[0]&&(m=0)),m;)try{if(o=1,c&&(I=2&u[0]?c.return:u[0]?c.throw||((I=c.return)&&I.call(c),0):c.next)&&!(I=I.call(c,u[1])).done)return I;switch(c=0,I&&(u=[2&u[0],I.value]),u[0]){case 0:case 1:I=u;break;case 4:return m.label++,{value:u[1],done:!1};case 5:m.label++,c=u[1],u=[0];continue;case 7:u=m.ops.pop(),m.trys.pop();continue;default:if(!((I=(I=m.trys).length>0&&I[I.length-1])||u[0]!==6&&u[0]!==2)){m=0;continue}if(u[0]===3&&(!I||u[1]>I[0]&&u[1]<I[3])){m.label=u[1];break}if(u[0]===6&&m.label<I[1]){m.label=I[1],I=u;break}if(I&&m.label<I[2]){m.label=I[2],m.ops.push(u);break}I[2]&&m.ops.pop(),m.trys.pop();continue}u=g.call(i,m)}catch(v){u=[6,v],c=0}finally{o=I=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([L,s])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.decompressFromUTF16=n.compressToUTF16=n.decompressFromBase64=n.compressToBase64=void 0;var S=a(304),p=a(134),E=new S.CompressorImpl,h=new p.DecompressorImpl,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",x={};n.compressToBase64=function(i){return l(this,void 0,void 0,function(){var g;return f(this,function(o){switch(o.label){case 0:return i===null?[2,""]:[4,E.compress(i,6,function(c){return d.charAt(c)})];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(i){return l(this,void 0,void 0,function(){return f(this,function(g){switch(g.label){case 0:return i===null?[2,""]:i===""?[2,null]:[4,h.decompress(i.length,32,function(o){return function(c,I){if(!x[c]){x[c]={};for(var A=0;A<c.length;A++)x[c][c.charAt(A)]=A}return x[c][I]}(d,i.charAt(o))})];case 1:return[2,g.sent()]}})})},n.compressToUTF16=function(i){return l(this,void 0,void 0,function(){return f(this,function(g){switch(g.label){case 0:return i===null?[2,""]:[4,E.compress(i,15,function(o){return String.fromCharCode(o+32)})];case 1:return[2,g.sent()+" "]}})})},n.decompressFromUTF16=function(i){return l(this,void 0,void 0,function(){return f(this,function(g){switch(g.label){case 0:return i===null?[2,""]:i===""?[2,null]:[4,h.decompress(i.length,16384,function(o){return i.charCodeAt(o)-32})];case 1:return[2,g.sent()]}})})}},304:function(r,n,a){var l=this&&this.__awaiter||function(h,d,x,i){return new(x||(x=Promise))(function(g,o){function c(m){try{A(i.next(m))}catch(T){o(T)}}function I(m){try{A(i.throw(m))}catch(T){o(T)}}function A(m){var T;m.done?g(m.value):(T=m.value,T instanceof x?T:new x(function(L){L(T)})).then(c,I)}A((i=i.apply(h,d||[])).next())})},f=this&&this.__generator||function(h,d){var x,i,g,o,c={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return o={next:I(0),throw:I(1),return:I(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function I(A){return function(m){return function(T){if(x)throw new TypeError("Generator is already executing.");for(;o&&(o=0,T[0]&&(c=0)),c;)try{if(x=1,i&&(g=2&T[0]?i.return:T[0]?i.throw||((g=i.return)&&g.call(i),0):i.next)&&!(g=g.call(i,T[1])).done)return g;switch(i=0,g&&(T=[2&T[0],g.value]),T[0]){case 0:case 1:g=T;break;case 4:return c.label++,{value:T[1],done:!1};case 5:c.label++,i=T[1],T=[0];continue;case 7:T=c.ops.pop(),c.trys.pop();continue;default:if(!((g=(g=c.trys).length>0&&g[g.length-1])||T[0]!==6&&T[0]!==2)){c=0;continue}if(T[0]===3&&(!g||T[1]>g[0]&&T[1]<g[3])){c.label=T[1];break}if(T[0]===6&&c.label<g[1]){c.label=g[1],g=T;break}if(g&&c.label<g[2]){c.label=g[2],c.ops.push(T);break}g[2]&&c.ops.pop(),c.trys.pop();continue}T=d.call(h,c)}catch(L){T=[6,L],i=0}finally{x=g=0}if(5&T[0])throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}([A,m])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.CompressorImpl=void 0;var S=a(658),p=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],E=function(){function h(){}return h.writeValueToData=function(d,x,i,g,o){if(i%4!=0||d.dataPosition+i>g-1)for(var c=0;c<i;c++)d.dataVal=d.dataVal<<1|1&x,d.dataPosition==g-1?(d.dataPosition=0,d.data.push(o(d.dataVal)),d.dataVal=0):d.dataPosition++,x>>=1;else d.dataVal<<=i,d.dataVal|=function(I,A){for(var m=0,T=0;T<A;++T)m<<=4,m|=p[15&I],I>>=4;return m}(x,i/4),d.dataPosition+=i},h.writeWToDataVal=function(d,x,i){d.dictionaryToCreate.has(d.w)?(d.w.charCodeAt(0)<256?(h.writeValueToData(d,0,d.numBits,x,i),h.writeValueToData(d,d.w.charCodeAt(0),8,x,i)):(h.writeValueToData(d,1,d.numBits,x,i),h.writeValueToData(d,d.w.charCodeAt(0),16,x,i)),d.enlargeIn--,d.enlargeIn==0&&(d.enlargeIn=Math.pow(2,d.numBits),d.numBits++),d.dictionaryToCreate.delete(d.w)):h.writeValueToData(d,d.dictionary.get(d.w),d.numBits,x,i),d.enlargeIn--,d.enlargeIn==0&&(d.enlargeIn=Math.pow(2,d.numBits),d.numBits++)},h.loopIteration=function(d,x,i,g,o){var c=d.charAt(x);o.dictionary.has(c)||(o.dictionary.set(c,o.dictSize++),o.dictionaryToCreate.set(c,!0));var I=o.w+c;o.dictionary.has(I)?o.w=I:(this.writeWToDataVal(o,i,g),o.dictionary.set(I,o.dictSize++),o.w=String(c))},h.prototype.compress=function(d,x,i){var g=this;return new Promise(function(o){return l(g,void 0,void 0,function(){var c,I;return f(this,function(A){switch(A.label){case 0:if(d==null)return o(""),[2];c={data:[],dataPosition:0,dataVal:0,dictionary:new Map,dictionaryToCreate:new Map,dictSize:3,enlargeIn:2,numBits:2,w:""},I=0,A.label=1;case 1:return I<d.length?(h.loopIteration(d,I,x,i,c),I%1e4!=0?[3,3]:[4,(0,S.wait)()]):[3,4];case 2:A.sent(),A.label=3;case 3:return I+=1,[3,1];case 4:return c.w!==""&&h.writeWToDataVal(c,x,i),h.writeValueToData(c,2,c.numBits,x,i),c.dataVal<<=x-c.dataPosition,c.data.push(i(c.dataVal)),o(c.data.join("")),[2]}})})})},h}();n.CompressorImpl=E},134:function(r,n,a){var l=this&&this.__awaiter||function(E,h,d,x){return new(d||(d=Promise))(function(i,g){function o(A){try{I(x.next(A))}catch(m){g(m)}}function c(A){try{I(x.throw(A))}catch(m){g(m)}}function I(A){var m;A.done?i(A.value):(m=A.value,m instanceof d?m:new d(function(T){T(m)})).then(o,c)}I((x=x.apply(E,h||[])).next())})},f=this&&this.__generator||function(E,h){var d,x,i,g,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return g={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function c(I){return function(A){return function(m){if(d)throw new TypeError("Generator is already executing.");for(;g&&(g=0,m[0]&&(o=0)),o;)try{if(d=1,x&&(i=2&m[0]?x.return:m[0]?x.throw||((i=x.return)&&i.call(x),0):x.next)&&!(i=i.call(x,m[1])).done)return i;switch(x=0,i&&(m=[2&m[0],i.value]),m[0]){case 0:case 1:i=m;break;case 4:return o.label++,{value:m[1],done:!1};case 5:o.label++,x=m[1],m=[0];continue;case 7:m=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||m[0]!==6&&m[0]!==2)){o=0;continue}if(m[0]===3&&(!i||m[1]>i[0]&&m[1]<i[3])){o.label=m[1];break}if(m[0]===6&&o.label<i[1]){o.label=i[1],i=m;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(m);break}i[2]&&o.ops.pop(),o.trys.pop();continue}m=h.call(E,o)}catch(T){m=[6,T],x=0}finally{d=i=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([I,A])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.DecompressorImpl=void 0;var S=a(658),p=function(){function E(){}return E.prototype.decompress=function(h,d,x){var i=this;return new Promise(function(g){return l(i,void 0,void 0,function(){var o,c,I;return f(this,function(A){switch(A.label){case 0:for(o={bits:0,c:null,dataIndex:1,dataPosition:d,dataVal:x(0),dictionary:new Map,dictSize:4,enlargeIn:4,entry:"",maxPower:Math.pow(2,2),numBits:3,power:1,resb:null,result:[],w:null},c=0;c<3;c+=1)o.dictionary.set(c,c);for(;o.power!=o.maxPower;)o.resb=o.dataVal&o.dataPosition,o.dataPosition>>=1,o.dataPosition==0&&(o.dataPosition=d,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=d,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=d,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),I=1,A.label=1;case 1:return I%2e4!=0?[3,3]:[4,(0,S.wait)()];case 2:A.sent(),A.label=3;case 3:if(o.dataIndex>h)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=d,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=d,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=d,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++),I++,[3,1];case 4:return[2]}})})})},E}();n.DecompressorImpl=p},658:function(r,n){var a=this&&this.__awaiter||function(f,S,p,E){return new(p||(p=Promise))(function(h,d){function x(o){try{g(E.next(o))}catch(c){d(c)}}function i(o){try{g(E.throw(o))}catch(c){d(c)}}function g(o){var c;o.done?h(o.value):(c=o.value,c instanceof p?c:new p(function(I){I(c)})).then(x,i)}g((E=E.apply(f,S||[])).next())})},l=this&&this.__generator||function(f,S){var p,E,h,d,x={label:0,sent:function(){if(1&h[0])throw h[1];return h[1]},trys:[],ops:[]};return d={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function i(g){return function(o){return function(c){if(p)throw new TypeError("Generator is already executing.");for(;d&&(d=0,c[0]&&(x=0)),x;)try{if(p=1,E&&(h=2&c[0]?E.return:c[0]?E.throw||((h=E.return)&&h.call(E),0):E.next)&&!(h=h.call(E,c[1])).done)return h;switch(E=0,h&&(c=[2&c[0],h.value]),c[0]){case 0:case 1:h=c;break;case 4:return x.label++,{value:c[1],done:!1};case 5:x.label++,E=c[1],c=[0];continue;case 7:c=x.ops.pop(),x.trys.pop();continue;default:if(!((h=(h=x.trys).length>0&&h[h.length-1])||c[0]!==6&&c[0]!==2)){x=0;continue}if(c[0]===3&&(!h||c[1]>h[0]&&c[1]<h[3])){x.label=c[1];break}if(c[0]===6&&x.label<h[1]){x.label=h[1],h=c;break}if(h&&x.label<h[2]){x.label=h[2],x.ops.push(c);break}h[2]&&x.ops.pop(),x.trys.pop();continue}c=S.call(f,x)}catch(I){c=[6,I],E=0}finally{p=h=0}if(5&c[0])throw c[1];return{value:c[0]?c[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 l(this,function(f){return[2,new Promise(function(S){setTimeout(S,0)})]})})}}},t={};return function r(n){var a=t[n];if(a!==void 0)return a.exports;var l=t[n]={exports:{}};return e[n].call(l.exports,l,l.exports,r),l.exports}(48)})())});var at=Lt((fn,Re)=>{"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 l=!r.JS_SHA256_NO_COMMON_JS&&typeof Re=="object"&&Re.exports,f=typeof define=="function"&&define.amd,S=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),E=[-2147483648,8388608,32768,128],h=[24,16,8,0],d=[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"],i=[];(r.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(s){return Object.prototype.toString.call(s)==="[object Array]"}),S&&(r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(s){return typeof s=="object"&&s.buffer&&s.buffer.constructor===ArrayBuffer});var g=function(s,u){return function(v){return new m(u,!0).update(v)[s]()}},o=function(s){var u=g("hex",s);a&&(u=c(u,s)),u.create=function(){return new m(s)},u.update=function(F){return u.create().update(F)};for(var v=0;v<x.length;++v){var w=x[v];u[w]=g(w,s)}return u},c=function(s,u){var v=Ht("crypto"),w=Ht("buffer").Buffer,F=u?"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 v.createHash(F).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?v.createHash(F).update(b(y)).digest("hex"):s(y)};return C},I=function(s,u){return function(v,w){return new T(v,u,!0).update(w)[s]()}},A=function(s){var u=I("hex",s);u.create=function(F){return new T(F,s)},u.update=function(F,b){return u.create(F).update(b)};for(var v=0;v<x.length;++v){var w=x[v];u[w]=I(w,s)}return u};function m(s,u){u?(i[0]=i[16]=i[1]=i[2]=i[3]=i[4]=i[5]=i[6]=i[7]=i[8]=i[9]=i[10]=i[11]=i[12]=i[13]=i[14]=i[15]=0,this.blocks=i):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],s?(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=s}m.prototype.update=function(s){if(!this.finalized){var u,v=typeof s;if(v!=="string"){if(v==="object"){if(s===null)throw new Error(e);if(S&&s.constructor===ArrayBuffer)s=new Uint8Array(s);else if(!Array.isArray(s)&&(!S||!ArrayBuffer.isView(s)))throw new Error(e)}else throw new Error(e);u=!0}for(var w,F=0,b,C=s.length,y=this.blocks;F<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),u)for(b=this.start;F<C&&b<64;++F)y[b>>>2]|=s[F]<<h[b++&3];else for(b=this.start;F<C&&b<64;++F)w=s.charCodeAt(F),w<128?y[b>>>2]|=w<<h[b++&3]:w<2048?(y[b>>>2]|=(192|w>>>6)<<h[b++&3],y[b>>>2]|=(128|w&63)<<h[b++&3]):w<55296||w>=57344?(y[b>>>2]|=(224|w>>>12)<<h[b++&3],y[b>>>2]|=(128|w>>>6&63)<<h[b++&3],y[b>>>2]|=(128|w&63)<<h[b++&3]):(w=65536+((w&1023)<<10|s.charCodeAt(++F)&1023),y[b>>>2]|=(240|w>>>18)<<h[b++&3],y[b>>>2]|=(128|w>>>12&63)<<h[b++&3],y[b>>>2]|=(128|w>>>6&63)<<h[b++&3],y[b>>>2]|=(128|w&63)<<h[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}},m.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var s=this.blocks,u=this.lastByteIndex;s[16]=this.block,s[u>>>2]|=E[u&3],this.block=s[16],u>=56&&(this.hashed||this.hash(),s[0]=this.block,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),s[14]=this.hBytes<<3|this.bytes>>>29,s[15]=this.bytes<<3,this.hash()}},m.prototype.hash=function(){var s=this.h0,u=this.h1,v=this.h2,w=this.h3,F=this.h4,b=this.h5,C=this.h6,y=this.h7,P=this.blocks,k,N,_,X,M,Y,Z,le,tt,rt,Ae;for(k=16;k<64;++k)M=P[k-15],N=(M>>>7|M<<25)^(M>>>18|M<<14)^M>>>3,M=P[k-2],_=(M>>>17|M<<15)^(M>>>19|M<<13)^M>>>10,P[k]=P[k-16]+N+P[k-7]+_<<0;for(Ae=u&v,k=0;k<64;k+=4)this.first?(this.is224?(le=300032,M=P[0]-1413257819,y=M-150054599<<0,w=M+24177077<<0):(le=704751109,M=P[0]-210244248,y=M-1521486534<<0,w=M+143694565<<0),this.first=!1):(N=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),_=(F>>>6|F<<26)^(F>>>11|F<<21)^(F>>>25|F<<7),le=s&u,X=le^s&v^Ae,Z=F&b^~F&C,M=y+_+Z+d[k]+P[k],Y=N+X,y=w+M<<0,w=M+Y<<0),N=(w>>>2|w<<30)^(w>>>13|w<<19)^(w>>>22|w<<10),_=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),tt=w&s,X=tt^w&u^le,Z=y&F^~y&b,M=C+_+Z+d[k+1]+P[k+1],Y=N+X,C=v+M<<0,v=M+Y<<0,N=(v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10),_=(C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7),rt=v&w,X=rt^v&s^tt,Z=C&y^~C&F,M=b+_+Z+d[k+2]+P[k+2],Y=N+X,b=u+M<<0,u=M+Y<<0,N=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),_=(b>>>6|b<<26)^(b>>>11|b<<21)^(b>>>25|b<<7),Ae=u&v,X=Ae^u&w^rt,Z=b&C^~b&y,M=F+_+Z+d[k+3]+P[k+3],Y=N+X,F=s+M<<0,s=M+Y<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+s<<0,this.h1=this.h1+u<<0,this.h2=this.h2+v<<0,this.h3=this.h3+w<<0,this.h4=this.h4+F<<0,this.h5=this.h5+b<<0,this.h6=this.h6+C<<0,this.h7=this.h7+y<<0},m.prototype.hex=function(){this.finalize();var s=this.h0,u=this.h1,v=this.h2,w=this.h3,F=this.h4,b=this.h5,C=this.h6,y=this.h7,P=p[s>>>28&15]+p[s>>>24&15]+p[s>>>20&15]+p[s>>>16&15]+p[s>>>12&15]+p[s>>>8&15]+p[s>>>4&15]+p[s&15]+p[u>>>28&15]+p[u>>>24&15]+p[u>>>20&15]+p[u>>>16&15]+p[u>>>12&15]+p[u>>>8&15]+p[u>>>4&15]+p[u&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[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[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[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},m.prototype.toString=m.prototype.hex,m.prototype.digest=function(){this.finalize();var s=this.h0,u=this.h1,v=this.h2,w=this.h3,F=this.h4,b=this.h5,C=this.h6,y=this.h7,P=[s>>>24&255,s>>>16&255,s>>>8&255,s&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255,w>>>24&255,w>>>16&255,w>>>8&255,w&255,F>>>24&255,F>>>16&255,F>>>8&255,F&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},m.prototype.array=m.prototype.digest,m.prototype.arrayBuffer=function(){this.finalize();var s=new ArrayBuffer(this.is224?28:32),u=new DataView(s);return u.setUint32(0,this.h0),u.setUint32(4,this.h1),u.setUint32(8,this.h2),u.setUint32(12,this.h3),u.setUint32(16,this.h4),u.setUint32(20,this.h5),u.setUint32(24,this.h6),this.is224||u.setUint32(28,this.h7),s};function T(s,u,v){var w,F=typeof s;if(F==="string"){var b=[],C=s.length,y=0,P;for(w=0;w<C;++w)P=s.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|s.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);s=b}else if(F==="object"){if(s===null)throw new Error(e);if(S&&s.constructor===ArrayBuffer)s=new Uint8Array(s);else if(!Array.isArray(s)&&(!S||!ArrayBuffer.isView(s)))throw new Error(e)}else throw new Error(e);s.length>64&&(s=new m(u,!0).update(s).array());var k=[],N=[];for(w=0;w<64;++w){var _=s[w]||0;k[w]=92^_,N[w]=54^_}m.call(this,u,v),this.update(N),this.oKeyPad=k,this.inner=!0,this.sharedMemory=v}T.prototype=new m,T.prototype.finalize=function(){if(m.prototype.finalize.call(this),this.inner){this.inner=!1;var s=this.array();m.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(s),m.prototype.finalize.call(this)}};var L=o();L.sha256=L,L.sha224=o(!0),L.sha256.hmac=A(),L.sha224.hmac=A(!0),l?Re.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 he=R(()=>{"use strict"});function D(e){return Q(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var xe=R(()=>{"use strict";he()});var lt,Gt=R(()=>{"use strict";lt="2.21.54"});function Xt(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Xt(e.cause,t):t?null:e}var ft,H,ae=R(()=>{"use strict";Gt();ft={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${lt}`},H=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,l=ft.getDocsUrl?.({...r,docsPath:a}),f=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...l?[`Docs: ${l}`]:[],...n?[`Details: ${n}`]:[],...ft.version?[`Version: ${ft.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=lt}walk(t){return Xt(this,t)}}});var Be,He,Le,ze,De,Yt=R(()=>{"use strict";xe();ae();Be=class extends H{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"})}},He=class extends H{constructor({expectedSize:t,value:r}){super(`Size of bytes "${r}" (bytes${D(r)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}},Le=class extends H{constructor({expectedLength:t,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${r}`].join(`
4
- `),{name:"AbiEncodingLengthMismatchError"})}},ze=class extends H{constructor(t,{docsPath:r}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
5
- `),{docsPath:r,name:"InvalidAbiEncodingType"})}},De=class extends H{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
6
- `),{name:"InvalidArrayError"})}}});var ye,ge,dt=R(()=>{"use strict";ae();ye=class extends H{constructor({offset:t,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}},ge=class extends H{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 U(e,{dir:t,size:r=32}={}){return typeof e=="string"?q(e,{dir:t,size:r}):Zt(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 ge({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](r*2,"0")}`}function Zt(e,{dir:t,size:r=32}={}){if(r===null)return e;if(e.length>r)throw new ge({size:e.length,targetSize:r,type:"bytes"});let n=new Uint8Array(r);for(let a=0;a<r;a++){let l=t==="right";n[l?a:r-a-1]=e[l?a:e.length-a-1]}return n}var be=R(()=>{"use strict";dt()});var pe,Ue,$e=R(()=>{"use strict";ae();pe=class extends H{constructor({max:t,min:r,signed:n,size:a,value:l}){super(`Number "${l}" is not in safe ${a?`${a*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${r} to ${t})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}},Ue=class extends H{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}});function ie(e,{size:t}){if(D(e)>t)throw new Ue({givenSize:D(e),maxSize:t})}var mt=R(()=>{"use strict";$e();xe()});function $(e,t={}){return typeof e=="number"||typeof e=="bigint"?K(e,t):typeof e=="string"?Ne(e,t):typeof e=="boolean"?Oe(e,t):we(e,t)}function Oe(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(ie(r,{size:t.size}),U(r,{size:t.size})):r}function we(e,t={}){let r="";for(let a=0;a<e.length;a++)r+=lo[e[a]];let n=`0x${r}`;return typeof t.size=="number"?(ie(n,{size:t.size}),U(n,{dir:"right",size:t.size})):n}function K(e,t={}){let{signed:r,size:n}=t,a=BigInt(e),l;n?r?l=(1n<<BigInt(n)*8n-1n)-1n:l=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(l=BigInt(Number.MAX_SAFE_INTEGER));let f=typeof l=="bigint"&&r?-l-1n:0;if(l&&a>l||a<f){let p=typeof e=="bigint"?"n":"";throw new pe({max:l?`${l}${p}`:void 0,min:`${f}${p}`,signed:r,size:n,value:`${e}${p}`})}let S=`0x${(r&&a<0?(1n<<BigInt(n*8))+BigInt(a):a).toString(16)}`;return n?U(S,{size:n}):S}function Ne(e,t={}){let r=fo.encode(e);return we(r,t)}var lo,fo,Se=R(()=>{"use strict";$e();be();mt();lo=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));fo=new TextEncoder});function ht(e,t={}){return typeof e=="number"||typeof e=="bigint"?tr(e,t):typeof e=="boolean"?er(e,t):Q(e)?Ie(e,t):_e(e,t)}function er(e,t={}){let r=new Uint8Array(1);return r[0]=Number(e),typeof t.size=="number"?(ie(r,{size:t.size}),U(r,{size:t.size})):r}function Qt(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 Ie(e,t={}){let r=e;t.size&&(ie(r,{size:t.size}),r=U(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let a=n.length/2,l=new Uint8Array(a);for(let f=0,S=0;f<a;f++){let p=Qt(n.charCodeAt(S++)),E=Qt(n.charCodeAt(S++));if(p===void 0||E===void 0)throw new H(`Invalid byte sequence ("${n[S-2]}${n[S-1]}" in "${n}").`);l[f]=p*16+E}return l}function tr(e,t){let r=K(e,t);return Ie(r)}function _e(e,t={}){let r=mo.encode(e);return typeof t.size=="number"?(ie(r,{size:t.size}),U(r,{dir:"right",size:t.size})):r}var mo,G,je=R(()=>{"use strict";ae();he();be();mt();Se();mo=new TextEncoder;G={zero:48,nine:57,A:65,F:70,a:97,f:102}});function xt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function ho(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Te(e,...t){if(!ho(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 yt(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 rr(e,t){Te(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}var gt=R(()=>{"use strict"});function xo(e,t=!1){return t?{h:Number(e&Ve),l:Number(e>>or&Ve)}:{h:Number(e>>or&Ve)|0,l:Number(e&Ve)|0}}function nr(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let a=0;a<e.length;a++){let{h:l,l:f}=xo(e[a],t);[r[a],n[a]]=[l,f]}return[r,n]}var Ve,or,ar,ir,sr,cr,pr=R(()=>{"use strict";Ve=BigInt(4294967295),or=BigInt(32);ar=(e,t,r)=>e<<r|t>>>32-r,ir=(e,t,r)=>t<<r|e>>>32-r,sr=(e,t,r)=>t<<r-32|e>>>64-r,cr=(e,t,r)=>e<<r-32|t>>>64-r});function wt(e){for(let t=0;t<e.length;t++)e[t]=yo(e[t])}function go(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function qe(e){return typeof e=="string"&&(e=go(e)),Te(e),e}function lr(e){let t=n=>e().update(qe(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function fr(e){let t=(n,a)=>e(a).update(qe(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}var ur,bt,yo,We,dr=R(()=>{"use strict";gt();ur=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),bt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,yo=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;We=class{clone(){return this._cloneInto()}}});function Fo(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 S=(f+8)%10,p=(f+2)%10,E=r[p],h=r[p+1],d=mr(E,h,1)^r[S],x=hr(E,h,1)^r[S+1];for(let i=0;i<50;i+=10)e[f+i]^=d,e[f+i+1]^=x}let a=e[2],l=e[3];for(let f=0;f<24;f++){let S=yr[f],p=mr(a,l,S),E=hr(a,l,S),h=xr[f];a=e[h],l=e[h+1],e[h]=p,e[h+1]=E}for(let f=0;f<50;f+=10){for(let S=0;S<10;S++)r[S]=e[f+S];for(let S=0;S<10;S++)e[f+S]^=~r[(S+2)%10]&r[(S+4)%10]}e[0]^=vo[n],e[1]^=Eo[n]}r.fill(0)}var xr,yr,gr,bo,ve,wo,So,Io,To,vo,Eo,mr,hr,Ke,ee,va,Ea,Fa,Aa,Ca,br,Pa,Ma,wr,Ra,ka,Sr=R(()=>{"use strict";gt();pr();dr();xr=[],yr=[],gr=[],bo=BigInt(0),ve=BigInt(1),wo=BigInt(2),So=BigInt(7),Io=BigInt(256),To=BigInt(113);for(let e=0,t=ve,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],xr.push(2*(5*n+r)),yr.push((e+1)*(e+2)/2%64);let a=bo;for(let l=0;l<7;l++)t=(t<<ve^(t>>So)*To)%Io,t&wo&&(a^=ve<<(ve<<BigInt(l))-ve);gr.push(a)}[vo,Eo]=nr(gr,!0),mr=(e,t,r)=>r>32?sr(e,t,r):ar(e,t,r),hr=(e,t,r)=>r>32?cr(e,t,r):ir(e,t,r);Ke=class e extends We{constructor(t,r,n,a=!1,l=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=a,this.rounds=l,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,xt(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ur(this.state)}keccak(){bt||wt(this.state32),Fo(this.state32,this.rounds),bt||wt(this.state32),this.posOut=0,this.pos=0}update(t){yt(this);let{blockLen:r,state:n}=this;t=qe(t);let a=t.length;for(let l=0;l<a;){let f=Math.min(r-this.pos,a-l);for(let S=0;S<f;S++)n[this.pos++]^=t[l++];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){yt(this,!1),Te(t),this.finish();let r=this.state,{blockLen:n}=this;for(let a=0,l=t.length;a<l;){this.posOut>=n&&this.keccak();let f=Math.min(n-this.posOut,l-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 xt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(rr(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:l,enableXOF:f}=this;return t||(t=new e(r,n,a,f,l)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=l,t.suffix=n,t.outputLen=a,t.enableXOF=f,t.destroyed=this.destroyed,t}},ee=(e,t,r)=>lr(()=>new Ke(t,e,r)),va=ee(6,144,224/8),Ea=ee(6,136,256/8),Fa=ee(6,104,384/8),Aa=ee(6,72,512/8),Ca=ee(1,144,224/8),br=ee(1,136,256/8),Pa=ee(1,104,384/8),Ma=ee(1,72,512/8),wr=(e,t,r)=>fr((n={})=>new Ke(t,e,n.dkLen===void 0?r:n.dkLen,!0)),Ra=wr(31,168,128/8),ka=wr(31,136,256/8)});function Ee(e,t){let r=t||"hex",n=br(Q(e,{strict:!1})?ht(e):e);return r==="bytes"?n:$(n)}var St=R(()=>{"use strict";Sr();he();je();Se()});var se,It=R(()=>{"use strict";ae();se=class extends H{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}});var ue,Tt=R(()=>{"use strict";ue=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 Ir(e,t){if(vt.has(`${e}.${t}`))return vt.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=Ee(_e(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 l=`0x${a.join("")}`;return vt.set(`${e}.${t}`,l),l}var vt,Tr=R(()=>{"use strict";je();St();Tt();vt=new ue(8192)});function Fe(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(Et.has(n))return Et.get(n);let a=Ao.test(e)?e.toLowerCase()===e?!0:r?Ir(e)===e:!0:!1;return Et.set(n,a),a}var Ao,Et,Ft=R(()=>{"use strict";Tt();Tr();Ao=/^0x[a-fA-F0-9]{40}$/,Et=new ue(8192)});function te(e){return typeof e[0]=="string"?j(e):vr(e)}function vr(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 At=R(()=>{"use strict"});function Er(e,t,r,{strict:n}={}){return Q(e,{strict:!1})?Po(e,t,r,{strict:n}):Co(e,t,r,{strict:n})}function Fr(e,t){if(typeof t=="number"&&t>0&&t>D(e)-1)throw new ye({offset:t,position:"start",size:D(e)})}function Ar(e,t,r){if(typeof t=="number"&&typeof r=="number"&&D(e)!==r-t)throw new ye({offset:r,position:"end",size:D(e)})}function Co(e,t,r,{strict:n}={}){Fr(e,t);let a=e.slice(t,r);return n&&Ar(a,t,r),a}function Po(e,t,r,{strict:n}={}){Fr(e,t);let a=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&Ar(a,t,r),a}var Cr=R(()=>{"use strict";dt();he();xe()});var Pr,Mr=R(()=>{"use strict";Pr=/^(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 Ct(e,t){if(e.length!==t.length)throw new Le({expectedLength:e.length,givenLength:t.length});let r=Mo({params:e,values:t}),n=Mt(r);return n.length===0?"0x":n}function Mo({params:e,values:t}){let r=[];for(let n=0;n<e.length;n++)r.push(Pt({param:e[n],value:t[n]}));return r}function Pt({param:e,value:t}){let r=Uo(e.type);if(r){let[n,a]=r;return ko(t,{length:n,param:{...e,type:a}})}if(e.type==="tuple")return Do(t,{param:e});if(e.type==="address")return Ro(t);if(e.type==="bool")return Ho(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let n=e.type.startsWith("int"),[,,a="256"]=Pr.exec(e.type)??[];return Lo(t,{signed:n,size:Number(a)})}if(e.type.startsWith("bytes"))return Bo(t,{param:e});if(e.type==="string")return zo(t);throw new ze(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Mt(e){let t=0;for(let l=0;l<e.length;l++){let{dynamic:f,encoded:S}=e[l];f?t+=32:t+=D(S)}let r=[],n=[],a=0;for(let l=0;l<e.length;l++){let{dynamic:f,encoded:S}=e[l];f?(r.push(K(t+a,{size:32})),n.push(S),a+=D(S)):r.push(S)}return te([...r,...n])}function Ro(e){if(!Fe(e))throw new se({address:e});return{dynamic:!1,encoded:q(e.toLowerCase())}}function ko(e,{length:t,param:r}){let n=t===null;if(!Array.isArray(e))throw new De(e);if(!n&&e.length!==t)throw new Be({expectedLength:t,givenLength:e.length,type:`${r.type}[${t}]`});let a=!1,l=[];for(let f=0;f<e.length;f++){let S=Pt({param:r,value:e[f]});S.dynamic&&(a=!0),l.push(S)}if(n||a){let f=Mt(l);if(n){let S=K(l.length,{size:32});return{dynamic:!0,encoded:l.length>0?te([S,f]):S}}if(a)return{dynamic:!0,encoded:f}}return{dynamic:!1,encoded:te(l.map(({encoded:f})=>f))}}function Bo(e,{param:t}){let[,r]=t.type.split("bytes"),n=D(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 He({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:q(e,{dir:"right"})}}function Ho(e){if(typeof e!="boolean")throw new H(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:q(Oe(e))}}function Lo(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 pe({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 zo(e){let t=Ne(e),r=Math.ceil(D(t)/32),n=[];for(let a=0;a<r;a++)n.push(q(Er(t,a*32,(a+1)*32),{dir:"right"}));return{dynamic:!0,encoded:te([q(K(D(t),{size:32})),...n])}}function Do(e,{param:t}){let r=!1,n=[];for(let a=0;a<t.components.length;a++){let l=t.components[a],f=Array.isArray(e)?a:l.name,S=Pt({param:l,value:e[f]});n.push(S),S.dynamic&&(r=!0)}return{dynamic:r,encoded:r?Mt(n):te(n.map(({encoded:a})=>a))}}function Uo(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var Rr=R(()=>{"use strict";Yt();It();ae();$e();Ft();At();be();xe();Cr();Se();Mr()});function Rt(e,t){if(!Fe(e,{strict:!1}))throw new se({address:e});if(!Fe(t,{strict:!1}))throw new se({address:t});return e.toLowerCase()===t.toLowerCase()}var kr=R(()=>{"use strict";It();Ft()});var Zo={};oo(Zo,{Deferred:()=>W,FrakContextManager:()=>re,FrakRpcError:()=>B,PressInteractionEncoder:()=>Jr,PurchaseInteractionEncoder:()=>Gr,ReferralInteractionEncoder:()=>Qe,RpcErrorCodes:()=>z,WebShopInteractionEncoder:()=>Xr,compressJson:()=>de,createIFrameNexusClient:()=>ut,createIframe:()=>ct,decompressDataAndCheckHash:()=>ne,decompressJson:()=>me,displayModal:()=>J,getProductInformation:()=>jr,hashAndCompressData:()=>oe,interactionTypes:()=>V,modalBuilder:()=>Kr,openSso:()=>_r,processReferral:()=>et,productTypes:()=>O,productTypesMask:()=>$r,referralInteraction:()=>Yr,sendInteraction:()=>Ye,sendTransaction:()=>qr,siweAuthenticate:()=>Wr,trackPurchaseStatus:()=>Vr,watchWalletStatus:()=>Xe});function Dt(e){document.readyState==="complete"||document.readyState==="interactive"?setTimeout(e,1):document.addEventListener?document.addEventListener("DOMContentLoaded",e):document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&e()})}async function Ut(e,t){return document.getElementById(e)?Promise.resolve(!0):new Promise((r,n)=>{let a=document.createElement("script");a.id=e,a.src=t,a.async=!0,a.onload=()=>r(!0),a.onerror=()=>n(new Error(`Script load error for ${t}`)),document.head.appendChild(a)})}function $t(){ao(),io(),Ut("frak-components","https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/dist/bundle/components.js")}function ao(){window.FrakSetup.config={walletUrl:"https://wallet.frak.id",metadata:{name:"Moov360"},domain:window.location.host},window.FrakSetup.modalConfig={login:{allowSso:!0,ssoMetadata:{logoUrl:"https://moov360.com/wp-content/uploads/2022/07/MOOV360noir-1.png",homepageLink:"https://moov360.com/"}},metadata:{header:{icon:"https://moov360.com/wp-content/uploads/2022/07/MOOV360noir-1.png"},lang:"fr"}},window.FrakSetup.modalShareConfig={popupTitle:"Partage ce produit avec tes amis",text:"D\xE9couvre ce produit chez Moov360!",link:window.location.href}}function io(){let e=document.querySelectorAll("a.frak-link");for(let t of Array.from(e)){let r=document.createElement("frak-button-share");r.setAttribute("text","Partage et gagne"),r.setAttribute("classname","button"),r.style.display="block",r.style.marginTop="20px",t.replaceWith(r)}}var so={"moov360.com":$t};function Ot(){let e=so[window.location.host];e&&e()}var B=class extends Error{constructor(r,n,a){super(n);this.code=r;this.data=a}};var Me=class extends B{constructor(t){super(z.internalError,t)}};var z={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 co=(e="button[data-frak-share-button], #nexus-share-button > button")=>document.querySelectorAll(e),po=(e,t)=>{if(e){t?.removeAttribute("disabled");return}t?.setAttribute("disabled","")},Nt=e=>t=>{let r=Array.from(co(t?.metadata?.buttonShare));for(let n of r)po(e,n)},_t=Nt(!0),jt=Nt(!1);var Vt=Pe(nt(),1),it=Pe(at(),1);async function oe(e){let t=(0,it.sha256)(JSON.stringify(e)),r={...e,validationHash:t},n=await de(r),a=(0,it.sha256)(n);return{compressed:n,compressedHash:a}}async function de(e){return(0,Vt.compressToBase64)(JSON.stringify(e))}var Wt=Pe(nt(),1),st=Pe(at(),1);async function ne(e){if(!(e?.compressed&&e?.compressedHash))throw new B(z.corruptedResponse,"Missing compressed data");let t=await me(e.compressed);if(!t)throw new B(z.corruptedResponse,"Invalid compressed data");if(!t?.validationHash)throw new B(z.corruptedResponse,"Missing validation hash");if((0,st.sha256)(e.compressed)!==e.compressedHash)throw new B(z.corruptedResponse,"Invalid compressed hash");let{validationHash:n,...a}=t;if((0,st.sha256)(JSON.stringify(a))!==t.validationHash)throw new B(z.corruptedResponse,"Invalid data validation hash");return t}async function me(e){let t=await(0,Wt.decompressFromBase64)(e);try{return JSON.parse(t)}catch(r){return console.error("Invalid compressed data",{e:r,decompressed:t}),null}}var ce="nexus-wallet-backup";function qt(){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 ke={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 ct({walletBaseUrl:e,config:t}){jt(t);let r=document.querySelector("#nexus-wallet");r&&r.remove();let n=document.createElement("iframe");return n.id=ke.id,n.name=ke.name,n.allow=ke.allow,n.style.zIndex=ke.style.zIndex.toString(),pt({iframe:n,isVisible:!1}),document.body.appendChild(n),new Promise(a=>{n?.addEventListener("load",()=>a(n)),n.src=`${e??t?.walletUrl??"https://wallet.frak.id"}/listener`})}function pt({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 Kt({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(ce,n.data.backup):localStorage.removeItem(ce);break;case"remove-backup":localStorage.removeItem(ce);break;case"show":case"hide":pt({iframe:e,isVisible:n.iframeLifecycle==="show"});break}},isConnected:t.promise}}function Jt({nexusWalletUrl:e,iframe:t,channelManager:r,iframeLifecycleManager:n}){if(typeof window>"u")throw new B(z.configError,"iframe client should be used in the browser");if(!t.contentWindow)throw new B(z.configError,"The iframe does not have a product window");let a=t.contentWindow,l=async p=>{if(!(p.origin&&URL.canParse(p.origin))||new URL(p.origin).origin.toLowerCase()!==new URL(e).origin.toLowerCase())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,h=r.getRpcResolver(E);h&&await h(p.data)};return window.addEventListener("message",l),{sendEvent:p=>{a.postMessage(p,{targetOrigin:e})},cleanup:()=>{window.removeEventListener("message",l)}}}function ut({config:e,iframe:t}){let r=qt(),n=Kt({iframe:t}),a=Jt({nexusWalletUrl:e?.walletUrl??"https://wallet.frak.id",iframe:t,channelManager:r,iframeLifecycleManager:n}),l=async E=>{if(!await n.isConnected)throw new B(z.clientNotConnected,"The iframe provider isn't connected yet");let d=new W,x=r.createChannel(async g=>{let o=await ne(g.data);o.error?d.reject(new B(o.error.code,o.error.message,o.error?.data)):d.resolve(o.result),r.removeChannel(x)}),i=await oe(E);return a.sendEvent({id:x,topic:E.method,data:i}),d.promise},f=async(E,h)=>{if(!await n.isConnected)throw new B(z.clientNotConnected,"The iframe provider isn't connected yet");let x=r.createChannel(async g=>{let o=await ne(g.data);if(o.result)h(o.result);else throw new Me("No valid result in the response")}),i=await oe(E);a.sendEvent({id:x,topic:E.method,data:i})},S=async()=>{r.destroy(),a.cleanup(),t.remove()},p=uo({config:e,messageHandler:a,lifecycleManager:n});return{config:e,waitForConnection:n.isConnected,waitForSetup:p,request:l,listenerRequest:f,destroy:S}}async function uo({config:e,messageHandler:t,lifecycleManager:r}){await r.isConnected,_t(e);let n=async()=>{let l=e.metadata.css;l&&t.sendEvent({clientLifecycle:"modal-css",data:{cssLink:l}})},a=async()=>{if(typeof window>"u")return;let l=window.localStorage.getItem(ce);l&&t.sendEvent({clientLifecycle:"restore-backup",data:{backup:l}})};await Promise.all([n(),a()])}var Je=256,Ge;function Br(e=11){if(!Ge||Je+e>256*2){Ge="",Je=0;for(let t=0;t<256;t++)Ge+=(256+Math.random()*256|0).toString(16).substring(1)}return Ge.substring(Je,Je+++e)}Rr();je();Se();At();kr();St();be();var kt="fCtx";function $o(e){return btoa(Array.from(e,t=>String.fromCharCode(t)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Oo(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 Hr(e){if(e?.r)try{let t=Ie(e.r);return $o(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function Lr(e){if(!(!e||e.length===0))try{let t=Oo(e);return{r:we(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function zr({url:e}){if(!e)return null;let r=new URL(e).searchParams.get(kt);return r?Lr(r):null}function Dr({url:e,context:t}){if(!e)return null;let r=zr({url:e}),n=r?{...r,...t}:t;if(!n.r)return null;let a=Hr(n);if(!a)return null;let l=new URL(e);return l.searchParams.set(kt,a),l.toString()}function Ur(e){let t=new URL(e);return t.searchParams.delete(kt),t.toString()}function No({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=Dr({url:r,context:t}):n=Ur(r),n&&window.history.replaceState(null,"",n.toString())}var re={compress:Hr,decompress:Lr,parse:zr,update:Dr,remove:Ur,replaceUrl:No};var O={dapp:1,press:2,webshop:3,referral:30,purchase:31},$r=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",unsafeCompleted:"0x4d5b14e0"}};function Xe(e,t){if(!t)return e.request({method:"frak_listenToWalletStatus"}).then(a=>(Or(a.interactionToken),a));let r=new W,n=!1;return e.listenerRequest({method:"frak_listenToWalletStatus"},a=>{t(a),Or(a.interactionToken),n||(r.resolve(a),n=!0)}).then(()=>r.promise)}function Or(e){typeof window>"u"||(e?window.sessionStorage.setItem("frak-wallet-interaction-token",e):window.sessionStorage.removeItem("frak.interaction-token"))}function Nr({domain:e}){let t=e??window.location.host;return Ee($(t))}async function Ye(e,{productId:t,interaction:r,validation:n}){let a=t??Nr(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 _r(e,t){let{metadata:r}=e.config;await e.request({method:"frak_sso",params:[t,r.name,r.css]})}async function jr(e){return await e.request({method:"frak_getProductInformation"})}async function Vr(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 Bt(){return Br(96)}async function Wr(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}`,l={...t,statement:a,nonce:t?.nonce??Bt(),uri:t?.uri??`https://${n}`,version:t?.version??"1",domain:n};return(await J(e,{metadata:r,steps:{login:{},siweAuthenticate:{siwe:l}}})).siweAuthenticate}async function qr(e,{tx:t,metadata:r}){return(await J(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function Kr(e,{metadata:t,login:r,openSession:n}){return Ze(e,{steps:{login:r??{},openSession:n??{}},metadata:t})}function Ze(e,t){function r(f){return Ze(e,{...t,steps:{...t.steps,sendTransaction:f}})}function n(f){return Ze(e,{...t,steps:{...t.steps,final:{...f,action:{key:"reward"}}}})}function a(f,S){return Ze(e,{...t,steps:{...t.steps,final:{...S,action:{key:"sharing",options:f}}}})}async function l(){return await J(e,t)}return{params:t,sendTx:r,reward:n,sharing:a,display:l}}function _o({articleId:e}){let t=j([V.press.openArticle,U(e,{size:32})]);return{handlerTypeDenominator:$(O.press),interactionData:t}}function jo({articleId:e}){let t=j([V.press.readArticle,U(e,{size:32})]);return{handlerTypeDenominator:$(O.press),interactionData:t}}var Jr={openArticle:_o,readArticle:jo};function Vo(){let e=j([V.referral.createLink,"0x"]);return{handlerTypeDenominator:$(O.referral),interactionData:e}}function Wo({referrer:e}){let t=j([V.referral.referred,U(e,{size:32})]);return{handlerTypeDenominator:$(O.referral),interactionData:t}}var Qe={createLink:Vo,referred:Wo};function qo({purchaseId:e}){let t=j([V.purchase.started,U(e,{size:32})]);return{handlerTypeDenominator:$(O.purchase),interactionData:t}}function Ko({purchaseId:e,proof:t}){let r=Ct([{type:"uint256"},{type:"bytes32[]"}],[BigInt(e),t]),n=j([V.purchase.completed,r]);return{handlerTypeDenominator:$(O.purchase),interactionData:n}}var Gr={startPurchase:qo,completedPurchase:Ko};function Jo(){let e=j([V.webshop.open,"0x"]);return{handlerTypeDenominator:$(O.webshop),interactionData:e}}var Xr={open:Jo};async function et(e,{walletStatus:t,frakContext:r,modalConfig:n,productId:a,options:l}){let f=!1;async function S(){if(!f)return f=!0,Xo(e,{modalConfig:n,walletStatus:t})}async function p(E){let h=Qe.referred({referrer:E});await Ye(e,{productId:a,interaction:h})}try{let{status:E,currentWallet:h}=await Go({initialWalletStatus:t,getFreshWalletStatus:S,pushReferralInteraction:p,frakContext:r});return re.replaceUrl({url:window.location?.href,context:l?.alwaysAppendUrl?{r:h}:null}),E}catch(E){return console.log("Error processing referral",{error:E}),re.replaceUrl({url:window.location?.href,context:l?.alwaysAppendUrl?{r:t?.wallet}:null}),Yo(E)}}async function Go({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 Xo(e,{modalConfig:t,walletStatus:r}){return r?.interactionSession?r.wallet??void 0:t?(await J(e,t))?.login?.wallet??void 0:void 0}function Yo(e){if(e instanceof B)switch(e.code){case z.walletNotConnected:return"no-wallet";case z.serverErrorForInteractionDelegation:return"no-session";default:return"error"}return"error"}async function Yr(e,{productId:t,modalConfig:r,options:n}={}){let a=re.parse({url:window.location.href}),l=await Xe(e);try{return await et(e,{walletStatus:l,frakContext:a,modalConfig:r,productId:t,options:n})}catch(f){return f}}Dt(()=>Ot());return no(Zo);})();
1
+ "use strict";var NexusSDK=(()=>{var Qr=Object.create;var Re=Object.defineProperty;var eo=Object.getOwnPropertyDescriptor;var to=Object.getOwnPropertyNames;var ro=Object.getPrototypeOf,oo=Object.prototype.hasOwnProperty;var zt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var M=(e,t)=>()=>(e&&(t=e(e=0)),t);var Dt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),no=(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 to(t))!oo.call(e,a)&&a!==r&&Re(e,a,{get:()=>t[a],enumerable:!(n=eo(t,a))||n.enumerable});return e};var Be=(e,t,r)=>(r=e!=null?Qr(ro(e)):{},Ut(t||!e||!e.__esModule?Re(r,"default",{value:e,enumerable:!0}):r,e)),ao=e=>Ut(Re({},"__esModule",{value:!0}),e);var st=Dt((he,it)=>{"use strict";(function(e,t){if(typeof he=="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 he=="object"?he:e)[n]=r[n]}})(he,()=>(()=>{"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(I,A){function h(c){try{z(i.next(c))}catch(l){A(l)}}function T(c){try{z(i.throw(c))}catch(l){A(l)}}function z(c){var l;c.done?I(c.value):(l=c.value,l instanceof o?l:new o(function(F){F(l)})).then(h,T)}z((i=i.apply(s,g||[])).next())})},f=this&&this.__generator||function(s,g){var o,i,I,A,h={label:0,sent:function(){if(1&I[0])throw I[1];return I[1]},trys:[],ops:[]};return A={next:T(0),throw:T(1),return:T(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function T(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&&(I=2&l[0]?i.return:l[0]?i.throw||((I=i.return)&&I.call(i),0):i.next)&&!(I=I.call(i,l[1])).done)return I;switch(i=0,I&&(l=[2&l[0],I.value]),l[0]){case 0:case 1:I=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(!((I=(I=h.trys).length>0&&I[I.length-1])||l[0]!==6&&l[0]!==2)){h=0;continue}if(l[0]===3&&(!I||l[1]>I[0]&&l[1]<I[3])){h.label=l[1];break}if(l[0]===6&&h.label<I[1]){h.label=I[1],I=l;break}if(I&&h.label<I[2]){h.label=I[2],h.ops.push(l);break}I[2]&&h.ops.pop(),h.trys.pop();continue}l=g.call(s,h)}catch(F){l=[6,F],i=0}finally{o=I=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 S=a(304),p=a(134),E=new S.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,I){if(!x[i]){x[i]={};for(var A=0;A<i.length;A++)x[i][i.charAt(A)]=A}return x[i][I]}(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(T){o(T)}}function I(h){try{A(s.throw(h))}catch(T){o(T)}}function A(h){var T;h.done?g(h.value):(T=h.value,T instanceof x?T:new x(function(z){z(T)})).then(i,I)}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:I(0),throw:I(1),return:I(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function I(A){return function(h){return function(T){if(x)throw new TypeError("Generator is already executing.");for(;o&&(o=0,T[0]&&(i=0)),i;)try{if(x=1,s&&(g=2&T[0]?s.return:T[0]?s.throw||((g=s.return)&&g.call(s),0):s.next)&&!(g=g.call(s,T[1])).done)return g;switch(s=0,g&&(T=[2&T[0],g.value]),T[0]){case 0:case 1:g=T;break;case 4:return i.label++,{value:T[1],done:!1};case 5:i.label++,s=T[1],T=[0];continue;case 7:T=i.ops.pop(),i.trys.pop();continue;default:if(!((g=(g=i.trys).length>0&&g[g.length-1])||T[0]!==6&&T[0]!==2)){i=0;continue}if(T[0]===3&&(!g||T[1]>g[0]&&T[1]<g[3])){i.label=T[1];break}if(T[0]===6&&i.label<g[1]){i.label=g[1],g=T;break}if(g&&i.label<g[2]){i.label=g[2],i.ops.push(T);break}g[2]&&i.ops.pop(),i.trys.pop();continue}T=m.call(d,i)}catch(z){T=[6,z],s=0}finally{x=g=0}if(5&T[0])throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}([A,h])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.CompressorImpl=void 0;var S=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(I,A){for(var h=0,T=0;T<A;++T)h<<=4,h|=p[15&I],I>>=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 I=o.w+i;o.dictionary.has(I)?o.w=I:(this.writeWToDataVal(o,s,g),o.dictionary.set(I,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,I;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:""},I=0,A.label=1;case 1:return I<m.length?(d.loopIteration(m,I,x,s,i),I%1e4!=0?[3,3]:[4,(0,S.wait)()]):[3,4];case 2:A.sent(),A.label=3;case 3:return I+=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{I(x.next(A))}catch(h){g(h)}}function i(A){try{I(x.throw(A))}catch(h){g(h)}}function I(A){var h;A.done?s(A.value):(h=A.value,h instanceof m?h:new m(function(T){T(h)})).then(o,i)}I((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(I){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(T){h=[6,T],x=0}finally{m=s=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([I,A])}}};Object.defineProperty(n,"__esModule",{value:!0}),n.DecompressorImpl=void 0;var S=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,I;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),I=1,A.label=1;case 1:return I%2e4!=0?[3,3]:[4,(0,S.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++),I++,[3,1];case 4:return[2]}})})})},E}();n.DecompressorImpl=p},658:function(r,n){var a=this&&this.__awaiter||function(f,S,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(I){I(i)})).then(x,s)}g((E=E.apply(f,S||[])).next())})},u=this&&this.__generator||function(f,S){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=S.call(f,x)}catch(I){i=[6,I],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(S){setTimeout(S,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((en,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,S=!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]"}),S&&(r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(c){return typeof c=="object"&&c.buffer&&c.buffer.constructor===ArrayBuffer});var g=function(c,l){return function(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 b=x[F];l[b]=g(b,c)}return l},i=function(c,l){var F=zt("crypto"),b=zt("buffer").Buffer,v=l?"sha224":"sha256",w;b.from&&!r.JS_SHA256_NO_BUFFER_FROM?w=b.from:w=function(y){return new b(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===b?F.createHash(v).update(w(y)).digest("hex"):c(y)};return C},I=function(c,l){return function(F,b){return new T(F,l,!0).update(b)[c]()}},A=function(c){var l=I("hex",c);l.create=function(v){return new T(v,c)},l.update=function(v,w){return l.create(v).update(w)};for(var F=0;F<x.length;++F){var b=x[F];l[b]=I(b,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(S&&c.constructor===ArrayBuffer)c=new Uint8Array(c);else if(!Array.isArray(c)&&(!S||!ArrayBuffer.isView(c)))throw new Error(e)}else throw new Error(e);l=!0}for(var b,v=0,w,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(w=this.start;v<C&&w<64;++v)y[w>>>2]|=c[v]<<d[w++&3];else for(w=this.start;v<C&&w<64;++v)b=c.charCodeAt(v),b<128?y[w>>>2]|=b<<d[w++&3]:b<2048?(y[w>>>2]|=(192|b>>>6)<<d[w++&3],y[w>>>2]|=(128|b&63)<<d[w++&3]):b<55296||b>=57344?(y[w>>>2]|=(224|b>>>12)<<d[w++&3],y[w>>>2]|=(128|b>>>6&63)<<d[w++&3],y[w>>>2]|=(128|b&63)<<d[w++&3]):(b=65536+((b&1023)<<10|c.charCodeAt(++v)&1023),y[w>>>2]|=(240|b>>>18)<<d[w++&3],y[w>>>2]|=(128|b>>>12&63)<<d[w++&3],y[w>>>2]|=(128|b>>>6&63)<<d[w++&3],y[w>>>2]|=(128|b&63)<<d[w++&3]);this.lastByteIndex=w,this.bytes+=w-this.start,w>=64?(this.block=y[16],this.start=w-64,this.hash(),this.hashed=!0):this.start=w}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},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,b=this.h3,v=this.h4,w=this.h5,C=this.h6,y=this.h7,P=this.blocks,R,N,j,X,k,Y,Z,de,nt,at,Me;for(R=16;R<64;++R)k=P[R-15],N=(k>>>7|k<<25)^(k>>>18|k<<14)^k>>>3,k=P[R-2],j=(k>>>17|k<<15)^(k>>>19|k<<13)^k>>>10,P[R]=P[R-16]+N+P[R-7]+j<<0;for(Me=l&F,R=0;R<64;R+=4)this.first?(this.is224?(de=300032,k=P[0]-1413257819,y=k-150054599<<0,b=k+24177077<<0):(de=704751109,k=P[0]-210244248,y=k-1521486534<<0,b=k+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),de=c&l,X=de^c&F^Me,Z=v&w^~v&C,k=y+j+Z+m[R]+P[R],Y=N+X,y=b+k<<0,b=k+Y<<0),N=(b>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10),j=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),nt=b&c,X=nt^b&l^de,Z=y&v^~y&w,k=C+j+Z+m[R+1]+P[R+1],Y=N+X,C=F+k<<0,F=k+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&b,X=at^F&c^nt,Z=C&y^~C&v,k=w+j+Z+m[R+2]+P[R+2],Y=N+X,w=l+k<<0,l=k+Y<<0,N=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),j=(w>>>6|w<<26)^(w>>>11|w<<21)^(w>>>25|w<<7),Me=l&F,X=Me^l&b^at,Z=w&C^~w&y,k=v+j+Z+m[R+3]+P[R+3],Y=N+X,v=c+k<<0,c=k+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+b<<0,this.h4=this.h4+v<<0,this.h5=this.h5+w<<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,b=this.h3,v=this.h4,w=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[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[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[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[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,b=this.h3,v=this.h4,w=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,b>>>24&255,b>>>16&255,b>>>8&255,b&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255,w>>>24&255,w>>>16&255,w>>>8&255,w&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 T(c,l,F){var b,v=typeof c;if(v==="string"){var w=[],C=c.length,y=0,P;for(b=0;b<C;++b)P=c.charCodeAt(b),P<128?w[y++]=P:P<2048?(w[y++]=192|P>>>6,w[y++]=128|P&63):P<55296||P>=57344?(w[y++]=224|P>>>12,w[y++]=128|P>>>6&63,w[y++]=128|P&63):(P=65536+((P&1023)<<10|c.charCodeAt(++b)&1023),w[y++]=240|P>>>18,w[y++]=128|P>>>12&63,w[y++]=128|P>>>6&63,w[y++]=128|P&63);c=w}else if(v==="object"){if(c===null)throw new Error(e);if(S&&c.constructor===ArrayBuffer)c=new Uint8Array(c);else if(!Array.isArray(c)&&(!S||!ArrayBuffer.isView(c)))throw new Error(e)}else throw new Error(e);c.length>64&&(c=new h(l,!0).update(c).array());var R=[],N=[];for(b=0;b<64;++b){var j=c[b]||0;R[b]=92^j,N[b]=54^j}h.call(this,l,F),this.update(N),this.oKeyPad=R,this.inner=!0,this.sharedMemory=F}T.prototype=new h,T.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 we=M(()=>{"use strict"});function O(e){return Q(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var be=M(()=>{"use strict";we()});var ft,Vt=M(()=>{"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,L,se=M(()=>{"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,De,Ue,$e,Oe,qt=M(()=>{"use strict";be();se();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"})}},De=class extends L{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 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 Se,Ie,mt=M(()=>{"use strict";se();Se=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"})}},Ie=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 Ie({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 Ie({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 Te=M(()=>{"use strict";mt()});var le,_e,Ne=M(()=>{"use strict";se();le=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 ce(e,{size:t}){if(O(e)>t)throw new _e({givenSize:O(e),maxSize:t})}var ht=M(()=>{"use strict";Ne();be()});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"?(ce(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+=co[e[a]];let n=`0x${r}`;return typeof t.size=="number"?(ce(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 le({max:u?`${u}${p}`:void 0,min:`${f}${p}`,signed:r,size:n,value:`${e}${p}`})}let S=`0x${(r&&a<0?(1n<<BigInt(n*8))+BigInt(a):a).toString(16)}`;return n?D(S,{size:n}):S}function Ve(e,t={}){let r=po.encode(e);return Fe(r,t)}var co,po,Ee=M(()=>{"use strict";Ne();Te();ht();co=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));po=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"?(ce(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&&(ce(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,S=0;f<a;f++){let p=Jt(n.charCodeAt(S++)),E=Jt(n.charCodeAt(S++));if(p===void 0||E===void 0)throw new L(`Invalid byte sequence ("${n[S-2]}${n[S-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=uo.encode(e);return typeof t.size=="number"?(ce(r,{size:t.size}),D(r,{dir:"right",size:t.size})):r}var uo,G,qe=M(()=>{"use strict";se();we();Te();ht();Ee();uo=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 lo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Ae(e,...t){if(!lo(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 wt=M(()=>{"use strict"});function fo(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}=fo(e[a],t);[r[a],n[a]]=[u,f]}return[r,n]}var Ke,Zt,er,tr,rr,or,nr=M(()=>{"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 St(e){for(let t=0;t<e.length;t++)e[t]=mo(e[t])}function ho(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=ho(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,bt,mo,Je,cr=M(()=>{"use strict";wt();ar=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),bt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,mo=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;Je=class{clone(){return this._cloneInto()}}});function To(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 S=(f+8)%10,p=(f+2)%10,E=r[p],d=r[p+1],m=pr(E,d,1)^r[S],x=ur(E,d,1)^r[S+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 S=fr[f],p=pr(a,u,S),E=ur(a,u,S),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 S=0;S<10;S++)r[S]=e[f+S];for(let S=0;S<10;S++)e[f+S]^=~r[(S+2)%10]&r[(S+4)%10]}e[0]^=So[n],e[1]^=Io[n]}r.fill(0)}var lr,fr,dr,xo,Ce,yo,go,wo,bo,So,Io,pr,ur,Xe,ee,pa,ua,la,fa,da,mr,ma,ha,hr,xa,ya,xr=M(()=>{"use strict";wt();nr();cr();lr=[],fr=[],dr=[],xo=BigInt(0),Ce=BigInt(1),yo=BigInt(2),go=BigInt(7),wo=BigInt(256),bo=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=xo;for(let u=0;u<7;u++)t=(t<<Ce^(t>>go)*bo)%wo,t&yo&&(a^=Ce<<(Ce<<BigInt(u))-Ce);dr.push(a)}[So,Io]=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(){bt||St(this.state32),To(this.state32,this.rounds),bt||St(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 S=0;S<f;S++)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)),pa=ee(6,144,224/8),ua=ee(6,136,256/8),la=ee(6,104,384/8),fa=ee(6,72,512/8),da=ee(1,144,224/8),mr=ee(1,136,256/8),ma=ee(1,104,384/8),ha=ee(1,72,512/8),hr=(e,t,r)=>sr((n={})=>new Xe(t,e,n.dkLen===void 0?r:n.dkLen,!0)),xa=hr(31,168,128/8),ya=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 It=M(()=>{"use strict";xr();we();qe();Ee()});var pe,Tt=M(()=>{"use strict";se();pe=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 fe,Ft=M(()=>{"use strict";fe=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){let r=super.get(t);return super.has(t)&&r!==void 0&&(this.delete(t),super.set(t,r)),r}set(t,r){if(super.set(t,r),this.maxSize&&this.size>this.maxSize){let 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=M(()=>{"use strict";qe();It();Ft();Et=new fe(8192)});function ke(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(vt.has(n))return vt.get(n);let a=Fo.test(e)?e.toLowerCase()===e?!0:r?yr(e)===e:!0:!1;return vt.set(n,a),a}var Fo,vt,At=M(()=>{"use strict";Ft();gr();Fo=/^0x[a-fA-F0-9]{40}$/,vt=new fe(8192)});function te(e){return typeof e[0]=="string"?V(e):wr(e)}function wr(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=M(()=>{"use strict"});function br(e,t,r,{strict:n}={}){return Q(e,{strict:!1})?vo(e,t,r,{strict:n}):Eo(e,t,r,{strict:n})}function Sr(e,t){if(typeof t=="number"&&t>0&&t>O(e)-1)throw new Se({offset:t,position:"start",size:O(e)})}function Ir(e,t,r){if(typeof t=="number"&&typeof r=="number"&&O(e)!==r-t)throw new Se({offset:r,position:"end",size:O(e)})}function Eo(e,t,r,{strict:n}={}){Sr(e,t);let a=e.slice(t,r);return n&&Ir(a,t,r),a}function vo(e,t,r,{strict:n}={}){Sr(e,t);let a=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&Ir(a,t,r),a}var Tr=M(()=>{"use strict";mt();we();be()});var Fr,Er=M(()=>{"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=Ao({params:e,values:t}),n=Mt(r);return n.length===0?"0x":n}function Ao({params:e,values:t}){let r=[];for(let n=0;n<e.length;n++)r.push(kt({param:e[n],value:t[n]}));return r}function kt({param:e,value:t}){let r=Lo(e.type);if(r){let[n,a]=r;return Po(t,{length:n,param:{...e,type:a}})}if(e.type==="tuple")return Ho(t,{param:e});if(e.type==="address")return Co(t);if(e.type==="bool")return Mo(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let n=e.type.startsWith("int"),[,,a="256"]=Fr.exec(e.type)??[];return Ro(t,{signed:n,size:Number(a)})}if(e.type.startsWith("bytes"))return ko(t,{param:e});if(e.type==="string")return Bo(t);throw new $e(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Mt(e){let t=0;for(let u=0;u<e.length;u++){let{dynamic:f,encoded:S}=e[u];f?t+=32:t+=O(S)}let r=[],n=[],a=0;for(let u=0;u<e.length;u++){let{dynamic:f,encoded:S}=e[u];f?(r.push(K(t+a,{size:32})),n.push(S),a+=O(S)):r.push(S)}return te([...r,...n])}function Co(e){if(!ke(e))throw new pe({address:e});return{dynamic:!1,encoded:q(e.toLowerCase())}}function Po(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 S=kt({param:r,value:e[f]});S.dynamic&&(a=!0),u.push(S)}if(n||a){let f=Mt(u);if(n){let S=K(u.length,{size:32});return{dynamic:!0,encoded:u.length>0?te([S,f]):S}}if(a)return{dynamic:!0,encoded:f}}return{dynamic:!1,encoded:te(u.map(({encoded:f})=>f))}}function ko(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 Mo(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 Ro(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 le({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 Bo(e){let t=Ve(e),r=Math.ceil(O(t)/32),n=[];for(let a=0;a<r;a++)n.push(q(br(t,a*32,(a+1)*32),{dir:"right"}));return{dynamic:!0,encoded:te([q(K(O(t),{size:32})),...n])}}function Ho(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,S=kt({param:u,value:e[f]});n.push(S),S.dynamic&&(r=!0)}return{dynamic:r,encoded:r?Mt(n):te(n.map(({encoded:a})=>a))}}function Lo(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var vr=M(()=>{"use strict";qt();Tt();se();Ne();At();Ct();Te();be();Tr();Ee();Er()});function Rt(e,t){if(!ke(e,{strict:!1}))throw new pe({address:e});if(!ke(t,{strict:!1}))throw new pe({address:t});return e.toLowerCase()===t.toLowerCase()}var Ar=M(()=>{"use strict";Tt();At()});var Jo={};no(Jo,{ClientNotFound:()=>me,Deferred:()=>W,FrakContextManager:()=>re,FrakRpcError:()=>B,PressInteractionEncoder:()=>Jr,PurchaseInteractionEncoder:()=>Gr,ReferralInteractionEncoder:()=>rt,RetailInteractionEncoder:()=>Yr,RpcErrorCodes:()=>H,WebShopInteractionEncoder:()=>Xr,baseIframeProps:()=>ae,compressJson:()=>xe,createIFrameFrakClient:()=>ie,createIFrameNexusClient:()=>Ko,createIframe:()=>ge,decompressDataAndCheckHash:()=>ne,decompressJson:()=>ye,displayModal:()=>J,getProductInformation:()=>jr,hashAndCompressData:()=>oe,interactionTypes:()=>_,modalBuilder:()=>Kr,openSso:()=>Nr,processReferral:()=>ot,productTypes:()=>$,productTypesMask:()=>$r,referralInteraction:()=>Zr,sendInteraction:()=>et,sendTransaction:()=>qr,setupClient:()=>Ht,siweAuthenticate:()=>Wr,trackPurchaseStatus:()=>Vr,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)}},me=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 xe(r),a=(0,pt.sha256)(n);return{compressed:n,compressedHash:a}}async function xe(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 ye(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 ye(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 ue="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 ge({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(ue,n.data.backup):localStorage.removeItem(ue);break;case"remove-backup":localStorage.removeItem(ue);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 ie({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})},S=io(a,n),p=async()=>{S(),r.destroy(),a.cleanup(),t.remove()},E=so({config:e,messageHandler:a,lifecycleManager:n});return{config:e,waitForConnection:n.isConnected,waitForSetup:E,request:u,listenerRequest:f,destroy:p}}function io(e,t){let a,u,f=()=>e.sendEvent({iframeLifecycle:"heartbeat"});async function S(){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 S(),p}async function so({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(ue);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();It();Te();var Bt="fCtx";function zo(e){return btoa(Array.from(e,t=>String.fromCharCode(t)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Do(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 zo(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function kr(e){if(!(!e||e.length===0))try{let t=Do(e);return{r:Fe(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function Mr({url:e}){if(!e)return null;let r=new URL(e).searchParams.get(Bt);return r?kr(r):null}function Rr({url:e,context:t}){if(!e)return null;let r=Mr({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 Uo({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:kr,parse:Mr,update:Rr,remove:Br,replaceUrl:Uo};async function Ht({config:e}){let t=await ge({config:e});if(!t){console.error("Failed to create iframe");return}let r=ie({config:e,iframe:t});if(await r.waitForSetup,!await r.waitForConnection){console.error("Failed to connect to client");return}return r}function Hr(e){document.readyState==="complete"||document.readyState==="interactive"?setTimeout(e,1):document.addEventListener?document.addEventListener("DOMContentLoaded",e):document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&e()})}async function Lr(e,t){return document.getElementById(e)?Promise.resolve(!0):new Promise((r,n)=>{let a=document.createElement("script");a.id=e,a.src=t,a.async=!0,a.onload=()=>r(!0),a.onerror=()=>n(new Error(`Script load error for ${t}`)),document.head.appendChild(a)})}function zr(){$o(),Oo()}function $o(){let e="https://gapianne.com/cdn/shop/files/logo-gapianne_7a65f4c4-54e8-4831-afa2-0849e4c5f8de.png";window.FrakSetup.config={walletUrl:"https://wallet.frak.id",metadata:{name:"Gapianne"},domain:window.location.host},window.FrakSetup.modalConfig={login:{allowSso:!0,ssoMetadata:{logoUrl:e,homepageLink:"https://gapianne.com/"}},metadata:{header:{icon:e},isDismissible:!0,lang:"fr"}},window.FrakSetup.modalShareConfig={popupTitle:"Pr\xEAt(e) \xE0 r\xE9v\xE9ler un secret bien-\xEAtre ?",text:"D\xE9couvre ce produit chez Gapianne",link:window.location.href}}function Oo(){let e=document.querySelectorAll("#nexus-share-button > button");for(let t of Array.from(e)){let r=document.createElement("frak-button-share");r.setAttribute("text","PARTAGE ET GAGNE"),r.setAttribute("classname","button w-full"),t.replaceWith(r)}}function Dr(){_o(),No()}function _o(){window.FrakSetup.config={walletUrl:"https://wallet.frak.id",metadata:{name:"Moov360"},domain:window.location.host},window.FrakSetup.modalConfig={login:{allowSso:!0,ssoMetadata:{logoUrl:"https://moov360.com/wp-content/uploads/2022/07/MOOV360noir-1.png",homepageLink:"https://moov360.com/"}},metadata:{header:{icon:"https://moov360.com/wp-content/uploads/2022/07/MOOV360noir-1.png"},lang:"fr"}},window.FrakSetup.modalShareConfig={popupTitle:"Partage ce produit avec tes amis",text:"D\xE9couvre ce produit chez Moov360!",link:window.location.href}}function No(){let e=document.querySelectorAll("a.frak-link");for(let t of Array.from(e)){let r=document.createElement("frak-button-share");r.setAttribute("text","Partage et gagne {REWARD}!"),r.setAttribute("no-reward-text","Partage et gagne"),r.setAttribute("use-reward","true"),r.setAttribute("classname","button"),r.style.display="block",r.style.marginTop="20px",t.replaceWith(r)}}var jo={"moov360.com":Dr,"gapianne.com":zr};function Ur(){let e=jo[window.location.host];e&&(e(),Lr("frak-components","https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/cdn/components.js"))}var $={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},$r=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=>(Or(a.interactionToken),a));let r=new W,n=!1;return e.listenerRequest({method:"frak_listenToWalletStatus"},a=>{t(a),Or(a.interactionToken),n||(r.resolve(a),n=!0)}).then(()=>r.promise)}function Or(e){typeof window>"u"||(e?window.sessionStorage.setItem("frak-wallet-interaction-token",e):window.sessionStorage.removeItem("frak.interaction-token"))}function _r({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??_r(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 Nr(e,t){let{metadata:r}=e.config;await e.request({method:"frak_sso",params:[t,r.name,r.css]})}async function jr(e){return await e.request({method:"frak_getProductInformation"})}async function Vr(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 Wr(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 qr(e,{tx:t,metadata:r}){return(await J(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function Kr(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,S){return tt(e,{...t,steps:{...t.steps,final:{...S,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 Gr={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 Xr={open(){return{handlerTypeDenominator:U($.webshop),interactionData:_.webshop.open}}};var Yr={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 S(){if(!f)return f=!0,Wo(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 Vo({initialWalletStatus:t,getFreshWalletStatus:S,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}),qo(E)}}async function Vo({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 Wo(e,{modalConfig:t,walletStatus:r}){return r?.interactionSession?r.wallet??void 0:t?(await J(e,t))?.login?.wallet??void 0:void 0}function qo(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 Zr(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})}}var Ko=ie;Hr(()=>Ur());return ao(Jo);})();
7
7
  /*! Bundled license information:
8
8
 
9
9
  js-sha256/src/sha256.js:
package/package.json CHANGED
@@ -11,11 +11,11 @@
11
11
  "url": "https://twitter.com/QNivelais"
12
12
  }
13
13
  ],
14
- "version": "0.0.25",
15
- "description": "Frak Wallet client SDK, helping any person to interact with the Frak wallet, and require the unlock of a premium article within the Frak ecosystem.",
14
+ "version": "0.0.27",
15
+ "description": "Legacy SDK, only used here to provide nice wrapper and redirection for older implementation, to not break anything and keep them updated with latest security updates.",
16
16
  "repository": {
17
17
  "url": "https://github.com/frak-id/wallet",
18
- "directory": "packages/sdk"
18
+ "directory": "sdk/legacy"
19
19
  },
20
20
  "homepage": "https://docs.frak.id/wallet-sdk/overview",
21
21
  "keywords": [
@@ -28,76 +28,23 @@
28
28
  "license": "GNU GPL 3.0",
29
29
  "sideEffects": false,
30
30
  "private": false,
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
31
34
  "type": "module",
32
35
  "files": [
33
36
  "/dist"
34
37
  ],
35
- "exports": {
36
- "./core": {
37
- "import": {
38
- "types": "./dist/core/index.d.ts",
39
- "default": "./dist/core/index.js"
40
- },
41
- "require": {
42
- "types": "./dist/core/index.d.cts",
43
- "default": "./dist/core/index.cjs"
44
- }
45
- },
46
- "./actions": {
47
- "import": {
48
- "types": "./dist/core/actions/index.d.ts",
49
- "default": "./dist/core/actions/index.js"
50
- },
51
- "require": {
52
- "types": "./dist/core/actions/index.d.cts",
53
- "default": "./dist/core/actions/index.cjs"
54
- }
55
- },
56
- "./interactions": {
57
- "import": {
58
- "types": "./dist/core/interactions/index.d.ts",
59
- "default": "./dist/core/interactions/index.js"
60
- },
61
- "require": {
62
- "types": "./dist/core/interactions/index.d.cts",
63
- "default": "./dist/core/interactions/index.cjs"
64
- }
65
- },
66
- "./react": {
67
- "import": {
68
- "types": "./dist/react/index.d.ts",
69
- "default": "./dist/react/index.js"
70
- },
71
- "require": {
72
- "types": "./dist/react/index.d.cts",
73
- "default": "./dist/react/index.cjs"
74
- }
75
- }
76
- },
38
+ "main": "./dist/bundle/bundle.js",
39
+ "browser": "./dist/bundle/bundle.js",
77
40
  "scripts": {
78
41
  "lint": "biome lint .",
79
42
  "format:check": "biome check .",
80
43
  "format": "biome check --write .",
81
44
  "clean": "rimraf dist",
82
- "build": "tsup && bun run check-exports",
45
+ "build": "tsup",
83
46
  "build:watch": "tsup --watch",
84
- "check-exports": "attw --pack --profile node16 ."
85
- },
86
- "peerDependencies": {
87
- "viem": "^2.x",
88
- "@tanstack/react-query": ">=5.0.0",
89
- "react": ">=18"
90
- },
91
- "dependencies": {
92
- "async-lz-string": "^1.1.0",
93
- "js-sha256": "^0.11.0"
94
- },
95
- "devDependencies": {
96
- "@arethetypeswrong/cli": "^0.17.1",
97
- "@tanstack/react-query": ">=5.62.3",
98
- "@types/node": "^22",
99
- "@types/react": ">=18",
100
- "tsup": "^8.3.5",
101
- "typescript": "^5"
47
+ "prepublish": "bun run lint && bun run build",
48
+ "publish": "bun publish"
102
49
  }
103
50
  }