@dcl/shop 0.1.0-30275838080.commit-dc84870 → 0.1.0-30277401547.commit-e877307

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 (209) hide show
  1. package/assets/Activity-_qlXQij1.js +287 -0
  2. package/assets/{AnimatedBackground-xHNygKQ8.js → AnimatedBackground-DO49gSw8.js} +1 -1
  3. package/assets/Assets-D-VpkQ1l.js +787 -0
  4. package/assets/{Assets.styles-DvPvkguW.js → Assets.styles-BZMkOQeI.js} +94 -21
  5. package/assets/Authorizations-BFWG3QA_.js +182 -0
  6. package/assets/{Button-auVihOkI.js → Button-DvhW1Z1S.js} +3 -3
  7. package/assets/Cart-C_kThny7.css +1 -0
  8. package/assets/Cart-Cz7NK8QL.js +1 -0
  9. package/assets/{CircularProgress-DFdK37rG.js → CircularProgress-BmwVvF17.js} +3 -3
  10. package/assets/{Collection-B3vEoxu6.js → Collection-Bc2CvIur.js} +2 -2
  11. package/assets/CollectionCarousel-DEYFBykF.js +292 -0
  12. package/assets/{Creator-YS98HebA.js → Creator-7vyVsWtE.js} +1 -1
  13. package/assets/{ExchangeController-BDF-2GeF.js → ExchangeController-icK8vQc1.js} +1 -1
  14. package/assets/GetCredits-BE-bIUdj.js +611 -0
  15. package/assets/{HelpersUtil-pH82j1ap.js → HelpersUtil-C_aV_Y-W.js} +1 -1
  16. package/assets/ImportListings-CgB7Xjb_.css +1 -0
  17. package/assets/{ImportListings-D5NXWizQ.js → ImportListings-CusN2RYj.js} +2 -2
  18. package/assets/{ItemDetail-DSWLL-Uv.css → ItemDetail-CkmPrObF.css} +1 -1
  19. package/assets/ItemDetail-blewhWwg.js +2406 -0
  20. package/assets/{LoadMore-C2IGYfn5.js → LoadMore-C2uaqP2N.js} +1 -1
  21. package/assets/{MarketCheckout-BF6QzOp6.js → MarketCheckout-CW6mGgHt.js} +1 -1
  22. package/assets/{MenuList-CuKsDFTR.js → MenuList-mbP1RxaG.js} +2 -2
  23. package/assets/{MyAssets-DzPtnmU-.js → MyAssets-HcHA9d8L.js} +4 -4
  24. package/assets/MyFavorites-DkEAv96J.js +1 -0
  25. package/assets/{NotFound-C6fJPmtm.js → NotFound-B2W2MHR8.js} +1 -1
  26. package/assets/NotificationsBell-BEAvIZcq.js +34 -0
  27. package/assets/{StoreSettings-_eAoEzML.js → StoreSettings-CGc7i0kZ.js} +3 -3
  28. package/assets/{Success-Bx8rXLT9.js → Success-5LiVLOny.js} +2 -2
  29. package/assets/{SwapController-CxLE_1Gs.js → SwapController-BZT-uJE0.js} +1 -1
  30. package/assets/{Tooltip-CTKg0lSi.js → Tooltip-V9fXstBY.js} +1 -1
  31. package/assets/TradeService-D9nuCaGq.js +1 -0
  32. package/assets/{W3MFrameProviderSingleton-B2IDULyh.js → W3MFrameProviderSingleton-Ccq1reIt.js} +3 -3
  33. package/assets/{WebCryptoP256-wzk7delV.js → WebCryptoP256-CrgJppag.js} +1 -1
  34. package/assets/authorizations-t9AL68YM.js +1 -0
  35. package/assets/{basic-Ww-Goaw6.js → basic-BIbSgqQe.js} +1 -1
  36. package/assets/{biconomy-B_JhK1qV.js → biconomy-JEnDnFaz.js} +1 -1
  37. package/assets/{builder-AyiZYpZU.js → builder-uUlDA8Em.js} +1 -1
  38. package/assets/buy-84sizoxr.js +1 -0
  39. package/assets/buy-gasless-oF_YJX_W.js +1 -0
  40. package/assets/{cart-checkout-CWNsZ2Kj.js → cart-checkout-K77UDHy3.js} +1 -1
  41. package/assets/{categories-BtWBqb3o.js → categories-BwvbYi6M.js} +6 -6
  42. package/assets/categories-YFBLpDYC.css +1 -0
  43. package/assets/{ccip-CqHKhzd2.js → ccip-5L0bsS_C.js} +1 -1
  44. package/assets/{ccip-BjXLypPq.js → ccip-wypw12me.js} +1 -1
  45. package/assets/{collection-DOvX-TK6.js → collection-D7HQMUIe.js} +1 -1
  46. package/assets/{controller-C7WZ94lQ.js → controller-Cwg1NxXB.js} +2 -2
  47. package/assets/{core-DxTrqfX4.js → core-3ZRiSdvl.js} +4 -4
  48. package/assets/{custom-4udkoSO3.js → custom-BVE_f5dD.js} +1 -1
  49. package/assets/{data-capture-DDVUgHnH.js → data-capture-BRhsLQVv.js} +1 -1
  50. package/assets/{email-Csl1ng9Z.js → email-CldXoMar.js} +1 -1
  51. package/assets/{embedded-wallet-BkYPvh0b.js → embedded-wallet-vSjh73AM.js} +1 -1
  52. package/assets/{emotion-styled.browser.esm-Cdq1r4Bx.js → emotion-styled.browser.esm-vQZV14Nf.js} +1 -1
  53. package/assets/{engine-D35Ks53W.js → engine-BPP9EW4Q.js} +1 -1
  54. package/assets/{errors-DuOi3T0l.js → errors-D-hio89k.js} +1 -1
  55. package/assets/{estimate-l1-fee-Di371MAc.js → estimate-l1-fee-BLZxmPJY.js} +1 -1
  56. package/assets/{execute-TUXY08B1.js → execute-cH8V-8nL.js} +2 -2
  57. package/assets/{features-B8cziiif.js → features-CJ1tq5LL.js} +1 -1
  58. package/assets/{fetchTokenMetadata-BpxdUfTL.js → fetchTokenMetadata-hD4VNXHw.js} +2 -2
  59. package/assets/{get-ecosystem-wallet-info-B-M4E9jS.js → get-ecosystem-wallet-info-3DZHpSG2.js} +1 -1
  60. package/assets/{getBalance-Bifizyr6.js → getBalance-vjJ5CXDC.js} +1 -1
  61. package/assets/{getNFT-DF6Vq2zI.js → getNFT-BTjIkFXY.js} +1 -1
  62. package/assets/{getNFT-BdLG614g.js → getNFT-D8HIjTde.js} +1 -1
  63. package/assets/{getThemeProps-DxJMDPi7.js → getThemeProps-qmqFWvou.js} +1 -1
  64. package/assets/governance-DnazlIjy.webp +0 -0
  65. package/assets/{hashTypedData-C_DXc5T4.js → hashTypedData-BrvDnrgK.js} +1 -1
  66. package/assets/{hashTypedData-CCVnwMeq.js → hashTypedData-Y2DJnKI9.js} +1 -1
  67. package/assets/identity-B4DXDuJP.webp +0 -0
  68. package/assets/{import-Dk9yGfxG.js → import-AgO0v-a5.js} +1 -1
  69. package/assets/{in-app-9n3fFIsg.js → in-app-C4N5lFwd.js} +1 -1
  70. package/assets/{in-app-wallet-calls-mZphw4u1.js → in-app-wallet-calls-CMBsSG6j.js} +1 -1
  71. package/assets/{index-RdnFDXdw.js → index--8tZMj8Y.js} +1 -1
  72. package/assets/{index-B0_gRdTe.js → index-1cJq3bUz.js} +1 -1
  73. package/assets/{index-Bpy0DTJn.js → index-B8GAuQX3.js} +3 -3
  74. package/assets/{index-B5oo797l.js → index-B96cJA0d.js} +1 -1
  75. package/assets/{index-hgeC0JQZ.js → index-B9AUDrI9.js} +1 -1
  76. package/assets/index-BFPNYe8x.js +312 -0
  77. package/assets/{index-BP7gy2xI.js → index-BGTbU_0B.js} +2 -2
  78. package/assets/{index-DEd7XSCQ.js → index-BKvaZQRw.js} +1 -1
  79. package/assets/index-BQOr-Vwz.js +4 -0
  80. package/assets/{index-BuDF20FB.js → index-BQuXaLZX.js} +1 -1
  81. package/assets/{index-FC51tvWK.js → index-BWgCJZHy.js} +2 -2
  82. package/assets/{index-DA6wQsaR.js → index-B_jKVCv0.js} +1 -1
  83. package/assets/{index-Bkrc7UDL.js → index-BcgMkg8Z.js} +1 -1
  84. package/assets/{index-BAsZQOHh.js → index-BjQNL760.js} +1 -1
  85. package/assets/{index-CQz4TE_L.js → index-BlBoDOVY.js} +1 -1
  86. package/assets/{index-BcCAXEd4.js → index-C-2OENmH.js} +1 -1
  87. package/assets/{index-CxqiofWy.js → index-C7UEmKEb.js} +3 -3
  88. package/assets/{index-BwPtVV-b.js → index-C7gHM4wY.js} +1 -1
  89. package/assets/{index-swIqjzKr.js → index-C8Ua1g52.js} +1 -1
  90. package/assets/{index-DJ5U21fD.js → index-CI-UnS2-.js} +1 -1
  91. package/assets/{index-CmPocwN2.js → index-CV39-lnY.js} +1 -1
  92. package/assets/{index-DsV2STGW.js → index-CcARyxeB.js} +1 -1
  93. package/assets/{index-c9PZfSgh.js → index-Ch88GJdD.js} +1 -1
  94. package/assets/{index-Dxv5sw39.js → index-CiKWw9L3.js} +2 -2
  95. package/assets/{index-D2txhfvA.js → index-CmhYJKse.js} +1 -1
  96. package/assets/{index-BloQv0Rh.js → index-CnIGe1GZ.js} +1 -1
  97. package/assets/index-CsSypry2.js +2 -0
  98. package/assets/{index-dlaqrKGR.js → index-CvkWE_vF.js} +1 -1
  99. package/assets/{index-CSIhwKQ9.js → index-D0cj2XsC.js} +1 -1
  100. package/assets/{index-BWmGCZ1p.js → index-D2-V-v9q.js} +1 -1
  101. package/assets/{index-cBh2qc74.js → index-D2iLR1Fl.js} +1 -1
  102. package/assets/{index-892TBSG5.js → index-D96o2dcC.js} +1 -1
  103. package/assets/{index-D_7jU7Mb.js → index-DCFYAbF4.js} +1 -1
  104. package/assets/{index-Dp1f5mtU.js → index-DGwFgPlc.js} +1 -1
  105. package/assets/{index-CqQDAMpz.js → index-DN-OLR2r.js} +3 -3
  106. package/assets/{index-PtoeaYYN.js → index-DNLIdOOI.js} +1 -1
  107. package/assets/{index-CLAml9VI.js → index-DZxRXkvI.js} +1 -1
  108. package/assets/{index-BYcZdsFn.js → index-Dq7pc9gT.js} +1 -1
  109. package/assets/index-DwufS2l2.css +1 -0
  110. package/assets/{index-2v1NJpk7.js → index-Dx4EbFs-.js} +1 -1
  111. package/assets/{index-D2jkAfLH.js → index-Dz0EI57w.js} +1 -1
  112. package/assets/{index-Clx5uD4u.js → index-E3wxKJyS.js} +1 -1
  113. package/assets/{index-C_nN_7-B.js → index-HMuz0PhO.js} +1 -1
  114. package/assets/{index-BrKWcIRW.js → index-Hb4Ys2Tq.js} +1 -1
  115. package/assets/{index-CpzF0qFB.js → index-Vlg-GpRL.js} +1 -1
  116. package/assets/{index-B2uGwMji.js → index-YHVXMMbH.js} +1 -1
  117. package/assets/{index-BuV9hoRm.js → index-bqj_5mVc.js} +1 -1
  118. package/assets/{index-DFJtxZT4.js → index-jPOTr4Wq.js} +1 -1
  119. package/assets/{index-CKKx-sxY.js → index-qDfBJZD7.js} +1 -1
  120. package/assets/{index-Daa0ny5M.js → index-r7kjVwFs.js} +1 -1
  121. package/assets/{index-B39oAHib.js → index-rjU6xZd8.js} +1 -1
  122. package/assets/{index-mmQp95p3.js → index-trxbKGTp.js} +1 -1
  123. package/assets/{index.es-DmMpOWQ3.js → index.es-BKhU-mgO.js} +1 -1
  124. package/assets/{index.es-CzPV8SvV.js → index.es-DvYEMDdQ.js} +4 -4
  125. package/assets/{index.es-4BADL1wA.js → index.es-magZDVqq.js} +1 -1
  126. package/assets/invite-BfwIhP2C.webp +0 -0
  127. package/assets/{localBatchGatewayRequest-CnnsiZVW.js → localBatchGatewayRequest-CnLOTida.js} +1 -1
  128. package/assets/mana-rate-BpgRIQMS.js +1 -0
  129. package/assets/{networks-B7r9ehKQ.js → networks-BNqJWbtk.js} +1 -1
  130. package/assets/{onramp--n2FS2dI.js → onramp-BYjThZVX.js} +1 -1
  131. package/assets/{openzeppelin-BbXNToq4.js → openzeppelin-Ba3p7TP4.js} +1 -1
  132. package/assets/pack-chest-BX_j84xW.webp +0 -0
  133. package/assets/pack-coins-BDh1ZDbh.webp +0 -0
  134. package/assets/pack-stacks-D-V2jSHW.webp +0 -0
  135. package/assets/packs-backdrop-BcXiUPeP.webp +0 -0
  136. package/assets/{parseNft-BF90Orsn.js → parseNft-CfH76UUp.js} +2 -2
  137. package/assets/{parseSignature-BaWXPhl1.js → parseSignature-CuL9-kIi.js} +1 -1
  138. package/assets/{parseSignature-WOPJhKuP.js → parseSignature-D3qKk3uH.js} +3 -3
  139. package/assets/{passkeys-CkuCBuiV.js → passkeys-DPVQjClK.js} +1 -1
  140. package/assets/{pay-with-exchange-uDtQzLx-.js → pay-with-exchange-MNFdDdCT.js} +1 -1
  141. package/assets/{qr-overlay-BEtM3LtR.js → qr-overlay-DDDT3Q-c.js} +1 -1
  142. package/assets/{receive-DeKeGYSl.js → receive-BU9aVDlN.js} +1 -1
  143. package/assets/{resolveImplementation-C9MSE3Ke.js → resolveImplementation-OjvLy3T5.js} +1 -1
  144. package/assets/{rpc-BvqgbCLc.js → rpc-DjbYCcnH.js} +1 -1
  145. package/assets/{secp256k1-Dr3qxILc.js → secp256k1-Cz5kqQCg.js} +1 -1
  146. package/assets/{secp256k1-C8vAuzgh.js → secp256k1-X13vDEXt.js} +1 -1
  147. package/assets/{secp256k1-BzX_Tu6g.js → secp256k1-w4Bql-wA.js} +1 -1
  148. package/assets/{send-batch-transaction-BuyyUQwP.js → send-batch-transaction-Dxt9X3nj.js} +1 -1
  149. package/assets/{send-eip712-transaction-q9T6NkCK.js → send-eip712-transaction-DaAvg9MZ.js} +2 -2
  150. package/assets/{send-gasless-transaction-qGeRIUzg.js → send-gasless-transaction-BquzQGsb.js} +2 -2
  151. package/assets/{send-DwfQbeLz.js → send-oOaeKGnc.js} +1 -1
  152. package/assets/{send-transaction-au-YwQq3.js → send-transaction-BHdPLXiu.js} +2 -2
  153. package/assets/sendMetaTransaction-DNedK3Cr.js +1 -0
  154. package/assets/{sendRawTransaction-CfnlIDvI.js → sendRawTransaction-DUzMWVdQ.js} +3 -3
  155. package/assets/{serializeTransaction-DfOWev7O.js → serializeTransaction-BfDfoMJJ.js} +1 -1
  156. package/assets/{session-proposal-DlrzMPU6.js → session-proposal-CuVqfqoo.js} +1 -1
  157. package/assets/{session-request-CWIXGzBr.js → session-request-CKwxSrqb.js} +2 -2
  158. package/assets/{signing-Blgmj-ki.js → signing-BjyyWrkp.js} +3 -3
  159. package/assets/{socials-B995t4YH.js → socials-pvmMMGV3.js} +1 -1
  160. package/assets/{swaps-Clq_Nmgr.js → swaps-padIwW3Y.js} +1 -1
  161. package/assets/{thirdweb-ivD78gRL.js → thirdweb-kveVeUIA.js} +3 -3
  162. package/assets/{to-serializable-transaction-DaB5jIxe.js → to-serializable-transaction-108u7zPg.js} +2 -2
  163. package/assets/trade-encoding-DcECym8l.js +1 -0
  164. package/assets/{transactionReceipt-CLWilq6h.js → transactionReceipt-Bs-2Cglz.js} +1 -1
  165. package/assets/{transactions-BpphjA60.js → transactions-dcat6MM1.js} +1 -1
  166. package/assets/useCreditPacks-BAZLy3JX.js +1 -0
  167. package/assets/{useInfiniteGrid-CD-N77Cs.js → useInfiniteGrid-BBNOO0mR.js} +1 -1
  168. package/assets/useManaRate-CGtpZZBQ.js +1 -0
  169. package/assets/{useStore-BLu1YQjn.js → useStore-Bo6L1SFA.js} +1 -1
  170. package/assets/useTheme-CQjQJ5Is.js +1 -0
  171. package/assets/{verifyHash-DRTDPueY.js → verifyHash-BfupbUWA.js} +1 -1
  172. package/assets/{w3m-modal-CyjbWChP.js → w3m-modal-C2yr-A_-.js} +1 -1
  173. package/assets/{w3m-modal-BWS5cBnY.js → w3m-modal-CdtZ4EYL.js} +1 -1
  174. package/assets/{wait-for-tx-receipt-Dwbw_tfy.js → wait-for-tx-receipt-BBOv1oQx.js} +1 -1
  175. package/assets/{wallets-SowU94TA.js → wallets-CcitqMTg.js} +5 -5
  176. package/assets/{web-connector-BQYnWq2A.js → web-connector-BLbBOK88.js} +3 -3
  177. package/assets/world-B-9aPlxu.webp +0 -0
  178. package/assets/{writeContract-BQBB6IQD.js → writeContract-Cke2dgme.js} +1 -1
  179. package/assets/{zoraTestnet-AkjTySo9.js → zoraTestnet-NeGGigN-.js} +1 -1
  180. package/index.html +11 -11
  181. package/package.json +2 -2
  182. package/assets/Activity-zOdV7zID.js +0 -284
  183. package/assets/Assets-BsWk8z8u.js +0 -758
  184. package/assets/Authorizations-WRwO7XIX.js +0 -175
  185. package/assets/Cart-BB2vUnjZ.js +0 -3
  186. package/assets/Cart-BaVkpmjN.css +0 -1
  187. package/assets/CollectionCarousel-c7FA9ke_.js +0 -1
  188. package/assets/GetCredits-DKFHGw4S.js +0 -1
  189. package/assets/ImportListings-Dx8BzO4r.css +0 -1
  190. package/assets/ItemDetail-BFcnjOnk.js +0 -1762
  191. package/assets/MyFavorites-CDL0dF1c.js +0 -3
  192. package/assets/NotificationsBell-B39tpkNG.js +0 -34
  193. package/assets/TradeService-BS4tPzcI.js +0 -1
  194. package/assets/authorizations-DWHCeP7j.js +0 -1
  195. package/assets/buy-B0Piwjmq.js +0 -1
  196. package/assets/buy-gasless-pPTI8u_1.js +0 -1
  197. package/assets/categories-_8oO8Yih.css +0 -1
  198. package/assets/index-B4tgQVEu.js +0 -312
  199. package/assets/index-CuyaFbh3.js +0 -4
  200. package/assets/index-CvuJSryR.js +0 -2
  201. package/assets/index-D3DtvRSj.css +0 -1
  202. package/assets/index-HN6Rk25C.js +0 -1
  203. package/assets/mana-rate-B-Ghbv7a.js +0 -1
  204. package/assets/pack-chips--HnOpf5U.webp +0 -0
  205. package/assets/sendMetaTransaction-CiO3jI6F.js +0 -1
  206. package/assets/trade-encoding-BCN0X2W3.js +0 -1
  207. package/assets/useCreditPacks-CnlSkvVM.js +0 -1
  208. package/assets/useManaRate-Ctm7UARH.js +0 -1
  209. package/assets/useTheme-RtXSDv_5.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as e,r as j,u as pa,a as _a,L as te}from"./react-BW1xvPTF.js";import{t,C as L,A as G,ak as ga,x as ba,ai as P,Q as Ue,u as va,n as fa,a as xa,b as Ca,al as ja,am as ka,I as A,an as Na,z as wa,y as Ma,ao as Oe,j as W,ap as $e,aq as Sa,J as O,e as qa,h as Ve,c as pe,ar as _e,l as se,k as De,o as ne,q as Pa,r as ge,m as Ge,as as Aa}from"./index-BFPNYe8x.js";import{P as Ye,m as Xe,W as Ia,c as be,t as Ka,C as Qa,A as Ra,a as Ta,s as He,b as Fa,d as Ea,e as Wa}from"./CollectionCarousel-DEYFBykF.js";import{u as La}from"./useManaRate-CGtpZZBQ.js";import{u as Je,r as Ba}from"./mana-rate-BpgRIQMS.js";import{g as za,j as Ua,h as Oa,n as $a,i as Va,A as Da}from"./authorizations-t9AL68YM.js";import{a as ve}from"./buy-84sizoxr.js";import{a as Ga,w as Ha,S as Ja,G as Ya}from"./buy-gasless-oF_YJX_W.js";import{R as re,r as Xa}from"./cart-checkout-K77UDHy3.js";import{u as Za,M as et,c as at}from"./useCreditPacks-BAZLy3JX.js";import{l as tt}from"./loader-logo-BzY9EKdC.js";import{i as st,a as nt}from"./errors-D-hio89k.js";import{E as rt}from"./ErrorNotice-BG40E5Ff.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-DcECym8l.js";import"./sendMetaTransaction-DNedK3Cr.js";const it="https://cdn.decentraland.org/@dcl/shop/0.1.0-30277401547.commit-e877307/assets/buy-error-22UunaPC.png";function ct(i){const{phase:o,balanceCredits:C,onClose:N}=i,I=o==="processing",R=o==="error"?t("cartCheckout.errorTitle"):o==="nofunds"?t("cartCheckout.titleNoFunds"):o==="choose"?t("buyModal.choosePayment"):t("cartCheckout.titleBuy"),T=o==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":t("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:I?void 0:N,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${T?" 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:R}),!I&&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:o==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(L,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:G(C)})]})]}),o==="choose"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"cart-checkout__choose-total",children:[e.jsx("span",{children:t("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(L,{className:"buy-modal__balance-ico"}),G(i.totalCredits??0)]})]}),e.jsx(Ye,{options:i.options??[],totalCents:i.totalCents??0,onPay:i.onPay??(()=>{}),rateNote:(()=>{const M=Xe(i.totalCents??0,i.totalManaWei??0n);return M!=null?t("buyModal.manaRate",{mana:M.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),o==="processing"&&e.jsx(ot,{stage:i.stage??"reserving",step:i.step??1,total:i.total??1,isSelfCustody:!!i.isSelfCustody}),o==="nofunds"&&e.jsx(lt,{lines:i.lines??[],shortfallCredits:i.shortfallCredits??0,packs:i.packs??[],selectedPack:i.selectedPack??"",onSelectPack:i.onSelectPack??(()=>{}),onBuyPacks:i.onBuyPacks??(()=>{}),onCancel:N}),o==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:it,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:t("cartCheckout.errorHeadline")})," ",t("cartCheckout.errorBody")]})]}),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--purple",onClick:i.onRetry??N,children:t("cartCheckout.tryAgain")})]})]})]})]})}function ot({stage:i,step:o,total:C,isSelfCustody:N}){const I=i==="reserving",R=C>0?Math.min(100,Math.round(o/C*100)):0,T=i==="awaiting-signature"?N?t("buyModal.confirmToContinue"):t("buyModal.completingTransaction"):i==="settling"?t("buyModal.completingTransaction"):t("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:tt,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:T}),I?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:`${R}%`}})}),C>1?e.jsxs("span",{className:"cart-checkout__step",children:[o,"/",C]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function lt({lines:i,shortfallCredits:o,packs:C,selectedPack:N,onSelectPack:I,onBuyPacks:R,onCancel:T}){const M=C.find(n=>n.id===N),ce=i.reduce((n,q)=>n+(q.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(Ia,{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,o)})})," ",t("buyModal.warningToPurchase",{count:ce})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:i.map(n=>{const q=n.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:n.item.thumbnail?e.jsx("img",{src:n.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:n.item.name,children:[n.item.name||t("buyModal.itemFallback"),q>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:t("cartCheckout.qty",{count:q})}):null]}),n.item.creator?e.jsx(ga,{address:n.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(L,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:G(n.priceCredits*q)})]})]})]},n.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:C.map(n=>{const q=n.id===N;return e.jsxs("button",{className:`buy-modal__pack${q?" buy-modal__pack--on":""}`,onClick:()=>I(n.id),children:[e.jsx(L,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:G(n.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(L,{className:"buy-modal__total-ico"}),e.jsx("span",{children:G((M==null?void 0:M.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((M==null?void 0:M.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:T,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:R,children:t("buyModal.buy")})]})]})}function fe(i){if(st(i))return t("errors.rejected");const o=(i.message??"").toLowerCase();return o.includes("insufficient")?t("cart.error.insufficient",{currency:qa.name}):o.includes("no active listing")||o.includes("your own listing")?t("cart.error.listingChanged"):t("marketCheckout.error.generic")}const dt=12e4;function ut(i){const o=[];return i.unavailable.length&&o.push(t("cart.drop.unavailable",{count:i.unavailable.length})),i.own.length&&o.push(t("cart.drop.own",{count:i.own.length})),t("cart.drop.removed",{items:o.join(` ${t("cart.drop.and")} `)})}const xe=i=>i.reduce((o,C)=>o+C.priceCredits*C.quantity,0),ie=i=>i.flatMap(o=>Array.from({length:o.quantity},()=>({...o,quantity:1})));function At(){ba({title:t("nav.cart"),noindex:!0});const i=P(a=>a.items),o=P(a=>a.remove),C=P(a=>a.increment),N=P(a=>a.decrement),I=P(a=>a.clear),R=P(a=>a.restore),T=P(a=>a.setFittingOpen),M=Ue(a=>a.items),ce=Ue(a=>a.toggle),{session:n,signIn:q}=va(),H=Za().packs.slice(0,et);j.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const Ze=i.some(a=>a.category!=="emote"),{data:oe}=fa({queryKey:["upsell-listings"],queryFn:()=>Aa({first:40}),staleTime:6e4}),{data:v}=xa(n),d=Ca(),B=pa(),{state:F}=_a(),[ea,$]=j.useState(null),[Ce,J]=j.useState(null),[aa,S]=j.useState(!1),[w,E]=j.useState(null),je=j.useRef(0),[h,g]=j.useState(null),{data:V}=ja(n),{data:le}=La(!0),[de,ke]=j.useState(""),D=j.useRef(null),Ne=ka(i),we=a=>Oe(Ne[a.id]),ue=i.filter(we),he=i.length>0&&ue.length===0,ta=ue.reduce((a,s)=>a+s.priceCredits*s.quantity,0),sa=i.reduce((a,s)=>a+s.quantity,0),na=ue.reduce((a,s)=>a+s.quantity,0),Me=w?w.liveTotalCredits:ta,ra=new Set(i.map(a=>a.id)),Se=((oe==null?void 0:oe.items)??[]).filter(a=>!ra.has(a.id)).slice(0,12),ia=new Map(w==null?void 0:w.buyable.map(a=>[a.item.id,a])),Y=(v==null?void 0:v.credits)??0,X=Me*10,qe=le?Je(X,le):0n,Z=be({priceCents:X,priceManaWei:qe,balanceCents:(v==null?void 0:v.balanceCents)??0,manaBalanceWei:V??0n}),Pe=Xe(X,qe),Ae=Pe!=null?t("buyModal.manaRate",{mana:Pe.toLocaleString("en",{maximumFractionDigits:2})}):null,ca=Sa;function ee(a){a(),E(null),J(null),$(null)}function oa(){g(null),S(!1)}function Ie(a){const s=xe(a),c=Math.max(0,s-Y),r=H.find(l=>l.credits>=c)??H[H.length-1];ke(r.id),W("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:s,credits_balance:Y,shortfall:c}),g({phase:"nofunds",lines:a.map(l=>({item:l.item,priceCredits:l.priceCredits,quantity:l.quantity})),shortfall:c}),S(!1)}async function me(a){if(!n||a.length===0)return;const s=ie(a),c=s.map(y=>({...y.item,priceCredits:y.priceCredits})),r=a.map(y=>({...y.item,priceCredits:y.priceCredits,quantity:y.quantity})),l=[];let u="authorize",p=!1;g({phase:"processing",stage:"reserving",step:1,total:s.length});try{const y=[];for(let x=0;x<s.length;x++){const b=s[x];g({phase:"processing",stage:"reserving",step:x+1,total:s.length});try{const{credit:f,maxCreditedValue:U}=await Ve(n.identity,b.usdCents,b.trade.id);l.push(f.id),y.push({trade:b.trade,credits:[f],maxCreditedValue:U})}catch(f){if(nt(f)){if(l.length){try{await pe(n.identity,l)}catch(U){O(U,{flow:"cart_checkout",step:"release"})}d.invalidateQueries({queryKey:["usd-balance"]})}Ie(a);return}throw f}}u="submit";const k=()=>g({phase:"processing",stage:"settling",step:s.length,total:s.length});g({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});let _=[];if(za())try{_=await Ga({purchases:y,buyer:n.address,signer:n.signer,onSigned:k});const b=(await Promise.allSettled(_.map(f=>Ha(f)))).flatMap(f=>f.status==="rejected"?[f.reason]:[]);if(b.length&&!b.some(f=>f instanceof Ja))throw b[0];p=!0}catch(x){if(!(x instanceof Ya))throw x;_=await ve({purchases:y,buyer:n.address,signer:n.signer,onSigned:k})}else _=await ve({purchases:y,buyer:n.address,signer:n.signer});a.forEach(x=>o(x.item.id)),E(null),W("Shop Completed Purchase",{..._e(c),payment_type:"credits",no_crypto_step:p,transaction_hash:_[0]??null}),d.invalidateQueries({queryKey:["usd-balance"]}),d.invalidateQueries({queryKey:["detail-trade"]}),d.invalidateQueries({queryKey:["shop-item"]}),d.invalidateQueries({queryKey:["owned-token"]}),d.invalidateQueries({queryKey:["public-token"]}),d.invalidateQueries({queryKey:["item-resales"]}),d.invalidateQueries({queryKey:["shop-items"]}),d.invalidateQueries({queryKey:["catalog-items"]}),d.invalidateQueries({queryKey:["my-assets"]}),d.invalidateQueries({queryKey:["purchases"]}),d.invalidateQueries({queryKey:["owned-item-count"]}),d.invalidateQueries({queryKey:["overview-listings"]}),d.invalidateQueries({queryKey:["upsell-listings"]});const m=D.current;D.current=null,g(null),S(!1);const Q={items:r,txHash:_[0]??void 0,settled:!0,...m?{creditsAdded:m}:{}};B("/success",{state:Q,replace:!0})}catch(y){if(se(y)||O(y,{flow:"cart_checkout",step:u,cart_size:a.length}),W(se(y)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:u,error_code:De(y),value_usd:$e(c.reduce((k,_)=>k+_.priceCredits,0)),cart_size:s.length}),l.length){try{await pe(n.identity,l)}catch(k){O(k,{flow:"cart_checkout",step:"release"})}d.invalidateQueries({queryKey:["usd-balance"]})}g({phase:"error",message:fe(y)})}}function Ke(a,s){d.invalidateQueries({queryKey:["usd-balance"]}),d.invalidateQueries({queryKey:["detail-trade"]}),d.invalidateQueries({queryKey:["shop-item"]}),d.invalidateQueries({queryKey:["owned-token"]}),d.invalidateQueries({queryKey:["public-token"]}),d.invalidateQueries({queryKey:["item-resales"]}),d.invalidateQueries({queryKey:["shop-items"]}),d.invalidateQueries({queryKey:["catalog-items"]}),d.invalidateQueries({queryKey:["my-assets"]}),d.invalidateQueries({queryKey:["purchases"]}),d.invalidateQueries({queryKey:["owned-item-count"]}),d.invalidateQueries({queryKey:["overview-listings"]}),d.invalidateQueries({queryKey:["upsell-listings"]});const c=D.current;D.current=null,g(null),S(!1);const r={items:a,txHash:s[0]??void 0,settled:!0,...c?{creditsAdded:c}:{}};B("/success",{state:r,replace:!0})}function Qe(a,s){se(a)||O(a,{flow:s,step:"submit"}),W(se(a)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:De(a)}),g({phase:"error",message:fe(a)}),S(!1)}async function la(a,s){const c=ne(ge.MANAToken,s),r=ne(ge.CreditsManager,s);await Va({auth:{kind:Da.Allowance,contractAddress:c.address,spenderAddress:r.address,chainId:s},signer:a})}async function da(a){const s=ie(a).reduce((u,p)=>u+p.usdCents,0),c=(V??0n)>0n;let r=le;if(!r&&c)try{r=await d.fetchQuery({queryKey:["mana-rate",Ge.chainId],queryFn:()=>Ba(Ge.chainId),staleTime:6e4})}catch{r=void 0}const l=r?Je(s,r):0n;return{totalCents:s,manaWei:l}}async function Re(a,s){const c=xe(a),{totalCents:r,manaWei:l}=await da(a),u=be({priceCents:r,priceManaWei:l,balanceCents:(v==null?void 0:v.balanceCents)??0,manaBalanceWei:V??0n});if(s&&u.options.some(p=>p.method===s)){if(s==="credits"){me(a);return}const{spender:p,chainId:y}=Te(s,a);await Fe(p,y,()=>s==="mana"?void Ee(a):void We(a,r,l));return}if(u.options.some(p=>p.method==="mana"||p.method==="combined")){g({phase:"choose",lines:a,totalCents:r,manaWei:l}),S(!1);return}if(v!=null&&v.credits<c){Ie(a);return}me(a)}function ua(a){return be({priceCents:a.totalCents,priceManaWei:a.manaWei,balanceCents:(v==null?void 0:v.balanceCents)??0,manaBalanceWei:V??0n})}const[ye,ae]=j.useState(null);function Te(a,s){const c=s[0].trade;return{spender:a==="mana"?ne(Pa(c.contract),c.chainId).address:ne(ge.CreditsManager,c.chainId).address,chainId:c.chainId}}async function Fe(a,s,c){const r=Ua(s,a),l=n?await Oa(r,n.address).catch(()=>!0):!0;if($a(n==null?void 0:n.providerType,l)){S(!1),ae({auth:r,run:c});return}c()}function ha(a){if((h==null?void 0:h.phase)!=="choose")return;const{lines:s,totalCents:c,manaWei:r}=h;if(a==="credits"){me(s);return}const{spender:l,chainId:u}=Te(a,s);Fe(l,u,()=>a==="mana"?void Ee(s):void We(s,c,r))}async function Ee(a){if(!n||a.length===0)return;const s=ie(a),c=s.map(u=>({...u.item,priceCredits:u.priceCredits})),r=a.map(u=>({...u.item,priceCredits:u.priceCredits,quantity:u.quantity})),l=()=>g({phase:"processing",stage:"settling",step:s.length,total:s.length});g({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});try{const u=await Fa({trades:s.map(p=>p.trade),buyer:n.address,signer:n.signer,onSigned:l});a.forEach(p=>o(p.item.id)),E(null),W("Shop Completed Purchase",{..._e(c),payment_type:"mana",transaction_hash:u[0]??null}),d.invalidateQueries({queryKey:["mana-balance"]}),Ke(r,u)}catch(u){Qe(u,"buy_cart_mana")}}async function We(a,s,c){if(!n||a.length===0)return;const r=ie(a),l=r.map(m=>({...m.item,priceCredits:m.priceCredits})),u=a.map(m=>({...m.item,priceCredits:m.priceCredits,quantity:m.quantity})),p=Ea(r.map(m=>m.usdCents),(v==null?void 0:v.balanceCents)??0),y=p.reduce((m,Q)=>m+Q,0),k=Wa(Math.max(0,s-y),s,c),_=[];g({phase:"processing",stage:"reserving",step:1,total:r.length});try{const m=[];for(let b=0;b<r.length;b++){const f=p[b];if(f<=0)continue;g({phase:"processing",stage:"reserving",step:b+1,total:r.length});const{credit:U,maxCreditedValue:ya}=await Ve(n.identity,f,r[b].trade.id);_.push(U.id),m.push({trade:r[b].trade,credits:[U],maxCreditedValue:ya})}r.forEach((b,f)=>{p[f]<=0&&m.push({trade:b.trade,credits:[],maxCreditedValue:"0"})}),m[0]={...m[0],maxCreditedValue:(BigInt(m[0].maxCreditedValue)+k).toString()},await la(n.signer,r[0].trade.chainId);const Q=()=>g({phase:"processing",stage:"settling",step:r.length,total:r.length});g({phase:"processing",stage:"awaiting-signature",step:r.length,total:r.length});const x=await ve({purchases:m,buyer:n.address,signer:n.signer,onSigned:Q});a.forEach(b=>o(b.item.id)),E(null),W("Shop Completed Purchase",{..._e(l),payment_type:"credits_and_mana",transaction_hash:x[0]??null}),d.invalidateQueries({queryKey:["mana-balance"]}),Ke(u,x)}catch(m){_.length&&(pe(n.identity,_).catch(()=>{}),d.invalidateQueries({queryKey:["usd-balance"]})),Qe(m,"buy_cart_combined")}}async function z(a){if(!n){He({type:"cart-checkout"}),q();return}const s=P.getState().items.filter(we);if(s.length===0)return;$(null),J(null),S(!0);const c=s.reduce((r,l)=>r+l.priceCredits*l.quantity,0);W("Shop Started Checkout",{cart_size:s.length,cart_value_credits:c,cart_value_usd:$e(c),has_sufficient_credits:Y>=c});try{const r=await Xa(s,n.address,ca),l=[...r.unavailable,...r.own];if(l.length&&(l.forEach(u=>o(u.id)),J(ut(r))),r.buyable.length===0){$(t("cart.error.noneAvailable")),E(null);return}if(r.orderChanged){E(r),je.current=Date.now();return}await Re(r.buyable,a)}catch(r){O(r,{flow:"cart_checkout",step:"review",cart_size:s.length}),$(fe(r))}finally{S(!1)}}async function Le(){if(w){if(!n){He({type:"cart-checkout"}),q();return}if(Date.now()-je.current>dt){E(null),J(null),await z();return}$(null),Re(w.buyable)}}async function ma(){if(de){try{sessionStorage.setItem(re,JSON.stringify(P.getState().items))}catch{}S(!0);try{const a=await at(de,n?{address:n.address,identity:n.identity}:void 0);if(a.url){window.location.href=a.url;return}B("/credits")}catch(a){try{sessionStorage.removeItem(re)}catch{}O(a,{flow:"cart_buy_credits"}),g({phase:"error",message:t("buyModal.error.creditsCheckout")})}finally{S(!1)}}}const Be=j.useRef(!1);j.useEffect(()=>{if(!n||Be.current||!Ka("cart-checkout"))return;Be.current=!0;const a=setTimeout(()=>void z(),0);return()=>clearTimeout(a)},[n]);const ze=j.useRef(!1);j.useEffect(()=>{if(!(F!=null&&F.resumeCheckout)||ze.current)return;ze.current=!0,D.current=F.creditsAdded??null;try{const s=sessionStorage.getItem(re);if(s){sessionStorage.removeItem(re);const c=JSON.parse(s);Array.isArray(c)&&c.length&&R(c)}}catch{}d.invalidateQueries({queryKey:["usd-balance"]});const a=setTimeout(()=>void z(),0);return()=>clearTimeout(a)},[F==null?void 0:F.resumeCheckout]);const K=aa||(h==null?void 0:h.phase)==="processing";return i.length===0&&!h?e.jsx("div",{className:"checkout checkout--empty",children:e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>B(-1),type:"button",children:[e.jsx(A,{name:"arrow-left"}),t("nav.cart")]}),e.jsxs("section",{className:"checkout__panel cart-empty","data-testid":"cart-empty",children:[e.jsx(A,{name:"cart-plus",size:110,className:"cart-empty__icon"}),e.jsxs("div",{className:"cart-empty__text",children:[e.jsx("p",{className:"cart-empty__title",children:t("cart.empty.title")}),e.jsx("p",{className:"cart-empty__body",children:t("cart.empty.body")})]}),e.jsx(te,{className:"cart-empty__cta",to:"/assets",children:t("cart.empty.cta")})]})]})}):e.jsxs("div",{className:"checkout",children:[e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>B(-1),type:"button",children:[e.jsx(A,{name:"arrow-left"}),t("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:()=>B(-1),type:"button","aria-label":t("cart.goBack"),children:e.jsx(A,{name:"arrow-left"})}),e.jsx("h1",{className:"checkout__panel-title",children:t("cart.panelTitle",{count:sa})}),Ze?e.jsxs("button",{className:"checkout__fitting",onClick:()=>T(!0),disabled:K,children:[e.jsx(A,{name:"fitting-room"}),t("cart.fittingRoom")]}):null]}),e.jsxs("section",{className:"checkout__panel",children:[e.jsx("div",{className:"checkout__list",children:i.map(a=>{const s=ia.get(a.id),c=s?s.priceCredits:a.priceCredits,r=!!s&&s.priceCredits!==a.priceCredits,l=!a.tokenId,u=a.quantity,p=typeof a.available=="number"&&u>=a.available,y=c*u,k=!!M[a.id],_=Na(a),m=Ne[a.id],Q=!Oe(m),x=m==="sold-out"?t("cart.availability.soldOut"):t("cart.availability.unavailable");return e.jsxs("div",{className:`checkout__card${Q?" is-unavailable":""}`,children:[e.jsxs("div",{className:"checkout__thumb",children:[_?e.jsx(te,{className:"checkout__thumb-link",to:_,state:{item:a,tradeId:a.tradeId},"aria-label":a.name,children:a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:a.name}):null}):a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:a.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:[_?e.jsx(te,{className:"checkout__name",to:_,state:{item:a,tradeId:a.tradeId},title:a.name,children:a.name}):e.jsx("div",{className:"checkout__name",title:a.name,children:a.name}),a.creator?e.jsx(wa,{address:a.creator,className:"checkout__creator",linkToProfile:!0}):null,l?e.jsxs("span",{className:"checkout__creator-tag","data-testid":"cart-creator-tag",children:[e.jsx(A,{name:"buy-from-creator",className:"checkout__creator-tag-ico","aria-hidden":!0}),t("cart.creatorTag")]}):null]}),e.jsx("div",{className:"checkout__foot",children:Q?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"checkout__unavailable",children:[e.jsx(A,{name:"warning-fill",size:24,className:"checkout__warn","aria-hidden":!0}),x]}),_?e.jsx(te,{className:"checkout__resales",to:_,state:{item:a,tradeId:a.tradeId},children:t("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[l?e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>ee(()=>N(a.id)),disabled:K||u<=1,"aria-label":t("cart.decreaseQuantity",{name:a.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:u}),e.jsx("button",{className:"checkout__step",onClick:()=>ee(()=>C(a.id)),disabled:K||p,"aria-label":t("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(L,{className:"checkout__price-ico"})," ",y,r?e.jsx("span",{className:"checkout__price-was",children:a.priceCredits*u}):null]})]})})]}),e.jsxs("div",{className:"checkout__actions",children:[e.jsx("button",{className:`checkout__fav${k?" is-on":""}`,onClick:()=>ce(a),"aria-label":k?t("cart.removeFromFavorites",{name:a.name}):t("cart.addToFavorites",{name:a.name}),title:k?t("assetCard.removeFromFavorites"):t("assetCard.addToFavorites"),children:e.jsx(A,{name:k?"heart-solid":"heart"})}),e.jsx("button",{className:"checkout__remove",onClick:()=>ee(()=>o(a.id)),disabled:K,"aria-label":t("cart.remove",{name:a.name}),title:t("cart.removeTitle"),children:e.jsx(A,{name:"trash",size:24})})]})]},a.id)})}),e.jsx("div",{className:"checkout__utils",children:e.jsx("button",{className:"link",onClick:()=>ee(I),disabled:K,children:t("cart.clearCart")})})]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:t("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:t("cart.totalItems",{count:na})}),e.jsxs("span",{className:"checkout__total-side",children:[e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(L,{className:"checkout__total-ico"})," ",Me]}),Ae&&(V??0n)>0n?e.jsx("span",{className:"checkout__total-rate","data-testid":"cart-mana-rate",children:Ae}):null]})]}),Z.options.length>0||Z.manaShortfall?e.jsx(Ye,{options:Z.options,totalCents:X,shortfall:Z.manaShortfall,creditsLabel:w?t("marketCheckout.confirmPurchase"):t("cart.buyWithCredits"),busy:K||he,onPay:a=>void(w?Le():z(a))}):e.jsx("button",{className:"checkout__cta",onClick:()=>void(w?Le():z()),disabled:K||he,children:K?t("cart.working"):w?t("marketCheckout.confirmPurchase"):t("assetCard.buyNow")}),he?e.jsx("p",{className:"muted checkout__msg",children:t("cart.allUnavailable")}):null,n?null:e.jsx("p",{className:"muted checkout__msg",children:t("cart.signInHint")}),w?e.jsx("p",{className:"muted checkout__msg",children:t("cart.priceChanged")}):null,Ce?e.jsx("p",{className:"muted checkout__msg",children:Ce}):null,e.jsx(rt,{message:ea,className:"checkout__msg"})]})]})]})]}),Se.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(Qa,{title:t("cart.youMightAlsoLike"),items:Se})}):null,ye&&n?e.jsx(Ra,{auth:ye.auth,signer:n.signer,title:t("authorizeStep.manaTitle"),name:t("authorizeStep.manaName"),reason:t("authorizeStep.manaReason"),icon:e.jsx("img",{src:Ta,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:a}=ye;ae(null),a()},onCancel:()=>ae(null),onClose:()=>ae(null)}):null,h?e.jsx(ct,{phase:h.phase,balanceCredits:Y,onClose:oa,stage:h.phase==="processing"?h.stage:void 0,step:h.phase==="processing"?h.step:void 0,total:h.phase==="processing"?h.total:void 0,isSelfCustody:Ma(n==null?void 0:n.providerType),options:h.phase==="choose"?ua(h).options:void 0,onPay:ha,totalCents:h.phase==="choose"?h.totalCents:void 0,totalManaWei:h.phase==="choose"?h.manaWei:void 0,totalCredits:h.phase==="choose"?xe(h.lines):void 0,lines:h.phase==="nofunds"?h.lines:void 0,shortfallCredits:h.phase==="nofunds"?h.shortfall:void 0,packs:H,selectedPack:de,onSelectPack:ke,onBuyPacks:()=>void ma(),message:h.phase==="error"?h.message:void 0,onRetry:()=>void z()}):null]})}export{At as Cart};
@@ -1,4 +1,4 @@
1
- import{Q as N,R as U,S as w,U as z,V as o,W as E,X as c,Y as I,Z as g,$ as D,O as R}from"./index-B4tgQVEu.js";import{r as W,j as v}from"./react-BW1xvPTF.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=R(P||(P=l`
1
+ import{V as N,W as U,X as w,Y as z,Z as o,$ as E,a0 as c,a1 as I,a2 as g,a3 as D,R}from"./index-BFPNYe8x.js";import{r as W,j as v}from"./react-BW1xvPTF.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=R(P||(P=l`
2
2
  0% {
3
3
  transform: rotate(0deg);
4
4
  }
@@ -23,6 +23,6 @@ import{Q as N,R as U,S as w,U as z,V as o,W as E,X as c,Y as I,Z as g,$ as D,O a
23
23
  }
24
24
  `)),B=r=>{const{classes:e,variant:s,color:a,disableShrink:d}=r,u={root:["root",s,`color${c(a)}`],svg:["svg"],circle:["circle",`circle${c(s)}`,d&&"circleDisableShrink"]};return I(u,F,e)},G=g("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(r,e)=>{const{ownerState:s}=r;return[e.root,e[s.variant],e[`color${c(s.color)}`]]}})(({ownerState:r,theme:e})=>o({display:"inline-block"},r.variant==="determinate"&&{transition:e.transitions.create("transform")},r.color!=="inherit"&&{color:(e.vars||e).palette[r.color].main}),({ownerState:r})=>r.variant==="indeterminate"&&D(b||(b=l`
25
25
  animation: ${0} 1.4s linear infinite;
26
- `),V)),L=g("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(r,e)=>e.svg})({display:"block"}),O=g("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(r,e)=>{const{ownerState:s}=r;return[e.circle,e[`circle${c(s.variant)}`],s.disableShrink&&e.circleDisableShrink]}})(({ownerState:r,theme:e})=>o({stroke:"currentColor"},r.variant==="determinate"&&{transition:e.transitions.create("stroke-dashoffset")},r.variant==="indeterminate"&&{strokeDasharray:"80px, 200px",strokeDashoffset:0}),({ownerState:r})=>r.variant==="indeterminate"&&!r.disableShrink&&D($||($=l`
26
+ `),V)),L=g("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(r,e)=>e.svg})({display:"block"}),X=g("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(r,e)=>{const{ownerState:s}=r;return[e.circle,e[`circle${c(s.variant)}`],s.disableShrink&&e.circleDisableShrink]}})(({ownerState:r,theme:e})=>o({stroke:"currentColor"},r.variant==="determinate"&&{transition:e.transitions.create("stroke-dashoffset")},r.variant==="indeterminate"&&{strokeDasharray:"80px, 200px",strokeDashoffset:0}),({ownerState:r})=>r.variant==="indeterminate"&&!r.disableShrink&&D($||($=l`
27
27
  animation: ${0} 1.4s ease-in-out infinite;
28
- `),Z)),Y=W.forwardRef(function(e,s){const a=w({props:e,name:"MuiCircularProgress"}),{className:d,color:u="primary",disableShrink:M=!1,size:m=40,style:_,thickness:i=3.6,value:p=0,variant:k="indeterminate"}=a,j=z(a,K),n=o({},a,{color:u,disableShrink:M,size:m,thickness:i,value:p,variant:k}),f=B(n),h={},x={},y={};if(k==="determinate"){const C=2*Math.PI*((t-i)/2);h.strokeDasharray=C.toFixed(3),y["aria-valuenow"]=Math.round(p),h.strokeDashoffset=`${((100-p)/100*C).toFixed(3)}px`,x.transform="rotate(-90deg)"}return v.jsx(G,o({className:E(f.root,d),style:o({width:m,height:m},x,_),ownerState:n,ref:s,role:"progressbar"},y,j,{children:v.jsx(L,{className:f.svg,ownerState:n,viewBox:`${t/2} ${t/2} ${t} ${t}`,children:v.jsx(O,{className:f.circle,style:h,ownerState:n,cx:t,cy:t,r:(t-i)/2,fill:"none",strokeWidth:i})})}))});export{Y as C};
28
+ `),Z)),A=W.forwardRef(function(e,s){const a=w({props:e,name:"MuiCircularProgress"}),{className:d,color:u="primary",disableShrink:M=!1,size:m=40,style:_,thickness:i=3.6,value:p=0,variant:k="indeterminate"}=a,j=z(a,K),n=o({},a,{color:u,disableShrink:M,size:m,thickness:i,value:p,variant:k}),f=B(n),h={},x={},y={};if(k==="determinate"){const C=2*Math.PI*((t-i)/2);h.strokeDasharray=C.toFixed(3),y["aria-valuenow"]=Math.round(p),h.strokeDashoffset=`${((100-p)/100*C).toFixed(3)}px`,x.transform="rotate(-90deg)"}return v.jsx(G,o({className:E(f.root,d),style:o({width:m,height:m},x,_),ownerState:n,ref:s,role:"progressbar"},y,j,{children:v.jsx(L,{className:f.svg,ownerState:n,viewBox:`${t/2} ${t/2} ${t} ${t}`,children:v.jsx(X,{className:f.circle,style:h,ownerState:n,cx:t,cy:t,r:(t-i)/2,fill:"none",strokeWidth:i})})}))});export{A as C};
@@ -1,4 +1,4 @@
1
- import{j as e,r as p,d as O,u as Q}from"./react-BW1xvPTF.js";import{J as N,s as v,ar as Y,as as E,I as Z,t,p as V,H as W,o as X,m as ee,A as ae,at as te,e as re,au as se}from"./index-B4tgQVEu.js";import{E as oe}from"./ErrorNotice-BG40E5Ff.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-DOvX-TK6.js";import{u as de}from"./useStore-BLu1YQjn.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-BtWBqb3o.js";import{L as xe}from"./LoadMore-C2IGYfn5.js";import{u as he}from"./useInfiniteGrid-CD-N77Cs.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";const be=v.section`
1
+ import{j as e,r as p,d as O,u as Q}from"./react-BW1xvPTF.js";import{K as N,s as v,ay as Y,az as E,I as Z,t,m as V,J as W,n as X,x as ee,M as ae,aA as te,e as re,aB as se}from"./index-BFPNYe8x.js";import{E as oe}from"./ErrorNotice-BG40E5Ff.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-D7HQMUIe.js";import{u as de}from"./useStore-Bo6L1SFA.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-BwvbYi6M.js";import{L as xe}from"./LoadMore-C2uaqP2N.js";import{u as he}from"./useInfiniteGrid-BBNOO0mR.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.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;
@@ -42,4 +42,4 @@ import{j as e,r as p,d as O,u as Q}from"./react-BW1xvPTF.js";import{J as N,s as
42
42
  padding: 24px 16px;
43
43
  font-size: 26px;
44
44
  }
45
- `;function ye({name:r,creator:a}){const{data:i}=de(a),n=(i==null?void 0:i.cover)||ie;return e.jsxs(be,{"data-testid":"collection-hero","aria-label":r,children:[e.jsxs(ve,{children:[e.jsx(je,{src:n,alt:"",loading:"eager"}),e.jsx(fe,{"aria-hidden":!0})]}),e.jsx(Ne,{"data-testid":"collection-hero-title",children:r})]})}function _e({address:r}){var h,c;const{data:a}=Y(r),[i,n]=p.useState(!1);if(!r)return null;const l=(a==null?void 0:a.name)||E(r),u=(c=(h=a==null?void 0:a.avatar)==null?void 0:h.snapshots)==null?void 0:c.face256,g=`${V.profileUrl}/${r}`,x=ce(ne({name:a==null?void 0:a.name,hasClaimedName:a==null?void 0:a.hasClaimedName,ethAddress:(a==null?void 0:a.ethAddress)??r}));async function d(){try{await navigator.clipboard.writeText(r),n(!0),window.setTimeout(()=>n(!1),1500)}catch(j){W(j,{flow:"copy_creator_address"})}}return e.jsxs("div",{className:"creator-card","data-testid":"creator-card",children:[u?e.jsx("img",{className:"creator-card__ava",src:u,alt:"",loading:"eager",style:{backgroundColor:x}}):e.jsx("span",{className:"creator-card__ava creator-card__ava--ph","aria-hidden":!0,style:{backgroundColor:x}}),e.jsx("h2",{className:"creator-card__name",title:l,children:l}),e.jsxs("button",{type:"button",className:"creator-card__account",onClick:()=>void d(),title:i?t("collection.copied"):t("collection.copyAddress"),"aria-label":i?t("collection.copied"):t("collection.copyAddress"),children:[e.jsx("span",{className:"creator-card__account-text",children:E(r)}),e.jsx(Z,{name:"copy",size:16})]}),e.jsx("a",{className:"creator-card__view","data-testid":"creator-card-view",href:g,target:"_blank",rel:"noopener noreferrer",children:t("collection.viewProfile")})]})}const Ce=48;function Be(){var T;const{contractAddress:r}=O(),a=Q(),[i,n]=p.useState("wearable"),[l,u]=p.useState(null),[g,x]=p.useState([]),[d,h]=p.useState(""),[c,j]=p.useState(""),[_,$]=p.useState("newest"),C=d&&!Number.isNaN(Number(d))?Number(d):void 0,w=c&&!Number.isNaN(Number(c))?Number(c):void 0,I=l?ge[l]:void 0,z=(F.find(s=>s.key===_)??F[0]).server,S={category:i,rarities:g.length?g:void 0,wearableCategories:I,minPriceCredits:C,maxPriceCredits:w,sortBy:z},{items:b,total:B,isLoading:f,error:A,hasNextPage:L,isFetchingNextPage:P,fetchNextPage:U}=he(["collection-page",r,S],s=>te(r,{...S,first:Ce,skip:s}),{enabled:!!r}),{data:o}=X({queryKey:["collection-meta",r],queryFn:()=>se(r),enabled:!!r,staleTime:5*6e4}),k=(o==null?void 0:o.name)||t("collection.fallbackTitle");ee({title:o==null?void 0:o.name,description:o!=null&&o.name?t("seo.collection.description",{name:o.name}):void 0});const M=(o==null?void 0:o.creator)||((T=b[0])==null?void 0:T.creator);function H(s){n(s),u(null)}function q(s){x(m=>m.includes(s)?m.filter(J=>J!==s):[...m,s])}function G(){n("wearable"),u(null),x([]),h(""),j("")}const y=!!(C||w),K=y?`${d||"0"}–${c||"∞"}`:t("filter.price"),D=i!=="wearable"||!!l||g.length>0||y;return e.jsxs("div",{className:"collection-page","data-testid":"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":t("collection.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>a("/assets"),children:t("collection.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:k})]}),e.jsx(ye,{name:k,creator:M}),e.jsxs("div",{className:"browse browse--sidebar collection-page__browse","data-testid":"browse",children:[e.jsxs("aside",{className:"browse__sidebar","data-testid":"browse-sidebar",children:[e.jsx(_e,{address:M}),e.jsx(me,{category:i,subCategory:l,onCategory:H,onSub:u,title:t("collection.category"),flat:!0})]}),e.jsxs("div",{className:"browse__main",children:[!f&&b.length>0?e.jsx(le,{items:b,source:"collection"}):null,e.jsx(pe,{rarities:g,onToggleRarity:q,sort:_,onSort:$,total:B,loading:f,anyActive:D,onClear:G,renderTrailing:s=>e.jsx(ue,{panelKey:"price",label:K,active:y,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":t("collection.priceMin"),placeholder:t("collection.priceMinPlaceholder"),value:d,onChange:m=>h(m.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":t("collection.priceMax"),placeholder:t("collection.priceMaxPlaceholder"),value:c,onChange:m=>j(m.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:t("collection.priceHint",{currency:re.name})})]})})}),A?e.jsx(oe,{message:t("collection.error")}):null,e.jsx("div",{className:"grid","data-testid":"grid",children:f?e.jsx(R,{count:15}):e.jsxs(e.Fragment,{children:[b.map(s=>e.jsx(ae,{item:s},s.id)),P?e.jsx(R,{count:6}):null]})}),e.jsx(xe,{hasNextPage:L,isFetching:P,onLoadMore:()=>void U()}),!f&&!A&&b.length===0?e.jsx("p",{className:"muted",children:t("collection.empty")}):null]})]})]})}export{Be as Collection,Be as default};
45
+ `;function ye({name:r,creator:a}){const{data:i}=de(a),n=(i==null?void 0:i.cover)||ie;return e.jsxs(be,{"data-testid":"collection-hero","aria-label":r,children:[e.jsxs(ve,{children:[e.jsx(je,{src:n,alt:"",loading:"eager"}),e.jsx(fe,{"aria-hidden":!0})]}),e.jsx(Ne,{"data-testid":"collection-hero-title",children:r})]})}function _e({address:r}){var h,c;const{data:a}=Y(r),[i,n]=p.useState(!1);if(!r)return null;const l=(a==null?void 0:a.name)||E(r),u=(c=(h=a==null?void 0:a.avatar)==null?void 0:h.snapshots)==null?void 0:c.face256,g=`${V.profileUrl}/${r}`,x=ce(ne({name:a==null?void 0:a.name,hasClaimedName:a==null?void 0:a.hasClaimedName,ethAddress:(a==null?void 0:a.ethAddress)??r}));async function d(){try{await navigator.clipboard.writeText(r),n(!0),window.setTimeout(()=>n(!1),1500)}catch(j){W(j,{flow:"copy_creator_address"})}}return e.jsxs("div",{className:"creator-card","data-testid":"creator-card",children:[u?e.jsx("img",{className:"creator-card__ava",src:u,alt:"",loading:"eager",style:{backgroundColor:x}}):e.jsx("span",{className:"creator-card__ava creator-card__ava--ph","aria-hidden":!0,style:{backgroundColor:x}}),e.jsx("h2",{className:"creator-card__name",title:l,children:l}),e.jsxs("button",{type:"button",className:"creator-card__account",onClick:()=>void d(),title:i?t("collection.copied"):t("collection.copyAddress"),"aria-label":i?t("collection.copied"):t("collection.copyAddress"),children:[e.jsx("span",{className:"creator-card__account-text",children:E(r)}),e.jsx(Z,{name:"copy",size:16})]}),e.jsx("a",{className:"creator-card__view","data-testid":"creator-card-view",href:g,target:"_blank",rel:"noopener noreferrer",children:t("collection.viewProfile")})]})}const Ce=48;function Ie(){var T;const{contractAddress:r}=O(),a=Q(),[i,n]=p.useState("wearable"),[l,u]=p.useState(null),[g,x]=p.useState([]),[d,h]=p.useState(""),[c,j]=p.useState(""),[_,$]=p.useState("newest"),C=d&&!Number.isNaN(Number(d))?Number(d):void 0,w=c&&!Number.isNaN(Number(c))?Number(c):void 0,z=l?ge[l]:void 0,B=(F.find(s=>s.key===_)??F[0]).server,S={category:i,rarities:g.length?g:void 0,wearableCategories:z,minPriceCredits:C,maxPriceCredits:w,sortBy:B},{items:b,total:I,isLoading:f,error:A,hasNextPage:L,isFetchingNextPage:P,fetchNextPage:U}=he(["collection-page",r,S],s=>te(r,{...S,first:Ce,skip:s}),{enabled:!!r}),{data:o}=X({queryKey:["collection-meta",r],queryFn:()=>se(r),enabled:!!r,staleTime:5*6e4}),k=(o==null?void 0:o.name)||t("collection.fallbackTitle");ee({title:o==null?void 0:o.name,description:o!=null&&o.name?t("seo.collection.description",{name:o.name}):void 0});const M=(o==null?void 0:o.creator)||((T=b[0])==null?void 0:T.creator);function K(s){n(s),u(null)}function q(s){x(m=>m.includes(s)?m.filter(J=>J!==s):[...m,s])}function G(){n("wearable"),u(null),x([]),h(""),j("")}const y=!!(C||w),H=y?`${d||"0"}–${c||"∞"}`:t("filter.price"),D=i!=="wearable"||!!l||g.length>0||y;return e.jsxs("div",{className:"collection-page","data-testid":"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":t("collection.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>a("/assets"),children:t("collection.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:k})]}),e.jsx(ye,{name:k,creator:M}),e.jsxs("div",{className:"browse browse--sidebar collection-page__browse","data-testid":"browse",children:[e.jsxs("aside",{className:"browse__sidebar","data-testid":"browse-sidebar",children:[e.jsx(_e,{address:M}),e.jsx(me,{category:i,subCategory:l,onCategory:K,onSub:u,title:t("collection.category"),flat:!0})]}),e.jsxs("div",{className:"browse__main",children:[!f&&b.length>0?e.jsx(le,{items:b,source:"collection"}):null,e.jsx(pe,{rarities:g,onToggleRarity:q,sort:_,onSort:$,total:I,loading:f,anyActive:D,onClear:G,renderTrailing:s=>e.jsx(ue,{panelKey:"price",label:H,active:y,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":t("collection.priceMin"),placeholder:t("collection.priceMinPlaceholder"),value:d,onChange:m=>h(m.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":t("collection.priceMax"),placeholder:t("collection.priceMaxPlaceholder"),value:c,onChange:m=>j(m.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:t("collection.priceHint",{currency:re.name})})]})})}),A?e.jsx(oe,{message:t("collection.error")}):null,e.jsx("div",{className:"grid","data-testid":"grid",children:f?e.jsx(R,{count:15}):e.jsxs(e.Fragment,{children:[b.map(s=>e.jsx(ae,{item:s},s.id)),P?e.jsx(R,{count:6}):null]})}),e.jsx(xe,{hasNextPage:L,isFetching:P,onLoadMore:()=>void U()}),!f&&!A&&b.length===0?e.jsx("p",{className:"muted",children:t("collection.empty")}):null]})]})]})}export{Ie as Collection,Ie as default};
@@ -0,0 +1,292 @@
1
+ import{j as e,r as w}from"./react-BW1xvPTF.js";import{s as l,K as r,t as m,C as R,A as v,aL as C,e as O,R as U,I as T,J as G,o as $,r as _,q as H,aM as L,M as J}from"./index-BFPNYe8x.js";import{s as K,i as F,A as P,a as B,r as V,m as Y,e as Z}from"./authorizations-t9AL68YM.js";import{i as q}from"./errors-D-hio89k.js";import{E as X}from"./ErrorNotice-BG40E5Ff.js";import{b as Q}from"./buy-84sizoxr.js";import{g as ee,d as te}from"./trade-encoding-DcECym8l.js";import{s as ne,M as ae,E as re}from"./sendMetaTransaction-DNedK3Cr.js";import{I as se,C as oe}from"./ethers-CtVvB8eG.js";const S="shop:resume_after_signin",ie=900*1e3;function Ge(n){try{sessionStorage.setItem(S,JSON.stringify({...n,at:Date.now()}))}catch{}}function He(n){let t;try{t=sessionStorage.getItem(S)}catch{return null}if(!t)return null;try{sessionStorage.removeItem(S)}catch{}let a;try{a=JSON.parse(t)}catch{return null}return!a||a.type!==n||typeof a.at!="number"||Date.now()-a.at>ie?null:a.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:a.path}}function ce(n,t){return(n+t-1n)/t}function le(n,t,a){return n<=0||t<=0?0n:n>=t?a:ce(a*BigInt(n),BigInt(t))}function Je(n){var x,f,y;const t=Number.isFinite(n.priceCents)?Math.max(0,Math.trunc(n.priceCents)):0,a=Number.isFinite(n.balanceCents)?Math.max(0,Math.trunc(n.balanceCents)):0,s=n.priceManaWei>0n?n.priceManaWei:0n,i=n.manaBalanceWei>0n?n.manaBalanceWei:0n;if(t<=0)return{options:[],preferred:null,manaShortfall:null};const o=[];if(a>=t&&o.push({method:"credits",creditsCents:t,manaWei:0n}),s>0n&&a>0&&a<t){const c=t-a,g=le(c,t,s);i>=g&&o.push({method:"combined",creditsCents:a,manaWei:g})}s>0n&&i>=s&&o.push({method:"mana",creditsCents:0,manaWei:s});const d=((x=o.find(c=>c.method==="credits"))==null?void 0:x.method)??((f=o.find(c=>c.method==="combined"))==null?void 0:f.method)??((y=o.find(c=>c.method==="mana"))==null?void 0:y.method)??null,b=!o.some(c=>c.method==="mana"||c.method==="combined")&&s>0n&&i>0n?{manaWei:i,manaCents:de(i,t,s),priceCents:t}:null;return{options:o,preferred:d,manaShortfall:b}}function de(n,t,a){return Number(n*BigInt(t)/a)}function Ke(n,t){let a=Number.isFinite(t)?Math.max(0,Math.trunc(t)):0;return n.map(s=>{const i=Number.isFinite(s)?Math.max(0,Math.trunc(s)):0,o=Math.min(i,a);return a-=o,o})}function k(n){return Number.isFinite(n)?Math.max(0,n)/10:0}function Ve(n,t){return n.options.find(a=>a.method===t)??null}function Ye(n,t){if(!Number.isFinite(n)||n<=0||t<=0n)return null;const a=n/10;return Number(t)/1e18/a}const A="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%201'%3e%3cpath%20id='Vector'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%202L22%2012L12%2022L2%2012L12%202ZM12%204.8L19.2%2012L12%2019.2L4.8%2012L12%204.8ZM12%2015.6C12.9548%2015.6001%2013.8705%2015.2209%2014.5457%2014.5459C15.2209%2013.8708%2015.6003%2012.9552%2015.6004%2012.0004C15.6005%2011.0456%2015.2213%2010.1299%2014.5463%209.45471C13.8712%208.7795%2012.9556%208.40011%2012.0008%208.4C11.0461%208.4%2010.1304%208.77928%209.45525%209.45442C8.78012%2010.1295%208.40083%2011.0452%208.40083%2012C8.40083%2012.9548%208.78012%2013.8705%209.45525%2014.5456C10.1304%2015.2207%2011.0461%2015.6%2012.0008%2015.6H12Z'%20fill='white'/%3e%3cg%20id='Rectangle%201'%3e%3c/g%3e%3c/g%3e%3c/svg%3e",ue=l.div`
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 12px;
5
+ align-items: stretch;
6
+ width: 100%;
7
+ `,D=`
8
+ width: 100%;
9
+ min-height: 56px;
10
+ display: flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ gap: 8px;
14
+ flex-wrap: wrap;
15
+ padding: 0 12px;
16
+ border: 0;
17
+ border-radius: 12px;
18
+ cursor: pointer;
19
+ transition:
20
+ background 0.15s ease,
21
+ filter 0.15s ease;
22
+ font-family: ${r.font.sans};
23
+ font-weight: 600;
24
+ font-size: 15px;
25
+ line-height: 24px;
26
+ letter-spacing: 0.46px;
27
+ text-transform: uppercase;
28
+ color: ${r.colors.softWhite};
29
+
30
+ &:focus-visible {
31
+ outline: 2px solid ${r.colors.accent};
32
+ outline-offset: 2px;
33
+ }
34
+ &:disabled {
35
+ opacity: 0.6;
36
+ cursor: default;
37
+ }
38
+ `,he=l.button`
39
+ ${D}
40
+ background: ${r.gradients.amethyst};
41
+
42
+ &:hover:not(:disabled) {
43
+ filter: brightness(1.08);
44
+ }
45
+ `,W=l.button`
46
+ ${D}
47
+ background: ${r.colors.text2};
48
+
49
+ &:hover:not(:disabled) {
50
+ background: ${r.colors.gray0};
51
+ }
52
+ `,M=l.span`
53
+ display: inline-flex;
54
+ align-items: center;
55
+ gap: 6px;
56
+ text-transform: none;
57
+ letter-spacing: 0;
58
+
59
+ span {
60
+ font-size: 20px;
61
+ font-weight: 600;
62
+ line-height: normal;
63
+ }
64
+ .ico {
65
+ width: 24px;
66
+ height: 24px;
67
+ background: ${r.colors.softWhite};
68
+ }
69
+ `,z=l.span`
70
+ position: relative;
71
+ display: block;
72
+ width: 30px;
73
+ height: 30px;
74
+ flex: none;
75
+
76
+ /* Centred in the slot, not pinned to its top: the slot is taller than the glyph and sits next to a
77
+ vertically centred amount, so a top-pinned mark reads as floating above the number. */
78
+ img {
79
+ position: absolute;
80
+ top: 50%;
81
+ left: 0;
82
+ transform: translateY(-50%);
83
+ width: 24px;
84
+ height: 24px;
85
+ display: block;
86
+ }
87
+ `,pe=l.span`
88
+ font-size: 13px;
89
+ font-weight: 600;
90
+ letter-spacing: 0.02em;
91
+ opacity: 0.85;
92
+ `,me=l.span`
93
+ font-size: 18px;
94
+ font-weight: 600;
95
+ opacity: 0.7;
96
+ `,fe=l.p`
97
+ margin: 0;
98
+ font-family: ${r.font.sans};
99
+ font-weight: 400;
100
+ font-size: 12px;
101
+ line-height: 1;
102
+ color: ${r.colors.muted};
103
+ text-align: center;
104
+ `,xe=l.p`
105
+ margin: -4px 0 0;
106
+ font-family: ${r.font.sans};
107
+ font-weight: 400;
108
+ font-size: 12px;
109
+ line-height: 1.4;
110
+ color: ${r.colors.muted};
111
+ text-align: center;
112
+ `;function Ze({options:n,totalCents:t,onPay:a,busy:s=!1,rateNote:i,creditsLabel:o,shortfall:d}){return e.jsxs(ue,{children:[n.map(u=>u.method==="credits"?e.jsxs(he,{type:"button","data-testid":"pay-with-credits",onClick:()=>a("credits"),disabled:s,children:[e.jsx("span",{children:o??m("buyModal.buy")}),e.jsxs(M,{children:[e.jsx(R,{}),e.jsx("span",{children:v(k(u.creditsCents))})]})]},"credits"):u.method==="mana"?e.jsxs(W,{type:"button","data-testid":"pay-with-mana",onClick:()=>a("mana"),disabled:s,children:[e.jsx("span",{children:m("buyModal.buyWithMana")}),e.jsxs(M,{children:[e.jsx(z,{children:e.jsx("img",{src:A,alt:"","aria-hidden":!0})}),e.jsx("span",{children:C(u.manaWei)})]})]},"mana"):e.jsxs(W,{type:"button","data-testid":"pay-with-combined",onClick:()=>a("combined"),disabled:s,children:[e.jsx("span",{children:m("buyModal.buyWith")}),e.jsxs(M,{children:[e.jsx(R,{}),e.jsx("span",{children:v(k(u.creditsCents))}),e.jsx(me,{children:"+"}),e.jsx(z,{children:e.jsx("img",{src:A,alt:"","aria-hidden":!0})}),e.jsx("span",{children:C(u.manaWei)}),e.jsx(pe,{children:"MANA"})]})]},"combined")),d?e.jsxs(e.Fragment,{children:[e.jsxs(W,{type:"button","data-testid":"pay-with-mana-disabled",disabled:!0,children:[e.jsx("span",{children:m("buyModal.buyWithMana")}),e.jsxs(M,{children:[e.jsx(z,{children:e.jsx("img",{src:A,alt:"","aria-hidden":!0})}),e.jsx("span",{children:C(d.manaWei)})]})]},"mana-short"),e.jsx(xe,{"data-testid":"mana-shortfall-note",children:m("buyModal.manaWorth",{mana:C(d.manaWei),credits:v(k(d.manaCents)),price:v(k(d.priceCents)),currency:O.name})})]}):null,i?e.jsx(fe,{"data-testid":"mana-rate-note",children:i}):null,e.jsx("span",{hidden:!0,"data-testid":"pay-total-cents",children:t})]})}const ge=U`
113
+ to { transform: rotate(360deg); }
114
+ `,be=l.div`
115
+ position: fixed;
116
+ inset: 0;
117
+ z-index: 10000;
118
+ display: flex;
119
+ align-items: center;
120
+ justify-content: center;
121
+ padding: 16px;
122
+ background: rgba(22, 21, 24, 0.55);
123
+ `,ye=l.div`
124
+ width: 480px;
125
+ max-width: 100%;
126
+ max-height: 92vh;
127
+ overflow-y: auto;
128
+ background: ${r.colors.white};
129
+ border-radius: 16px;
130
+ padding: 12px 16px 16px;
131
+ box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
132
+ display: flex;
133
+ flex-direction: column;
134
+ gap: 20px;
135
+ `,we=l.div`
136
+ display: flex;
137
+ align-items: center;
138
+ justify-content: space-between;
139
+ gap: 8px;
140
+ padding-bottom: 16px;
141
+ border-bottom: 1px solid ${r.colors.gray4};
142
+ `,je=l.h2`
143
+ margin: 0;
144
+ font-family: ${r.font.sans};
145
+ font-weight: 600;
146
+ font-size: 20px;
147
+ line-height: 1.6;
148
+ color: ${r.colors.text};
149
+ `,ve=l.button`
150
+ flex: none;
151
+ display: grid;
152
+ place-items: center;
153
+ width: 24px;
154
+ height: 24px;
155
+ border: 0;
156
+ background: none;
157
+ cursor: pointer;
158
+ color: ${r.colors.text};
159
+
160
+ .ico {
161
+ width: 18px;
162
+ height: 18px;
163
+ }
164
+ &:disabled {
165
+ opacity: 0.4;
166
+ cursor: default;
167
+ }
168
+ &:focus-visible {
169
+ outline: 2px solid ${r.colors.accent};
170
+ outline-offset: 2px;
171
+ }
172
+ `,Ce=l.div`
173
+ display: grid;
174
+ grid-template-columns: 44px 1fr;
175
+ align-items: center;
176
+ gap: 14px;
177
+ padding: 14px 18px;
178
+ background: ${r.colors.white};
179
+ border: 1px solid ${r.colors.line};
180
+ border-radius: 16px;
181
+ `,ke=l.div`
182
+ width: 44px;
183
+ height: 44px;
184
+ border-radius: 10px;
185
+ background: ${r.colors.media};
186
+ overflow: hidden;
187
+ display: flex;
188
+ align-items: center;
189
+ justify-content: center;
190
+ color: ${r.colors.muted2};
191
+
192
+ img {
193
+ width: 100%;
194
+ height: 100%;
195
+ object-fit: contain;
196
+ }
197
+ .ccy-mark {
198
+ width: 26px;
199
+ height: 26px;
200
+ }
201
+ `,Me=l.div`
202
+ min-width: 0;
203
+ display: flex;
204
+ flex-direction: column;
205
+ gap: 4px;
206
+ `,$e=l.span`
207
+ font-weight: 700;
208
+ color: ${r.colors.text};
209
+ `,Ne=l.span`
210
+ font-size: 13px;
211
+ line-height: 1.45;
212
+ color: ${r.colors.muted};
213
+ `,Ae=l.p`
214
+ margin: 0;
215
+ font-size: 12px;
216
+ line-height: 1.5;
217
+ color: ${r.colors.muted2};
218
+ `,We=l.div`
219
+ display: flex;
220
+ gap: 12px;
221
+
222
+ ${r.media.down("mobile")} {
223
+ flex-direction: column-reverse;
224
+ }
225
+ `,ze=l.button`
226
+ flex: 1 1 0;
227
+ height: 48px;
228
+ border: 2px solid ${r.colors.accent};
229
+ border-radius: 12px;
230
+ background: transparent;
231
+ color: ${r.colors.accent};
232
+ cursor: pointer;
233
+ font-family: ${r.font.sans};
234
+ font-weight: 600;
235
+ font-size: 13px;
236
+ line-height: 24px;
237
+ letter-spacing: 0.46px;
238
+ text-transform: uppercase;
239
+
240
+ &:hover:not(:disabled) {
241
+ background: rgba(105, 31, 169, 0.06);
242
+ }
243
+ &:disabled {
244
+ cursor: default;
245
+ opacity: 0.5;
246
+ }
247
+ &:focus-visible {
248
+ outline: 2px solid ${r.colors.accent};
249
+ outline-offset: 2px;
250
+ }
251
+ `,_e=l.button`
252
+ flex: 1 1 0;
253
+ display: inline-flex;
254
+ align-items: center;
255
+ justify-content: center;
256
+ gap: 8px;
257
+ height: 48px;
258
+ border: 0;
259
+ border-radius: 12px;
260
+ background: ${r.colors.accent};
261
+ color: ${r.colors.softWhite};
262
+ cursor: pointer;
263
+ font-family: ${r.font.sans};
264
+ font-weight: 600;
265
+ font-size: 13px;
266
+ line-height: 24px;
267
+ letter-spacing: 0.46px;
268
+ text-transform: uppercase;
269
+
270
+ &:hover:not(:disabled) {
271
+ background: ${r.colors.accentHover};
272
+ }
273
+ &:disabled {
274
+ cursor: default;
275
+ background: rgba(105, 31, 169, 0.4);
276
+ }
277
+ &:focus-visible {
278
+ outline: 2px solid ${r.colors.accent};
279
+ outline-offset: 2px;
280
+ }
281
+ `,Se=l.span`
282
+ width: 16px;
283
+ height: 16px;
284
+ border-radius: 50%;
285
+ border: 2px solid rgba(255, 255, 255, 0.5);
286
+ border-top-color: ${r.colors.white};
287
+ animation: ${ge} 0.7s linear infinite;
288
+
289
+ @media (prefers-reduced-motion: reduce) {
290
+ animation: none;
291
+ }
292
+ `;function qe({auth:n,signer:t,title:a,reason:s,name:i,image:o,icon:d,onAuthorized:u,onCancel:b,onClose:x}){const[f,y]=w.useState(!1),[c,g]=w.useState(null);async function j(){y(!0),g(null);try{await K({auth:n,signer:t,active:!0}),u()}catch(h){q(h)?g(m("authorizeStep.errorRejected")):(G(h,{flow:"authorize_step",kind:n.kind}),g(m("authorizeStep.errorGeneric"))),y(!1)}}return e.jsx(be,{onClick:f?void 0:x,role:"presentation",children:e.jsxs(ye,{onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":a,children:[e.jsxs(we,{children:[e.jsx(je,{children:a}),e.jsx(ve,{onClick:x,disabled:f,"aria-label":m("authorizeStep.close"),children:e.jsx(T,{name:"close",className:"ico"})})]}),e.jsxs(Ce,{"data-testid":"authorize-step-row",children:[e.jsx(ke,{children:o?e.jsx("img",{src:o,alt:""}):d}),e.jsxs(Me,{children:[e.jsx($e,{title:i,children:i}),e.jsx(Ne,{children:s})]})]}),e.jsx(Ae,{children:m("authorizeStep.note")}),e.jsx(X,{message:c}),e.jsxs(We,{children:[e.jsx(ze,{type:"button",onClick:b,disabled:f,children:m("authorizeStep.cancel")}),e.jsx(_e,{type:"button","data-testid":"authorize-step-action",onClick:()=>void j(),disabled:f,children:f?e.jsxs(e.Fragment,{children:[e.jsx(Se,{"aria-hidden":!0}),m("authorizeStep.authorizing")]}):m("authorizeStep.authorize")})]})]})})}async function Xe(n){const[t]=await Ie({...n,trades:[n.trade]});return t}async function Ie(n){const{trades:t,buyer:a,signer:s,onSigned:i}=n;if(t.length===0)throw new Error("No items to buy");const o=new Map;for(const u of t){const b=`${u.chainId}:${u.contract.toLowerCase()}`,x=o.get(b);x?x.push(u):o.set(b,[u])}const d=[];for(const u of o.values())d.push(await Ee({trades:u,buyer:a,signer:s,onSigned:i}));return d}async function Ee(n){const{trades:t,buyer:a,signer:s,onSigned:i}=n,o=t[0],d=$(H(o.contract),o.chainId),u=$(_.MANAToken,o.chainId);await F({auth:{kind:P.Allowance,contractAddress:u.address,spenderAddress:d.address,chainId:o.chainId},signer:s});const b=t.map(c=>ee(c,a));if(B.enabled)try{const c=new se(d.abi).encodeFunctionData("accept",[b]),g=V(),j=Y(s.provider,g),h=await ne(j,g,c,d,{serverURL:B.relayerUrl});return i==null||i(),await g.waitForTransaction(h,1,12e4),h}catch(c){if(c instanceof ae&&c.code===re.USER_DENIED)throw c;console.warn("[buyWithMana] gasless meta-tx failed, falling back to a direct tx:",c)}await Z(s.provider,o.chainId);const f=await new oe(d.address,d.abi,s).accept(b,te(o.chainId));return i==null||i(),(await f.wait()).transactionHash}async function Qe(n){const{trade:t,buyer:a,signer:s,credits:i,manaGapWei:o}=n;if(i.length===0)throw new Error("No credits to spend — use buyWithMana for a MANA-only purchase");if(o<=0n)throw new Error("No MANA gap to cover — use buyWithCredits for a credits-only purchase");const d=$(_.MANAToken,t.chainId),u=$(_.CreditsManager,t.chainId);await F({auth:{kind:P.Allowance,contractAddress:d.address,spenderAddress:u.address,chainId:t.chainId},signer:s});const x=(i.reduce((f,y)=>f+BigInt(y.availableAmount),0n)+o).toString();return Q({trade:t,buyer:a,signer:s,credits:i,maxCreditedValue:x})}function et({className:n}){return e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:n,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 tt({title:n,items:t,onViewAll:a}){const s=w.useRef(null),[i,o]=w.useState(1),[d,u]=w.useState(0),[b,x]=w.useState(!0),[f,y]=w.useState(!1),c=w.useCallback(()=>{const h=s.current;if(!h)return;const{scrollLeft:p,scrollWidth:I,clientWidth:N}=h,E=Math.max(1,Math.ceil(I/N));o(E),u(Math.min(E-1,Math.round(p/N))),x(p<=1),y(p+N>=I-1)},[]);if(w.useEffect(()=>{c();const h=s.current;if(h)return h.addEventListener("scroll",c,{passive:!0}),window.addEventListener("resize",c),()=>{h.removeEventListener("scroll",c),window.removeEventListener("resize",c)}},[c,t.length]),t.length===0)return null;function g(h){const p=s.current;p&&p.scrollBy({left:h*p.clientWidth,behavior:"smooth"})}function j(h){const p=s.current;p&&p.scrollTo({left:h*p.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:n}),a?e.jsxs("button",{className:"collection-carousel__viewall",onClick:a,children:[m("collectionCarousel.viewAll"),e.jsx(T,{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:()=>g(-1),"aria-label":m("collectionCarousel.scrollLeft"),disabled:b,children:e.jsx("img",{src:L,alt:"","aria-hidden":!0})}),e.jsx("div",{className:"collection-carousel__track",ref:s,children:t.map(h=>e.jsx(J,{item:h},h.id))}),e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>g(1),"aria-label":m("collectionCarousel.scrollRight"),disabled:f,children:e.jsx("img",{src:L,alt:"","aria-hidden":!0})})]}),i>1?e.jsx("div",{className:"collection-carousel__dots","aria-label":m("collectionCarousel.pages"),children:Array.from({length:i}).map((h,p)=>e.jsx("button",{className:`collection-carousel__dot${p===d?" is-active":""}`,"aria-label":m("collectionCarousel.goToPage",{page:p+1}),"aria-current":p===d?"true":void 0,onClick:()=>j(p)},p))}):null]})}export{qe as A,tt as C,Ze as P,et as W,A as a,Ie as b,Je as c,Ke as d,le as e,k as f,Xe as g,Ve as h,Qe as i,Ye as m,Ge as s,He as t};
@@ -1 +1 @@
1
- import{u as K,j as e,L as re,d as se,b as te,r as j}from"./react-BW1xvPTF.js";import{av as oe,aw as ce,x as le,t as a,ax as E,B as ne,ar as D,u as ie,as as O,I,p as de,m as me,A as ue,an as he,ay as ge,e as xe}from"./index-B4tgQVEu.js";import{d as _e,g as pe,a as Ne,A as je}from"./collection-DOvX-TK6.js";import{u as be,L as fe}from"./useStore-BLu1YQjn.js";import{d as $,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-BtWBqb3o.js";import{L as B}from"./LoadMore-C2IGYfn5.js";import{u as R}from"./useInfiniteGrid-CD-N77Cs.js";import{E as T}from"./ErrorNotice-BG40E5Ff.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.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,N=r==null||o==null,{data:i}=oe(m,N),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 ye({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 Se={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,N=(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(Ne({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:N,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:Se[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(ye,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function ze(){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,N]=j.useState("wearable"),[i,p]=j.useState(null),[h,_]=j.useState([]),[d,b]=j.useState(""),[l,f]=j.useState(""),[P,z]=j.useState("newest"),y=d&&!Number.isNaN(Number(d))?Number(d):void 0,S=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:y,maxPriceCredits:S,sortBy:H},{items:v,total:Y,isLoading:C,error:A,hasNextPage:W,isFetchingNextPage:F,fetchNextPage:Z}=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 q(s){N(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(){N("wearable"),p(null),_([]),b(""),f("")}const k=!!(y||S),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(je,{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:q,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:W,isFetching:F,onLoadMore:()=>void Z()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:a("creator.empty")}):null]})})]})]})}export{ze as Creator,ze as default};
1
+ import{u as z,j as e,L as re,d as se,b as te,r as j}from"./react-BW1xvPTF.js";import{aC as oe,aD as ce,z as le,t as a,aE as E,B as ne,ay as D,u as ie,az as K,I,m as de,x as me,M as ue,as as he,aF as ge,e as xe}from"./index-BFPNYe8x.js";import{d as _e,g as pe,a as Ne,A as je}from"./collection-D7HQMUIe.js";import{u as be,L as fe}from"./useStore-Bo6L1SFA.js";import{d as $,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-BwvbYi6M.js";import{L as B}from"./LoadMore-C2uaqP2N.js";import{u as R}from"./useInfiniteGrid-BBNOO0mR.js";import{E as T}from"./ErrorNotice-BG40E5Ff.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";function Pe({collection:t,cover:r,itemCount:o}){const n=z(),{contractAddress:m,name:g,creator:x}=t,N=r==null||o==null,{data:i}=oe(m,N),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 ye({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 Se={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)||K(t),x=(b=(d=r==null?void 0:r.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,N=(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(Ne({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:N,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:Se[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(ye,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function Oe(){const{address:t}=se(),r=z(),[o]=te(),n=o.has("collections"),{data:m}=D(t),g=(m==null?void 0:m.name)||(t?K(t):a("creator.fallbackName"));me({title:g,description:a("seo.creator.description",{name:g})});const[x,N]=j.useState("wearable"),[i,p]=j.useState(null),[h,_]=j.useState([]),[d,b]=j.useState(""),[l,f]=j.useState(""),[P,O]=j.useState("newest"),y=d&&!Number.isNaN(Number(d))?Number(d):void 0,S=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:y,maxPriceCredits:S,sortBy:H},{items:v,total:Y,isLoading:C,error:A,hasNextPage:W,isFetchingNextPage:F,fetchNextPage:Z}=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 q(s){N(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(){N("wearable"),p(null),_([]),b(""),f("")}const k=!!(y||S),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(je,{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:q,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:O,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:W,isFetching:F,onLoadMore:()=>void Z()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:a("creator.empty")}):null]})})]})]})}export{Oe as Creator,Oe as default};
@@ -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-B2IDULyh.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-CqQDAMpz.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-Ccq1reIt.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-DN-OLR2r.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};