@dcl/shop 0.1.0-29956042914.commit-dfd2644 → 0.1.0-29994094833.commit-84e34c2

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 (169) hide show
  1. package/assets/{AnimatedBackground-BIfvWPVI.js → AnimatedBackground-DW1UTWMl.js} +1 -1
  2. package/assets/{Assets-C6nZk4Op.js → Assets-D0Gpv-gx.js} +1 -1
  3. package/assets/{Assets.styles-CDC2HBmZ.js → Assets.styles-Dz0IZ5_I.js} +1 -1
  4. package/assets/{Authorizations-BhMprrBp.js → Authorizations-hlWKflXp.js} +1 -1
  5. package/assets/{Cart-DpcQIaOW.js → Cart-BNmwscGt.js} +1 -1
  6. package/assets/{CircularProgress-BR1jf0Pq.js → CircularProgress-CzgFv03I.js} +1 -1
  7. package/assets/{Collection-crRNdqTt.js → Collection-CdFCCFbq.js} +1 -1
  8. package/assets/{CollectionCarousel-DuuF5eCz.js → CollectionCarousel-D6IuiIc2.js} +1 -1
  9. package/assets/{Creator-CuQROUax.js → Creator-CaxOzhEa.js} +1 -1
  10. package/assets/{CssVarsProvider-ewdlo_l2.js → CssVarsProvider-F9lbInZM.js} +1 -1
  11. package/assets/{ExchangeController-Cw15Jkg7.js → ExchangeController-DgDdAAKd.js} +1 -1
  12. package/assets/{GetCredits-CQDZBtlW.js → GetCredits-B-aIxpHv.js} +1 -1
  13. package/assets/{HelpersUtil-BlTjfPpB.js → HelpersUtil-CYLAmB96.js} +1 -1
  14. package/assets/{ImportListings-2AhLhkbi.js → ImportListings-wLBEk5Jj.js} +1 -1
  15. package/assets/{ItemDetail-Fmkapkuw.js → ItemDetail-DYEljYNo.js} +2 -2
  16. package/assets/{LoadMore-Cmni2e-s.js → LoadMore-DAM-bEob.js} +1 -1
  17. package/assets/{MarketCheckout-BJsJHJsi.js → MarketCheckout-BemjD_ML.js} +1 -1
  18. package/assets/{MyAssets-DzR99im2.js → MyAssets-uGWTenCp.js} +1 -1
  19. package/assets/{MyFavorites-BQGP1ZIo.js → MyFavorites-D4nPx2R8.js} +1 -1
  20. package/assets/{MyPurchases-CQkTuPMG.js → MyPurchases-cVdBxnoE.js} +1 -1
  21. package/assets/{NotFound-DC3EAWIQ.js → NotFound-8rhBEKBk.js} +1 -1
  22. package/assets/{PrimaryListModal-JkGI-cG4.js → PrimaryListModal-DRCA3QS9.js} +1 -1
  23. package/assets/{StoreSettings-C8nJd5ww.js → StoreSettings-ggmmaFdw.js} +5 -5
  24. package/assets/{Success-6wyy2HIl.js → Success-BTcAti-s.js} +1 -1
  25. package/assets/{SwapController-x5aR6arl.js → SwapController-DAWHQ4ok.js} +1 -1
  26. package/assets/{Tooltip-Bz0rwSTJ.js → Tooltip-CAVGsqiJ.js} +1 -1
  27. package/assets/{TradeService-DNmQf5Q5.js → TradeService-Bq-E9rL5.js} +1 -1
  28. package/assets/{W3MFrameProviderSingleton-Ddt2Odte.js → W3MFrameProviderSingleton-CO4_1ccR.js} +3 -3
  29. package/assets/{WebCryptoP256-BZEL0-4r.js → WebCryptoP256-DHiXQ6Dv.js} +1 -1
  30. package/assets/authorizations-mnih5q8o.js +1 -0
  31. package/assets/{basic-BgXpqXQ2.js → basic-DIfzBgGC.js} +1 -1
  32. package/assets/{biconomy-CL9LPvn9.js → biconomy-Btr8t9M_.js} +1 -1
  33. package/assets/{buy-ra8wh_Tw.js → buy-CHyPhIFc.js} +1 -1
  34. package/assets/{buy-gasless-DxE_2TUI.js → buy-gasless-DRDa-VRS.js} +1 -1
  35. package/assets/{cart-checkout-B1K9PgL-.js → cart-checkout-4SY4EejM.js} +1 -1
  36. package/assets/{categories-BaqUBHO4.js → categories-7ZUMUxRc.js} +1 -1
  37. package/assets/{ccip-DByx1TUc.js → ccip-CKzYrGsq.js} +1 -1
  38. package/assets/{ccip-Dggl7PUI.js → ccip-DQPPdysF.js} +1 -1
  39. package/assets/{collection-Djfr3IjX.js → collection-LjzTm4kD.js} +1 -1
  40. package/assets/{controller-BdA9yBve.js → controller-oqfUGC7Q.js} +2 -2
  41. package/assets/{core-KOFtWzF2.js → core-BnR4IbQF.js} +4 -4
  42. package/assets/{custom-EokPk8Aa.js → custom-LYbOpT74.js} +1 -1
  43. package/assets/{data-capture-DffV9O-P.js → data-capture-DvxW9LWJ.js} +1 -1
  44. package/assets/{email-CPTt0Qin.js → email-DblmG_9w.js} +1 -1
  45. package/assets/{embedded-wallet-CK2EcQQ5.js → embedded-wallet-BIBD3NXe.js} +1 -1
  46. package/assets/{emotion-styled.browser.esm-BuTVXj5n.js → emotion-styled.browser.esm-CtG7z_nw.js} +1 -1
  47. package/assets/{engine-u6OaJ_Tu.js → engine-Q3dlwVZc.js} +1 -1
  48. package/assets/{errors-DWlrWfS6.js → errors-B3Jy0VAJ.js} +1 -1
  49. package/assets/{estimate-l1-fee-B31zGZTX.js → estimate-l1-fee-DPrAoRm1.js} +1 -1
  50. package/assets/{execute-C4Ym12TX.js → execute-GsOG5tOz.js} +2 -2
  51. package/assets/{features-Cnk0ZN0_.js → features-BHjaYixx.js} +1 -1
  52. package/assets/{fetchTokenMetadata-nquRFqG-.js → fetchTokenMetadata-CIsTf8qh.js} +2 -2
  53. package/assets/{get-ecosystem-wallet-info-cPzYSZNS.js → get-ecosystem-wallet-info-B8oiqf_g.js} +1 -1
  54. package/assets/{getBalance-Bac56_RU.js → getBalance-Q-FuT0Qm.js} +1 -1
  55. package/assets/{getNFT-DN-_ELlI.js → getNFT-BonpS0wI.js} +1 -1
  56. package/assets/{getNFT-CwmEwcps.js → getNFT-DBtyLr3S.js} +1 -1
  57. package/assets/{getOverlayAlpha-F1qRCVfQ.js → getOverlayAlpha-5GYRyW4x.js} +1 -1
  58. package/assets/{hashTypedData-C5u_ZKDH.js → hashTypedData-BhuoQuOn.js} +1 -1
  59. package/assets/{hashTypedData-DOUtEnUo.js → hashTypedData-l7BbP1BP.js} +1 -1
  60. package/assets/{import-5uw4xr5F.js → import-a0kWnC35.js} +1 -1
  61. package/assets/{in-app-CBd4ysM4.js → in-app-ESN8W__G.js} +1 -1
  62. package/assets/{in-app-wallet-calls-C1P9zeN-.js → in-app-wallet-calls-BYj88Ef-.js} +1 -1
  63. package/assets/{index-CWUtfLAY.js → index-B-6uQuND.js} +1 -1
  64. package/assets/{index-7Kwtok4Q.js → index-B5qcYwN0.js} +1 -1
  65. package/assets/{index-DrdLRzZG.js → index-B7MM-EDJ.js} +3 -3
  66. package/assets/{index-CopbrGfc.js → index-BCPi-ClS.js} +1 -1
  67. package/assets/{index-CI2TPFS4.js → index-BDLTpYuD.js} +1 -1
  68. package/assets/{index-BdUwuly3.js → index-BI7O7l1f.js} +3 -3
  69. package/assets/{index-C4p0aCYB.js → index-BJj2KSp_.js} +1 -1
  70. package/assets/{index-DWn6y0S7.js → index-BQMla4xK.js} +1 -1
  71. package/assets/{index-Fd4ETRgB.js → index-BTNH3ieH.js} +1 -1
  72. package/assets/{index-B0-mv1E1.js → index-BTUsGa6S.js} +1 -1
  73. package/assets/{index-DyfjR5Mn.js → index-BU99LwmJ.js} +1 -1
  74. package/assets/{index-B1LoITLp.js → index-BYcynwJw.js} +1 -1
  75. package/assets/{index-BENz6waP.js → index-BZLlD7vv.js} +1 -1
  76. package/assets/{index-KLkyeTTn.js → index-BZcSxyRp.js} +2 -2
  77. package/assets/{index-CyXt5OH3.js → index-B_w7D_1t.js} +1 -1
  78. package/assets/{index-Bx9r3wix.js → index-BeGn7EwY.js} +1 -1
  79. package/assets/{index-BnLdR5Xg.js → index-BeJqoBti.js} +1 -1
  80. package/assets/{index-IsSLMZhM.js → index-BnPeVq62.js} +1 -1
  81. package/assets/{index-CbWiClPu.js → index-BsaSZdou.js} +1 -1
  82. package/assets/{index-Bw6VUGJ8.js → index-CDM_k6C9.js} +1 -1
  83. package/assets/{index-CtchK0pS.js → index-CJZmNG9i.js} +1 -1
  84. package/assets/{index-7pn-Zkqf.js → index-CNzygfnu.js} +1 -1
  85. package/assets/{index-B1rOMkKj.js → index-CcLECkyd.js} +1 -1
  86. package/assets/{index-B6K8cWej.js → index-CnnU_mLv.js} +1 -1
  87. package/assets/{index-CnpbeejJ.js → index-Ctb1grEl.js} +1 -1
  88. package/assets/{index-DT3QAIkB.js → index-Cup4Stx2.js} +1 -1
  89. package/assets/{index-p8jxMnmg.js → index-Cyn8gRvH.js} +1 -1
  90. package/assets/{index-N2L0zXX7.js → index-D2u3qo5-.js} +9 -9
  91. package/assets/{index-PzZvVORQ.js → index-D4JXiKx_.js} +1 -1
  92. package/assets/{index-CHhvcpqB.js → index-DD7JYX6I.js} +2 -2
  93. package/assets/{index-G8BCf4UV.js → index-DDV0fT7b.js} +1 -1
  94. package/assets/{index-DOpjx9Gt.js → index-DNIRbQMj.js} +1 -1
  95. package/assets/{index-D4hGWNAc.js → index-DNgvtVPS.js} +1 -1
  96. package/assets/{index-B_f2sEHx.js → index-D_vAUTlU.js} +1 -1
  97. package/assets/{index-fst0k3S4.js → index-DfEfFqPo.js} +1 -1
  98. package/assets/{index-DHdnzd1o.js → index-DiBhVrGy.js} +1 -1
  99. package/assets/{index-CjCLqlKH.js → index-DjtMF_FP.js} +1 -1
  100. package/assets/{index-BZC6kGI_.js → index-DlCwuyBG.js} +1 -1
  101. package/assets/{index-BghydE3i.js → index-DmGRJRWs.js} +1 -1
  102. package/assets/{index-BOV0dVd8.js → index-DqNB5gIy.js} +1 -1
  103. package/assets/{index-Ds3STnLu.js → index-Dz17wnbD.js} +1 -1
  104. package/assets/{index-Bnbb61F6.js → index-GAPC_47T.js} +1 -1
  105. package/assets/{index-BHqjqXrX.js → index-L6AnZu2-.js} +1 -1
  106. package/assets/{index-k-9jMlLN.js → index-Np3Taixr.js} +1 -1
  107. package/assets/{index-cl5Ayqiy.js → index-NuJxOSl-.js} +1 -1
  108. package/assets/{index-Drnj0iSQ.js → index-T7BPymVH.js} +1 -1
  109. package/assets/{index-LjWfI9wI.js → index-YTUbuYV5.js} +2 -2
  110. package/assets/{index-BI-15Yoh.js → index-_zid9pow.js} +1 -1
  111. package/assets/{index-D8mE8VOf.js → index-hxYvqItN.js} +1 -1
  112. package/assets/{index-BS7HG2Ql.js → index-nccYW6P3.js} +1 -1
  113. package/assets/{index-D42Of91M.js → index-u26i2x4Z.js} +1 -1
  114. package/assets/{index-CNai29v4.js → index-zU9Uj5fP.js} +3 -3
  115. package/assets/{index.es-DrNk9X0y.js → index.es-BVmvZPLl.js} +1 -1
  116. package/assets/{index.es-C81VIbew.js → index.es-CZyih3uZ.js} +4 -4
  117. package/assets/{index.es-BwegfBu5.js → index.es-DVSJ83NI.js} +1 -1
  118. package/assets/{localBatchGatewayRequest-D5NREzvf.js → localBatchGatewayRequest-CjdETprd.js} +1 -1
  119. package/assets/{mana-rate-B_U_hjWF.js → mana-rate-DcCwt7oF.js} +1 -1
  120. package/assets/{networks-CO_CB-36.js → networks-Gp8grhfL.js} +1 -1
  121. package/assets/{onramp-DS204bvv.js → onramp-DzUZOn5v.js} +1 -1
  122. package/assets/{openzeppelin-vQkavW6G.js → openzeppelin-Re-ToQ3G.js} +1 -1
  123. package/assets/{parseNft-5DK-sIz2.js → parseNft-DvKM3tDX.js} +2 -2
  124. package/assets/{parseSignature-B2BUI9OQ.js → parseSignature-CTjdilwC.js} +1 -1
  125. package/assets/{parseSignature-CyT-stCM.js → parseSignature-ChGXlmjA.js} +3 -3
  126. package/assets/{passkeys-B6n8vMGB.js → passkeys-O7R8Skr8.js} +1 -1
  127. package/assets/{pay-with-exchange-gNFEWKDj.js → pay-with-exchange-CGXWXub_.js} +1 -1
  128. package/assets/{qr-overlay-Bo7aYCqQ.js → qr-overlay-DQBJWl2U.js} +1 -1
  129. package/assets/{receive-BnsFI6IX.js → receive-amOjcYAx.js} +1 -1
  130. package/assets/{resolveImplementation-CMttJtr0.js → resolveImplementation-CstEI2ba.js} +1 -1
  131. package/assets/{rpc-BAOMBSXs.js → rpc-ZYSy-eJG.js} +1 -1
  132. package/assets/{secp256k1-Bnte6SOv.js → secp256k1-CdMvj0c6.js} +1 -1
  133. package/assets/{secp256k1-BAH7C8qp.js → secp256k1-DADPdC2O.js} +1 -1
  134. package/assets/{secp256k1-hg52lS4x.js → secp256k1-DfE_4Njp.js} +1 -1
  135. package/assets/{send-R3LSwc6d.js → send-B9WVOIIy.js} +1 -1
  136. package/assets/{send-batch-transaction-D2IsQ4Km.js → send-batch-transaction-BpIXP8aL.js} +1 -1
  137. package/assets/{send-eip712-transaction-vLI0QrlC.js → send-eip712-transaction-C-UOcWS2.js} +2 -2
  138. package/assets/{send-gasless-transaction-oD96yb_X.js → send-gasless-transaction-D2HEIqEd.js} +2 -2
  139. package/assets/{send-transaction-BDY5eooW.js → send-transaction-rA10MuVm.js} +2 -2
  140. package/assets/{sendRawTransaction-pi98_gCD.js → sendRawTransaction-FATzwmfZ.js} +3 -3
  141. package/assets/{serializeTransaction-DrKe9SDk.js → serializeTransaction-DixmbC2c.js} +1 -1
  142. package/assets/{session-proposal-De5gie8Q.js → session-proposal-BOIm4XSE.js} +1 -1
  143. package/assets/{session-request-C9tsmcGI.js → session-request-c_OnJFO0.js} +2 -2
  144. package/assets/{signing-OhCCSIGM.js → signing-41DxLyFg.js} +3 -3
  145. package/assets/{socials-vaNStMlg.js → socials-BWQzaLAW.js} +1 -1
  146. package/assets/{swaps-CdD2eT6E.js → swaps-CivCXKBU.js} +1 -1
  147. package/assets/{thirdweb-CZMpMgi9.js → thirdweb-C8KpcE8I.js} +3 -3
  148. package/assets/{to-serializable-transaction-FwS07VBE.js → to-serializable-transaction-BWjd1RMk.js} +2 -2
  149. package/assets/{trade-encoding-Nzi47aTM.js → trade-encoding-CtfVB9K4.js} +1 -1
  150. package/assets/{transactionReceipt-CmX59xgt.js → transactionReceipt-Coqh5oX3.js} +1 -1
  151. package/assets/{transactions-CnDzN5iB.js → transactions-C7og5tua.js} +1 -1
  152. package/assets/useCreditPacks-Djg10PxH.js +1 -0
  153. package/assets/{useInfiniteGrid-CgxIpgDb.js → useInfiniteGrid-Cg-FBhvv.js} +1 -1
  154. package/assets/{useStore-Dk-xL0c8.js → useStore-Bvj7HKvJ.js} +1 -1
  155. package/assets/{useTheme-BrDoOqsp.js → useTheme-BDMGaPba.js} +1 -1
  156. package/assets/useTheme-DpYzrDIG.js +1 -0
  157. package/assets/{verifyHash-DsGGUyHh.js → verifyHash--D25lC81.js} +1 -1
  158. package/assets/{w3m-modal-WLlRU45K.js → w3m-modal-B0pocWlf.js} +1 -1
  159. package/assets/{w3m-modal-DYen_3Ih.js → w3m-modal-BG_0bUMI.js} +1 -1
  160. package/assets/{wait-for-tx-receipt-Cs504Ygp.js → wait-for-tx-receipt-DxxlAWDR.js} +1 -1
  161. package/assets/{wallets-JBfmut-y.js → wallets-DsPPoviJ.js} +5 -5
  162. package/assets/{web-connector-rxhXXM2O.js → web-connector-Brej9YrP.js} +3 -3
  163. package/assets/{writeContract-BXZiViEe.js → writeContract-CgNduh80.js} +1 -1
  164. package/assets/{zoraTestnet-BdqfY9hY.js → zoraTestnet-Bc68rMQr.js} +1 -1
  165. package/index.html +11 -11
  166. package/package.json +2 -2
  167. package/assets/authorizations-BUCDfL2t.js +0 -1
  168. package/assets/useCreditPacks-DAdqCu9-.js +0 -1
  169. package/assets/useTheme-DkDLv0JM.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as l,j as v}from"./react-BrLDncxD.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-29956042914.commit-dfd2644/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-29956042914.commit-dfd2644/assets/DCL_LogoPattern-BryBPc3d.png",U=`
1
+ import{r as l,j as v}from"./react-BrLDncxD.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-29994094833.commit-84e34c2/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-29994094833.commit-84e34c2/assets/DCL_LogoPattern-BryBPc3d.png",U=`
2
2
  attribute vec2 a_position;
3
3
  varying vec2 v_uv;
