@dcl/shop 1.0.2-31061650925.commit-fa244eb → 1.0.2-31061952187.commit-8d8b09e

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 (175) hide show
  1. package/_assets/{Activity-DAMRT2bN.js → Activity-D_fQdZon.js} +8 -8
  2. package/_assets/{AnimatedBackground-N_wcSf6D.js → AnimatedBackground-C9W4RBcZ.js} +1 -1
  3. package/_assets/{Assets-7wgiv5MU.js → Assets-CvZql_4R.js} +2 -2
  4. package/_assets/{Assets.styles-9R6ppWqo.js → Assets.styles-BBWJCcMx.js} +1 -1
  5. package/_assets/{Authorizations-DCP2Yevg.js → Authorizations-DVwQ95Ww.js} +1 -1
  6. package/_assets/{Cart-CpLaRQWb.js → Cart-CBLHJRVj.js} +6 -6
  7. package/_assets/{CircularProgress-BYXbDw8X.js → CircularProgress-D09608yv.js} +1 -1
  8. package/_assets/{Collection-CA94Ylrk.js → Collection-DllncUVv.js} +10 -10
  9. package/_assets/{CollectionCarousel-BkFV4le7.js → CollectionCarousel-B9HmGuVb.js} +6 -6
  10. package/_assets/{Confetti-D7bsXMqQ.js → Confetti-Dl6FT7nL.js} +1 -1
  11. package/_assets/{Creator-DWKYxWTB.js → Creator-BreBnKPX.js} +5 -5
  12. package/_assets/{ErrorNotice-CCsvrT3H.js → ErrorNotice-OUNK486K.js} +1 -1
  13. package/_assets/{ExchangeController-KIbY1TeV.js → ExchangeController-Cp3qbfAM.js} +1 -1
  14. package/_assets/{Faq-YyrvPI25.js → Faq-DXtTtsuA.js} +1 -1
  15. package/_assets/{GetCredits-gCz6CMY3.js → GetCredits-BhRNCaTG.js} +10 -10
  16. package/_assets/{Grow-B6W2xyXd.js → Grow-DXdR0gI9.js} +1 -1
  17. package/_assets/{HelpersUtil-BmHoBPAz.js → HelpersUtil-rQp5uDAx.js} +1 -1
  18. package/_assets/{ItemDetail-DsP2PTh3.js → ItemDetail-clRbfaLQ.js} +28 -28
  19. package/_assets/LazyEmoteControls-B7UYn8xk.js +2 -0
  20. package/_assets/{LoadMore-ChGcAM1i.js → LoadMore-jSNRJiwZ.js} +1 -1
  21. package/_assets/{ManaPricingBanner.styles-CZgGH3OR.js → ManaPricingBanner.styles-vDUAKLLe.js} +1 -1
  22. package/_assets/{MyAssets-jgTQywGo.js → MyAssets-CsWhc-qa.js} +4 -4
  23. package/_assets/{MyFavorites-B_oQzUR9.js → MyFavorites-BLrz2vwY.js} +1 -1
  24. package/_assets/{NotFound-CjDp1Ys_.js → NotFound-DP4nosOd.js} +1 -1
  25. package/_assets/{NotificationsBell-Dkr9JB0w.js → NotificationsBell-ARziPv8W.js} +1 -1
  26. package/_assets/OutfitDetail-CLmuEgB3.js +374 -0
  27. package/_assets/{OutfitPreview-J5m3e8Gl.js → OutfitPreview-PWdXvCaE.js} +2 -2
  28. package/_assets/{OutfitStudio-xpf5tPAA.js → OutfitStudio-Cx3Xm6ff.js} +11 -11
  29. package/_assets/{StoreSettings-BkFED3xP.js → StoreSettings-BQtEgWRm.js} +21 -21
  30. package/_assets/{Success-lmJVKgtL.js → Success-BWfI3_Mu.js} +1 -1
  31. package/_assets/{SwapController-DKvQsgHw.js → SwapController-Bf58lQ6b.js} +1 -1
  32. package/_assets/{Tooltip-BBYuQHQb.js → Tooltip-BDmKiALz.js} +1 -1
  33. package/_assets/{TradeService-CkbprpVw.js → TradeService-Yecm1OxI.js} +1 -1
  34. package/_assets/{W3MFrameProviderSingleton-6oL2Do5B.js → W3MFrameProviderSingleton-BQyeyr-U.js} +3 -3
  35. package/_assets/{WebCryptoP256-6t0_XFco.js → WebCryptoP256-Ou_F2OJp.js} +1 -1
  36. package/_assets/{authorizations-CbXH-W_L.js → authorizations-B3AvOvOm.js} +1 -1
  37. package/_assets/{basic-DSLXBfxu.js → basic-DTDRwam-.js} +1 -1
  38. package/_assets/{biconomy-DKrndD59.js → biconomy-DaLi1O64.js} +1 -1
  39. package/_assets/{builder-CVMQir9d.js → builder-DxumJmKw.js} +1 -1
  40. package/_assets/{buy-BllmT-mt.js → buy-BHkfYJLe.js} +1 -1
  41. package/_assets/{buy-gasless-BuzErI_K.js → buy-gasless-BfTEWjT9.js} +1 -1
  42. package/_assets/{categories-Bjf-PXbG.js → categories-D23W_J-A.js} +1 -1
  43. package/_assets/{ccip-DI15Urx-.js → ccip-DGVhZCZ4.js} +1 -1
  44. package/_assets/{ccip-DyRqdu6M.js → ccip-qhHiv1gU.js} +1 -1
  45. package/_assets/{collectionPage.styles-BgKDi1Aa.js → collectionPage.styles-CoEdrsfq.js} +3 -3
  46. package/_assets/{controller-BSVA5WKe.js → controller-DGtmLk4f.js} +2 -2
  47. package/_assets/{core-CflNwoXZ.js → core-BAqS3vu7.js} +4 -4
  48. package/_assets/{createSvgIcon-BCgRSx6l.js → createSvgIcon-Bm9nxGqG.js} +2 -2
  49. package/_assets/{custom-ekboJ4XZ.js → custom-MaGTnz7S.js} +1 -1
  50. package/_assets/{data-capture-C00Edv8o.js → data-capture-5Vi1cyBa.js} +1 -1
  51. package/_assets/{email-D7bKqbcO.js → email-BG6hRXMo.js} +1 -1
  52. package/_assets/{embedded-wallet-BgZe_e0-.js → embedded-wallet-CfnknCH8.js} +1 -1
  53. package/_assets/{emotion-styled.browser.esm-BsZP4P-B.js → emotion-styled.browser.esm-CoxAZUrJ.js} +1 -1
  54. package/_assets/{engine-Cnqy1olA.js → engine-nQGCV50K.js} +1 -1
  55. package/_assets/{errors-BXmP5k3l.js → errors-DZ_QWsza.js} +1 -1
  56. package/_assets/{estimate-l1-fee-9ryWwmxC.js → estimate-l1-fee-CVpJ9ym5.js} +1 -1
  57. package/_assets/{execute-CY4XWL-J.js → execute-DFvUDrLY.js} +2 -2
  58. package/_assets/{features-MG4MlDMD.js → features-BXUedULM.js} +1 -1
  59. package/_assets/{fetchTokenMetadata-qCCUs6iE.js → fetchTokenMetadata-CkQcnzmO.js} +2 -2
  60. package/_assets/{field.styles-DEvu6yNO.js → field.styles-PE4ZasC2.js} +1 -1
  61. package/_assets/{get-ecosystem-wallet-info-DEImAnzE.js → get-ecosystem-wallet-info-CRLH8I6C.js} +1 -1
  62. package/_assets/{getBalance-J5grsfOj.js → getBalance-CiV48JsZ.js} +1 -1
  63. package/_assets/{getNFT-ByNh7y6k.js → getNFT-C3ucNb89.js} +1 -1
  64. package/_assets/{getNFT-Dm5aL9u2.js → getNFT-CV3N9TTA.js} +1 -1
  65. package/_assets/{grid.styles-CtrXwvIr.js → grid.styles-hOZTJ80g.js} +1 -1
  66. package/_assets/{hashTypedData-CgttwS7E.js → hashTypedData-BtF2J233.js} +1 -1
  67. package/_assets/{hashTypedData-BxKbqj1M.js → hashTypedData-gTABcRB5.js} +1 -1
  68. package/_assets/{in-app-DF-fkkCZ.js → in-app-CSDr4Blb.js} +1 -1
  69. package/_assets/{in-app-wallet-calls-D9z1I0uV.js → in-app-wallet-calls-Crivl9zc.js} +1 -1
  70. package/_assets/{index-BybKxZca.js → index-1oceTWwb.js} +3 -3
  71. package/_assets/{index-Fn-DLeUg.js → index-9_4ZEs3N.js} +1 -1
  72. package/_assets/{index-C5fUw5Ha.js → index-9x1mGBeU.js} +1 -1
  73. package/_assets/{index-DXpGefPo.js → index-BBbwMaBz.js} +1 -1
  74. package/_assets/{index-BiSRuBrK.js → index-BNBzDf6z.js} +1 -1
  75. package/_assets/{index-CjSsletQ.js → index-BTDIKmoC.js} +1 -1
  76. package/_assets/{index-CuZ7SJno.js → index-Bg_gOSx_.js} +1 -1
  77. package/_assets/{index-BFgGvh7x.js → index-BniGBCAO.js} +1 -1
  78. package/_assets/{index-DbCIWeQF.js → index-Bs4LvV4K.js} +2 -2
  79. package/_assets/{index-B6xwPPMs.js → index-C0pcaEQl.js} +1 -1
  80. package/_assets/{index-BDPRDW4c.js → index-C23D_vyT.js} +1 -1
  81. package/_assets/{index-C0xt2SIQ.js → index-C5Evg5sh.js} +1 -1
  82. package/_assets/{index-D7foy_c1.js → index-C7hpB9s1.js} +3 -3
  83. package/_assets/{index-zG9t0hxJ.js → index-CGBg3yUz.js} +11 -11
  84. package/_assets/{index--tlhUPhu.js → index-CHf7lsmp.js} +1 -1
  85. package/_assets/{index-B7sgFJOZ.js → index-CHolIX6U.js} +1 -1
  86. package/_assets/{index-D7dTUoYt.js → index-CKUuopSw.js} +12 -12
  87. package/_assets/{index-Z6tclw43.js → index-CS27am7J.js} +1 -1
  88. package/_assets/{index-BlIt7KpC.js → index-Cf-gi-Qq.js} +1 -1
  89. package/_assets/{index-C2s-_3dE.js → index-CkGO7qOd.js} +1 -1
  90. package/_assets/{index-BcW0TBOx.js → index-ClUPCoEW.js} +1 -1
  91. package/_assets/{index-gbxeK1C-.js → index-CmY0V0eX.js} +1 -1
  92. package/_assets/{index-BKC-pfo2.js → index-CvwosU6Y.js} +1 -1
  93. package/_assets/{index-B7Mvi-Fg.js → index-CwRTjZPC.js} +3 -3
  94. package/_assets/{index-lIySTE8R.js → index-CyRHowbs.js} +1 -1
  95. package/_assets/{index-CpxvlmGa.js → index-D5eMvKb_.js} +1 -1
  96. package/_assets/{index-7eX0SEVb.js → index-D769FdFr.js} +1 -1
  97. package/_assets/{index-CszjRehO.js → index-D7LYoLo4.js} +1 -1
  98. package/_assets/{index-CAj85Mcv.js → index-DKHMu0o3.js} +1 -1
  99. package/_assets/{index-CuZGDrIM.js → index-DKdQUEzy.js} +1 -1
  100. package/_assets/{index-DYQXXAKt.js → index-DLFQdlEW.js} +1 -1
  101. package/_assets/{index-Cbj1bJsc.js → index-DSuiX4WG.js} +1 -1
  102. package/_assets/{index-BSmKDErh.js → index-DXRL-4ld.js} +1 -1
  103. package/_assets/{index-BZNkhtbZ.js → index-DY1xBku2.js} +1 -1
  104. package/_assets/{index-D_a1Dj89.js → index-DdmULNRk.js} +2 -2
  105. package/_assets/{index-DVJFosyx.js → index-DgOiZShm.js} +1 -1
  106. package/_assets/{index-BsD9lKdu.js → index-Dh85kccn.js} +1 -1
  107. package/_assets/{index-CkHS5p_Q.js → index-DjTNPtj2.js} +1 -1
  108. package/_assets/{index-CIKoh-oU.js → index-DkV5TYom.js} +1 -1
  109. package/_assets/{index-DRjhhI6j.js → index-DnJJn52L.js} +1 -1
  110. package/_assets/{index-CKXjZ-Kd.js → index-DoGz07sk.js} +1 -1
  111. package/_assets/{index-D20327nw.js → index-Dp2641E3.js} +1 -1
  112. package/_assets/{index-CbQYrUIv.js → index-DwX-9Zo4.js} +1 -1
  113. package/_assets/{index-BcQ98rhd.js → index-EKmmXx1j.js} +1 -1
  114. package/_assets/{index-gmA5M3R1.js → index-HAEoS9R6.js} +1 -1
  115. package/_assets/{index-DlewIau_.js → index-ItjVcw1b.js} +1 -1
  116. package/_assets/{index-B5TGt1q8.js → index-KWEbYeSY.js} +1 -1
  117. package/_assets/{index-CAzui_hj.js → index-S0X-BG2b.js} +1 -1
  118. package/_assets/{index-C6RxhKIE.js → index-UyXkCiLs.js} +1 -1
  119. package/_assets/{index-Dc_jl2yy.js → index-hKv-BpxY.js} +1 -1
  120. package/_assets/{index-CgKz1pmK.js → index-qGMuaBIs.js} +1 -1
  121. package/_assets/{index-D5jN8YQk.js → index-wRmEiTlP.js} +2 -2
  122. package/_assets/{index.es-BOuSF7GL.js → index.es-DnMGDxtr.js} +1 -1
  123. package/_assets/{index.es-6tzroQMk.js → index.es-g_bB-nFv.js} +1 -1
  124. package/_assets/{index.es-11O0MAa5.js → index.es-wpL2Ycto.js} +4 -4
  125. package/_assets/{localBatchGatewayRequest-CByVkxJB.js → localBatchGatewayRequest-DtELSHiE.js} +1 -1
  126. package/_assets/{networks-CLAHX11r.js → networks-ZmRqsvV6.js} +1 -1
  127. package/_assets/{onramp-X6DWjNa-.js → onramp-Bffl3qa3.js} +1 -1
  128. package/_assets/{openzeppelin-DWrLU4le.js → openzeppelin-BmH-LNci.js} +1 -1
  129. package/_assets/{parseNft-C0F1eSr9.js → parseNft-PSjb4qKi.js} +2 -2
  130. package/_assets/{parseSignature-Cfa0bf3p.js → parseSignature-D947kFfv.js} +3 -3
  131. package/_assets/{parseSignature-B1BDTVRI.js → parseSignature-IigTmAp7.js} +1 -1
  132. package/_assets/{passkeys-Bq7ndAcy.js → passkeys-BsJVcpuM.js} +1 -1
  133. package/_assets/{pay-with-exchange-DU8q52b9.js → pay-with-exchange-CU_HZd9F.js} +1 -1
  134. package/_assets/{qr-overlay-2pcgXiq0.js → qr-overlay-EMShc5uE.js} +1 -1
  135. package/_assets/{receive-UZ0WD1OR.js → receive-CO6WElZa.js} +1 -1
  136. package/_assets/{resolveImplementation-C5KIPshP.js → resolveImplementation-CUngPhAv.js} +1 -1
  137. package/_assets/{rpc-q5JetAPC.js → rpc-BqH_VMy9.js} +1 -1
  138. package/_assets/{secp256k1-C79pdbKP.js → secp256k1-CTsmRKJj.js} +1 -1
  139. package/_assets/{secp256k1-C35ing1J.js → secp256k1-D7kpLshE.js} +1 -1
  140. package/_assets/{secp256k1-CYrjGZQC.js → secp256k1-DneM3aYG.js} +1 -1
  141. package/_assets/{send-_ymraJKw.js → send-DnwW2LgN.js} +1 -1
  142. package/_assets/{send-batch-transaction-DkYVZ1xj.js → send-batch-transaction-BgJnfEM8.js} +1 -1
  143. package/_assets/{send-eip712-transaction-BzZBuy56.js → send-eip712-transaction-Cw3ykz5y.js} +2 -2
  144. package/_assets/{send-gasless-transaction-ByRZPFH6.js → send-gasless-transaction-BjGhnCwR.js} +2 -2
  145. package/_assets/{send-transaction-CUkh0xRu.js → send-transaction-COKVeGfk.js} +2 -2
  146. package/_assets/{sendMetaTransaction-De85nOcx.js → sendMetaTransaction-Bp3kwdLJ.js} +1 -1
  147. package/_assets/{sendRawTransaction-D5RykxPX.js → sendRawTransaction-eVli2oE3.js} +3 -3
  148. package/_assets/{serializeTransaction-EYy94JNM.js → serializeTransaction-CIM9i_-w.js} +1 -1
  149. package/_assets/{session-proposal-Bf_Po3Sl.js → session-proposal-KGl_Ah2b.js} +1 -1
  150. package/_assets/{session-request-DEDmAqA-.js → session-request-VAEXTksW.js} +2 -2
  151. package/_assets/{signing-DqKP5KUZ.js → signing-Cgx49_1X.js} +3 -3
  152. package/_assets/{skeleton.styles-CVQk0siV.js → skeleton.styles-BXNXDWEi.js} +1 -1
  153. package/_assets/{socials-3pLrS-E7.js → socials-oKAOeF-k.js} +1 -1
  154. package/_assets/{styled-8pFgehSd.js → styled-pD_2hanx.js} +1 -1
  155. package/_assets/{swaps-C-dgABl9.js → swaps-BcAY_D99.js} +1 -1
  156. package/_assets/{thirdweb-C6_KggNb.js → thirdweb-ChAqWFCO.js} +3 -3
  157. package/_assets/{to-serializable-transaction-BWUJjZdO.js → to-serializable-transaction-D9qGbcrS.js} +2 -2
  158. package/_assets/{transactionReceipt-DmwkwkkP.js → transactionReceipt-BMw52z-f.js} +1 -1
  159. package/_assets/{transactions-BSJMdJi4.js → transactions-CeENvGIt.js} +1 -1
  160. package/_assets/{useCreditPacks-DQxqJepP.js → useCreditPacks-BcavayJ3.js} +1 -1
  161. package/_assets/{useImportable-Co0AaRPY.js → useImportable-CqnIvzif.js} +1 -1
  162. package/_assets/{useInfiniteGrid-UHC0Jjfu.js → useInfiniteGrid-BjEQAabI.js} +1 -1
  163. package/_assets/{useTheme-B-55uBZP.js → useTheme-BnnteKI4.js} +1 -1
  164. package/_assets/{verifyHash-BGJh7VH4.js → verifyHash-CuRmy06R.js} +1 -1
  165. package/_assets/{w3m-modal-CwXD068w.js → w3m-modal-BvOCJx7k.js} +1 -1
  166. package/_assets/{w3m-modal-CjXODL26.js → w3m-modal-CkBFH4cA.js} +1 -1
  167. package/_assets/{wait-for-tx-receipt-DRA8zhkS.js → wait-for-tx-receipt-B2KaPYJT.js} +1 -1
  168. package/_assets/{wallets-DOXRX-PZ.js → wallets-CpXU08d2.js} +5 -5
  169. package/_assets/{web-connector-CXxJTFl4.js → web-connector-BHRkWbB9.js} +3 -3
  170. package/_assets/{writeContract-BdEWRAPa.js → writeContract-DNDGvg0r.js} +1 -1
  171. package/_assets/{zoraTestnet-CzfX948o.js → zoraTestnet-CCn01jlp.js} +1 -1
  172. package/index.html +11 -11
  173. package/package.json +2 -2
  174. package/_assets/LazyEmoteControls-lVtDIvME.js +0 -2
  175. package/_assets/OutfitDetail-BNlw-NwV.js +0 -334
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_assets/index-zG9t0hxJ.js","_assets/react-BYHuwl8r.js","_assets/index-D7dTUoYt.js","_assets/dcl-schemas-CmtP3U6y.js","_assets/sentry-Dx-KuLV3.js","_assets/ethers-BDpbhgX6.js","_assets/intl-CBcMB1D2.js","_assets/index-BYP7oMPZ.css","_assets/useImportable-Co0AaRPY.js","_assets/buy-BllmT-mt.js","_assets/authorizations-CbXH-W_L.js","_assets/sendMetaTransaction-De85nOcx.js","_assets/ManaPricingBanner.styles-CZgGH3OR.js","_assets/Faq-YyrvPI25.js","_assets/field.styles-DEvu6yNO.js"])))=>i.map(i=>d[i]);
2
- import{n as It,bO as At,o as O,v as A,bP as $t,t as s,s as l,w as Lt,B as Et,x as Pt,b as c,ap as Tt,I as $,bQ as et,bR as it,bS as Nt,_ as St,z as P,bT as Ct,A as Ft,bj as q,L as Dt,bU as Mt,E as Ht,bV as Rt,bW as W}from"./index-D7dTUoYt.js";import{r as g,u as zt,j as e,L as rt,e as Ot}from"./react-BYHuwl8r.js";import{u as qt}from"./useImportable-Co0AaRPY.js";import{L as Wt}from"./LoadMore-ChGcAM1i.js";import{u as L}from"./useInfiniteGrid-UHC0Jjfu.js";import{m as ot}from"./mana-matic-C4e1sNO3.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";import"./buy-BllmT-mt.js";import"./authorizations-CbXH-W_L.js";import"./sendMetaTransaction-De85nOcx.js";const _t=15e3;function Gt(t,n){return t.txHash&&n.txHash?t.txHash===n.txHash:t.txHash||n.txHash?!1:t.status===n.status&&Math.abs(t.createdAt-n.createdAt)<=_t}function Bt(t){const n=[...t].sort((i,r)=>r.createdAt-i.createdAt),a=[];for(const i of n){const r=a[a.length-1];r&&Gt(r[r.length-1],i)?r.push(i):a.push([i])}return a.map(i=>{var r;return{id:((r=i.find(o=>o.txHash))==null?void 0:r.txHash)??i[i.length-1].id,createdAt:Math.max(...i.map(o=>o.createdAt)),status:Kt(i),totalCredits:i.reduce((o,h)=>o+h.credits,0),lines:i}})}function Kt(t){return t.some(n=>n.status==="PENDING")?"PENDING":t.some(n=>n.status==="SETTLED")?"SETTLED":"EXPIRED"}function Ut(t){return t==="SETTLED"?"SETTLED":t==="EXPIRED"?"FAILED":"PENDING"}function Qt(t){return t.tradeId?`trade:${t.tradeId}`:t.contractAddress&&t.itemId?`item:${t.contractAddress.toLowerCase()}:${t.itemId}`:null}function Vt(t){const n=[],a=new Map;for(const i of t){const r=Qt(i);if(!r){n.push({key:i.id,tradeId:null,contractAddress:i.contractAddress??null,itemId:i.itemId??null,quantity:1,credits:i.credits});continue}const o=a.get(r);if(o){o.quantity+=1,o.credits+=i.credits;continue}const h={key:r,tradeId:i.tradeId,contractAddress:i.contractAddress??null,itemId:i.itemId??null,quantity:1,credits:i.credits};a.set(r,h),n.push(h)}return n}function Xt(t,n){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:n?It(t.manaWei,n):null,manaWei:t.manaWei,createdAt:t.createdAt,txHash:t.txHash}}function Yt(t){return t.status!=="EXPIRED"||!!t.submittedTxHash}function Zt(t){const a=Bt(t.purchases.filter(Yt)).map(d=>({kind:"purchase",id:`purchase:${d.id}`,createdAt:d.createdAt,order:d})),i=t.sales.map(d=>{const x=Xt(d,t.rate);return{kind:"sale",id:`sale:${x.id}`,createdAt:x.createdAt,sale:x}}),r=(t.creditOrders??[]).filter(d=>d.status!=="failed"&&d.status!=="abandoned").map(d=>({kind:"credit",id:`credit:${d.id}`,createdAt:d.createdAt,order:d})),o=new Set(t.purchases.filter(d=>d.txHash).map(d=>d.txHash.toLowerCase())),h=(t.manaPurchases??[]).filter(d=>!o.has(d.txHash.toLowerCase())).map(d=>({kind:"mana-purchase",id:`mana-purchase:${d.id}`,createdAt:d.createdAt,sale:d}));return[...a,...i,...r,...h].sort((d,x)=>x.createdAt-d.createdAt||(d.id<x.id?-1:1))}function Jt(t,n){return n==="all"?t:n==="sales"?t.filter(a=>a.kind==="sale"):t.filter(a=>a.kind==="purchase"||a.kind==="credit"||a.kind==="mana-purchase")}const ct=t=>t.trim().toLowerCase();function te(t){const n=new Map;for(const a of t??[]){const i=ct(a.txHash??"");if(!i)continue;const r=n.get(i);r?r.push(a):n.set(i,[a])}return n}function ee(t,n,a=Date.now()){const i=n.txHash?t.get(ct(n.txHash)):void 0;if(!i||i.length===0)return{kind:"direct"};const r=i.length===1?ie(i[0].netCents):null,o=i.filter(d=>!d.available&&d.availableAt>a);if(o.length===0)return{kind:"credited",credits:r};const h=o.reduce((d,x)=>Math.max(d,x.availableAt),0);return{kind:"pending",credits:r,availableAt:h}}function ie(t){return At(t)}function ne(){const t=O(i=>{var r;return(r=i.session)==null?void 0:r.address}),{data:n,isLoading:a}=A({queryKey:["listing-count",t],queryFn:()=>$t({creator:t,onSale:!0,first:1}),enabled:!!t,staleTime:5*6e4});return{count:n==null?void 0:n.total,isLoading:a}}const se="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061650925.commit-fa244eb/_assets/credits-product-vs4Q6u6l.svg",_=Lt`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_assets/index-CGBg3yUz.js","_assets/react-BYHuwl8r.js","_assets/index-CKUuopSw.js","_assets/dcl-schemas-CmtP3U6y.js","_assets/sentry-Dx-KuLV3.js","_assets/ethers-BDpbhgX6.js","_assets/intl-CBcMB1D2.js","_assets/index-BYP7oMPZ.css","_assets/useImportable-CqnIvzif.js","_assets/buy-BHkfYJLe.js","_assets/authorizations-B3AvOvOm.js","_assets/sendMetaTransaction-Bp3kwdLJ.js","_assets/ManaPricingBanner.styles-vDUAKLLe.js","_assets/Faq-DXtTtsuA.js","_assets/field.styles-PE4ZasC2.js"])))=>i.map(i=>d[i]);
2
+ import{n as It,bN as At,o as O,v as A,bO as $t,t as s,s as l,w as Lt,B as Et,x as Pt,b as c,an as Nt,I as $,bP as et,bQ as it,bR as Tt,_ as St,z as P,bS as Ct,A as Ft,bh as q,L as Dt,bT as Mt,E as Ht,bU as Rt,bV as _}from"./index-CKUuopSw.js";import{r as g,u as zt,j as e,L as rt,e as Ot}from"./react-BYHuwl8r.js";import{u as qt}from"./useImportable-CqnIvzif.js";import{L as _t}from"./LoadMore-jSNRJiwZ.js";import{u as L}from"./useInfiniteGrid-BjEQAabI.js";import{m as ot}from"./mana-matic-C4e1sNO3.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";import"./buy-BHkfYJLe.js";import"./authorizations-B3AvOvOm.js";import"./sendMetaTransaction-Bp3kwdLJ.js";const Wt=15e3;function Gt(t,n){return t.txHash&&n.txHash?t.txHash===n.txHash:t.txHash||n.txHash?!1:t.status===n.status&&Math.abs(t.createdAt-n.createdAt)<=Wt}function Bt(t){const n=[...t].sort((i,r)=>r.createdAt-i.createdAt),a=[];for(const i of n){const r=a[a.length-1];r&&Gt(r[r.length-1],i)?r.push(i):a.push([i])}return a.map(i=>{var r;return{id:((r=i.find(o=>o.txHash))==null?void 0:r.txHash)??i[i.length-1].id,createdAt:Math.max(...i.map(o=>o.createdAt)),status:Kt(i),totalCredits:i.reduce((o,h)=>o+h.credits,0),lines:i}})}function Kt(t){return t.some(n=>n.status==="PENDING")?"PENDING":t.some(n=>n.status==="SETTLED")?"SETTLED":"EXPIRED"}function Ut(t){return t==="SETTLED"?"SETTLED":t==="EXPIRED"?"FAILED":"PENDING"}function Qt(t){return t.tradeId?`trade:${t.tradeId}`:t.contractAddress&&t.itemId?`item:${t.contractAddress.toLowerCase()}:${t.itemId}`:null}function Vt(t){const n=[],a=new Map;for(const i of t){const r=Qt(i);if(!r){n.push({key:i.id,tradeId:null,contractAddress:i.contractAddress??null,itemId:i.itemId??null,quantity:1,credits:i.credits});continue}const o=a.get(r);if(o){o.quantity+=1,o.credits+=i.credits;continue}const h={key:r,tradeId:i.tradeId,contractAddress:i.contractAddress??null,itemId:i.itemId??null,quantity:1,credits:i.credits};a.set(r,h),n.push(h)}return n}function Xt(t,n){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:n?It(t.manaWei,n):null,manaWei:t.manaWei,createdAt:t.createdAt,txHash:t.txHash}}function Yt(t){return t.status!=="EXPIRED"||!!t.submittedTxHash}function Zt(t){const a=Bt(t.purchases.filter(Yt)).map(d=>({kind:"purchase",id:`purchase:${d.id}`,createdAt:d.createdAt,order:d})),i=t.sales.map(d=>{const x=Xt(d,t.rate);return{kind:"sale",id:`sale:${x.id}`,createdAt:x.createdAt,sale:x}}),r=(t.creditOrders??[]).filter(d=>d.status!=="failed"&&d.status!=="abandoned").map(d=>({kind:"credit",id:`credit:${d.id}`,createdAt:d.createdAt,order:d})),o=new Set(t.purchases.filter(d=>d.txHash).map(d=>d.txHash.toLowerCase())),h=(t.manaPurchases??[]).filter(d=>!o.has(d.txHash.toLowerCase())).map(d=>({kind:"mana-purchase",id:`mana-purchase:${d.id}`,createdAt:d.createdAt,sale:d}));return[...a,...i,...r,...h].sort((d,x)=>x.createdAt-d.createdAt||(d.id<x.id?-1:1))}function Jt(t,n){return n==="all"?t:n==="sales"?t.filter(a=>a.kind==="sale"):t.filter(a=>a.kind==="purchase"||a.kind==="credit"||a.kind==="mana-purchase")}const ct=t=>t.trim().toLowerCase();function te(t){const n=new Map;for(const a of t??[]){const i=ct(a.txHash??"");if(!i)continue;const r=n.get(i);r?r.push(a):n.set(i,[a])}return n}function ee(t,n,a=Date.now()){const i=n.txHash?t.get(ct(n.txHash)):void 0;if(!i||i.length===0)return{kind:"direct"};const r=i.length===1?ie(i[0].netCents):null,o=i.filter(d=>!d.available&&d.availableAt>a);if(o.length===0)return{kind:"credited",credits:r};const h=o.reduce((d,x)=>Math.max(d,x.availableAt),0);return{kind:"pending",credits:r,availableAt:h}}function ie(t){return At(t)}function ne(){const t=O(i=>{var r;return(r=i.session)==null?void 0:r.address}),{data:n,isLoading:a}=A({queryKey:["listing-count",t],queryFn:()=>$t({creator:t,onSale:!0,first:1}),enabled:!!t,staleTime:5*6e4});return{count:n==null?void 0:n.total,isLoading:a}}const se="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061952187.commit-8d8b09e/_assets/credits-product-vs4Q6u6l.svg",W=Lt`
3
3
  0% { background-position: 200% 0; }
