@dcl/auth-site 4.21.1-30219248876.commit-24ddf14 → 4.21.1-30289583460.commit-46bdbdf

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 (130) hide show
  1. package/assets/{ConstantsUtil-CzNPnfvC.js → ConstantsUtil-Cw4CyveW.js} +1 -1
  2. package/assets/{ContentfulRichText-DxQuR5CI.js → ContentfulRichText-BT96-A7w.js} +1 -1
  3. package/assets/{ExchangeController-XAm9XNH_.js → ExchangeController-BIE70uXJ.js} +1 -1
  4. package/assets/{HelpersUtil-D0bqaP2j.js → HelpersUtil-COH6r2kA.js} +1 -1
  5. package/assets/LoginPage-fSUgfU4P.js +1 -0
  6. package/assets/{NetworkUtil-BHkCxx2E.js → NetworkUtil-BGKHKoaf.js} +1 -1
  7. package/assets/{SwapController-CheFvyGv.js → SwapController-CYoV1KaM.js} +1 -1
  8. package/assets/{W3MFrameProviderSingleton-D-BUT5wM.js → W3MFrameProviderSingleton-BKmP_oxD.js} +3 -3
  9. package/assets/{biconomy-D-DxWmVr.js → biconomy-C7o8zrOF.js} +1 -1
  10. package/assets/{browser-CP1onCY9.js → browser-jyTXFcNa.js} +1 -1
  11. package/assets/browser-ponyfill-DoK0rGNS.js +1 -0
  12. package/assets/{ccip-BZDadTlV.js → ccip-0sHJmZED.js} +1 -1
  13. package/assets/{ccip-3zUxK3Gw.js → ccip-_D3P6GZf.js} +1 -1
  14. package/assets/{chains-BDkVDPy_.js → chains-DPTnBL64.js} +1 -1
  15. package/assets/{common-BFmWd8xi.js → common-CHSeSCWT.js} +1 -1
  16. package/assets/controller-C64KTqP4.js +2 -0
  17. package/assets/{data-capture-BMRON7UD.js → data-capture-Cx4b9vYS.js} +1 -1
  18. package/assets/{email-CErecXQ9.js → email-BQdM1ASh.js} +1 -1
  19. package/assets/{embedded-wallet-EUgEHDZ2.js → embedded-wallet-CXUgkaij.js} +1 -1
  20. package/assets/{engine-BEtPuqW4.js → engine-DN05o7om.js} +1 -1
  21. package/assets/{estimate-l1-fee-BS9VOVeT.js → estimate-l1-fee--u86zfdZ.js} +1 -1
  22. package/assets/{ethereum-DX4J06qQ.js → ethereum-CJbf5HCu.js} +1 -1
  23. package/assets/extractIPFS-DJBAzpfR.js +1 -0
  24. package/assets/{features-CvgY07hD.js → features-BaQq55bG.js} +1 -1
  25. package/assets/{fetchTokenMetadata-C1hwuwwE.js → fetchTokenMetadata-C1ngO7HU.js} +1 -1
  26. package/assets/{fortmatic-BMWX8r_B.js → fortmatic-CM-36WpK.js} +1 -1
  27. package/assets/get-ecosystem-wallet-info-D3mZ828S.js +1 -0
  28. package/assets/getBalance-DMdDUfLy.js +1 -0
  29. package/assets/{getInstalledModules-BvcUgaUG.js → getInstalledModules-DOdq5s84.js} +1 -1
  30. package/assets/{getNFT-GgKNl-j7.js → getNFT-B8132wTr.js} +2 -2
  31. package/assets/{getNFT-CviSgHxJ.js → getNFT-Df4p3NnO.js} +1 -1
  32. package/assets/{if-defined-CZ-Ni5r4.js → if-defined-Bl8a4ab-.js} +1 -1
  33. package/assets/in-app-DOg1gcN6.js +2 -0
  34. package/assets/{in-app-wallet-calls-Dp8LchpI.js → in-app-wallet-calls-C3XXM2uK.js} +1 -1
  35. package/assets/{index-DO9RwAeE.js → index--khZ3g0E.js} +2 -2
  36. package/assets/{index-C9O95X47.js → index-456fp1SV.js} +1 -1
  37. package/assets/{index-B5uah2Mi.js → index-5JpvePdb.js} +1 -1
  38. package/assets/{index-BU_jFUvT.js → index-B1wz7Owl.js} +1 -1
  39. package/assets/{index-DxZ3L6Uq.js → index-BCq7sn5F.js} +1 -1
  40. package/assets/{index-DMboQYAs.js → index-BKdNzTPl.js} +3 -3
  41. package/assets/{index-CV1wSfjU.js → index-BMLKyv2l.js} +4 -4
  42. package/assets/{index-BbxpfO0Z.js → index-BX3tZejP.js} +1 -1
  43. package/assets/{index-DL7944aX.js → index-BazvSf0U.js} +1 -1
  44. package/assets/{index-DeNl37wK.js → index-Bc52X0iQ.js} +1 -1
  45. package/assets/index-Bk62IJ7q.js +2 -0
  46. package/assets/{index-CNawyI5m.js → index-BtsxTU_X.js} +1 -1
  47. package/assets/{index-LnZNillc.js → index-Bx5a0Vg2.js} +1 -1
  48. package/assets/{index-VXCQQUMO.js → index-C8c8VNHR.js} +1 -1
  49. package/assets/{index-DgsJmxR8.js → index-CB0KMBUn.js} +1 -1
  50. package/assets/{index-B0epNfh3.js → index-CBS6SUOD.js} +1 -1
  51. package/assets/{index-C-CaajUq.js → index-CMn1rqzs.js} +1 -1
  52. package/assets/{index-4eFtRvf8.js → index-CPSrsrPD.js} +1 -1
  53. package/assets/{index-_W3JLSKP.js → index-CT312b_h.js} +1 -1
  54. package/assets/{index-Bg2S4rMm.js → index-CTYL6USa.js} +1 -1
  55. package/assets/{index-CkUVgkd6.js → index-CZmexbhB.js} +1 -1
  56. package/assets/{index-D5UJ7h1L.js → index-CfMamdHz.js} +1 -1
  57. package/assets/{index-BA9mBJE2.js → index-CjOKquSH.js} +1 -1
  58. package/assets/{index-CorIB2CW.js → index-Cuhzd-33.js} +1 -1
  59. package/assets/{index-WlYrqZYZ.css → index-CujiQKjN.css} +1 -1
  60. package/assets/{index-FFN3doyb.js → index-CwCHLbKJ.js} +1 -1
  61. package/assets/{index-Zq07deju.js → index-D2phLp5f.js} +1 -1
  62. package/assets/index-D3gAQcpU.js +2 -0
  63. package/assets/{index-CBTkcQS7.js → index-D3ndDNzn.js} +1 -1
  64. package/assets/index-DAclPpwc.js +4 -0
  65. package/assets/{index-BXti1mxp.js → index-DAoXeY-7.js} +1 -1
  66. package/assets/{index-Dk68gptr.js → index-DDa27cxc.js} +1 -1
  67. package/assets/{index-3ABGPDRw.js → index-DK67hOZb.js} +1 -1
  68. package/assets/{index-DviYNxW1.js → index-DKNEknrt.js} +1 -1
  69. package/assets/{index-BKzEIHtm.js → index-DLDBtSCZ.js} +1 -1
  70. package/assets/index-DPWHpwh1.js +176 -0
  71. package/assets/{index-BCzsHMax.js → index-DYaEHsOY.js} +1 -1
  72. package/assets/{index-DfIoL0Qo.js → index-Dhjx38e5.js} +1 -1
  73. package/assets/{index-QoQJjmOl.js → index-Di_Hl_iK.js} +1 -1
  74. package/assets/{index-URGlrGXk.js → index-Dk7lZXfn.js} +1 -1
  75. package/assets/{index-m1WRN5a_.js → index-DkXO_kZj.js} +1 -1
  76. package/assets/{index-D60uOnX4.js → index-Z08B4dd3.js} +1 -1
  77. package/assets/{index-bLGiRbxa.js → index-ZGp_PUF2.js} +1 -1
  78. package/assets/{index-BqPg25rh.js → index-aZ_z0i3j.js} +1 -1
  79. package/assets/{index-Cj2uW1Lf.js → index-bW418N1D.js} +1 -1
  80. package/assets/{index-CmKGqlU_.js → index-n7PJcE82.js} +1 -1
  81. package/assets/{index-DuFpmHvV.js → index-r-swI_-s.js} +1 -1
  82. package/assets/{index-g7QpkACJ.js → index-tF1SLBXL.js} +1 -1
  83. package/assets/{index-CsUYGy8g.js → index-wL64_peq.js} +1 -1
  84. package/assets/{index.es-BKmMwunl.js → index.es-BOYbQise.js} +1 -1
  85. package/assets/index.es-DRRWBSJv.js +1 -0
  86. package/assets/linkAccount-C5bSjc1T.js +1 -0
  87. package/assets/{native-BiSSc15w.js → native-CV5tv0TG.js} +1 -1
  88. package/assets/{networks-BcJLZQ9w.js → networks-C86eT1TG.js} +3 -3
  89. package/assets/{onramp-D-3HuYvZ.js → onramp-BOODe8UW.js} +1 -1
  90. package/assets/{openzeppelin-Duyo-wSY.js → openzeppelin-D68EAkgg.js} +1 -1
  91. package/assets/{ownerOf-CIsWRTsZ.js → ownerOf-CursHafI.js} +1 -1
  92. package/assets/{parseNft-CDRvc17C.js → parseNft-n7ZvU0Fd.js} +2 -2
  93. package/assets/{pay-with-exchange-dKeF-eq1.js → pay-with-exchange-WgJKv9uo.js} +1 -1
  94. package/assets/{qr-overlay-B3X464To.js → qr-overlay-D8U0fVP-.js} +3 -3
  95. package/assets/{receive-CwRP6RHs.js → receive-BqvjZCLR.js} +1 -1
  96. package/assets/{ref-Am-Ii6qr.js → ref-kgQxGa5I.js} +1 -1
  97. package/assets/{resolveImplementation-D_uV1kN9.js → resolveImplementation-B4GM10am.js} +1 -1
  98. package/assets/secp256k1-CpwTLmAw.js +1 -0
  99. package/assets/{send-eV0xu-rz.js → send-BL378Uzh.js} +1 -1
  100. package/assets/{send-eip712-transaction-v5rl5bS0.js → send-eip712-transaction-u41VUUSa.js} +1 -1
  101. package/assets/{send-gasless-transaction-BSWmg7Bc.js → send-gasless-transaction-Bv-SeN6V.js} +2 -2
  102. package/assets/session-proposal-C8n_HnVT.js +1 -0
  103. package/assets/session-request-CObMtvdb.js +2 -0
  104. package/assets/{socials-EOHl4oNK.js → socials-D4dvlXCA.js} +1 -1
  105. package/assets/{swaps-DC37kX5G.js → swaps-V4FJcglk.js} +1 -1
  106. package/assets/{thirdweb-D3S3QNoz.js → thirdweb-129NE2Ul.js} +6 -6
  107. package/assets/{totalSupply-ChvRCwfw.js → totalSupply-DO_2zgMa.js} +1 -1
  108. package/assets/{transactions-BuJcvOCy.js → transactions-Bmdan2s3.js} +1 -1
  109. package/assets/types-DC0Zmj1B.js +1 -0
  110. package/assets/{ui-am1Nr89z.js → ui-C5Ow-sF2.js} +24 -24
  111. package/assets/{vendor-fOKayE99.js → vendor-DTjic7dc.js} +1 -1
  112. package/assets/{w3m-modal-BOwoCvC2.js → w3m-modal-CfVCaJKp.js} +1 -1
  113. package/assets/wallets-B4VDiGHH.js +12 -0
  114. package/assets/{web-connector-R4G4pIAb.js → web-connector-DNU9LISy.js} +3 -3
  115. package/index.html +5 -5
  116. package/package.json +3 -3
  117. package/assets/LoginPage-Dmt0aaJN.js +0 -1
  118. package/assets/browser-ponyfill-BJn8N62z.js +0 -1
  119. package/assets/controller-CboGnADz.js +0 -2
  120. package/assets/extractIPFS-DMc3oWj5.js +0 -1
  121. package/assets/get-ecosystem-wallet-info-D24KUwyy.js +0 -1
  122. package/assets/getBalance-BP5JFX6y.js +0 -1
  123. package/assets/index-C1ZdbWKv.js +0 -2
  124. package/assets/index-CUHQgubq.js +0 -284
  125. package/assets/index-Di5IKGPW.js +0 -2
  126. package/assets/index.es-C_JmLWxx.js +0 -1
  127. package/assets/secp256k1-1LYC9nsy.js +0 -1
  128. package/assets/session-proposal-D0XKdHBT.js +0 -1
  129. package/assets/session-request-h64Fr79p.js +0 -2
  130. package/assets/wallets-BQ-Ff9kc.js +0 -14