4
4
  void main() {
@@ -1,4 +1,4 @@
1
- import{a as Ke,r as p,j as e,b as Qe}from"./react-BrLDncxD.js";import{c as F,w as Ze,q as Je,L as Xe,s,F as t,d as Te,n as Ye,o as ze,j as Ie,e as et,t as o,I as z,g as B,v as pe,x as D,y as tt,z as nt,u as Ne,G as st,A as K,au as ot,av as it}from"./index-N2L0zXX7.js";import{r as rt,a as at,m as _e}from"./mana-rate-B_U_hjWF.js";import{u as Ae,M as lt}from"./MarketCheckout-BJsJHJsi.js";import{g as ct,h as dt,i as ft,j as pt,k as ut,C as xt,l as ht,o as mt,m as gt,n as bt,M as yt}from"./Assets.styles-CDC2HBmZ.js";import{d as ue,R as wt,F as vt,S as xe,b as jt}from"./categories-BaqUBHO4.js";import{L as $t}from"./LoadMore-Cmni2e-s.js";import{u as Ct}from"./useInfiniteGrid-CgxIpgDb.js";import{E as kt}from"./ErrorNotice-BDH9xoG4.js";import{d as St}from"./dcl-schemas-BICTSpB5.js";import{u as Rt,G as Et,w as Tt,S as zt}from"./buy-gasless-DxE_2TUI.js";import{s as It}from"./buy-ra8wh_Tw.js";import{h as Nt}from"./trade-encoding-Nzi47aTM.js";import{f as _t}from"./errors-DWlrWfS6.js";import{J as At,C as Pt,B as ne}from"./ethers-BIvjmL85.js";import{l as Mt}from"./loader-logo-BzY9EKdC.js";import{n as Lt}from"./emotion-CSxEP8yM.js";import"./sentry-DYZXk5O5.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./authorizations-BUCDfL2t.js";import"./Tooltip-Bz0rwSTJ.js";function Q(n){const i=n.source??"item",f=n.tradeId||`${n.contractAddress}-${n.tokenId??n.itemId??""}`;return`${i}:${f}`}const W="100000000000000000000",Pe=2,V=15,Bt=/^[a-zA-Z0-9]+$/;function he(n){const i=n.trim();return i.length===0?{ok:!1,reason:"empty"}:Bt.test(i)?i.length<Pe?{ok:!1,reason:"too-short"}:i.length>V?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Ft(n){return n.replace(/[^a-zA-Z0-9]/g,"").slice(0,V)}const Wt=["function available(string _subdomain) view returns (bool)"],me={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Ht(){return F.chainId===St.ChainId.MATIC_MAINNET?me.mainnet:me.sepolia}async function Ut(n,i={}){var d;const{rpc:f,address:u}=Ht(),l=new At(f),c=new Pt(u,Wt,l);console.info(`[names] availability check → DCLRegistrar(${u}).available("${n}") on ${f}`);const x=await c.available(n);if((d=i.signal)!=null&&d.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${n}" available=${x}`),x?"available":"taken"}const Ot="https://app.across.to/api";class Me extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function Gt(n){return at(W,n)}async function qt(n,i,f={}){var d;const u=f.chainId??F.chainId,l=f.provider??"across",c=`${F.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(i)}&chainId=${u}&provider=${l}`,x=await Xe(c,{method:"GET",identity:n,metadata:{}});if(!x.ok){let a;try{a=(d=await x.json())==null?void 0:d.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new Me:new Error(`fetchNameCreditRoute ${x.status}`)}return x.json()}function Dt(n,i){const f=ne.from(n.availableAmount),l=ne.from(W).sub(f);return{credits:[{value:n.amount,expiresAt:Number(n.expiresAt),salt:Nt(n.id)}],creditsSignatures:[n.signature],externalCall:{target:i.externalCall.target,selector:i.externalCall.selector,data:i.externalCall.data,expiresAt:i.externalCall.expiresAt,salt:i.externalCall.salt},customExternalCallSignature:i.customExternalCallSignature,maxUncreditedValue:l.isNegative()?"0":l.toString(),maxCreditedValue:W}}async function Vt(n,i={}){const f=Ot,u=i.intervalMs??1e4,l=i.maxAttempts??60;let c={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let x=0;x<l;x++){try{const d=await fetch(`${f}/deposit/status?originChainId=137&depositTxHash=${n}`);if(d.ok){const a=await d.json(),m=(a.status??"pending").toLowerCase(),w=a.fillTx??a.fillTxnRef??null,y=a.actionsSucceeded!==!1;if(m==="filled")return{status:"filled",destinationTxHash:w,actionsSucceeded:y};if(m==="refunded"||m==="expired")return{status:m,destinationTxHash:null,actionsSucceeded:!1};c={status:"pending",destinationTxHash:w,actionsSucceeded:y}}}catch{}x<l-1&&await new Promise(d=>setTimeout(d,u))}return c}async function Kt(n){const{name:i,identity:f,signer:u}=n,l=n.chainId??F.chainId,c=n.provider??"across",x=(n.beneficiary??await u.getAddress()).toLowerCase();let d=null,a=!1;console.info("[names] register start",{name:i,buyer:x,chainId:l,provider:c});try{const m=await rt(l),w=Gt(m);console.info("[names] step 1/6 sized reservation",{usdCents:w,manaRate:m});const y=await qt(f,i,{chainId:l,provider:c});console.info("[names] step 2/6 route fetched",{target:y.externalCall.target,selector:y.externalCall.selector,provider:y.provider,quoteId:y.quoteId});const v=await Ze(f,w);if(d=v.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:v.credit.id,maxCreditedValue:v.maxCreditedValue}),ne.from(v.maxCreditedValue).lt(W))throw new Error("Credit under-sized for the name price");const C=Dt(v.credit,y);let h;try{h=await Rt({chainId:l,buyer:x,signer:u,args:C})}catch(b){if(!(b instanceof Et))throw b;h=await It(l,C,u)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:h}),await Tt(h),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:h}),c==="across"){const b=await Vt(h,n.acrossPoll);if(console.info("[names] step 6/6 across status",b),b.status==="pending")return{status:"pending",originTxHash:h};if(b.status!=="filled"||!b.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:h,destinationTxHash:b.destinationTxHash}}return{status:"pending",originTxHash:h}}catch(m){if(console.error("[names] register failed — raw error:",m,{name:i,buyer:x,originConfirmed:a}),m instanceof zt)return{status:"pending",originTxHash:m.txHash};throw d&&!a&&await Je(f,[d]).catch(()=>{}),m instanceof Me?m:new Error(_t(m,"Couldn't register the name. Please try again.",{sale:!0}))}}const Qt=s.div`
1
+ import{a as Ke,r as p,j as e,b as Qe}from"./react-BrLDncxD.js";import{c as F,w as Ze,q as Je,L as Xe,s,F as t,d as Te,n as Ye,o as ze,j as Ie,e as et,t as o,I as z,g as B,v as pe,x as D,y as tt,z as nt,u as Ne,G as st,A as K,au as ot,av as it}from"./index-D2u3qo5-.js";import{r as rt,a as at,m as _e}from"./mana-rate-DcCwt7oF.js";import{u as Ae,M as lt}from"./MarketCheckout-BemjD_ML.js";import{g as ct,h as dt,i as ft,j as pt,k as ut,C as xt,l as ht,o as mt,m as gt,n as bt,M as yt}from"./Assets.styles-Dz0IZ5_I.js";import{d as ue,R as wt,F as vt,S as xe,b as jt}from"./categories-7ZUMUxRc.js";import{L as $t}from"./LoadMore-DAM-bEob.js";import{u as Ct}from"./useInfiniteGrid-Cg-FBhvv.js";import{E as kt}from"./ErrorNotice-BDH9xoG4.js";import{d as St}from"./dcl-schemas-BICTSpB5.js";import{u as Rt,G as Et,w as Tt,S as zt}from"./buy-gasless-DRDa-VRS.js";import{s as It}from"./buy-CHyPhIFc.js";import{h as Nt}from"./trade-encoding-CtfVB9K4.js";import{f as _t}from"./errors-B3Jy0VAJ.js";import{J as At,C as Pt,B as ne}from"./ethers-BIvjmL85.js";import{l as Mt}from"./loader-logo-BzY9EKdC.js";import{n as Lt}from"./emotion-CSxEP8yM.js";import"./sentry-DYZXk5O5.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./authorizations-mnih5q8o.js";import"./Tooltip-CAVGsqiJ.js";function Q(n){const i=n.source??"item",f=n.tradeId||`${n.contractAddress}-${n.tokenId??n.itemId??""}`;return`${i}:${f}`}const W="100000000000000000000",Pe=2,V=15,Bt=/^[a-zA-Z0-9]+$/;function he(n){const i=n.trim();return i.length===0?{ok:!1,reason:"empty"}:Bt.test(i)?i.length<Pe?{ok:!1,reason:"too-short"}:i.length>V?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Ft(n){return n.replace(/[^a-zA-Z0-9]/g,"").slice(0,V)}const Wt=["function available(string _subdomain) view returns (bool)"],me={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Ht(){return F.chainId===St.ChainId.MATIC_MAINNET?me.mainnet:me.sepolia}async function Ut(n,i={}){var d;const{rpc:f,address:u}=Ht(),l=new At(f),c=new Pt(u,Wt,l);console.info(`[names] availability check → DCLRegistrar(${u}).available("${n}") on ${f}`);const x=await c.available(n);if((d=i.signal)!=null&&d.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${n}" available=${x}`),x?"available":"taken"}const Ot="https://app.across.to/api";class Me extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function Gt(n){return at(W,n)}async function qt(n,i,f={}){var d;const u=f.chainId??F.chainId,l=f.provider??"across",c=`${F.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(i)}&chainId=${u}&provider=${l}`,x=await Xe(c,{method:"GET",identity:n,metadata:{}});if(!x.ok){let a;try{a=(d=await x.json())==null?void 0:d.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new Me:new Error(`fetchNameCreditRoute ${x.status}`)}return x.json()}function Dt(n,i){const f=ne.from(n.availableAmount),l=ne.from(W).sub(f);return{credits:[{value:n.amount,expiresAt:Number(n.expiresAt),salt:Nt(n.id)}],creditsSignatures:[n.signature],externalCall:{target:i.externalCall.target,selector:i.externalCall.selector,data:i.externalCall.data,expiresAt:i.externalCall.expiresAt,salt:i.externalCall.salt},customExternalCallSignature:i.customExternalCallSignature,maxUncreditedValue:l.isNegative()?"0":l.toString(),maxCreditedValue:W}}async function Vt(n,i={}){const f=Ot,u=i.intervalMs??1e4,l=i.maxAttempts??60;let c={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let x=0;x<l;x++){try{const d=await fetch(`${f}/deposit/status?originChainId=137&depositTxHash=${n}`);if(d.ok){const a=await d.json(),m=(a.status??"pending").toLowerCase(),w=a.fillTx??a.fillTxnRef??null,y=a.actionsSucceeded!==!1;if(m==="filled")return{status:"filled",destinationTxHash:w,actionsSucceeded:y};if(m==="refunded"||m==="expired")return{status:m,destinationTxHash:null,actionsSucceeded:!1};c={status:"pending",destinationTxHash:w,actionsSucceeded:y}}}catch{}x<l-1&&await new Promise(d=>setTimeout(d,u))}return c}async function Kt(n){const{name:i,identity:f,signer:u}=n,l=n.chainId??F.chainId,c=n.provider??"across",x=(n.beneficiary??await u.getAddress()).toLowerCase();let d=null,a=!1;console.info("[names] register start",{name:i,buyer:x,chainId:l,provider:c});try{const m=await rt(l),w=Gt(m);console.info("[names] step 1/6 sized reservation",{usdCents:w,manaRate:m});const y=await qt(f,i,{chainId:l,provider:c});console.info("[names] step 2/6 route fetched",{target:y.externalCall.target,selector:y.externalCall.selector,provider:y.provider,quoteId:y.quoteId});const v=await Ze(f,w);if(d=v.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:v.credit.id,maxCreditedValue:v.maxCreditedValue}),ne.from(v.maxCreditedValue).lt(W))throw new Error("Credit under-sized for the name price");const C=Dt(v.credit,y);let h;try{h=await Rt({chainId:l,buyer:x,signer:u,args:C})}catch(b){if(!(b instanceof Et))throw b;h=await It(l,C,u)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:h}),await Tt(h),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:h}),c==="across"){const b=await Vt(h,n.acrossPoll);if(console.info("[names] step 6/6 across status",b),b.status==="pending")return{status:"pending",originTxHash:h};if(b.status!=="filled"||!b.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:h,destinationTxHash:b.destinationTxHash}}return{status:"pending",originTxHash:h}}catch(m){if(console.error("[names] register failed — raw error:",m,{name:i,buyer:x,originConfirmed:a}),m instanceof zt)return{status:"pending",originTxHash:m.txHash};throw d&&!a&&await Je(f,[d]).catch(()=>{}),m instanceof Me?m:new Error(_t(m,"Couldn't register the name. Please try again.",{sale:!0}))}}const Qt=s.div`
2
2
  position: fixed;
3
3
  inset: 0;
4
4
  z-index: 10000;
@@ -1,4 +1,4 @@
1
- import{r as y,j as t}from"./react-BrLDncxD.js";import{R as z,a as oe,C as ie,c as ne}from"./categories-BaqUBHO4.js";import{T as se}from"./Tooltip-Bz0rwSTJ.js";import{F as e,s as o,I as m,t as s,G as re,C as v}from"./index-N2L0zXX7.js";import{n as c}from"./emotion-CSxEP8yM.js";const ae=o.div`
1
+ import{r as y,j as t}from"./react-BrLDncxD.js";import{R as z,a as oe,C as ie,c as ne}from"./categories-7ZUMUxRc.js";import{T as se}from"./Tooltip-CAVGsqiJ.js";import{F as e,s as o,I as m,t as s,G as re,C as v}from"./index-D2u3qo5-.js";import{n as c}from"./emotion-CSxEP8yM.js";const ae=o.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 12px;
@@ -1,4 +1,4 @@
1
- import{j as t,L as R,r as L}from"./react-BrLDncxD.js";import{s as a,B as q,F as e,M as B,u as D,t as i,d as N,e as F,I as x,g as G,m as A,o as H,c as M,J as y,E as Q,H as z}from"./index-N2L0zXX7.js";import{b as K,c as W,s as J,d as O}from"./authorizations-BUCDfL2t.js";import{f as P}from"./errors-DWlrWfS6.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-iOoE_Tw3.js";const X=B`
1
+ import{j as t,L as R,r as L}from"./react-BrLDncxD.js";import{s as a,B as q,F as e,M as B,u as D,t as i,d as N,e as F,I as x,g as G,m as A,o as H,c as M,J as y,E as Q,H as z}from"./index-D2u3qo5-.js";import{b as K,c as W,s as J,d as O}from"./authorizations-mnih5q8o.js";import{f as P}from"./errors-B3Jy0VAJ.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-iOoE_Tw3.js";const X=B`
2
2
  to { transform: rotate(360deg); }
3
3
  `,U=a.section`
4
4
  width: 100%;
@@ -1,3 +1,3 @@
1
- import{j as e,r as y,a as qe,u as Ie,L as se}from"./react-BrLDncxD.js";import{t as a,g as R,j as J,u as Te,ae as v,a as ue,d as Fe,m as Re,n as Ae,o as Be,I as F,h as Le,e as Ue,x as D,ag as he,ah as We,E as U,s as ze,B as $e,C as Ke,w as Qe,q as me,ai as Oe,z as _e,y as Ge,aj as De}from"./index-N2L0zXX7.js";import{a as ye}from"./buy-ra8wh_Tw.js";import{a as He,w as Je,S as Ve,G as Ye}from"./buy-gasless-DxE_2TUI.js";import{R as H,r as Xe}from"./cart-checkout-B1K9PgL-.js";import{a as Ze}from"./authorizations-BUCDfL2t.js";import{u as es,M as ss,c as as}from"./useCreditPacks-DAdqCu9-.js";import{W as ts,C as rs,a as cs}from"./CollectionCarousel-DuuF5eCz.js";import{l as ns}from"./loader-logo-BzY9EKdC.js";import{i as os,a as is}from"./errors-DWlrWfS6.js";import{E as ls}from"./ErrorNotice-BDH9xoG4.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-Nzi47aTM.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./address-DrURAr9O.js";const ds="https://cdn.decentraland.org/@dcl/shop/0.1.0-29956042914.commit-dfd2644/assets/buy-error-22UunaPC.png";function us(r){const{phase:n,balanceCredits:u,onClose:h}=r,C=n==="processing",w=n==="error"?a("cartCheckout.errorTitle"):n==="nofunds"?a("cartCheckout.titleNoFunds"):a("cartCheckout.titleBuy"),S=n==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:C?void 0:h,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${S?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:w}),!C&&e.jsx("button",{className:"buy-modal__x",onClick:h,"aria-label":a("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:n==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),e.jsx(R,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:J(u)})]})]}),n==="processing"&&e.jsx(hs,{stage:r.stage??"reserving",step:r.step??1,total:r.total??1,isSelfCustody:!!r.isSelfCustody}),n==="nofunds"&&e.jsx(ms,{lines:r.lines??[],shortfallCredits:r.shortfallCredits??0,packs:r.packs??[],selectedPack:r.selectedPack??"",onSelectPack:r.onSelectPack??(()=>{}),onBuyPacks:r.onBuyPacks??(()=>{}),onCancel:h}),n==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:ds,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:a("cartCheckout.errorHeadline")})," ",a("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:h,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:r.onRetry??h,children:a("cartCheckout.tryAgain")})]})]})]})]})}function hs({stage:r,step:n,total:u,isSelfCustody:h}){const C=r==="reserving",w=u>0?Math.min(100,Math.round(n/u*100)):0,S=r==="awaiting-signature"?h?a("buyModal.confirmToContinue"):a("buyModal.completingTransaction"):r==="settling"?a("buyModal.completingTransaction"):a("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:ns,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:S}),C?e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill buy-modal__progress-fill--step",style:{width:`${w}%`}})}),u>1?e.jsxs("span",{className:"cart-checkout__step",children:[n,"/",u]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function ms({lines:r,shortfallCredits:n,packs:u,selectedPack:h,onSelectPack:C,onBuyPacks:w,onCancel:S}){const N=u.find(t=>t.id===h),V=r.reduce((t,m)=>t+(m.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(ts,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,n)})})," ",a("buyModal.warningToPurchase",{count:V})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:r.map(t=>{const m=t.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"buy-modal__asset-name",title:t.item.name,children:[t.item.name||a("buyModal.itemFallback"),m>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:a("cartCheckout.qty",{count:m})}):null]}),t.item.creator?e.jsx(rs,{address:t.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(R,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:J(t.priceCredits*m)})]})]})]},t.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:u.map(t=>{const m=t.id===h;return e.jsxs("button",{className:`buy-modal__pack${m?" buy-modal__pack--on":""}`,onClick:()=>C(t.id),children:[e.jsx(R,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:J(t.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",t.usd.toFixed(2),")"]})]},t.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(R,{className:"buy-modal__total-ico"}),e.jsx("span",{children:J((N==null?void 0:N.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((N==null?void 0:N.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:S,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:w,children:a("buyModal.buy")})]})]})}const _s=ze($e)`
1
+ import{j as e,r as y,a as qe,u as Ie,L as se}from"./react-BrLDncxD.js";import{t as a,g as R,j as J,u as Te,ae as v,a as ue,d as Fe,m as Re,n as Ae,o as Be,I as F,h as Le,e as Ue,x as D,ag as he,ah as We,E as U,s as ze,B as $e,C as Ke,w as Qe,q as me,ai as Oe,z as _e,y as Ge,aj as De}from"./index-D2u3qo5-.js";import{a as ye}from"./buy-CHyPhIFc.js";import{a as He,w as Je,S as Ve,G as Ye}from"./buy-gasless-DRDa-VRS.js";import{R as H,r as Xe}from"./cart-checkout-4SY4EejM.js";import{a as Ze}from"./authorizations-mnih5q8o.js";import{u as es,M as ss,c as as}from"./useCreditPacks-Djg10PxH.js";import{W as ts,C as rs,a as cs}from"./CollectionCarousel-D6IuiIc2.js";import{l as ns}from"./loader-logo-BzY9EKdC.js";import{i as os,a as is}from"./errors-B3Jy0VAJ.js";import{E as ls}from"./ErrorNotice-BDH9xoG4.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-CtfVB9K4.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./address-DrURAr9O.js";const ds="https://cdn.decentraland.org/@dcl/shop/0.1.0-29994094833.commit-84e34c2/assets/buy-error-22UunaPC.png";function us(r){const{phase:n,balanceCredits:u,onClose:h}=r,C=n==="processing",w=n==="error"?a("cartCheckout.errorTitle"):n==="nofunds"?a("cartCheckout.titleNoFunds"):a("cartCheckout.titleBuy"),S=n==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:C?void 0:h,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${S?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:w}),!C&&e.jsx("button",{className:"buy-modal__x",onClick:h,"aria-label":a("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:n==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),e.jsx(R,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:J(u)})]})]}),n==="processing"&&e.jsx(hs,{stage:r.stage??"reserving",step:r.step??1,total:r.total??1,isSelfCustody:!!r.isSelfCustody}),n==="nofunds"&&e.jsx(ms,{lines:r.lines??[],shortfallCredits:r.shortfallCredits??0,packs:r.packs??[],selectedPack:r.selectedPack??"",onSelectPack:r.onSelectPack??(()=>{}),onBuyPacks:r.onBuyPacks??(()=>{}),onCancel:h}),n==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:ds,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:a("cartCheckout.errorHeadline")})," ",a("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:h,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:r.onRetry??h,children:a("cartCheckout.tryAgain")})]})]})]})]})}function hs({stage:r,step:n,total:u,isSelfCustody:h}){const C=r==="reserving",w=u>0?Math.min(100,Math.round(n/u*100)):0,S=r==="awaiting-signature"?h?a("buyModal.confirmToContinue"):a("buyModal.completingTransaction"):r==="settling"?a("buyModal.completingTransaction"):a("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:ns,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:S}),C?e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill buy-modal__progress-fill--step",style:{width:`${w}%`}})}),u>1?e.jsxs("span",{className:"cart-checkout__step",children:[n,"/",u]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function ms({lines:r,shortfallCredits:n,packs:u,selectedPack:h,onSelectPack:C,onBuyPacks:w,onCancel:S}){const N=u.find(t=>t.id===h),V=r.reduce((t,m)=>t+(m.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(ts,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,n)})})," ",a("buyModal.warningToPurchase",{count:V})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:r.map(t=>{const m=t.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"buy-modal__asset-name",title:t.item.name,children:[t.item.name||a("buyModal.itemFallback"),m>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:a("cartCheckout.qty",{count:m})}):null]}),t.item.creator?e.jsx(rs,{address:t.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(R,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:J(t.priceCredits*m)})]})]})]},t.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:u.map(t=>{const m=t.id===h;return e.jsxs("button",{className:`buy-modal__pack${m?" buy-modal__pack--on":""}`,onClick:()=>C(t.id),children:[e.jsx(R,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:J(t.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",t.usd.toFixed(2),")"]})]},t.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(R,{className:"buy-modal__total-ico"}),e.jsx("span",{children:J((N==null?void 0:N.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((N==null?void 0:N.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:S,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:w,children:a("buyModal.buy")})]})]})}const _s=ze($e)`
2
2
  margin-top: 12px;
3
3
  `;function pe(r){if(os(r))return a("errors.rejected");const n=(r.message??"").toLowerCase();return n.includes("insufficient")?a("cart.error.insufficient",{currency:Ke.name}):n.includes("no active listing")||n.includes("your own listing")?a("cart.error.listingChanged"):a("marketCheckout.error.generic")}const ys=12e4;function ps(r){const n=[];return r.unavailable.length&&n.push(a("cart.drop.unavailable",{count:r.unavailable.length})),r.own.length&&n.push(a("cart.drop.own",{count:r.own.length})),a("cart.drop.removed",{items:n.join(` ${a("cart.drop.and")} `)})}const be=r=>r.reduce((n,u)=>n+u.priceCredits*u.quantity,0),bs=r=>r.flatMap(n=>Array.from({length:n.quantity},()=>({...n,quantity:1})));function As(){Te({title:a("nav.cart"),noindex:!0});const r=v(s=>s.items),n=v(s=>s.remove),u=v(s=>s.increment),h=v(s=>s.decrement),C=v(s=>s.clear),w=v(s=>s.restore),S=v(s=>s.setFittingOpen),N=ue(s=>s.items),V=ue(s=>s.toggle),{session:t}=Fe(),m=es().packs.slice(0,ss);y.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const ge=r.some(s=>s.category!=="emote"),{data:Y}=Re({queryKey:["upsell-listings"],queryFn:()=>De({first:40}),staleTime:6e4}),{data:A}=Ae(t),W=Be(),z=qe(),{state:M}=Ie(),[ae,B]=y.useState(null),[fe,E]=y.useState(null),[te,$]=y.useState(null),[xe,P]=y.useState(!1),[f,L]=y.useState(null),re=y.useRef(0),[l,j]=y.useState(null),[X,ce]=y.useState(""),Z=y.useRef(null),je=r.reduce((s,c)=>s+c.priceCredits*c.quantity,0),ne=r.reduce((s,c)=>s+c.quantity,0),ke=f?f.liveTotalCredits:je,ve=new Set(r.map(s=>s.id)),oe=((Y==null?void 0:Y.items)??[]).filter(s=>!ve.has(s.id)).slice(0,12),Ce=new Map(f==null?void 0:f.buyable.map(s=>[s.item.id,s])),K=(A==null?void 0:A.credits)??0,Ne=We;function Q(s){s(),L(null),$(null),E(null)}function we(){j(null),P(!1)}function ie(s){const c=be(s),o=Math.max(0,c-K),p=m.find(d=>d.credits>=o)??m[m.length-1];ce(p.id),D("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:c,credits_balance:K,shortfall:o}),j({phase:"nofunds",lines:s.map(d=>({item:d.item,priceCredits:d.priceCredits,quantity:d.quantity})),shortfall:o}),P(!1)}async function Se(s){if(!t||s.length===0)return;const c=bs(s),o=c.map(i=>({...i.item,priceCredits:i.priceCredits})),p=s.map(i=>({...i.item,priceCredits:i.priceCredits,quantity:i.quantity})),d=[];let k="authorize",G=!1;j({phase:"processing",stage:"reserving",step:1,total:c.length});try{const i=[];for(let x=0;x<c.length;x++){const T=c[x];j({phase:"processing",stage:"reserving",step:x+1,total:c.length});try{const{credit:_,maxCreditedValue:ee}=await Qe(t.identity,T.usdCents,T.trade.id);d.push(_.id),i.push({trade:T.trade,credits:[_],maxCreditedValue:ee})}catch(_){if(is(_)){if(d.length){try{await me(t.identity,d)}catch(ee){U(ee,{flow:"cart_checkout",step:"release"})}W.invalidateQueries({queryKey:["usd-balance"]})}ie(s);return}throw _}}k="submit";const b=()=>j({phase:"processing",stage:"settling",step:c.length,total:c.length});j({phase:"processing",stage:"awaiting-signature",step:c.length,total:c.length});let g=[];if(Ze())try{g=await He({purchases:i,buyer:t.address,signer:t.signer,onSigned:b});const T=(await Promise.allSettled(g.map(_=>Je(_)))).flatMap(_=>_.status==="rejected"?[_.reason]:[]);if(T.length&&!T.some(_=>_ instanceof Ve))throw T[0];G=!0}catch(x){if(!(x instanceof Ye))throw x;g=await ye({purchases:i,buyer:t.address,signer:t.signer,onSigned:b})}else g=await ye({purchases:i,buyer:t.address,signer:t.signer});s.forEach(x=>n(x.item.id)),L(null),D("Shop Completed Purchase",{...Oe(o),payment_type:"credits",no_crypto_step:G,transaction_hash:g[0]??null}),W.invalidateQueries({queryKey:["usd-balance"]});const I=Z.current;Z.current=null,j(null),P(!1);const Pe={items:p,txHash:g[0]??void 0,settled:!0,...I?{creditsAdded:I}:{}};z("/success",{state:Pe,replace:!0})}catch(i){if(_e(i)||U(i,{flow:"cart_checkout",step:k,cart_size:s.length}),D(_e(i)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:k,error_code:Ge(i),value_usd:he(o.reduce((b,g)=>b+g.priceCredits,0)),cart_size:c.length}),d.length){try{await me(t.identity,d)}catch(b){U(b,{flow:"cart_checkout",step:"release"})}W.invalidateQueries({queryKey:["usd-balance"]})}j({phase:"error",message:pe(i)})}}function le(s){const c=be(s);if(A!=null&&A.credits<c){ie(s);return}Se(s)}async function O(){if(!t){E(a("buyModal.signInToCheckout"));return}const s=v.getState().items;if(s.length===0)return;E(null),$(null),P(!0);const c=s.reduce((o,p)=>o+p.priceCredits*p.quantity,0);D("Shop Started Checkout",{cart_size:s.length,cart_value_credits:c,cart_value_usd:he(c),has_sufficient_credits:K>=c});try{B(a("cart.status.reviewing"));const o=await Xe(s,t.address,Ne),p=[...o.unavailable,...o.own];if(p.length&&(p.forEach(d=>n(d.id)),$(ps(o))),o.buyable.length===0){E(a("cart.error.noneAvailable")),L(null),B(null);return}if(o.orderChanged){L(o),re.current=Date.now(),B(null);return}B(null),le(o.buyable)}catch(o){U(o,{flow:"cart_checkout",step:"review",cart_size:s.length}),E(pe(o)),B(null)}finally{P(!1)}}async function Me(){if(f){if(!t){E(a("buyModal.signInToCheckout"));return}if(Date.now()-re.current>ys){L(null),$(null),await O();return}E(null),le(f.buyable)}}async function Ee(){if(X){try{sessionStorage.setItem(H,JSON.stringify(v.getState().items))}catch{}P(!0);try{const s=await as(X,t?{address:t.address,identity:t.identity}:void 0);if(s.url){window.location.href=s.url;return}z("/credits")}catch(s){try{sessionStorage.removeItem(H)}catch{}U(s,{flow:"cart_buy_credits"}),j({phase:"error",message:a("buyModal.error.creditsCheckout")})}finally{P(!1)}}}const de=y.useRef(!1);y.useEffect(()=>{if(!(M!=null&&M.resumeCheckout)||de.current)return;de.current=!0,Z.current=M.creditsAdded??null;try{const c=sessionStorage.getItem(H);if(c){sessionStorage.removeItem(H);const o=JSON.parse(c);Array.isArray(o)&&o.length&&w(o)}}catch{}W.invalidateQueries({queryKey:["usd-balance"]});const s=setTimeout(()=>void O(),0);return()=>clearTimeout(s)},[M==null?void 0:M.resumeCheckout]);const q=xe||(l==null?void 0:l.phase)==="processing";return r.length===0&&!l?e.jsxs("div",{className:"cart cart--empty",children:[e.jsx(F,{name:"cart",size:44,color:"var(--muted-2)"}),e.jsx("p",{className:"cart-empty__title",children:a("cart.empty.title")}),e.jsx("p",{className:"muted",children:a("cart.empty.body")}),e.jsx(_s,{as:se,to:"/assets",variant:"purple",children:a("cart.empty.cta")})]}):e.jsxs("div",{className:"checkout",children:[e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>z(-1),type:"button",children:[e.jsx(F,{name:"arrow-left"}),a("nav.cart")]}),e.jsxs("div",{className:"checkout__body",children:[e.jsxs("div",{className:"checkout__left",children:[e.jsxs("div",{className:"checkout__head-card",children:[e.jsx("button",{className:"checkout__panel-back",onClick:()=>z(-1),type:"button","aria-label":a("cart.goBack"),children:e.jsx(F,{name:"arrow-left"})}),e.jsx("h1",{className:"checkout__panel-title",children:a("cart.panelTitle",{count:ne})}),ge?e.jsxs("button",{className:"checkout__fitting",onClick:()=>S(!0),disabled:q,children:[e.jsx(F,{name:"fitting-room"}),a("cart.fittingRoom")]}):null]}),e.jsxs("section",{className:"checkout__panel",children:[e.jsx("div",{className:"checkout__list",children:r.map(s=>{const c=Ce.get(s.id),o=c?c.priceCredits:s.priceCredits,p=!!c&&c.priceCredits!==s.priceCredits,d=!s.tokenId,k=s.quantity,G=typeof s.available=="number"&&k>=s.available,i=o*k,b=!!N[s.id],g=s.tokenId??s.itemId,I=s.contractAddress&&g?`/item/${s.contractAddress}/${g}`:null;return e.jsxs("div",{className:"checkout__card",children:[e.jsxs("div",{className:"checkout__thumb",children:[I?e.jsx(se,{className:"checkout__thumb-link",to:I,state:{item:s,tradeId:s.tradeId},"aria-label":s.name,children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null}):s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null,e.jsx("span",{className:"checkout__thumb-check","aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"checkout__info",children:[e.jsxs("div",{className:"checkout__desc",children:[I?e.jsx(se,{className:"checkout__name",to:I,state:{item:s,tradeId:s.tradeId},title:s.name,children:s.name}):e.jsx("div",{className:"checkout__name",title:s.name,children:s.name}),s.creator?e.jsx(Le,{address:s.creator,className:"checkout__creator",linkToProfile:!0}):null]}),e.jsxs("div",{className:"checkout__foot",children:[d?e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>Q(()=>h(s.id)),disabled:q||k<=1,"aria-label":a("cart.decreaseQuantity",{name:s.name}),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx("span",{className:"checkout__qty",children:k}),e.jsx("button",{className:"checkout__step",onClick:()=>Q(()=>u(s.id)),disabled:q||G,"aria-label":a("cart.increaseQuantity"),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null,e.jsxs("div",{className:"checkout__price",children:[e.jsx(R,{className:"checkout__price-ico"})," ",i,p?e.jsx("span",{className:"checkout__price-was",children:s.priceCredits*k}):null]})]})]}),e.jsxs("div",{className:"checkout__actions",children:[e.jsx("button",{className:`checkout__fav${b?" is-on":""}`,onClick:()=>V(s),"aria-label":b?a("cart.removeFromFavorites",{name:s.name}):a("cart.addToFavorites",{name:s.name}),title:b?a("assetCard.removeFromFavorites"):a("assetCard.addToFavorites"),children:e.jsx(F,{name:b?"heart-solid":"heart"})}),e.jsx("button",{className:"checkout__remove",onClick:()=>Q(()=>n(s.id)),disabled:q,"aria-label":a("cart.remove",{name:s.name}),title:a("cart.removeTitle"),children:e.jsx(F,{name:"trash",size:24})})]})]},s.id)})}),e.jsx("div",{className:"checkout__utils",children:e.jsx("button",{className:"link",onClick:()=>Q(C),disabled:q,children:a("cart.clearCart")})})]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:a("cart.purchaseSummary")}),e.jsxs("div",{className:"checkout__summary-body",children:[e.jsxs("div",{className:"checkout__total-line",children:[e.jsx("span",{className:"checkout__total-label",children:a("cart.totalItems",{count:ne})}),e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(R,{className:"checkout__total-ico"})," ",ke]})]}),e.jsx("button",{className:"checkout__cta",onClick:()=>void(f?Me():O()),disabled:q,children:q?a("cart.working"):f?a("marketCheckout.confirmPurchase"):a("assetCard.buyNow")}),f?e.jsx("p",{className:"muted checkout__msg",children:a("cart.priceChanged")}):null,te?e.jsx("p",{className:"muted checkout__msg",children:te}):null,ae?e.jsx("p",{className:"muted checkout__msg",children:ae}):null,e.jsx(ls,{message:fe,className:"checkout__msg"})]})]})]})]}),oe.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(cs,{title:a("cart.youMightAlsoLike"),items:oe})}):null,l?e.jsx(us,{phase:l.phase,balanceCredits:K,onClose:we,stage:l.phase==="processing"?l.stage:void 0,step:l.phase==="processing"?l.step:void 0,total:l.phase==="processing"?l.total:void 0,isSelfCustody:Ue(t==null?void 0:t.providerType),lines:l.phase==="nofunds"?l.lines:void 0,shortfallCredits:l.phase==="nofunds"?l.shortfall:void 0,packs:m,selectedPack:X,onSelectPack:ce,onBuyPacks:()=>void Ee(),message:l.phase==="error"?l.message:void 0,onRetry:()=>void O()}):null]})}export{As as Cart};
@@ -1,4 +1,4 @@
1
- import{N,O as U,P as w,Q as z,R as o,S as E,U as c,V as I,W as g,X as D,M}from"./index-N2L0zXX7.js";import{r as W,j as v}from"./react-BrLDncxD.js";function F(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const K=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,S,b,$;const t=44,V=M(P||(P=l`
1
+ import{N,O as U,P as w,Q as z,R as o,S as E,U as c,V as I,W as g,X as D,M}from"./index-D2u3qo5-.js";import{r as W,j as v}from"./react-BrLDncxD.js";function F(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const K=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,S,b,$;const t=44,V=M(P||(P=l`
2
2
  0% {
3
3
  transform: rotate(0deg);
4
4
  }
@@ -1,4 +1,4 @@
1
- import{j as e,r as p,d as Q,a as Y}from"./react-BrLDncxD.js";import{F as N,s as v,ak as Z,I as J,t,c as V,E as W,m as X,u as ee,A as ae,ao as te,C as re,ap as se}from"./index-N2L0zXX7.js";import{E as oe}from"./ErrorNotice-BDH9xoG4.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-Djfr3IjX.js";import{u as de}from"./useStore-Dk-xL0c8.js";import{s as E}from"./address-DrURAr9O.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-BaqUBHO4.js";import{L as xe}from"./LoadMore-Cmni2e-s.js";import{u as he}from"./useInfiniteGrid-CgxIpgDb.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";const be=v.section`
1
+ import{j as e,r as p,d as Q,a as Y}from"./react-BrLDncxD.js";import{F as N,s as v,ak as Z,I as J,t,c as V,E as W,m as X,u as ee,A as ae,ao as te,C as re,ap as se}from"./index-D2u3qo5-.js";import{E as oe}from"./ErrorNotice-BDH9xoG4.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-LjzTm4kD.js";import{u as de}from"./useStore-Bvj7HKvJ.js";import{s as E}from"./address-DrURAr9O.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-7ZUMUxRc.js";import{L as xe}from"./LoadMore-DAM-bEob.js";import{u as he}from"./useInfiniteGrid-Cg-FBhvv.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";const be=v.section`
2
2
  position: relative;
3
3
  border-radius: ${N.radius.card};
4
4
  overflow: hidden;
@@ -1 +1 @@
1
- import{j as e,r as o}from"./react-BrLDncxD.js";import{ak as b,G as N,t as n,I as E,al as _,A as W}from"./index-N2L0zXX7.js";import{s as A}from"./address-DrURAr9O.js";function M({address:c,className:i}){const{data:l}=b(c),s=l!=null&&l.name?N(l.name):A(c);return e.jsx("div",{className:i,children:n("search.byCreator",{name:s})})}function P({className:c}){return e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:c,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"#691fa9",strokeWidth:"1.8"}),e.jsx("path",{d:"M12 7v6",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"16.5",r:"1.1",fill:"#691fa9"})]})}function z({title:c,items:i,onViewAll:l}){const s=o.useRef(null),[d,v]=o.useState(1),[h,j]=o.useState(0),[g,k]=o.useState(!0),[p,C]=o.useState(!1),a=o.useCallback(()=>{const r=s.current;if(!r)return;const{scrollLeft:t,scrollWidth:f,clientWidth:u}=r,x=Math.max(1,Math.ceil(f/u));v(x),j(Math.min(x-1,Math.round(t/u))),k(t<=1),C(t+u>=f-1)},[]);if(o.useEffect(()=>{a();const r=s.current;if(r)return r.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a),()=>{r.removeEventListener("scroll",a),window.removeEventListener("resize",a)}},[a,i.length]),i.length===0)return null;function m(r){const t=s.current;t&&t.scrollBy({left:r*t.clientWidth,behavior:"smooth"})}function w(r){const t=s.current;t&&t.scrollTo({left:r*t.clientWidth,behavior:"smooth"})}return e.jsxs("section",{className:"collection-carousel",children:[e.jsxs("div",{className:"collection-carousel__head",children:[e.jsx("h2",{className:"collection-carousel__title",children:c}),l?e.jsxs("button",{className:"collection-carousel__viewall",onClick:l,children:[n("collectionCarousel.viewAll"),e.jsx(E,{name:"chevron-down",size:16,className:"collection-carousel__viewall-ico"})]}):null]}),e.jsxs("div",{className:"collection-carousel__viewport",children:[e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--left",onClick:()=>m(-1),"aria-label":n("collectionCarousel.scrollLeft"),disabled:g,children:e.jsx("img",{src:_,alt:"","aria-hidden":!0})}),e.jsx("div",{className:"collection-carousel__track",ref:s,children:i.map(r=>e.jsx(W,{item:r},r.id))}),e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>m(1),"aria-label":n("collectionCarousel.scrollRight"),disabled:p,children:e.jsx("img",{src:_,alt:"","aria-hidden":!0})})]}),d>1?e.jsx("div",{className:"collection-carousel__dots","aria-label":n("collectionCarousel.pages"),children:Array.from({length:d}).map((r,t)=>e.jsx("button",{className:`collection-carousel__dot${t===h?" is-active":""}`,"aria-label":n("collectionCarousel.goToPage",{page:t+1}),"aria-current":t===h?"true":void 0,onClick:()=>w(t)},t))}):null]})}export{M as C,P as W,z as a};
1
+ import{j as e,r as o}from"./react-BrLDncxD.js";import{ak as b,G as N,t as n,I as E,al as _,A as W}from"./index-D2u3qo5-.js";import{s as A}from"./address-DrURAr9O.js";function M({address:c,className:i}){const{data:l}=b(c),s=l!=null&&l.name?N(l.name):A(c);return e.jsx("div",{className:i,children:n("search.byCreator",{name:s})})}function P({className:c}){return e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:c,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"#691fa9",strokeWidth:"1.8"}),e.jsx("path",{d:"M12 7v6",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"16.5",r:"1.1",fill:"#691fa9"})]})}function z({title:c,items:i,onViewAll:l}){const s=o.useRef(null),[d,v]=o.useState(1),[h,j]=o.useState(0),[g,k]=o.useState(!0),[p,C]=o.useState(!1),a=o.useCallback(()=>{const r=s.current;if(!r)return;const{scrollLeft:t,scrollWidth:f,clientWidth:u}=r,x=Math.max(1,Math.ceil(f/u));v(x),j(Math.min(x-1,Math.round(t/u))),k(t<=1),C(t+u>=f-1)},[]);if(o.useEffect(()=>{a();const r=s.current;if(r)return r.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a),()=>{r.removeEventListener("scroll",a),window.removeEventListener("resize",a)}},[a,i.length]),i.length===0)return null;function m(r){const t=s.current;t&&t.scrollBy({left:r*t.clientWidth,behavior:"smooth"})}function w(r){const t=s.current;t&&t.scrollTo({left:r*t.clientWidth,behavior:"smooth"})}return e.jsxs("section",{className:"collection-carousel",children:[e.jsxs("div",{className:"collection-carousel__head",children:[e.jsx("h2",{className:"collection-carousel__title",children:c}),l?e.jsxs("button",{className:"collection-carousel__viewall",onClick:l,children:[n("collectionCarousel.viewAll"),e.jsx(E,{name:"chevron-down",size:16,className:"collection-carousel__viewall-ico"})]}):null]}),e.jsxs("div",{className:"collection-carousel__viewport",children:[e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--left",onClick:()=>m(-1),"aria-label":n("collectionCarousel.scrollLeft"),disabled:g,children:e.jsx("img",{src:_,alt:"","aria-hidden":!0})}),e.jsx("div",{className:"collection-carousel__track",ref:s,children:i.map(r=>e.jsx(W,{item:r},r.id))}),e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>m(1),"aria-label":n("collectionCarousel.scrollRight"),disabled:p,children:e.jsx("img",{src:_,alt:"","aria-hidden":!0})})]}),d>1?e.jsx("div",{className:"collection-carousel__dots","aria-label":n("collectionCarousel.pages"),children:Array.from({length:d}).map((r,t)=>e.jsx("button",{className:`collection-carousel__dot${t===h?" is-active":""}`,"aria-label":n("collectionCarousel.goToPage",{page:t+1}),"aria-current":t===h?"true":void 0,onClick:()=>w(t)},t))}):null]})}export{M as C,P as W,z as a};
@@ -1 +1 @@
1
- import{a as K,j as e,L as re,d as se,b as te,r as N}from"./react-BrLDncxD.js";import{aq as oe,ar as ce,h as le,t as a,as as E,B as ne,ak as D,d as ie,I,c as de,u as me,A as ue,aj as he,at as ge,C as xe}from"./index-N2L0zXX7.js";import{d as _e,g as pe,a as je,A as Ne}from"./collection-Djfr3IjX.js";import{u as be,L as fe}from"./useStore-Dk-xL0c8.js";import{s as O}from"./address-DrURAr9O.js";import{d as $,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-BaqUBHO4.js";import{L as B}from"./LoadMore-Cmni2e-s.js";import{u as R}from"./useInfiniteGrid-CgxIpgDb.js";import{E as T}from"./ErrorNotice-BDH9xoG4.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";function Pe({collection:t,cover:r,itemCount:o}){const n=K(),{contractAddress:m,name:g,creator:x}=t,j=r==null||o==null,{data:i}=oe(m,j),p=r==null?(i==null?void 0:i.items)??[]:[],h=o??(i==null?void 0:i.total);function _(){n(`/collection/${m}`)}return e.jsxs("article",{className:"coll-card",role:"link",tabIndex:0,onClick:_,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),_())},children:[e.jsx("div",{className:"coll-card__media",children:r?e.jsx("img",{className:"coll-card__img","data-testid":"coll-card-img",src:r,alt:"",loading:"lazy"}):p.length>0?e.jsx(ce,{items:p,className:"coll-card__cover"}):null}),e.jsxs("div",{className:"coll-card__body",children:[e.jsx("h3",{className:"coll-card__name",title:g,children:g}),e.jsxs("div",{className:"coll-card__meta",children:[x?e.jsx(le,{address:x,className:"coll-card__creator",linkToProfile:!0}):e.jsx("span",{className:"coll-card__creator",children:" "}),e.jsx("span",{className:"coll-card__count",children:h==null?"…":a("collectionCard.itemCount",{count:h})})]}),e.jsx("button",{className:"coll-card__view",onClick:d=>{d.stopPropagation(),_()},tabIndex:-1,children:a("collectionCard.viewCollection")})]})]})}function Se({address:t,className:r=""}){const o=E(m=>m.followed.includes(t.toLowerCase())),n=E(m=>m.toggle);return t?e.jsx(ne,{type:"button",size:"sm",variant:o?"ghost":"outline",className:r||void 0,"aria-pressed":o,title:o?a("creator.unfollowTitle"):a("creator.followTitle"),onClick:()=>n(t),children:o?a("creator.following"):a("creator.follow")}):null}const ye={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function Le({address:t}){var d,b;const{data:r}=D(t),{data:o}=be(t),n=ie(l=>{var f;return(f=l.session)==null?void 0:f.address}),m=!!n&&n.toLowerCase()===t.toLowerCase(),g=(r==null?void 0:r.name)||O(t),x=(b=(d=r==null?void 0:r.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,j=(o==null?void 0:o.cover)||_e,i=o==null?void 0:o.description,p=`${de.profileUrl}/${t}`,h=fe.filter(l=>o==null?void 0:o.links[l]),_=pe(je({name:r==null?void 0:r.name,hasClaimedName:r==null?void 0:r.hasClaimedName,ethAddress:(r==null?void 0:r.ethAddress)??t}));return e.jsxs("section",{className:"creator-hero","aria-label":`${g} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:j,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link","data-testid":"creator-hero-link",href:(o==null?void 0:o.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:a(`creator.link.${l}`),"aria-label":a(`creator.link.${l}`),children:e.jsx(I,{name:ye[l]})},l)),m&&e.jsx(re,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:a("creator.editStore"),"aria-label":a("creator.editStore"),children:e.jsx(I,{name:"pen"})})]}),e.jsxs("div",{className:"creator-hero__body",children:[x?e.jsx("img",{className:"creator-hero__ava",src:x,alt:"",loading:"eager",style:{backgroundColor:_}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:_}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:g}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view","data-testid":"creator-hero-view",href:p,target:"_blank",rel:"noopener noreferrer",children:a("creator.viewProfile")}),e.jsx(Se,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function Ge(){const{address:t}=se(),r=K(),[o]=te(),n=o.has("collections"),{data:m}=D(t),g=(m==null?void 0:m.name)||(t?O(t):a("creator.fallbackName"));me({title:g,description:a("seo.creator.description",{name:g})});const[x,j]=N.useState("wearable"),[i,p]=N.useState(null),[h,_]=N.useState([]),[d,b]=N.useState(""),[l,f]=N.useState(""),[P,z]=N.useState("newest"),S=d&&!Number.isNaN(Number(d))?Number(d):void 0,y=l&&!Number.isNaN(Number(l))?Number(l):void 0,G=i?ke[i]:void 0,H=($.find(s=>s.key===P)??$[0]).server,L={creator:t,category:x,rarities:h.length?h:void 0,wearableCategories:G,minPriceCredits:S,maxPriceCredits:y,sortBy:H},{items:v,total:Y,isLoading:C,error:A,hasNextPage:q,isFetchingNextPage:F,fetchNextPage:W}=R(["creator-listings",L],s=>he({...L,first:U,skip:s}),{enabled:!!t&&!n}),u=R(["creator-collections",t],s=>ge(t,{first:U,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!t&&n});function Z(s){j(s),p(null),n&&M()}function M(){const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}`:""},{replace:!0})}function J(){if(n){M();return}const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function Q(s){_(c=>c.includes(s)?c.filter(ae=>ae!==s):[...c,s])}function V(){j("wearable"),p(null),_([]),b(""),f("")}const k=!!(S||y),X=k?`${d||"0"}–${l||"∞"}`:a("filter.price"),ee=x!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":a("creator.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:a("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:g})]}),t?e.jsx(Le,{address:t}):null,!n&&!C&&v.length>0?e.jsx(Ne,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(ve,{category:x,subCategory:i,onCategory:Z,onSub:p,title:a("creator.category"),flat:!0,collections:n,onCollections:J})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":a("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(Pe,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:a("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{rarities:h,onToggleRarity:Q,sort:P,onSort:z,total:Y,loading:C,anyActive:ee,onClear:V,renderTrailing:s=>e.jsx(we,{panelKey:"price",label:X,active:k,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMin"),placeholder:a("creator.priceMinPlaceholder"),value:d,onChange:c=>b(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMax"),placeholder:a("creator.priceMaxPlaceholder"),value:l,onChange:c=>f(c.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:a("creator.priceHint",{currency:xe.name})})]})})}),A?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid",children:C?e.jsx(w,{count:15}):e.jsxs(e.Fragment,{children:[v.map(s=>e.jsx(ue,{item:s},s.id)),F?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:q,isFetching:F,onLoadMore:()=>void W()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:a("creator.empty")}):null]})})]})]})}export{Ge as Creator,Ge as default};
1
+ import{a as K,j as e,L as re,d as se,b as te,r as N}from"./react-BrLDncxD.js";import{aq as oe,ar as ce,h as le,t as a,as as E,B as ne,ak as D,d as ie,I,c as de,u as me,A as ue,aj as he,at as ge,C as xe}from"./index-D2u3qo5-.js";import{d as _e,g as pe,a as je,A as Ne}from"./collection-LjzTm4kD.js";import{u as be,L as fe}from"./useStore-Bvj7HKvJ.js";import{s as O}from"./address-DrURAr9O.js";import{d as $,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-7ZUMUxRc.js";import{L as B}from"./LoadMore-DAM-bEob.js";import{u as R}from"./useInfiniteGrid-Cg-FBhvv.js";import{E as T}from"./ErrorNotice-BDH9xoG4.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";function Pe({collection:t,cover:r,itemCount:o}){const n=K(),{contractAddress:m,name:g,creator:x}=t,j=r==null||o==null,{data:i}=oe(m,j),p=r==null?(i==null?void 0:i.items)??[]:[],h=o??(i==null?void 0:i.total);function _(){n(`/collection/${m}`)}return e.jsxs("article",{className:"coll-card",role:"link",tabIndex:0,onClick:_,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),_())},children:[e.jsx("div",{className:"coll-card__media",children:r?e.jsx("img",{className:"coll-card__img","data-testid":"coll-card-img",src:r,alt:"",loading:"lazy"}):p.length>0?e.jsx(ce,{items:p,className:"coll-card__cover"}):null}),e.jsxs("div",{className:"coll-card__body",children:[e.jsx("h3",{className:"coll-card__name",title:g,children:g}),e.jsxs("div",{className:"coll-card__meta",children:[x?e.jsx(le,{address:x,className:"coll-card__creator",linkToProfile:!0}):e.jsx("span",{className:"coll-card__creator",children:" "}),e.jsx("span",{className:"coll-card__count",children:h==null?"…":a("collectionCard.itemCount",{count:h})})]}),e.jsx("button",{className:"coll-card__view",onClick:d=>{d.stopPropagation(),_()},tabIndex:-1,children:a("collectionCard.viewCollection")})]})]})}function Se({address:t,className:r=""}){const o=E(m=>m.followed.includes(t.toLowerCase())),n=E(m=>m.toggle);return t?e.jsx(ne,{type:"button",size:"sm",variant:o?"ghost":"outline",className:r||void 0,"aria-pressed":o,title:o?a("creator.unfollowTitle"):a("creator.followTitle"),onClick:()=>n(t),children:o?a("creator.following"):a("creator.follow")}):null}const ye={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function Le({address:t}){var d,b;const{data:r}=D(t),{data:o}=be(t),n=ie(l=>{var f;return(f=l.session)==null?void 0:f.address}),m=!!n&&n.toLowerCase()===t.toLowerCase(),g=(r==null?void 0:r.name)||O(t),x=(b=(d=r==null?void 0:r.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,j=(o==null?void 0:o.cover)||_e,i=o==null?void 0:o.description,p=`${de.profileUrl}/${t}`,h=fe.filter(l=>o==null?void 0:o.links[l]),_=pe(je({name:r==null?void 0:r.name,hasClaimedName:r==null?void 0:r.hasClaimedName,ethAddress:(r==null?void 0:r.ethAddress)??t}));return e.jsxs("section",{className:"creator-hero","aria-label":`${g} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:j,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link","data-testid":"creator-hero-link",href:(o==null?void 0:o.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:a(`creator.link.${l}`),"aria-label":a(`creator.link.${l}`),children:e.jsx(I,{name:ye[l]})},l)),m&&e.jsx(re,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:a("creator.editStore"),"aria-label":a("creator.editStore"),children:e.jsx(I,{name:"pen"})})]}),e.jsxs("div",{className:"creator-hero__body",children:[x?e.jsx("img",{className:"creator-hero__ava",src:x,alt:"",loading:"eager",style:{backgroundColor:_}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:_}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:g}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view","data-testid":"creator-hero-view",href:p,target:"_blank",rel:"noopener noreferrer",children:a("creator.viewProfile")}),e.jsx(Se,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function Ge(){const{address:t}=se(),r=K(),[o]=te(),n=o.has("collections"),{data:m}=D(t),g=(m==null?void 0:m.name)||(t?O(t):a("creator.fallbackName"));me({title:g,description:a("seo.creator.description",{name:g})});const[x,j]=N.useState("wearable"),[i,p]=N.useState(null),[h,_]=N.useState([]),[d,b]=N.useState(""),[l,f]=N.useState(""),[P,z]=N.useState("newest"),S=d&&!Number.isNaN(Number(d))?Number(d):void 0,y=l&&!Number.isNaN(Number(l))?Number(l):void 0,G=i?ke[i]:void 0,H=($.find(s=>s.key===P)??$[0]).server,L={creator:t,category:x,rarities:h.length?h:void 0,wearableCategories:G,minPriceCredits:S,maxPriceCredits:y,sortBy:H},{items:v,total:Y,isLoading:C,error:A,hasNextPage:q,isFetchingNextPage:F,fetchNextPage:W}=R(["creator-listings",L],s=>he({...L,first:U,skip:s}),{enabled:!!t&&!n}),u=R(["creator-collections",t],s=>ge(t,{first:U,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!t&&n});function Z(s){j(s),p(null),n&&M()}function M(){const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}`:""},{replace:!0})}function J(){if(n){M();return}const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function Q(s){_(c=>c.includes(s)?c.filter(ae=>ae!==s):[...c,s])}function V(){j("wearable"),p(null),_([]),b(""),f("")}const k=!!(S||y),X=k?`${d||"0"}–${l||"∞"}`:a("filter.price"),ee=x!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":a("creator.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:a("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:g})]}),t?e.jsx(Le,{address:t}):null,!n&&!C&&v.length>0?e.jsx(Ne,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(ve,{category:x,subCategory:i,onCategory:Z,onSub:p,title:a("creator.category"),flat:!0,collections:n,onCollections:J})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":a("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(Pe,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:a("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{rarities:h,onToggleRarity:Q,sort:P,onSort:z,total:Y,loading:C,anyActive:ee,onClear:V,renderTrailing:s=>e.jsx(we,{panelKey:"price",label:X,active:k,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMin"),placeholder:a("creator.priceMinPlaceholder"),value:d,onChange:c=>b(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMax"),placeholder:a("creator.priceMaxPlaceholder"),value:l,onChange:c=>f(c.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:a("creator.priceHint",{currency:xe.name})})]})})}),A?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid",children:C?e.jsx(w,{count:15}):e.jsxs(e.Fragment,{children:[v.map(s=>e.jsx(ue,{item:s},s.id)),F?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:q,isFetching:F,onLoadMore:()=>void W()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:a("creator.empty")}):null]})})]})]})}export{Ge as Creator,Ge as default};
@@ -1,4 +1,4 @@
1
- import{b7 as U,b8 as Ue,R as C,b9 as qe,ba as Ye,$ as Qe,bb as Je,aW as Xe,Q as R,a$ as K,a_ as Te,bc as a,bd as Ze,be as Le,T as et,b5 as tt}from"./index-N2L0zXX7.js";import{R as rt,g as ot}from"./getOverlayAlpha-F1qRCVfQ.js";import{j as T,r as y}from"./react-BrLDncxD.js";import{u as nt,a as Be}from"./useTheme-BrDoOqsp.js";function ne(r){const o=Ue(r);return r!==o&&o.styles?(o.styles.match(/^@layer\s+[^{]*$/)||(o.styles=`@layer global{${o.styles}}`),o):r}function at({styles:r,themeId:o,defaultTheme:n={}}){const i=nt(n),s=o&&i[o]||i;let l=typeof r=="function"?r(s):r;return s.modularCssLayers&&(Array.isArray(l)?l=l.map(d=>ne(typeof d=="function"?d(s):d)):l=ne(l)),T.jsx(U,{styles:l})}const Ee=y.createContext(null);function se(){return y.useContext(Ee)}const it=typeof Symbol=="function"&&Symbol.for,st=it?Symbol.for("mui.nested"):"__THEME_NESTED__";function lt(r,o){return typeof o=="function"?o(r):C({},r,o)}function ct(r){const{children:o,theme:n}=r,i=se(),s=y.useMemo(()=>{const l=i===null?n:lt(i,n);return l!=null&&(l[st]=i!==null),l},[n,i]);return T.jsx(Ee.Provider,{value:s,children:o})}function dt(r){const o=Be(),n=qe()||"",{modularCssLayers:i}=r;let s="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!i||o!==null?s="":typeof i=="string"?s=i.replace(/mui(?!\.)/g,s):s=`@layer ${s};`,Ye(()=>{const l=document.querySelector("head");if(!l)return;const d=l.firstChild;if(s){var m;if(d&&(m=d.hasAttribute)!=null&&m.call(d,"data-mui-layer-order")&&d.getAttribute("data-mui-layer-order")===n)return;const S=document.createElement("style");S.setAttribute("data-mui-layer-order",n),S.textContent=s,l.prepend(S)}else{var f;(f=l.querySelector(`style[data-mui-layer-order="${n}"]`))==null||f.remove()}},[s,n]),s?T.jsx(at,{styles:s}):null}const $e={};function xe(r,o,n,i=!1){return y.useMemo(()=>{const s=r&&o[r]||o;if(typeof n=="function"){const l=n(s),d=r?C({},o,{[r]:l}):l;return i?()=>d:d}return r?C({},o,{[r]:n}):C({},o,n)},[r,o,n,i])}function ut(r){const{children:o,theme:n,themeId:i}=r,s=Be($e),l=se()||$e,d=xe(i,s,n),m=xe(i,l,n,!0),f=d.direction==="rtl",S=dt(d);return T.jsx(ct,{theme:m,children:T.jsx(Qe.Provider,{value:d,children:T.jsx(rt,{value:f,children:T.jsxs(Je,{value:d==null?void 0:d.components,children:[S,o]})})})})}const le="mode",ce="color-scheme",Ie="data-color-scheme";function mt(r){const{defaultMode:o="light",defaultLightColorScheme:n="light",defaultDarkColorScheme:i="dark",modeStorageKey:s=le,colorSchemeStorageKey:l=ce,attribute:d=Ie,colorSchemeNode:m="document.documentElement",nonce:f}=r||{};return T.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?f:"",dangerouslySetInnerHTML:{__html:`(function() {
1
+ import{b7 as U,b8 as Ue,R as C,b9 as qe,ba as Ye,$ as Qe,bb as Je,aW as Xe,Q as R,a$ as K,a_ as Te,bc as a,bd as Ze,be as Le,T as et,b5 as tt}from"./index-D2u3qo5-.js";import{R as rt,g as ot}from"./getOverlayAlpha-5GYRyW4x.js";import{j as T,r as y}from"./react-BrLDncxD.js";import{u as nt,a as Be}from"./useTheme-BDMGaPba.js";function ne(r){const o=Ue(r);return r!==o&&o.styles?(o.styles.match(/^@layer\s+[^{]*$/)||(o.styles=`@layer global{${o.styles}}`),o):r}function at({styles:r,themeId:o,defaultTheme:n={}}){const i=nt(n),s=o&&i[o]||i;let l=typeof r=="function"?r(s):r;return s.modularCssLayers&&(Array.isArray(l)?l=l.map(d=>ne(typeof d=="function"?d(s):d)):l=ne(l)),T.jsx(U,{styles:l})}const Ee=y.createContext(null);function se(){return y.useContext(Ee)}const it=typeof Symbol=="function"&&Symbol.for,st=it?Symbol.for("mui.nested"):"__THEME_NESTED__";function lt(r,o){return typeof o=="function"?o(r):C({},r,o)}function ct(r){const{children:o,theme:n}=r,i=se(),s=y.useMemo(()=>{const l=i===null?n:lt(i,n);return l!=null&&(l[st]=i!==null),l},[n,i]);return T.jsx(Ee.Provider,{value:s,children:o})}function dt(r){const o=Be(),n=qe()||"",{modularCssLayers:i}=r;let s="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!i||o!==null?s="":typeof i=="string"?s=i.replace(/mui(?!\.)/g,s):s=`@layer ${s};`,Ye(()=>{const l=document.querySelector("head");if(!l)return;const d=l.firstChild;if(s){var m;if(d&&(m=d.hasAttribute)!=null&&m.call(d,"data-mui-layer-order")&&d.getAttribute("data-mui-layer-order")===n)return;const S=document.createElement("style");S.setAttribute("data-mui-layer-order",n),S.textContent=s,l.prepend(S)}else{var f;(f=l.querySelector(`style[data-mui-layer-order="${n}"]`))==null||f.remove()}},[s,n]),s?T.jsx(at,{styles:s}):null}const $e={};function xe(r,o,n,i=!1){return y.useMemo(()=>{const s=r&&o[r]||o;if(typeof n=="function"){const l=n(s),d=r?C({},o,{[r]:l}):l;return i?()=>d:d}return r?C({},o,{[r]:n}):C({},o,n)},[r,o,n,i])}function ut(r){const{children:o,theme:n,themeId:i}=r,s=Be($e),l=se()||$e,d=xe(i,s,n),m=xe(i,l,n,!0),f=d.direction==="rtl",S=dt(d);return T.jsx(ct,{theme:m,children:T.jsx(Qe.Provider,{value:d,children:T.jsx(rt,{value:f,children:T.jsxs(Je,{value:d==null?void 0:d.components,children:[S,o]})})})})}const le="mode",ce="color-scheme",Ie="data-color-scheme";function mt(r){const{defaultMode:o="light",defaultLightColorScheme:n="light",defaultDarkColorScheme:i="dark",modeStorageKey:s=le,colorSchemeStorageKey:l=ce,attribute:d=Ie,colorSchemeNode:m="document.documentElement",nonce:f}=r||{};return T.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?f:"",dangerouslySetInnerHTML:{__html:`(function() {
2
2
  try {
3
3
  var mode = localStorage.getItem('${s}') || '${o}';
4
4
  var colorScheme = '';
@@ -1 +1 @@
1
- import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-Ddt2Odte.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-BdUwuly3.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
1
+ import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-CO4_1ccR.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-BI7O7l1f.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
@@ -1 +1 @@
1
- import{a as $,b as q,r as i,j as e}from"./react-BrLDncxD.js";import{u as H,t as s,d as Q,o as V,x as g,C as d,E as P,y as I,g as W,r as z}from"./index-N2L0zXX7.js";import{R as G}from"./resume-buy-Bf0zIH7y.js";import{R as D}from"./cart-checkout-B1K9PgL-.js";import{l as J}from"./loader-logo-BzY9EKdC.js";import{u as Z,p as X,c as ee,i as se}from"./useCreditPacks-DAdqCu9-.js";import{C as te}from"./CircularProgress-BR1jf0Pq.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";const j="https://cdn.decentraland.org/@dcl/shop/0.1.0-29956042914.commit-dfd2644/assets/pack-chips--HnOpf5U.webp",re="https://cdn.decentraland.org/@dcl/shop/0.1.0-29956042914.commit-dfd2644/assets/credit-coin-CmcTCd5i.webp",ae="data:image/svg+xml,%3csvg%20width='60'%20height='60'%20viewBox='0%200%2060%2060'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='60'%20height='60'%20rx='30'%20fill='%2334CE77'/%3e%3cpath%20d='M21.6583%2046.1067L11.4656%2036.0591C10.1688%2034.829%2010.1905%2032.7207%2011.4769%2031.4622L13.6868%2029.3591C14.9732%2028.1006%2017.1615%2028.1058%2018.4582%2029.3359L23.8747%2034.6197L41.9704%2015.6527C43.2568%2014.3942%2045.4291%2014.2093%2046.7258%2015.4394L48.8765%2017.3628C50.1732%2018.5929%2050.3491%2020.6844%2049.0626%2021.9429L26.6112%2045.8766C25.1433%2047.342%2022.955%2047.3368%2021.6583%2046.1067Z'%20fill='%23FCFCFC'/%3e%3c/svg%3e",x=se()?"mock":"stripe",ce={pack_5:j,pack_10:j,pack_25:j,pack_50:j},ne="https://docs.decentraland.org";function M(l){const r=l;if((r==null?void 0:r.name)==="AbortError")return s("getCredits.errorCanceled");const m=((r==null?void 0:r.message)??"").toLowerCase();return m.includes("sign in")?s("getCredits.errorSignIn",{currency:d.name}):m.includes("timed out")?s("getCredits.errorTimeout",{currency:d.name}):s("getCredits.errorGeneric")}function je(){H({title:s("nav.getCredits",{currency:d.name}),noindex:!0});const l=$(),{session:r,signIn:m}=Q(),n=V(),[N,w]=q(),{packs:F,isLoading:T}=Z(),[p,o]=i.useState("select"),[c,E]=i.useState(null),[R,L]=i.useState(null),[U,h]=i.useState(null),[K,f]=i.useState(!1),b=i.useRef(null);i.useEffect(()=>()=>{var t;return(t=b.current)==null?void 0:t.abort()},[]);const A=i.useCallback(()=>{w(t=>{const a=new URLSearchParams(t);return a.delete("order"),a.delete("canceled"),a},{replace:!0})},[w]),y=i.useCallback(async t=>{o("processing");const a=new AbortController;b.current=a;try{const u=await X(t,{signal:a.signal,address:r==null?void 0:r.address,identity:r==null?void 0:r.identity});if(u.status==="credited"){const _=u.creditsGranted??(c==null?void 0:c.credits)??0;L(_>0?_:null),o("success"),g("Shop Completed Buy Credits",{order_id:t,pack_usd:(c==null?void 0:c.usd)??null,credits:_>0?_:null,provider:x}),n.invalidateQueries({queryKey:["usd-balance"]});try{if(sessionStorage.getItem(D)){const k={resumeCheckout:!0,..._>0?{creditsAdded:_}:{}};l("/cart",{state:k});return}}catch{}try{const k=sessionStorage.getItem(G);if(k){sessionStorage.removeItem(G);const C=JSON.parse(k),B=C.tokenId??C.itemId;if(C.contractAddress&&B){l(`/item/${C.contractAddress}/${B}`,{state:{item:C,resumeBuy:!0}});return}}}catch{}}else u.status==="pending"?(g("Shop Buy Credits Pending",{step:"grant",pack_usd:(c==null?void 0:c.usd)??null}),n.invalidateQueries({queryKey:["usd-balance"]}),o("pending")):(g("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(c==null?void 0:c.usd)??null}),h(u.error??s("getCredits.errorGrant",{currency:d.name})),o("error"))}catch(u){P(u,{flow:"get_credits",step:"grant",order_id:t}),g("Shop Buy Credits Failed",{step:"grant",error_code:I(u),pack_usd:(c==null?void 0:c.usd)??null}),h(M(u)),o("error")}},[c,r,n,l]),O=i.useCallback(async t=>{if(!r){m();return}h(null),f(!1),E(t),o(x==="mock"?"processing":"redirecting"),g("Shop Started Buy Credits",{pack_usd:t.usd,credits:t.credits,provider:x});try{const a=await ee(t.id,{address:r.address,identity:r.identity});if(a.mock)y(a.orderId);else if(a.url)g("Shop Redirected To Stripe",{order_id:a.orderId,pack_usd:t.usd,credits:t.credits}),window.location.href=a.url;else throw new Error("Checkout did not return a redirect url")}catch(a){P(a,{flow:"get_credits",step:"checkout",provider:x}),g("Shop Buy Credits Failed",{step:"checkout",error_code:I(a),pack_usd:t.usd}),h(M(a)),o("error")}},[r,m,y]),v=i.useRef(!1);i.useEffect(()=>{if(v.current)return;const t=N.get("order");if(N.get("canceled")!=null){v.current=!0,g("Shop Buy Credits Cancelled",{order_id:t,provider:x}),A(),f(!0),o("select");return}t&&(o("processing"),r&&(v.current=!0,A(),y(t)))},[N,r]);function S(){var t;(t=b.current)==null||t.abort(),o("select"),E(null),L(null),h(null),f(!1)}const Y=p==="select";return e.jsxs("div",{className:"getcredits",children:[Y&&e.jsxs("header",{className:"getcredits__head",children:[e.jsx("h1",{className:"getcredits__title",children:s("getCredits.title",{currency:d.name})}),e.jsxs("p",{className:"getcredits__sub",children:[s("getCredits.subtitle",{currency:d.name})," ",e.jsxs("a",{className:"getcredits__learn",href:ne,target:"_blank",rel:"noreferrer",children:[s("getCredits.learnMore"),e.jsxs("svg",{className:"getcredits__learn-ico",viewBox:"0 0 13 13","aria-hidden":!0,fill:"none",children:[e.jsx("path",{d:"M4 2h7v7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M11 2 2 11",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})]}),p==="select"&&e.jsxs(e.Fragment,{children:[K&&e.jsx("p",{className:"getcredits__note muted",role:"status",children:s("getCredits.canceledNote")}),e.jsx(ie,{packs:F,loading:T,onSelect:t=>void O(t)})]}),p==="redirecting"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(te,{size:32}),e.jsx("p",{className:"muted",children:s("getCredits.redirecting")})]}),p==="processing"&&e.jsxs("div",{className:"gc-processing",role:"status","aria-live":"polite",children:[e.jsx("img",{className:"gc-processing__logo",src:J,alt:"",width:61,height:61}),e.jsxs("div",{className:"gc-processing__body",children:[e.jsxs("p",{className:"gc-processing__title",children:[e.jsx("strong",{children:s("getCredits.processing")}),"…"]}),e.jsxs("div",{className:"gc-progress","aria-hidden":!0,children:[e.jsx("span",{className:"gc-progress__track",children:e.jsx("span",{className:"gc-progress__fill"})}),e.jsx("span",{className:"gc-progress__count",children:"1/1"})]})]})]}),p==="success"&&e.jsxs("div",{className:"gc-success",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"gc-banner",children:[e.jsx("img",{className:"gc-banner__icon",src:ae,alt:"",width:60,height:60}),e.jsxs("p",{className:"gc-banner__text",children:[e.jsx("strong",{children:s("getCredits.successTitle")})," ",s("getCredits.successBody",{currency:d.name})]})]}),R!=null&&e.jsx("div",{className:"gc-credits",children:e.jsxs("div",{className:"gc-credits__row",children:[e.jsx("img",{className:"gc-credits__coin",src:re,alt:"",width:93,height:93}),e.jsxs("p",{className:"gc-credits__text",children:[e.jsx(W,{className:"gc-credits__diamond"}),e.jsxs("span",{children:[e.jsx("strong",{className:"gc-credits__amount",children:s("getCredits.creditsAmount",{credits:R,currency:d.name})})," ",e.jsx("span",{className:"gc-credits__added",children:s("getCredits.creditsAdded")})]})]})]})}),e.jsxs("div",{className:"gc-actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:S,children:s("getCredits.buyMore",{currency:d.name})}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:s("getCredits.startShopping")})]})]}),p==="pending"&&e.jsxs("div",{className:"gc-status",role:"status","aria-live":"polite",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.pendingTitle",{currency:d.name})}),e.jsx("p",{className:"muted",children:s("getCredits.pendingBody")}),e.jsxs("div",{className:"gc-status__actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:s("getCredits.startShopping")}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:S,children:s("getCredits.done")})]})]}),p==="error"&&e.jsxs("div",{className:"gc-status gc-status--err",role:"alert",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.errorTitle")}),e.jsx("p",{className:"error",children:U}),e.jsx("div",{className:"gc-status__actions",children:e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:S,children:s("getCredits.tryAgain")})})]})]})}function ie({packs:l,loading:r,onSelect:m}){return r?e.jsx("div",{className:"packs","aria-busy":"true","aria-label":s("getCredits.packsLoading",{currency:d.name}),children:[0,1,2,3].map(n=>e.jsx("div",{className:"pack pack--skeleton","aria-hidden":!0,children:e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"skeleton pack__label-sk"}),e.jsx("span",{className:"skeleton pack__art-sk"}),e.jsx("span",{className:"skeleton pack__cta-sk"})]})},n))}):e.jsx("div",{className:"packs",children:l.map(n=>e.jsxs("button",{type:"button",className:`pack${n.bestValue?" pack--best":""}`,"data-testid":"pack",onClick:()=>m(n),"aria-label":s("getCredits.packAria",{amount:z(n.credits),usd:n.usd}),children:[n.bestValue&&e.jsx("span",{className:"pack__badge",children:s("getCredits.packBadge")}),e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"pack__label",children:s("getCredits.creditsAmount",{credits:n.credits,currency:d.name})}),e.jsx("span",{className:"pack__art",children:e.jsx("img",{src:ce[n.id]??j,alt:"",loading:"lazy"})}),e.jsx("span",{className:"pack__cta-wrap",children:e.jsxs("span",{className:"pack__cta",children:["$",n.usd.toFixed(2)]})})]})]},n.id))})}export{je as GetCredits,je as default};
1
+ import{a as $,b as q,r as i,j as e}from"./react-BrLDncxD.js";import{u as H,t as s,d as Q,o as V,x as g,C as d,E as P,y as I,g as W,r as z}from"./index-D2u3qo5-.js";import{R as G}from"./resume-buy-Bf0zIH7y.js";import{R as D}from"./cart-checkout-4SY4EejM.js";import{l as J}from"./loader-logo-BzY9EKdC.js";import{u as Z,p as X,c as ee,i as se}from"./useCreditPacks-Djg10PxH.js";import{C as te}from"./CircularProgress-CzgFv03I.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";const j="https://cdn.decentraland.org/@dcl/shop/0.1.0-29994094833.commit-84e34c2/assets/pack-chips--HnOpf5U.webp",re="https://cdn.decentraland.org/@dcl/shop/0.1.0-29994094833.commit-84e34c2/assets/credit-coin-CmcTCd5i.webp",ce="data:image/svg+xml,%3csvg%20width='60'%20height='60'%20viewBox='0%200%2060%2060'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='60'%20height='60'%20rx='30'%20fill='%2334CE77'/%3e%3cpath%20d='M21.6583%2046.1067L11.4656%2036.0591C10.1688%2034.829%2010.1905%2032.7207%2011.4769%2031.4622L13.6868%2029.3591C14.9732%2028.1006%2017.1615%2028.1058%2018.4582%2029.3359L23.8747%2034.6197L41.9704%2015.6527C43.2568%2014.3942%2045.4291%2014.2093%2046.7258%2015.4394L48.8765%2017.3628C50.1732%2018.5929%2050.3491%2020.6844%2049.0626%2021.9429L26.6112%2045.8766C25.1433%2047.342%2022.955%2047.3368%2021.6583%2046.1067Z'%20fill='%23FCFCFC'/%3e%3c/svg%3e",x=se()?"mock":"stripe",ae={pack_5:j,pack_10:j,pack_25:j,pack_50:j},ne="https://docs.decentraland.org";function M(l){const r=l;if((r==null?void 0:r.name)==="AbortError")return s("getCredits.errorCanceled");const m=((r==null?void 0:r.message)??"").toLowerCase();return m.includes("sign in")?s("getCredits.errorSignIn",{currency:d.name}):m.includes("timed out")?s("getCredits.errorTimeout",{currency:d.name}):s("getCredits.errorGeneric")}function je(){H({title:s("nav.getCredits",{currency:d.name}),noindex:!0});const l=$(),{session:r,signIn:m}=Q(),n=V(),[N,w]=q(),{packs:F,isLoading:T}=Z(),[p,o]=i.useState("select"),[a,E]=i.useState(null),[R,L]=i.useState(null),[U,h]=i.useState(null),[K,f]=i.useState(!1),b=i.useRef(null);i.useEffect(()=>()=>{var t;return(t=b.current)==null?void 0:t.abort()},[]);const A=i.useCallback(()=>{w(t=>{const c=new URLSearchParams(t);return c.delete("order"),c.delete("canceled"),c},{replace:!0})},[w]),y=i.useCallback(async t=>{o("processing");const c=new AbortController;b.current=c;try{const u=await X(t,{signal:c.signal,address:r==null?void 0:r.address,identity:r==null?void 0:r.identity});if(u.status==="credited"){const _=u.creditsGranted??(a==null?void 0:a.credits)??0;L(_>0?_:null),o("success"),g("Shop Completed Buy Credits",{order_id:t,pack_usd:(a==null?void 0:a.usd)??null,credits:_>0?_:null,provider:x}),n.invalidateQueries({queryKey:["usd-balance"]});try{if(sessionStorage.getItem(D)){const k={resumeCheckout:!0,..._>0?{creditsAdded:_}:{}};l("/cart",{state:k});return}}catch{}try{const k=sessionStorage.getItem(G);if(k){sessionStorage.removeItem(G);const C=JSON.parse(k),B=C.tokenId??C.itemId;if(C.contractAddress&&B){l(`/item/${C.contractAddress}/${B}`,{state:{item:C,resumeBuy:!0}});return}}}catch{}}else u.status==="pending"?(g("Shop Buy Credits Pending",{step:"grant",pack_usd:(a==null?void 0:a.usd)??null}),n.invalidateQueries({queryKey:["usd-balance"]}),o("pending")):(g("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(a==null?void 0:a.usd)??null}),h(u.error??s("getCredits.errorGrant",{currency:d.name})),o("error"))}catch(u){P(u,{flow:"get_credits",step:"grant",order_id:t}),g("Shop Buy Credits Failed",{step:"grant",error_code:I(u),pack_usd:(a==null?void 0:a.usd)??null}),h(M(u)),o("error")}},[a,r,n,l]),O=i.useCallback(async t=>{if(!r){m();return}h(null),f(!1),E(t),o(x==="mock"?"processing":"redirecting"),g("Shop Started Buy Credits",{pack_usd:t.usd,credits:t.credits,provider:x});try{const c=await ee(t.id,{address:r.address,identity:r.identity});if(c.mock)y(c.orderId);else if(c.url)g("Shop Redirected To Stripe",{order_id:c.orderId,pack_usd:t.usd,credits:t.credits}),window.location.href=c.url;else throw new Error("Checkout did not return a redirect url")}catch(c){P(c,{flow:"get_credits",step:"checkout",provider:x}),g("Shop Buy Credits Failed",{step:"checkout",error_code:I(c),pack_usd:t.usd}),h(M(c)),o("error")}},[r,m,y]),v=i.useRef(!1);i.useEffect(()=>{if(v.current)return;const t=N.get("order");if(N.get("canceled")!=null){v.current=!0,g("Shop Buy Credits Cancelled",{order_id:t,provider:x}),A(),f(!0),o("select");return}t&&(o("processing"),r&&(v.current=!0,A(),y(t)))},[N,r]);function S(){var t;(t=b.current)==null||t.abort(),o("select"),E(null),L(null),h(null),f(!1)}const Y=p==="select";return e.jsxs("div",{className:"getcredits",children:[Y&&e.jsxs("header",{className:"getcredits__head",children:[e.jsx("h1",{className:"getcredits__title",children:s("getCredits.title",{currency:d.name})}),e.jsxs("p",{className:"getcredits__sub",children:[s("getCredits.subtitle",{currency:d.name})," ",e.jsxs("a",{className:"getcredits__learn",href:ne,target:"_blank",rel:"noreferrer",children:[s("getCredits.learnMore"),e.jsxs("svg",{className:"getcredits__learn-ico",viewBox:"0 0 13 13","aria-hidden":!0,fill:"none",children:[e.jsx("path",{d:"M4 2h7v7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M11 2 2 11",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})]}),p==="select"&&e.jsxs(e.Fragment,{children:[K&&e.jsx("p",{className:"getcredits__note muted",role:"status",children:s("getCredits.canceledNote")}),e.jsx(ie,{packs:F,loading:T,onSelect:t=>void O(t)})]}),p==="redirecting"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(te,{size:32}),e.jsx("p",{className:"muted",children:s("getCredits.redirecting")})]}),p==="processing"&&e.jsxs("div",{className:"gc-processing",role:"status","aria-live":"polite",children:[e.jsx("img",{className:"gc-processing__logo",src:J,alt:"",width:61,height:61}),e.jsxs("div",{className:"gc-processing__body",children:[e.jsxs("p",{className:"gc-processing__title",children:[e.jsx("strong",{children:s("getCredits.processing")}),"…"]}),e.jsxs("div",{className:"gc-progress","aria-hidden":!0,children:[e.jsx("span",{className:"gc-progress__track",children:e.jsx("span",{className:"gc-progress__fill"})}),e.jsx("span",{className:"gc-progress__count",children:"1/1"})]})]})]}),p==="success"&&e.jsxs("div",{className:"gc-success",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"gc-banner",children:[e.jsx("img",{className:"gc-banner__icon",src:ce,alt:"",width:60,height:60}),e.jsxs("p",{className:"gc-banner__text",children:[e.jsx("strong",{children:s("getCredits.successTitle")})," ",s("getCredits.successBody",{currency:d.name})]})]}),R!=null&&e.jsx("div",{className:"gc-credits",children:e.jsxs("div",{className:"gc-credits__row",children:[e.jsx("img",{className:"gc-credits__coin",src:re,alt:"",width:93,height:93}),e.jsxs("p",{className:"gc-credits__text",children:[e.jsx(W,{className:"gc-credits__diamond"}),e.jsxs("span",{children:[e.jsx("strong",{className:"gc-credits__amount",children:s("getCredits.creditsAmount",{credits:R,currency:d.name})})," ",e.jsx("span",{className:"gc-credits__added",children:s("getCredits.creditsAdded")})]})]})]})}),e.jsxs("div",{className:"gc-actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:S,children:s("getCredits.buyMore",{currency:d.name})}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:s("getCredits.startShopping")})]})]}),p==="pending"&&e.jsxs("div",{className:"gc-status",role:"status","aria-live":"polite",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.pendingTitle",{currency:d.name})}),e.jsx("p",{className:"muted",children:s("getCredits.pendingBody")}),e.jsxs("div",{className:"gc-status__actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:s("getCredits.startShopping")}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:S,children:s("getCredits.done")})]})]}),p==="error"&&e.jsxs("div",{className:"gc-status gc-status--err",role:"alert",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.errorTitle")}),e.jsx("p",{className:"error",children:U}),e.jsx("div",{className:"gc-status__actions",children:e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:S,children:s("getCredits.tryAgain")})})]})]})}function ie({packs:l,loading:r,onSelect:m}){return r?e.jsx("div",{className:"packs","aria-busy":"true","aria-label":s("getCredits.packsLoading",{currency:d.name}),children:[0,1,2,3].map(n=>e.jsx("div",{className:"pack pack--skeleton","aria-hidden":!0,children:e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"skeleton pack__label-sk"}),e.jsx("span",{className:"skeleton pack__art-sk"}),e.jsx("span",{className:"skeleton pack__cta-sk"})]})},n))}):e.jsx("div",{className:"packs",children:l.map(n=>e.jsxs("button",{type:"button",className:`pack${n.bestValue?" pack--best":""}`,"data-testid":"pack",onClick:()=>m(n),"aria-label":s("getCredits.packAria",{amount:z(n.credits),usd:n.usd}),children:[n.bestValue&&e.jsx("span",{className:"pack__badge",children:s("getCredits.packBadge")}),e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"pack__label",children:s("getCredits.creditsAmount",{credits:n.credits,currency:d.name})}),e.jsx("span",{className:"pack__art",children:e.jsx("img",{src:ae[n.id]??j,alt:"",loading:"lazy"})}),e.jsx("span",{className:"pack__cta-wrap",children:e.jsxs("span",{className:"pack__cta",children:["$",n.usd.toFixed(2)]})})]})]},n.id))})}export{je as GetCredits,je as default};
@@ -1,4 +1,4 @@
1
- import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-DWn6y0S7.js";import{d as g,r as v}from"./index-BdUwuly3.js";import{C as c}from"./ConstantsUtil-DO6FyoSW.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-Ddt2Odte.js";import{au as y}from"./NetworkUtil-BGlQiKvg.js";const b=g`
1
+ import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-BQMla4xK.js";import{d as g,r as v}from"./index-BI7O7l1f.js";import{C as c}from"./ConstantsUtil-DO6FyoSW.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-CO4_1ccR.js";import{au as y}from"./NetworkUtil-BGlQiKvg.js";const b=g`
2
2
  :host {
3
3
  display: flex;
4
4
  justify-content: center;
@@ -1,4 +1,4 @@
1
- import{a as K,r as u,j as e,L as B}from"./react-BrLDncxD.js";import{e as $,t as s,C as w,B as k,g as L,x as P,E as A,u as U,d as W,o as O,m as z,s as Q,J}from"./index-N2L0zXX7.js";import{i as Y,R as D,f as G}from"./import-5uw4xr5F.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./buy-ra8wh_Tw.js";import"./authorizations-BUCDfL2t.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./trade-encoding-Nzi47aTM.js";import"./mana-rate-B_U_hjWF.js";function H({queue:n,session:T,onClose:j,onDone:h}){const N=K(),d=$(T.providerType),[m,f]=u.useState(()=>n.map(()=>"pending")),[I,E]=u.useState("running"),S=u.useRef(!1);u.useEffect(()=>{if(S.current)return;S.current=!0;let t=!1;return(async()=>{for(let r=0;r<n.length;r++){if(t)return;f(p=>p.map((g,o)=>o===r?"active":g));try{await Y(n[r].item,n[r].priceCredits,T),P("Shop Migrated Listing",{item_id:n[r].item.itemId??n[r].item.oldTradeId??null,contract_address:n[r].item.contractAddress,new_price_credits:n[r].priceCredits,new_price_usd:n[r].priceCredits/10}),t||f(p=>p.map((g,o)=>o===r?"done":g))}catch(p){if(p instanceof D)A(p,{flow:"import_listing",step:"relist",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(g=>g.map((o,b)=>b===r?"unlisted":o));else{const g=p,o=g.code===4001||/reject|denied|cancel/i.test(g.message??"");o||A(p,{flow:"import_listing",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(b=>b.map((a,l)=>l===r?o?"skipped":"failed":a))}}}t||E("finished")})(),()=>{t=!0}},[]);const _=m.filter(t=>t==="done").length,v=m.findIndex(t=>t==="active"),x=Math.round(m.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function y(){h(),j()}if(I==="finished"){const t=m.filter(r=>r==="skipped"||r==="failed").length,c=m.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:_>0?s("migrate.successTitle"):s("migrate.nothingTitle")}),e.jsxs("p",{className:"muted",style:{margin:0},children:[_>0?s("migrate.listedSummary",{count:_,currency:w.name}):s("migrate.noneListed"),t>0?" "+s("migrate.skippedSummary",{count:t}):"",c>0?" "+s("migrate.unlistedSummary",{count:c}):""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(k,{variant:"ghost",onClick:y,children:s("getCredits.done")}),c>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/my-assets")},children:s("migrate.goToMyAssets")}):_>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/assets")},children:s("migrate.viewInShop")}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate","data-testid":"modal",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:s("migrate.listingTitle")}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[d?s("migrate.subConfirm"):s("migrate.subManaged")," ",v>=0?s("migrate.progressCount",{current:v+1,total:n.length}):""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${x}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,c)=>e.jsxs("li",{className:`migrate__row migrate__row--${m[c]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||s("migrate.itemFallback")}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(L,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:m[c]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",d?s("migrate.statusConfirm"):s("migrate.statusAdding")]}):m[c]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):m[c]==="skipped"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusSkipped")}):m[c]==="failed"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusFailed")}):m[c]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:s("migrate.unlistedTooltip"),children:s("migrate.statusUnlisted")}):e.jsx("span",{className:"migrate__wait",children:s("migrate.statusWaiting")})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:d?s("migrate.hintConfirm"):s("migrate.hintManaged")})]})})}const F=Q(k)`
1
+ import{a as K,r as u,j as e,L as B}from"./react-BrLDncxD.js";import{e as $,t as s,C as w,B as k,g as L,x as P,E as A,u as U,d as W,o as O,m as z,s as Q,J}from"./index-D2u3qo5-.js";import{i as Y,R as D,f as G}from"./import-a0kWnC35.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./buy-CHyPhIFc.js";import"./authorizations-mnih5q8o.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./trade-encoding-CtfVB9K4.js";import"./mana-rate-DcCwt7oF.js";function H({queue:n,session:T,onClose:j,onDone:h}){const N=K(),d=$(T.providerType),[m,f]=u.useState(()=>n.map(()=>"pending")),[I,E]=u.useState("running"),S=u.useRef(!1);u.useEffect(()=>{if(S.current)return;S.current=!0;let t=!1;return(async()=>{for(let r=0;r<n.length;r++){if(t)return;f(p=>p.map((g,o)=>o===r?"active":g));try{await Y(n[r].item,n[r].priceCredits,T),P("Shop Migrated Listing",{item_id:n[r].item.itemId??n[r].item.oldTradeId??null,contract_address:n[r].item.contractAddress,new_price_credits:n[r].priceCredits,new_price_usd:n[r].priceCredits/10}),t||f(p=>p.map((g,o)=>o===r?"done":g))}catch(p){if(p instanceof D)A(p,{flow:"import_listing",step:"relist",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(g=>g.map((o,b)=>b===r?"unlisted":o));else{const g=p,o=g.code===4001||/reject|denied|cancel/i.test(g.message??"");o||A(p,{flow:"import_listing",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(b=>b.map((a,l)=>l===r?o?"skipped":"failed":a))}}}t||E("finished")})(),()=>{t=!0}},[]);const _=m.filter(t=>t==="done").length,v=m.findIndex(t=>t==="active"),x=Math.round(m.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function y(){h(),j()}if(I==="finished"){const t=m.filter(r=>r==="skipped"||r==="failed").length,c=m.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:_>0?s("migrate.successTitle"):s("migrate.nothingTitle")}),e.jsxs("p",{className:"muted",style:{margin:0},children:[_>0?s("migrate.listedSummary",{count:_,currency:w.name}):s("migrate.noneListed"),t>0?" "+s("migrate.skippedSummary",{count:t}):"",c>0?" "+s("migrate.unlistedSummary",{count:c}):""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(k,{variant:"ghost",onClick:y,children:s("getCredits.done")}),c>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/my-assets")},children:s("migrate.goToMyAssets")}):_>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/assets")},children:s("migrate.viewInShop")}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate","data-testid":"modal",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:s("migrate.listingTitle")}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[d?s("migrate.subConfirm"):s("migrate.subManaged")," ",v>=0?s("migrate.progressCount",{current:v+1,total:n.length}):""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${x}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,c)=>e.jsxs("li",{className:`migrate__row migrate__row--${m[c]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||s("migrate.itemFallback")}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(L,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:m[c]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",d?s("migrate.statusConfirm"):s("migrate.statusAdding")]}):m[c]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):m[c]==="skipped"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusSkipped")}):m[c]==="failed"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusFailed")}):m[c]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:s("migrate.unlistedTooltip"),children:s("migrate.statusUnlisted")}):e.jsx("span",{className:"migrate__wait",children:s("migrate.statusWaiting")})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:d?s("migrate.hintConfirm"):s("migrate.hintManaged")})]})})}const F=Q(k)`
2
2
  margin-top: 10px;