4
4
  100% { background-position: -200% 0; }
5
5
  `,ae=l.section`
@@ -107,12 +107,12 @@ import{n as It,bO as At,o as O,v as A,bP as $t,t as s,s as l,w as Lt,B as Et,x a
107
107
  display: flex;
108
108
  flex-direction: column;
109
109
  gap: 16px;
110
- `,T=l.div`
110
+ `,N=l.div`
111
111
  background: ${s.colors.white};
112
112
  border: 1px solid ${s.colors.line};
113
113
  border-radius: 16px;
114
114
  overflow: hidden;
115
- `,N=l.div`
115
+ `,T=l.div`
116
116
  display: flex;
117
117
  align-items: center;
118
118
  justify-content: space-between;
@@ -303,7 +303,7 @@ import{n as It,bO as At,o as O,v as A,bP as $t,t as s,s as l,w as Lt,B as Et,x a
303
303
  border-radius: 10px;
304
304
  background: linear-gradient(100deg, ${s.colors.media} 30%, ${s.colors.panel} 50%, ${s.colors.media} 70%);
305
305
  background-size: 200% 100%;
306
- animation: ${_} 1.3s infinite linear;
306
+ animation: ${W} 1.3s infinite linear;
307
307
 
308
308
  @media (prefers-reduced-motion: reduce) {
309
309
  animation: none;
@@ -326,7 +326,7 @@ import{n as It,bO as At,o as O,v as A,bP as $t,t as s,s as l,w as Lt,B as Et,x a
326
326
  border-radius: 6px;
327
327
  background: linear-gradient(100deg, ${s.colors.media} 30%, ${s.colors.panel} 50%, ${s.colors.media} 70%);
328
328
  background-size: 200% 100%;
329
- animation: ${_} 1.3s infinite linear;
329
+ animation: ${W} 1.3s infinite linear;
330
330
 
331
331
  @media (prefers-reduced-motion: reduce) {
332
332
  animation: none;
@@ -352,7 +352,7 @@ import{n as It,bO as At,o as O,v as A,bP as $t,t as s,s as l,w as Lt,B as Et,x a
352
352
  border: 1px solid transparent;
353
353
  background: linear-gradient(100deg, ${s.colors.media} 30%, ${s.colors.panel} 50%, ${s.colors.media} 70%);
354
354
  background-size: 200% 100%;
355
- animation: ${_} 1.3s infinite linear;
355
+ animation: ${W} 1.3s infinite linear;
356
356
 
357
357
  @media (prefers-reduced-motion: reduce) {
358
358
  animation: none;
@@ -375,4 +375,4 @@ import{n as It,bO as At,o as O,v as A,bP as $t,t as s,s as l,w as Lt,B as Et,x a
375
375
  color: ${s.colors.softWhite};
376
376
  `,be=l(Et)`
377
377
  margin-top: 12px;
378
- `,Y=H.withComponent(rt),ye=g.lazy(()=>St(()=>import("./index-zG9t0hxJ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(t=>({default:t.ImportListings}))),E=24,ve=["all","purchases","sales"],R="section",at="listings",z="view",je="migrate";function I(t){try{return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function xt(t){return t.length>10?`${t.slice(0,6)}…${t.slice(-4)}`:t}function mt(t){const n=Number(t)/1e18;return Number.isFinite(n)?n.toLocaleString("en",{maximumFractionDigits:2}):"0"}function gt({children:t}){const n=g.useRef(null),[a,i]=g.useState(null),r=()=>{var h;const o=(h=n.current)==null?void 0:h.getBoundingClientRect();o&&i({top:o.bottom+8,left:o.left+o.width/2})};return e.jsxs(xe,{ref:n,tabIndex:0,onMouseEnter:r,onMouseLeave:()=>i(null),onFocus:r,onBlur:()=>i(null),children:[t,a?Ot.createPortal(e.jsx(me,{style:{top:a.top,left:a.left},role:"tooltip",children:c("activity.polygonMana")}),document.body):null]})}function ke({item:t}){const n=!!t.contractAddress&&!!t.itemId,a=!!t.tradeId||n,{data:i,isLoading:r}=A({queryKey:["order-line-display",t.tradeId,t.contractAddress,t.itemId],queryFn:()=>t.tradeId?Rt(t.tradeId):W(t.contractAddress,{itemId:t.itemId}),enabled:a,staleTime:5*6e4}),o=a&&r,h=(i==null?void 0:i.name)??c("activity.itemFallback"),d=(i==null?void 0:i.thumbnail)??"",x=q({contractAddress:i==null?void 0:i.contractAddress,tokenId:i==null?void 0:i.tokenId,itemId:i==null?void 0:i.itemId})??void 0,f=e.jsxs(e.Fragment,{children:[o?e.jsx(K,{}):e.jsx(B,{children:d?e.jsx("img",{src:d,alt:h}):e.jsx($,{name:"cart",size:20})}),e.jsxs(U,{children:[o?e.jsx(V,{}):e.jsx(Q,{title:h,children:h}),t.quantity>1?e.jsx(X,{children:c("activity.quantity",{count:t.quantity})}):null]}),e.jsxs(fe,{children:[e.jsx(P,{className:"ccy-mark"})," ",t.credits]})]});return x?e.jsx(Y,{to:x,"data-link":"true",children:f}):e.jsx(H,{children:f})}function we({order:t}){const n=Vt(t.lines),a=n.reduce((o,h)=>o+h.quantity,0),i=Ut(t.status),r=i==="SETTLED"?c("activity.completed"):i==="FAILED"?c("activity.failed"):c("activity.processing");return e.jsxs(T,{"data-testid":"purchase-order",children:[e.jsxs(N,{children:[e.jsxs(S,{children:[e.jsx(C,{children:I(t.createdAt)}),e.jsxs(F,{children:[c("activity.purchaseLabel")," · ",c("activity.itemCount",{count:a})]})]}),e.jsxs(D,{children:[e.jsx(M,{"data-status":i,children:r}),e.jsxs(k,{children:[e.jsx(P,{className:"ccy-mark"})," ",t.totalCredits]})]})]}),i==="FAILED"?e.jsx(ge,{children:c("activity.purchaseFailedNote")}):null,e.jsx(G,{children:n.map(o=>e.jsx(ke,{item:o},o.key))})]})}function Ie({sale:t}){const{data:n,isLoading:a}=A({queryKey:["asset-display",t.contractAddress,t.tokenId,t.itemId],queryFn:()=>W(t.contractAddress,{tokenId:t.tokenId,itemId:t.itemId}),enabled:!!t.contractAddress,staleTime:3e5}),i=(n==null?void 0:n.name)??c("activity.itemFallback"),r=(n==null?void 0:n.thumbnail)??"",o=q({contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId})??void 0,h=e.jsxs(e.Fragment,{children:[a?e.jsx(K,{}):e.jsx(B,{children:r?e.jsx("img",{src:r,alt:i}):e.jsx($,{name:"offer",size:20})}),e.jsxs(U,{children:[a?e.jsx(V,{}):e.jsx(Q,{title:i,children:i}),e.jsx(X,{children:c("activity.boughtFrom",{account:xt(t.seller)})})]})]});return e.jsxs(T,{"data-testid":"activity-mana-purchase",children:[e.jsxs(N,{children:[e.jsxs(S,{children:[e.jsx(C,{children:I(t.createdAt)}),e.jsx(F,{children:c("activity.paidWithMana")})]}),e.jsxs(D,{children:[e.jsx(M,{"data-status":"SETTLED",children:c("activity.completed")}),e.jsxs(k,{children:[mt(t.manaWei)," ",e.jsx(gt,{children:e.jsx(lt,{src:ot,alt:"MANA"})})]})]})]}),e.jsx(G,{children:o?e.jsx(Y,{to:o,"data-link":"true",children:h}):e.jsx(H,{children:h})})]})}function Ae({sale:t,payout:n}){const{data:a,isLoading:i}=A({queryKey:["asset-display",t.contractAddress,t.tokenId,t.itemId],queryFn:()=>W(t.contractAddress,{tokenId:t.tokenId,itemId:t.itemId}),enabled:!!t.contractAddress,staleTime:3e5}),r=(a==null?void 0:a.name)??c("activity.itemFallback"),o=(a==null?void 0:a.thumbnail)??"",h=q({contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId})??void 0,d=e.jsxs(e.Fragment,{children:[i?e.jsx(K,{}):e.jsx(B,{children:o?e.jsx("img",{src:o,alt:r}):e.jsx($,{name:"offer",size:20})}),e.jsxs(U,{children:[i?e.jsx(V,{}):e.jsx(Q,{title:r,children:r}),e.jsxs(X,{children:[c("activity.soldTo",{account:xt(t.counterparty)}),n.kind==="pending"?` · ${c("activity.payoutPendingOn",{date:I(n.availableAt)})}`:""]})]})]});return e.jsxs(T,{"data-testid":"activity-sale",children:[e.jsxs(N,{children:[e.jsxs(S,{children:[e.jsx(C,{children:I(t.createdAt)}),e.jsx(F,{children:c("activity.saleLabel")})]}),e.jsxs(D,{children:[e.jsx(M,{"data-status":n.kind==="pending"?"PENDING":"SOLD",children:n.kind==="pending"?c("activity.payoutPending"):c("activity.sold")}),n.kind==="direct"?e.jsxs(k,{"data-kind":"income",children:["+",mt(t.manaWei)," ",e.jsx(gt,{children:e.jsx(lt,{src:ot,alt:"MANA"})})]}):n.credits!==null?e.jsxs(k,{"data-kind":"income",children:[e.jsx(P,{className:"ccy-mark"})," +",Dt(n.credits)]}):e.jsx(k,{"data-kind":"income",children:c("activity.payoutCredited")})]})]}),e.jsx(G,{children:h?e.jsx(Y,{to:h,"data-link":"true",children:d}):e.jsx(H,{children:d})})]})}function $e({order:t}){const n=`$${(t.usdCents/100).toFixed(2)}`,a=Ct(t.status),i=a==="SETTLED"?c("activity.completed"):a==="FAILED"?c("activity.failed"):a==="UNFINISHED"?c("activity.unfinished"):c("activity.processing"),r=O(p=>p.session),o=Ft(),[h,d]=g.useState(!1),x=t.status==="initiated"&&!!r;async function f(){if(!(!r||h)){d(!0);try{const p=await Mt(t.id,r.identity);if(p){window.location.href=p;return}Ht.info(c("activity.resumeExpired")),o.invalidateQueries({queryKey:["credit-orders"]})}finally{d(!1)}}}return e.jsx(T,{"data-testid":"credit-order",children:e.jsxs(N,{children:[e.jsx(he,{children:e.jsx("img",{src:se,alt:"","aria-hidden":!0})}),e.jsxs(S,{children:[e.jsx(C,{children:I(t.createdAt)}),e.jsxs(F,{children:[c("activity.creditPurchaseLabel")," · ",c("activity.creditPaid",{usd:n})]})]}),e.jsxs(D,{children:[x?e.jsx(pe,{type:"button",onClick:()=>void f(),disabled:h,"data-testid":"resume-order",children:h?c("activity.resuming"):c("activity.resume")}):null,e.jsx(M,{"data-status":a,children:i}),e.jsxs(k,{"data-kind":"income",children:["+",e.jsx(P,{className:"ccy-mark"})," ",t.credits]})]})]})})}function Le({filter:t}){const n={all:{icon:"clock",title:c("activity.emptyAllTitle"),body:c("activity.emptyAllBody")},purchases:{icon:"cart",title:c("activity.emptyPurchasesTitle"),body:c("activity.emptyPurchasesBody")},sales:{icon:"offer",title:c("activity.emptySalesTitle"),body:c("activity.emptySalesBody")}}[t];return e.jsxs(ut,{children:[e.jsx($,{name:n.icon,size:40,color:s.colors.muted2}),e.jsx(ht,{children:n.title}),e.jsx(pt,{children:n.body}),t!=="sales"?e.jsx(be,{as:rt,to:"/items",variant:"white",children:c("notFound.cta")}):null]})}function qe(){const{session:t}=O(),[n,a]=g.useState("all"),[i,r]=zt(),o=i.get(R)===at||i.get(z)===je;Pt({title:o?c("seo.import.title"):c("nav.activity"),noindex:!0});const{count:h}=qt(),{count:d}=ne(),f=h!==void 0&&d!==void 0&&(h>0||d>0||o),p=!!t&&!o&&n!=="sales",m=!!t&&!o&&n!=="purchases",b=L(["purchases",t==null?void 0:t.address],u=>Nt(t.address,t.identity,{first:E,skip:u}),{enabled:p}),y=L(["sales",t==null?void 0:t.address],u=>et(t.address,{role:"seller",first:E,skip:u}),{enabled:m}),v=L(["credit-orders",t==null?void 0:t.address],u=>it(t.address,t.identity,{first:E,skip:u}),{enabled:p}),j=L(["mana-purchases",t==null?void 0:t.address],u=>et(t.address,{role:"buyer",first:E,skip:u}),{enabled:p}),{data:Z}=A({queryKey:["sale-payouts",t==null?void 0:t.address],queryFn:()=>it(t.address,t.identity,{first:200}).then(u=>u.payouts),enabled:m,staleTime:6e4}),ft=g.useMemo(()=>te(Z),[Z]),{data:bt}=Tt(m);if(!t)return e.jsxs(ut,{children:[e.jsx($,{name:"clock",size:40,color:s.colors.muted2}),e.jsx(ht,{children:c("activity.signInTitle")}),e.jsx(pt,{children:c("activity.signInBody")})]});const J=Jt(Zt({purchases:p?b.items:[],sales:m?y.items:[],creditOrders:p?v.items:[],manaPurchases:p?j.items:[],rate:bt}),n),yt=p&&(b.isLoading||v.isLoading||j.isLoading)||m&&y.isLoading,tt=p&&(b.isFetchingNextPage||v.isFetchingNextPage||j.isFetchingNextPage)||m&&y.isFetchingNextPage,vt=p&&(b.hasNextPage||v.hasNextPage||j.hasNextPage)||m&&y.hasNextPage;function jt(){p&&b.hasNextPage&&b.fetchNextPage(),p&&v.hasNextPage&&v.fetchNextPage(),p&&j.hasNextPage&&j.fetchNextPage(),m&&y.hasNextPage&&y.fetchNextPage()}function kt(u){if(a(u),!o)return;const w=new URLSearchParams(i);w.delete(R),w.delete(z),r(w,{replace:!0})}function wt(){const u=new URLSearchParams(i);u.set(R,at),u.delete(z),r(u,{replace:!0})}return e.jsxs(ae,{children:[e.jsx(re,{children:e.jsx(oe,{children:c("nav.activity")})}),e.jsxs(ce,{role:"tablist","aria-label":c("nav.activity"),children:[ve.map(u=>e.jsx(dt,{type:"button",role:"tab","aria-selected":!o&&n===u,"data-active":!o&&n===u,"data-testid":`activity-filter-${u}`,onClick:()=>kt(u),children:c(`activity.filter.${u}`)},u)),f?e.jsxs(de,{type:"button",role:"tab","aria-selected":o,"data-active":o,"data-testid":"activity-filter-migrate","aria-label":h?c("activity.migrate.chipAria",{count:h}):void 0,onClick:wt,children:[c("activity.migrate.chip"),h?e.jsx(le,{"data-testid":"activity-migrate-count","aria-hidden":!0,children:h}):null]}):null]}),o?e.jsx(g.Suspense,{fallback:e.jsx(ue,{"aria-busy":"true"}),children:e.jsx(ye,{})}):yt?e.jsx(nt,{children:Array.from({length:5}).map((u,w)=>e.jsx(st,{},w))}):J.length===0?e.jsx(Le,{filter:n}):e.jsxs(e.Fragment,{children:[e.jsxs(nt,{children:[J.map(u=>u.kind==="purchase"?e.jsx(we,{order:u.order},u.id):u.kind==="credit"?e.jsx($e,{order:u.order},u.id):u.kind==="mana-purchase"?e.jsx(Ie,{sale:u.sale},u.id):e.jsx(Ae,{sale:u.sale,payout:ee(ft,u.sale)},u.id)),tt?e.jsx(st,{}):null]}),e.jsx(Wt,{hasNextPage:vt,isFetching:tt,onLoadMore:jt})]})]})}export{qe as Activity};
378
+ `,Y=H.withComponent(rt),ye=g.lazy(()=>St(()=>import("./index-CGBg3yUz.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(t=>({default:t.ImportListings}))),E=24,ve=["all","purchases","sales"],R="section",at="listings",z="view",je="migrate";function I(t){try{return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function xt(t){return t.length>10?`${t.slice(0,6)}…${t.slice(-4)}`:t}function mt(t){const n=Number(t)/1e18;return Number.isFinite(n)?n.toLocaleString("en",{maximumFractionDigits:2}):"0"}function gt({children:t}){const n=g.useRef(null),[a,i]=g.useState(null),r=()=>{var h;const o=(h=n.current)==null?void 0:h.getBoundingClientRect();o&&i({top:o.bottom+8,left:o.left+o.width/2})};return e.jsxs(xe,{ref:n,tabIndex:0,onMouseEnter:r,onMouseLeave:()=>i(null),onFocus:r,onBlur:()=>i(null),children:[t,a?Ot.createPortal(e.jsx(me,{style:{top:a.top,left:a.left},role:"tooltip",children:c("activity.polygonMana")}),document.body):null]})}function ke({item:t}){const n=!!t.contractAddress&&!!t.itemId,a=!!t.tradeId||n,{data:i,isLoading:r}=A({queryKey:["order-line-display",t.tradeId,t.contractAddress,t.itemId],queryFn:()=>t.tradeId?Rt(t.tradeId):_(t.contractAddress,{itemId:t.itemId}),enabled:a,staleTime:5*6e4}),o=a&&r,h=(i==null?void 0:i.name)??c("activity.itemFallback"),d=(i==null?void 0:i.thumbnail)??"",x=q({contractAddress:i==null?void 0:i.contractAddress,tokenId:i==null?void 0:i.tokenId,itemId:i==null?void 0:i.itemId})??void 0,f=e.jsxs(e.Fragment,{children:[o?e.jsx(K,{}):e.jsx(B,{children:d?e.jsx("img",{src:d,alt:h}):e.jsx($,{name:"cart",size:20})}),e.jsxs(U,{children:[o?e.jsx(V,{}):e.jsx(Q,{title:h,children:h}),t.quantity>1?e.jsx(X,{children:c("activity.quantity",{count:t.quantity})}):null]}),e.jsxs(fe,{children:[e.jsx(P,{className:"ccy-mark"})," ",t.credits]})]});return x?e.jsx(Y,{to:x,"data-link":"true",children:f}):e.jsx(H,{children:f})}function we({order:t}){const n=Vt(t.lines),a=n.reduce((o,h)=>o+h.quantity,0),i=Ut(t.status),r=i==="SETTLED"?c("activity.completed"):i==="FAILED"?c("activity.failed"):c("activity.processing");return e.jsxs(N,{"data-testid":"purchase-order",children:[e.jsxs(T,{children:[e.jsxs(S,{children:[e.jsx(C,{children:I(t.createdAt)}),e.jsxs(F,{children:[c("activity.purchaseLabel")," · ",c("activity.itemCount",{count:a})]})]}),e.jsxs(D,{children:[e.jsx(M,{"data-status":i,children:r}),e.jsxs(k,{children:[e.jsx(P,{className:"ccy-mark"})," ",t.totalCredits]})]})]}),i==="FAILED"?e.jsx(ge,{children:c("activity.purchaseFailedNote")}):null,e.jsx(G,{children:n.map(o=>e.jsx(ke,{item:o},o.key))})]})}function Ie({sale:t}){const{data:n,isLoading:a}=A({queryKey:["asset-display",t.contractAddress,t.tokenId,t.itemId],queryFn:()=>_(t.contractAddress,{tokenId:t.tokenId,itemId:t.itemId}),enabled:!!t.contractAddress,staleTime:3e5}),i=(n==null?void 0:n.name)??c("activity.itemFallback"),r=(n==null?void 0:n.thumbnail)??"",o=q({contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId})??void 0,h=e.jsxs(e.Fragment,{children:[a?e.jsx(K,{}):e.jsx(B,{children:r?e.jsx("img",{src:r,alt:i}):e.jsx($,{name:"offer",size:20})}),e.jsxs(U,{children:[a?e.jsx(V,{}):e.jsx(Q,{title:i,children:i}),e.jsx(X,{children:c("activity.boughtFrom",{account:xt(t.seller)})})]})]});return e.jsxs(N,{"data-testid":"activity-mana-purchase",children:[e.jsxs(T,{children:[e.jsxs(S,{children:[e.jsx(C,{children:I(t.createdAt)}),e.jsx(F,{children:c("activity.paidWithMana")})]}),e.jsxs(D,{children:[e.jsx(M,{"data-status":"SETTLED",children:c("activity.completed")}),e.jsxs(k,{children:[mt(t.manaWei)," ",e.jsx(gt,{children:e.jsx(lt,{src:ot,alt:"MANA"})})]})]})]}),e.jsx(G,{children:o?e.jsx(Y,{to:o,"data-link":"true",children:h}):e.jsx(H,{children:h})})]})}function Ae({sale:t,payout:n}){const{data:a,isLoading:i}=A({queryKey:["asset-display",t.contractAddress,t.tokenId,t.itemId],queryFn:()=>_(t.contractAddress,{tokenId:t.tokenId,itemId:t.itemId}),enabled:!!t.contractAddress,staleTime:3e5}),r=(a==null?void 0:a.name)??c("activity.itemFallback"),o=(a==null?void 0:a.thumbnail)??"",h=q({contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId})??void 0,d=e.jsxs(e.Fragment,{children:[i?e.jsx(K,{}):e.jsx(B,{children:o?e.jsx("img",{src:o,alt:r}):e.jsx($,{name:"offer",size:20})}),e.jsxs(U,{children:[i?e.jsx(V,{}):e.jsx(Q,{title:r,children:r}),e.jsxs(X,{children:[c("activity.soldTo",{account:xt(t.counterparty)}),n.kind==="pending"?` · ${c("activity.payoutPendingOn",{date:I(n.availableAt)})}`:""]})]})]});return e.jsxs(N,{"data-testid":"activity-sale",children:[e.jsxs(T,{children:[e.jsxs(S,{children:[e.jsx(C,{children:I(t.createdAt)}),e.jsx(F,{children:c("activity.saleLabel")})]}),e.jsxs(D,{children:[e.jsx(M,{"data-status":n.kind==="pending"?"PENDING":"SOLD",children:n.kind==="pending"?c("activity.payoutPending"):c("activity.sold")}),n.kind==="direct"?e.jsxs(k,{"data-kind":"income",children:["+",mt(t.manaWei)," ",e.jsx(gt,{children:e.jsx(lt,{src:ot,alt:"MANA"})})]}):n.credits!==null?e.jsxs(k,{"data-kind":"income",children:[e.jsx(P,{className:"ccy-mark"})," +",Dt(n.credits)]}):e.jsx(k,{"data-kind":"income",children:c("activity.payoutCredited")})]})]}),e.jsx(G,{children:h?e.jsx(Y,{to:h,"data-link":"true",children:d}):e.jsx(H,{children:d})})]})}function $e({order:t}){const n=`$${(t.usdCents/100).toFixed(2)}`,a=Ct(t.status),i=a==="SETTLED"?c("activity.completed"):a==="FAILED"?c("activity.failed"):a==="UNFINISHED"?c("activity.unfinished"):c("activity.processing"),r=O(p=>p.session),o=Ft(),[h,d]=g.useState(!1),x=t.status==="initiated"&&!!r;async function f(){if(!(!r||h)){d(!0);try{const p=await Mt(t.id,r.identity);if(p){window.location.href=p;return}Ht.info(c("activity.resumeExpired")),o.invalidateQueries({queryKey:["credit-orders"]})}finally{d(!1)}}}return e.jsx(N,{"data-testid":"credit-order",children:e.jsxs(T,{children:[e.jsx(he,{children:e.jsx("img",{src:se,alt:"","aria-hidden":!0})}),e.jsxs(S,{children:[e.jsx(C,{children:I(t.createdAt)}),e.jsxs(F,{children:[c("activity.creditPurchaseLabel")," · ",c("activity.creditPaid",{usd:n})]})]}),e.jsxs(D,{children:[x?e.jsx(pe,{type:"button",onClick:()=>void f(),disabled:h,"data-testid":"resume-order",children:h?c("activity.resuming"):c("activity.resume")}):null,e.jsx(M,{"data-status":a,children:i}),e.jsxs(k,{"data-kind":"income",children:["+",e.jsx(P,{className:"ccy-mark"})," ",t.credits]})]})]})})}function Le({filter:t}){const n={all:{icon:"clock",title:c("activity.emptyAllTitle"),body:c("activity.emptyAllBody")},purchases:{icon:"cart",title:c("activity.emptyPurchasesTitle"),body:c("activity.emptyPurchasesBody")},sales:{icon:"offer",title:c("activity.emptySalesTitle"),body:c("activity.emptySalesBody")}}[t];return e.jsxs(ut,{children:[e.jsx($,{name:n.icon,size:40,color:s.colors.muted2}),e.jsx(ht,{children:n.title}),e.jsx(pt,{children:n.body}),t!=="sales"?e.jsx(be,{as:rt,to:"/items",variant:"white",children:c("notFound.cta")}):null]})}function qe(){const{session:t}=O(),[n,a]=g.useState("all"),[i,r]=zt(),o=i.get(R)===at||i.get(z)===je;Pt({title:o?c("seo.import.title"):c("nav.activity"),noindex:!0});const{count:h}=qt(),{count:d}=ne(),f=h!==void 0&&d!==void 0&&(h>0||d>0||o),p=!!t&&!o&&n!=="sales",m=!!t&&!o&&n!=="purchases",b=L(["purchases",t==null?void 0:t.address],u=>Tt(t.address,t.identity,{first:E,skip:u}),{enabled:p}),y=L(["sales",t==null?void 0:t.address],u=>et(t.address,{role:"seller",first:E,skip:u}),{enabled:m}),v=L(["credit-orders",t==null?void 0:t.address],u=>it(t.address,t.identity,{first:E,skip:u}),{enabled:p}),j=L(["mana-purchases",t==null?void 0:t.address],u=>et(t.address,{role:"buyer",first:E,skip:u}),{enabled:p}),{data:Z}=A({queryKey:["sale-payouts",t==null?void 0:t.address],queryFn:()=>it(t.address,t.identity,{first:200}).then(u=>u.payouts),enabled:m,staleTime:6e4}),ft=g.useMemo(()=>te(Z),[Z]),{data:bt}=Nt(m);if(!t)return e.jsxs(ut,{children:[e.jsx($,{name:"clock",size:40,color:s.colors.muted2}),e.jsx(ht,{children:c("activity.signInTitle")}),e.jsx(pt,{children:c("activity.signInBody")})]});const J=Jt(Zt({purchases:p?b.items:[],sales:m?y.items:[],creditOrders:p?v.items:[],manaPurchases:p?j.items:[],rate:bt}),n),yt=p&&(b.isLoading||v.isLoading||j.isLoading)||m&&y.isLoading,tt=p&&(b.isFetchingNextPage||v.isFetchingNextPage||j.isFetchingNextPage)||m&&y.isFetchingNextPage,vt=p&&(b.hasNextPage||v.hasNextPage||j.hasNextPage)||m&&y.hasNextPage;function jt(){p&&b.hasNextPage&&b.fetchNextPage(),p&&v.hasNextPage&&v.fetchNextPage(),p&&j.hasNextPage&&j.fetchNextPage(),m&&y.hasNextPage&&y.fetchNextPage()}function kt(u){if(a(u),!o)return;const w=new URLSearchParams(i);w.delete(R),w.delete(z),r(w,{replace:!0})}function wt(){const u=new URLSearchParams(i);u.set(R,at),u.delete(z),r(u,{replace:!0})}return e.jsxs(ae,{children:[e.jsx(re,{children:e.jsx(oe,{children:c("nav.activity")})}),e.jsxs(ce,{role:"tablist","aria-label":c("nav.activity"),children:[ve.map(u=>e.jsx(dt,{type:"button",role:"tab","aria-selected":!o&&n===u,"data-active":!o&&n===u,"data-testid":`activity-filter-${u}`,onClick:()=>kt(u),children:c(`activity.filter.${u}`)},u)),f?e.jsxs(de,{type:"button",role:"tab","aria-selected":o,"data-active":o,"data-testid":"activity-filter-migrate","aria-label":h?c("activity.migrate.chipAria",{count:h}):void 0,onClick:wt,children:[c("activity.migrate.chip"),h?e.jsx(le,{"data-testid":"activity-migrate-count","aria-hidden":!0,children:h}):null]}):null]}),o?e.jsx(g.Suspense,{fallback:e.jsx(ue,{"aria-busy":"true"}),children:e.jsx(ye,{})}):yt?e.jsx(nt,{children:Array.from({length:5}).map((u,w)=>e.jsx(st,{},w))}):J.length===0?e.jsx(Le,{filter:n}):e.jsxs(e.Fragment,{children:[e.jsxs(nt,{children:[J.map(u=>u.kind==="purchase"?e.jsx(we,{order:u.order},u.id):u.kind==="credit"?e.jsx($e,{order:u.order},u.id):u.kind==="mana-purchase"?e.jsx(Ie,{sale:u.sale},u.id):e.jsx(Ae,{sale:u.sale,payout:ee(ft,u.sale)},u.id)),tt?e.jsx(st,{}):null]}),e.jsx(_t,{hasNextPage:vt,isFetching:tt,onLoadMore:jt})]})]})}export{qe as Activity};
@@ -1,4 +1,4 @@
1
- import{r as u,j as m}from"./react-BYHuwl8r.js";import{s as d}from"./index-D7dTUoYt.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";const P="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061650925.commit-fa244eb/_assets/custom-welcome-background-BxlFQma9.webp",L="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061650925.commit-fa244eb/_assets/DCL_LogoPattern-BryBPc3d.png",D=`
1
+ import{r as u,j as m}from"./react-BYHuwl8r.js";import{s as d}from"./index-CKUuopSw.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";const P="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061952187.commit-8d8b09e/_assets/custom-welcome-background-BxlFQma9.webp",L="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061952187.commit-8d8b09e/_assets/DCL_LogoPattern-BryBPc3d.png",D=`
2
2
  attribute vec2 a_position;
3
3
  varying vec2 v_uv;
4
4
  void main() {
@@ -1,4 +1,4 @@
1
- import{b as Fe,r as w,j as e,u as Ke}from"./react-BYHuwl8r.js";import{u as Qe}from"./useUrlFilters-DH-gxdfV.js";import{u as Je,S as $e,R as Xe,F as Ye,e as et}from"./categories-Bjf-PXbG.js";import{c as L,r as tt,bo as nt,bp as st,aC as it,a as ot,s,t,o as Ie,be as rt,A as at,L as xe,b as n,y as lt,I as E,z as F,b$ as Y,bd as ct,$ as J,bt as dt,bs as pt,x as Ae,ap as Ne,n as Le,q as ht,an as xt,ar as ke,as as G,aI as ft,bM as mt}from"./index-D7dTUoYt.js";import{g as ut,h as gt,i as bt,j as yt,k as wt,C as jt,l as vt,o as Ct,m as $t,n as kt,M as St,u as Tt,E as Et,v as _t,p as Rt,q as Mt,r as zt,s as Ft,t as It}from"./Assets.styles-9R6ppWqo.js";import{L as At}from"./LoadMore-ChGcAM1i.js";import{u as Nt}from"./useInfiniteGrid-UHC0Jjfu.js";import{E as Lt}from"./ErrorNotice-CCsvrT3H.js";import{d as Wt}from"./dcl-schemas-CmtP3U6y.js";import{s as Pt,G as Bt,w as Ht,S as Ut}from"./buy-gasless-BuzErI_K.js";import{s as Ot,k as Gt}from"./buy-BllmT-mt.js";import{f as Dt}from"./errors-BXmP5k3l.js";import{J as qt,C as Zt,B as fe}from"./ethers-BDpbhgX6.js";import{n as Vt}from"./Tooltip-BBYuQHQb.js";import{G as Kt}from"./grid.styles-CtrXwvIr.js";import"./skeleton.styles-CVQk0siV.js";import"./sentry-Dx-KuLV3.js";import"./intl-CBcMB1D2.js";import"./authorizations-CbXH-W_L.js";import"./sendMetaTransaction-De85nOcx.js";function D(i){const r=i.source??"item",l=i.tradeId||`${i.contractAddress}-${i.tokenId??i.itemId??""}`;return`${r}:${l}`}const W="100000000000000000000",We=2,X=15,Qt=/^[a-zA-Z0-9]+$/;function Se(i){const r=i.trim();return r.length===0?{ok:!1,reason:"empty"}:Qt.test(r)?r.length<We?{ok:!1,reason:"too-short"}:r.length>X?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Jt(i){return i.replace(/[^a-zA-Z0-9]/g,"").slice(0,X)}const Xt=["function available(string _subdomain) view returns (bool)"],Te={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Yt(){return L.chainId===Number(Wt.ChainId.MATIC_MAINNET)?Te.mainnet:Te.sepolia}async function en(i,r={}){var c;const{rpc:l,address:x}=Yt(),h=new qt(l),d=new Zt(x,Xt,h);console.info(`[names] availability check → DCLRegistrar(${x}).available("${i}") on ${l}`);const p=await d.available(i);if((c=r.signal)!=null&&c.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${i}" available=${p}`),p?"available":"taken"}const tn="https://app.across.to/api";class me extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function nn(i){return it(W,i)}async function sn(i,r,l={}){var c;const x=l.chainId??L.chainId,h=l.provider??"across",d=`${L.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(r)}&chainId=${x}&provider=${h}`,p=await ot(d,{method:"GET",identity:i,metadata:{}});if(!p.ok){let a;try{a=(c=await p.json())==null?void 0:c.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new me:new Error(`fetchNameCreditRoute ${p.status}`)}return p.json()}function on(i,r){const l=fe.from(i.availableAmount),h=fe.from(W).sub(l);return{credits:[{value:i.amount,expiresAt:Number(i.expiresAt),salt:Gt(i.id)}],creditsSignatures:[i.signature],externalCall:{target:r.externalCall.target,selector:r.externalCall.selector,data:r.externalCall.data,expiresAt:r.externalCall.expiresAt,salt:r.externalCall.salt},customExternalCallSignature:r.customExternalCallSignature,maxUncreditedValue:h.isNegative()?"0":h.toString(),maxCreditedValue:W}}async function rn(i,r={}){const l=tn,x=r.intervalMs??1e4,h=r.maxAttempts??60;let d={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let p=0;p<h;p++){try{const c=await fetch(`${l}/deposit/status?originChainId=137&depositTxHash=${i}`);if(c.ok){const a=await c.json(),f=(a.status??"pending").toLowerCase(),g=a.fillTx??a.fillTxnRef??null,u=a.actionsSucceeded!==!1;if(f==="filled")return{status:"filled",destinationTxHash:g,actionsSucceeded:u};if(f==="refunded"||f==="expired")return{status:f,destinationTxHash:null,actionsSucceeded:!1};d={status:"pending",destinationTxHash:g,actionsSucceeded:u}}}catch{}p<h-1&&await new Promise(c=>setTimeout(c,x))}return d}async function an(i){const{name:r,identity:l,signer:x}=i,h=i.chainId??L.chainId,d=i.provider??"across",p=(i.beneficiary??await x.getAddress()).toLowerCase();let c=null,a=!1;console.info("[names] register start",{name:r,buyer:p,chainId:h,provider:d});try{const f=await tt(h),g=nn(f);console.info("[names] step 1/6 sized reservation",{usdCents:g,manaRate:f});const u=await sn(l,r,{chainId:h,provider:d});console.info("[names] step 2/6 route fetched",{target:u.externalCall.target,selector:u.externalCall.selector,provider:u.provider,quoteId:u.quoteId});const v=await nt(l,g);if(c=v.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:v.credit.id,maxCreditedValue:v.maxCreditedValue}),fe.from(v.maxCreditedValue).lt(W))throw new Error("Credit under-sized for the name price");const j=on(v.credit,u);let m;try{m=await Pt({chainId:h,buyer:p,signer:x,args:j})}catch(b){if(!(b instanceof Bt))throw b;m=await Ot(h,j,x)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:m}),await Ht(m),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:m}),d==="across"){const b=await rn(m,i.acrossPoll);if(console.info("[names] step 6/6 across status",b),b.status==="pending")return{status:"pending",originTxHash:m};if(b.status!=="filled"||!b.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:m,destinationTxHash:b.destinationTxHash}}return{status:"pending",originTxHash:m}}catch(f){if(console.error("[names] register failed — raw error:",f,{name:r,buyer:p,originConfirmed:a}),f instanceof Ut)return{status:"pending",originTxHash:f.txHash};if(c&&!a&&await st(l,[c]).catch(()=>{}),f instanceof me)throw f;const g=new Error(Dt(f,"Couldn't register the name. Please try again.",{sale:!0}));throw g.cause=f,g}}const ln="data:image/svg+xml,%3csvg%20preserveAspectRatio='none'%20overflow='visible'%20style='display:%20block;'%20width='46.999'%20height='46.999'%20viewBox='0%200%2046.999%2046.999'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Vector'%3e%3cpath%20d='M23.5861%2046.999C27.4441%2046.999%2031.1266%2046.1286%2034.3708%2044.475H12.8014C16.0456%2046.1286%2019.6405%2046.999%2023.5861%2046.999Z'%20fill='%23FCFCFC'%20fill-opacity='0.6'/%3e%3cpath%20d='M8.76807%2041.9509H38.1411C39.1056%2041.1676%2040.1577%2040.2102%2040.7715%2039.514H6.13765C7.01445%2040.3843%207.89126%2041.2547%208.76807%2041.9509Z'%20fill='%23FCFCFC'%20fill-opacity='0.6'/%3e%3cpath%20d='M25.0767%2034.0307H2.2797C2.80578%2035.0752%203.41955%2036.0326%204.03331%2036.9899H22.5339L25.0767%2034.0307Z'%20fill='%23FCFCFC'%20fill-opacity='0.6'/%3e%3cpath%20d='M23.5861%200C10.6094%200%200%2010.4442%200%2023.4125C0%2026.2846%200.526084%2029.0697%201.49057%2031.5938L10.6094%2020.7144L15.8702%2014.3608L28.6716%2029.679L32.3542%2025.2402L41.999%2036.7288H42.7882C45.5063%2032.8993%2046.9968%2028.2864%2046.9968%2023.3254C47.1722%2010.4442%2036.5628%200%2023.5861%200ZM15.7825%2012.272C13.9412%2012.272%2012.5383%2010.7924%2012.5383%209.05166C12.5383%207.31095%2014.0289%205.83136%2015.7825%205.83136C17.6238%205.83136%2019.0267%207.31095%2019.0267%209.05166C19.0267%2010.7924%2017.6238%2012.272%2015.7825%2012.272ZM32.8803%2022.8032C29.2853%2022.8032%2026.3919%2019.931%2026.3919%2016.3626C26.3919%2012.7942%2029.2853%209.92201%2032.8803%209.92201C36.4752%209.92201%2039.3686%2012.7942%2039.3686%2016.3626C39.4563%2019.931%2036.4752%2022.8032%2032.8803%2022.8032Z'%20fill='%23FCFCFC'%20fill-opacity='0.6'/%3e%3cpath%20d='M16.484%2018.7126V31.6808H27.2687L16.484%2018.7126Z'%20fill='%23FCFCFC'%20fill-opacity='0.6'/%3e%3cpath%20d='M33.1433%2037.164H39.2809L33.1433%2029.766V37.164Z'%20fill='%23FCFCFC'%20fill-opacity='0.6'/%3e%3c/g%3e%3c/svg%3e",cn="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061650925.commit-fa244eb/_assets/name-verified-oGwQ3ntb.svg",dn="#34fee6",pn=s.div`
1
+ import{b as Fe,r as w,j as e,u as Ke}from"./react-BYHuwl8r.js";import{u as Qe}from"./useUrlFilters-DH-gxdfV.js";import{u as Je,S as $e,R as Xe,F as Ye,e as et}from"./categories-D23W_J-A.js";import{c as L,r as tt,bm as nt,bn as st,aA as it,a as ot,s,t,o as Ie,bc as rt,A as at,L as xe,b as n,y as lt,I as E,z as F,c0 as Y,bb as ct,Z as J,br as dt,bq as pt,x as Ae,an as Ne,n as Le,q as ht,ac as xt,ap as ke,aq as G,aG as ft,bL as mt}from"./index-CKUuopSw.js";import{g as ut,h as gt,i as bt,j as yt,k as wt,C as jt,l as vt,o as Ct,m as $t,n as kt,M as St,u as Tt,E as Et,v as _t,p as Rt,q as Mt,r as zt,s as Ft,t as It}from"./Assets.styles-BBWJCcMx.js";import{L as At}from"./LoadMore-jSNRJiwZ.js";import{u as Nt}from"./useInfiniteGrid-BjEQAabI.js";import{E as Lt}from"./ErrorNotice-OUNK486K.js";import{d as Wt}from"./dcl-schemas-CmtP3U6y.js";import{s as Pt,G as Bt,w as Ht,S as Ut}from"./buy-gasless-BfTEWjT9.js";import{s as Ot,k as Gt}from"./buy-BHkfYJLe.js";import{f as Dt}from"./errors-DZ_QWsza.js";import{J as qt,C as Zt,B as fe}from"./ethers-BDpbhgX6.js";import{n as Vt}from"./Tooltip-BDmKiALz.js";import{G as Kt}from"./grid.styles-hOZTJ80g.js";import"./skeleton.styles-BXNXDWEi.js";import"./sentry-Dx-KuLV3.js";import"./intl-CBcMB1D2.js";import"./authorizations-B3AvOvOm.js";import"./sendMetaTransaction-Bp3kwdLJ.js";function D(i){const r=i.source??"item",l=i.tradeId||`${i.contractAddress}-${i.tokenId??i.itemId??""}`;return`${r}:${l}`}const W="100000000000000000000",We=2,X=15,Qt=/^[a-zA-Z0-9]+$/;function Se(i){const r=i.trim();return r.length===0?{ok:!1,reason:"empty"}:Qt.test(r)?r.length<We?{ok:!1,reason:"too-short"}:r.length>X?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Jt(i){return i.replace(/[^a-zA-Z0-9]/g,"").slice(0,X)}const Xt=["function available(string _subdomain) view returns (bool)"],Te={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Yt(){return L.chainId===Number(Wt.ChainId.MATIC_MAINNET)?Te.mainnet:Te.sepolia}async function en(i,r={}){var c;const{rpc:l,address:x}=Yt(),h=new qt(l),d=new Zt(x,Xt,h);console.info(`[names] availability check → DCLRegistrar(${x}).available("${i}") on ${l}`);const p=await d.available(i);if((c=r.signal)!=null&&c.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${i}" available=${p}`),p?"available":"taken"}const tn="https://app.across.to/api";class me extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function nn(i){return it(W,i)}async function sn(i,r,l={}){var c;const x=l.chainId??L.chainId,h=l.provider??"across",d=`${L.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(r)}&chainId=${x}&provider=${h}`,p=await ot(d,{method:"GET",identity:i,metadata:{}});if(!p.ok){let a;try{a=(c=await p.json())==null?void 0:c.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new me:new Error(`fetchNameCreditRoute ${p.status}`)}return p.json()}function on(i,r){const l=fe.from(i.availableAmount),h=fe.from(W).sub(l);return{credits:[{value:i.amount,expiresAt:Number(i.expiresAt),salt:Gt(i.id)}],creditsSignatures:[i.signature],externalCall:{target:r.externalCall.target,selector:r.externalCall.selector,data:r.externalCall.data,expiresAt:r.externalCall.expiresAt,salt:r.externalCall.salt},customExternalCallSignature:r.customExternalCallSignature,maxUncreditedValue:h.isNegative()?"0":h.toString(),maxCreditedValue:W}}async function rn(i,r={}){const l=tn,x=r.intervalMs??1e4,h=r.maxAttempts??60;let d={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let p=0;p<h;p++){try{const c=await fetch(`${l}/deposit/status?originChainId=137&depositTxHash=${i}`);if(c.ok){const a=await c.json(),f=(a.status??"pending").toLowerCase(),g=a.fillTx??a.fillTxnRef??null,u=a.actionsSucceeded!==!1;if(f==="filled")return{status:"filled",destinationTxHash:g,actionsSucceeded:u};if(f==="refunded"||f==="expired")return{status:f,destinationTxHash:null,actionsSucceeded:!1};d={status:"pending",destinationTxHash:g,actionsSucceeded:u}}}catch{}p<h-1&&await new Promise(c=>setTimeout(c,x))}return d}async function an(i){const{name:r,identity:l,signer:x}=i,h=i.chainId??L.chainId,d=i.provider??"across",p=(i.beneficiary??await x.getAddress()).toLowerCase();let c=null,a=!1;console.info("[names] register start",{name:r,buyer:p,chainId:h,provider:d});try{const f=await tt(h),g=nn(f);console.info("[names] step 1/6 sized reservation",{usdCents:g,manaRate:f});const u=await sn(l,r,{chainId:h,provider:d});console.info("[names] step 2/6 route fetched",{target:u.externalCall.target,selector:u.externalCall.selector,provider:u.provider,quoteId:u.quoteId});const v=await nt(l,g);if(c=v.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:v.credit.id,maxCreditedValue:v.maxCreditedValue}),fe.from(v.maxCreditedValue).lt(W))throw new Error("Credit under-sized for the name price");const j=on(v.credit,u);let m;try{m=await Pt({chainId:h,buyer:p,signer:x,args:j})}catch(b){if(!(b instanceof Bt))throw b;m=await Ot(h,j,x)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:m}),await Ht(m),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:m}),d==="across"){const b=await rn(m,i.acrossPoll);if(console.info("[names] step 6/6 across status",b),b.status==="pending")return{status:"pending",originTxHash:m};if(b.status!=="filled"||!b.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:m,destinationTxHash:b.destinationTxHash}}return{status:"pending",originTxHash:m}}catch(f){if(console.error("[names] register failed — raw error:",f,{name:r,buyer:p,originConfirmed:a}),f instanceof Ut)return{status:"pending",originTxHash:f.txHash};if(c&&!a&&await st(l,[c]).catch(()=>{}),f instanceof me)throw f;const g=new Error(Dt(f,"Couldn't register the name. Please try again.",{sale:!0}));throw g.cause=f,g}}const ln="data:image/svg+xml,%3csvg%20preserveAspectRatio='none'%20overflow='visible'%20style='display:%20block;'%20width='46.999'%20height='46.999'%20viewBox='0%200%2046.999%2046.999'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Vector'%3e%3cpath%20d='M23.5861%2046.999C27.4441%2046.999%2031.1266%2046.1286%2034.3708%2044.475H12.8014C16.0456%2046.1286%2019.6405%2046.999%2023.5861%2046.999Z'%20fill='%23FCFCFC'%20fill-opacity='0.6'/%3e%3cpath%20d='M8.76807%2041.9509H38.1411C39.1056%2041.1676%2040.1577%2040.2102%2040.7715%2039.514H6.13765C7.01445%2040.3843%207.89126%2041.2547%208.76807%2041.9509Z'%20fill='%23FCFCFC'%20fill-opacity='0.6'/%3e%3cpath%20d='M25.0767%2034.0307H2.2797C2.80578%2035.0752%203.41955%2036.0326%204.03331%2036.9899H22.5339L25.0767%2034.0307Z'%20fill='%23FCFCFC'%20fill-opacity='0.6'/%3e%3cpath%20d='M23.5861%200C10.6094%200%200%2010.4442%200%2023.4125C0%2026.2846%200.526084%2029.0697%201.49057%2031.5938L10.6094%2020.7144L15.8702%2014.3608L28.6716%2029.679L32.3542%2025.2402L41.999%2036.7288H42.7882C45.5063%2032.8993%2046.9968%2028.2864%2046.9968%2023.3254C47.1722%2010.4442%2036.5628%200%2023.5861%200ZM15.7825%2012.272C13.9412%2012.272%2012.5383%2010.7924%2012.5383%209.05166C12.5383%207.31095%2014.0289%205.83136%2015.7825%205.83136C17.6238%205.83136%2019.0267%207.31095%2019.0267%209.05166C19.0267%2010.7924%2017.6238%2012.272%2015.7825%2012.272ZM32.8803%2022.8032C29.2853%2022.8032%2026.3919%2019.931%2026.3919%2016.3626C26.3919%2012.7942%2029.2853%209.92201%2032.8803%209.92201C36.4752%209.92201%2039.3686%2012.7942%2039.3686%2016.3626C39.4563%2019.931%2036.4752%2022.8032%2032.8803%2022.8032Z'%20fill='%23FCFCFC'%20fill-opacity='0.6'/%3e%3cpath%20d='M16.484%2018.7126V31.6808H27.2687L16.484%2018.7126Z'%20fill='%23FCFCFC'%20fill-opacity='0.6'/%3e%3cpath%20d='M33.1433%2037.164H39.2809L33.1433%2029.766V37.164Z'%20fill='%23FCFCFC'%20fill-opacity='0.6'/%3e%3c/g%3e%3c/svg%3e",cn="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061952187.commit-8d8b09e/_assets/name-verified-oGwQ3ntb.svg",dn="#34fee6",pn=s.div`
2
2
  position: fixed;
3
3
  inset: 0;
4
4
  z-index: 10000;
@@ -422,7 +422,7 @@ import{b as Fe,r as w,j as e,u as Ke}from"./react-BYHuwl8r.js";import{u as Qe}fr
422
422
  color: ${t.colors.accent};
423
423
  }
424
424
  }
425
- `;function In({name:i,priceCredits:r,onClose:l}){const{session:x}=Ie(),{data:h,isError:d}=rt(x),p=at(),c=Fe(),[a,f]=w.useState("confirm"),[g,u]=w.useState(""),[v,j]=w.useState(null),m=w.useRef(!1),b=g.trim().toLowerCase()===i.toLowerCase(),C=a==="completing",$=r!=null?xe(r):"—",k=r==null,T=h==null?void 0:h.credits,I=r!=null&&T!=null?r-T:0,S=I>0,A=k?n("names.priceUnavailable"):S?n("names.insufficientCredits",{credits:xe(I)}):null;w.useEffect(()=>{const y=R=>{R.key==="Escape"&&!C&&l()};document.addEventListener("keydown",y);const _=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",y),document.body.style.overflow=_}},[C,l]);async function P(){if(!(!x||!b||k||S||m.current)){m.current=!0,f("completing"),j(null);try{const y=await an({name:i,identity:x.identity,signer:x.signer});J("Shop Completed Purchase",{purchase_type:"name",is_primary:!0,payment_type:"credits",value_credits:r??null,settlement:y.status}),p.invalidateQueries({queryKey:["usd-balance"]}),p.invalidateQueries({queryKey:["my-assets"]}),f(y.status==="registered"?"success":"pending")}catch(y){J(pt(y)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:dt(y),purchase_type:"name"}),j(y instanceof me?n("names.errorRouteCost"):(y==null?void 0:y.message)||n("names.errorGeneric")),f("error")}finally{m.current=!1}}}const B=a!=="success"&&a!=="pending",M=lt(x==null?void 0:x.providerType);return e.jsx(pn,{onClick:C?void 0:l,role:"presentation",children:e.jsxs(hn,{role:"dialog","aria-modal":"true","aria-label":n("names.buyTitle"),onClick:y=>y.stopPropagation(),children:[B&&e.jsxs(e.Fragment,{children:[e.jsxs(ee,{children:[e.jsx(te,{children:a==="error"?n("names.errorTitle"):n("names.buyTitle")}),e.jsx(ne,{onClick:l,disabled:C,"aria-label":n("buyModal.close"),children:e.jsx(E,{name:"close"})})]}),e.jsxs(se,{children:[n("names.myCreditsBalance")," ",e.jsx(F,{})," ",Y(h,d)]}),e.jsx(ie,{})]}),(a==="confirm"||a==="error")&&e.jsxs(e.Fragment,{children:[e.jsxs(oe,{children:[e.jsx(Ee,{"aria-hidden":!0,children:"@"}),e.jsxs(re,{children:[e.jsxs(ae,{children:[i,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(le,{children:n("names.subtitle")})]}),e.jsxs(ce,{children:[e.jsx(F,{}),$]})]}),a==="error"?e.jsxs(e.Fragment,{children:[e.jsxs(de,{children:[e.jsx(E,{name:"info","aria-hidden":!0}),e.jsx("span",{children:v})]}),e.jsx(_e,{onClick:()=>f("confirm"),children:n("names.tryAgain")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(gn,{children:[e.jsx(bn,{children:n("names.confirmTitle")}),e.jsx(yn,{dangerouslySetInnerHTML:{__html:n("names.confirmBody",{name:`<b>@${An(i)}</b>`})}}),e.jsxs(wn,{children:[e.jsx(jn,{"aria-hidden":!0,children:"@"}),e.jsx(vn,{value:g,onChange:y=>u(y.target.value.replace(/[^a-zA-Z0-9]/g,"")),placeholder:"yourname","aria-label":n("names.reenterAria"),autoComplete:"off",spellCheck:!1,style:{width:`${Math.max(g.length,8)}ch`}}),e.jsx(Cn,{children:".dcl.eth"})]})]}),A?e.jsxs(de,{"data-tone":"info","data-testid":"name-blocked-reason",children:[e.jsx(E,{name:"info","aria-hidden":!0}),e.jsx("span",{children:A})]}):null,e.jsx(_e,{onClick:()=>void P(),disabled:!b||!x||k||S,children:n("names.buyCta")})]})]}),a==="completing"&&e.jsxs($n,{children:[e.jsx(kn,{src:ct,alt:"",width:56,height:56}),e.jsx(Sn,{children:M?n("names.confirming"):n("names.completing")}),e.jsxs(Tn,{children:[e.jsx(En,{"aria-hidden":!0,children:e.jsx("span",{})}),e.jsx(_n,{children:"1/1"})]})]}),a==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(ee,{children:[e.jsx(te,{children:n("names.pendingHeaderTitle")}),e.jsx(ne,{onClick:l,"aria-label":n("buyModal.close"),children:e.jsx(E,{name:"close"})})]}),e.jsxs(se,{children:[n("names.myCreditsBalance")," ",e.jsx(F,{})," ",Y(h,d)]}),e.jsx(ie,{}),e.jsxs(de,{"data-tone":"info",children:[e.jsx(E,{name:"info","aria-hidden":!0}),e.jsxs("span",{children:[e.jsx("b",{children:n("names.pendingBannerBold")})," ",n("names.pendingBannerRest")]})]}),e.jsxs(oe,{style:{marginTop:20},children:[e.jsx(Ee,{"aria-hidden":!0,children:"@"}),e.jsxs(re,{children:[e.jsxs(ae,{children:[i,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(le,{children:n("names.subtitle")})]}),e.jsxs(ce,{children:[e.jsx(F,{}),$]})]}),e.jsx(Re,{children:e.jsx(Me,{onClick:()=>{l(),c("/my-items")},children:n("names.myItems")})})]}),a==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs(ee,{children:[e.jsx(te,{children:n("names.successHeaderTitle")}),e.jsx(ne,{onClick:l,"aria-label":n("buyModal.close"),children:e.jsx(E,{name:"close"})})]}),e.jsxs(se,{children:[n("names.myCreditsBalance")," ",e.jsx(F,{})," ",Y(h,d)]}),e.jsx(ie,{}),e.jsxs(Rn,{children:[e.jsx(Mn,{"aria-hidden":!0,children:e.jsx(E,{name:"check"})}),e.jsxs(zn,{children:[e.jsx("b",{children:n("names.successBannerBold")})," ",n("names.successBannerRest")]})]}),e.jsxs(oe,{style:{marginTop:20},children:[e.jsxs(xn,{"data-testid":"name-success-tile",children:[e.jsx(fn,{src:ln,alt:"","aria-hidden":!0,width:47,height:47}),e.jsxs(mn,{children:[e.jsx("span",{"aria-hidden":!0,children:i}),e.jsx(un,{src:cn,alt:"","aria-hidden":!0,width:14,height:14})]})]}),e.jsxs(re,{children:[e.jsxs(ae,{children:[i,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(le,{children:n("names.subtitle")})]}),e.jsxs(ce,{children:[e.jsx(F,{}),$]})]}),e.jsxs(Re,{children:[e.jsx(Me,{onClick:()=>{l(),c("/my-items")},children:n("names.myItems")}),e.jsx(Fn,{href:L.profileUrl,target:"_blank",rel:"noopener noreferrer",children:n("names.assignToAvatar")})]})]})]})})}function An(i){return i.replace(/[&<>"']/g,r=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[r])}const Nn="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061650925.commit-fa244eb/_assets/identity-B4DXDuJP.webp",Ln="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061650925.commit-fa244eb/_assets/world-B-9aPlxu.webp",Wn="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061650925.commit-fa244eb/_assets/invite-BfwIhP2C.webp",Pn="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061650925.commit-fa244eb/_assets/governance-DnazlIjy.webp",Bn=s.div`
425
+ `;function In({name:i,priceCredits:r,onClose:l}){const{session:x}=Ie(),{data:h,isError:d}=rt(x),p=at(),c=Fe(),[a,f]=w.useState("confirm"),[g,u]=w.useState(""),[v,j]=w.useState(null),m=w.useRef(!1),b=g.trim().toLowerCase()===i.toLowerCase(),C=a==="completing",$=r!=null?xe(r):"—",k=r==null,T=h==null?void 0:h.credits,I=r!=null&&T!=null?r-T:0,S=I>0,A=k?n("names.priceUnavailable"):S?n("names.insufficientCredits",{credits:xe(I)}):null;w.useEffect(()=>{const y=R=>{R.key==="Escape"&&!C&&l()};document.addEventListener("keydown",y);const _=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",y),document.body.style.overflow=_}},[C,l]);async function P(){if(!(!x||!b||k||S||m.current)){m.current=!0,f("completing"),j(null);try{const y=await an({name:i,identity:x.identity,signer:x.signer});J("Shop Completed Purchase",{purchase_type:"name",is_primary:!0,payment_type:"credits",value_credits:r??null,settlement:y.status}),p.invalidateQueries({queryKey:["usd-balance"]}),p.invalidateQueries({queryKey:["my-assets"]}),f(y.status==="registered"?"success":"pending")}catch(y){J(pt(y)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:dt(y),purchase_type:"name"}),j(y instanceof me?n("names.errorRouteCost"):(y==null?void 0:y.message)||n("names.errorGeneric")),f("error")}finally{m.current=!1}}}const B=a!=="success"&&a!=="pending",M=lt(x==null?void 0:x.providerType);return e.jsx(pn,{onClick:C?void 0:l,role:"presentation",children:e.jsxs(hn,{role:"dialog","aria-modal":"true","aria-label":n("names.buyTitle"),onClick:y=>y.stopPropagation(),children:[B&&e.jsxs(e.Fragment,{children:[e.jsxs(ee,{children:[e.jsx(te,{children:a==="error"?n("names.errorTitle"):n("names.buyTitle")}),e.jsx(ne,{onClick:l,disabled:C,"aria-label":n("buyModal.close"),children:e.jsx(E,{name:"close"})})]}),e.jsxs(se,{children:[n("names.myCreditsBalance")," ",e.jsx(F,{})," ",Y(h,d)]}),e.jsx(ie,{})]}),(a==="confirm"||a==="error")&&e.jsxs(e.Fragment,{children:[e.jsxs(oe,{children:[e.jsx(Ee,{"aria-hidden":!0,children:"@"}),e.jsxs(re,{children:[e.jsxs(ae,{children:[i,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(le,{children:n("names.subtitle")})]}),e.jsxs(ce,{children:[e.jsx(F,{}),$]})]}),a==="error"?e.jsxs(e.Fragment,{children:[e.jsxs(de,{children:[e.jsx(E,{name:"info","aria-hidden":!0}),e.jsx("span",{children:v})]}),e.jsx(_e,{onClick:()=>f("confirm"),children:n("names.tryAgain")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(gn,{children:[e.jsx(bn,{children:n("names.confirmTitle")}),e.jsx(yn,{dangerouslySetInnerHTML:{__html:n("names.confirmBody",{name:`<b>@${An(i)}</b>`})}}),e.jsxs(wn,{children:[e.jsx(jn,{"aria-hidden":!0,children:"@"}),e.jsx(vn,{value:g,onChange:y=>u(y.target.value.replace(/[^a-zA-Z0-9]/g,"")),placeholder:"yourname","aria-label":n("names.reenterAria"),autoComplete:"off",spellCheck:!1,style:{width:`${Math.max(g.length,8)}ch`}}),e.jsx(Cn,{children:".dcl.eth"})]})]}),A?e.jsxs(de,{"data-tone":"info","data-testid":"name-blocked-reason",children:[e.jsx(E,{name:"info","aria-hidden":!0}),e.jsx("span",{children:A})]}):null,e.jsx(_e,{onClick:()=>void P(),disabled:!b||!x||k||S,children:n("names.buyCta")})]})]}),a==="completing"&&e.jsxs($n,{children:[e.jsx(kn,{src:ct,alt:"",width:56,height:56}),e.jsx(Sn,{children:M?n("names.confirming"):n("names.completing")}),e.jsxs(Tn,{children:[e.jsx(En,{"aria-hidden":!0,children:e.jsx("span",{})}),e.jsx(_n,{children:"1/1"})]})]}),a==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(ee,{children:[e.jsx(te,{children:n("names.pendingHeaderTitle")}),e.jsx(ne,{onClick:l,"aria-label":n("buyModal.close"),children:e.jsx(E,{name:"close"})})]}),e.jsxs(se,{children:[n("names.myCreditsBalance")," ",e.jsx(F,{})," ",Y(h,d)]}),e.jsx(ie,{}),e.jsxs(de,{"data-tone":"info",children:[e.jsx(E,{name:"info","aria-hidden":!0}),e.jsxs("span",{children:[e.jsx("b",{children:n("names.pendingBannerBold")})," ",n("names.pendingBannerRest")]})]}),e.jsxs(oe,{style:{marginTop:20},children:[e.jsx(Ee,{"aria-hidden":!0,children:"@"}),e.jsxs(re,{children:[e.jsxs(ae,{children:[i,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(le,{children:n("names.subtitle")})]}),e.jsxs(ce,{children:[e.jsx(F,{}),$]})]}),e.jsx(Re,{children:e.jsx(Me,{onClick:()=>{l(),c("/my-items")},children:n("names.myItems")})})]}),a==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs(ee,{children:[e.jsx(te,{children:n("names.successHeaderTitle")}),e.jsx(ne,{onClick:l,"aria-label":n("buyModal.close"),children:e.jsx(E,{name:"close"})})]}),e.jsxs(se,{children:[n("names.myCreditsBalance")," ",e.jsx(F,{})," ",Y(h,d)]}),e.jsx(ie,{}),e.jsxs(Rn,{children:[e.jsx(Mn,{"aria-hidden":!0,children:e.jsx(E,{name:"check"})}),e.jsxs(zn,{children:[e.jsx("b",{children:n("names.successBannerBold")})," ",n("names.successBannerRest")]})]}),e.jsxs(oe,{style:{marginTop:20},children:[e.jsxs(xn,{"data-testid":"name-success-tile",children:[e.jsx(fn,{src:ln,alt:"","aria-hidden":!0,width:47,height:47}),e.jsxs(mn,{children:[e.jsx("span",{"aria-hidden":!0,children:i}),e.jsx(un,{src:cn,alt:"","aria-hidden":!0,width:14,height:14})]})]}),e.jsxs(re,{children:[e.jsxs(ae,{children:[i,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(le,{children:n("names.subtitle")})]}),e.jsxs(ce,{children:[e.jsx(F,{}),$]})]}),e.jsxs(Re,{children:[e.jsx(Me,{onClick:()=>{l(),c("/my-items")},children:n("names.myItems")}),e.jsx(Fn,{href:L.profileUrl,target:"_blank",rel:"noopener noreferrer",children:n("names.assignToAvatar")})]})]})]})})}function An(i){return i.replace(/[&<>"']/g,r=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[r])}const Nn="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061952187.commit-8d8b09e/_assets/identity-B4DXDuJP.webp",Ln="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061952187.commit-8d8b09e/_assets/world-B-9aPlxu.webp",Wn="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061952187.commit-8d8b09e/_assets/invite-BfwIhP2C.webp",Pn="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061952187.commit-8d8b09e/_assets/governance-DnazlIjy.webp",Bn=s.div`
426
426
  width: 100%;
427
427
  min-width: 0;
428
428
  `,Hn=s.nav`
@@ -1,4 +1,4 @@
1
- import{r as w,j as i}from"./react-BYHuwl8r.js";import{C as _,R as T,a as le,b as de}from"./categories-Bjf-PXbG.js";import{n as d,T as ce}from"./Tooltip-BBYuQHQb.js";import{s as t,t as e,I as k,b as a,an as E,C as F}from"./index-D7dTUoYt.js";const pe=t.div`
1
+ import{r as w,j as i}from"./react-BYHuwl8r.js";import{C as _,R as T,a as le,b as de}from"./categories-D23W_J-A.js";import{n as d,T as ce}from"./Tooltip-BDmKiALz.js";import{s as t,t as e,I as k,b as a,ac as E,C as F}from"./index-CKUuopSw.js";const pe=t.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 12px;
@@ -1,4 +1,4 @@
1
- import{j as i,L as _,r as F}from"./react-BYHuwl8r.js";import{t as o,s as n,B as G,w as N,x as P,b as e,o as B,y as O,I as z,z as K,v as w,A as H,c as Q,D as X,E as A,F as Z,G as J,H as E}from"./index-D7dTUoYt.js";import{c as U,d as V,b as Y,e as tt,s as it,a as et}from"./authorizations-CbXH-W_L.js";import{f as ot}from"./builder-CVMQir9d.js";import{m as at}from"./mana-matic-C4e1sNO3.js";import{f as nt}from"./errors-BXmP5k3l.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-De85nOcx.js";const st=N`
1
+ import{j as i,L as _,r as F}from"./react-BYHuwl8r.js";import{t as o,s as n,B as G,w as N,x as P,b as e,o as B,y as O,I as z,z as K,v as w,A as H,c as Q,D as X,E as A,F as Z,G as J,H as E}from"./index-CKUuopSw.js";import{c as U,d as V,b as Y,e as tt,s as it,a as et}from"./authorizations-B3AvOvOm.js";import{f as ot}from"./builder-DxumJmKw.js";import{m as at}from"./mana-matic-C4e1sNO3.js";import{f as nt}from"./errors-DZ_QWsza.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-Bp3kwdLJ.js";const st=N`
2
2
  to { transform: rotate(360deg); }
3
3
  `,rt=N`
4
4
  to { background-position: -200% 0; }
@@ -1,4 +1,4 @@
1
- import{j as t,L as ke,r as P,b as Xt,a as Zt}from"./react-BYHuwl8r.js";import{t as de,s as i,b as a,L as ce,bd as ea,J as ta,I as H,z as St,K as Le,x as aa,Y as Q,ao as ot,o as sa,q as na,v as ia,be as ra,A as oa,bf as ca,ap as da,bg as la,bh as ct,bi as ua,bj as ha,y as pa,bk as dt,$ as G,bl as lt,bm as ga,F as ae,r as ma,c as ut,bn as xa,C as fa,bo as ht,bp as Re,bq as ya,br as xe,bs as fe,bt as pt,g as ye,f as ba,h as qe,bu as va}from"./index-D7dTUoYt.js";import{M as wa,S as Ca,C as ja,H as ka,a as Sa,T as $a,X as Ta,b as Ma,B as Ia,c as Pa,d as gt,e as za,f as Ce,P as $t,m as Aa,g as Ea,h as Ra,i as qa,j as Tt,k as je,L as Ba,l as _a,n as mt,o as xt,W as Fa,p as Wa,q as La,A as Ka,r as Na,s as Ua,t as Qa,u as Ha,v as Oa,w as Ga,x as Va,y as Da,z as Ya,D as Ja,E as Xa,F as Za,G as es,I as ts,J as as,K as ss,N as Be,O as ns,Q as is,R as rs,U as os,V as ft,Y as yt,Z as cs,_ as ds,$ as ls}from"./CollectionCarousel-BkFV4le7.js";import{k as us,l as hs,a as ps,n as gs,f as ms,A as xs}from"./authorizations-CbXH-W_L.js";import{g as fs,j as _e}from"./buy-BllmT-mt.js";import{b as ys,w as bs,S as bt,G as vs}from"./buy-gasless-BuzErI_K.js";import{u as ws,M as Cs,R as be,r as js,c as ks,p as vt}from"./useCreditPacks-DQxqJepP.js";import{i as Ss,a as $s}from"./errors-BXmP5k3l.js";import{E as Ts}from"./ErrorNotice-CCsvrT3H.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-De85nOcx.js";const{colors:se,radius:Ms}=de,Is=i.div`
1
+ import{j as t,L as ke,r as P,b as Yt,a as Zt}from"./react-BYHuwl8r.js";import{t as de,s as i,b as a,L as ce,bb as ea,J as ta,I as H,z as St,K as Le,x as aa,X as Q,am as ot,o as sa,q as na,v as ia,bc as ra,A as oa,bd as ca,an as da,be as la,bf as ct,bg as ua,bh as ha,y as pa,bi as dt,Z as G,bj as lt,bk as ga,F as ae,r as ma,c as ut,bl as xa,C as fa,bm as ht,bn as Re,bo as ya,bp as xe,bq as fe,br as pt,g as ye,f as ba,h as qe,bs as va}from"./index-CKUuopSw.js";import{M as wa,S as Ca,C as ja,H as ka,a as Sa,T as $a,X as Ta,b as Ma,B as Ia,c as Pa,d as gt,e as za,f as Ce,P as $t,m as Aa,g as Ea,h as Ra,i as qa,j as Tt,k as je,L as Ba,l as _a,n as mt,o as xt,W as Fa,p as Wa,q as La,A as Ka,r as Na,s as Ua,t as Qa,u as Ha,v as Oa,w as Ga,x as Va,y as Da,z as Ja,D as Xa,E as Ya,F as Za,G as es,I as ts,J as as,K as ss,N as Be,O as ns,Q as is,R as rs,U as os,V as ft,Y as yt,Z as cs,_ as ds,$ as ls}from"./CollectionCarousel-B9HmGuVb.js";import{k as us,l as hs,a as ps,n as gs,f as ms,A as xs}from"./authorizations-B3AvOvOm.js";import{g as fs,j as _e}from"./buy-BHkfYJLe.js";import{b as ys,w as bs,S as bt,G as vs}from"./buy-gasless-BfTEWjT9.js";import{u as ws,M as Cs,R as be,r as js,c as ks,p as vt}from"./useCreditPacks-BcavayJ3.js";import{i as Ss,a as $s}from"./errors-DZ_QWsza.js";import{E as Ts}from"./ErrorNotice-OUNK486K.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-Bp3kwdLJ.js";const{colors:se,radius:Ms}=de,Is=i.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
@@ -58,7 +58,7 @@ import{j as t,L as ke,r as P,b as Xt,a as Zt}from"./react-BYHuwl8r.js";import{t
58
58
  font-weight: 700;
59
59
  color: ${se.text};
60
60
  }
61
- `,Rs="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061650925.commit-fa244eb/_assets/buy-error-22UunaPC.png";function qs(o){const{phase:l,balanceCredits:I,onClose:z}=o,F=l==="processing",V=l==="error"?a("cartCheckout.errorTitle"):l==="nofunds"?a("cartCheckout.titleNoFunds"):l==="choose"?a("buyModal.choosePayment"):a("cartCheckout.titleBuy"),D=l==="processing";return t.jsxs(wa,{role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[t.jsx(Ca,{onClick:F?void 0:z,"aria-hidden":!0}),t.jsxs(ja,{"data-tall":D||void 0,children:[t.jsxs(ka,{children:[t.jsxs(Sa,{children:[t.jsx($a,{children:V}),!F&&t.jsx(Ta,{onClick:z,"aria-label":a("buyModal.close"),children:t.jsx(Ma,{})})]}),t.jsxs(Ia,{children:[t.jsx(Pa,{children:l==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),t.jsx(gt,{}),t.jsx(za,{children:ce(I)})]})]}),l==="choose"&&t.jsxs(Ce,{children:[t.jsxs(Es,{children:[t.jsx("span",{children:a("cart.purchaseSummary")}),t.jsxs("strong",{children:[t.jsx(gt,{}),ce(o.totalCredits??0)]})]}),t.jsx($t,{options:o.options??[],totalCents:o.totalCents??0,onPay:o.onPay??(()=>{}),rateNote:(()=>{const A=Aa(o.totalCents??0,o.totalManaWei??0n);return A!=null?a("buyModal.manaRate",{mana:A.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),l==="processing"&&t.jsx(Bs,{stage:o.stage??"reserving",step:o.step??1,total:o.total??1,isSelfCustody:!!o.isSelfCustody,signatures:o.signatures}),l==="nofunds"&&t.jsx(_s,{lines:o.lines??[],shortfallCredits:o.shortfallCredits??0,packs:o.packs??[],selectedPack:o.selectedPack??"",onSelectPack:o.onSelectPack??(()=>{}),onBuyPacks:o.onBuyPacks??(()=>{}),onCancel:z}),l==="error"&&t.jsxs(Ce,{children:[t.jsxs(Ea,{"data-testid":"buy-error",children:[t.jsx(Ra,{src:Rs,alt:"",width:64,height:80}),t.jsxs(qa,{children:[t.jsx("b",{children:a("cartCheckout.errorHeadline")})," ",o.message??a("cartCheckout.errorBody")]})]}),t.jsxs(Tt,{children:[t.jsx(je,{"data-variant":"outline",onClick:z,children:a("buyModal.cancel")}),t.jsx(je,{"data-variant":"purple",onClick:o.onRetry??z,children:a("cartCheckout.tryAgain")})]})]})]})]})}function Bs({stage:o,step:l,total:I,isSelfCustody:z,signatures:F}){const V=o==="reserving",D=I>0?Math.min(100,Math.round(l/I*100)):0,A=z&&F&&F.total>1,ne=o==="awaiting-signature"?z?A?a("cartCheckout.confirmMultiple",{current:F.current,total:F.total}):a("buyModal.confirmToContinue"):a("buyModal.completingTransaction"):o==="settling"?a("buyModal.completingTransaction"):a("cartCheckout.preparing");return t.jsxs(Ce,{"data-processing":!0,children:[t.jsx(Ba,{src:ea,alt:"",width:61,height:61}),t.jsx(_a,{children:ne}),V?t.jsxs(Is,{children:[t.jsx(mt,{"aria-hidden":!0,children:t.jsx(xt,{"data-step":!0,style:{width:`${D}%`}})}),I>1?t.jsxs(Ps,{children:[l,"/",I]}):null]}):t.jsx(mt,{"aria-hidden":!0,children:t.jsx(xt,{})})]})}function _s({lines:o,shortfallCredits:l,packs:I,selectedPack:z,onSelectPack:F,onBuyPacks:V,onCancel:D}){const A=I.find(n=>n.id===z),ne=o.reduce((n,L)=>n+(L.quantity??1),0);return t.jsxs(Ce,{children:[t.jsxs(Fa,{"data-testid":"nofunds-warning",children:[t.jsx(Wa,{}),t.jsxs(La,{children:[t.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",t.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,l)})})," ",a("buyModal.warningToPurchase",{count:ne})]})]}),t.jsx(zs,{children:o.map(n=>{const L=n.quantity??1;return t.jsxs(Ka,{children:[t.jsx(Na,{children:n.item.thumbnail?t.jsx("img",{src:n.item.thumbnail,alt:""}):null}),t.jsxs(Ua,{children:[t.jsxs("div",{children:[t.jsxs(Qa,{title:n.item.name,children:[n.item.name||a("buyModal.itemFallback"),L>1?t.jsx(As,{children:a("cartCheckout.qty",{count:L})}):null]}),n.item.creator?t.jsx(Ha,{address:n.item.creator}):null]}),t.jsxs(Oa,{children:[t.jsx(Ga,{}),t.jsx("span",{children:ce(n.priceCredits*L)})]})]})]},n.item.id)})}),t.jsx(Va,{children:I.map(n=>{const L=n.id===z;return t.jsxs(Da,{"data-testid":"credit-pack","data-on":L||void 0,onClick:()=>F(n.id),children:[t.jsx(Ya,{src:Ja,alt:""}),t.jsx(Xa,{children:ce(n.credits)}),t.jsxs(Za,{children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),t.jsxs(es,{children:[t.jsxs(ts,{children:[t.jsx(as,{}),t.jsx("span",{children:ce((A==null?void 0:A.credits)??0)})]}),t.jsxs(ss,{children:["$",((A==null?void 0:A.usd)??0).toFixed(2)]})]}),t.jsxs(Tt,{children:[t.jsx(je,{"data-variant":"outline",onClick:D,children:a("buyModal.cancel")}),t.jsx(je,{"data-variant":"gradient",onClick:V,children:a("buyModal.buy")})]})]})}const{colors:r,gradients:Fs,radius:Z}=de,Mt="@media (max-width: 1080px)",M="@media (max-width: 880px)",wt=i.div`
61
+ `,Rs="https://cdn.decentraland.org/@dcl/shop/1.0.2-31061952187.commit-8d8b09e/_assets/buy-error-22UunaPC.png";function qs(o){const{phase:l,balanceCredits:I,onClose:z}=o,F=l==="processing",V=l==="error"?a("cartCheckout.errorTitle"):l==="nofunds"?a("cartCheckout.titleNoFunds"):l==="choose"?a("buyModal.choosePayment"):a("cartCheckout.titleBuy"),D=l==="processing";return t.jsxs(wa,{role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[t.jsx(Ca,{onClick:F?void 0:z,"aria-hidden":!0}),t.jsxs(ja,{"data-tall":D||void 0,children:[t.jsxs(ka,{children:[t.jsxs(Sa,{children:[t.jsx($a,{children:V}),!F&&t.jsx(Ta,{onClick:z,"aria-label":a("buyModal.close"),children:t.jsx(Ma,{})})]}),t.jsxs(Ia,{children:[t.jsx(Pa,{children:l==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),t.jsx(gt,{}),t.jsx(za,{children:ce(I)})]})]}),l==="choose"&&t.jsxs(Ce,{children:[t.jsxs(Es,{children:[t.jsx("span",{children:a("cart.purchaseSummary")}),t.jsxs("strong",{children:[t.jsx(gt,{}),ce(o.totalCredits??0)]})]}),t.jsx($t,{options:o.options??[],totalCents:o.totalCents??0,onPay:o.onPay??(()=>{}),rateNote:(()=>{const A=Aa(o.totalCents??0,o.totalManaWei??0n);return A!=null?a("buyModal.manaRate",{mana:A.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),l==="processing"&&t.jsx(Bs,{stage:o.stage??"reserving",step:o.step??1,total:o.total??1,isSelfCustody:!!o.isSelfCustody,signatures:o.signatures}),l==="nofunds"&&t.jsx(_s,{lines:o.lines??[],shortfallCredits:o.shortfallCredits??0,packs:o.packs??[],selectedPack:o.selectedPack??"",onSelectPack:o.onSelectPack??(()=>{}),onBuyPacks:o.onBuyPacks??(()=>{}),onCancel:z}),l==="error"&&t.jsxs(Ce,{children:[t.jsxs(Ea,{"data-testid":"buy-error",children:[t.jsx(Ra,{src:Rs,alt:"",width:64,height:80}),t.jsxs(qa,{children:[t.jsx("b",{children:a("cartCheckout.errorHeadline")})," ",o.message??a("cartCheckout.errorBody")]})]}),t.jsxs(Tt,{children:[t.jsx(je,{"data-variant":"outline",onClick:z,children:a("buyModal.cancel")}),t.jsx(je,{"data-variant":"purple",onClick:o.onRetry??z,children:a("cartCheckout.tryAgain")})]})]})]})]})}function Bs({stage:o,step:l,total:I,isSelfCustody:z,signatures:F}){const V=o==="reserving",D=I>0?Math.min(100,Math.round(l/I*100)):0,A=z&&F&&F.total>1,ne=o==="awaiting-signature"?z?A?a("cartCheckout.confirmMultiple",{current:F.current,total:F.total}):a("buyModal.confirmToContinue"):a("buyModal.completingTransaction"):o==="settling"?a("buyModal.completingTransaction"):a("cartCheckout.preparing");return t.jsxs(Ce,{"data-processing":!0,children:[t.jsx(Ba,{src:ea,alt:"",width:61,height:61}),t.jsx(_a,{children:ne}),V?t.jsxs(Is,{children:[t.jsx(mt,{"aria-hidden":!0,children:t.jsx(xt,{"data-step":!0,style:{width:`${D}%`}})}),I>1?t.jsxs(Ps,{children:[l,"/",I]}):null]}):t.jsx(mt,{"aria-hidden":!0,children:t.jsx(xt,{})})]})}function _s({lines:o,shortfallCredits:l,packs:I,selectedPack:z,onSelectPack:F,onBuyPacks:V,onCancel:D}){const A=I.find(n=>n.id===z),ne=o.reduce((n,L)=>n+(L.quantity??1),0);return t.jsxs(Ce,{children:[t.jsxs(Fa,{"data-testid":"nofunds-warning",children:[t.jsx(Wa,{}),t.jsxs(La,{children:[t.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",t.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,l)})})," ",a("buyModal.warningToPurchase",{count:ne})]})]}),t.jsx(zs,{children:o.map(n=>{const L=n.quantity??1;return t.jsxs(Ka,{children:[t.jsx(Na,{children:n.item.thumbnail?t.jsx("img",{src:n.item.thumbnail,alt:""}):null}),t.jsxs(Ua,{children:[t.jsxs("div",{children:[t.jsxs(Qa,{title:n.item.name,children:[n.item.name||a("buyModal.itemFallback"),L>1?t.jsx(As,{children:a("cartCheckout.qty",{count:L})}):null]}),n.item.creator?t.jsx(Ha,{address:n.item.creator}):null]}),t.jsxs(Oa,{children:[t.jsx(Ga,{}),t.jsx("span",{children:ce(n.priceCredits*L)})]})]})]},n.item.id)})}),t.jsx(Va,{children:I.map(n=>{const L=n.id===z;return t.jsxs(Da,{"data-testid":"credit-pack","data-on":L||void 0,onClick:()=>F(n.id),children:[t.jsx(Ja,{src:Xa,alt:""}),t.jsx(Ya,{children:ce(n.credits)}),t.jsxs(Za,{children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),t.jsxs(es,{children:[t.jsxs(ts,{children:[t.jsx(as,{}),t.jsx("span",{children:ce((A==null?void 0:A.credits)??0)})]}),t.jsxs(ss,{children:["$",((A==null?void 0:A.usd)??0).toFixed(2)]})]}),t.jsxs(Tt,{children:[t.jsx(je,{"data-variant":"outline",onClick:D,children:a("buyModal.cancel")}),t.jsx(je,{"data-variant":"gradient",onClick:V,children:a("buyModal.buy")})]})]})}const{colors:r,gradients:Fs,radius:Z}=de,Mt="@media (max-width: 1080px)",M="@media (max-width: 880px)",wt=i.div`
62
62
  max-width: 1510px;
63
63
  margin: 0 auto;
64
64
  /* Grows into the page's leftover height and passes it down to Upsell, so the white cross-sell band ends at
@@ -308,11 +308,11 @@ import{j as t,L as ke,r as P,b as Xt,a as Zt}from"./react-BYHuwl8r.js";import{t
308
308
  padding: 0 10px;
309
309
  font-size: 12px;
310
310
  }
311
- `,Ys=i.div`
311
+ `,Js=i.div`
312
312
  display: flex;
313
313
  flex-direction: column;
314
314
  gap: 24px;
315
- `,Js=i.div`
315
+ `,Xs=i.div`
316
316
  position: relative;
317
317
  display: flex;
318
318
  align-items: stretch;
@@ -331,7 +331,7 @@ import{j as t,L as ke,r as P,b as Xt,a as Zt}from"./react-BYHuwl8r.js";import{t
331
331
  &[data-unavailable] [data-desc] {
332
332
  opacity: 0.7;
333
333
  }
334
- `,Xs=i.div`
334
+ `,Ys=i.div`
335
335
  position: relative;
336
336
  flex-shrink: 0;
337
337
  width: 137.5px;
@@ -703,4 +703,4 @@ import{j as t,L as ke,r as P,b as Xt,a as Zt}from"./react-BYHuwl8r.js";import{t
703
703
  & section {
704
704
  margin-top: 0;
705
705
  }
706
- `;function Fe(o){if(Ss(o))return a("errors.rejected");const l=(o.message??"").toLowerCase();return l.includes("insufficient")?a("cart.error.insufficient",{currency:fa.name}):l.includes("no active listing")||l.includes("your own listing")?a("cart.error.listingChanged"):a("marketCheckout.error.generic")}const An=12e4;function En(o){const l=[];return o.unavailable.length&&l.push(a("cart.drop.unavailable",{count:o.unavailable.length})),o.own.length&&l.push(a("cart.drop.own",{count:o.own.length})),a("cart.drop.removed",{items:l.join(` ${a("cart.drop.and")} `)})}const We=o=>o.reduce((l,I)=>l+I.priceCredits*I.quantity,0),we=o=>o.flatMap(l=>Array.from({length:l.quantity},()=>({...l,quantity:1})));function Vn(){aa({title:a("nav.cart"),noindex:!0});const o=Q(e=>e.items),l=Q(e=>e.remove),I=Q(e=>e.increment),z=Q(e=>e.decrement),F=Q(e=>e.clear),V=Q(e=>e.restore),D=Q(e=>e.setFittingOpen),A=ot(e=>e.items),ne=ot(e=>e.toggle),{session:n,signIn:L}=sa(),Et=na(),le=ws().packs.slice(0,Cs);P.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const Rt=o.some(e=>e.category!=="emote"),{data:Se}=ia({queryKey:["upsell-listings"],queryFn:()=>va({first:40}),staleTime:6e4}),{data:S}=ra(n),v=oa(),ee=Xt(),{state:Y}=Zt(),[qt,ie]=P.useState(null),[Ke,ue]=P.useState(null),[Bt,q]=P.useState(!1),[B,O]=P.useState(null),Ne=P.useRef(0),[g,j]=P.useState(null),{data:he}=ca(n),{data:re}=da(!0),[$e,Ue]=P.useState(""),oe=P.useRef(null),Qe=la(o),He=e=>dt(Qe[e.id]),Te=o.filter(He),Oe=o.length>0&&Te.length===0,_t=Te.reduce((e,s)=>e+s.priceCredits*s.quantity,0),Ft=o.reduce((e,s)=>e+s.quantity,0),Wt=Te.reduce((e,s)=>e+s.quantity,0),Ge=B?B.liveTotalCredits:_t,Lt=new Set(o.map(e=>e.id)),Ve=((Se==null?void 0:Se.items)??[]).filter(e=>!Lt.has(e.id)).slice(0,12),Kt=new Map(B==null?void 0:B.buyable.map(e=>[e.item.id,e])),pe=(S==null?void 0:S.credits)??0,Me=Ge*10,Nt=re?ct(Me,re):0n,Ie=Be({priceCents:Me,priceManaWei:Nt,balanceCents:(S==null?void 0:S.balanceCents)??0,manaBalanceWei:he??0n}),Ut=e=>e.some(s=>s.acquisition==="store"),Pe=e=>e.flatMap(s=>s.acquisition==="trade"?[s]:[]),Qt=ga,Ht=e=>xa(e.contractAddress,String(e.itemId));function ge(e){e(),O(null),ue(null),ie(null)}function Ot(){j(null),q(!1)}function De(e){const s=We(e),d=Math.max(0,s-pe),c=le.find(u=>u.credits>=d)??le[le.length-1];Ue(c.id),G("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:s,credits_balance:pe,shortfall:d}),j({phase:"nofunds",lines:e.map(u=>({item:u.item,priceCredits:u.priceCredits,quantity:u.quantity})),shortfall:d}),q(!1)}async function ze(e){if(!n||e.length===0)return;const s=we(e),d=s.map(y=>({...y.item,priceCredits:y.priceCredits})),c=e.map(y=>({...y.item,priceCredits:y.priceCredits,quantity:y.quantity})),u=[];let h="authorize";const w=new Set,$=new Set,_=new Set,E=[];let R=!1;j({phase:"processing",stage:"reserving",step:1,total:s.length});try{const y=[];for(let x=0;x<s.length;x++){const p=s[x];j({phase:"processing",stage:"reserving",step:x+1,total:s.length});try{const T=p.acquisition==="trade"?p.trade.id:void 0,C=p.item.contractAddress&&p.item.itemId!=null?{contractAddress:p.item.contractAddress,itemId:String(p.item.itemId)}:void 0,{credit:U,maxCreditedValue:X}=await ht(n.identity,p.usdCents,T,C);u.push({salt:U.id,itemId:p.item.id}),y.push(p.acquisition==="store"?{kind:"store",item:{collection:p.item.contractAddress,itemId:String(p.item.itemId),priceWei:p.priceWei},credits:[U],maxCreditedValue:X,chainId:p.item.chainId}:{kind:"trade",trade:p.trade,credits:[U],maxCreditedValue:X})}catch(T){if($s(T)){if(u.length){try{await Re(n.identity,u.map(C=>C.salt))}catch(C){ae(C,{flow:"cart_checkout",step:"release"})}v.invalidateQueries({queryKey:["usd-balance"]})}De(e);return}throw T}}h="submit";const m=fs(y).length,k=x=>m>1?{current:x,total:m}:void 0,W=(x,p)=>j({phase:"processing",stage:x,step:s.length,total:s.length,signatures:k(p)}),K=x=>x<m?W("awaiting-signature",x+1):W("settling",m);W("awaiting-signature",1);let f=[];if(us())try{const x=new Map;f=await ys({purchases:y,buyer:n.address,signer:n.signer,onSigned:()=>K(m),onBroadcast:({txHash:C,salts:U})=>{x.set(C,U),U.forEach(X=>w.add(X))}});const p=await Promise.allSettled(f.map(C=>bs(C)));p.forEach((C,U)=>{const X=x.get(f[U])??[];C.status==="fulfilled"?(X.forEach(Ee=>$.add(Ee)),E.push(f[U])):C.reason instanceof bt||X.forEach(Ee=>_.add(Ee))});const T=p.flatMap(C=>C.status==="rejected"?[C.reason]:[]);if(T.length&&!T.some(C=>C instanceof bt))throw T[0];R=!0}catch(x){if(!(x instanceof vs)||!ya(n.providerType))throw x;f=await _e({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:p})=>p.forEach(T=>w.add(T)),onSettled:({txHash:p,salts:T})=>{T.forEach(C=>$.add(C)),E.push(p)},onReverted:({salts:p})=>p.forEach(T=>_.add(T))})}else f=await _e({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:x})=>x.forEach(p=>w.add(p)),onSettled:({txHash:x,salts:p})=>{p.forEach(T=>$.add(T)),E.push(x)},onReverted:({salts:x})=>x.forEach(p=>_.add(p))});e.forEach(x=>l(x.item.id)),O(null),G("Shop Completed Purchase",{...xe(d),payment_type:"credits",no_crypto_step:R,transaction_hash:f[0]??null}),yt(v);const b=oe.current;oe.current=null,j(null),q(!1);const N={items:c,txHash:f[0]??void 0,txHashes:f,settled:!0,...b?{creditsAdded:b}:{}};ee("/success",{state:N,replace:!0})}catch(y){fe(y)||ae(y,{flow:"cart_checkout",step:h,cart_size:e.length});const m=new Set([...w].filter(b=>!_.has(b))),{toRelease:k,boughtItemIds:W}=vt({reservations:u,spent:m,settled:$}),K=d.filter(b=>W.includes(b.id)),f=d.filter(b=>!W.includes(b.id));if(G(fe(y)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:h,error_code:pt(y),value_usd:lt(f.reduce((b,N)=>b+N.priceCredits,0)),cart_size:s.length,partial:K.length>0}),k.length)try{await Re(n.identity,k)}catch(b){ae(b,{flow:"cart_checkout",step:"release"})}if(v.invalidateQueries({queryKey:["usd-balance"]}),K.length>0){W.forEach(b=>l(b)),O(null),yt(v),G("Shop Completed Purchase",{...xe(K),payment_type:"credits",no_crypto_step:R,transaction_hash:E[0]??null,partial:!0}),j({phase:"error",message:a("cart.error.partiallyBought")}),q(!1);return}j({phase:"error",message:Fe(y)})}}function Ye(e,s){v.invalidateQueries({queryKey:["usd-balance"]}),v.invalidateQueries({queryKey:["detail-trade"]}),v.invalidateQueries({queryKey:["shop-item"]}),v.invalidateQueries({queryKey:["owned-token"]}),v.invalidateQueries({queryKey:["public-token"]}),v.invalidateQueries({queryKey:["item-resales"]}),v.invalidateQueries({queryKey:["shop-items"]}),v.invalidateQueries({queryKey:["catalog-items"]}),v.invalidateQueries({queryKey:["my-assets"]}),v.invalidateQueries({queryKey:["purchases"]}),v.invalidateQueries({queryKey:["owned-item-count"]}),v.invalidateQueries({queryKey:["overview-listings"]}),v.invalidateQueries({queryKey:["upsell-listings"]});const d=oe.current;oe.current=null,j(null),q(!1);const c={items:e,txHash:s[0]??void 0,txHashes:s,settled:!0,...d?{creditsAdded:d}:{}};ee("/success",{state:c,replace:!0})}function Je(e,s){fe(e)||ae(e,{flow:s,step:"submit"}),G(fe(e)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:pt(e)}),j({phase:"error",message:Fe(e)}),q(!1)}async function Gt(e,s){const d=ye(qe.MANAToken,s),c=ye(qe.CreditsManager,s);await ms({auth:{kind:xs.Allowance,contractAddress:d.address,spenderAddress:c.address,chainId:s},signer:e})}async function Xe(){if(re)return re;try{return await v.fetchQuery({queryKey:["mana-rate",ut.chainId],queryFn:()=>ma(ut.chainId),staleTime:6e4})}catch{return}}async function Vt(e){const s=we(e).reduce((h,w)=>h+w.usdCents,0),c=(he??0n)>0n?await Xe():re,u=c?ct(s,c):0n;return{totalCents:s,manaWei:u}}async function Ze(e,s){const d=We(e),{totalCents:c,manaWei:u}=await Vt(e),h=Be({priceCents:c,priceManaWei:u,balanceCents:(S==null?void 0:S.balanceCents)??0,manaBalanceWei:he??0n}),w=Ut(e)?{...h,options:h.options.filter($=>$.method==="credits")}:h;if(s&&w.options.some($=>$.method===s)){if(s==="credits"){ze(e);return}const{spender:$,chainId:_}=et(s,e);await tt($,_,()=>s==="mana"?void at(e):void st(e,c,u));return}if(w.options.some($=>$.method==="mana"||$.method==="combined")){j({phase:"choose",lines:e,totalCents:c,manaWei:u}),q(!1);return}if(S!=null&&S.credits<d){De(e);return}ze(e)}function Dt(e){return Be({priceCents:e.totalCents,priceManaWei:e.manaWei,balanceCents:(S==null?void 0:S.balanceCents)??0,manaBalanceWei:he??0n})}const[Ae,me]=P.useState(null);function et(e,s){const d=Pe(s)[0].trade;return{spender:e==="mana"?ye(ba(d.contract),d.chainId).address:ye(qe.CreditsManager,d.chainId).address,chainId:d.chainId}}async function tt(e,s,d){const c=hs(s,e),u=n?await ps(c,n.address).catch(()=>!0):!0;if(gs(n==null?void 0:n.providerType,u)){q(!1),me({auth:c,run:d});return}d()}function Yt(e){if((g==null?void 0:g.phase)!=="choose")return;const{lines:s,totalCents:d,manaWei:c}=g;if(e==="credits"){ze(s);return}const{spender:u,chainId:h}=et(e,s);tt(u,h,()=>e==="mana"?void at(s):void st(s,d,c))}async function at(e){if(!n||e.length===0)return;const s=we(e),d=s.map(h=>({...h.item,priceCredits:h.priceCredits})),c=e.map(h=>({...h.item,priceCredits:h.priceCredits,quantity:h.quantity})),u=()=>j({phase:"processing",stage:"settling",step:s.length,total:s.length});j({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});try{const h=await cs({trades:Pe(s).map(w=>w.trade),buyer:n.address,signer:n.signer,onSigned:u});e.forEach(w=>l(w.item.id)),O(null),G("Shop Completed Purchase",{...xe(d),payment_type:"mana",transaction_hash:h[0]??null}),v.invalidateQueries({queryKey:["mana-balance"]}),Ye(c,h)}catch(h){Je(h,"buy_cart_mana")}}async function st(e,s,d){if(!n||e.length===0)return;const c=we(e),u=c.map(m=>({...m.item,priceCredits:m.priceCredits})),h=e.map(m=>({...m.item,priceCredits:m.priceCredits,quantity:m.quantity})),w=ds(c.map(m=>m.usdCents),(S==null?void 0:S.balanceCents)??0),$=w.reduce((m,k)=>m+k,0),_=ls(Math.max(0,s-$),s,d),E=[],R=new Set,y=new Set;j({phase:"processing",stage:"reserving",step:1,total:c.length});try{const m=Pe(c),k=[];for(let f=0;f<m.length;f++){const b=w[f];if(b<=0)continue;j({phase:"processing",stage:"reserving",step:f+1,total:m.length});const N=m[f].item,{credit:x,maxCreditedValue:p}=await ht(n.identity,b,m[f].trade.id,N.contractAddress&&N.itemId!=null?{contractAddress:N.contractAddress,itemId:String(N.itemId)}:void 0);E.push({salt:x.id,itemId:N.id}),k.push({kind:"trade",trade:m[f].trade,credits:[x],maxCreditedValue:p})}m.forEach((f,b)=>{w[b]<=0&&k.push({kind:"trade",trade:f.trade,credits:[],maxCreditedValue:"0"})}),k[0]={...k[0],maxCreditedValue:(BigInt(k[0].maxCreditedValue)+_).toString()},await Gt(n.signer,m[0].trade.chainId);const W=()=>j({phase:"processing",stage:"settling",step:c.length,total:c.length});j({phase:"processing",stage:"awaiting-signature",step:c.length,total:c.length});const K=await _e({purchases:k,buyer:n.address,signer:n.signer,onSigned:W,onBroadcast:({salts:f})=>f.forEach(b=>R.add(b)),onReverted:({salts:f})=>f.forEach(b=>y.add(b))});e.forEach(f=>l(f.item.id)),O(null),G("Shop Completed Purchase",{...xe(u),payment_type:"credits_and_mana",transaction_hash:K[0]??null}),v.invalidateQueries({queryKey:["mana-balance"]}),Ye(h,K)}catch(m){const{toRelease:k}=vt({reservations:E,spent:new Set([...R].filter(W=>!y.has(W))),settled:new Set});k.length&&Re(n.identity,k).catch(()=>{}),E.length&&v.invalidateQueries({queryKey:["usd-balance"]}),Je(m,"buy_cart_combined")}}async function te(e){if(!n){ft({type:"cart-checkout"}),L();return}const s=Q.getState().items.filter(He);if(s.length===0)return;ie(null),ue(null),q(!0);const d=s.reduce((c,u)=>c+u.priceCredits*u.quantity,0);G("Shop Started Checkout",{cart_size:s.length,cart_value_credits:d,cart_value_usd:lt(d),has_sufficient_credits:pe>=d});try{const c=await js(s,n.address,Qt,await Xe(),Ht),u=[...c.unavailable,...c.own];if(u.length&&(u.forEach(h=>l(h.id)),ue(En(c))),c.buyable.length===0){ie(a("cart.error.noneAvailable")),O(null);return}if(c.orderChanged){O(c),Ne.current=Date.now();return}await Ze(c.buyable,e)}catch(c){ae(c,{flow:"cart_checkout",step:"review",cart_size:s.length}),ie(Fe(c))}finally{q(!1)}}async function nt(){if(B){if(!n){ft({type:"cart-checkout"}),L();return}if(Date.now()-Ne.current>An){O(null),ue(null),await te();return}ie(null),Ze(B.buyable)}}async function Jt(){if($e){try{sessionStorage.setItem(be,JSON.stringify(Q.getState().items))}catch{}q(!0);try{const e=await ks($e,n?{address:n.address,identity:n.identity}:void 0);if(e.url){window.location.href=e.url;return}ee("/credits")}catch(e){try{sessionStorage.removeItem(be)}catch{}ae(e,{flow:"cart_buy_credits"}),j({phase:"error",message:a("buyModal.error.creditsCheckout")})}finally{q(!1)}}}const it=P.useRef(!1);P.useEffect(()=>{if(!n||it.current||!ns("cart-checkout"))return;it.current=!0;const e=setTimeout(()=>void te(),0);return()=>clearTimeout(e)},[n]);const rt=P.useRef(!1);P.useEffect(()=>{if(!(Y!=null&&Y.resumeCheckout)||rt.current)return;rt.current=!0,oe.current=Y.creditsAdded??null;try{const s=sessionStorage.getItem(be);if(s){sessionStorage.removeItem(be);const d=JSON.parse(s);Array.isArray(d)&&d.length&&V(d)}}catch{}v.invalidateQueries({queryKey:["usd-balance"]});const e=setTimeout(()=>void te(),0);return()=>clearTimeout(e)},[Y==null?void 0:Y.resumeCheckout]);const J=Bt||(g==null?void 0:g.phase)==="processing";return o.length===0&&!g?t.jsx(wt,{children:t.jsxs(jt,{children:[t.jsxs(Ct,{onClick:()=>ee(-1),type:"button",children:[t.jsx(H,{name:"arrow-left"}),a("nav.cart")]}),t.jsxs(Ns,{"data-testid":"cart-empty",children:[t.jsx(H,{name:"cart-plus",size:110}),t.jsxs(Us,{children:[t.jsx(Qs,{children:a("cart.empty.title")}),t.jsx(Hs,{children:a("cart.empty.body")})]}),t.jsx(Os,{to:"/items",children:a("cart.empty.cta")})]})]})}):t.jsxs(wt,{children:[t.jsxs(jt,{children:[t.jsxs(Ct,{onClick:()=>ee(-1),type:"button",children:[t.jsx(H,{name:"arrow-left"}),a("nav.cart")]}),t.jsxs(Ws,{children:[t.jsxs(Ls,{children:[t.jsxs(Ks,{children:[t.jsx(Gs,{onClick:()=>ee(-1),type:"button","aria-label":a("cart.goBack"),children:t.jsx(H,{name:"arrow-left"})}),t.jsx(Vs,{children:a("cart.panelTitle",{count:Ft})}),Rt?t.jsxs(Ds,{onClick:()=>D(!0),disabled:J,children:[t.jsx(H,{name:"fitting-room"}),a("cart.fittingRoom")]}):null]}),t.jsxs(It,{children:[t.jsx(Ys,{children:o.map(e=>{const s=Kt.get(e.id),d=s?s.priceCredits:e.priceCredits,c=!!s&&s.priceCredits!==e.priceCredits,u=!e.tokenId,h=e.quantity,w=typeof e.available=="number"&&h>=e.available,$=d*h,_=ua(e),E=!!_&&!!A[_],R=ha(e),y=Qe[e.id],m=!dt(y),k=y==="sold-out"?a("cart.availability.soldOut"):a("cart.availability.unavailable");return t.jsxs(Js,{"data-unavailable":m||void 0,children:[t.jsxs(Xs,{"data-thumb":!0,children:[R?t.jsx(Zs,{to:R,state:{item:e,tradeId:e.tradeId},"aria-label":e.name,children:e.thumbnail?t.jsx("img",{src:e.thumbnail,alt:e.name}):null}):e.thumbnail?t.jsx("img",{src:e.thumbnail,alt:e.name}):null,t.jsx(en,{"data-check":!0,"aria-hidden":!0,children:t.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:t.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),t.jsxs(tn,{children:[t.jsxs(an,{"data-desc":!0,children:[R?t.jsx(nn,{to:R,state:{item:e,tradeId:e.tradeId},title:e.name,children:e.name}):t.jsx(sn,{title:e.name,children:e.name}),e.creator?t.jsx(rn,{address:e.creator,linkToProfile:!0}):null,Et&&u?t.jsxs(fn,{"data-testid":"cart-creator-tag",children:[t.jsx(yn,{name:"buy-from-creator"}),a("cart.creatorTag")]}):null]}),t.jsx(on,{children:m?t.jsxs(t.Fragment,{children:[t.jsxs(gn,{children:[t.jsx(mn,{name:"warning-fill",size:24}),k]}),R?t.jsx(xn,{to:R,state:{item:e,tradeId:e.tradeId},children:a("cart.availability.viewResales")}):null]}):t.jsxs(t.Fragment,{children:[u?t.jsxs(cn,{children:[t.jsx(kt,{onClick:()=>ge(()=>z(e.id)),disabled:J||h<=1,"aria-label":a("cart.decreaseQuantity",{name:e.name}),children:t.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:t.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),t.jsx(dn,{children:h}),t.jsx(kt,{onClick:()=>ge(()=>I(e.id)),disabled:J||w,"aria-label":a("cart.increaseQuantity"),children:t.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:t.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null,t.jsxs(ln,{children:[t.jsx(un,{})," ",$,c?t.jsx(hn,{children:e.priceCredits*h}):null]})]})})]}),t.jsxs(pn,{children:[_?t.jsx(bn,{"data-on":E||void 0,onClick:()=>ne(e),"aria-label":E?a("cart.removeFromFavorites",{name:e.name}):a("cart.addToFavorites",{name:e.name}),title:E?a("assetCard.removeFromFavorites"):a("assetCard.addToFavorites"),children:t.jsx(H,{name:E?"heart-solid":"heart"})}):null,t.jsx(vn,{onClick:()=>ge(()=>l(e.id)),disabled:J,"aria-label":a("cart.remove",{name:e.name}),title:a("cart.removeTitle"),children:t.jsx(H,{name:"trash",size:24})})]})]},e.id)})}),t.jsx(wn,{children:t.jsx("button",{className:"link",onClick:()=>ge(F),disabled:J,children:a("cart.clearCart")})})]})]}),t.jsxs(Cn,{children:[t.jsx(jn,{children:a("cart.purchaseSummary")}),t.jsxs(kn,{children:[t.jsxs(Sn,{children:[t.jsx($n,{children:a("cart.totalItems",{count:Wt})}),t.jsx(Mn,{children:t.jsxs(Tn,{children:[t.jsx(In,{})," ",Ge]})})]}),t.jsx($t,{options:Ie.options,totalCents:Me,shortfall:Ie.manaShortfall,showCreditsAmount:!1,creditsLabel:B?a("marketCheckout.confirmPurchase"):Ie.options.length>1?a("cart.buyWithCredits"):a("cart.checkout"),busy:J||Oe,onPay:e=>void(B?nt():te(e)),creditsFallback:{label:J?a("cart.working"):B?a("marketCheckout.confirmPurchase"):a("cart.checkout"),onClick:()=>void(B?nt():te())}}),Oe?t.jsx(ve,{className:"muted",children:a("cart.allUnavailable")}):null,n?null:t.jsx(ve,{className:"muted",children:a("cart.signInHint")}),B?t.jsx(ve,{className:"muted",children:a("cart.priceChanged")}):null,Ke?t.jsx(ve,{className:"muted",children:Ke}):null,t.jsx(Pn,{message:qt})]})]})]})]}),Ve.length>0?t.jsx(zn,{children:t.jsx(is,{title:a("cart.youMightAlsoLike"),items:Ve})}):null,Ae&&n?t.jsx(rs,{auth:Ae.auth,signer:n.signer,title:a("authorizeStep.manaTitle"),name:a("authorizeStep.manaName"),reason:a("authorizeStep.manaReason"),icon:t.jsx("img",{src:os,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:e}=Ae;me(null),e()},onCancel:()=>me(null),onClose:()=>me(null)}):null,g?t.jsx(qs,{phase:g.phase,balanceCredits:pe,onClose:Ot,stage:g.phase==="processing"?g.stage:void 0,step:g.phase==="processing"?g.step:void 0,total:g.phase==="processing"?g.total:void 0,isSelfCustody:pa(n==null?void 0:n.providerType),signatures:g.phase==="processing"?g.signatures:void 0,options:g.phase==="choose"?Dt(g).options:void 0,onPay:Yt,totalCents:g.phase==="choose"?g.totalCents:void 0,totalManaWei:g.phase==="choose"?g.manaWei:void 0,totalCredits:g.phase==="choose"?We(g.lines):void 0,lines:g.phase==="nofunds"?g.lines:void 0,shortfallCredits:g.phase==="nofunds"?g.shortfall:void 0,packs:le,selectedPack:$e,onSelectPack:Ue,onBuyPacks:()=>void Jt(),message:g.phase==="error"?g.message:void 0,onRetry:()=>void te()}):null]})}export{Vn as Cart};
706
+ `;function Fe(o){if(Ss(o))return a("errors.rejected");const l=(o.message??"").toLowerCase();return l.includes("insufficient")?a("cart.error.insufficient",{currency:fa.name}):l.includes("no active listing")||l.includes("your own listing")?a("cart.error.listingChanged"):a("marketCheckout.error.generic")}const An=12e4;function En(o){const l=[];return o.unavailable.length&&l.push(a("cart.drop.unavailable",{count:o.unavailable.length})),o.own.length&&l.push(a("cart.drop.own",{count:o.own.length})),a("cart.drop.removed",{items:l.join(` ${a("cart.drop.and")} `)})}const We=o=>o.reduce((l,I)=>l+I.priceCredits*I.quantity,0),we=o=>o.flatMap(l=>Array.from({length:l.quantity},()=>({...l,quantity:1})));function Vn(){aa({title:a("nav.cart"),noindex:!0});const o=Q(e=>e.items),l=Q(e=>e.remove),I=Q(e=>e.increment),z=Q(e=>e.decrement),F=Q(e=>e.clear),V=Q(e=>e.restore),D=Q(e=>e.setFittingOpen),A=ot(e=>e.items),ne=ot(e=>e.toggle),{session:n,signIn:L}=sa(),Et=na(),le=ws().packs.slice(0,Cs);P.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const Rt=o.some(e=>e.category!=="emote"),{data:Se}=ia({queryKey:["upsell-listings"],queryFn:()=>va({first:40}),staleTime:6e4}),{data:S}=ra(n),v=oa(),ee=Yt(),{state:J}=Zt(),[qt,ie]=P.useState(null),[Ke,ue]=P.useState(null),[Bt,q]=P.useState(!1),[B,O]=P.useState(null),Ne=P.useRef(0),[g,j]=P.useState(null),{data:he}=ca(n),{data:re}=da(!0),[$e,Ue]=P.useState(""),oe=P.useRef(null),Qe=la(o),He=e=>dt(Qe[e.id]),Te=o.filter(He),Oe=o.length>0&&Te.length===0,_t=Te.reduce((e,s)=>e+s.priceCredits*s.quantity,0),Ft=o.reduce((e,s)=>e+s.quantity,0),Wt=Te.reduce((e,s)=>e+s.quantity,0),Ge=B?B.liveTotalCredits:_t,Lt=new Set(o.map(e=>e.id)),Ve=((Se==null?void 0:Se.items)??[]).filter(e=>!Lt.has(e.id)).slice(0,12),Kt=new Map(B==null?void 0:B.buyable.map(e=>[e.item.id,e])),pe=(S==null?void 0:S.credits)??0,Me=Ge*10,Nt=re?ct(Me,re):0n,Ie=Be({priceCents:Me,priceManaWei:Nt,balanceCents:(S==null?void 0:S.balanceCents)??0,manaBalanceWei:he??0n}),Ut=e=>e.some(s=>s.acquisition==="store"),Pe=e=>e.flatMap(s=>s.acquisition==="trade"?[s]:[]),Qt=ga,Ht=e=>xa(e.contractAddress,String(e.itemId));function ge(e){e(),O(null),ue(null),ie(null)}function Ot(){j(null),q(!1)}function De(e){const s=We(e),d=Math.max(0,s-pe),c=le.find(u=>u.credits>=d)??le[le.length-1];Ue(c.id),G("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:s,credits_balance:pe,shortfall:d}),j({phase:"nofunds",lines:e.map(u=>({item:u.item,priceCredits:u.priceCredits,quantity:u.quantity})),shortfall:d}),q(!1)}async function ze(e){if(!n||e.length===0)return;const s=we(e),d=s.map(y=>({...y.item,priceCredits:y.priceCredits})),c=e.map(y=>({...y.item,priceCredits:y.priceCredits,quantity:y.quantity})),u=[];let h="authorize";const w=new Set,$=new Set,_=new Set,E=[];let R=!1;j({phase:"processing",stage:"reserving",step:1,total:s.length});try{const y=[];for(let x=0;x<s.length;x++){const p=s[x];j({phase:"processing",stage:"reserving",step:x+1,total:s.length});try{const T=p.acquisition==="trade"?p.trade.id:void 0,C=p.item.contractAddress&&p.item.itemId!=null?{contractAddress:p.item.contractAddress,itemId:String(p.item.itemId)}:void 0,{credit:U,maxCreditedValue:Y}=await ht(n.identity,p.usdCents,T,C);u.push({salt:U.id,itemId:p.item.id}),y.push(p.acquisition==="store"?{kind:"store",item:{collection:p.item.contractAddress,itemId:String(p.item.itemId),priceWei:p.priceWei},credits:[U],maxCreditedValue:Y,chainId:p.item.chainId}:{kind:"trade",trade:p.trade,credits:[U],maxCreditedValue:Y})}catch(T){if($s(T)){if(u.length){try{await Re(n.identity,u.map(C=>C.salt))}catch(C){ae(C,{flow:"cart_checkout",step:"release"})}v.invalidateQueries({queryKey:["usd-balance"]})}De(e);return}throw T}}h="submit";const m=fs(y).length,k=x=>m>1?{current:x,total:m}:void 0,W=(x,p)=>j({phase:"processing",stage:x,step:s.length,total:s.length,signatures:k(p)}),K=x=>x<m?W("awaiting-signature",x+1):W("settling",m);W("awaiting-signature",1);let f=[];if(us())try{const x=new Map;f=await ys({purchases:y,buyer:n.address,signer:n.signer,onSigned:()=>K(m),onBroadcast:({txHash:C,salts:U})=>{x.set(C,U),U.forEach(Y=>w.add(Y))}});const p=await Promise.allSettled(f.map(C=>bs(C)));p.forEach((C,U)=>{const Y=x.get(f[U])??[];C.status==="fulfilled"?(Y.forEach(Ee=>$.add(Ee)),E.push(f[U])):C.reason instanceof bt||Y.forEach(Ee=>_.add(Ee))});const T=p.flatMap(C=>C.status==="rejected"?[C.reason]:[]);if(T.length&&!T.some(C=>C instanceof bt))throw T[0];R=!0}catch(x){if(!(x instanceof vs)||!ya(n.providerType))throw x;f=await _e({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:p})=>p.forEach(T=>w.add(T)),onSettled:({txHash:p,salts:T})=>{T.forEach(C=>$.add(C)),E.push(p)},onReverted:({salts:p})=>p.forEach(T=>_.add(T))})}else f=await _e({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:x})=>x.forEach(p=>w.add(p)),onSettled:({txHash:x,salts:p})=>{p.forEach(T=>$.add(T)),E.push(x)},onReverted:({salts:x})=>x.forEach(p=>_.add(p))});e.forEach(x=>l(x.item.id)),O(null),G("Shop Completed Purchase",{...xe(d),payment_type:"credits",no_crypto_step:R,transaction_hash:f[0]??null}),yt(v);const b=oe.current;oe.current=null,j(null),q(!1);const N={items:c,txHash:f[0]??void 0,txHashes:f,settled:!0,...b?{creditsAdded:b}:{}};ee("/success",{state:N,replace:!0})}catch(y){fe(y)||ae(y,{flow:"cart_checkout",step:h,cart_size:e.length});const m=new Set([...w].filter(b=>!_.has(b))),{toRelease:k,boughtItemIds:W}=vt({reservations:u,spent:m,settled:$}),K=d.filter(b=>W.includes(b.id)),f=d.filter(b=>!W.includes(b.id));if(G(fe(y)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:h,error_code:pt(y),value_usd:lt(f.reduce((b,N)=>b+N.priceCredits,0)),cart_size:s.length,partial:K.length>0}),k.length)try{await Re(n.identity,k)}catch(b){ae(b,{flow:"cart_checkout",step:"release"})}if(v.invalidateQueries({queryKey:["usd-balance"]}),K.length>0){W.forEach(b=>l(b)),O(null),yt(v),G("Shop Completed Purchase",{...xe(K),payment_type:"credits",no_crypto_step:R,transaction_hash:E[0]??null,partial:!0}),j({phase:"error",message:a("cart.error.partiallyBought")}),q(!1);return}j({phase:"error",message:Fe(y)})}}function Je(e,s){v.invalidateQueries({queryKey:["usd-balance"]}),v.invalidateQueries({queryKey:["detail-trade"]}),v.invalidateQueries({queryKey:["shop-item"]}),v.invalidateQueries({queryKey:["owned-token"]}),v.invalidateQueries({queryKey:["public-token"]}),v.invalidateQueries({queryKey:["item-resales"]}),v.invalidateQueries({queryKey:["shop-items"]}),v.invalidateQueries({queryKey:["catalog-items"]}),v.invalidateQueries({queryKey:["my-assets"]}),v.invalidateQueries({queryKey:["purchases"]}),v.invalidateQueries({queryKey:["owned-item-count"]}),v.invalidateQueries({queryKey:["overview-listings"]}),v.invalidateQueries({queryKey:["upsell-listings"]});const d=oe.current;oe.current=null,j(null),q(!1);const c={items:e,txHash:s[0]??void 0,txHashes:s,settled:!0,...d?{creditsAdded:d}:{}};ee("/success",{state:c,replace:!0})}function Xe(e,s){fe(e)||ae(e,{flow:s,step:"submit"}),G(fe(e)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:pt(e)}),j({phase:"error",message:Fe(e)}),q(!1)}async function Gt(e,s){const d=ye(qe.MANAToken,s),c=ye(qe.CreditsManager,s);await ms({auth:{kind:xs.Allowance,contractAddress:d.address,spenderAddress:c.address,chainId:s},signer:e})}async function Ye(){if(re)return re;try{return await v.fetchQuery({queryKey:["mana-rate",ut.chainId],queryFn:()=>ma(ut.chainId),staleTime:6e4})}catch{return}}async function Vt(e){const s=we(e).reduce((h,w)=>h+w.usdCents,0),c=(he??0n)>0n?await Ye():re,u=c?ct(s,c):0n;return{totalCents:s,manaWei:u}}async function Ze(e,s){const d=We(e),{totalCents:c,manaWei:u}=await Vt(e),h=Be({priceCents:c,priceManaWei:u,balanceCents:(S==null?void 0:S.balanceCents)??0,manaBalanceWei:he??0n}),w=Ut(e)?{...h,options:h.options.filter($=>$.method==="credits")}:h;if(s&&w.options.some($=>$.method===s)){if(s==="credits"){ze(e);return}const{spender:$,chainId:_}=et(s,e);await tt($,_,()=>s==="mana"?void at(e):void st(e,c,u));return}if(w.options.some($=>$.method==="mana"||$.method==="combined")){j({phase:"choose",lines:e,totalCents:c,manaWei:u}),q(!1);return}if(S!=null&&S.credits<d){De(e);return}ze(e)}function Dt(e){return Be({priceCents:e.totalCents,priceManaWei:e.manaWei,balanceCents:(S==null?void 0:S.balanceCents)??0,manaBalanceWei:he??0n})}const[Ae,me]=P.useState(null);function et(e,s){const d=Pe(s)[0].trade;return{spender:e==="mana"?ye(ba(d.contract),d.chainId).address:ye(qe.CreditsManager,d.chainId).address,chainId:d.chainId}}async function tt(e,s,d){const c=hs(s,e),u=n?await ps(c,n.address).catch(()=>!0):!0;if(gs(n==null?void 0:n.providerType,u)){q(!1),me({auth:c,run:d});return}d()}function Jt(e){if((g==null?void 0:g.phase)!=="choose")return;const{lines:s,totalCents:d,manaWei:c}=g;if(e==="credits"){ze(s);return}const{spender:u,chainId:h}=et(e,s);tt(u,h,()=>e==="mana"?void at(s):void st(s,d,c))}async function at(e){if(!n||e.length===0)return;const s=we(e),d=s.map(h=>({...h.item,priceCredits:h.priceCredits})),c=e.map(h=>({...h.item,priceCredits:h.priceCredits,quantity:h.quantity})),u=()=>j({phase:"processing",stage:"settling",step:s.length,total:s.length});j({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});try{const h=await cs({trades:Pe(s).map(w=>w.trade),buyer:n.address,signer:n.signer,onSigned:u});e.forEach(w=>l(w.item.id)),O(null),G("Shop Completed Purchase",{...xe(d),payment_type:"mana",transaction_hash:h[0]??null}),v.invalidateQueries({queryKey:["mana-balance"]}),Je(c,h)}catch(h){Xe(h,"buy_cart_mana")}}async function st(e,s,d){if(!n||e.length===0)return;const c=we(e),u=c.map(m=>({...m.item,priceCredits:m.priceCredits})),h=e.map(m=>({...m.item,priceCredits:m.priceCredits,quantity:m.quantity})),w=ds(c.map(m=>m.usdCents),(S==null?void 0:S.balanceCents)??0),$=w.reduce((m,k)=>m+k,0),_=ls(Math.max(0,s-$),s,d),E=[],R=new Set,y=new Set;j({phase:"processing",stage:"reserving",step:1,total:c.length});try{const m=Pe(c),k=[];for(let f=0;f<m.length;f++){const b=w[f];if(b<=0)continue;j({phase:"processing",stage:"reserving",step:f+1,total:m.length});const N=m[f].item,{credit:x,maxCreditedValue:p}=await ht(n.identity,b,m[f].trade.id,N.contractAddress&&N.itemId!=null?{contractAddress:N.contractAddress,itemId:String(N.itemId)}:void 0);E.push({salt:x.id,itemId:N.id}),k.push({kind:"trade",trade:m[f].trade,credits:[x],maxCreditedValue:p})}m.forEach((f,b)=>{w[b]<=0&&k.push({kind:"trade",trade:f.trade,credits:[],maxCreditedValue:"0"})}),k[0]={...k[0],maxCreditedValue:(BigInt(k[0].maxCreditedValue)+_).toString()},await Gt(n.signer,m[0].trade.chainId);const W=()=>j({phase:"processing",stage:"settling",step:c.length,total:c.length});j({phase:"processing",stage:"awaiting-signature",step:c.length,total:c.length});const K=await _e({purchases:k,buyer:n.address,signer:n.signer,onSigned:W,onBroadcast:({salts:f})=>f.forEach(b=>R.add(b)),onReverted:({salts:f})=>f.forEach(b=>y.add(b))});e.forEach(f=>l(f.item.id)),O(null),G("Shop Completed Purchase",{...xe(u),payment_type:"credits_and_mana",transaction_hash:K[0]??null}),v.invalidateQueries({queryKey:["mana-balance"]}),Je(h,K)}catch(m){const{toRelease:k}=vt({reservations:E,spent:new Set([...R].filter(W=>!y.has(W))),settled:new Set});k.length&&Re(n.identity,k).catch(()=>{}),E.length&&v.invalidateQueries({queryKey:["usd-balance"]}),Xe(m,"buy_cart_combined")}}async function te(e){if(!n){ft({type:"cart-checkout"}),L();return}const s=Q.getState().items.filter(He);if(s.length===0)return;ie(null),ue(null),q(!0);const d=s.reduce((c,u)=>c+u.priceCredits*u.quantity,0);G("Shop Started Checkout",{cart_size:s.length,cart_value_credits:d,cart_value_usd:lt(d),has_sufficient_credits:pe>=d});try{const c=await js(s,n.address,Qt,await Ye(),Ht),u=[...c.unavailable,...c.own];if(u.length&&(u.forEach(h=>l(h.id)),ue(En(c))),c.buyable.length===0){ie(a("cart.error.noneAvailable")),O(null);return}if(c.orderChanged){O(c),Ne.current=Date.now();return}await Ze(c.buyable,e)}catch(c){ae(c,{flow:"cart_checkout",step:"review",cart_size:s.length}),ie(Fe(c))}finally{q(!1)}}async function nt(){if(B){if(!n){ft({type:"cart-checkout"}),L();return}if(Date.now()-Ne.current>An){O(null),ue(null),await te();return}ie(null),Ze(B.buyable)}}async function Xt(){if($e){try{sessionStorage.setItem(be,JSON.stringify(Q.getState().items))}catch{}q(!0);try{const e=await ks($e,n?{address:n.address,identity:n.identity}:void 0);if(e.url){window.location.href=e.url;return}ee("/credits")}catch(e){try{sessionStorage.removeItem(be)}catch{}ae(e,{flow:"cart_buy_credits"}),j({phase:"error",message:a("buyModal.error.creditsCheckout")})}finally{q(!1)}}}const it=P.useRef(!1);P.useEffect(()=>{if(!n||it.current||!ns("cart-checkout"))return;it.current=!0;const e=setTimeout(()=>void te(),0);return()=>clearTimeout(e)},[n]);const rt=P.useRef(!1);P.useEffect(()=>{if(!(J!=null&&J.resumeCheckout)||rt.current)return;rt.current=!0,oe.current=J.creditsAdded??null;try{const s=sessionStorage.getItem(be);if(s){sessionStorage.removeItem(be);const d=JSON.parse(s);Array.isArray(d)&&d.length&&V(d)}}catch{}v.invalidateQueries({queryKey:["usd-balance"]});const e=setTimeout(()=>void te(),0);return()=>clearTimeout(e)},[J==null?void 0:J.resumeCheckout]);const X=Bt||(g==null?void 0:g.phase)==="processing";return o.length===0&&!g?t.jsx(wt,{children:t.jsxs(jt,{children:[t.jsxs(Ct,{onClick:()=>ee(-1),type:"button",children:[t.jsx(H,{name:"arrow-left"}),a("nav.cart")]}),t.jsxs(Ns,{"data-testid":"cart-empty",children:[t.jsx(H,{name:"cart-plus",size:110}),t.jsxs(Us,{children:[t.jsx(Qs,{children:a("cart.empty.title")}),t.jsx(Hs,{children:a("cart.empty.body")})]}),t.jsx(Os,{to:"/items",children:a("cart.empty.cta")})]})]})}):t.jsxs(wt,{children:[t.jsxs(jt,{children:[t.jsxs(Ct,{onClick:()=>ee(-1),type:"button",children:[t.jsx(H,{name:"arrow-left"}),a("nav.cart")]}),t.jsxs(Ws,{children:[t.jsxs(Ls,{children:[t.jsxs(Ks,{children:[t.jsx(Gs,{onClick:()=>ee(-1),type:"button","aria-label":a("cart.goBack"),children:t.jsx(H,{name:"arrow-left"})}),t.jsx(Vs,{children:a("cart.panelTitle",{count:Ft})}),Rt?t.jsxs(Ds,{onClick:()=>D(!0),disabled:X,children:[t.jsx(H,{name:"fitting-room"}),a("cart.fittingRoom")]}):null]}),t.jsxs(It,{children:[t.jsx(Js,{children:o.map(e=>{const s=Kt.get(e.id),d=s?s.priceCredits:e.priceCredits,c=!!s&&s.priceCredits!==e.priceCredits,u=!e.tokenId,h=e.quantity,w=typeof e.available=="number"&&h>=e.available,$=d*h,_=ua(e),E=!!_&&!!A[_],R=ha(e),y=Qe[e.id],m=!dt(y),k=y==="sold-out"?a("cart.availability.soldOut"):a("cart.availability.unavailable");return t.jsxs(Xs,{"data-unavailable":m||void 0,children:[t.jsxs(Ys,{"data-thumb":!0,children:[R?t.jsx(Zs,{to:R,state:{item:e,tradeId:e.tradeId},"aria-label":e.name,children:e.thumbnail?t.jsx("img",{src:e.thumbnail,alt:e.name}):null}):e.thumbnail?t.jsx("img",{src:e.thumbnail,alt:e.name}):null,t.jsx(en,{"data-check":!0,"aria-hidden":!0,children:t.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:t.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),t.jsxs(tn,{children:[t.jsxs(an,{"data-desc":!0,children:[R?t.jsx(nn,{to:R,state:{item:e,tradeId:e.tradeId},title:e.name,children:e.name}):t.jsx(sn,{title:e.name,children:e.name}),e.creator?t.jsx(rn,{address:e.creator,linkToProfile:!0}):null,Et&&u?t.jsxs(fn,{"data-testid":"cart-creator-tag",children:[t.jsx(yn,{name:"buy-from-creator"}),a("cart.creatorTag")]}):null]}),t.jsx(on,{children:m?t.jsxs(t.Fragment,{children:[t.jsxs(gn,{children:[t.jsx(mn,{name:"warning-fill",size:24}),k]}),R?t.jsx(xn,{to:R,state:{item:e,tradeId:e.tradeId},children:a("cart.availability.viewResales")}):null]}):t.jsxs(t.Fragment,{children:[u?t.jsxs(cn,{children:[t.jsx(kt,{onClick:()=>ge(()=>z(e.id)),disabled:X||h<=1,"aria-label":a("cart.decreaseQuantity",{name:e.name}),children:t.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:t.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),t.jsx(dn,{children:h}),t.jsx(kt,{onClick:()=>ge(()=>I(e.id)),disabled:X||w,"aria-label":a("cart.increaseQuantity"),children:t.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:t.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null,t.jsxs(ln,{children:[t.jsx(un,{})," ",$,c?t.jsx(hn,{children:e.priceCredits*h}):null]})]})})]}),t.jsxs(pn,{children:[_?t.jsx(bn,{"data-on":E||void 0,onClick:()=>ne(e),"aria-label":E?a("cart.removeFromFavorites",{name:e.name}):a("cart.addToFavorites",{name:e.name}),title:E?a("assetCard.removeFromFavorites"):a("assetCard.addToFavorites"),children:t.jsx(H,{name:E?"heart-solid":"heart"})}):null,t.jsx(vn,{onClick:()=>ge(()=>l(e.id)),disabled:X,"aria-label":a("cart.remove",{name:e.name}),title:a("cart.removeTitle"),children:t.jsx(H,{name:"trash",size:24})})]})]},e.id)})}),t.jsx(wn,{children:t.jsx("button",{className:"link",onClick:()=>ge(F),disabled:X,children:a("cart.clearCart")})})]})]}),t.jsxs(Cn,{children:[t.jsx(jn,{children:a("cart.purchaseSummary")}),t.jsxs(kn,{children:[t.jsxs(Sn,{children:[t.jsx($n,{children:a("cart.totalItems",{count:Wt})}),t.jsx(Mn,{children:t.jsxs(Tn,{children:[t.jsx(In,{})," ",Ge]})})]}),t.jsx($t,{options:Ie.options,totalCents:Me,shortfall:Ie.manaShortfall,showCreditsAmount:!1,creditsLabel:B?a("marketCheckout.confirmPurchase"):Ie.options.length>1?a("cart.buyWithCredits"):a("cart.checkout"),busy:X||Oe,onPay:e=>void(B?nt():te(e)),creditsFallback:{label:X?a("cart.working"):B?a("marketCheckout.confirmPurchase"):a("cart.checkout"),onClick:()=>void(B?nt():te())}}),Oe?t.jsx(ve,{className:"muted",children:a("cart.allUnavailable")}):null,n?null:t.jsx(ve,{className:"muted",children:a("cart.signInHint")}),B?t.jsx(ve,{className:"muted",children:a("cart.priceChanged")}):null,Ke?t.jsx(ve,{className:"muted",children:Ke}):null,t.jsx(Pn,{message:qt})]})]})]})]}),Ve.length>0?t.jsx(zn,{children:t.jsx(is,{title:a("cart.youMightAlsoLike"),items:Ve})}):null,Ae&&n?t.jsx(rs,{auth:Ae.auth,signer:n.signer,title:a("authorizeStep.manaTitle"),name:a("authorizeStep.manaName"),reason:a("authorizeStep.manaReason"),icon:t.jsx("img",{src:os,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:e}=Ae;me(null),e()},onCancel:()=>me(null),onClose:()=>me(null)}):null,g?t.jsx(qs,{phase:g.phase,balanceCredits:pe,onClose:Ot,stage:g.phase==="processing"?g.stage:void 0,step:g.phase==="processing"?g.step:void 0,total:g.phase==="processing"?g.total:void 0,isSelfCustody:pa(n==null?void 0:n.providerType),signatures:g.phase==="processing"?g.signatures:void 0,options:g.phase==="choose"?Dt(g).options:void 0,onPay:Jt,totalCents:g.phase==="choose"?g.totalCents:void 0,totalManaWei:g.phase==="choose"?g.manaWei:void 0,totalCredits:g.phase==="choose"?We(g.lines):void 0,lines:g.phase==="nofunds"?g.lines:void 0,shortfallCredits:g.phase==="nofunds"?g.shortfall:void 0,packs:le,selectedPack:$e,onSelectPack:Ue,onBuyPacks:()=>void Xt(),message:g.phase==="error"?g.message:void 0,onRetry:()=>void te()}):null]})}export{Vn as Cart};
@@ -1,4 +1,4 @@
1
- import{aj as N,ak as w,al as o,am as n,K as D,w as M}from"./index-D7dTUoYt.js";import{r as U,j as g}from"./react-BYHuwl8r.js";import{g as z,a as E,c as I,b as K}from"./clsx-WwvpwSg0.js";import{s as v}from"./styled-8pFgehSd.js";function F(r){return z("MuiCircularProgress",r)}E("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const W=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,b,S,$;const t=44,B=M(P||(P=l`
1
+ import{ai as N,aj as w,ak as o,al as n,K as D,w as M}from"./index-CKUuopSw.js";import{r as U,j as g}from"./react-BYHuwl8r.js";import{g as z,a as E,c as I,b as K}from"./clsx-WwvpwSg0.js";import{s as v}from"./styled-pD_2hanx.js";function F(r){return z("MuiCircularProgress",r)}E("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const W=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,b,S,$;const t=44,B=M(P||(P=l`
2
2
  0% {
3
3
  transform: rotate(0deg);
4
4
  }
@@ -1,4 +1,4 @@
1
- import{j as e,r as m,d as J,b as X}from"./react-BYHuwl8r.js";import{t as b,s,bv as ee,a2 as te,D as F,bw as ae,bx as oe,I as ie,b as a,c as re,F as se,v as ne,x as ce,C as le,ar as R,as as de,by as pe,bz as xe}from"./index-D7dTUoYt.js";import{E as he}from"./ErrorNotice-CCsvrT3H.js";import{d as me,P as ge,C as ue,a as be,b as fe,A as ve}from"./collectionPage.styles-BgKDi1Aa.js";import{u as ye,S as W,a as je,F as Ce,c as we,P as $e,d as ke,H as Ne,e as Se}from"./categories-Bjf-PXbG.js";import{L as Pe}from"./LoadMore-ChGcAM1i.js";import{u as Ae}from"./useInfiniteGrid-UHC0Jjfu.js";import{G as Me}from"./grid.styles-CtrXwvIr.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";import"./skeleton.styles-CVQk0siV.js";const Te=s.section`
1
+ import{j as e,r as m,d as J,b as X}from"./react-BYHuwl8r.js";import{t as b,s,bt as ee,a1 as te,D as R,bu as ae,bv as oe,I as ie,b as a,c as re,F as se,v as ne,x as ce,C as le,ap as z,aq as de,bw as pe,bx as xe}from"./index-CKUuopSw.js";import{E as he}from"./ErrorNotice-OUNK486K.js";import{d as me,P as ge,C as ue,a as be,b as fe,A as ve}from"./collectionPage.styles-CoEdrsfq.js";import{u as ye,S as W,a as je,F as Ce,c as we,P as $e,d as ke,H as Ne,e as Se}from"./categories-D23W_J-A.js";import{L as Pe}from"./LoadMore-jSNRJiwZ.js";import{u as Ae}from"./useInfiniteGrid-BjEQAabI.js";import{G as Me}from"./grid.styles-hOZTJ80g.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";import"./skeleton.styles-BXNXDWEi.js";const Te=s.section`
2
2
  position: relative;
3
3
  border-radius: ${b.radius.card};
4
4
  overflow: hidden;
@@ -11,20 +11,20 @@ import{j as e,r as m,d as J,b as X}from"./react-BYHuwl8r.js";import{t as b,s,bv
11
11
  ${b.media.maxWidth("mobile")} {
12
12
  min-height: 140px;
13
13
  }
14
- `,ze=s.div`
14
+ `,Ee=s.div`
15
15
  position: absolute;
16
16
  inset: 0;
17
17
  z-index: 0;
18
- `,Ee=s.img`
18
+ `,Fe=s.img`
19
19
  width: 100%;
20
20
  height: 100%;
21
21
  object-fit: cover;
22
22
  display: block;
23
- `,Fe=s.div`
23
+ `,Re=s.div`
24
24
  position: absolute;
25
25
  inset: 0;
26
26
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.55) 100%);
27
- `,Re=s.h1`
27
+ `,ze=s.h1`
28
28
  position: relative;
29
29
  z-index: 1;
30
30
  margin: 0;
@@ -42,7 +42,7 @@ import{j as e,r as m,d as J,b as X}from"./react-BYHuwl8r.js";import{t as b,s,bv
42
42
  padding: 24px 16px;
43
43
  font-size: 26px;
44
44
  }
45
- `;function We({name:o,creator:t}){const{data:n}=ee(t),p=(n==null?void 0:n.cover)||me;return e.jsxs(Te,{"data-testid":"collection-hero","aria-label":o,children:[e.jsxs(ze,{children:[e.jsx(Ee,{src:p,alt:"",loading:"eager"}),e.jsx(Fe,{"aria-hidden":!0})]}),e.jsx(Re,{"data-testid":"collection-hero-title",children:o})]})}const{colors:c,radius:B}=b,Le=s.div`
45
+ `;function We({name:o,creator:t}){const{data:n}=ee(t),p=(n==null?void 0:n.cover)||me;return e.jsxs(Te,{"data-testid":"collection-hero","aria-label":o,children:[e.jsxs(Ee,{children:[e.jsx(Fe,{src:p,alt:"",loading:"eager"}),e.jsx(Re,{"aria-hidden":!0})]}),e.jsx(ze,{"data-testid":"collection-hero-title",children:o})]})}const{colors:c,radius:B}=b,Le=s.div`
46
46
  display: flex;
47
47
  flex-direction: column;
48
48
  align-items: center;
@@ -116,7 +116,7 @@ import{j as e,r as m,d as J,b as X}from"./react-BYHuwl8r.js";import{t as b,s,bv
116
116
  background: ${c.softWhite};
117
117
  color: ${c.text};
118
118
  }
119
- `;function Ge({address:o}){var v,d;const{data:t}=te(o),[n,p]=m.useState(!1);if(!o)return null;const l=(t==null?void 0:t.name)||F(o),g=(d=(v=t==null?void 0:t.avatar)==null?void 0:v.snapshots)==null?void 0:d.face256,u=`${re.profileUrl}/${o}`,f=ae(oe({name:t==null?void 0:t.name,hasClaimedName:t==null?void 0:t.hasClaimedName,ethAddress:(t==null?void 0:t.ethAddress)??o}));async function x(){try{await navigator.clipboard.writeText(o),p(!0),window.setTimeout(()=>p(!1),1500)}catch(j){se(j,{flow:"copy_creator_address"})}}return e.jsxs(Le,{"data-testid":"creator-card",children:[g?e.jsx(L,{src:g,alt:"",loading:"eager",style:{backgroundColor:f}}):e.jsx(L,{as:"span","aria-hidden":!0,style:{backgroundColor:f}}),e.jsx(Be,{title:l,children:l}),e.jsxs(Ie,{type:"button",onClick:()=>void x(),title:n?a("collection.copied"):a("collection.copyAddress"),"aria-label":n?a("collection.copied"):a("collection.copyAddress"),children:[e.jsx("span",{children:F(o)}),e.jsx(ie,{name:"copy",size:16})]}),e.jsx(_e,{"data-testid":"creator-card-view",href:u,target:"_blank",rel:"noopener noreferrer",children:a("collection.viewProfile")})]})}const{colors:He,media:$}=b,Ue=s.div`
119
+ `;function Ge({address:o}){var v,d;const{data:t}=te(o),[n,p]=m.useState(!1);if(!o)return null;const l=(t==null?void 0:t.name)||R(o),g=(d=(v=t==null?void 0:t.avatar)==null?void 0:v.snapshots)==null?void 0:d.face256,u=`${re.profileUrl}/${o}`,f=ae(oe({name:t==null?void 0:t.name,hasClaimedName:t==null?void 0:t.hasClaimedName,ethAddress:(t==null?void 0:t.ethAddress)??o}));async function x(){try{await navigator.clipboard.writeText(o),p(!0),window.setTimeout(()=>p(!1),1500)}catch(j){se(j,{flow:"copy_creator_address"})}}return e.jsxs(Le,{"data-testid":"creator-card",children:[g?e.jsx(L,{src:g,alt:"",loading:"eager",style:{backgroundColor:f}}):e.jsx(L,{as:"span","aria-hidden":!0,style:{backgroundColor:f}}),e.jsx(Be,{title:l,children:l}),e.jsxs(Ie,{type:"button",onClick:()=>void x(),title:n?a("collection.copied"):a("collection.copyAddress"),"aria-label":n?a("collection.copied"):a("collection.copyAddress"),children:[e.jsx("span",{children:R(o)}),e.jsx(ie,{name:"copy",size:16})]}),e.jsx(_e,{"data-testid":"creator-card-view",href:u,target:"_blank",rel:"noopener noreferrer",children:a("collection.viewProfile")})]})}const{colors:He,media:$}=b,Ue=s.div`
120
120
  position: relative;
121
121
  display: flex;
122
122
  gap: 32px;
@@ -125,14 +125,14 @@ import{j as e,r as m,d as J,b as X}from"./react-BYHuwl8r.js";import{t as b,s,bv
125
125
  ${$.maxWidth("lg")} {
126
126
  display: block;
127
127
  }
128
- `,Ye=s.div`
128
+ `,qe=s.div`
129
129
  flex: 1;
130
130
  min-width: 0;
131
131
 
132
132
  ${$.maxWidth("lg")} {
133
133
  width: 100%;
134
134
  }
135
- `,qe=s.aside`
135
+ `,Ye=s.aside`
136
136
  flex: none;
137
137
  width: 265px;
138
138
 
@@ -159,4 +159,4 @@ import{j as e,r as m,d as J,b as X}from"./react-BYHuwl8r.js";import{t as b,s,bv
159
159
  visibility: visible;
160
160
  }
161
161
  }
162
- `,De=48;function st(){var E;const{contractAddress:o}=J(),t=X(),[n,p]=m.useState("all"),[l,g]=m.useState(null),[u,f]=m.useState([]),[x,v]=m.useState(""),[d,j]=m.useState(""),[k,I]=m.useState("newest");ye(`${n}:${l??""}`);const N=x&&!Number.isNaN(Number(x))?Number(x):void 0,S=d&&!Number.isNaN(Number(d))?Number(d):void 0,_=l?Se[l]:void 0,G=(W.find(i=>i.key===k)??W[0]).server,P={category:n,rarities:u.length?u:void 0,wearableCategories:_,minPriceCredits:N,maxPriceCredits:S,sortBy:G},{items:y,total:H,isLoading:C,error:A,hasNextPage:U,isFetchingNextPage:M,isFetchNextPageError:Y,fetchNextPage:q}=Ae(["collection-page",o,P],i=>pe(o,{...P,first:De,skip:i}),{enabled:!!o}),{data:r}=ne({queryKey:["collection-meta",o],queryFn:()=>xe(o),enabled:!!o,staleTime:5*6e4}),T=(r==null?void 0:r.name)||a("collection.fallbackTitle");ce({title:r==null?void 0:r.name,description:r!=null&&r.name?a("seo.collection.description",{name:r.name}):void 0});const z=(r==null?void 0:r.creator)||((E=y[0])==null?void 0:E.creator);function D(i){p(i),g(null)}function K(i){f(h=>h.includes(i)?h.filter(Z=>Z!==i):[...h,i])}function O(){p("all"),g(null),f([]),v(""),j("")}const w=!!(N||S),Q=w?`${x||"0"}–${d||"∞"}`:a("filter.price"),V=n!=="all"||!!l||u.length>0||w;return e.jsxs(ge,{"data-testid":"collection-page",children:[e.jsxs(ue,{"aria-label":a("collection.breadcrumbAria"),children:[e.jsx(be,{onClick:()=>t("/items"),children:a("collection.breadcrumb")}),e.jsx("span",{children:"/"}),e.jsx(fe,{children:T})]}),e.jsx(We,{name:T,creator:z}),e.jsxs(Ue,{"data-testid":"browse",children:[e.jsxs(qe,{"data-testid":"browse-sidebar",children:[e.jsx(Ge,{address:z}),e.jsx(je,{category:n,subCategory:l,onCategory:D,onSub:g,title:a("collection.category"),flat:!0})]}),e.jsxs(Ye,{children:[!C&&y.length>0?e.jsx(ve,{items:y,source:"collection"}):null,e.jsx(Ce,{rarities:u,onToggleRarity:K,sort:k,onSort:I,total:H,loading:C,anyActive:V,onClear:O,renderTrailing:i=>e.jsx(we,{panelKey:"price",label:Q,active:w,panel:i,children:e.jsxs($e,{"data-variant":"price",children:[e.jsxs(ke,{children:[e.jsx("input",{type:"number",min:"0","aria-label":a("collection.priceMin"),placeholder:a("collection.priceMinPlaceholder"),value:x,onChange:h=>v(h.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("collection.priceMax"),placeholder:a("collection.priceMaxPlaceholder"),value:d,onChange:h=>j(h.target.value)})]}),e.jsx(Ne,{children:a("collection.priceHint",{currency:le.name})})]})})}),A?e.jsx(he,{message:a("collection.error")}):null,e.jsx(Me,{"data-testid":"grid",children:C?e.jsx(R,{count:15}):e.jsxs(e.Fragment,{children:[y.map(i=>e.jsx(de,{item:i},i.id)),M?e.jsx(R,{count:6}):null]})}),e.jsx(Pe,{hasNextPage:U,isFetching:M,isError:Y,onLoadMore:()=>void q()}),!C&&!A&&y.length===0?e.jsx("p",{className:"muted",children:a("collection.empty")}):null]})]})]})}export{st as Collection,st as default};
162
+ `,De=48;function st(){var F;const{contractAddress:o}=J(),t=X(),[n,p]=m.useState("all"),[l,g]=m.useState(null),[u,f]=m.useState([]),[x,v]=m.useState(""),[d,j]=m.useState(""),[k,I]=m.useState("newest");ye(`${n}:${l??""}`);const N=x&&!Number.isNaN(Number(x))?Number(x):void 0,S=d&&!Number.isNaN(Number(d))?Number(d):void 0,_=l?Se[l]:void 0,G=(W.find(i=>i.key===k)??W[0]).server,P={category:n,rarities:u.length?u:void 0,wearableCategories:_,minPriceCredits:N,maxPriceCredits:S,sortBy:G},{items:y,total:H,isLoading:C,error:A,hasNextPage:U,isFetchingNextPage:M,isFetchNextPageError:q,fetchNextPage:Y}=Ae(["collection-page",o,P],i=>pe(o,{...P,first:De,skip:i}),{enabled:!!o}),{data:r}=ne({queryKey:["collection-meta",o],queryFn:()=>xe(o),enabled:!!o,staleTime:5*6e4}),T=(r==null?void 0:r.name)||a("collection.fallbackTitle");ce({title:r==null?void 0:r.name,description:r!=null&&r.name?a("seo.collection.description",{name:r.name}):void 0});const E=(r==null?void 0:r.creator)||((F=y[0])==null?void 0:F.creator);function D(i){p(i),g(null)}function K(i){f(h=>h.includes(i)?h.filter(Z=>Z!==i):[...h,i])}function O(){p("all"),g(null),f([]),v(""),j("")}const w=!!(N||S),Q=w?`${x||"0"}–${d||"∞"}`:a("filter.price"),V=n!=="all"||!!l||u.length>0||w;return e.jsxs(ge,{"data-testid":"collection-page",children:[e.jsxs(ue,{"aria-label":a("collection.breadcrumbAria"),children:[e.jsx(be,{onClick:()=>t("/items"),children:a("collection.breadcrumb")}),e.jsx("span",{children:"/"}),e.jsx(fe,{children:T})]}),e.jsx(We,{name:T,creator:E}),e.jsxs(Ue,{"data-testid":"browse",children:[e.jsxs(Ye,{"data-testid":"browse-sidebar",children:[e.jsx(Ge,{address:E}),e.jsx(je,{category:n,subCategory:l,onCategory:D,onSub:g,title:a("collection.category"),flat:!0})]}),e.jsxs(qe,{children:[!C&&y.length>0?e.jsx(ve,{items:y,source:"collection"}):null,e.jsx(Ce,{rarities:u,onToggleRarity:K,sort:k,onSort:I,total:H,loading:C,anyActive:V,onClear:O,renderTrailing:i=>e.jsx(we,{panelKey:"price",label:Q,active:w,panel:i,children:e.jsxs($e,{"data-variant":"price",children:[e.jsxs(ke,{children:[e.jsx("input",{type:"number",min:"0","aria-label":a("collection.priceMin"),placeholder:a("collection.priceMinPlaceholder"),value:x,onChange:h=>v(h.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("collection.priceMax"),placeholder:a("collection.priceMaxPlaceholder"),value:d,onChange:h=>j(h.target.value)})]}),e.jsx(Ne,{children:a("collection.priceHint",{currency:le.name})})]})})}),A?e.jsx(he,{message:a("collection.error")}):null,e.jsx(Me,{"data-testid":"grid",children:C?e.jsx(z,{count:15}):e.jsxs(e.Fragment,{children:[y.map(i=>e.jsx(de,{item:i},i.id)),M?e.jsx(z,{count:6}):null]})}),e.jsx(Pe,{hasNextPage:U,isFetching:M,isError:q,onLoadMore:()=>void Y()}),!C&&!A&&y.length===0?e.jsx("p",{className:"muted",children:a("collection.empty")}):null]})]})]})}export{st as Collection,st as default};