@@ -1,9 +1,9 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/in-app-wallet-calls-Dp8LchpI.js","assets/thirdweb-D3S3QNoz.js","assets/passkeys-C1wTOzLk.js","assets/uint8-array-DZKEMhA1.js"])))=>i.map(i=>d[i]);
2
- import{ab as p,as as g,s as w,o as q,b as I,f as y,_ as b,at as Q,l as P,P as D,t as F,N as A,F as H,au as k,av as O,aw as J}from"./thirdweb-D3S3QNoz.js";import{a0 as Y,p as U,a1 as N,a2 as B,a3 as Z,a4 as K,a5 as X,a6 as ee,a7 as te}from"./wallets-BQ-Ff9kc.js";import"./store-CraP4F4Y.js";import"./ui-am1Nr89z.js";import"./vendor-fOKayE99.js";import"./index-CUHQgubq.js";import"./index-C-CaajUq.js";import"./index-BbxpfO0Z.js";import"./index-nibyPLVP.js";import"./ethereum-DX4J06qQ.js";const T=new Map,ie={getItem:async i=>T.get(i)??null,removeItem:async i=>{T.delete(i)},setItem:async(i,e)=>{T.set(i,e)}};async function W({authToken:i,client:e,ecosystem:t}){const r=await p(e,t)(`${g("inAppWallet")}/api/2024-05-05/accounts`,{headers:{Authorization:`Bearer embedded-wallet-token:${i}`,"Content-Type":"application/json"},method:"GET"});if(!r.ok){const l=await r.text().catch(()=>"Unknown error");throw new Error(`Failed to get user info: ${l}`)}return await r.json()}const ae=g("inAppWallet"),ne=`${ae}/`,R=`${ne}api/2023-10-20`,re=`${R}/embedded-wallet/validate-custom-jwt`,se=`${R}/embedded-wallet/validate-custom-auth-endpoint`,M=(i,e)=>e instanceof Error?`${i}: ${e.message}`:`${i}: ${w(e)}`;async function oe(i){const t=await p(i.client,i.ecosystem)(se,{body:w({developerClientId:i.client.clientId,payload:i.payload}),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok){const a=await t.json();throw new Error(`Custom auth endpoint authentication error: ${a.message}`)}try{const{verifiedToken:a}=await t.json();return{storedToken:a}}catch(a){throw new Error(M("Malformed response from post auth_endpoint authentication",a))}}const z=i=>{if(!Y.includes(i))throw new Error(`Unknown auth option ${i}`);switch(i){case"wallet":return"siwe";default:return i}},v=({authOption:i,client:e,ecosystem:t,mode:a="popup",redirectUrl:r,authFlow:l})=>{if(a==="popup"&&r)throw new Error("Redirect URL is not supported for popup mode");if(a==="window"&&!r)throw new Error("Redirect URL is required for window mode");const c=z(i);let n=`${g("inAppWallet")}/api/2024-05-05/login/${c}?clientId=${e.clientId}`;if(t!=null&&t.partnerId?n=`${n}&ecosystemId=${t.id}&ecosystemPartnerId=${t.partnerId}`:t&&(n=`${n}&ecosystemId=${t.id}`),a!=="popup"){const o=new URL(r||window.location.href);o.searchParams.set("walletId",(t==null?void 0:t.id)||"inApp"),o.searchParams.set("authProvider",i),l&&o.searchParams.set("authFlow",l),n=`${n}&redirectUrl=${encodeURIComponent(o.toString())}`}return n},S=({authOption:i,client:e,ecosystem:t})=>{const a=z(i);let r=`${g("inAppWallet")}/api/2024-05-05/login/${a}/callback?clientId=${e.clientId}`;return t!=null&&t.partnerId?r=`${r}&ecosystemId=${t.id}&ecosystemPartnerId=${t.partnerId}`:t&&(r=`${r}&ecosystemId=${t.id}`),r};async function ce(i){const e=p(i.client,i.ecosystem),t=v({authOption:"backend",client:i.client,ecosystem:i.ecosystem}),a=await e(`${t}`,{body:w({walletSecret:i.walletSecret}),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok){const r=await a.text();throw new Error(`Failed to generate backend account: ${r}`)}return await a.json()}async function le(i){let e=await i.storage.getGuestSessionId();e||(e=q(32),i.storage.saveGuestSessionId(e));const t=p(i.client,i.ecosystem),a=S({authOption:"guest",client:i.client,ecosystem:i.ecosystem}),r=await t(`${a}`,{body:w({sessionId:e}),headers:{"Content-Type":"application/json"},method:"POST"});if(!r.ok){const l=await r.text();throw new Error(`Failed to generate guest account: ${r.status} ${r.statusText} ${l}`)}return await r.json()}async function de(i){const t=await p(i.client,i.ecosystem)(re,{body:w({developerClientId:i.client.clientId,jwt:i.jwt}),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok){const a=await t.json();throw new Error(`JWT authentication error: ${a.message}`)}try{const{verifiedToken:a}=await t.json();return{storedToken:a}}catch(a){throw new Error(M("Malformed response from post jwt authentication",a))}}function x(){return`${g("inAppWallet")}/api/2024-05-05/login/passkey/callback`}function G(i,e){return`${g("inAppWallet")}/api/2024-05-05/login/passkey?type=${i}${e?`&username=${e}`:""}`}async function ue(i){var d,u,h;if(!i.passkeyClient.isAvailable())throw new Error("Passkeys are not available on this device");const e=p(i.client,i.ecosystem),t=i.username??we(i.ecosystem),r=await(await e(G("sign-up",t))).json();if(!r.challenge)throw new Error("No challenge received");const l=r.challenge,c=await i.passkeyClient.register({challenge:l,name:t,rp:i.rp}),n={};(d=i.ecosystem)!=null&&d.partnerId&&(n["x-ecosystem-partner-id"]=i.ecosystem.partnerId),(u=i.ecosystem)!=null&&u.id&&(n["x-ecosystem-id"]=i.ecosystem.id);const s=await(await e(x(),{body:w({authenticatorData:c.authenticatorData,clientData:c.clientData,credential:{algorithm:c.credential.algorithm,publicKey:c.credential.publicKey},credentialId:c.credentialId,origin:c.origin,rpId:i.rp.id,serverVerificationId:r.serverVerificationId,type:"sign-up",username:t}),headers:{"Content-Type":"application/json",...n},method:"POST"})).json();if(!s||!s.storedToken)throw new Error(`Error verifying passkey: ${s.message??"unknown error"}`);return await((h=i.storage)==null?void 0:h.savePasskeyCredentialId(c.credentialId)),s}async function he(i){var s,d,u,h;if(!i.passkeyClient.isAvailable())throw new Error("Passkeys are not available on this device");const e=p(i.client,i.ecosystem),[t,a]=await Promise.all([e(G("sign-in")).then(f=>f.json()),(s=i.storage)==null?void 0:s.getPasskeyCredentialId()]);if(!t.challenge)throw new Error("No challenge received");const r=t.challenge,l=await i.passkeyClient.authenticate({challenge:r,credentialId:a??void 0,rp:i.rp}),c={};(d=i.ecosystem)!=null&&d.partnerId&&(c["x-ecosystem-partner-id"]=i.ecosystem.partnerId),(u=i.ecosystem)!=null&&u.id&&(c["x-ecosystem-id"]=i.ecosystem.id);const o=await(await e(x(),{body:w({authenticatorData:l.authenticatorData,clientData:l.clientData,credentialId:l.credentialId,origin:l.origin,rpId:i.rp.id,serverVerificationId:t.serverVerificationId,signature:l.signature,type:"sign-in"}),headers:{"Content-Type":"application/json",...c},method:"POST"})).json();if(!o||!o.storedToken)throw new Error(`Error verifying passkey: ${o.message??"unknown error"}`);return await((h=i.storage)==null?void 0:h.savePasskeyCredentialId(l.credentialId)),o}function we(i){return`${(i==null?void 0:i.id)??"wallet"}-${new Date().toISOString()}`}function pe(i){let a=[`${i.domain} wants you to sign in with your Ethereum account:`,i.address].join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/in-app-wallet-calls-C3XXM2uK.js","assets/thirdweb-129NE2Ul.js","assets/passkeys-C1wTOzLk.js","assets/uint8-array-DZKEMhA1.js"])))=>i.map(i=>d[i]);
2
+ import{a0 as p,$ as g,s as w,o as q,b as I,f as y,_ as b,az as Q,l as P,P as D,t as F,N as A,F as H,aA as k,aB as O,aC as J}from"./thirdweb-129NE2Ul.js";import{p as U,C as N,w as B,I as Y,l as Z,u as K,g as X}from"./linkAccount-C5bSjc1T.js";import{a as ee,s as te}from"./types-DC0Zmj1B.js";const T=new Map,ie={getItem:async i=>T.get(i)??null,removeItem:async i=>{T.delete(i)},setItem:async(i,e)=>{T.set(i,e)}};async function W({authToken:i,client:e,ecosystem:t}){const r=await p(e,t)(`${g("inAppWallet")}/api/2024-05-05/accounts`,{headers:{Authorization:`Bearer embedded-wallet-token:${i}`,"Content-Type":"application/json"},method:"GET"});if(!r.ok){const l=await r.text().catch(()=>"Unknown error");throw new Error(`Failed to get user info: ${l}`)}return await r.json()}const ae=g("inAppWallet"),ne=`${ae}/`,R=`${ne}api/2023-10-20`,re=`${R}/embedded-wallet/validate-custom-jwt`,se=`${R}/embedded-wallet/validate-custom-auth-endpoint`,M=(i,e)=>e instanceof Error?`${i}: ${e.message}`:`${i}: ${w(e)}`;async function oe(i){const t=await p(i.client,i.ecosystem)(se,{body:w({developerClientId:i.client.clientId,payload:i.payload}),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok){const a=await t.json();throw new Error(`Custom auth endpoint authentication error: ${a.message}`)}try{const{verifiedToken:a}=await t.json();return{storedToken:a}}catch(a){throw new Error(M("Malformed response from post auth_endpoint authentication",a))}}const z=i=>{if(!ee.includes(i))throw new Error(`Unknown auth option ${i}`);switch(i){case"wallet":return"siwe";default:return i}},v=({authOption:i,client:e,ecosystem:t,mode:a="popup",redirectUrl:r,authFlow:l})=>{if(a==="popup"&&r)throw new Error("Redirect URL is not supported for popup mode");if(a==="window"&&!r)throw new Error("Redirect URL is required for window mode");const c=z(i);let n=`${g("inAppWallet")}/api/2024-05-05/login/${c}?clientId=${e.clientId}`;if(t!=null&&t.partnerId?n=`${n}&ecosystemId=${t.id}&ecosystemPartnerId=${t.partnerId}`:t&&(n=`${n}&ecosystemId=${t.id}`),a!=="popup"){const o=new URL(r||window.location.href);o.searchParams.set("walletId",(t==null?void 0:t.id)||"inApp"),o.searchParams.set("authProvider",i),l&&o.searchParams.set("authFlow",l),n=`${n}&redirectUrl=${encodeURIComponent(o.toString())}`}return n},S=({authOption:i,client:e,ecosystem:t})=>{const a=z(i);let r=`${g("inAppWallet")}/api/2024-05-05/login/${a}/callback?clientId=${e.clientId}`;return t!=null&&t.partnerId?r=`${r}&ecosystemId=${t.id}&ecosystemPartnerId=${t.partnerId}`:t&&(r=`${r}&ecosystemId=${t.id}`),r};async function ce(i){const e=p(i.client,i.ecosystem),t=v({authOption:"backend",client:i.client,ecosystem:i.ecosystem}),a=await e(`${t}`,{body:w({walletSecret:i.walletSecret}),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok){const r=await a.text();throw new Error(`Failed to generate backend account: ${r}`)}return await a.json()}async function le(i){let e=await i.storage.getGuestSessionId();e||(e=q(32),i.storage.saveGuestSessionId(e));const t=p(i.client,i.ecosystem),a=S({authOption:"guest",client:i.client,ecosystem:i.ecosystem}),r=await t(`${a}`,{body:w({sessionId:e}),headers:{"Content-Type":"application/json"},method:"POST"});if(!r.ok){const l=await r.text();throw new Error(`Failed to generate guest account: ${r.status} ${r.statusText} ${l}`)}return await r.json()}async function de(i){const t=await p(i.client,i.ecosystem)(re,{body:w({developerClientId:i.client.clientId,jwt:i.jwt}),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok){const a=await t.json();throw new Error(`JWT authentication error: ${a.message}`)}try{const{verifiedToken:a}=await t.json();return{storedToken:a}}catch(a){throw new Error(M("Malformed response from post jwt authentication",a))}}function x(){return`${g("inAppWallet")}/api/2024-05-05/login/passkey/callback`}function G(i,e){return`${g("inAppWallet")}/api/2024-05-05/login/passkey?type=${i}${e?`&username=${e}`:""}`}async function ue(i){var d,u,h;if(!i.passkeyClient.isAvailable())throw new Error("Passkeys are not available on this device");const e=p(i.client,i.ecosystem),t=i.username??we(i.ecosystem),r=await(await e(G("sign-up",t))).json();if(!r.challenge)throw new Error("No challenge received");const l=r.challenge,c=await i.passkeyClient.register({challenge:l,name:t,rp:i.rp}),n={};(d=i.ecosystem)!=null&&d.partnerId&&(n["x-ecosystem-partner-id"]=i.ecosystem.partnerId),(u=i.ecosystem)!=null&&u.id&&(n["x-ecosystem-id"]=i.ecosystem.id);const s=await(await e(x(),{body:w({authenticatorData:c.authenticatorData,clientData:c.clientData,credential:{algorithm:c.credential.algorithm,publicKey:c.credential.publicKey},credentialId:c.credentialId,origin:c.origin,rpId:i.rp.id,serverVerificationId:r.serverVerificationId,type:"sign-up",username:t}),headers:{"Content-Type":"application/json",...n},method:"POST"})).json();if(!s||!s.storedToken)throw new Error(`Error verifying passkey: ${s.message??"unknown error"}`);return await((h=i.storage)==null?void 0:h.savePasskeyCredentialId(c.credentialId)),s}async function he(i){var s,d,u,h;if(!i.passkeyClient.isAvailable())throw new Error("Passkeys are not available on this device");const e=p(i.client,i.ecosystem),[t,a]=await Promise.all([e(G("sign-in")).then(f=>f.json()),(s=i.storage)==null?void 0:s.getPasskeyCredentialId()]);if(!t.challenge)throw new Error("No challenge received");const r=t.challenge,l=await i.passkeyClient.authenticate({challenge:r,credentialId:a??void 0,rp:i.rp}),c={};(d=i.ecosystem)!=null&&d.partnerId&&(c["x-ecosystem-partner-id"]=i.ecosystem.partnerId),(u=i.ecosystem)!=null&&u.id&&(c["x-ecosystem-id"]=i.ecosystem.id);const o=await(await e(x(),{body:w({authenticatorData:l.authenticatorData,clientData:l.clientData,credentialId:l.credentialId,origin:l.origin,rpId:i.rp.id,serverVerificationId:t.serverVerificationId,signature:l.signature,type:"sign-in"}),headers:{"Content-Type":"application/json",...c},method:"POST"})).json();if(!o||!o.storedToken)throw new Error(`Error verifying passkey: ${o.message??"unknown error"}`);return await((h=i.storage)==null?void 0:h.savePasskeyCredentialId(l.credentialId)),o}function we(i){return`${(i==null?void 0:i.id)??"wallet"}-${new Date().toISOString()}`}function pe(i){let a=[`${i.domain} wants you to sign in with your Ethereum account:`,i.address].join(`
3
3
  `);a=[a,i.statement].join(`
4
4
 
5
5
  `),i.statement&&(a+=`
6
6
  `);const r=[];if(i.uri){const d=`URI: ${i.uri}`;r.push(d)}const l=`Version: ${i.version}`;if(r.push(l),i.chain_id){const d=`Chain ID: ${i.chain_id}`||"1";r.push(d)}const c=`Nonce: ${i.nonce}`;r.push(c);const n=`Issued At: ${i.issued_at}`;r.push(n);const o=`Expiration Time: ${i.expiration_time}`;if(r.push(o),i.invalid_before){const d=`Not Before: ${i.invalid_before}`;r.push(d)}i.resources&&r.push(["Resources:",...i.resources.map(d=>`- ${d}`)].join(`
7
7
  `));const s=r.join(`
8
8
  `);return[a,s].join(`
9
- `)}async function ge(i){const{payload:e,account:t}=i,a=await t.signMessage({message:pe(e)});return{payload:e,signature:a}}const me=["xyz.abs"];async function fe(i){const{wallet:e,client:t,ecosystem:a,chain:r}=i,l=me.includes(e.id)?r||I(1):I(1),c=e.getAccount()||await e.connect({chain:l,client:t}),n=p(t,a),o=await(async()=>{const u=v({authOption:"wallet",client:i.client,ecosystem:i.ecosystem}),h=await n(`${u}&address=${c.address}&chainId=${l.id}`);if(!h.ok)throw new Error("Failed to generate SIWE login payload");return await h.json()})(),{signature:s}=await ge({account:c,payload:o});return await(async()=>{const u=S({authOption:"wallet",client:i.client,ecosystem:i.ecosystem}),h=await n(`${u}&signature=${s}&payload=${encodeURIComponent(o)}`,{body:w({payload:o,signature:s}),headers:{"Content-Type":"application/json"},method:"POST"});if(!h.ok)throw new Error("Failed to verify SIWE signature");return await h.json()})()}async function ye({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=p(i,r);if(!a)throw new Error("No auth token found when signing message");const c={address:e.address,chainId:e.chainId,nonce:Number(e.nonce)},n=await l(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-authorization`,{body:w(c),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!n.ok)throw new Error(`Failed to sign message - ${n.status} ${n.statusText}`);return await n.json()}async function be({client:i,payload:{message:e,isRaw:t,originalMessage:a,chainId:r},storage:l}){const c=await l.getAuthCookie(),n=l.ecosystem,o=p(i,n);if(!c)throw new Error("No auth token found when signing message");const s=await o(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-message`,{body:w({messagePayload:{chainId:r,isRaw:t,message:e,originalMessage:a}}),headers:{Authorization:`Bearer embedded-wallet-token:${c}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!s.ok)throw new Error(`Failed to sign message - ${s.status} ${s.statusText}`);return await s.json()}async function Ie({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=p(i,r);if(!a)throw new Error("No auth token found when signing transaction");const c=await l(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-transaction`,{body:w({transactionPayload:e}),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!c.ok)throw new Error(`Failed to sign transaction - ${c.status} ${c.statusText}`);return(await c.json()).signature}async function ve({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=p(i,r);if(!a)throw new Error("No auth token found when signing typed data");const c=await l(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-typed-data`,{body:w({...e}),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!c.ok)throw new Error(`Failed to sign typed data - ${c.status} ${c.statusText}`);return await c.json()}class ke{constructor({client:e,ecosystem:t,address:a,storage:r}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"address",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=t,this.address=a,this.localStorage=r}async postWalletSetUp(e){await this.localStorage.saveAuthCookie(e.storedToken.cookieString)}async getUserWalletStatus(){var l,c;const e=await this.localStorage.getAuthCookie();if(!e)return{status:"Logged Out"};const t=await W({authToken:e,client:this.client,ecosystem:this.ecosystem});if(!t)return{status:"Logged Out"};const a=t.wallets[0],r={email:(l=t.linkedAccounts.find(n=>n.details.email!==void 0))==null?void 0:l.details.email,phoneNumber:(c=t.linkedAccounts.find(n=>n.details.phone!==void 0))==null?void 0:c.details.phone,recoveryShareManagement:"ENCLAVE",userWalletId:t.id||""};return a?{account:await this.getAccount(),authDetails:r,status:"Logged In, Wallet Initialized",walletAddress:a.address}:{authDetails:r,status:"Logged In, Wallet Uninitialized"}}async getAccount(){const e=this.client,t=this.localStorage,a=this.address,r=this.ecosystem,l=async n=>{const o=P({chain:I(n.chainId),client:e}),s={chainId:A(n.chainId),data:n.data,gas:m(n.gas),nonce:m(n.nonce)||A(await b(async()=>{const{eth_getTransactionCount:d}=await import("./thirdweb-D3S3QNoz.js").then(u=>u.cl);return{eth_getTransactionCount:d}},[]).then(({eth_getTransactionCount:d})=>d(o,{address:y(this.address),blockTag:"pending"}))),to:n.to?y(n.to):void 0,value:m(n.value)};return n.authorizationList&&n.authorizationList.length>0?(s.type=4,s.authorizationList=n.authorizationList,s.maxFeePerGas=m(n.maxFeePerGas),s.maxPriorityFeePerGas=m(n.maxPriorityFeePerGas)):m(n.maxFeePerGas)?(s.maxFeePerGas=m(n.maxFeePerGas),s.maxPriorityFeePerGas=m(n.maxPriorityFeePerGas),s.type=2):(s.gasPrice=m(n.gasPrice),s.type=0),Ie({client:e,payload:s,storage:t})},c={address:y(a),async sendTransaction(n){const o=P({chain:I(n.chainId),client:e}),s=await l(n),d=await D(o,s);return F({chainId:n.chainId,client:e,contractAddress:n.to??void 0,ecosystem:r,gasPrice:n.gasPrice,transactionHash:d,walletAddress:a,walletType:"inApp"}),{transactionHash:d}},async signAuthorization(n){const o=await ye({client:e,payload:n,storage:t});return{address:y(o.address),chainId:Number.parseInt(o.chainId),nonce:BigInt(o.nonce),r:BigInt(o.r),s:BigInt(o.s),yParity:Number.parseInt(o.yParity)}},async signMessage({message:n,originalMessage:o,chainId:s}){const d=typeof n=="string"?{chainId:s,isRaw:!1,message:n,originalMessage:o}:{chainId:s,isRaw:!0,message:typeof n.raw=="string"?n.raw:Q(n.raw),originalMessage:o},{signature:u}=await be({client:e,payload:d,storage:t});return u},async signTransaction(n){if(!n.chainId)throw new Error("chainId required in tx to sign");return l({chainId:n.chainId,...n})},async signTypedData(n){const o=U(n),{signature:s}=await ve({client:e,payload:o,storage:t});return s},sendCalls:async n=>{const{inAppWalletSendCalls:o}=await b(async()=>{const{inAppWalletSendCalls:f}=await import("./in-app-wallet-calls-Dp8LchpI.js");return{inAppWalletSendCalls:f}},__vite__mapDeps([0,1])),s=n.calls[0];if(!s)throw new Error("No calls to send");const d=s.client,u=s.chain||n.chain,h=await o({account:c,calls:n.calls,chain:u});return{chain:u,client:d,id:h}},getCallsStatus:async n=>{const{inAppWalletGetCallsStatus:o}=await b(async()=>{const{inAppWalletGetCallsStatus:s}=await import("./in-app-wallet-calls-Dp8LchpI.js");return{inAppWalletGetCallsStatus:s}},__vite__mapDeps([0,1]));return o(n)},getCallsStatusRaw:async n=>{const{inAppWalletGetCallsStatusRaw:o}=await b(async()=>{const{inAppWalletGetCallsStatusRaw:s}=await import("./in-app-wallet-calls-Dp8LchpI.js");return{inAppWalletGetCallsStatusRaw:s}},__vite__mapDeps([0,1]));return o(n)},getCapabilities:async n=>({[n.chainId??1]:{atomic:{status:"unsupported"},paymasterService:{supported:!1}}})};return c}}function m(i){return i===void 0||H(i)?i:A(i)}const Te={backgroundColor:"transparent",border:"none",colorScheme:"light",display:"none",height:"100%",pointerEvents:"all",position:"fixed",right:"0px",top:"0px",width:"100%",zIndex:"2147483646"},L=new Map;class Le{constructor({link:e,baseUrl:t,iframeId:a,container:r,onIframeInitialize:l,localStorage:c,clientId:n,ecosystem:o}){if(Object.defineProperty(this,"iframe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"POLLING_INTERVAL_SECONDS",{enumerable:!0,configurable:!0,writable:!0,value:1.4}),Object.defineProperty(this,"iframeBaseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.localStorage=c,this.clientId=n,this.ecosystem=o,this.iframeBaseUrl=t,typeof document>"u")return;r=r??document.body;let s=document.getElementById(a);const d=new URL(e);if(!s||s.src!==d.href){s=document.createElement("iframe");const u={...Te};Object.assign(s.style,u),s.setAttribute("id",a),s.setAttribute("fetchpriority","high"),r.appendChild(s),s.src=d.href;const h=f=>{if(f.data.eventType==="ewsIframeLoaded"){if(window.removeEventListener("message",h),!s){console.warn("thirdweb iFrame not found");return}this.onIframeLoadHandler(s,l)()}};window.addEventListener("message",h)}this.iframe=s}async onIframeLoadedInitVariables(){var e,t;return{authCookie:await this.localStorage.getAuthCookie(),clientId:this.clientId,deviceShareStored:await this.localStorage.getDeviceShare(),ecosystemId:(e=this.ecosystem)==null?void 0:e.id,partnerId:(t=this.ecosystem)==null?void 0:t.partnerId,walletUserId:await this.localStorage.getWalletUserId()}}onIframeLoadHandler(e,t){return async()=>{var l;const a=new MessageChannel,r=new Promise((c,n)=>{a.port1.onmessage=o=>{const{data:s}=o;a.port1.close(),s.success||n(new Error(s.error)),L.set(e.src,!0),t&&t(),c(!0)}});(l=e==null?void 0:e.contentWindow)==null||l.postMessage({data:await this.onIframeLoadedInitVariables(),eventType:"initIframe"},this.iframeBaseUrl,[a.port2]),await r}}async call({procedureName:e,params:t,showIframe:a=!1}){var c;if(!this.iframe)throw new Error("Iframe not found. You are likely calling this from the backend where the DOM is not available.");for(;!L.get(this.iframe.src);)await k(this.POLLING_INTERVAL_SECONDS*1e3);a&&(this.iframe.style.display="block",await k(.005*1e3));const r=new MessageChannel,l=new Promise((n,o)=>{r.port1.onmessage=async s=>{const{data:d}=s;r.port1.close(),a&&(await k(.1*1e3),this.iframe&&(this.iframe.style.display="none")),d.success?n(d.data):o(new Error(d.error))}});return(c=this.iframe.contentWindow)==null||c.postMessage({data:{...t,...await this.onIframeLoadedInitVariables()},eventType:e},this.iframeBaseUrl,[r.port2]),l}destroy(){this.iframe&&L.delete(this.iframe.src)}}class Pe extends Le{constructor({clientId:e,baseUrl:t,ecosystem:a}){super({baseUrl:t,clientId:e,container:typeof document>"u"?void 0:document.body,ecosystem:a,iframeId:We+((a==null?void 0:a.id)||""),link:Ae({baseUrl:t,clientId:e,ecosystem:a,path:Z}).href,localStorage:new N({clientId:e,ecosystem:a,storage:B})}),this.clientId=e,this.ecosystem=a}}function Ae({clientId:i,baseUrl:e,path:t,ecosystem:a,queryParams:r}){var c;const l=new URL(`${t}`,e);if(r)for(const n of Object.keys(r))l.searchParams.set(n,((c=r[n])==null?void 0:c.toString())||"");return l.searchParams.set("clientId",i),(a==null?void 0:a.partnerId)!==void 0&&l.searchParams.set("partnerId",a.partnerId),(a==null?void 0:a.id)!==void 0&&l.searchParams.set("ecosystemId",a.id),l}const We="thirdweb-in-app-wallet-iframe";async function Se({client:i,ecosystem:e,authToken:t}){const r=await p(i,e)(`${g("inAppWallet")}/api/v1/enclave-wallet/generate`,{headers:{Authorization:`Bearer embedded-wallet-token:${t}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!r.ok)throw new Error(`Failed to generate wallet - ${r.status} ${r.statusText}`);const{wallet:l}=await r.json();return l}class Ee{constructor({baseUrl:e,querier:t,preLogin:a,postLogin:r,client:l,ecosystem:c}){Object.defineProperty(this,"LoginQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"preLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"postLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseUrl=e,this.LoginQuerier=t,this.preLogin=a,this.postLogin=r,this.client=l,this.ecosystem=c}async sendEmailLoginOtp({email:e}){return await this.LoginQuerier.call({params:{email:e},procedureName:"sendThirdwebEmailLoginOtp"})}async sendSmsLoginOtp({phoneNumber:e}){return await this.LoginQuerier.call({params:{phoneNumber:e},procedureName:"sendThirdwebSmsLoginOtp"})}}class Oe extends Ee{async authenticateWithModal(){return this.LoginQuerier.call({params:void 0,procedureName:"loginWithThirdwebModal",showIframe:!0})}async loginWithModal(){await this.preLogin();const e=await this.authenticateWithModal();return this.postLogin(e)}async authenticateWithIframe({email:e}){return this.LoginQuerier.call({params:{email:e},procedureName:"loginWithThirdwebModal",showIframe:!0})}async loginWithIframe({email:e}){await this.preLogin();const t=await this.authenticateWithIframe({email:e});return this.postLogin(t)}async authenticateWithCustomJwt({encryptionKey:e,jwt:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom jwt auth");return this.LoginQuerier.call({params:{encryptionKey:e,jwt:t},procedureName:"loginWithCustomJwt"})}async loginWithCustomJwt({encryptionKey:e,jwt:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom jwt auth");await this.preLogin();const a=await this.authenticateWithCustomJwt({encryptionKey:e,jwt:t});return this.postLogin(a)}async authenticateWithCustomAuthEndpoint({encryptionKey:e,payload:t}){return this.LoginQuerier.call({params:{encryptionKey:e,payload:t},procedureName:"loginWithCustomAuthEndpoint"})}async loginWithCustomAuthEndpoint({encryptionKey:e,payload:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom auth");await this.preLogin();const a=await this.authenticateWithCustomAuthEndpoint({encryptionKey:e,payload:t});return this.postLogin(a)}async authenticateWithEmailOtp({email:e,otp:t,recoveryCode:a}){return this.LoginQuerier.call({params:{email:e,otp:t,recoveryCode:a},procedureName:"verifyThirdwebEmailLoginOtp"})}async loginWithEmailOtp({email:e,otp:t,recoveryCode:a}){const r=await this.authenticateWithEmailOtp({email:e,otp:t,recoveryCode:a});return this.postLogin(r)}async authenticateWithSmsOtp({phoneNumber:e,otp:t,recoveryCode:a}){return this.LoginQuerier.call({params:{otp:t,phoneNumber:e,recoveryCode:a},procedureName:"verifyThirdwebSmsLoginOtp"})}async loginWithSmsOtp({phoneNumber:e,otp:t,recoveryCode:a}){const r=await this.authenticateWithSmsOtp({otp:t,phoneNumber:e,recoveryCode:a});return this.postLogin(r)}}class Ce{constructor({client:e,querier:t,onAuthSuccess:a,ecosystem:r,baseUrl:l,localStorage:c}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"AuthQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onAuthSuccess",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"BaseLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=r,this.AuthQuerier=t,this.localStorage=c,this.onAuthSuccess=a,this.BaseLogin=new Oe({baseUrl:l,client:e,ecosystem:r,postLogin:async n=>this.postLogin(n),preLogin:async()=>{await this.preLogin()},querier:t})}async preLogin(){await this.logout()}async postLogin({storedToken:e,walletDetails:t}){return e.shouldStoreCookieString&&await this.localStorage.saveAuthCookie(e.cookieString),await this.onAuthSuccess({storedToken:e,walletDetails:t})}async loginWithAuthToken(e,t){var l;e.storedToken.authProvider!=="Backend"&&await this.preLogin();const a=await W({authToken:e.storedToken.cookieString,client:this.client,ecosystem:this.ecosystem});if(!a)throw new Error("Cannot login, no user found for auth token");if(a.wallets.length>0&&((l=a.wallets[0])==null?void 0:l.type)==="enclave")return this.postLogin({storedToken:e.storedToken,walletDetails:{walletAddress:a.wallets[0].address}});if(a.wallets.length===0){const c=await Se({authToken:e.storedToken.cookieString,client:this.client,ecosystem:this.ecosystem});return this.postLogin({storedToken:e.storedToken,walletDetails:{walletAddress:c.address}})}const r=await this.AuthQuerier.call({params:{recoveryCode:t,storedToken:e.storedToken},procedureName:"loginWithStoredTokenDetails"});return this.postLogin(r)}async loginWithModal(){return this.BaseLogin.loginWithModal()}async authenticateWithModal(){return this.BaseLogin.authenticateWithModal()}async loginWithIframe(e){return this.BaseLogin.loginWithIframe(e)}async authenticateWithIframe(e){return this.BaseLogin.authenticateWithIframe(e)}async loginWithCustomJwt(e){return this.BaseLogin.loginWithCustomJwt(e)}async authenticateWithCustomJwt(e){return this.BaseLogin.authenticateWithCustomJwt(e)}async loginWithCustomAuthEndpoint(e){return this.BaseLogin.loginWithCustomAuthEndpoint(e)}async authenticateWithCustomAuthEndpoint(e){return this.BaseLogin.authenticateWithCustomAuthEndpoint(e)}async sendEmailLoginOtp({email:e}){return this.BaseLogin.sendEmailLoginOtp({email:e})}async sendSmsLoginOtp({phoneNumber:e}){return this.BaseLogin.sendSmsLoginOtp({phoneNumber:e})}async loginWithEmailOtp(e){return await this.preLogin(),this.BaseLogin.loginWithEmailOtp(e)}async authenticateWithEmailOtp(e){return this.BaseLogin.authenticateWithEmailOtp(e)}async loginWithSmsOtp(e){return await this.preLogin(),this.BaseLogin.loginWithSmsOtp(e)}async authenticateWithSmsOtp(e){return this.BaseLogin.authenticateWithSmsOtp(e)}async logout(){const e=await this.localStorage.removeAuthCookie(),t=await this.localStorage.removeWalletUserId();return{success:e||t}}}const $e="width=350, height=500",C=({isWindowOpenedByFn:i,win:e,closeOpenedWindow:t})=>{i?e==null||e.close():e&&t?t(e):e&&e.close()};async function $(i){const e=v({...i,mode:i.mode||"redirect",authFlow:i.authFlow});i.mode==="redirect"?window.location.href=e:window.open(e),await new Promise(t=>setTimeout(t,5e3))}const je=async i=>{let e=i.openedWindow,t=!1;if(e||(e=window.open(v({...i,mode:"popup"}),`Login to ${i.authOption}`,$e),t=!0),!e)throw new Error("Something went wrong opening pop-up");return await new Promise((r,l)=>{const c=window.setInterval(async()=>{e.closed&&(clearInterval(c),window.removeEventListener("message",n),l(new Error("User closed login window")))},1e3),n=async o=>{if(o.origin===g("inAppWallet")){if(typeof o.data!="object"){l(new Error("Invalid event data"));return}switch(o.data.eventType){case"oauthSuccessResult":{window.removeEventListener("message",n),clearInterval(c),C({closeOpenedWindow:i.closeOpenedWindow,isWindowOpenedByFn:t,win:e}),o.data.authResult&&r(o.data.authResult);break}case"oauthFailureResult":{window.removeEventListener("message",n),clearInterval(c),C({closeOpenedWindow:i.closeOpenedWindow,isWindowOpenedByFn:t,win:e}),l(new Error(o.data.errorString));break}}}};window.addEventListener("message",n)})},_e=async i=>{const{client:e,ecosystem:t}=i,a=v({authOption:i.strategy,client:e,ecosystem:t}),r={"Content-Type":"application/json","x-client-id":e.clientId};t!=null&&t.id&&(r["x-ecosystem-id"]=t.id),t!=null&&t.partnerId&&(r["x-ecosystem-partner-id"]=t.partnerId);const l=(()=>{switch(i.strategy){case"email":return{email:i.email};case"phone":return{phone:i.phoneNumber}}})(),c=await fetch(a,{body:w(l),headers:r,method:"POST"});if(!c.ok){const n=await c.text();let o;try{const s=JSON.parse(n);s&&typeof s.message=="string"&&(o=s.message)}catch{}throw new Error(o||"Failed to send verification code")}return await c.json()},j=async i=>{const{client:e,ecosystem:t}=i,a=S({authOption:i.strategy,client:i.client,ecosystem:i.ecosystem}),r={"Content-Type":"application/json","x-client-id":e.clientId};t!=null&&t.id&&(r["x-ecosystem-id"]=t.id),t!=null&&t.partnerId&&(r["x-ecosystem-partner-id"]=t.partnerId);const l=(()=>{switch(i.strategy){case"email":return{code:i.verificationCode,email:i.email};case"phone":return{code:i.verificationCode,phone:i.phoneNumber}}})(),c=await fetch(a,{body:w(l),headers:r,method:"POST"});if(!c.ok)throw new Error("Failed to verify verification code");return await c.json()};class _{constructor({client:e,ecosystem:t,querier:a,localStorage:r}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"walletManagerQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=t,this.walletManagerQuerier=a,this.localStorage=r}async postWalletSetUp(e){e.deviceShareStored&&await this.localStorage.saveDeviceShare(e.deviceShareStored,e.storedToken.authDetails.userWalletId)}async getUserWalletStatus(){const e=await this.walletManagerQuerier.call({params:void 0,procedureName:"getUserStatus"});return e.status==="Logged In, Wallet Initialized"?{status:"Logged In, Wallet Initialized",...e.user,account:await this.getAccount()}:e.status==="Logged In, New Device"?{status:"Logged In, New Device",...e.user}:e.status==="Logged In, Wallet Uninitialized"?{status:"Logged In, Wallet Uninitialized",...e.user}:{status:e.status}}async getAccount(){var c;const e=this.walletManagerQuerier,t=this.client,a=(c=this.ecosystem)==null?void 0:c.partnerId,{address:r}=await e.call({params:void 0,procedureName:"getAddress"}),l=async n=>{const o={chainId:n.chainId,data:n.data,gasLimit:n.gas,nonce:n.nonce,to:n.to??void 0,value:n.value};n.maxFeePerGas?(o.accessList=n.accessList,o.maxFeePerGas=n.maxFeePerGas,o.maxPriorityFeePerGas=n.maxPriorityFeePerGas,o.type=2):(o.gasPrice=n.gasPrice,o.type=0);const s=O().rpc,{signedTransaction:d}=await e.call({params:{chainId:n.chainId,partnerId:a,rpcEndpoint:`https://${n.chainId}.${s}`,transaction:o},procedureName:"signTransaction"});return d};return{address:y(r),async sendTransaction(n){const o=P({chain:I(n.chainId),client:t}),s=await l(n),d=await D(o,s);return F({chainId:n.chainId,client:t,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:d,walletAddress:r,walletType:"inApp"}),{transactionHash:d}},async signMessage({message:n}){const o=typeof n=="string"?n:n.raw instanceof Uint8Array?n.raw:J(n.raw),{signedMessage:s}=await e.call({params:{chainId:1,message:o,partnerId:a},procedureName:"signMessage"});return s},async signTransaction(n){if(!n.chainId)throw new Error("chainId required in tx to sign");return l({...n,chainId:n.chainId})},async signTypedData(n){var E;const o=U(n);(E=o.types)!=null&&E.EIP712Domain&&(o.types.EIP712Domain=void 0);const s=o.domain,d=s==null?void 0:s.chainId,h={...s!=null&&s.verifyingContract?{verifyingContract:s==null?void 0:s.verifyingContract}:{},name:s==null?void 0:s.name,version:s==null?void 0:s.version};d&&(h.chainId=d);const f=O().rpc,{signedTypedData:V}=await e.call({params:{chainId:Number.parseInt(BigInt(d||1).toString()),domain:h,message:o.message,partnerId:a,rpcEndpoint:`https://${d}.${f}`,types:o.types},procedureName:"signTypedDataV4"});return V}}}}class Qe{isClientIdLegacyPaper(e){return e.indexOf("-")>0&&e.length===36}constructor({client:e,onAuthSuccess:t,ecosystem:a,passkeyDomain:r,storage:l}){if(Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"querier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"wallet",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"auth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"passkeyDomain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.isClientIdLegacyPaper(e.clientId))throw new Error("You are using a legacy clientId. Please use the clientId found on the thirdweb dashboard settings page");const c=g("inAppWallet");this.client=e,this.ecosystem=a,this.passkeyDomain=r,this.storage=new N({clientId:e.clientId,ecosystem:a,storage:l??Fe()}),this.querier=new Pe({baseUrl:c,clientId:e.clientId,ecosystem:a}),this.auth=new Ce({baseUrl:c,client:e,ecosystem:a,localStorage:this.storage,onAuthSuccess:async n=>{if(t==null||t(n),n.storedToken.authDetails.walletType==="sharded"&&(await this.querier.call({params:{storedToken:n.storedToken},procedureName:"migrateFromShardToEnclave"})||console.warn("Failed to migrate from sharded to enclave wallet, continuing with sharded wallet")),this.wallet=await this.initializeWallet(n.storedToken.cookieString),!this.wallet)throw new Error("Failed to initialize wallet");const o="deviceShareStored"in n.walletDetails?n.walletDetails.deviceShareStored:void 0;return await this.wallet.postWalletSetUp({deviceShareStored:o,storedToken:n.storedToken}),this.wallet instanceof _&&await this.querier.call({params:{authCookie:n.storedToken.cookieString,clientId:this.client.clientId,deviceShareStored:"deviceShareStored"in n.walletDetails?n.walletDetails.deviceShareStored:null,ecosystemId:a==null?void 0:a.id,partnerId:a==null?void 0:a.partnerId,walletUserId:n.storedToken.authDetails.userWalletId},procedureName:"initIframe"}),{user:{account:await this.wallet.getAccount(),authDetails:n.storedToken.authDetails,status:"Logged In, Wallet Initialized",walletAddress:n.walletDetails.walletAddress}}},querier:this.querier})}async initializeWallet(e){var r;const t=await this.storage.getAuthCookie();if(!e&&t===null)throw new Error("No auth token provided and no stored auth token found to initialize the wallet");const a=await W({authToken:e||t,client:this.client,ecosystem:this.ecosystem});if(!a)throw new Error("Cannot initialize wallet, no user logged in");if(a.wallets.length===0)throw new Error("Cannot initialize wallet, this user does not have a wallet generated yet");return((r=a.wallets[0])==null?void 0:r.type)==="enclave"?new ke({address:a.wallets[0].address,client:this.client,ecosystem:this.ecosystem,storage:this.storage}):new _({client:this.client,ecosystem:this.ecosystem,localStorage:this.storage,querier:this.querier})}async getUser(){if(!this.wallet){const e=await this.storage.getAuthCookie();if(!e)return{status:"Logged Out"};this.wallet=await this.initializeWallet(e)}if(!this.wallet)throw new Error("Wallet not initialized");return await this.wallet.getUserWalletStatus()}getAccount(){if(!this.wallet)throw new Error("Wallet not initialized");return this.wallet.getAccount()}async preAuthenticate(e){return _e({...e,client:this.client,ecosystem:this.ecosystem})}async authenticateWithRedirect(e,t,a){return $({authOption:e,client:this.client,ecosystem:this.ecosystem,mode:t,redirectUrl:a})}async loginWithAuthToken(e,t){return this.auth.loginWithAuthToken(e,t)}async authenticate(e){const t=e.strategy;switch(t){case"email":return j({...e,client:this.client,ecosystem:this.ecosystem});case"phone":return j({...e,client:this.client,ecosystem:this.ecosystem});case"auth_endpoint":return oe({client:this.client,ecosystem:this.ecosystem,payload:e.payload});case"jwt":return de({client:this.client,ecosystem:this.ecosystem,jwt:e.jwt});case"passkey":return this.passkeyAuth(e);case"iframe_email_verification":return this.auth.authenticateWithIframe({email:e.email});case"iframe":return this.auth.authenticateWithModal();case"apple":case"facebook":case"google":case"telegram":case"github":case"twitch":case"farcaster":case"line":case"x":case"tiktok":case"epic":case"steam":case"coinbase":case"discord":return je({authOption:t,client:this.client,closeOpenedWindow:e.closeOpenedWindow,ecosystem:this.ecosystem,openedWindow:e.openedWindow});case"guest":return le({client:this.client,ecosystem:this.ecosystem,storage:this.storage});case"backend":return ce({client:this.client,ecosystem:this.ecosystem,walletSecret:e.walletSecret});case"wallet":return fe({client:this.client,ecosystem:this.ecosystem,wallet:e.wallet,chain:e.chain})}}async connect(e){const t=e.strategy;switch(t){case"auth_endpoint":case"jwt":{const a=await this.authenticate(e);return await this.loginWithAuthToken(a,e.encryptionKey)}case"iframe_email_verification":return this.auth.loginWithIframe({email:e.email});case"iframe":return this.auth.loginWithModal();case"passkey":{const a=await this.passkeyAuth(e);return this.loginWithAuthToken(a)}case"backend":case"phone":case"email":case"wallet":case"apple":case"facebook":case"google":case"farcaster":case"telegram":case"github":case"line":case"x":case"tiktok":case"epic":case"guest":case"coinbase":case"twitch":case"steam":case"discord":{const a=await this.authenticate(e);return await this.auth.loginWithAuthToken(a)}default:De(t)}}async logout(){return await this.auth.logout()}async passkeyAuth(e){const{PasskeyWebClient:t}=await b(async()=>{const{PasskeyWebClient:n}=await import("./passkeys-C1wTOzLk.js");return{PasskeyWebClient:n}},__vite__mapDeps([2,3])),{passkeyName:a,storeLastUsedPasskey:r=!0}=e,l=new t,c=this.storage;return e.type==="sign-up"?ue({client:this.client,ecosystem:this.ecosystem,passkeyClient:l,rp:{id:this.passkeyDomain??window.location.hostname,name:this.passkeyDomain??window.document.title},storage:r?c:void 0,username:a}):he({client:this.client,ecosystem:this.ecosystem,passkeyClient:l,rp:{id:this.passkeyDomain??window.location.hostname,name:this.passkeyDomain??window.document.title},storage:r?c:void 0})}async linkProfileWithRedirect(e,t,a){return $({authOption:e,client:this.client,ecosystem:this.ecosystem,mode:t,redirectUrl:a,authFlow:"link"})}async linkProfile(e){if("strategy"in e&&K.includes(e.strategy)&&"mode"in e&&e.mode!=="popup"&&e.mode!==void 0)return await this.linkProfileWithRedirect(e.strategy,e.mode,"redirectUrl"in e?e.redirectUrl:void 0),[];const{storedToken:t}=await this.authenticate(e);return await X({client:e.client,ecosystem:e.ecosystem||this.ecosystem,storage:this.storage,tokenToLink:t.cookieString})}async unlinkProfile(e,t){return await ee({allowAccountDeletion:t,client:this.client,ecosystem:this.ecosystem,profileToUnlink:e,storage:this.storage})}async getProfiles(){return te({client:this.client,ecosystem:this.ecosystem,storage:this.storage})}}function De(i,e){throw new Error(`Invalid param: ${i}`)}function Fe(){return typeof window<"u"&&window.localStorage?B:ie}export{Qe as InAppWebConnector};
9
+ `)}async function ge(i){const{payload:e,account:t}=i,a=await t.signMessage({message:pe(e)});return{payload:e,signature:a}}const me=["xyz.abs"];async function fe(i){const{wallet:e,client:t,ecosystem:a,chain:r}=i,l=me.includes(e.id)?r||I(1):I(1),c=e.getAccount()||await e.connect({chain:l,client:t}),n=p(t,a),o=await(async()=>{const u=v({authOption:"wallet",client:i.client,ecosystem:i.ecosystem}),h=await n(`${u}&address=${c.address}&chainId=${l.id}`);if(!h.ok)throw new Error("Failed to generate SIWE login payload");return await h.json()})(),{signature:s}=await ge({account:c,payload:o});return await(async()=>{const u=S({authOption:"wallet",client:i.client,ecosystem:i.ecosystem}),h=await n(`${u}&signature=${s}&payload=${encodeURIComponent(o)}`,{body:w({payload:o,signature:s}),headers:{"Content-Type":"application/json"},method:"POST"});if(!h.ok)throw new Error("Failed to verify SIWE signature");return await h.json()})()}async function ye({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=p(i,r);if(!a)throw new Error("No auth token found when signing message");const c={address:e.address,chainId:e.chainId,nonce:Number(e.nonce)},n=await l(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-authorization`,{body:w(c),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!n.ok)throw new Error(`Failed to sign message - ${n.status} ${n.statusText}`);return await n.json()}async function be({client:i,payload:{message:e,isRaw:t,originalMessage:a,chainId:r},storage:l}){const c=await l.getAuthCookie(),n=l.ecosystem,o=p(i,n);if(!c)throw new Error("No auth token found when signing message");const s=await o(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-message`,{body:w({messagePayload:{chainId:r,isRaw:t,message:e,originalMessage:a}}),headers:{Authorization:`Bearer embedded-wallet-token:${c}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!s.ok)throw new Error(`Failed to sign message - ${s.status} ${s.statusText}`);return await s.json()}async function Ie({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=p(i,r);if(!a)throw new Error("No auth token found when signing transaction");const c=await l(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-transaction`,{body:w({transactionPayload:e}),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!c.ok)throw new Error(`Failed to sign transaction - ${c.status} ${c.statusText}`);return(await c.json()).signature}async function ve({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=p(i,r);if(!a)throw new Error("No auth token found when signing typed data");const c=await l(`${g("inAppWallet")}/api/v1/enclave-wallet/sign-typed-data`,{body:w({...e}),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!c.ok)throw new Error(`Failed to sign typed data - ${c.status} ${c.statusText}`);return await c.json()}class ke{constructor({client:e,ecosystem:t,address:a,storage:r}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"address",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=t,this.address=a,this.localStorage=r}async postWalletSetUp(e){await this.localStorage.saveAuthCookie(e.storedToken.cookieString)}async getUserWalletStatus(){var l,c;const e=await this.localStorage.getAuthCookie();if(!e)return{status:"Logged Out"};const t=await W({authToken:e,client:this.client,ecosystem:this.ecosystem});if(!t)return{status:"Logged Out"};const a=t.wallets[0],r={email:(l=t.linkedAccounts.find(n=>n.details.email!==void 0))==null?void 0:l.details.email,phoneNumber:(c=t.linkedAccounts.find(n=>n.details.phone!==void 0))==null?void 0:c.details.phone,recoveryShareManagement:"ENCLAVE",userWalletId:t.id||""};return a?{account:await this.getAccount(),authDetails:r,status:"Logged In, Wallet Initialized",walletAddress:a.address}:{authDetails:r,status:"Logged In, Wallet Uninitialized"}}async getAccount(){const e=this.client,t=this.localStorage,a=this.address,r=this.ecosystem,l=async n=>{const o=P({chain:I(n.chainId),client:e}),s={chainId:A(n.chainId),data:n.data,gas:m(n.gas),nonce:m(n.nonce)||A(await b(async()=>{const{eth_getTransactionCount:d}=await import("./thirdweb-129NE2Ul.js").then(u=>u.cl);return{eth_getTransactionCount:d}},[]).then(({eth_getTransactionCount:d})=>d(o,{address:y(this.address),blockTag:"pending"}))),to:n.to?y(n.to):void 0,value:m(n.value)};return n.authorizationList&&n.authorizationList.length>0?(s.type=4,s.authorizationList=n.authorizationList,s.maxFeePerGas=m(n.maxFeePerGas),s.maxPriorityFeePerGas=m(n.maxPriorityFeePerGas)):m(n.maxFeePerGas)?(s.maxFeePerGas=m(n.maxFeePerGas),s.maxPriorityFeePerGas=m(n.maxPriorityFeePerGas),s.type=2):(s.gasPrice=m(n.gasPrice),s.type=0),Ie({client:e,payload:s,storage:t})},c={address:y(a),async sendTransaction(n){const o=P({chain:I(n.chainId),client:e}),s=await l(n),d=await D(o,s);return F({chainId:n.chainId,client:e,contractAddress:n.to??void 0,ecosystem:r,gasPrice:n.gasPrice,transactionHash:d,walletAddress:a,walletType:"inApp"}),{transactionHash:d}},async signAuthorization(n){const o=await ye({client:e,payload:n,storage:t});return{address:y(o.address),chainId:Number.parseInt(o.chainId),nonce:BigInt(o.nonce),r:BigInt(o.r),s:BigInt(o.s),yParity:Number.parseInt(o.yParity)}},async signMessage({message:n,originalMessage:o,chainId:s}){const d=typeof n=="string"?{chainId:s,isRaw:!1,message:n,originalMessage:o}:{chainId:s,isRaw:!0,message:typeof n.raw=="string"?n.raw:Q(n.raw),originalMessage:o},{signature:u}=await be({client:e,payload:d,storage:t});return u},async signTransaction(n){if(!n.chainId)throw new Error("chainId required in tx to sign");return l({chainId:n.chainId,...n})},async signTypedData(n){const o=U(n),{signature:s}=await ve({client:e,payload:o,storage:t});return s},sendCalls:async n=>{const{inAppWalletSendCalls:o}=await b(async()=>{const{inAppWalletSendCalls:f}=await import("./in-app-wallet-calls-C3XXM2uK.js");return{inAppWalletSendCalls:f}},__vite__mapDeps([0,1])),s=n.calls[0];if(!s)throw new Error("No calls to send");const d=s.client,u=s.chain||n.chain,h=await o({account:c,calls:n.calls,chain:u});return{chain:u,client:d,id:h}},getCallsStatus:async n=>{const{inAppWalletGetCallsStatus:o}=await b(async()=>{const{inAppWalletGetCallsStatus:s}=await import("./in-app-wallet-calls-C3XXM2uK.js");return{inAppWalletGetCallsStatus:s}},__vite__mapDeps([0,1]));return o(n)},getCallsStatusRaw:async n=>{const{inAppWalletGetCallsStatusRaw:o}=await b(async()=>{const{inAppWalletGetCallsStatusRaw:s}=await import("./in-app-wallet-calls-C3XXM2uK.js");return{inAppWalletGetCallsStatusRaw:s}},__vite__mapDeps([0,1]));return o(n)},getCapabilities:async n=>({[n.chainId??1]:{atomic:{status:"unsupported"},paymasterService:{supported:!1}}})};return c}}function m(i){return i===void 0||H(i)?i:A(i)}const Te={backgroundColor:"transparent",border:"none",colorScheme:"light",display:"none",height:"100%",pointerEvents:"all",position:"fixed",right:"0px",top:"0px",width:"100%",zIndex:"2147483646"},L=new Map;class Le{constructor({link:e,baseUrl:t,iframeId:a,container:r,onIframeInitialize:l,localStorage:c,clientId:n,ecosystem:o}){if(Object.defineProperty(this,"iframe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"POLLING_INTERVAL_SECONDS",{enumerable:!0,configurable:!0,writable:!0,value:1.4}),Object.defineProperty(this,"iframeBaseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.localStorage=c,this.clientId=n,this.ecosystem=o,this.iframeBaseUrl=t,typeof document>"u")return;r=r??document.body;let s=document.getElementById(a);const d=new URL(e);if(!s||s.src!==d.href){s=document.createElement("iframe");const u={...Te};Object.assign(s.style,u),s.setAttribute("id",a),s.setAttribute("fetchpriority","high"),r.appendChild(s),s.src=d.href;const h=f=>{if(f.data.eventType==="ewsIframeLoaded"){if(window.removeEventListener("message",h),!s){console.warn("thirdweb iFrame not found");return}this.onIframeLoadHandler(s,l)()}};window.addEventListener("message",h)}this.iframe=s}async onIframeLoadedInitVariables(){var e,t;return{authCookie:await this.localStorage.getAuthCookie(),clientId:this.clientId,deviceShareStored:await this.localStorage.getDeviceShare(),ecosystemId:(e=this.ecosystem)==null?void 0:e.id,partnerId:(t=this.ecosystem)==null?void 0:t.partnerId,walletUserId:await this.localStorage.getWalletUserId()}}onIframeLoadHandler(e,t){return async()=>{var l;const a=new MessageChannel,r=new Promise((c,n)=>{a.port1.onmessage=o=>{const{data:s}=o;a.port1.close(),s.success||n(new Error(s.error)),L.set(e.src,!0),t&&t(),c(!0)}});(l=e==null?void 0:e.contentWindow)==null||l.postMessage({data:await this.onIframeLoadedInitVariables(),eventType:"initIframe"},this.iframeBaseUrl,[a.port2]),await r}}async call({procedureName:e,params:t,showIframe:a=!1}){var c;if(!this.iframe)throw new Error("Iframe not found. You are likely calling this from the backend where the DOM is not available.");for(;!L.get(this.iframe.src);)await k(this.POLLING_INTERVAL_SECONDS*1e3);a&&(this.iframe.style.display="block",await k(.005*1e3));const r=new MessageChannel,l=new Promise((n,o)=>{r.port1.onmessage=async s=>{const{data:d}=s;r.port1.close(),a&&(await k(.1*1e3),this.iframe&&(this.iframe.style.display="none")),d.success?n(d.data):o(new Error(d.error))}});return(c=this.iframe.contentWindow)==null||c.postMessage({data:{...t,...await this.onIframeLoadedInitVariables()},eventType:e},this.iframeBaseUrl,[r.port2]),l}destroy(){this.iframe&&L.delete(this.iframe.src)}}class Pe extends Le{constructor({clientId:e,baseUrl:t,ecosystem:a}){super({baseUrl:t,clientId:e,container:typeof document>"u"?void 0:document.body,ecosystem:a,iframeId:We+((a==null?void 0:a.id)||""),link:Ae({baseUrl:t,clientId:e,ecosystem:a,path:Y}).href,localStorage:new N({clientId:e,ecosystem:a,storage:B})}),this.clientId=e,this.ecosystem=a}}function Ae({clientId:i,baseUrl:e,path:t,ecosystem:a,queryParams:r}){var c;const l=new URL(`${t}`,e);if(r)for(const n of Object.keys(r))l.searchParams.set(n,((c=r[n])==null?void 0:c.toString())||"");return l.searchParams.set("clientId",i),(a==null?void 0:a.partnerId)!==void 0&&l.searchParams.set("partnerId",a.partnerId),(a==null?void 0:a.id)!==void 0&&l.searchParams.set("ecosystemId",a.id),l}const We="thirdweb-in-app-wallet-iframe";async function Se({client:i,ecosystem:e,authToken:t}){const r=await p(i,e)(`${g("inAppWallet")}/api/v1/enclave-wallet/generate`,{headers:{Authorization:`Bearer embedded-wallet-token:${t}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!r.ok)throw new Error(`Failed to generate wallet - ${r.status} ${r.statusText}`);const{wallet:l}=await r.json();return l}class Ee{constructor({baseUrl:e,querier:t,preLogin:a,postLogin:r,client:l,ecosystem:c}){Object.defineProperty(this,"LoginQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"preLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"postLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseUrl=e,this.LoginQuerier=t,this.preLogin=a,this.postLogin=r,this.client=l,this.ecosystem=c}async sendEmailLoginOtp({email:e}){return await this.LoginQuerier.call({params:{email:e},procedureName:"sendThirdwebEmailLoginOtp"})}async sendSmsLoginOtp({phoneNumber:e}){return await this.LoginQuerier.call({params:{phoneNumber:e},procedureName:"sendThirdwebSmsLoginOtp"})}}class Oe extends Ee{async authenticateWithModal(){return this.LoginQuerier.call({params:void 0,procedureName:"loginWithThirdwebModal",showIframe:!0})}async loginWithModal(){await this.preLogin();const e=await this.authenticateWithModal();return this.postLogin(e)}async authenticateWithIframe({email:e}){return this.LoginQuerier.call({params:{email:e},procedureName:"loginWithThirdwebModal",showIframe:!0})}async loginWithIframe({email:e}){await this.preLogin();const t=await this.authenticateWithIframe({email:e});return this.postLogin(t)}async authenticateWithCustomJwt({encryptionKey:e,jwt:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom jwt auth");return this.LoginQuerier.call({params:{encryptionKey:e,jwt:t},procedureName:"loginWithCustomJwt"})}async loginWithCustomJwt({encryptionKey:e,jwt:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom jwt auth");await this.preLogin();const a=await this.authenticateWithCustomJwt({encryptionKey:e,jwt:t});return this.postLogin(a)}async authenticateWithCustomAuthEndpoint({encryptionKey:e,payload:t}){return this.LoginQuerier.call({params:{encryptionKey:e,payload:t},procedureName:"loginWithCustomAuthEndpoint"})}async loginWithCustomAuthEndpoint({encryptionKey:e,payload:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom auth");await this.preLogin();const a=await this.authenticateWithCustomAuthEndpoint({encryptionKey:e,payload:t});return this.postLogin(a)}async authenticateWithEmailOtp({email:e,otp:t,recoveryCode:a}){return this.LoginQuerier.call({params:{email:e,otp:t,recoveryCode:a},procedureName:"verifyThirdwebEmailLoginOtp"})}async loginWithEmailOtp({email:e,otp:t,recoveryCode:a}){const r=await this.authenticateWithEmailOtp({email:e,otp:t,recoveryCode:a});return this.postLogin(r)}async authenticateWithSmsOtp({phoneNumber:e,otp:t,recoveryCode:a}){return this.LoginQuerier.call({params:{otp:t,phoneNumber:e,recoveryCode:a},procedureName:"verifyThirdwebSmsLoginOtp"})}async loginWithSmsOtp({phoneNumber:e,otp:t,recoveryCode:a}){const r=await this.authenticateWithSmsOtp({otp:t,phoneNumber:e,recoveryCode:a});return this.postLogin(r)}}class Ce{constructor({client:e,querier:t,onAuthSuccess:a,ecosystem:r,baseUrl:l,localStorage:c}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"AuthQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onAuthSuccess",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"BaseLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=r,this.AuthQuerier=t,this.localStorage=c,this.onAuthSuccess=a,this.BaseLogin=new Oe({baseUrl:l,client:e,ecosystem:r,postLogin:async n=>this.postLogin(n),preLogin:async()=>{await this.preLogin()},querier:t})}async preLogin(){await this.logout()}async postLogin({storedToken:e,walletDetails:t}){return e.shouldStoreCookieString&&await this.localStorage.saveAuthCookie(e.cookieString),await this.onAuthSuccess({storedToken:e,walletDetails:t})}async loginWithAuthToken(e,t){var l;e.storedToken.authProvider!=="Backend"&&await this.preLogin();const a=await W({authToken:e.storedToken.cookieString,client:this.client,ecosystem:this.ecosystem});if(!a)throw new Error("Cannot login, no user found for auth token");if(a.wallets.length>0&&((l=a.wallets[0])==null?void 0:l.type)==="enclave")return this.postLogin({storedToken:e.storedToken,walletDetails:{walletAddress:a.wallets[0].address}});if(a.wallets.length===0){const c=await Se({authToken:e.storedToken.cookieString,client:this.client,ecosystem:this.ecosystem});return this.postLogin({storedToken:e.storedToken,walletDetails:{walletAddress:c.address}})}const r=await this.AuthQuerier.call({params:{recoveryCode:t,storedToken:e.storedToken},procedureName:"loginWithStoredTokenDetails"});return this.postLogin(r)}async loginWithModal(){return this.BaseLogin.loginWithModal()}async authenticateWithModal(){return this.BaseLogin.authenticateWithModal()}async loginWithIframe(e){return this.BaseLogin.loginWithIframe(e)}async authenticateWithIframe(e){return this.BaseLogin.authenticateWithIframe(e)}async loginWithCustomJwt(e){return this.BaseLogin.loginWithCustomJwt(e)}async authenticateWithCustomJwt(e){return this.BaseLogin.authenticateWithCustomJwt(e)}async loginWithCustomAuthEndpoint(e){return this.BaseLogin.loginWithCustomAuthEndpoint(e)}async authenticateWithCustomAuthEndpoint(e){return this.BaseLogin.authenticateWithCustomAuthEndpoint(e)}async sendEmailLoginOtp({email:e}){return this.BaseLogin.sendEmailLoginOtp({email:e})}async sendSmsLoginOtp({phoneNumber:e}){return this.BaseLogin.sendSmsLoginOtp({phoneNumber:e})}async loginWithEmailOtp(e){return await this.preLogin(),this.BaseLogin.loginWithEmailOtp(e)}async authenticateWithEmailOtp(e){return this.BaseLogin.authenticateWithEmailOtp(e)}async loginWithSmsOtp(e){return await this.preLogin(),this.BaseLogin.loginWithSmsOtp(e)}async authenticateWithSmsOtp(e){return this.BaseLogin.authenticateWithSmsOtp(e)}async logout(){const e=await this.localStorage.removeAuthCookie(),t=await this.localStorage.removeWalletUserId();return{success:e||t}}}const $e="width=350, height=500",C=({isWindowOpenedByFn:i,win:e,closeOpenedWindow:t})=>{i?e==null||e.close():e&&t?t(e):e&&e.close()};async function $(i){const e=v({...i,mode:i.mode||"redirect",authFlow:i.authFlow});i.mode==="redirect"?window.location.href=e:window.open(e),await new Promise(t=>setTimeout(t,5e3))}const je=async i=>{let e=i.openedWindow,t=!1;if(e||(e=window.open(v({...i,mode:"popup"}),`Login to ${i.authOption}`,$e),t=!0),!e)throw new Error("Something went wrong opening pop-up");return await new Promise((r,l)=>{const c=window.setInterval(async()=>{e.closed&&(clearInterval(c),window.removeEventListener("message",n),l(new Error("User closed login window")))},1e3),n=async o=>{if(o.origin===g("inAppWallet")){if(typeof o.data!="object"){l(new Error("Invalid event data"));return}switch(o.data.eventType){case"oauthSuccessResult":{window.removeEventListener("message",n),clearInterval(c),C({closeOpenedWindow:i.closeOpenedWindow,isWindowOpenedByFn:t,win:e}),o.data.authResult&&r(o.data.authResult);break}case"oauthFailureResult":{window.removeEventListener("message",n),clearInterval(c),C({closeOpenedWindow:i.closeOpenedWindow,isWindowOpenedByFn:t,win:e}),l(new Error(o.data.errorString));break}}}};window.addEventListener("message",n)})},_e=async i=>{const{client:e,ecosystem:t}=i,a=v({authOption:i.strategy,client:e,ecosystem:t}),r={"Content-Type":"application/json","x-client-id":e.clientId};t!=null&&t.id&&(r["x-ecosystem-id"]=t.id),t!=null&&t.partnerId&&(r["x-ecosystem-partner-id"]=t.partnerId);const l=(()=>{switch(i.strategy){case"email":return{email:i.email};case"phone":return{phone:i.phoneNumber}}})(),c=await fetch(a,{body:w(l),headers:r,method:"POST"});if(!c.ok){const n=await c.text();let o;try{const s=JSON.parse(n);s&&typeof s.message=="string"&&(o=s.message)}catch{}throw new Error(o||"Failed to send verification code")}return await c.json()},j=async i=>{const{client:e,ecosystem:t}=i,a=S({authOption:i.strategy,client:i.client,ecosystem:i.ecosystem}),r={"Content-Type":"application/json","x-client-id":e.clientId};t!=null&&t.id&&(r["x-ecosystem-id"]=t.id),t!=null&&t.partnerId&&(r["x-ecosystem-partner-id"]=t.partnerId);const l=(()=>{switch(i.strategy){case"email":return{code:i.verificationCode,email:i.email};case"phone":return{code:i.verificationCode,phone:i.phoneNumber}}})(),c=await fetch(a,{body:w(l),headers:r,method:"POST"});if(!c.ok)throw new Error("Failed to verify verification code");return await c.json()};class _{constructor({client:e,ecosystem:t,querier:a,localStorage:r}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"walletManagerQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=t,this.walletManagerQuerier=a,this.localStorage=r}async postWalletSetUp(e){e.deviceShareStored&&await this.localStorage.saveDeviceShare(e.deviceShareStored,e.storedToken.authDetails.userWalletId)}async getUserWalletStatus(){const e=await this.walletManagerQuerier.call({params:void 0,procedureName:"getUserStatus"});return e.status==="Logged In, Wallet Initialized"?{status:"Logged In, Wallet Initialized",...e.user,account:await this.getAccount()}:e.status==="Logged In, New Device"?{status:"Logged In, New Device",...e.user}:e.status==="Logged In, Wallet Uninitialized"?{status:"Logged In, Wallet Uninitialized",...e.user}:{status:e.status}}async getAccount(){var c;const e=this.walletManagerQuerier,t=this.client,a=(c=this.ecosystem)==null?void 0:c.partnerId,{address:r}=await e.call({params:void 0,procedureName:"getAddress"}),l=async n=>{const o={chainId:n.chainId,data:n.data,gasLimit:n.gas,nonce:n.nonce,to:n.to??void 0,value:n.value};n.maxFeePerGas?(o.accessList=n.accessList,o.maxFeePerGas=n.maxFeePerGas,o.maxPriorityFeePerGas=n.maxPriorityFeePerGas,o.type=2):(o.gasPrice=n.gasPrice,o.type=0);const s=O().rpc,{signedTransaction:d}=await e.call({params:{chainId:n.chainId,partnerId:a,rpcEndpoint:`https://${n.chainId}.${s}`,transaction:o},procedureName:"signTransaction"});return d};return{address:y(r),async sendTransaction(n){const o=P({chain:I(n.chainId),client:t}),s=await l(n),d=await D(o,s);return F({chainId:n.chainId,client:t,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:d,walletAddress:r,walletType:"inApp"}),{transactionHash:d}},async signMessage({message:n}){const o=typeof n=="string"?n:n.raw instanceof Uint8Array?n.raw:J(n.raw),{signedMessage:s}=await e.call({params:{chainId:1,message:o,partnerId:a},procedureName:"signMessage"});return s},async signTransaction(n){if(!n.chainId)throw new Error("chainId required in tx to sign");return l({...n,chainId:n.chainId})},async signTypedData(n){var E;const o=U(n);(E=o.types)!=null&&E.EIP712Domain&&(o.types.EIP712Domain=void 0);const s=o.domain,d=s==null?void 0:s.chainId,h={...s!=null&&s.verifyingContract?{verifyingContract:s==null?void 0:s.verifyingContract}:{},name:s==null?void 0:s.name,version:s==null?void 0:s.version};d&&(h.chainId=d);const f=O().rpc,{signedTypedData:V}=await e.call({params:{chainId:Number.parseInt(BigInt(d||1).toString()),domain:h,message:o.message,partnerId:a,rpcEndpoint:`https://${d}.${f}`,types:o.types},procedureName:"signTypedDataV4"});return V}}}}class Re{isClientIdLegacyPaper(e){return e.indexOf("-")>0&&e.length===36}constructor({client:e,onAuthSuccess:t,ecosystem:a,passkeyDomain:r,storage:l}){if(Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"querier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"wallet",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"auth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"passkeyDomain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.isClientIdLegacyPaper(e.clientId))throw new Error("You are using a legacy clientId. Please use the clientId found on the thirdweb dashboard settings page");const c=g("inAppWallet");this.client=e,this.ecosystem=a,this.passkeyDomain=r,this.storage=new N({clientId:e.clientId,ecosystem:a,storage:l??Fe()}),this.querier=new Pe({baseUrl:c,clientId:e.clientId,ecosystem:a}),this.auth=new Ce({baseUrl:c,client:e,ecosystem:a,localStorage:this.storage,onAuthSuccess:async n=>{if(t==null||t(n),n.storedToken.authDetails.walletType==="sharded"&&(await this.querier.call({params:{storedToken:n.storedToken},procedureName:"migrateFromShardToEnclave"})||console.warn("Failed to migrate from sharded to enclave wallet, continuing with sharded wallet")),this.wallet=await this.initializeWallet(n.storedToken.cookieString),!this.wallet)throw new Error("Failed to initialize wallet");const o="deviceShareStored"in n.walletDetails?n.walletDetails.deviceShareStored:void 0;return await this.wallet.postWalletSetUp({deviceShareStored:o,storedToken:n.storedToken}),this.wallet instanceof _&&await this.querier.call({params:{authCookie:n.storedToken.cookieString,clientId:this.client.clientId,deviceShareStored:"deviceShareStored"in n.walletDetails?n.walletDetails.deviceShareStored:null,ecosystemId:a==null?void 0:a.id,partnerId:a==null?void 0:a.partnerId,walletUserId:n.storedToken.authDetails.userWalletId},procedureName:"initIframe"}),{user:{account:await this.wallet.getAccount(),authDetails:n.storedToken.authDetails,status:"Logged In, Wallet Initialized",walletAddress:n.walletDetails.walletAddress}}},querier:this.querier})}async initializeWallet(e){var r;const t=await this.storage.getAuthCookie();if(!e&&t===null)throw new Error("No auth token provided and no stored auth token found to initialize the wallet");const a=await W({authToken:e||t,client:this.client,ecosystem:this.ecosystem});if(!a)throw new Error("Cannot initialize wallet, no user logged in");if(a.wallets.length===0)throw new Error("Cannot initialize wallet, this user does not have a wallet generated yet");return((r=a.wallets[0])==null?void 0:r.type)==="enclave"?new ke({address:a.wallets[0].address,client:this.client,ecosystem:this.ecosystem,storage:this.storage}):new _({client:this.client,ecosystem:this.ecosystem,localStorage:this.storage,querier:this.querier})}async getUser(){if(!this.wallet){const e=await this.storage.getAuthCookie();if(!e)return{status:"Logged Out"};this.wallet=await this.initializeWallet(e)}if(!this.wallet)throw new Error("Wallet not initialized");return await this.wallet.getUserWalletStatus()}getAccount(){if(!this.wallet)throw new Error("Wallet not initialized");return this.wallet.getAccount()}async preAuthenticate(e){return _e({...e,client:this.client,ecosystem:this.ecosystem})}async authenticateWithRedirect(e,t,a){return $({authOption:e,client:this.client,ecosystem:this.ecosystem,mode:t,redirectUrl:a})}async loginWithAuthToken(e,t){return this.auth.loginWithAuthToken(e,t)}async authenticate(e){const t=e.strategy;switch(t){case"email":return j({...e,client:this.client,ecosystem:this.ecosystem});case"phone":return j({...e,client:this.client,ecosystem:this.ecosystem});case"auth_endpoint":return oe({client:this.client,ecosystem:this.ecosystem,payload:e.payload});case"jwt":return de({client:this.client,ecosystem:this.ecosystem,jwt:e.jwt});case"passkey":return this.passkeyAuth(e);case"iframe_email_verification":return this.auth.authenticateWithIframe({email:e.email});case"iframe":return this.auth.authenticateWithModal();case"apple":case"facebook":case"google":case"telegram":case"github":case"twitch":case"farcaster":case"line":case"x":case"tiktok":case"epic":case"steam":case"coinbase":case"discord":return je({authOption:t,client:this.client,closeOpenedWindow:e.closeOpenedWindow,ecosystem:this.ecosystem,openedWindow:e.openedWindow});case"guest":return le({client:this.client,ecosystem:this.ecosystem,storage:this.storage});case"backend":return ce({client:this.client,ecosystem:this.ecosystem,walletSecret:e.walletSecret});case"wallet":return fe({client:this.client,ecosystem:this.ecosystem,wallet:e.wallet,chain:e.chain})}}async connect(e){const t=e.strategy;switch(t){case"auth_endpoint":case"jwt":{const a=await this.authenticate(e);return await this.loginWithAuthToken(a,e.encryptionKey)}case"iframe_email_verification":return this.auth.loginWithIframe({email:e.email});case"iframe":return this.auth.loginWithModal();case"passkey":{const a=await this.passkeyAuth(e);return this.loginWithAuthToken(a)}case"backend":case"phone":case"email":case"wallet":case"apple":case"facebook":case"google":case"farcaster":case"telegram":case"github":case"line":case"x":case"tiktok":case"epic":case"guest":case"coinbase":case"twitch":case"steam":case"discord":{const a=await this.authenticate(e);return await this.auth.loginWithAuthToken(a)}default:De(t)}}async logout(){return await this.auth.logout()}async passkeyAuth(e){const{PasskeyWebClient:t}=await b(async()=>{const{PasskeyWebClient:n}=await import("./passkeys-C1wTOzLk.js");return{PasskeyWebClient:n}},__vite__mapDeps([2,3])),{passkeyName:a,storeLastUsedPasskey:r=!0}=e,l=new t,c=this.storage;return e.type==="sign-up"?ue({client:this.client,ecosystem:this.ecosystem,passkeyClient:l,rp:{id:this.passkeyDomain??window.location.hostname,name:this.passkeyDomain??window.document.title},storage:r?c:void 0,username:a}):he({client:this.client,ecosystem:this.ecosystem,passkeyClient:l,rp:{id:this.passkeyDomain??window.location.hostname,name:this.passkeyDomain??window.document.title},storage:r?c:void 0})}async linkProfileWithRedirect(e,t,a){return $({authOption:e,client:this.client,ecosystem:this.ecosystem,mode:t,redirectUrl:a,authFlow:"link"})}async linkProfile(e){if("strategy"in e&&te.includes(e.strategy)&&"mode"in e&&e.mode!=="popup"&&e.mode!==void 0)return await this.linkProfileWithRedirect(e.strategy,e.mode,"redirectUrl"in e?e.redirectUrl:void 0),[];const{storedToken:t}=await this.authenticate(e);return await Z({client:e.client,ecosystem:e.ecosystem||this.ecosystem,storage:this.storage,tokenToLink:t.cookieString})}async unlinkProfile(e,t){return await K({allowAccountDeletion:t,client:this.client,ecosystem:this.ecosystem,profileToUnlink:e,storage:this.storage})}async getProfiles(){return X({client:this.client,ecosystem:this.ecosystem,storage:this.storage})}}function De(i,e){throw new Error(`Invalid param: ${i}`)}function Fe(){return typeof window<"u"&&window.localStorage?B:ie}export{Re as InAppWebConnector};
package/index.html CHANGED
@@ -5,11 +5,11 @@
5
5
  <link rel="shortcut icon" type="image/x-icon" href="https://decentraland.org/images/icons/favicon-32x32.png" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Decentraland | Authorization</title>
8
- <script type="module" crossorigin src="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30219248876.commit-24ddf14/assets/index-CUHQgubq.js"></script>
9
- <link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30219248876.commit-24ddf14/assets/thirdweb-D3S3QNoz.js">
10
- <link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30219248876.commit-24ddf14/assets/vendor-fOKayE99.js">
11
- <link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30219248876.commit-24ddf14/assets/ui-am1Nr89z.js">
12
- <link rel="stylesheet" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30219248876.commit-24ddf14/assets/index-WlYrqZYZ.css">
8
+ <script type="module" crossorigin src="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30289583460.commit-46bdbdf/assets/index-DPWHpwh1.js"></script>
9
+ <link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30289583460.commit-46bdbdf/assets/thirdweb-129NE2Ul.js">
10
+ <link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30289583460.commit-46bdbdf/assets/vendor-DTjic7dc.js">
11
+ <link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30289583460.commit-46bdbdf/assets/ui-C5Ow-sF2.js">
12
+ <link rel="stylesheet" crossorigin href="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30289583460.commit-46bdbdf/assets/index-CujiQKjN.css">
13
13
  </head>
14
14
  <body>
15
15
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcl/auth-site",
3
- "version": "4.21.1-30219248876.commit-24ddf14",
3
+ "version": "4.21.1-30289583460.commit-46bdbdf",
4
4
  "description": "Auth website",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -17,6 +17,6 @@
17
17
  ],
18
18
  "author": "Decentraland",
19
19
  "license": "Apache-2.0",
20
- "homepage": "https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30219248876.commit-24ddf14",
21
- "commit": "24ddf1402dbd4020e8132fbf71818d82bc4cf5b2"
20
+ "homepage": "https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30289583460.commit-46bdbdf",
21
+ "commit": "46bdbdfc07985e76e84c2c47d0153f5347747bd9"
22
22
  }
@@ -1 +0,0 @@
1
- import{u as A,j as e,D as xe,C as pe,G as De,L as ie,b as ke,c as $e}from"./ui-am1Nr89z.js";import{e as Fe,a as t}from"./vendor-fOKayE99.js";import{E as J,F as u,G as Ve,J as ze,K as Ke,M as qe,O as He,P as Ze,Q as Je,X as Qe,Y as Xe,Z as ye,_ as Ye,$ as en,a0 as nn,a1 as tn,a2 as an,a3 as sn,a4 as on,a5 as rn,a6 as ln,a7 as cn,a8 as dn,a9 as un,aa as gn,ab as hn,ac as mn,ad as wn,ae as Cn,af as fn,ag as xn,ah as pn,ai as kn,aj as yn,ak as En,al as Sn,am as jn,an as Ln,ao as _n,ap as bn,aq as In,ar as le,as as ce,at as de,au as ue,av as Tn,aw as Mn,ax as On,ay as S,az as vn,aA as An,aB as Rn,aC as Pn,aD as Wn,aE as Nn,aF as Bn,aG as Un,aH as Gn,aI as Dn,aJ as V,aK as $n,aL as Fn,aM as ge,aN as v,aO as Vn,aP as zn,aQ as Kn,aR as he,aS as me,aT as qn,aU as Hn,aV as we,aW as Zn,aX as Ce,aY as Jn,aZ as Qn,a_ as Xn,a$ as Yn,b0 as et,b1 as nt,b2 as tt,b3 as at}from"./index-CUHQgubq.js";import"./thirdweb-D3S3QNoz.js";const st="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30219248876.commit-24ddf14/assets/image-new1-CpZnKbBW.webp",ot="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30219248876.commit-24ddf14/assets/image-new2-C5ihWkmR.webp",rt="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30219248876.commit-24ddf14/assets/image-new3-DJx27VUM.webp",it="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30219248876.commit-24ddf14/assets/image-new4-Dx5Lwr3m.webp",lt="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30219248876.commit-24ddf14/assets/image-new5-CzVG1QYp.webp",ct="https://cdn.decentraland.org/@dcl/auth-site/4.21.1-30219248876.commit-24ddf14/assets/image-new6-DgBpE6FO.webp",dt=["email","metamask","google","discord","apple","x","fortmatic","coinbase","walletconnect"];function ut(a){switch(a){case"email":return u.EMAIL;case"metamask":return u.METAMASK;case"google":return u.GOOGLE;case"discord":return u.DISCORD;case"apple":return u.APPLE;case"x":return u.X;case"fortmatic":return u.FORTMATIC;case"coinbase":return u.COINBASE;case"walletconnect":return u.WALLET_CONNECT}}const gt=({isReady:a,onConnect:r})=>{var j;const[c]=Fe(),i=t.useRef(!1),g=(j=c.get("loginMethod"))==null?void 0:j.toLowerCase(),y=dt.includes(g)?g:null,x=t.useCallback(()=>y?ut(y):null,[y])();return t.useEffect(()=>{if(!a||i.current||!x||J(x)&&!window.ethereum)return;const E=setTimeout(()=>{i.current=!0,r(x)},100);return()=>clearTimeout(E)},[a,x,r]),{loginMethod:y,autoLoginTriggered:i.current,resolvedConnectionOption:x}},ht=pe,mt=({open:a,onContinue:r,onClose:c})=>{const{t:i}=A();return e.jsxs(xe,{open:a,maxWidth:"xs",fullWidth:!0,children:[e.jsx(Ve,{onClick:c,"data-testid":"clock-sync-close-button",children:e.jsx(ht,{})}),e.jsxs(ze,{children:[e.jsx(Ke,{src:qe,alt:"warning"}),e.jsx(He,{children:i("clock_sync_modal.title")}),e.jsx(Ze,{children:i("clock_sync_modal.message")}),e.jsx(Je,{children:e.jsx(Qe,{variant:"contained",onClick:r,"data-testid":"clock-sync-continue-button",children:i("clock_sync_modal.continue_to_site")})})]})]})},wt=async a=>{await ye(a)},Ct=async(a,r)=>Xe(a,r),ft=a=>{const{open:r,email:c,onClose:i,onBack:g,onSuccess:y}=a,{t:l}=A(),x=t.useCallback(async(b,f)=>{const k=await Ct(b,f);return localStorage.setItem("dcl_thirdweb_user_email",b),{email:b,address:k}},[]),{otp:j,error:E,isLoading:h,hasError:m,otpInputRefs:p,handleOtpChange:R,handleOtpKeyDown:C,handleOtpPaste:P,handleResendOtp:L,isResendDisabled:_,resendText:W}=Ye({open:r,email:c,verify:x,resend:wt,onSuccess:y}),z=t.useCallback(()=>{h||i()},[h,i]),K=t.useCallback(()=>{h||g()},[h,g]),N=()=>e.jsxs(cn,{children:[e.jsx(dn,{children:e.jsx(un,{src:gn,alt:""})}),e.jsx(hn,{children:l("email_login_modal.title")}),e.jsxs(mn,{children:[l("email_login_modal.subtitle_prefix"),e.jsx("strong",{children:c}),l("email_login_modal.subtitle_suffix")]}),e.jsx(wn,{hasError:m,children:j.map((b,f)=>e.jsx(Cn,{"data-testid":`otp-input-${f}`,ref:k=>{p.current[f]=k},type:"text",inputMode:"numeric",maxLength:1,value:b,onChange:k=>R(f,k.target.value),onKeyDown:k=>C(f,k),onPaste:P,hasError:m,disabled:h,autoComplete:"one-time-code"},f))}),h&&!E&&e.jsxs(fn,{children:[e.jsx(xn,{size:16}),e.jsx(pn,{children:l("email_login_modal.verifying")})]}),E&&e.jsxs(e.Fragment,{children:[e.jsx(kn,{children:E}),e.jsx(yn,{disabled:_,onClick:_?void 0:L,children:W})]}),!E&&e.jsxs(En,{children:[l("email_login_modal.didnt_get_email"),e.jsx(Sn,{disabled:_,onClick:_?void 0:L,children:W})]})]});return e.jsxs(e.Fragment,{children:[r&&e.jsx(De,{styles:en}),e.jsxs(nn,{open:r,maxWidth:"sm",fullWidth:!0,className:tn,children:[e.jsxs(an,{children:[e.jsxs(sn,{onClick:K,disabled:h,"data-testid":"email-login-back-button",children:[e.jsx(on,{children:"‹"})," ",l("email_login_modal.back")]}),e.jsx(rn,{onClick:z,disabled:h,"data-testid":"email-login-close-button",children:"×"})]}),e.jsx(ln,{children:N()})]})]})},xt=pe,pt=({open:a,onTryAgain:r,onClose:c})=>{const{t:i}=A();return e.jsx(xe,{open:a,onClose:c,"aria-label":i("wallet_error_modal.title"),PaperProps:{sx:{background:"transparent",boxShadow:"none",overflow:"visible"}},slotProps:{backdrop:{sx:{backgroundColor:"rgba(0, 0, 0, 0.6)"}}},children:e.jsxs(jn,{children:[e.jsx(Ln,{onClick:c,"aria-label":i("common.close_window"),"data-testid":"wallet-error-close-button",children:e.jsx(xt,{sx:{fontSize:14}})}),e.jsx(_n,{children:e.jsxs("svg",{width:"30",height:"27",viewBox:"0 0 30 27",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M13.268 1.5C14.0378 0.166667 15.9623 0.166667 16.7321 1.5L28.8565 22.5C29.6263 23.8333 28.664 25.5 27.1244 25.5H2.87565C1.33605 25.5 0.373749 23.8333 1.14355 22.5L13.268 1.5Z",fill:"white",fillOpacity:"0",stroke:"white",strokeWidth:"2"}),e.jsx("path",{d:"M15 9V16",stroke:"white",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("circle",{cx:"15",cy:"20.5",r:"1.5",fill:"white"})]})}),e.jsx(bn,{children:i("wallet_error_modal.message")}),e.jsx(In,{variant:"contained",onClick:r,"data-testid":"wallet-error-try-again-button",children:i("wallet_error_modal.try_again")})]})})},kt=({error:a,onError:r})=>{const{t:c}=A();return a?e.jsxs(le,{children:[e.jsx(ce,{variant:"absolute"}),e.jsxs(de,{children:[e.jsx(ie,{size:"huge"}),e.jsx(ue,{children:c("common.something_went_wrong")}),e.jsx(Tn,{children:a}),r&&e.jsx(Mn,{onClick:r,"data-testid":"confirming-login-retry-button",children:c("common.try_again")})]})]}):e.jsxs(le,{children:[e.jsx(ce,{variant:"absolute"}),e.jsxs(de,{children:[e.jsx(ie,{size:"huge"}),e.jsx(ue,{children:c("login.confirming_login")}),e.jsx(On,{children:e.jsx(ke,{color:"inherit",size:40})})]})]})},fe=[st,ot,rt,it,lt,ct],yt=["newUser","newuser","new-user","new_user"],bt=()=>{const{t:a}=A(),[r,c]=t.useState(yt.some(n=>new URLSearchParams(window.location.search).has(n))),[i,g]=t.useState(S.CONNECTING_WALLET),[y,l]=t.useState(!1),[x,j]=t.useState(!1),[E,h]=t.useState(!1),[m,p]=t.useState(),{redirect:R,redirectTo:C,skipSetup:P}=vn(),{initialized:L,flags:_,variants:W}=t.useContext(An),z=Rn(W),[K,N]=t.useState(()=>new URLSearchParams(window.location.search).get("walletError")==="rejected"),[b,f]=t.useState(""),[k,Q]=t.useState(!1),[Ee,O]=t.useState(null),[Se,B]=t.useState(!1),[X,q]=t.useState(null),Y=t.useMemo(()=>{if(!C)return"";try{const n=C.startsWith("/")?new URL(C,window.location.origin):new URL(C);return n.pathname.includes("/play")?(n.searchParams.append("guest","true"),n.toString()):""}catch{return""}},[C]),je=!!Y,[H,Le]=t.useState(0),[_e,ee]=t.useState(0),[Z,ne]=t.useState(!1),[be]=Pn(),{ensureProfile:te}=Wn(),{identity:ae,getIdentitySignature:U}=Nn(),{trackLoginClick:G,trackLoginSuccess:D,trackGuestLogin:se}=Bn(),Ie=t.useCallback(async()=>{await se()},[se]),I=t.useCallback(()=>{const n=new URLSearchParams(window.location.search);return Un(n)},[]),T=t.useCallback(async(n,s,o=null,w)=>{!P&&n&&!await te(n,o??ae,{redirectTo:C,referrer:s})||(Gn(n),R(),w==null||w())},[P,C,ae,te,R]),$=t.useCallback(async()=>await Dn()?!0:(l(!1),j(!0),!1),[]),Te=t.useCallback(async n=>{f(n),Q(!0),O(null),p(u.EMAIL),G({method:u.EMAIL,type:V.WEB2});try{await $n.disconnect(),await Fn()}catch{}ge({checkpointId:2,action:"reached",source:"auth",userIdentifier:n,identifierType:"email",email:n,metadata:{loginMethod:u.EMAIL}});try{await ye(n),h(!0)}catch(s){const o=v(s,"Error sending verification code");p(void 0),o==="Failed to fetch"||o!=null&&o.toLowerCase().includes("network")?O(a("login.errors.network_error")):o!=null&&o.toLowerCase().includes("invalid email")?O(a("login.errors.invalid_email")):O(o||a("login.errors.failed_send_code"))}finally{Q(!1)}},[G,a]),M=t.useCallback(async n=>{var w,F;if(!L)return;if(n===u.EMAIL){const d=document.getElementById("dcl-email-input");d&&(d.scrollIntoView({behavior:"smooth",block:"center"}),d.focus());return}const s=Vn(n),o=s?V.WEB2:V.WEB3;p(n),G({method:n,type:o});try{if(s)l(!0),g(S.LOADING_MAGIC),await zn(n,Kn(_[he.MAGIC_TEST]),C);else{if(J(n)&&!window.ethereum)throw new Error("No wallet extension detected. Please install MetaMask or another Ethereum wallet.");l(!0),g(S.CONNECTING_WALLET);const d=await me(n);ge({checkpointId:2,action:"reached",source:"auth",userIdentifier:((w=d.account)==null?void 0:w.toLowerCase())??"",identifierType:"wallet",wallet:(F=d.account)==null?void 0:F.toLowerCase(),metadata:{loginMethod:n}}),g(S.WAITING_FOR_SIGNATURE);const Ue=await U(d);localStorage.removeItem("dcl_thirdweb_user_email"),localStorage.removeItem("dcl_magic_user_email"),await D({ethAddress:d.account??void 0,type:o});const Ge=I();await $()&&await T(d.account??"",Ge,Ue,()=>l(!1))}}catch(d){qn(d)?console.info("User rejected login signature in wallet — not reporting to Sentry"):v(d,"Error during login connection",{sentryTags:{isWeb2Wallet:s,connectionType:n}}),Hn(d)&&d.name==="ErrorUnlockingWallet"?g(S.ERROR_LOCKED_WALLET):g(S.ERROR)}},[g,l,p,C,_[he.MAGIC_TEST],G,D,T,L,$,I,U]),Me=t.useCallback(()=>{l(!1),p(void 0),g(S.CONNECTING_WALLET)},[l]),Oe=t.useCallback(()=>{N(!1);const n=new URLSearchParams(window.location.search);n.delete("walletError");const s=n.toString(),o=`${window.location.pathname}${s?`?${s}`:""}`;window.history.replaceState({},"",o)},[]),ve=t.useCallback(()=>{N(!1);const n=new URLSearchParams(window.location.search);n.delete("walletError");const s=n.toString(),o=`${window.location.pathname}${s?`?${s}`:""}`;window.history.replaceState({},"",o),M(u.METAMASK)},[M]),Ae=t.useCallback(()=>{h(!1),f(""),p(void 0)},[]),Re=t.useCallback(()=>{h(!1),f(""),p(void 0)},[]),Pe=t.useCallback(async n=>{h(!1),B(!0),q(null);try{const s=n.address.toLowerCase(),o=await U();await D({ethAddress:s,type:V.WEB2});const w=I();await $()?await T(s,w,o,()=>B(!1)):B(!1)}catch(s){const o=v(s,"Error completing email login",{sentryTags:{connectionType:u.EMAIL}});q(o||a("login.errors.something_went_wrong"))}},[D,$,T,I,U,a]),We=t.useCallback(()=>{O(null)},[]),Ne=t.useCallback(()=>{B(!1),q(null),h(!0)},[]);gt({isReady:L,onConnect:M});const Be=t.useCallback(()=>{m&&M(m)},[m,M]),oe=t.useCallback(async()=>{if(j(!1),!m)return;const n=I();if(J(m)&&!window.ethereum){v(new Error("No wallet extension detected"),"Wallet extension not available for clock sync continue");return}try{const s=await me(m);await T(s.account??"",n,null,()=>l(!1))}catch(s){v(s,"Error during clock sync continue flow"),g(S.ERROR),l(!0)}},[m,T,I]);if(t.useEffect(()=>{const s=fe.length-1,o=setInterval(()=>{Le(w=>(ee(w),ne(!0),w>=s?0:w+1))},5e3);return()=>clearInterval(o)},[]),t.useEffect(()=>{if(!Z)return;const n=setTimeout(()=>{ee(H),ne(!1)},1e3);return()=>clearTimeout(n)},[Z,H]),!L)return e.jsx(we,{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx(ke,{size:80})});const re=fe;return e.jsxs(we,{children:[e.jsx($e,{children:e.jsxs(Zn,{children:[e.jsx(Ce,{isVisible:!0,style:{backgroundImage:`url(${re[_e]})`},"aria-hidden":!0}),e.jsx(Ce,{isVisible:Z,style:{backgroundImage:`url(${re[H]})`},"aria-hidden":!0})]})}),Se&&!x&&e.jsx(kt,{error:X,onError:X?Ne:void 0}),e.jsx(pt,{open:K,onTryAgain:ve,onClose:Oe}),e.jsx(mt,{open:x,onContinue:oe,onClose:oe}),e.jsx(Jn,{open:y,state:i,onClose:Me,onTryAgain:Be,providerType:m?Qn(m):null}),e.jsx(ft,{open:E,email:b,onClose:Ae,onBack:Re,onSuccess:Pe}),e.jsx(Xn,{children:e.jsxs(Yn,{children:[e.jsxs(et,{children:[e.jsx(nt,{onConnect:M,onEmailSubmit:Te,onEmailChange:We,loadingOption:m,connectionOptions:be.connectionOptions,isNewUser:r,signInOptionsMode:z,isEmailLoading:k,emailError:Ee}),r&&e.jsxs(tt,{children:[a("login.already_have_account")," ",e.jsx("span",{onClick:()=>c(!1),children:a("login.sign_in")})]})]}),je&&e.jsxs(at,{children:[a("login.quick_dive")," ",e.jsx("a",{href:Y,onClick:Ie,children:a("login.explore_as_guest")})]})]})})]})};export{bt as LoginPage};
@@ -1 +0,0 @@
1
- import{g as r}from"./thirdweb-D3S3QNoz.js";import{r as o}from"./index-CUHQgubq.js";var t=o();const f=r(t);export{f as o};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-C_JmLWxx.js","assets/ui-am1Nr89z.js","assets/vendor-fOKayE99.js","assets/thirdweb-D3S3QNoz.js","assets/wallets-BQ-Ff9kc.js","assets/store-CraP4F4Y.js","assets/index-CUHQgubq.js","assets/index-WlYrqZYZ.css","assets/index-C-CaajUq.js","assets/index-BbxpfO0Z.js","assets/index-nibyPLVP.js","assets/ethereum-DX4J06qQ.js","assets/index.es-BKmMwunl.js","assets/browser-ponyfill-BJn8N62z.js"])))=>i.map(i=>d[i]);
2
- import{b as T,_ as G,e as R,s as V,f as v,U as J,S as K,h as X,v as Y,i as B,j as Q,u as Z,n as I,t as H}from"./thirdweb-D3S3QNoz.js";import{a as x,b as U,N as W,n as D,s as O,D as nn,c as E,f as an,p as en}from"./wallets-BQ-Ff9kc.js";import"./store-CraP4F4Y.js";import"./ui-am1Nr89z.js";import"./vendor-fOKayE99.js";import"./index-CUHQgubq.js";import"./index-C-CaajUq.js";import"./index-BbxpfO0Z.js";import"./index-nibyPLVP.js";import"./ethereum-DX4J06qQ.js";let y=null;const b={lastUsedChainId:"tw.wc.lastUsedChainId",requestedChains:"tw.wc.requestedChains"};async function gn(n,i,e,t,a){var A,N,S;const s=await $(n,e,a),o=n.walletConnect;let{onDisplayUri:c}=o||{};const d=await U(e);!c&&a&&(c=q=>{const L=d.mobile.native||d.mobile.universal;if(!L){a(q);return}const z=an(L,q).redirect;a(z)}),c&&s.events.addListener("display_uri",c);let l=o==null?void 0:o.optionalChains;const u=n.chain;e==="global.safe"&&(l=dn.map(T));const{chains:h,rpcMap:r}=rn({chain:u,client:n.client,optionalChains:l});await s.connect({...o!=null&&o.pairingTopic?{pairingTopic:o==null?void 0:o.pairingTopic}:{},optionalNamespaces:{[W]:{chains:h,events:["chainChanged","accountsChanged"],methods:["eth_sendTransaction","eth_signTransaction","eth_sign","personal_sign","eth_signTypedData","eth_signTypedData_v4","wallet_switchEthereumChain","wallet_addEthereumChain"],rpcMap:r}}}),F(h.map(_=>Number(_.split(":")[1])),t);const m=((A=h[0])==null?void 0:A.split(":")[1])||1,f=D(m),C=cn(s.session,"eip155:1");if(!C)throw new Error("No accounts found on provider.");const g=n.chain&&n.chain.id===f?n.chain:T(f);if(n){const _={chain:n.chain,optionalChains:(N=n.walletConnect)==null?void 0:N.optionalChains,pairingTopic:(S=n.walletConnect)==null?void 0:S.pairingTopic};t&&O(t,e,_)}return c&&s.events.removeListener("display_uri",c),k(C,g,s,i,t,n.client,d,a)}async function tn(n,i,e){var o,c,d,l,u,h;if(!n.session)throw new Error("No session found on provider.");const t=`eip155:${i.id}`,a=I(i.id);if(M(n.session,t)){n.setDefaultChain(t);return}try{await w({provider:n,payload:{method:"wallet_switchEthereumChain",params:[{chainId:a}]},chain:t,walletInfo:e}),n.setDefaultChain(t);return}catch(r){if(((r==null?void 0:r.code)??((c=(o=r==null?void 0:r.data)==null?void 0:o.originalError)==null?void 0:c.code))===4001)throw new Error("User rejected chain switch")}const s=sn(n.session);if(!s)throw new Error("No routable chain to send wallet_addEthereumChain");try{await w({provider:n,payload:{method:"wallet_addEthereumChain",params:[{chainId:a,chainName:i.name,nativeCurrency:i.nativeCurrency,rpcUrls:[i.rpc],blockExplorerUrls:[((l=(d=i.blockExplorers)==null?void 0:d[0])==null?void 0:l.url)??""]}]},chain:s,walletInfo:e})}catch(r){throw((r==null?void 0:r.code)??((h=(u=r==null?void 0:r.data)==null?void 0:u.originalError)==null?void 0:h.code))===4001?new Error("User rejected add chain"):new Error(`Add chain failed: ${(r==null?void 0:r.message)||String(r)}`)}if(await w({provider:n,payload:{method:"wallet_switchEthereumChain",params:[{chainId:a}]},chain:t,walletInfo:e}),n.setDefaultChain(t),!M(n.session,t))throw new Error("Target chain still not enabled by wallet")}function P(n){var i;return(i=n==null?void 0:n.namespaces)==null?void 0:i.eip155}function M(n,i){var t;const e=P(n);return!!((t=e==null?void 0:e.accounts)!=null&&t.some(a=>a.startsWith(`${i}:`)))}function cn(n,i){var a;const e=P(n),t=((a=e==null?void 0:e.accounts)==null?void 0:a.find(s=>s.startsWith(`${i}:`)))||(e==null?void 0:e.accounts[0]);return t?t.split(":")[2]??null:null}function sn(n){var e,t,a,s;const i=P(n);return((s=(a=(t=(e=i==null?void 0:i.accounts)==null?void 0:e[0])==null?void 0:t.split(":"))==null?void 0:a.slice(0,2))==null?void 0:s.join(":"))??null}async function _n(n,i,e,t,a){var m,f,p,C,g;const s=t?await x(t,e):null,o=await U(e),c=await $(s?{chain:s.chain,client:n.client,walletConnect:{optionalChains:s.optionalChains,pairingTopic:s.pairingTopic}}:{client:n.client,walletConnect:{}},e,a);if(!c.session)throw await c.disconnect(),new Error("No wallet connect session found on provider.");const d=(p=(f=(m=c.session)==null?void 0:m.namespaces)==null?void 0:f[W])==null?void 0:p.accounts,l=(C=d==null?void 0:d[0])==null?void 0:C.split(":")[2];if(!l)throw new Error("No accounts found on provider.");const u=((g=n.chain)==null?void 0:g.id)||1,h=D(u),r=n.chain&&n.chain.id===h?n.chain:T(h);return k(l,r,c,i,t,n.client,o,a)}async function $(n,i,e){var c,d,l,u;if(y)return y;const t=await U(i),a=n.walletConnect,{UniversalProvider:s}=await G(async()=>{const{UniversalProvider:h}=await import("./index.es-C_JmLWxx.js");return{UniversalProvider:h}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])),o=await s.init({metadata:{description:((c=a==null?void 0:a.appMetadata)==null?void 0:c.description)||E().description,icons:[((d=a==null?void 0:a.appMetadata)==null?void 0:d.logoUrl)||E().logoUrl],name:((l=a==null?void 0:a.appMetadata)==null?void 0:l.name)||E().name,url:((u=a==null?void 0:a.appMetadata)==null?void 0:u.url)||E().url,redirect:{native:t.mobile.native||void 0,universal:t.mobile.universal||void 0}},projectId:(a==null?void 0:a.projectId)||nn});if(o.events.setMaxListeners(Number.POSITIVE_INFINITY),i!=="walletConnect"){async function h(){var m,f,p,C;const r=((C=(p=(f=(m=o.session)==null?void 0:m.peer)==null?void 0:f.metadata)==null?void 0:p.redirect)==null?void 0:C.native)||t.mobile.native||t.mobile.universal;e&&r&&await e(r)}o.on("session_request_sent",h),o.events.addListener("disconnect",()=>{o.off("session_request_sent",h),y=null})}return y=o,o}function j({provider:n,address:i,client:e,chain:t,sessionRequestHandler:a,walletInfo:s}){return{address:v(i),async sendTransaction(c){const d=await w({provider:n,payload:{method:"eth_sendTransaction",params:[{data:c.data,from:v(i),gas:c.gas?I(c.gas):void 0,to:c.to,value:c.value?I(c.value):void 0}]},chain:`eip155:${c.chainId}`,walletInfo:s,sessionRequestHandler:a});return H({chainId:c.chainId,client:e,contractAddress:c.to??void 0,gasPrice:c.gasPrice,transactionHash:d,walletAddress:v(i),walletType:"walletConnect"}),{transactionHash:d}},async signMessage({message:c}){const d=typeof c=="string"?Q(c):c.raw instanceof Uint8Array?Z(c.raw):c.raw;return w({provider:n,payload:{method:"personal_sign",params:[d,this.address]},chain:`eip155:${t.id}`,walletInfo:s,sessionRequestHandler:a})},async signTypedData(c){const d=en(c),{domain:l,message:u,primaryType:h}=d,r={EIP712Domain:X({domain:l}),...d.types};Y({domain:l,message:u,primaryType:h,types:r});const m=B({domain:l??{},message:u,primaryType:h,types:r});return await w({provider:n,payload:{method:"eth_signTypedData_v4",params:[this.address,m]},chain:`eip155:${t.id}`,walletInfo:s,sessionRequestHandler:a})}}}async function w(n){var d,l,u,h;const{provider:i,payload:e,chain:t,walletInfo:a,sessionRequestHandler:s}=n,o=i.request(e,t),c=((h=(u=(l=(d=i.session)==null?void 0:d.peer)==null?void 0:l.metadata)==null?void 0:u.redirect)==null?void 0:h.native)||a.mobile.native||a.mobile.universal;return s&&c&&await s(c),o}function k(n,i,e,t,a,s,o,c){const d=j({address:n,chain:i,client:s,provider:e,sessionRequestHandler:c,walletInfo:o});async function l(){e.removeListener("accountsChanged",h),e.removeListener("chainChanged",r),e.removeListener("disconnect",u),await e.disconnect(),y=null}function u(){F([],a),a==null||a.removeItem(b.lastUsedChainId),l(),t.emit("disconnect",void 0)}function h(m){if(m[0]){const f=j({address:v(m[0]),chain:i,client:s,provider:e,sessionRequestHandler:c,walletInfo:o});t.emit("accountChanged",f),t.emit("accountsChanged",m)}else u()}function r(m){const f=T(D(m));t.emit("chainChanged",f),a==null||a.setItem(b.lastUsedChainId,String(m))}return e.on("accountsChanged",h),e.on("chainChanged",r),e.on("disconnect",u),e.on("session_delete",u),[d,i,l,m=>on(e,m,o)]}async function on(n,i,e){try{await tn(n,i,e)}catch(t){const a=typeof t=="string"?t:t==null?void 0:t.message;throw/user rejected request/i.test(a)?new J(t):new K(t)}}function F(n,i){i==null||i.setItem(b.requestedChains,V(n))}function rn(n){const i={},e=[];n.chain&&(i[n.chain.id]=R({chain:n.chain,client:n.client}),e.push(n.chain.id));const t=((n==null?void 0:n.optionalChains)||[]).slice(0,10);for(const a of t)i[a.id]=R({chain:a,client:n.client}),e.push(a.id);return e.includes(1)||(i[1]=T(1).rpc,e.push(1)),{chains:e.map(a=>`eip155:${a}`),rpcMap:i}}const dn=[1,11155111,42161,43114,8453,1313161554,84532,56,42220,100,10,137,1101,324,534352,80094];export{_n as autoConnectWC,gn as connectWC};
@@ -1 +0,0 @@
1
- import{F as _,X as F}from"./thirdweb-D3S3QNoz.js";const V="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",U=V.length,L=V.charAt(0),M=Math.log(256)/Math.log(U);function z(t){if(!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length===0)return"";let e=0,i=0,n=0;const s=t.length;for(;n!==s&&t[n]===0;)n++,e++;const c=(s-n)*M+1>>>0,a=new Uint8Array(c);for(;n!==s;){let d=t[n]||0,w=0;for(let h=c-1;(d!==0||w<i)&&h!==-1;h--,w++)d+=256*(a[h]||0)>>>0,a[h]=d%U>>>0,d=d/U>>>0;if(d!==0)throw new Error("Non-zero carry");i=w,n++}let l=c-i;for(;l!==c&&a[l]===0;)l++;let u=L.repeat(e);for(;l<c;++l)u+=V.charAt(a[l]||0);return u}let o,E,r=0,j={},b,N;const D=0;let C=0,S,R,I;const $={mapsAsObjects:!0,useRecords:!1};function v(t){let e;if(t<16&&(e=T(t)))return e;if(t>64&&decoder)return decoder.decode(o.subarray(r,r+=t));const i=r+t,n=[];for(e="";r<i;){const s=o[r++];if(!(s&128))n.push(s);else if((s&224)===192){const c=o[r++]&63;n.push((s&31)<<6|c)}else if((s&240)===224){const c=o[r++]&63,a=o[r++]&63;n.push((s&31)<<12|c<<6|a)}else if((s&248)===240){const c=o[r++]&63,a=o[r++]&63,l=o[r++]&63;let u=(s&7)<<18|c<<12|a<<6|l;u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|u&1023),n.push(u)}else n.push(s);n.length>=4096&&(e+=x.apply(String,n),n.length=0)}return n.length>0&&(e+=x.apply(String,n)),e}class O{constructor(){Object.assign(this,$)}decodeKey(e){return e}decode(e,i=-1){E=i>-1?i:e.length,r=0,C=0,N=null,S=null,o=e;try{I=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(n){throw o=null,e instanceof Uint8Array?n:new Error(`Source must be a Uint8Array or Buffer but was a ${e&&typeof e=="object"?e.constructor.name:typeof e}`)}return this instanceof O?(j=this,this.sharedValues&&(this.pack?new Array(this.maxPrivatePackedValues||16).concat(this.sharedValues):this.sharedValues),(!b||b.length>0)&&(b=[])):(j=$,(!b||b.length>0)&&(b=[])),H()}}function H(){try{const t=g();if(S){if(r>=S.postBundlePosition){const e=new Error("Unexpected bundle position");throw e.incomplete=!0,e}r=S.postBundlePosition,S=null}if(r===E)b=null,o=null,R&&(R=null);else if(r>E){const e=new Error("Unexpected end of CBOR data");throw e.incomplete=!0,e}else throw new Error("Data read, but end of buffer not reached");return t}catch(t){throw X(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer"))&&(t.incomplete=!0),t}}function g(){let t=o[r++];const e=t>>5;if(t=t&31,t>23)switch(t){case 24:t=o[r++];break;default:throw new Error(`Unknown token ${t}`)}switch(e){case 0:return t;case 1:return~t;case 2:return W(t);case 3:if(C>=r)return N.slice(r-D,(r+=t)-D);if(C===0&&E<140&&t<32){const i=t<16?T(t):K(t);if(i!==null)return i}return v(t);case 4:{const i=new Array(t);for(let n=0;n<t;n++)i[n]=g();return i}case 5:{const i={};for(let n=0;n<t;n++)i[J(g())]=g();return i}default:if(Number.isNaN(t)){const i=new Error("Unexpected end of CBOR data");throw i.incomplete=!0,i}throw new Error(`Unknown CBOR token ${t}`)}}function J(t){if(typeof t=="string")return t==="__proto__"?"__proto_":t;if(typeof t!="object")return t.toString();throw new Error(`Invalid property name type ${typeof t}`)}const x=String.fromCharCode;function K(t){const e=r,i=new Array(t);for(let n=0;n<t;n++){const s=o[r++];if((s&128)>0){r=e;return}i[n]=s}return x.apply(String,i)}function T(t){if(t<4){if(t<2){if(t===0)return"";const k=o[r++];if((k&128)>1){r-=1;return}return x(k)}const f=o[r++],p=o[r++];if((f&128)>0||(p&128)>0){r-=2;return}if(t<3)return x(f,p);const y=o[r++];if((y&128)>0){r-=3;return}return x(f,p,y)}const e=o[r++],i=o[r++],n=o[r++],s=o[r++];if((e&128)>0||(i&128)>0||(n&128)>0||(s&128)>0){r-=4;return}if(t<6){if(t===4)return x(e,i,n,s);const f=o[r++];if((f&128)>0){r-=5;return}return x(e,i,n,s,f)}if(t<8){const f=o[r++],p=o[r++];if((f&128)>0||(p&128)>0){r-=6;return}if(t<7)return x(e,i,n,s,f,p);const y=o[r++];if((y&128)>0){r-=7;return}return x(e,i,n,s,f,p,y)}const c=o[r++],a=o[r++],l=o[r++],u=o[r++];if((c&128)>0||(a&128)>0||(l&128)>0||(u&128)>0){r-=8;return}if(t<10){if(t===8)return x(e,i,n,s,c,a,l,u);const f=o[r++];if((f&128)>0){r-=9;return}return x(e,i,n,s,c,a,l,u,f)}if(t<12){const f=o[r++],p=o[r++];if((f&128)>0||(p&128)>0){r-=10;return}if(t<11)return x(e,i,n,s,c,a,l,u,f,p);const y=o[r++];if((y&128)>0){r-=11;return}return x(e,i,n,s,c,a,l,u,f,p,y)}const d=o[r++],w=o[r++],h=o[r++],m=o[r++];if((d&128)>0||(w&128)>0||(h&128)>0||(m&128)>0){r-=12;return}if(t<14){if(t===12)return x(e,i,n,s,c,a,l,u,d,w,h,m);const f=o[r++];if((f&128)>0){r-=13;return}return x(e,i,n,s,c,a,l,u,d,w,h,m,f)}const A=o[r++],B=o[r++];if((A&128)>0||(B&128)>0){r-=14;return}if(t<15)return x(e,i,n,s,c,a,l,u,d,w,h,m,A,B);const P=o[r++];if((P&128)>0){r-=15;return}return x(e,i,n,s,c,a,l,u,d,w,h,m,A,B,P)}function W(t){return j.copyBuffers?Uint8Array.prototype.slice.call(o,r,r+=t):o.subarray(r,r+=t)}function X(){o=null,R=null,b=null}const q=new Array(147);for(let t=0;t<256;t++)q[t]=+`1e${Math.floor(45.15-t*.30103)}`;const G=new O,Q=G.decode;function Y(t){return _(t,{strict:!1})?t:`0x${t}`}function tt(t){const e=F(Y(t)),i=e[e.length-2]*256+e[e.length-1],n=e.length-2-i;if(n<0||n>e.length)return;const s=e.slice(n,-2),c=Q(s);if("ipfs"in c)return`ipfs://${z(c.ipfs)}`}export{tt as extractIPFSUri};
@@ -1 +0,0 @@
1
- import{g as o}from"./wallets-BQ-Ff9kc.js";import"./thirdweb-D3S3QNoz.js";import"./store-CraP4F4Y.js";import"./ui-am1Nr89z.js";import"./vendor-fOKayE99.js";import"./index-CUHQgubq.js";import"./index-C-CaajUq.js";import"./index-BbxpfO0Z.js";import"./index-nibyPLVP.js";import"./ethereum-DX4J06qQ.js";async function g(n){const l=await o(n);return{app:{android:null,browser:null,chrome:null,edge:null,firefox:null,ios:null,linux:null,mac:null,opera:null,safari:null,windows:null},desktop:{native:null,universal:null},homepage:l.homepage||"",id:n,image_id:l.imageUrl||"",mobile:{native:null,universal:null},name:l.name,rdns:null}}export{g as getEcosystemWalletInfo};
@@ -1 +0,0 @@
1
- import{r as X,Y as ge,$ as we,_ as Ce,a0 as Te,a1 as Ne}from"./thirdweb-D3S3QNoz.js";const Oe="0x70a08231",Se=[{name:"_address",type:"address"}],Ae=[{type:"uint256"}];async function Ze(r){return X({contract:r.contract,method:[Oe,Se,Ae],params:[r.address]})}var g;(function(r){r.assertEqual=a=>{};function e(a){}r.assertIs=e;function t(a){throw new Error}r.assertNever=t,r.arrayToEnum=a=>{const n={};for(const i of a)n[i]=i;return n},r.getValidEnumValues=a=>{const n=r.objectKeys(a).filter(d=>typeof a[a[d]]!="number"),i={};for(const d of n)i[d]=a[d];return r.objectValues(i)},r.objectValues=a=>r.objectKeys(a).map(function(n){return a[n]}),r.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const n=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&n.push(i);return n},r.find=(a,n)=>{for(const i of a)if(n(i))return i},r.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function s(a,n=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}r.joinValues=s,r.jsonStringifyReplacer=(a,n)=>typeof n=="bigint"?n.toString():n})(g||(g={}));var ee;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(ee||(ee={}));const u=g.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),T=r=>{switch(typeof r){case"undefined":return u.undefined;case"string":return u.string;case"number":return Number.isNaN(r)?u.nan:u.number;case"boolean":return u.boolean;case"function":return u.function;case"bigint":return u.bigint;case"symbol":return u.symbol;case"object":return Array.isArray(r)?u.array:r===null?u.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?u.promise:typeof Map<"u"&&r instanceof Map?u.map:typeof Set<"u"&&r instanceof Set?u.set:typeof Date<"u"&&r instanceof Date?u.date:u.object;default:return u.unknown}},c=g.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class C extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(n){return n.message},s={_errors:[]},a=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let d=s,h=0;for(;h<i.path.length;){const f=i.path[h];h===i.path.length-1?(d[f]=d[f]||{_errors:[]},d[f]._errors.push(t(i))):d[f]=d[f]||{_errors:[]},d=d[f],h++}}};return a(this),s}static assert(e){if(!(e instanceof C))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,g.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const a of this.issues)if(a.path.length>0){const n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else s.push(e(a));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}C.create=r=>new C(r);const Y=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===u.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,g.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${g.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${g.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${g.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:g.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,g.assertNever(r)}return{message:t}};let Re=Y;function Ie(){return Re}const Ee=r=>{const{data:e,path:t,errorMaps:s,issueData:a}=r,n=[...t,...a.path||[]],i={...a,path:n};if(a.message!==void 0)return{...a,path:n,message:a.message};let d="";const h=s.filter(f=>!!f).slice().reverse();for(const f of h)d=f(i,{data:e,defaultError:d}).message;return{...a,path:n,message:d}};function o(r,e){const t=Ie(),s=Ee({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Y?void 0:Y].filter(a=>!!a)});r.common.issues.push(s)}class k{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const a of t){if(a.status==="aborted")return m;a.status==="dirty"&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const a of t){const n=await a.key,i=await a.value;s.push({key:n,value:i})}return k.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const a of t){const{key:n,value:i}=a;if(n.status==="aborted"||i.status==="aborted")return m;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(s[n.value]=i.value)}return{status:e.value,value:s}}}const m=Object.freeze({status:"aborted"}),M=r=>({status:"dirty",value:r}),b=r=>({status:"valid",value:r}),te=r=>r.status==="aborted",re=r=>r.status==="dirty",I=r=>r.status==="valid",D=r=>typeof Promise<"u"&&r instanceof Promise;var l;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(l||(l={}));class S{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const se=(r,e)=>{if(I(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new C(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:a}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,d)=>{const{message:h}=r;return i.code==="invalid_enum_value"?{message:h??d.defaultError}:typeof d.data>"u"?{message:h??s??d.defaultError}:i.code!=="invalid_type"?{message:d.defaultError}:{message:h??t??d.defaultError}},description:a}}class y{get description(){return this._def.description}_getType(e){return T(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:T(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new k,ctx:{common:e.parent.common,data:e.data,parsedType:T(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(D(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:T(e)},a=this._parseSync({data:e,path:s.path,parent:s});return se(s,a)}"~validate"(e){var s,a;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:T(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return I(n)?{value:n.value}:{issues:t.common.issues}}catch(n){(a=(s=n==null?void 0:n.message)==null?void 0:s.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>I(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:T(e)},a=this._parse({data:e,path:s.path,parent:s}),n=await(D(a)?a:Promise.resolve(a));return se(s,n)}refine(e,t){const s=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,n)=>{const i=e(a),d=()=>n.addIssue({code:c.custom,...s(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(h=>h?!0:(d(),!1)):i?!0:(d(),!1)})}refinement(e,t){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof t=="function"?t(s,a):t),!1))}_refinement(e){return new $({schema:this,typeName:p.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return O.create(this,this._def)}nullable(){return V.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return w.create(this)}promise(){return W.create(this,this._def)}or(e){return F.create([this,e],this._def)}and(e){return B.create(this,e,this._def)}transform(e){return new $({..._(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new J({..._(this._def),innerType:this,defaultValue:t,typeName:p.ZodDefault})}brand(){return new rt({typeName:p.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new G({..._(this._def),innerType:this,catchValue:t,typeName:p.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return K.create(this,e)}readonly(){return Q.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const je=/^c[^\s-]{8,}$/i,$e=/^[0-9a-z]+$/,Ve=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Pe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Me=/^[a-z0-9_-]{21}$/i,Le=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ze=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,De=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ue="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let q;const Fe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Be=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,We=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,qe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ye=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,He=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ve="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Je=new RegExp(`^${ve}$`);function xe(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Ge(r){return new RegExp(`^${xe(r)}$`)}function Qe(r){let e=`${ve}T${xe(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Xe(r,e){return!!((e==="v4"||!e)&&Fe.test(r)||(e==="v6"||!e)&&We.test(r))}function Ke(r,e){if(!Le.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function et(r,e){return!!((e==="v4"||!e)&&Be.test(r)||(e==="v6"||!e)&&qe.test(r))}class N extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.string){const n=this._getOrReturnCtx(e);return o(n,{code:c.invalid_type,expected:u.string,received:n.parsedType}),m}const s=new k;let a;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),o(a,{code:c.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),o(a,{code:c.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){const i=e.data.length>n.value,d=e.data.length<n.value;(i||d)&&(a=this._getOrReturnCtx(e,a),i?o(a,{code:c.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):d&&o(a,{code:c.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")De.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"email",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")q||(q=new RegExp(Ue,"u")),q.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"emoji",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Pe.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"uuid",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")Me.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"nanoid",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")je.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"cuid",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")$e.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"cuid2",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Ve.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"ulid",code:c.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),o(a,{validation:"url",code:c.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"regex",code:c.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),o(a,{code:c.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),o(a,{code:c.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),o(a,{code:c.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Qe(n).test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{code:c.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?Je.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{code:c.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?Ge(n).test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{code:c.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?ze.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"duration",code:c.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?Xe(e.data,n.version)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"ip",code:c.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?Ke(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"jwt",code:c.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?et(e.data,n.version)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"cidr",code:c.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?Ye.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"base64",code:c.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?He.test(e.data)||(a=this._getOrReturnCtx(e,a),o(a,{validation:"base64url",code:c.invalid_string,message:n.message}),s.dirty()):g.assertNever(n);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(a=>e.test(a),{validation:t,code:c.invalid_string,...l.errToObj(s)})}_addCheck(e){return new N({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...l.errToObj(e)})}url(e){return this._addCheck({kind:"url",...l.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...l.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...l.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...l.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...l.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...l.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...l.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...l.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...l.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...l.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...l.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...l.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...l.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...l.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...l.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...l.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...l.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...l.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...l.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...l.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...l.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...l.errToObj(t)})}nonempty(e){return this.min(1,l.errToObj(e))}trim(){return new N({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new N({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new N({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}N.create=r=>new N({checks:[],typeName:p.ZodString,coerce:(r==null?void 0:r.coerce)??!1,..._(r)});function tt(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=t>s?t:s,n=Number.parseInt(r.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return n%i/10**a}class E extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==u.number){const n=this._getOrReturnCtx(e);return o(n,{code:c.invalid_type,expected:u.number,received:n.parsedType}),m}let s;const a=new k;for(const n of this._def.checks)n.kind==="int"?g.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),o(s,{code:c.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),o(s,{code:c.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),o(s,{code:c.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?tt(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),o(s,{code:c.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),o(s,{code:c.not_finite,message:n.message}),a.dirty()):g.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,s,a){return new E({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:l.toString(a)}]})}_addCheck(e){return new E({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:l.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:l.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:l.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:l.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&g.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}E.create=r=>new E({checks:[],typeName:p.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class L extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==u.bigint)return this._getInvalidInput(e);let s;const a=new k;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),o(s,{code:c.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),o(s,{code:c.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),o(s,{code:c.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):g.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return o(t,{code:c.invalid_type,expected:u.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,s,a){return new L({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:l.toString(a)}]})}_addCheck(e){return new L({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}L.create=r=>new L({checks:[],typeName:p.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,..._(r)});class ae extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.boolean){const s=this._getOrReturnCtx(e);return o(s,{code:c.invalid_type,expected:u.boolean,received:s.parsedType}),m}return b(e.data)}}ae.create=r=>new ae({typeName:p.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class U extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.date){const n=this._getOrReturnCtx(e);return o(n,{code:c.invalid_type,expected:u.date,received:n.parsedType}),m}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return o(n,{code:c.invalid_date}),m}const s=new k;let a;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),o(a,{code:c.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),o(a,{code:c.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):g.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new U({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:l.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:l.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}U.create=r=>new U({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:p.ZodDate,..._(r)});class ne extends y{_parse(e){if(this._getType(e)!==u.symbol){const s=this._getOrReturnCtx(e);return o(s,{code:c.invalid_type,expected:u.symbol,received:s.parsedType}),m}return b(e.data)}}ne.create=r=>new ne({typeName:p.ZodSymbol,..._(r)});class ie extends y{_parse(e){if(this._getType(e)!==u.undefined){const s=this._getOrReturnCtx(e);return o(s,{code:c.invalid_type,expected:u.undefined,received:s.parsedType}),m}return b(e.data)}}ie.create=r=>new ie({typeName:p.ZodUndefined,..._(r)});class de extends y{_parse(e){if(this._getType(e)!==u.null){const s=this._getOrReturnCtx(e);return o(s,{code:c.invalid_type,expected:u.null,received:s.parsedType}),m}return b(e.data)}}de.create=r=>new de({typeName:p.ZodNull,..._(r)});class ce extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return b(e.data)}}ce.create=r=>new ce({typeName:p.ZodAny,..._(r)});class oe extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return b(e.data)}}oe.create=r=>new oe({typeName:p.ZodUnknown,..._(r)});class A extends y{_parse(e){const t=this._getOrReturnCtx(e);return o(t,{code:c.invalid_type,expected:u.never,received:t.parsedType}),m}}A.create=r=>new A({typeName:p.ZodNever,..._(r)});class ue extends y{_parse(e){if(this._getType(e)!==u.undefined){const s=this._getOrReturnCtx(e);return o(s,{code:c.invalid_type,expected:u.void,received:s.parsedType}),m}return b(e.data)}}ue.create=r=>new ue({typeName:p.ZodVoid,..._(r)});class w extends y{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==u.array)return o(t,{code:c.invalid_type,expected:u.array,received:t.parsedType}),m;if(a.exactLength!==null){const i=t.data.length>a.exactLength.value,d=t.data.length<a.exactLength.value;(i||d)&&(o(t,{code:i?c.too_big:c.too_small,minimum:d?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(o(t,{code:c.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(o(t,{code:c.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,d)=>a.type._parseAsync(new S(t,i,t.path,d)))).then(i=>k.mergeArray(s,i));const n=[...t.data].map((i,d)=>a.type._parseSync(new S(t,i,t.path,d)));return k.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new w({...this._def,minLength:{value:e,message:l.toString(t)}})}max(e,t){return new w({...this._def,maxLength:{value:e,message:l.toString(t)}})}length(e,t){return new w({...this._def,exactLength:{value:e,message:l.toString(t)}})}nonempty(e){return this.min(1,e)}}w.create=(r,e)=>new w({type:r,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,..._(e)});function R(r){if(r instanceof x){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=O.create(R(s))}return new x({...r._def,shape:()=>e})}else return r instanceof w?new w({...r._def,type:R(r.element)}):r instanceof O?O.create(R(r.unwrap())):r instanceof V?V.create(R(r.unwrap())):r instanceof Z?Z.create(r.items.map(e=>R(e))):r}class x extends y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=g.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==u.object){const f=this._getOrReturnCtx(e);return o(f,{code:c.invalid_type,expected:u.object,received:f.parsedType}),m}const{status:s,ctx:a}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),d=[];if(!(this._def.catchall instanceof A&&this._def.unknownKeys==="strip"))for(const f in a.data)i.includes(f)||d.push(f);const h=[];for(const f of i){const v=n[f],P=a.data[f];h.push({key:{status:"valid",value:f},value:v._parse(new S(a,P,a.path,f)),alwaysSet:f in a.data})}if(this._def.catchall instanceof A){const f=this._def.unknownKeys;if(f==="passthrough")for(const v of d)h.push({key:{status:"valid",value:v},value:{status:"valid",value:a.data[v]}});else if(f==="strict")d.length>0&&(o(a,{code:c.unrecognized_keys,keys:d}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const v of d){const P=a.data[v];h.push({key:{status:"valid",value:v},value:f._parse(new S(a,P,a.path,v)),alwaysSet:v in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const f=[];for(const v of h){const P=await v.key,be=await v.value;f.push({key:P,value:be,alwaysSet:v.alwaysSet})}return f}).then(f=>k.mergeObjectSync(s,f)):k.mergeObjectSync(s,h)}get shape(){return this._def.shape()}strict(e){return l.errToObj,new x({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,i;const a=((i=(n=this._def).errorMap)==null?void 0:i.call(n,t,s).message)??s.defaultError;return t.code==="unrecognized_keys"?{message:l.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new x({...this._def,unknownKeys:"strip"})}passthrough(){return new x({...this._def,unknownKeys:"passthrough"})}extend(e){return new x({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new x({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:p.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new x({...this._def,catchall:e})}pick(e){const t={};for(const s of g.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new x({...this._def,shape:()=>t})}omit(e){const t={};for(const s of g.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new x({...this._def,shape:()=>t})}deepPartial(){return R(this)}partial(e){const t={};for(const s of g.objectKeys(this.shape)){const a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()}return new x({...this._def,shape:()=>t})}required(e){const t={};for(const s of g.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof O;)n=n._def.innerType;t[s]=n}return new x({...this._def,shape:()=>t})}keyof(){return ke(g.objectKeys(this.shape))}}x.create=(r,e)=>new x({shape:()=>r,unknownKeys:"strip",catchall:A.create(),typeName:p.ZodObject,..._(e)});x.strictCreate=(r,e)=>new x({shape:()=>r,unknownKeys:"strict",catchall:A.create(),typeName:p.ZodObject,..._(e)});x.lazycreate=(r,e)=>new x({shape:r,unknownKeys:"strip",catchall:A.create(),typeName:p.ZodObject,..._(e)});class F extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function a(n){for(const d of n)if(d.result.status==="valid")return d.result;for(const d of n)if(d.result.status==="dirty")return t.common.issues.push(...d.ctx.common.issues),d.result;const i=n.map(d=>new C(d.ctx.common.issues));return o(t,{code:c.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(s.map(async n=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(a);{let n;const i=[];for(const h of s){const f={...t,common:{...t.common,issues:[]},parent:null},v=h._parseSync({data:t.data,path:t.path,parent:f});if(v.status==="valid")return v;v.status==="dirty"&&!n&&(n={result:v,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;const d=i.map(h=>new C(h));return o(t,{code:c.invalid_union,unionErrors:d}),m}}get options(){return this._def.options}}F.create=(r,e)=>new F({options:r,typeName:p.ZodUnion,..._(e)});function H(r,e){const t=T(r),s=T(e);if(r===e)return{valid:!0,data:r};if(t===u.object&&s===u.object){const a=g.objectKeys(e),n=g.objectKeys(r).filter(d=>a.indexOf(d)!==-1),i={...r,...e};for(const d of n){const h=H(r[d],e[d]);if(!h.valid)return{valid:!1};i[d]=h.data}return{valid:!0,data:i}}else if(t===u.array&&s===u.array){if(r.length!==e.length)return{valid:!1};const a=[];for(let n=0;n<r.length;n++){const i=r[n],d=e[n],h=H(i,d);if(!h.valid)return{valid:!1};a.push(h.data)}return{valid:!0,data:a}}else return t===u.date&&s===u.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class B extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(n,i)=>{if(te(n)||te(i))return m;const d=H(n.value,i.value);return d.valid?((re(n)||re(i))&&t.dirty(),{status:t.value,value:d.data}):(o(s,{code:c.invalid_intersection_types}),m)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,i])=>a(n,i)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}B.create=(r,e,t)=>new B({left:r,right:e,typeName:p.ZodIntersection,..._(t)});class Z extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.array)return o(s,{code:c.invalid_type,expected:u.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return o(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(o(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...s.data].map((i,d)=>{const h=this._def.items[d]||this._def.rest;return h?h._parse(new S(s,i,s.path,d)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>k.mergeArray(t,i)):k.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Z({...this._def,rest:e})}}Z.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Z({items:r,typeName:p.ZodTuple,rest:null,..._(e)})};class le extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.map)return o(s,{code:c.invalid_type,expected:u.map,received:s.parsedType}),m;const a=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([d,h],f)=>({key:a._parse(new S(s,d,s.path,[f,"key"])),value:n._parse(new S(s,h,s.path,[f,"value"]))}));if(s.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const h of i){const f=await h.key,v=await h.value;if(f.status==="aborted"||v.status==="aborted")return m;(f.status==="dirty"||v.status==="dirty")&&t.dirty(),d.set(f.value,v.value)}return{status:t.value,value:d}})}else{const d=new Map;for(const h of i){const f=h.key,v=h.value;if(f.status==="aborted"||v.status==="aborted")return m;(f.status==="dirty"||v.status==="dirty")&&t.dirty(),d.set(f.value,v.value)}return{status:t.value,value:d}}}}le.create=(r,e,t)=>new le({valueType:e,keyType:r,typeName:p.ZodMap,..._(t)});class z extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.set)return o(s,{code:c.invalid_type,expected:u.set,received:s.parsedType}),m;const a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&(o(s,{code:c.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&(o(s,{code:c.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function i(h){const f=new Set;for(const v of h){if(v.status==="aborted")return m;v.status==="dirty"&&t.dirty(),f.add(v.value)}return{status:t.value,value:f}}const d=[...s.data.values()].map((h,f)=>n._parse(new S(s,h,s.path,f)));return s.common.async?Promise.all(d).then(h=>i(h)):i(d)}min(e,t){return new z({...this._def,minSize:{value:e,message:l.toString(t)}})}max(e,t){return new z({...this._def,maxSize:{value:e,message:l.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}z.create=(r,e)=>new z({valueType:r,minSize:null,maxSize:null,typeName:p.ZodSet,..._(e)});class he extends y{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}he.create=(r,e)=>new he({getter:r,typeName:p.ZodLazy,..._(e)});class fe extends y{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return o(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}}fe.create=(r,e)=>new fe({value:r,typeName:p.ZodLiteral,..._(e)});function ke(r,e){return new j({values:r,typeName:p.ZodEnum,..._(e)})}class j extends y{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return o(t,{expected:g.joinValues(s),received:t.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return o(t,{received:t.data,code:c.invalid_enum_value,options:s}),m}return b(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return j.create(e,{...this._def,...t})}exclude(e,t=this._def){return j.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}j.create=ke;class me extends y{_parse(e){const t=g.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==u.string&&s.parsedType!==u.number){const a=g.objectValues(t);return o(s,{expected:g.joinValues(a),received:s.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(g.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=g.objectValues(t);return o(s,{received:s.data,code:c.invalid_enum_value,options:a}),m}return b(e.data)}get enum(){return this._def.values}}me.create=(r,e)=>new me({values:r,typeName:p.ZodNativeEnum,..._(e)});class W extends y{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.promise&&t.common.async===!1)return o(t,{code:c.invalid_type,expected:u.promise,received:t.parsedType}),m;const s=t.parsedType===u.promise?t.data:Promise.resolve(t.data);return b(s.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}W.create=(r,e)=>new W({type:r,typeName:p.ZodPromise,..._(e)});class $ extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:i=>{o(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){const i=a.transform(s.data,n);if(s.common.async)return Promise.resolve(i).then(async d=>{if(t.value==="aborted")return m;const h=await this._def.schema._parseAsync({data:d,path:s.path,parent:s});return h.status==="aborted"?m:h.status==="dirty"||t.value==="dirty"?M(h.value):h});{if(t.value==="aborted")return m;const d=this._def.schema._parseSync({data:i,path:s.path,parent:s});return d.status==="aborted"?m:d.status==="dirty"||t.value==="dirty"?M(d.value):d}}if(a.type==="refinement"){const i=d=>{const h=a.refinement(d,n);if(s.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(s.common.async===!1){const d=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return d.status==="aborted"?m:(d.status==="dirty"&&t.dirty(),i(d.value),{status:t.value,value:d.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(d=>d.status==="aborted"?m:(d.status==="dirty"&&t.dirty(),i(d.value).then(()=>({status:t.value,value:d.value}))))}if(a.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!I(i))return m;const d=a.transform(i.value,n);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:d}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>I(i)?Promise.resolve(a.transform(i.value,n)).then(d=>({status:t.value,value:d})):m);g.assertNever(a)}}$.create=(r,e,t)=>new $({schema:r,typeName:p.ZodEffects,effect:e,..._(t)});$.createWithPreprocess=(r,e,t)=>new $({schema:e,effect:{type:"preprocess",transform:r},typeName:p.ZodEffects,..._(t)});class O extends y{_parse(e){return this._getType(e)===u.undefined?b(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}O.create=(r,e)=>new O({innerType:r,typeName:p.ZodOptional,..._(e)});class V extends y{_parse(e){return this._getType(e)===u.null?b(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}V.create=(r,e)=>new V({innerType:r,typeName:p.ZodNullable,..._(e)});class J extends y{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===u.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}J.create=(r,e)=>new J({innerType:r,typeName:p.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class G extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return D(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}G.create=(r,e)=>new G({innerType:r,typeName:p.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class pe extends y{_parse(e){if(this._getType(e)!==u.nan){const s=this._getOrReturnCtx(e);return o(s,{code:c.invalid_type,expected:u.nan,received:s.parsedType}),m}return{status:"valid",value:e.data}}}pe.create=r=>new pe({typeName:p.ZodNaN,..._(r)});class rt extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class K extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),M(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,t){return new K({in:e,out:t,typeName:p.ZodPipeline})}}class Q extends y{_parse(e){const t=this._def.innerType._parse(e),s=a=>(I(a)&&(a.value=Object.freeze(a.value)),a);return D(t)?t.then(a=>s(a)):s(t)}unwrap(){return this._def.innerType}}Q.create=(r,e)=>new Q({innerType:r,typeName:p.ZodReadonly,..._(e)});var p;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(p||(p={}));const _e=N.create,st=E.create;A.create;w.create;const at=x.create;F.create;B.create;Z.create;j.create;W.create;O.create;V.create;const nt="0x06fdde03",it=[],dt=[{type:"string"}];async function ct(r){return X({contract:r.contract,method:[nt,it,dt],params:[]})}async function ot(r){return ge(()=>ct(r),{cacheKey:`${r.contract.chain.id}:${r.contract.address}:name`,cacheTime:Number.POSITIVE_INFINITY})}const ut="0x95d89b41",lt=[],ht=[{type:"string"}];async function ft(r){return X({contract:r.contract,method:[ut,lt,ht],params:[]})}async function mt(r){return ge(()=>ft(r),{cacheKey:`${r.contract.chain.id}:${r.contract.address}:symbol`,cacheTime:Number.POSITIVE_INFINITY})}const ye=at({name:_e().default("Ether"),symbol:_e().default("ETH"),decimals:st().default(18)}).default({name:"Ether",symbol:"ETH",decimals:18});async function pt(r){if(we(r.contract.address)){if(!r.contract.chain.nativeCurrency||!r.contract.chain.nativeCurrency.name||!r.contract.chain.nativeCurrency.symbol||!r.contract.chain.nativeCurrency.decimals)try{const{getChainMetadata:e}=await Ce(async()=>{const{getChainMetadata:s}=await import("./thirdweb-D3S3QNoz.js").then(a=>a.ch);return{getChainMetadata:s}},[]),t=await e(r.contract.chain);return ye.parse({...t.nativeCurrency,...r.contract.chain.nativeCurrency})}catch{}return ye.parse(r.contract.chain.nativeCurrency)}try{const[e,t,s]=await Promise.all([ot(r).catch(()=>""),mt(r),Te(r)]);return{decimals:s,name:e,symbol:t}}catch(e){throw new Error(`Invalid currency token: ${e}`)}}async function yt(r){const[e,t]=await Promise.all([Ze(r),pt(r)]);return{...t,chainId:r.contract.chain.id,displayValue:Ne(e,t.decimals),tokenAddress:r.contract.address,value:e}}export{yt as getBalance};
@@ -1,2 +0,0 @@
1
- import{d as E,s as I,a as w,k as R,T as M,j as e,M as T}from"./ui-am1Nr89z.js";import{u as U,d as q,a as V}from"./vendor-fOKayE99.js";import"./thirdweb-D3S3QNoz.js";import{k as b,T as g,W as D,m as i,o as c,p as o,q as W,V as N,t as _,u as F,v as P,R as L,w as h,x as S,L as B,I as G,D as z,y as O,z as $,C as H,A as Q}from"./index-CUHQgubq.js";const j={hasClaimedName:!0,description:"My description",tutorialStep:4095,name:"MotherHacker",userId:"0xd9b96b5dc720fc52bede1ec3b40a930e15f70ddd",email:"",ethAddress:"0xd9b96b5dc720fc52bede1ec3b40a930e15f70ddd",version:64,avatar:{bodyShape:"urn:decentraland:off-chain:base-avatars:BaseMale",wearables:["urn:decentraland:off-chain:base-avatars:eyebrows_17","urn:decentraland:off-chain:base-avatars:eyes_07","urn:decentraland:off-chain:base-avatars:beard","urn:decentraland:off-chain:base-avatars:mouth_03","urn:decentraland:off-chain:base-avatars:hair_coolshortstyle","urn:decentraland:matic:collections-v2:0xc43914be599f3f8fe4956aa3ec9d6a6aead1edfa:0:84","urn:decentraland:matic:collections-v2:0xd50191baed16bc532feb9d499fdaa805fe01d3ff:6:631873750011343120187508166102022593913370572403294667525865865224","urn:decentraland:matic:collections-v2:0xc43914be599f3f8fe4956aa3ec9d6a6aead1edfa:2:210624583337114373395836055367340864637790190801098222508621955166","urn:decentraland:off-chain:base-avatars:punk_piercing","urn:decentraland:matic:collections-v2:0x6b9ad15f1b82eb1d8b0f13d847f348b56589f83c:0:78"],forceRender:[],emotes:[{urn:"urn:decentraland:matic:collections-v2:0xea954afa4d2a8d0624adfafeb0e5a725ef777774:1:105312291668557186697918027683670432318895095400549111254310977736",slot:0},{urn:"urn:decentraland:matic:collections-v2:0xd50191baed16bc532feb9d499fdaa805fe01d3ff:3:315936875005671560093754083051011296956685286201647333762932932714",slot:1},{urn:"urn:decentraland:matic:collections-v2:0xea954afa4d2a8d0624adfafeb0e5a725ef777774:0:219",slot:2},{urn:"urn:decentraland:matic:collections-v2:0xef832a5183bf2e4099efed4c6ec981b7b41aa545:0:124",slot:3},{slot:4,urn:"hammer"},{urn:"urn:decentraland:matic:collections-v2:0x768c1027b1f1a452ecb8dab017a1e630a75f0d30:1:105312291668557186697918027683670432318895095400549111254310977547",slot:5},{urn:"urn:decentraland:matic:collections-v2:0x83134b69f9af4cb3239e0645281902a0a02adb37:0:100",slot:6},{slot:7,urn:"kiss"},{urn:"urn:decentraland:matic:collections-v2:0xc43914be599f3f8fe4956aa3ec9d6a6aead1edfa:4:421249166674228746791672110734681729275580381602196445017243910359",slot:8},{urn:"urn:decentraland:matic:collections-v2:0x0b472c2c04325a545a43370b54e93c87f3d5badf:3:315936875005671560093754083051011296956685286201647333762932932643",slot:9}],snapshots:{body:"https://peer-ec2.decentraland.org/content/contents/bafkreierlxqaqy2wqjmdf5y46p7xdzg5skpfbeyaixyrzim2hdmimazbce",face256:"https://peer-ec2.decentraland.org/content/contents/bafkreicow7jrxxezwqdkv63lvgahf42khbnuvnm5auam4sp2ph7ghbhyhi"},eyes:{color:{r:.37109375,g:.22265625,b:.1953125}},hair:{color:{r:.234375,g:.12890625,b:.04296875}},skin:{color:{r:.60546875,g:.4609375,b:.35546875}}},interests:[],hasConnectedWeb3:!0,muted:[]},u={contractAddress:"0x0000000000000000000000000000000000000000",description:"Test description",imageUrl:"https://peer.decentraland.org/lambdas/collections/contents/urn:decentraland:matic:collections-v2:0xfef5c99885c3036e591b6e6db52482891834a5f4:0/thumbnail",name:"Test NFT",rarity:E.Rarity.UNIQUE,toAddress:"0x0000000000000000000000000000000000000000",tokenId:"1",recipientProfile:{avatars:[j]}},m={manaAmount:"10 MANA",sceneImageUrl:"https://peer.decentraland.org/content/contents/bafybeietrfx6arffgapt65jkawued7mcsu75uuloodf3drxbvq2pfpggei",sceneName:"Test Scene",toAddress:"0x0000000000000000000000000000000000000000",recipientProfile:{avatars:[j]}},t="0xd9b96b5dc720fc52bede1ec3b40a930e15f70ddd",s="0x1234567890abcdef1234567890abcdef12345678",x="0x2791bca1f2de4661ed88a30c99a7a9449aa84174",y="0xfef5c99885c3036e591b6e6db52482891834a5f4",v={status:"success",assetChanges:[{type:"transfer",standard:"erc20",from:t,to:s,amount:"100",rawAmount:"100000000000000000000",tokenId:null,contractAddress:"0x0f5d2fb29fb7d3cfee444a200298f468908cc942",symbol:"MANA",name:"Decentraland MANA",decimals:18,logoUrl:null,dollarValue:"42.00"},{type:"transfer",standard:"erc20",from:t,to:s,amount:"250.5",rawAmount:"250500000",tokenId:null,contractAddress:x,symbol:"USDC",name:"USD Coin",decimals:6,logoUrl:null,dollarValue:"250.50"},{type:"transfer",standard:"native",from:t,to:s,amount:"1.5",rawAmount:"1500000000000000000",tokenId:null,contractAddress:null,symbol:"MATIC",name:null,decimals:18,logoUrl:null,dollarValue:"1.05"},{type:"transfer",standard:"erc20",from:s,to:t,amount:"0.05",rawAmount:"50000000000000000",tokenId:null,contractAddress:"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",symbol:"WETH",name:"Wrapped Ether",decimals:18,logoUrl:null,dollarValue:"160.00"},{type:"mint",standard:"erc721",from:null,to:t,amount:null,rawAmount:null,tokenId:"512",contractAddress:y,symbol:"WEAR",name:"Fancy Hat",decimals:null,logoUrl:null,dollarValue:null}],approvalChanges:[{kind:"approval",standard:"erc20",owner:t,spender:s,amount:"500",rawAmount:"500000000",isUnlimited:!1,tokenId:null,approved:null,contractAddress:x,symbol:"USDC",name:"USD Coin"},{kind:"approval",standard:"erc20",owner:t,spender:"0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",amount:null,rawAmount:"115792089237316195423570985008687907853269984665640564039457584007913129639935",isUnlimited:!0,tokenId:null,approved:null,contractAddress:"0x0f5d2fb29fb7d3cfee444a200298f468908cc942",symbol:"MANA",name:"Decentraland MANA"},{kind:"approvalForAll",standard:"erc721",owner:t,spender:s,amount:null,rawAmount:null,isUnlimited:!0,tokenId:null,approved:!0,contractAddress:y,symbol:null,name:"Fancy Wearables"},{kind:"approvalForAll",standard:"erc721",owner:t,spender:"0x9999999999999999999999999999999999999999",amount:null,rawAmount:null,isUnlimited:!1,tokenId:null,approved:!1,contractAddress:"0x1111111111111111111111111111111111111111",symbol:null,name:"Old Wearables"},{kind:"approval",standard:"erc721",owner:t,spender:s,amount:null,rawAmount:null,isUnlimited:!1,tokenId:"7",approved:null,contractAddress:y,symbol:null,name:"Fancy Wearables"}],balanceChanges:[{address:t,dollarValue:"-133.55"}],events:[{name:"Transfer",address:"0x0f5d2fb29fb7d3cfee444a200298f468908cc942"},{name:"Approval",address:x},{name:null,address:s}]},Y={status:"reverted",error:"ERC20: transfer amount exceeds balance",assetChanges:[],approvalChanges:[],balanceChanges:[],events:[]},K={status:"success",assetChanges:[],approvalChanges:[],balanceChanges:[],events:[{name:"ConfigUpdated",address:s}]},J={kind:"message",message:`Sign this message to prove you own this wallet.
2
- Nonce: 12345`},X={kind:"typedData",raw:'{"types":{},"primaryType":"Order","domain":{"name":"Decentraland Marketplace","chainId":137,"verifyingContract":"0x480a0f4e360e8964e68858dd231c2922f1df45ef"},"message":{"price":"1000000000000000000","expiration":"1700000000"}}',typedData:{types:{},primaryType:"Order",domain:{name:"Decentraland Marketplace",chainId:137,verifyingContract:"0x480a0f4e360e8964e68858dd231c2922f1df45ef"},message:{price:"1000000000000000000",expiration:"1700000000"}}},Z={kind:"typedData",raw:'{"primaryType":"MetaTransaction","domain":{"name":"Decentraland Collection","verifyingContract":"0xfef5c99885c3036e591b6e6db52482891834a5f4","salt":"0x0000000000000000000000000000000000000000000000000000000000000089"},"message":{"nonce":0,"from":"0xd9b96b5dc720fc52bede1ec3b40a930e15f70ddd","functionSignature":"0xa9059cbb"}}',typedData:{primaryType:"MetaTransaction",domain:{name:"Decentraland Collection",verifyingContract:"0xfef5c99885c3036e591b6e6db52482891834a5f4",salt:"0x0000000000000000000000000000000000000000000000000000000000000089"},message:{nonce:0,from:t,functionSignature:"0xa9059cbb"}}},ee=R({from:{opacity:0,transform:"translateY(-16px)"},to:{opacity:1,transform:"translateY(0)"}}),ae=I(w)(({theme:a})=>({animation:`${ee} ${a.transitions.duration.standard}ms ${a.transitions.easing.easeOut}`,backgroundColor:a.palette.background.paper,border:`1px solid ${a.palette.divider}`,borderRadius:a.shape.borderRadius,boxShadow:a.shadows[4],left:a.spacing(2),padding:a.spacing(1.5),position:"fixed",top:a.spacing(2),zIndex:a.zIndex.appBar})),ne=I(M)(({theme:a})=>({minWidth:a.spacing(40),"& .MuiInputBase-root":{backgroundColor:a.palette.background.paper}})),f=I(w)(({theme:a})=>({backgroundColor:a.palette.background.paper,border:`1px solid ${a.palette.divider}`,borderRadius:a.shape.borderRadius,boxShadow:a.shadows[4],margin:"15vh auto 0",maxWidth:a.spacing(60),padding:a.spacing(3)})),r="test-request-id",n=()=>{},l=async()=>{},le=()=>{const a=U(),{viewId:p}=q(),A=V.useMemo(()=>({closeWindow:{label:"CloseWindow",element:e.jsx(Q,{})},continueInApp:{label:"ContinueInApp",element:e.jsx(H,{autoStart:!1,onContinue:n,requestId:r,deepLinkUrl:"decentraland://"})},deniedSignIn:{label:"DeniedSignIn",element:e.jsx($,{requestId:r})},deniedWalletInteraction:{label:"DeniedWalletInteraction",element:e.jsx(O,{})},differentAccountError:{label:"DifferentAccountError",element:e.jsx(z,{requestId:r})},ipValidationError:{label:"IpValidationError",element:e.jsx(G,{requestId:r,reason:"Test reason"})},loadingRequest:{label:"LoadingRequest",element:e.jsx(B,{})},manaTransfer:{label:"TransferConfirmView (Tip)",element:e.jsx(c,{type:o.TIP,transferData:m,isLoading:!1,onDeny:n,onApprove:l})},manaTransferCanceled:{label:"TransferCanceledView (Tip)",element:e.jsx(S,{type:o.TIP,transferData:m})},manaTransferComplete:{label:"TransferCompletedView (Tip)",element:e.jsx(h,{type:o.TIP,transferData:m})},nftTransfer:{label:"TransferConfirmView (Gift)",element:e.jsx(c,{type:o.GIFT,transferData:u,isLoading:!1,onDeny:n,onApprove:l})},nftTransferCanceled:{label:"TransferCanceledView (Gift)",element:e.jsx(S,{type:o.GIFT,transferData:u})},nftTransferComplete:{label:"TransferCompletedView (Gift)",element:e.jsx(h,{type:o.GIFT,transferData:u})},recoverError:{label:"RecoverError",element:e.jsx(L,{onTryAgain:()=>alert("try again")})},signingError:{label:"SigningError",element:e.jsx(P,{error:"Test error"})},signInComplete:{label:"SignInComplete",element:e.jsx(F,{})},timeoutError:{label:"TimeoutError",element:e.jsx(_,{requestId:r})},verifySignIn:{label:"Verify Sign In",element:e.jsx(N,{requestId:r,code:1234,onDeny:n,onApprove:n})},walletInteraction:{label:"Wallet Interaction",element:e.jsx(D,{requestId:r,onDeny:n,onApprove:n})},walletInteractionComplete:{label:"WalletInteractionComplete",element:e.jsx(W,{})},walletNftInteraction:{label:"Wallet NFT Interaction",element:e.jsx(c,{type:o.GIFT,transferData:u,isLoading:!1,onDeny:n,onApprove:l})},walletManaInteraction:{label:"Wallet MANA Interaction",element:e.jsx(c,{type:o.TIP,transferData:m,isLoading:!1,onDeny:n,onApprove:l})},simulationSummarySuccess:{label:"SimulationSummary (Success)",element:e.jsx(f,{children:e.jsx(i,{simulation:{status:"ready",result:v},userAddress:t,chainId:137})})},simulationSummaryReverted:{label:"SimulationSummary (Reverted)",element:e.jsx(f,{children:e.jsx(i,{simulation:{status:"ready",result:Y},userAddress:t,chainId:137})})},simulationSummaryUnavailable:{label:"SimulationSummary (Unavailable)",element:e.jsx(f,{children:e.jsx(i,{simulation:{status:"unavailable"},userAddress:t,chainId:137})})},simulationSummaryNoChanges:{label:"SimulationSummary (No asset changes)",element:e.jsx(f,{children:e.jsx(i,{simulation:{status:"ready",result:K},userAddress:t,chainId:137})})},walletInteractionSimulation:{label:"Wallet Interaction (with summary)",element:e.jsx(D,{requestId:r,isWeb2Wallet:!0,simulation:{status:"ready",result:v},userAddress:t,verifiedContracts:["0x1234567890abcdef1234567890abcdef12345678","0x0f5d2fb29fb7d3cfee444a200298f468908cc942"],chainId:137,requiresAcknowledgment:!0,gasCovered:!0,onDeny:n,onApprove:n})},transactionDialogGasCovered:{label:"TransactionConfirmDialog (Gas covered)",element:e.jsx(g,{open:!0,transactionCost:BigInt(0),balance:BigInt(0),gasCovered:!0,onCancel:n,onConfirm:n})},transactionDialogWithGas:{label:"TransactionConfirmDialog (User pays gas)",element:e.jsx(g,{open:!0,transactionCost:BigInt("2500000000000000"),balance:BigInt("1500000000000000000"),onCancel:n,onConfirm:n})},transactionDialogReverted:{label:"TransactionConfirmDialog (Reverted)",element:e.jsx(g,{open:!0,transactionCost:BigInt("2500000000000000"),balance:BigInt("1500000000000000000"),isReverted:!0,onCancel:n,onConfirm:n})},signatureMessage:{label:"SignatureRequest (Message)",element:e.jsx(b,{requestId:r,method:"personal_sign",payload:J,simulation:{status:"idle"},userAddress:t,isMetaTransaction:!1,onDeny:n,onApprove:l})},signatureTypedData:{label:"SignatureRequest (Typed Data)",element:e.jsx(b,{requestId:r,method:"eth_signTypedData_v4",payload:X,simulation:{status:"idle"},userAddress:t,isMetaTransaction:!1,onDeny:n,onApprove:l})},signatureMetaTx:{label:"SignatureRequest (Meta-tx)",element:e.jsx(b,{requestId:r,method:"eth_signTypedData_v4",payload:Z,simulation:{status:"ready",result:v},userAddress:t,isMetaTransaction:!0,onDeny:n,onApprove:l})}}),[]),C=p?A[p]:void 0;return e.jsxs(e.Fragment,{children:[e.jsx(ae,{children:e.jsxs(ne,{select:!0,label:"View",size:"small",value:p??"",onChange:d=>a(`/testView/${d.target.value}`),children:[e.jsx(T,{value:"",children:"Select a view…"}),Object.entries(A).map(([d,{label:k}])=>e.jsx(T,{value:d,children:k},d))]})}),C?C.element:null]})};export{le as TestViewPage};