3
3
  `,V=Q(k)`
4
4
  padding: 13px 24px;
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Ds3STnLu.js","assets/react-BrLDncxD.js","assets/dcl-schemas-BICTSpB5.js","assets/index-N2L0zXX7.js","assets/sentry-DYZXk5O5.js","assets/ethers-BIvjmL85.js","assets/intl-CBcMB1D2.js","assets/index-Bw9Y53F1.css","assets/emotion-styled.browser.esm-BuTVXj5n.js","assets/useTheme-BrDoOqsp.js","assets/CircularProgress-BR1jf0Pq.js","assets/index-CopbrGfc.js","assets/useTheme-DkDLv0JM.js","assets/CssVarsProvider-ewdlo_l2.js","assets/getOverlayAlpha-F1qRCVfQ.js","assets/index-PzZvVORQ.js","assets/colors-LINLm1ux.js"])))=>i.map(i=>d[i]);
2
- import{a as oe,r as d,j as e,d as pa,u as ya,L as fa}from"./react-BrLDncxD.js";import{d as X,n as xa,o as ve,t,ah as ba,i as ga,b as ja,w as va,q as ne,x as D,y as ge,z as fe,ai as Na,E as Z,g as E,j as de,B as z,C as xe,p as wa,J as Je,_ as be,ak as ka,ax as Ia,ay as Ca,az as Sa,aA as Aa,c as Ne,aB as Ma,L as Ye,m as B,aC as Pa,I as T,F as K,s as W,aD as Ea,aE as Fa,aF as La,G as Ta,ae as ze,a as Ke,aG as Da,aH as Ra,aI as qa,aJ as Ba,aK as $a,af as Oa,u as za,aL as Ka,aM as Wa,aN as Va,h as Qa,aO as We,aP as Ua,f as Ga,ao as Ha,aQ as Ja,aR as Ya,ap as Xa,aS as Za,aT as et}from"./index-N2L0zXX7.js";import{d as G}from"./dcl-schemas-BICTSpB5.js";import{b as Ve,c as at}from"./buy-ra8wh_Tw.js";import{P as tt,f as st}from"./PrimaryListModal-JkGI-cG4.js";import{b as it,w as rt,S as nt,G as lt}from"./buy-gasless-DxE_2TUI.js";import{a as dt}from"./authorizations-BUCDfL2t.js";import{u as ot,M as ct,c as mt}from"./useCreditPacks-DAdqCu9-.js";import{W as ut,C as ht,a as _t}from"./CollectionCarousel-DuuF5eCz.js";import{R as Qe}from"./resume-buy-Bf0zIH7y.js";import{a as pt,f as je,i as yt}from"./errors-DWlrWfS6.js";import{E as ce}from"./ErrorNotice-BDH9xoG4.js";import{l as ft}from"./loader-logo-BzY9EKdC.js";import{C as xt}from"./CircularProgress-BR1jf0Pq.js";import{a as bt,b as gt}from"./trade-encoding-Nzi47aTM.js";import{u as jt,M as vt}from"./MarketCheckout-BJsJHJsi.js";import{s as Nt}from"./address-DrURAr9O.js";import{T as Xe}from"./Tooltip-Bz0rwSTJ.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./mana-rate-B_U_hjWF.js";import"./emotion-CSxEP8yM.js";function wt({item:s,onClose:n,resume:i=!1}){var ae,te;const{session:o}=X(),{data:m}=xa(o),h=ve(),w=oe(),x=ot().packs.slice(0,ct),[c,l]=d.useState("loading"),[a,j]=d.useState(null),[y,N]=d.useState(""),[F,b]=d.useState(s.priceCredits),[f,g]=d.useState(null),I=d.useRef(null),M=(f==null?void 0:f.credits)??F,ee=(m==null?void 0:m.credits)??0;d.useEffect(()=>{let u=!1;if(!o){l("error"),j(t("buyModal.signInToCheckout"));return}const C=_=>{const S=_-((m==null?void 0:m.credits)??0),v=x.find(R=>R.credits>=S)??x[x.length-1];N(v.id),D("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:_,credits_balance:(m==null?void 0:m.credits)??0,shortfall:Math.max(0,S)}),l("nofunds")};return(async()=>{var _,S;try{const v=await ba(s);if(!v)throw new Error("not for sale");if(ga(v,o.address))throw new Error("You can't buy your own listing.");const R=ja((S=(_=v.received)==null?void 0:_[0])==null?void 0:S.amount);if(!Number.isFinite(R)||R<=0)throw new Error("price unavailable");const V=Math.ceil(R/10);if(u)return;if(b(V),m!=null&&m.credits<V){C(V);return}try{const{credit:A,maxCreditedValue:J,usdCents:O}=await va(o.identity,R,v.id);if(u){ne(o.identity,[A.id]).catch(()=>{});return}I.current=A.id;const se=Math.ceil(O/10);b(se);const Q={trade:v,credit:A,maxCreditedValue:J,usdCents:O,credits:se};g(Q),i?H(Q):l("ready")}catch(A){if(u)return;if(pt(A)){C(V);return}throw A}}catch(v){if(u)return;D(fe(v)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:ge(v)}),l("error"),j(je(v,t("buyModal.error.generic"),{sale:!0}))}})(),()=>{u=!0,I.current&&o&&(ne(o.identity,[I.current]).catch(()=>{}),I.current=null)}},[]);async function H(u=f){if(!o||!u)return;l("processing"),j(null);let C=!1;try{const _={trade:u.trade,buyer:o.address,signer:o.signer,credits:[u.credit],maxCreditedValue:u.maxCreditedValue};let S;if(dt())try{S=await it(_),await rt(S),C=!0}catch(v){if(v instanceof nt)C=!0;else if(v instanceof lt)S=await Ve(_);else throw v}else S=await Ve(_);I.current=null,D("Shop Completed Purchase",{...Na([s]),payment_type:"credits",no_crypto_step:C,transaction_hash:S??null}),h.invalidateQueries({queryKey:["usd-balance"]}),l("complete")}catch(_){fe(_)||Z(_,{flow:"buy",step:"submit",gasless:C}),ne(o.identity,[u.credit.id]).catch(()=>{}),I.current=null,D(fe(_)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:ge(_)}),h.invalidateQueries({queryKey:["usd-balance"]}),j(je(_,t("buyModal.error.generic"),{sale:!0})),l("error")}}async function me(){if(!(!y||!o)){try{sessionStorage.setItem(Qe,JSON.stringify(s))}catch{}f&&ne(o.identity,[f.credit.id]).catch(()=>{}),I.current=null,l("loading");try{const u=await mt(y,{address:o.address,identity:o.identity});if(u.url){window.location.href=u.url;return}w("/credits")}catch(u){Z(u,{flow:"buy_credits_and_item"});try{sessionStorage.removeItem(Qe)}catch{}j(t("buyModal.error.creditsCheckout")),l("error")}}}const $=c==="processing",L=c==="complete"?t("buyModal.titleComplete"):c==="nofunds"?t("buyModal.titleNoFunds"):t("buyModal.titleBuy");return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":t("buyModal.dialogAria",{name:s.name}),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:$?void 0:n,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${c==="processing"||c==="loading"?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:L}),!$&&e.jsx("button",{className:"buy-modal__x",onClick:n,"aria-label":t("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:c==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(E,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:de(ee)})]})]}),c==="loading"&&e.jsx("div",{className:"buy-modal__body buy-modal__processing",children:e.jsx(xt,{size:44})}),c==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(ce,{message:a}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:n,children:t("buyModal.close")})})]}),c==="nofunds"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(ut,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:t("buyModal.insufficientFunds")})," ",t("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:t("buyModal.warningCreditsAmount",{count:Math.max(0,M-ee)})})," ",t("buyModal.warningToPurchase",{count:1})]})]}),e.jsx(Ue,{item:s,priceCredits:M}),e.jsx("div",{className:"buy-modal__packs",children:x.map(u=>{const C=u.credits,_=u.id===y;return e.jsxs("button",{className:`buy-modal__pack${_?" buy-modal__pack--on":""}`,onClick:()=>N(u.id),children:[e.jsx(E,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:de(C)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",u.usd.toFixed(2),")"]})]},u.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(E,{className:"buy-modal__total-ico"}),e.jsx("span",{children:de(((ae=x.find(u=>u.id===y))==null?void 0:ae.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",(((te=x.find(u=>u.id===y))==null?void 0:te.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:n,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:()=>void me(),children:t("buyModal.buy")})]})]}),c==="ready"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(Ue,{item:s,priceCredits:M}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient buy-modal__btn--full",onClick:()=>void H(),children:t("buyModal.buy")})})]}),c==="processing"&&e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:ft,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:i?t("buyModal.completingPurchase"):t("buyModal.completingTransaction")}),e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]}),c==="complete"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__success",children:[e.jsxs("svg",{viewBox:"0 0 64 64",width:"64",height:"64","aria-hidden":!0,children:[e.jsx("circle",{cx:"32",cy:"32",r:"32",fill:"#34ce74"}),e.jsx("path",{d:"M20 33l8 8 16-18",fill:"none",stroke:"#fff",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsxs("p",{className:"buy-modal__success-text",children:[e.jsx("b",{children:t("getCredits.successTitle")})," ",t("buyModal.successBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:()=>w("/assets?tab=mine"),children:t("buyModal.myAssets")}),e.jsxs("button",{className:"buy-modal__btn buy-modal__btn--ruby",onClick:n,children:[t("buyModal.tryInWorld"),e.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20","aria-hidden":!0,children:e.jsx("path",{d:"M5 12h12M13 7l5 5-5 5",fill:"none",stroke:"#fcfcfc",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})]})]})}function Ue({item:s,priceCredits:n}){return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsx("div",{className:"buy-modal__asset-name",title:s.name,children:s.name||t("buyModal.itemFallback")}),s.creator?e.jsx(ht,{address:s.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(E,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:de(n)})]})]})]})}const kt=1e3*60*60*24*182;function It({asset:s,session:n,onClose:i}){const o=ve(),m=oe(),[h,w]=d.useState("10"),[x,c]=d.useState(null),[l,a]=d.useState(null),[j,y]=d.useState(!1),[N,F]=d.useState(null);async function b(){a(null);const g=Number(h);if(!Number.isInteger(g)||g<=0){a(t("sellModal.errorWholeNumber"));return}y(!0);try{c(t("sellModal.statusPreparing")),await bt({signer:n.signer,contractAddress:s.contractAddress,chainId:s.chainId}),c(t("sellModal.statusListing"));const I=await gt({signer:n.signer,nft:{contractAddress:s.contractAddress,tokenId:s.tokenId,network:s.network,chainId:s.chainId},usdPrice:g/10,expiresAtMs:Date.now()+kt});c(t("sellModal.statusPublishing")),await wa(I,n.identity),c(null),F(g),D("Shop Listed Item",{item_id:s.itemId??s.tokenId??null,contract_address:s.contractAddress,price_credits:g,price_usd:g/10,listing_type:"secondary",is_primary:!1}),Je.success(t("sellModal.toastOnSale",{name:s.name})),o.invalidateQueries({queryKey:["my-assets",n.address]})}catch(I){Z(I,{flow:"list_secondary"}),D("Shop Listing Failed",{listing_type:"secondary",error_code:ge(I)}),a(je(I,t("sellModal.errorGeneric"))),c(null)}finally{y(!1)}}function f(){i(),m(`/item/${s.contractAddress}/${s.tokenId}`)}return N!==null?e.jsx("div",{className:"modal-backdrop",onClick:i,role:"presentation",children:e.jsxs("div",{className:"modal modal--success",onClick:g=>g.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:t("sellModal.successTitle")}),s.image?e.jsx("img",{className:"modal__img",src:s.image,alt:s.name}):null,e.jsx("p",{className:"modal-success__name",children:s.name}),e.jsxs("p",{className:"muted small",children:[t("sellModal.listedFor")," ",e.jsxs("strong",{children:[e.jsx(E,{className:"ccy-mark"})," ",N]})]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(z,{variant:"ghost",onClick:i,children:t("getCredits.done")}),e.jsx(z,{variant:"purple",onClick:f,children:t("sellModal.viewInShop")})]})]})}):e.jsx("div",{className:"modal-backdrop",onClick:i,role:"presentation",children:e.jsxs("div",{className:"modal","data-testid":"modal",onClick:g=>g.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("h2",{className:"modal__title",children:t("sellModal.listTitle",{name:s.name})}),s.image?e.jsx("img",{className:"modal__img",src:s.image,alt:s.name}):null,e.jsxs("label",{className:"field",children:[e.jsx("span",{children:t("sellModal.priceLabel",{currency:xe.name})}),e.jsx("input",{type:"number",min:"1",step:"1",value:h,onChange:g=>w(g.target.value),disabled:j})]}),e.jsx("p",{className:"muted small",children:t("sellModal.pricedInWhole",{currency:xe.name,currencySingular:xe.nameSingular})}),x?e.jsx("p",{className:"muted",children:x}):null,e.jsx(ce,{message:l}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(z,{variant:"ghost",onClick:i,disabled:j,children:t("sellModal.cancel")}),e.jsx(z,{onClick:()=>void b(),disabled:j,children:j?t("sellModal.listing"):t("sellModal.putOnSale")})]})]})})}const Ct=d.lazy(async()=>{const[{EmoteControls:s},{Experimental_CssVarsProvider:n},{light:i}]=await Promise.all([be(()=>import("./index-Ds3STnLu.js").then(o=>o.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),be(()=>import("./index-CopbrGfc.js"),__vite__mapDeps([11,3,1,2,4,5,6,7,12,9,13,14])),be(()=>import("./index-PzZvVORQ.js"),__vite__mapDeps([15,3,1,2,4,5,6,7,16,14,13,9]))]);return{default:o=>e.jsx(n,{theme:i,children:e.jsx(s,{...o})})}});function St(s){return e.jsx(d.Suspense,{fallback:null,children:e.jsx(Ct,{...s})})}function At({item:s}){const n=X(f=>{var g;return(g=f.session)==null?void 0:g.address}),{data:i,isLoading:o}=ka(n),m=n&&i?n:"default",h=s.category==="emote",[w,x]=d.useState("item"),c=!h&&w==="item",l=c||!o,[a,j]=d.useState(!0);d.useEffect(()=>{j(!0)},[s.id,c]);const y=!!n&&!!i,N=y&&Ia(s,Ca(i)),F=Sa(s)[0],b=y&&!N&&!h;return e.jsxs(e.Fragment,{children:[l?e.jsx(Aa,{id:"shop-item-preview",contractAddress:s.contractAddress,tokenId:s.tokenId??void 0,itemId:s.tokenId?void 0:s.itemId??void 0,profile:c?void 0:N?m:"default",bodyShape:c||N?void 0:F,type:h?void 0:c?G.PreviewType.WEARABLE:G.PreviewType.AVATAR,emote:h||c?void 0:G.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:h?1.5:void 0,wheelStart:h?100:void 0,dev:Ne.chainId===80002,onLoad:()=>j(!1)}):null,!l||a?e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":t("itemPreview.loading"),children:e.jsx("span",{className:"item-preview__spinner","aria-hidden":!0})}):null,b&&!c?e.jsx("p",{className:"item-preview__note",children:t("itemPreview.shownOnBody",{shape:Ma(F)})}):null,h?e.jsx("div",{className:"item-preview__emote-controls","data-testid":"emote-controls",children:e.jsx(St,{wearablePreviewId:"shop-item-preview",hideFrameInput:!0})}):e.jsxs("div",{className:"item-preview__toggle",role:"group","aria-label":t("itemPreview.previewMode"),children:[e.jsxs("button",{type:"button",className:w==="avatar"?"is-active":"","aria-pressed":w==="avatar","aria-label":t("itemPreview.onAvatar"),onClick:()=>x("avatar"),children:[e.jsxs("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"7.5",r:"4"}),e.jsx("path",{d:"M4 20c0-4.2 3.6-6.5 8-6.5s8 2.3 8 6.5v.5H4z"})]}),e.jsx("span",{className:"item-preview__toggle-label",children:t("itemPreview.onAvatar")})]}),e.jsxs("button",{type:"button",className:w==="item"?"is-active":"","aria-pressed":w==="item","aria-label":t("itemPreview.item"),onClick:()=>x("item"),children:[e.jsx("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:e.jsx("path",{d:"M8.5 3 3 6l1.8 3.8 2.2-1V21h10V8.8l2.2 1L22 6l-5.5-3a2.6 2.6 0 0 1-4.5 1.4A2.6 2.6 0 0 1 8.5 3z"})}),e.jsx("span",{className:"item-preview__toggle-label",children:t("itemPreview.item")})]})]})]})}function Ze(){return Ne.shopServerUrl||(typeof window<"u"?window.location.origin:"")}async function Mt(s,n,i){const o=new URLSearchParams({contractAddress:s,itemId:n}),m=`${Ze()}/notify-requests?${o.toString()}`,h=await Ye(m,{method:"GET",identity:i,metadata:{}});if(!h.ok)throw new Error(`getNotifyRequest ${h.status}`);return h.json()}async function Pt(s,n){const i=`${Ze()}/notify-requests`,o=await Ye(i,{method:"POST",identity:n,metadata:{},headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!o.ok)throw new Error(`createNotifyRequest ${o.status}: ${await o.text()}`);await o.json().catch(()=>{})}function Ge(s){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.trim())}function Et({item:s}){const n=X(b=>b.session),i=X(b=>b.signIn),[o,m]=d.useState(""),[h,w]=d.useState(!1),[x,c]=d.useState(!1),[l,a]=d.useState(null),j=!!n&&!!s.contractAddress&&!!s.itemId,{data:y}=B({queryKey:["notify-request",s.contractAddress,s.itemId,n==null?void 0:n.address],enabled:j,queryFn:()=>Mt(s.contractAddress,s.itemId,n.identity)});d.useEffect(()=>{y!=null&&y.email&&m(b=>b||y.email)},[y==null?void 0:y.email]),d.useEffect(()=>{if(!n)return;let b=!1;return Pa().then(f=>{!b&&f&&m(g=>g||f)}),()=>{b=!0}},[n]);const N=x||!!(y!=null&&y.subscribed);async function F(b){if(b.preventDefault(),!(!n||!s.itemId||!Ge(o)||h)){w(!0),a(null);try{await Pt({contractAddress:s.contractAddress,itemId:s.itemId,chainId:s.chainId,email:o.trim()},n.identity),c(!0)}catch(f){Z(f,{flow:"notify-me",contractAddress:s.contractAddress,itemId:s.itemId}),a(t("notifyMe.error"))}finally{w(!1)}}}return n?N?e.jsxs("div",{className:"notify notify__done","data-testid":"notify-subscribed",children:[e.jsx("span",{className:"notify__done-check","aria-hidden":!0,children:e.jsx(T,{name:"check",size:12})}),e.jsx("span",{className:"notify__done-text",children:t("notifyMe.subscribedBody")})]}):e.jsxs("form",{className:"notify",onSubmit:F,"data-testid":"notify",children:[e.jsx("label",{className:"notify__label",htmlFor:"notify-email",children:t("notifyMe.label")}),e.jsxs("div",{className:"notify__row",children:[e.jsx("input",{id:"notify-email",className:"notify__input",type:"email",inputMode:"email",autoComplete:"email",placeholder:t("notifyMe.placeholder"),value:o,onChange:b=>m(b.target.value),"data-testid":"notify-email"}),e.jsx("button",{type:"submit",className:"notify__btn",disabled:!Ge(o)||h,"data-testid":"notify-submit",children:h?t("notifyMe.working"):t("notifyMe.cta")})]}),e.jsx(ce,{message:l})]}):e.jsx("div",{className:"notify","data-testid":"notify",children:e.jsx("button",{type:"button",className:"notify__signin",onClick:i,"data-testid":"notify-signin",children:t("notifyMe.signInCta")})})}const Ft=W.button`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Dz17wnbD.js","assets/react-BrLDncxD.js","assets/dcl-schemas-BICTSpB5.js","assets/index-D2u3qo5-.js","assets/sentry-DYZXk5O5.js","assets/ethers-BIvjmL85.js","assets/intl-CBcMB1D2.js","assets/index-Bw9Y53F1.css","assets/emotion-styled.browser.esm-CtG7z_nw.js","assets/useTheme-BDMGaPba.js","assets/CircularProgress-CzgFv03I.js","assets/index-BCPi-ClS.js","assets/useTheme-DpYzrDIG.js","assets/CssVarsProvider-F9lbInZM.js","assets/getOverlayAlpha-5GYRyW4x.js","assets/index-D4JXiKx_.js","assets/colors-LINLm1ux.js"])))=>i.map(i=>d[i]);
2
+ import{a as oe,r as d,j as e,d as pa,u as ya,L as fa}from"./react-BrLDncxD.js";import{d as X,n as xa,o as ve,t,ah as ba,i as ga,b as ja,w as va,q as ne,x as D,y as ge,z as fe,ai as Na,E as Z,g as E,j as de,B as z,C as xe,p as wa,J as Je,_ as be,ak as ka,ax as Ia,ay as Ca,az as Sa,aA as Aa,c as Ne,aB as Ma,L as Ye,m as B,aC as Pa,I as T,F as K,s as W,aD as Ea,aE as Fa,aF as La,G as Ta,ae as ze,a as Ke,aG as Da,aH as Ra,aI as qa,aJ as Ba,aK as $a,af as Oa,u as za,aL as Ka,aM as Wa,aN as Va,h as Qa,aO as We,aP as Ua,f as Ga,ao as Ha,aQ as Ja,aR as Ya,ap as Xa,aS as Za,aT as et}from"./index-D2u3qo5-.js";import{d as G}from"./dcl-schemas-BICTSpB5.js";import{b as Ve,c as at}from"./buy-CHyPhIFc.js";import{P as tt,f as st}from"./PrimaryListModal-DRCA3QS9.js";import{b as it,w as rt,S as nt,G as lt}from"./buy-gasless-DRDa-VRS.js";import{a as dt}from"./authorizations-mnih5q8o.js";import{u as ot,M as ct,c as mt}from"./useCreditPacks-Djg10PxH.js";import{W as ut,C as ht,a as _t}from"./CollectionCarousel-D6IuiIc2.js";import{R as Qe}from"./resume-buy-Bf0zIH7y.js";import{a as pt,f as je,i as yt}from"./errors-B3Jy0VAJ.js";import{E as ce}from"./ErrorNotice-BDH9xoG4.js";import{l as ft}from"./loader-logo-BzY9EKdC.js";import{C as xt}from"./CircularProgress-CzgFv03I.js";import{a as bt,b as gt}from"./trade-encoding-CtfVB9K4.js";import{u as jt,M as vt}from"./MarketCheckout-BemjD_ML.js";import{s as Nt}from"./address-DrURAr9O.js";import{T as Xe}from"./Tooltip-CAVGsqiJ.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./mana-rate-DcCwt7oF.js";import"./emotion-CSxEP8yM.js";function wt({item:s,onClose:n,resume:i=!1}){var ae,te;const{session:o}=X(),{data:m}=xa(o),h=ve(),w=oe(),x=ot().packs.slice(0,ct),[c,l]=d.useState("loading"),[a,j]=d.useState(null),[y,N]=d.useState(""),[F,b]=d.useState(s.priceCredits),[f,g]=d.useState(null),I=d.useRef(null),M=(f==null?void 0:f.credits)??F,ee=(m==null?void 0:m.credits)??0;d.useEffect(()=>{let u=!1;if(!o){l("error"),j(t("buyModal.signInToCheckout"));return}const C=_=>{const S=_-((m==null?void 0:m.credits)??0),v=x.find(R=>R.credits>=S)??x[x.length-1];N(v.id),D("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:_,credits_balance:(m==null?void 0:m.credits)??0,shortfall:Math.max(0,S)}),l("nofunds")};return(async()=>{var _,S;try{const v=await ba(s);if(!v)throw new Error("not for sale");if(ga(v,o.address))throw new Error("You can't buy your own listing.");const R=ja((S=(_=v.received)==null?void 0:_[0])==null?void 0:S.amount);if(!Number.isFinite(R)||R<=0)throw new Error("price unavailable");const V=Math.ceil(R/10);if(u)return;if(b(V),m!=null&&m.credits<V){C(V);return}try{const{credit:A,maxCreditedValue:J,usdCents:O}=await va(o.identity,R,v.id);if(u){ne(o.identity,[A.id]).catch(()=>{});return}I.current=A.id;const se=Math.ceil(O/10);b(se);const Q={trade:v,credit:A,maxCreditedValue:J,usdCents:O,credits:se};g(Q),i?H(Q):l("ready")}catch(A){if(u)return;if(pt(A)){C(V);return}throw A}}catch(v){if(u)return;D(fe(v)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:ge(v)}),l("error"),j(je(v,t("buyModal.error.generic"),{sale:!0}))}})(),()=>{u=!0,I.current&&o&&(ne(o.identity,[I.current]).catch(()=>{}),I.current=null)}},[]);async function H(u=f){if(!o||!u)return;l("processing"),j(null);let C=!1;try{const _={trade:u.trade,buyer:o.address,signer:o.signer,credits:[u.credit],maxCreditedValue:u.maxCreditedValue};let S;if(dt())try{S=await it(_),await rt(S),C=!0}catch(v){if(v instanceof nt)C=!0;else if(v instanceof lt)S=await Ve(_);else throw v}else S=await Ve(_);I.current=null,D("Shop Completed Purchase",{...Na([s]),payment_type:"credits",no_crypto_step:C,transaction_hash:S??null}),h.invalidateQueries({queryKey:["usd-balance"]}),l("complete")}catch(_){fe(_)||Z(_,{flow:"buy",step:"submit",gasless:C}),ne(o.identity,[u.credit.id]).catch(()=>{}),I.current=null,D(fe(_)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:ge(_)}),h.invalidateQueries({queryKey:["usd-balance"]}),j(je(_,t("buyModal.error.generic"),{sale:!0})),l("error")}}async function me(){if(!(!y||!o)){try{sessionStorage.setItem(Qe,JSON.stringify(s))}catch{}f&&ne(o.identity,[f.credit.id]).catch(()=>{}),I.current=null,l("loading");try{const u=await mt(y,{address:o.address,identity:o.identity});if(u.url){window.location.href=u.url;return}w("/credits")}catch(u){Z(u,{flow:"buy_credits_and_item"});try{sessionStorage.removeItem(Qe)}catch{}j(t("buyModal.error.creditsCheckout")),l("error")}}}const $=c==="processing",L=c==="complete"?t("buyModal.titleComplete"):c==="nofunds"?t("buyModal.titleNoFunds"):t("buyModal.titleBuy");return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":t("buyModal.dialogAria",{name:s.name}),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:$?void 0:n,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${c==="processing"||c==="loading"?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:L}),!$&&e.jsx("button",{className:"buy-modal__x",onClick:n,"aria-label":t("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:c==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(E,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:de(ee)})]})]}),c==="loading"&&e.jsx("div",{className:"buy-modal__body buy-modal__processing",children:e.jsx(xt,{size:44})}),c==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(ce,{message:a}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:n,children:t("buyModal.close")})})]}),c==="nofunds"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(ut,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:t("buyModal.insufficientFunds")})," ",t("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:t("buyModal.warningCreditsAmount",{count:Math.max(0,M-ee)})})," ",t("buyModal.warningToPurchase",{count:1})]})]}),e.jsx(Ue,{item:s,priceCredits:M}),e.jsx("div",{className:"buy-modal__packs",children:x.map(u=>{const C=u.credits,_=u.id===y;return e.jsxs("button",{className:`buy-modal__pack${_?" buy-modal__pack--on":""}`,onClick:()=>N(u.id),children:[e.jsx(E,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:de(C)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",u.usd.toFixed(2),")"]})]},u.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(E,{className:"buy-modal__total-ico"}),e.jsx("span",{children:de(((ae=x.find(u=>u.id===y))==null?void 0:ae.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",(((te=x.find(u=>u.id===y))==null?void 0:te.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:n,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:()=>void me(),children:t("buyModal.buy")})]})]}),c==="ready"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(Ue,{item:s,priceCredits:M}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient buy-modal__btn--full",onClick:()=>void H(),children:t("buyModal.buy")})})]}),c==="processing"&&e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:ft,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:i?t("buyModal.completingPurchase"):t("buyModal.completingTransaction")}),e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]}),c==="complete"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__success",children:[e.jsxs("svg",{viewBox:"0 0 64 64",width:"64",height:"64","aria-hidden":!0,children:[e.jsx("circle",{cx:"32",cy:"32",r:"32",fill:"#34ce74"}),e.jsx("path",{d:"M20 33l8 8 16-18",fill:"none",stroke:"#fff",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsxs("p",{className:"buy-modal__success-text",children:[e.jsx("b",{children:t("getCredits.successTitle")})," ",t("buyModal.successBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:()=>w("/assets?tab=mine"),children:t("buyModal.myAssets")}),e.jsxs("button",{className:"buy-modal__btn buy-modal__btn--ruby",onClick:n,children:[t("buyModal.tryInWorld"),e.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20","aria-hidden":!0,children:e.jsx("path",{d:"M5 12h12M13 7l5 5-5 5",fill:"none",stroke:"#fcfcfc",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})]})]})}function Ue({item:s,priceCredits:n}){return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsx("div",{className:"buy-modal__asset-name",title:s.name,children:s.name||t("buyModal.itemFallback")}),s.creator?e.jsx(ht,{address:s.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(E,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:de(n)})]})]})]})}const kt=1e3*60*60*24*182;function It({asset:s,session:n,onClose:i}){const o=ve(),m=oe(),[h,w]=d.useState("10"),[x,c]=d.useState(null),[l,a]=d.useState(null),[j,y]=d.useState(!1),[N,F]=d.useState(null);async function b(){a(null);const g=Number(h);if(!Number.isInteger(g)||g<=0){a(t("sellModal.errorWholeNumber"));return}y(!0);try{c(t("sellModal.statusPreparing")),await bt({signer:n.signer,contractAddress:s.contractAddress,chainId:s.chainId}),c(t("sellModal.statusListing"));const I=await gt({signer:n.signer,nft:{contractAddress:s.contractAddress,tokenId:s.tokenId,network:s.network,chainId:s.chainId},usdPrice:g/10,expiresAtMs:Date.now()+kt});c(t("sellModal.statusPublishing")),await wa(I,n.identity),c(null),F(g),D("Shop Listed Item",{item_id:s.itemId??s.tokenId??null,contract_address:s.contractAddress,price_credits:g,price_usd:g/10,listing_type:"secondary",is_primary:!1}),Je.success(t("sellModal.toastOnSale",{name:s.name})),o.invalidateQueries({queryKey:["my-assets",n.address]})}catch(I){Z(I,{flow:"list_secondary"}),D("Shop Listing Failed",{listing_type:"secondary",error_code:ge(I)}),a(je(I,t("sellModal.errorGeneric"))),c(null)}finally{y(!1)}}function f(){i(),m(`/item/${s.contractAddress}/${s.tokenId}`)}return N!==null?e.jsx("div",{className:"modal-backdrop",onClick:i,role:"presentation",children:e.jsxs("div",{className:"modal modal--success",onClick:g=>g.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:t("sellModal.successTitle")}),s.image?e.jsx("img",{className:"modal__img",src:s.image,alt:s.name}):null,e.jsx("p",{className:"modal-success__name",children:s.name}),e.jsxs("p",{className:"muted small",children:[t("sellModal.listedFor")," ",e.jsxs("strong",{children:[e.jsx(E,{className:"ccy-mark"})," ",N]})]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(z,{variant:"ghost",onClick:i,children:t("getCredits.done")}),e.jsx(z,{variant:"purple",onClick:f,children:t("sellModal.viewInShop")})]})]})}):e.jsx("div",{className:"modal-backdrop",onClick:i,role:"presentation",children:e.jsxs("div",{className:"modal","data-testid":"modal",onClick:g=>g.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("h2",{className:"modal__title",children:t("sellModal.listTitle",{name:s.name})}),s.image?e.jsx("img",{className:"modal__img",src:s.image,alt:s.name}):null,e.jsxs("label",{className:"field",children:[e.jsx("span",{children:t("sellModal.priceLabel",{currency:xe.name})}),e.jsx("input",{type:"number",min:"1",step:"1",value:h,onChange:g=>w(g.target.value),disabled:j})]}),e.jsx("p",{className:"muted small",children:t("sellModal.pricedInWhole",{currency:xe.name,currencySingular:xe.nameSingular})}),x?e.jsx("p",{className:"muted",children:x}):null,e.jsx(ce,{message:l}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(z,{variant:"ghost",onClick:i,disabled:j,children:t("sellModal.cancel")}),e.jsx(z,{onClick:()=>void b(),disabled:j,children:j?t("sellModal.listing"):t("sellModal.putOnSale")})]})]})})}const Ct=d.lazy(async()=>{const[{EmoteControls:s},{Experimental_CssVarsProvider:n},{light:i}]=await Promise.all([be(()=>import("./index-Dz17wnbD.js").then(o=>o.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),be(()=>import("./index-BCPi-ClS.js"),__vite__mapDeps([11,3,1,2,4,5,6,7,12,9,13,14])),be(()=>import("./index-D4JXiKx_.js"),__vite__mapDeps([15,3,1,2,4,5,6,7,16,14,13,9]))]);return{default:o=>e.jsx(n,{theme:i,children:e.jsx(s,{...o})})}});function St(s){return e.jsx(d.Suspense,{fallback:null,children:e.jsx(Ct,{...s})})}function At({item:s}){const n=X(f=>{var g;return(g=f.session)==null?void 0:g.address}),{data:i,isLoading:o}=ka(n),m=n&&i?n:"default",h=s.category==="emote",[w,x]=d.useState("item"),c=!h&&w==="item",l=c||!o,[a,j]=d.useState(!0);d.useEffect(()=>{j(!0)},[s.id,c]);const y=!!n&&!!i,N=y&&Ia(s,Ca(i)),F=Sa(s)[0],b=y&&!N&&!h;return e.jsxs(e.Fragment,{children:[l?e.jsx(Aa,{id:"shop-item-preview",contractAddress:s.contractAddress,tokenId:s.tokenId??void 0,itemId:s.tokenId?void 0:s.itemId??void 0,profile:c?void 0:N?m:"default",bodyShape:c||N?void 0:F,type:h?void 0:c?G.PreviewType.WEARABLE:G.PreviewType.AVATAR,emote:h||c?void 0:G.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:h?1.5:void 0,wheelStart:h?100:void 0,dev:Ne.chainId===80002,onLoad:()=>j(!1)}):null,!l||a?e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":t("itemPreview.loading"),children:e.jsx("span",{className:"item-preview__spinner","aria-hidden":!0})}):null,b&&!c?e.jsx("p",{className:"item-preview__note",children:t("itemPreview.shownOnBody",{shape:Ma(F)})}):null,h?e.jsx("div",{className:"item-preview__emote-controls","data-testid":"emote-controls",children:e.jsx(St,{wearablePreviewId:"shop-item-preview",hideFrameInput:!0})}):e.jsxs("div",{className:"item-preview__toggle",role:"group","aria-label":t("itemPreview.previewMode"),children:[e.jsxs("button",{type:"button",className:w==="avatar"?"is-active":"","aria-pressed":w==="avatar","aria-label":t("itemPreview.onAvatar"),onClick:()=>x("avatar"),children:[e.jsxs("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"7.5",r:"4"}),e.jsx("path",{d:"M4 20c0-4.2 3.6-6.5 8-6.5s8 2.3 8 6.5v.5H4z"})]}),e.jsx("span",{className:"item-preview__toggle-label",children:t("itemPreview.onAvatar")})]}),e.jsxs("button",{type:"button",className:w==="item"?"is-active":"","aria-pressed":w==="item","aria-label":t("itemPreview.item"),onClick:()=>x("item"),children:[e.jsx("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:e.jsx("path",{d:"M8.5 3 3 6l1.8 3.8 2.2-1V21h10V8.8l2.2 1L22 6l-5.5-3a2.6 2.6 0 0 1-4.5 1.4A2.6 2.6 0 0 1 8.5 3z"})}),e.jsx("span",{className:"item-preview__toggle-label",children:t("itemPreview.item")})]})]})]})}function Ze(){return Ne.shopServerUrl||(typeof window<"u"?window.location.origin:"")}async function Mt(s,n,i){const o=new URLSearchParams({contractAddress:s,itemId:n}),m=`${Ze()}/notify-requests?${o.toString()}`,h=await Ye(m,{method:"GET",identity:i,metadata:{}});if(!h.ok)throw new Error(`getNotifyRequest ${h.status}`);return h.json()}async function Pt(s,n){const i=`${Ze()}/notify-requests`,o=await Ye(i,{method:"POST",identity:n,metadata:{},headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!o.ok)throw new Error(`createNotifyRequest ${o.status}: ${await o.text()}`);await o.json().catch(()=>{})}function Ge(s){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.trim())}function Et({item:s}){const n=X(b=>b.session),i=X(b=>b.signIn),[o,m]=d.useState(""),[h,w]=d.useState(!1),[x,c]=d.useState(!1),[l,a]=d.useState(null),j=!!n&&!!s.contractAddress&&!!s.itemId,{data:y}=B({queryKey:["notify-request",s.contractAddress,s.itemId,n==null?void 0:n.address],enabled:j,queryFn:()=>Mt(s.contractAddress,s.itemId,n.identity)});d.useEffect(()=>{y!=null&&y.email&&m(b=>b||y.email)},[y==null?void 0:y.email]),d.useEffect(()=>{if(!n)return;let b=!1;return Pa().then(f=>{!b&&f&&m(g=>g||f)}),()=>{b=!0}},[n]);const N=x||!!(y!=null&&y.subscribed);async function F(b){if(b.preventDefault(),!(!n||!s.itemId||!Ge(o)||h)){w(!0),a(null);try{await Pt({contractAddress:s.contractAddress,itemId:s.itemId,chainId:s.chainId,email:o.trim()},n.identity),c(!0)}catch(f){Z(f,{flow:"notify-me",contractAddress:s.contractAddress,itemId:s.itemId}),a(t("notifyMe.error"))}finally{w(!1)}}}return n?N?e.jsxs("div",{className:"notify notify__done","data-testid":"notify-subscribed",children:[e.jsx("span",{className:"notify__done-check","aria-hidden":!0,children:e.jsx(T,{name:"check",size:12})}),e.jsx("span",{className:"notify__done-text",children:t("notifyMe.subscribedBody")})]}):e.jsxs("form",{className:"notify",onSubmit:F,"data-testid":"notify",children:[e.jsx("label",{className:"notify__label",htmlFor:"notify-email",children:t("notifyMe.label")}),e.jsxs("div",{className:"notify__row",children:[e.jsx("input",{id:"notify-email",className:"notify__input",type:"email",inputMode:"email",autoComplete:"email",placeholder:t("notifyMe.placeholder"),value:o,onChange:b=>m(b.target.value),"data-testid":"notify-email"}),e.jsx("button",{type:"submit",className:"notify__btn",disabled:!Ge(o)||h,"data-testid":"notify-submit",children:h?t("notifyMe.working"):t("notifyMe.cta")})]}),e.jsx(ce,{message:l})]}):e.jsx("div",{className:"notify","data-testid":"notify",children:e.jsx("button",{type:"button",className:"notify__signin",onClick:i,"data-testid":"notify-signin",children:t("notifyMe.signInCta")})})}const Ft=W.button`
3
3
  display: flex;
4
4
  align-items: center;
5
5
  justify-content: center;
@@ -1,4 +1,4 @@
1
- import{r as l,j as c}from"./react-BrLDncxD.js";import{s as u,B as p,t as d}from"./index-N2L0zXX7.js";const a=u.div`
1
+ import{r as l,j as c}from"./react-BrLDncxD.js";import{s as u,B as p,t as d}from"./index-D2u3qo5-.js";const a=u.div`
2
2
  display: flex;
3
3
  justify-content: center;
4
4
  padding: 28px 0 8px;
@@ -1,3 +1,3 @@
1
- import{m as O,c as S,d as V,n as Y,o as H,t,q as k,g as x,r as M,v as $,C as j,f as D,i as J,w as X,x as p,y as F,z as R,s as Z,B as ee}from"./index-N2L0zXX7.js";import{r as re,a as b}from"./mana-rate-B_U_hjWF.js";import{a as ae,r as m,j as r}from"./react-BrLDncxD.js";import{b as A}from"./buy-ra8wh_Tw.js";import{b as te,w as se,S as ie,G as ce}from"./buy-gasless-DxE_2TUI.js";import{a as ne}from"./authorizations-BUCDfL2t.js";import{i as de}from"./errors-DWlrWfS6.js";import{E as oe}from"./ErrorNotice-BDH9xoG4.js";function Ce(e=!0){return O({queryKey:["mana-rate",S.chainId],queryFn:()=>re(S.chainId),enabled:e,staleTime:6e4,refetchInterval:6e4,retry:1})}const B=Z(ee)`
1
+ import{m as O,c as S,d as V,n as Y,o as H,t,q as k,g as x,r as M,v as $,C as j,f as D,i as J,w as X,x as p,y as F,z as R,s as Z,B as ee}from"./index-D2u3qo5-.js";import{r as re,a as b}from"./mana-rate-DcCwt7oF.js";import{a as ae,r as m,j as r}from"./react-BrLDncxD.js";import{b as A}from"./buy-CHyPhIFc.js";import{b as te,w as se,S as ie,G as ce}from"./buy-gasless-DRDa-VRS.js";import{a as ne}from"./authorizations-mnih5q8o.js";import{i as de}from"./errors-B3Jy0VAJ.js";import{E as oe}from"./ErrorNotice-BDH9xoG4.js";function Ce(e=!0){return O({queryKey:["mana-rate",S.chainId],queryFn:()=>re(S.chainId),enabled:e,staleTime:6e4,refetchInterval:6e4,retry:1})}const B=Z(ee)`
2
2
  flex: 1;
3
3
  `;function U(e){if(de(e))return t("errors.rejected");const n=(e.message??"").toLowerCase();return n.includes("insufficient")?t("marketCheckout.error.insufficient",{currency:j.name}):n.includes("not found")||n.includes("no active listing")||n.includes("404")?t("marketCheckout.error.soldOrRemoved"):n.includes("your own listing")?t("errors.cantBuyOwn"):t("marketCheckout.error.generic")}function le(e){return{id:e.tradeId,tradeId:e.tradeId,name:e.name,creator:e.creator,contractAddress:e.contractAddress,itemId:e.itemId,category:e.category,wearableCategory:e.wearableCategory??void 0,rarity:e.rarity,network:e.network,chainId:e.chainId,thumbnail:e.thumbnail,priceCredits:0,gender:null,isSmart:!1}}function ve({listing:e,rate:n,onClose:q,onSold:W}){const{session:i}=V(),{data:d,isError:T}=Y(i),w=H(),g=ae(),[N,f]=m.useState("confirm"),[C,I]=m.useState(t("marketCheckout.lockingPrice")),[z,_]=m.useState(null),[a,G]=m.useState(null),o=m.useRef(null),L=Math.ceil(b(e.manaWei,n)/10);m.useEffect(()=>{let l=!1;if(!i){f("error"),_(t("buyModal.signInToCheckout"));return}return(async()=>{try{const s=await D(e.tradeId);if(!s)throw new Error("not found");if(J(s,i.address))throw new Error("You can't buy your own listing.");const h=b(e.manaWei,n);if(!Number.isFinite(h)||h<=0)throw new Error("price unavailable");const{credit:u,maxCreditedValue:K,usdCents:P}=await X(i.identity,h,e.tradeId);if(l){k(i.identity,[u.id]).catch(()=>{});return}o.current=u.id,G({trade:s,credit:u,maxCreditedValue:K,usdCents:P,credits:Math.ceil(P/10)}),I("")}catch(s){if(l)return;console.error("[market] authorize failed",s),p(R(s)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:F(s),value_usd:Math.round(b(e.manaWei,n))/100}),f("error"),_(U(s))}})(),()=>{l=!0,o.current&&i&&(k(i.identity,[o.current]).catch(()=>{}),o.current=null)}},[]);const v=!!a&&d!=null&&d.credits<a.credits;async function Q(){if(!i||!a)return;if(v){p("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:a.credits,credits_balance:(d==null?void 0:d.credits)??0,shortfall:Math.max(0,a.credits-((d==null?void 0:d.credits)??0))}),k(i.identity,[a.credit.id]).catch(()=>{}),o.current=null,g("/credits");return}f("working"),_(null);let l=!1;try{I(t("marketCheckout.confirming"));const c={trade:a.trade,buyer:i.address,signer:i.signer,credits:[a.credit],maxCreditedValue:a.maxCreditedValue};let s;if(ne())try{s=await te(c),await se(s),l=!0}catch(u){if(u instanceof ie)l=!0;else if(u instanceof ce)s=await A(c);else throw u}else s=await A(c);o.current=null,p("Shop Completed Purchase",{items:[{item_id:e.itemId??null,contract_address:e.contractAddress,token_id:null,price_usd:a.usdCents/100}],value_credits:a.credits,value_usd:a.usdCents/100,purchase_type:"item",is_primary:!0,payment_type:"credits",no_crypto_step:l,transaction_hash:s??null}),w.invalidateQueries({queryKey:["usd-balance"]});const h={items:[le(e)],txHash:s};g("/success",{state:h})}catch(c){console.error("[market] buy now failed",c),k(i.identity,[a.credit.id]).catch(()=>{}),o.current=null,p(R(c)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:F(c),value_usd:a.usdCents/100}),w.invalidateQueries({queryKey:["usd-balance"]}),_(U(c)),f("error");const s=(c.message??"").toLowerCase();(s.includes("not found")||s.includes("no active listing")||s.includes("404"))&&W()}}function E(){i&&a&&k(i.identity,[a.credit.id]).catch(()=>{}),o.current=null,q()}const y=N==="working";return r.jsxs("div",{className:"mkt-modal",role:"dialog","aria-modal":"true","aria-label":t("buyModal.dialogAria",{name:e.name}),children:[r.jsx("div",{className:"mkt-modal__scrim",onClick:y?void 0:E,"aria-hidden":!0}),r.jsxs("div",{className:"mkt-modal__card",children:[r.jsxs("div",{className:"mkt-modal__head",children:[r.jsx("div",{className:"mkt-modal__thumb",children:e.thumbnail?r.jsx("img",{src:e.thumbnail,alt:""}):null}),r.jsxs("div",{children:[r.jsx("div",{className:"mkt-modal__name",title:e.name,children:e.name||t("buyModal.itemFallback")}),r.jsx("span",{className:"chip chip--rarity",children:e.rarity})]})]}),r.jsx("div",{className:"mkt-modal__price",children:a?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mkt-modal__price-label",children:t("marketCheckout.finalPrice")}),r.jsxs("div",{className:"mkt-modal__price-value",children:[r.jsx(x,{className:"mkt-modal__diamond"}),M(a.credits)]}),r.jsxs("div",{className:"mkt-modal__price-sub muted",children:[t("marketCheckout.lockedForPurchase")," · $",(a.usdCents/100).toFixed(2)]})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mkt-modal__price-label",children:t("marketCheckout.todaysPrice")}),r.jsxs("div",{className:"mkt-modal__price-value mkt-modal__price-value--approx",children:[r.jsx("span",{className:"mkt-modal__approx","aria-hidden":!0,children:"≈"}),r.jsx(x,{className:"mkt-modal__diamond"}),M(L)]}),r.jsx("div",{className:"mkt-modal__price-sub muted",children:C||t("marketCheckout.lockingPrice")})]})}),i?r.jsxs("div",{className:"mkt-modal__balance muted",children:[t("marketCheckout.yourBalance")," ",r.jsx(x,{className:"ccy-mark"})," ",$(d,T)]}):null,v?r.jsx("p",{className:"muted mkt-modal__note",children:t("marketCheckout.needMore",{currency:j.name})}):null,C&&N==="working"?r.jsx("p",{className:"muted mkt-modal__note",children:C}):null,r.jsx(oe,{message:z,className:"mkt-modal__note"}),r.jsxs("div",{className:"mkt-modal__actions",children:[r.jsx(B,{variant:"ghost",onClick:E,disabled:y,children:t("buyModal.cancel")}),r.jsx(B,{variant:"purple",onClick:()=>void Q(),disabled:y||!a,children:y?t("marketCheckout.buying"):v?t("nav.getCredits",{currency:j.name}):t("marketCheckout.confirmPurchase")})]})]})]})}export{ve as M,Ce as u};
@@ -1,4 +1,4 @@
1
- import{L as Se,b as Ye,r as d,j as t}from"./react-BrLDncxD.js";import{s as a,F as s,I as j,u as Je,t as r,d as Ve,o as Ze,G as le,m as M,B as Xe,A as q,x as et,H as tt,f as st,J as ot,E as nt,c as je,K as rt}from"./index-N2L0zXX7.js";import{f as at}from"./import-5uw4xr5F.js";import{P as it,f as lt}from"./PrimaryListModal-JkGI-cG4.js";import{c as ct}from"./buy-ra8wh_Tw.js";import{R as G,C as dt,a as mt,F as pt,S as D,b as ce}from"./categories-BaqUBHO4.js";import{L as ut}from"./LoadMore-Cmni2e-s.js";import{D as de,F as me,R as ft,a as xt,b as ht,c as yt,d as gt,S as bt,e as wt,f as St,g as jt,h as $t,i as Ct,j as It,k as kt,C as vt,l as At,m as Et,n as Tt,M as Ft}from"./Assets.styles-CDC2HBmZ.js";import{u as Rt}from"./useInfiniteGrid-CgxIpgDb.js";import{E as U}from"./ErrorNotice-BDH9xoG4.js";import{n as $e}from"./emotion-CSxEP8yM.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./mana-rate-B_U_hjWF.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./trade-encoding-Nzi47aTM.js";import"./authorizations-BUCDfL2t.js";import"./errors-DWlrWfS6.js";import"./Tooltip-Bz0rwSTJ.js";a.div`
1
+ import{L as Se,b as Ye,r as d,j as t}from"./react-BrLDncxD.js";import{s as a,F as s,I as j,u as Je,t as r,d as Ve,o as Ze,G as le,m as M,B as Xe,A as q,x as et,H as tt,f as st,J as ot,E as nt,c as je,K as rt}from"./index-D2u3qo5-.js";import{f as at}from"./import-a0kWnC35.js";import{P as it,f as lt}from"./PrimaryListModal-DRCA3QS9.js";import{c as ct}from"./buy-CHyPhIFc.js";import{R as G,C as dt,a as mt,F as pt,S as D,b as ce}from"./categories-7ZUMUxRc.js";import{L as ut}from"./LoadMore-DAM-bEob.js";import{D as de,F as me,R as ft,a as xt,b as ht,c as yt,d as gt,S as bt,e as wt,f as St,g as jt,h as $t,i as Ct,j as It,k as kt,C as vt,l as At,m as Et,n as Tt,M as Ft}from"./Assets.styles-Dz0IZ5_I.js";import{u as Rt}from"./useInfiniteGrid-Cg-FBhvv.js";import{E as U}from"./ErrorNotice-BDH9xoG4.js";import{n as $e}from"./emotion-CSxEP8yM.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./mana-rate-DcCwt7oF.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./trade-encoding-CtfVB9K4.js";import"./authorizations-mnih5q8o.js";import"./errors-B3Jy0VAJ.js";import"./Tooltip-CAVGsqiJ.js";a.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 4px;
@@ -1,3 +1,3 @@
1
- import{r as n,j as s,L as m}from"./react-BrLDncxD.js";import{u as c,t,a as l,I as d,A as p,s as v,B as x}from"./index-N2L0zXX7.js";import{L as u}from"./LoadMore-Cmni2e-s.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";const h=v(x)`
1
+ import{r as n,j as s,L as m}from"./react-BrLDncxD.js";import{u as c,t,a as l,I as d,A as p,s as v,B as x}from"./index-D2u3qo5-.js";import{L as u}from"./LoadMore-DAM-bEob.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";const h=v(x)`
2
2
  margin-top: 12px;
3
3
  `,r=24;function E(){c({title:t("nav.myFavorites"),noindex:!0});const a=l(e=>Object.values(e.items)),[i,o]=n.useState(r);return a.length===0?s.jsxs("div",{className:"favorites-empty",children:[s.jsx(d,{name:"heart",size:40,color:"var(--muted-2)"}),s.jsx("p",{className:"favorites-empty__title",children:t("myFavorites.emptyTitle")}),s.jsx("p",{className:"muted",children:t("myFavorites.emptyBody")}),s.jsx(h,{as:m,to:"/assets",variant:"purple",children:t("notFound.cta")})]}):s.jsxs("section",{className:"favorites",children:[s.jsxs("div",{className:"favorites__head",children:[s.jsx("h1",{children:t("nav.myFavorites")}),s.jsx("span",{className:"favorites__count",children:t("myFavorites.itemCount",{count:a.length})})]}),s.jsx("div",{className:"grid",children:a.slice(0,i).map(e=>s.jsx(p,{item:e},e.id))}),s.jsx(u,{hasNextPage:i<a.length,isFetching:!1,onLoadMore:()=>o(e=>e+r)})]})}export{E as MyFavorites};