@dcl/shop 0.1.0-29588264451.commit-627b4b7 → 0.1.0-29588647657.commit-2cc8158

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 (178) hide show
  1. package/assets/{AnimatedBackground-psFU9eqJ.js → AnimatedBackground-urlvv1u-.js} +3 -3
  2. package/assets/{Assets-iKVqmFqq.js → Assets-Bgol1TFW.js} +1 -1
  3. package/assets/{Cart-B0oxrKWW.js → Cart-BLK0NtgY.js} +1 -1
  4. package/assets/{CircularProgress-Fg-Nhc1W.js → CircularProgress-CPG7ZOfs.js} +1 -1
  5. package/assets/{Collection-D5Q48x8i.js → Collection-oY08s2SC.js} +1 -1
  6. package/assets/{ContentClient-CiSvC4he.js → ContentClient-CcNIfFcB.js} +1 -1
  7. package/assets/{Creator-Cw25k_kz.js → Creator-Geua9taX.js} +1 -1
  8. package/assets/{CssVarsProvider-D1D1cNqm.js → CssVarsProvider-CNdYCyi9.js} +1 -1
  9. package/assets/{DeploymentBuilder-Du1wr7ad.js → DeploymentBuilder-DOqh7sYP.js} +1 -1
  10. package/assets/{ExchangeController-DR6BBi2L.js → ExchangeController-BnfYxF48.js} +1 -1
  11. package/assets/GetCredits-COdRHzqV.js +1 -0
  12. package/assets/{HelpersUtil-31KPVf4r.js → HelpersUtil-C5w2ExFs.js} +1 -1
  13. package/assets/{ImportListings-dKZfPQUt.js → ImportListings-B-zcLoS1.js} +1 -1
  14. package/assets/{ItemDetail-Cx-6T0Eg.js → ItemDetail-BEVnVvI_.js} +2 -2
  15. package/assets/{MarketCheckout-Qn1ixrkb.js → MarketCheckout-k3hh1fMb.js} +1 -1
  16. package/assets/{MyAssets-DxI94ipn.js → MyAssets-CtamOoiB.js} +1 -1
  17. package/assets/{MyFavorites-D2VaWS1B.js → MyFavorites-DB_RHGeZ.js} +1 -1
  18. package/assets/{MyPurchases-B9emkBFN.js → MyPurchases-DLo5AL4P.js} +1 -1
  19. package/assets/{NotFound-E0wDMFCK.js → NotFound-CALTSbn3.js} +1 -1
  20. package/assets/{StoreSettings-DfKsXLjF.js → StoreSettings-IyPLWce9.js} +1 -1
  21. package/assets/{Success-D8vbmLlB.js → Success-CPrrgz5q.js} +1 -1
  22. package/assets/{SwapController-BhWJpnsS.js → SwapController-CUPcRb3X.js} +1 -1
  23. package/assets/{TradeService-CzTJfCBU.js → TradeService-DE_CcjPe.js} +1 -1
  24. package/assets/{W3MFrameProviderSingleton-QTe845Ty.js → W3MFrameProviderSingleton-KZXDtdeN.js} +3 -3
  25. package/assets/{WebCryptoP256-C9DwfYdN.js → WebCryptoP256-CmfR3sjC.js} +1 -1
  26. package/assets/{basic-BZccaaZw.js → basic-CrYMfATs.js} +1 -1
  27. package/assets/{biconomy-DB7oVSPZ.js → biconomy-CHSrNezt.js} +1 -1
  28. package/assets/{buy-D_7yggiZ.js → buy-C_OnDZx3.js} +1 -1
  29. package/assets/{buy-gasless-DdXBIm99.js → buy-gasless-uH5qu5A8.js} +1 -1
  30. package/assets/{cart-checkout-C6slCzLp.js → cart-checkout-DJSPllz1.js} +1 -1
  31. package/assets/{categories-CS5KEV15.js → categories-Dqa3M8i7.js} +1 -1
  32. package/assets/{ccip-CRir71Ts.js → ccip-CYomOMLt.js} +1 -1
  33. package/assets/{ccip-Bs_9Z_ZN.js → ccip-h7KPERy4.js} +1 -1
  34. package/assets/{collection-BB4WIsDf.js → collection-DOsbvafd.js} +1 -1
  35. package/assets/{controller-8YCt_5kO.js → controller-KHxYFosg.js} +2 -2
  36. package/assets/{core-_p71vehW.js → core-pBN9FKMw.js} +4 -4
  37. package/assets/{custom-D5gy9Lbk.js → custom-CEHsyFlW.js} +1 -1
  38. package/assets/{data-capture-D4KpcM2w.js → data-capture-BSdkL8U7.js} +1 -1
  39. package/assets/{decimals-DAdpv8M5.js → decimals-BA-bLcGh.js} +1 -1
  40. package/assets/decimals-CwI_mnkm.js +1 -0
  41. package/assets/{detectExtension-BwC-gZ7s.js → detectExtension-G5UH8a-M.js} +1 -1
  42. package/assets/{email-DoKqUCg3.js → email-BMkLtjTu.js} +1 -1
  43. package/assets/{embedded-wallet-DFjP-9W6.js → embedded-wallet-CMLY6maG.js} +1 -1
  44. package/assets/{emotion-styled.browser.esm-B7PezGnO.js → emotion-styled.browser.esm-Bcg9MXM8.js} +1 -1
  45. package/assets/{engine-C07V9FFP.js → engine-ZKKEGTTG.js} +1 -1
  46. package/assets/{estimate-l1-fee-CbSYXxVq.js → estimate-l1-fee-XHZSoWjk.js} +1 -1
  47. package/assets/{eth_estimateGas-CHt9spnf.js → eth_estimateGas-Bq7UQHDY.js} +1 -1
  48. package/assets/{eth_getStorageAt-Dzigs9Zu.js → eth_getStorageAt-DEYLIJ2f.js} +1 -1
  49. package/assets/{eth_getTransactionCount-CDY9h_Rg.js → eth_getTransactionCount-sK45qAke.js} +1 -1
  50. package/assets/{extractIPFS-BOTNSryE.js → extractIPFS-BTNSHVMw.js} +1 -1
  51. package/assets/{features-C90RUzSP.js → features-jLiVGuCn.js} +1 -1
  52. package/assets/{fetchTokenMetadata-BKZfKsNV.js → fetchTokenMetadata-CLRXW5Ae.js} +2 -2
  53. package/assets/get-ecosystem-wallet-info-HaXmkjKB.js +1 -0
  54. package/assets/{getBalance-Bb_-F40S.js → getBalance-D85PcSgJ.js} +1 -1
  55. package/assets/{getInstalledModules-BOPp6l-B.js → getInstalledModules-BbkWCUI_.js} +1 -1
  56. package/assets/{getNFT-DsdBNES9.js → getNFT-Ba-KxS5w.js} +1 -1
  57. package/assets/{getNFT-jiRKQ5Oo.js → getNFT-CpSdZEPv.js} +2 -2
  58. package/assets/{getOverlayAlpha-CM9JvcJV.js → getOverlayAlpha-CPeU_wtJ.js} +1 -1
  59. package/assets/{hashTypedData-DONiI8QZ.js → hashTypedData-BiAfRLxc.js} +1 -1
  60. package/assets/{hashTypedData-vGDzeBcA.js → hashTypedData-_My6_zHk.js} +1 -1
  61. package/assets/{import-DM-iC_9y.js → import-BM47oMM1.js} +1 -1
  62. package/assets/{in-app-wallet-calls-C_aNlFmv.js → in-app-wallet-calls-DB4mrEuh.js} +1 -1
  63. package/assets/{index-BtVa_Kh7.js → index-0YKOyKsz.js} +1 -1
  64. package/assets/{index-BVEDAipP.js → index-1w11c9kT.js} +1 -1
  65. package/assets/{index-SOuBSYKv.js → index-2lgRM28O.js} +1 -1
  66. package/assets/{index-xHNUVGAh.js → index-7a1mhp_I.js} +1 -1
  67. package/assets/{index-DO9rihjD.js → index-B1e1ZADY.js} +1 -1
  68. package/assets/{index-CE5ZSWni.js → index-B4HZUf7-.js} +1 -1
  69. package/assets/{index-MqZwF8o9.js → index-B9Xqc0Hi.js} +2 -2
  70. package/assets/{index-DHJgxESc.js → index-BE03Fup7.js} +1 -1
  71. package/assets/{index-C5j8nmW-.js → index-BNhDGSX8.js} +1 -1
  72. package/assets/{index-Bj7GkEZm.js → index-BQzrms9Y.js} +1 -1
  73. package/assets/{index-C02-3pKD.js → index-BS31iF_T.js} +1 -1
  74. package/assets/{index-BIJTdhnz.js → index-BUYyFeCt.js} +2 -2
  75. package/assets/{index-BNKsMdm-.js → index-BY2ihj74.js} +1 -1
  76. package/assets/{index-Bn_Nt76C.js → index-BhW68dt9.js} +1 -1
  77. package/assets/{index-DSs6L904.js → index-Bi6W-t7S.js} +1 -1
  78. package/assets/{index-CSm8067w.js → index-Bs2u8R9P.js} +1 -1
  79. package/assets/{index-C__ZUWCs.js → index-BseAK0jv.js} +1 -1
  80. package/assets/{index-CnWEn3Fl.js → index-BvJT7BsV.js} +1 -1
  81. package/assets/{index-BNsBOmtc.js → index-BvrUtN1i.js} +1 -1
  82. package/assets/{index-BUzSFM10.js → index-Bwj5NrhW.js} +1 -1
  83. package/assets/{index-QHZTwn8s.js → index-C-GvP7Ri.js} +1 -1
  84. package/assets/{index-BVpuOhLG.js → index-C-uQhIOu.js} +3 -3
  85. package/assets/{index--gVKrRw0.js → index-C0OEAd0W.js} +1 -1
  86. package/assets/{index-C2G2lljO.js → index-C1L7bhks.js} +1 -1
  87. package/assets/{index-CRTJ7_WQ.js → index-C8L1dg3z.js} +1 -1
  88. package/assets/{index-CFy8QjLL.js → index-CGf6vfVT.js} +1 -1
  89. package/assets/{index-DzmAUU0P.js → index-COd6Hpl3.js} +1 -1
  90. package/assets/{index-DmQaEVTR.js → index-COmrTRgF.js} +1 -1
  91. package/assets/{index-DaIODAHU.js → index-CRWbHzp3.js} +1 -1
  92. package/assets/{index-gEVnIhEr.js → index-CSy-_M5R.js} +1 -1
  93. package/assets/{index-D66LUjvb.js → index-CWkyddUj.js} +1 -1
  94. package/assets/{index-DgPN63Jh.js → index-CYWpV70P.js} +6 -6
  95. package/assets/{index-B2Zw4G7Z.js → index-Ct5KJb97.js} +1 -1
  96. package/assets/{index-8TBzmL0l.js → index-D8XdtECa.js} +1 -1
  97. package/assets/{index-Cv14wakP.js → index-D8bR8hF2.js} +1 -1
  98. package/assets/{index-DD6TVIkI.js → index-DMLSNnyb.js} +1 -1
  99. package/assets/{index-Ckj9N8kM.js → index-DMU6YRL7.js} +1 -1
  100. package/assets/{index-D8WLCETG.js → index-DMWWvHVt.js} +1 -1
  101. package/assets/{index-DxBzK74p.js → index-DPAyBtUP.js} +1 -1
  102. package/assets/{index-C7gttTv8.js → index-DUwiQnps.js} +1 -1
  103. package/assets/{index-D3SxIXox.js → index-DWVC6kWx.js} +1 -1
  104. package/assets/{index-ChMOJahJ.js → index-DYJHRYX4.js} +1 -1
  105. package/assets/{index-CBVNSjCQ.js → index-Df8J_8ta.js} +1 -1
  106. package/assets/{index-Bv4pyelF.js → index-DhmytMhG.js} +1 -1
  107. package/assets/{index-7DJmnNdg.js → index-Dih2AmlD.js} +1 -1
  108. package/assets/{index-CsTr0LfC.js → index-DqO1kUFU.js} +1 -1
  109. package/assets/{index-BpQeHVbA.js → index-Dy65iyWb.js} +1 -1
  110. package/assets/{index-7PEMu-vS.js → index-Ncc_A7mr.js} +1 -1
  111. package/assets/{index-D8WMIH5c.js → index-T4DqOE4M.js} +1 -1
  112. package/assets/{index-BQrBXxNO.js → index-X5dRqFqG.js} +1 -1
  113. package/assets/{index-CThtDCr0.js → index-XztZBEgs.js} +3 -3
  114. package/assets/{index-C8i-4YQe.js → index-eL578oJV.js} +1 -1
  115. package/assets/{index-Cmhu1R9V.js → index-fJZF9Wlt.js} +1 -1
  116. package/assets/{index-zHd02W0T.js → index-oExJUWSQ.js} +1 -1
  117. package/assets/{index-Dgwg-DaP.js → index-pOWOYTZf.js} +1 -1
  118. package/assets/{index-TNdqfy5A.js → index-wsdLqN_j.js} +2 -2
  119. package/assets/{index-BEob012O.js → index-xVgoxgG9.js} +1 -1
  120. package/assets/{index.es-D2JDwbaX.js → index.es-CAdXWwOm.js} +4 -4
  121. package/assets/{index.es-B5B8Zcyr.js → index.es-CiB5ifZN.js} +1 -1
  122. package/assets/{index.es-C122sfII.js → index.es-CsD1tXVc.js} +1 -1
  123. package/assets/{localBatchGatewayRequest-aLhcfaIA.js → localBatchGatewayRequest--Sv8eIOm.js} +1 -1
  124. package/assets/{mana-rate-DM_I1GlP.js → mana-rate-DgCtJ5pM.js} +1 -1
  125. package/assets/network-DRGleXEI.js +1 -0
  126. package/assets/{networks-C5Fm0Wg2.js → networks-BqVCrj8Y.js} +1 -1
  127. package/assets/{onramp-DkCes_uB.js → onramp-CBfgz1Ty.js} +1 -1
  128. package/assets/{openzeppelin-Do5qc-L4.js → openzeppelin-D2z1DmVV.js} +1 -1
  129. package/assets/{ownerOf-B7-bZ1Kj.js → ownerOf-DFlcEy6_.js} +1 -1
  130. package/assets/{parseNft-BnBeb8zU.js → parseNft-msnZvn_A.js} +2 -2
  131. package/assets/{parseSignature-gA3whR_I.js → parseSignature-CjbZVQR3.js} +1 -1
  132. package/assets/{parseSignature-BXiUrtE0.js → parseSignature-DEAl-96W.js} +3 -3
  133. package/assets/{pay-with-exchange-Bfj0m_wp.js → pay-with-exchange-CRwxKD_d.js} +1 -1
  134. package/assets/{payments-Cz9uOQEa.js → payments-CFEkq9jj.js} +1 -1
  135. package/assets/{qr-overlay-tCTGCDoP.js → qr-overlay-CS6qAFtp.js} +1 -1
  136. package/assets/{receive-BB-3p_8X.js → receive-D_7ieG-4.js} +1 -1
  137. package/assets/{resolveImplementation-AZ8V1faE.js → resolveImplementation-BxK03jeA.js} +1 -1
  138. package/assets/{rpc-DfJIwLRx.js → rpc-Cd5PGlK-.js} +1 -1
  139. package/assets/{secp256k1-D5GxePTM.js → secp256k1-BDhwR6SH.js} +1 -1
  140. package/assets/{secp256k1-lxVndZFi.js → secp256k1-D5XG5Cq2.js} +1 -1
  141. package/assets/{secp256k1-Bmuoeuaz.js → secp256k1-D_53A2qu.js} +1 -1
  142. package/assets/{send-DmW5J-Nc.js → send--YozeJBn.js} +1 -1
  143. package/assets/{send-batch-transaction-CZjLQhJF.js → send-batch-transaction-DiGyQeR5.js} +1 -1
  144. package/assets/{send-eip712-transaction-BhyQ0a_B.js → send-eip712-transaction-Dqu8RfN0.js} +2 -2
  145. package/assets/{send-gasless-transaction-CXbVlKhB.js → send-gasless-transaction-B5uz3mX0.js} +2 -2
  146. package/assets/{sendRawTransaction-BGdiWFeb.js → sendRawTransaction-rRmixG-d.js} +3 -3
  147. package/assets/{serializeTransaction-DykKczc7.js → serializeTransaction-CzGG2kBz.js} +1 -1
  148. package/assets/{session-proposal-BEX_HaKf.js → session-proposal-CCHvDJo0.js} +1 -1
  149. package/assets/{session-request-DR4MsaR6.js → session-request-BkhA5-RY.js} +2 -2
  150. package/assets/{sha256-Dlxe-c_a.js → sha256-Bt6mLy1E.js} +1 -1
  151. package/assets/{signing-DznnvpB3.js → signing-BwuIt3X5.js} +4 -4
  152. package/assets/{socials-BIESIfY8.js → socials-BStKssws.js} +1 -1
  153. package/assets/{swaps-CA_8qfYn.js → swaps-Bid0ju8o.js} +1 -1
  154. package/assets/{thirdweb-UauMP3KV.js → thirdweb-BMJ7fr_N.js} +3 -3
  155. package/assets/{totalSupply-V0CpLejD.js → totalSupply--8jNML7t.js} +1 -1
  156. package/assets/{trade-encoding-CWQaROcB.js → trade-encoding-Drnx1u3j.js} +1 -1
  157. package/assets/{transactionReceipt-T_4Pqj5L.js → transactionReceipt-C1w204dJ.js} +1 -1
  158. package/assets/{transactions-CCKmzO8P.js → transactions-KwvVTP9x.js} +1 -1
  159. package/assets/{useInfiniteGrid-BwrFUhaa.js → useInfiniteGrid-BAS-zEte.js} +1 -1
  160. package/assets/{useStore-D9l09yvh.js → useStore-D0Fp5fnX.js} +2 -2
  161. package/assets/useTheme-CBsdNYl2.js +1 -0
  162. package/assets/{useTheme-Bf8Lxsxi.js → useTheme-DU7pyJai.js} +1 -1
  163. package/assets/{verifyHash-DictgvCd.js → verifyHash-yypMHIUe.js} +1 -1
  164. package/assets/{w3m-modal-DEg0nzZj.js → w3m-modal-Cf0rHk1f.js} +1 -1
  165. package/assets/{w3m-modal-DjfQ6wwU.js → w3m-modal-D4BKzcIi.js} +1 -1
  166. package/assets/{wait-for-tx-receipt-agyY9QD2.js → wait-for-tx-receipt-Dq_saZBt.js} +1 -1
  167. package/assets/{wallet-kind-Jzl4cyiP.js → wallet-kind-D_7fqJZh.js} +1 -1
  168. package/assets/{wallets-_A4Bjek9.js → wallets-DthYtMmh.js} +6 -6
  169. package/assets/{web-connector-BaXQsZJI.js → web-connector-Cahc_-N0.js} +3 -3
  170. package/assets/{writeContract-D9YLPdhX.js → writeContract-CYBPanmL.js} +1 -1
  171. package/assets/{zoraTestnet-BC6E1i5C.js → zoraTestnet-CupsSsoK.js} +1 -1
  172. package/index.html +8 -8
  173. package/package.json +2 -2
  174. package/assets/GetCredits-HKG4BM_P.js +0 -1
  175. package/assets/decimals-Bkiwsrz3.js +0 -1
  176. package/assets/get-ecosystem-wallet-info-WLLUCIzd.js +0 -1
  177. package/assets/network-Dev_1fOd.js +0 -1
  178. package/assets/useTheme-B2pFHCn2.js +0 -1
@@ -1,11 +1,11 @@
1
- import{r as l,j as v}from"./react-yytiy0wi.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-29588264451.commit-627b4b7/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-29588264451.commit-627b4b7/assets/DCL_LogoPattern-BryBPc3d.png",b=`
1
+ import{r as l,j as v}from"./react-yytiy0wi.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-29588647657.commit-2cc8158/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-29588647657.commit-2cc8158/assets/DCL_LogoPattern-BryBPc3d.png",U=`
2
2
  attribute vec2 a_position;
3
3
  varying vec2 v_uv;
4
4
  void main() {
5
5
  v_uv = a_position * 0.5 + 0.5;
6
6
  gl_Position = vec4(a_position, 0.0, 1.0);
7
7
  }
8
- `,U=`
8
+ `,b=`
9
9
  precision highp float;
10
10
 
11
11
  uniform float u_time;
@@ -77,4 +77,4 @@ void main() {
77
77
 
78
78
  gl_FragColor = result;
79
79
  }
80
- `;function g(t,a,r){const e=t.createShader(a);return e?(t.shaderSource(e,r),t.compileShader(e),t.getShaderParameter(e,t.COMPILE_STATUS)?e:(console.error("Shader compile error:",t.getShaderInfoLog(e)),t.deleteShader(e),null)):null}function P(t,a,r){const e=t.createProgram();return e?(t.attachShader(e,a),t.attachShader(e,r),t.linkProgram(e),t.getProgramParameter(e,t.LINK_STATUS)?e:(console.error("Program link error:",t.getProgramInfoLog(e)),t.deleteProgram(e),null)):null}function D(t,a,r){const e=t.createTexture();if(!e)return null;t.bindTexture(t.TEXTURE_2D,e),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array([128,128,128,255]));const o=new Image;return o.crossOrigin="anonymous",o.onload=()=>{r!=null&&r()||(t.bindTexture(t.TEXTURE_2D,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.generateMipmap(t.TEXTURE_2D))},o.src=a,e}function L(){const t=l.useRef(null),a=l.useRef(0);return l.useEffect(()=>{var h;const r=t.current;if(!r||(h=window.matchMedia)!=null&&h.call(window,"(prefers-reduced-motion: reduce)").matches)return;const e=r.getContext("webgl",{alpha:!1,antialias:!1});if(!e)return;const o=g(e,e.VERTEX_SHADER,b),c=g(e,e.FRAGMENT_SHADER,U);if(!o||!c){o&&e.deleteShader(o),c&&e.deleteShader(c);return}const n=P(e,o,c);if(!n){e.deleteShader(o),e.deleteShader(c);return}const u=e.getAttribLocation(n,"a_position"),_=e.getUniformLocation(n,"u_time"),R=e.getUniformLocation(n,"u_resolution"),y=e.getUniformLocation(n,"u_overlayTex"),s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);let m=!1;const d=D(e,S,()=>m),A=()=>{const i=window.devicePixelRatio||1,x=r.clientWidth*i,E=r.clientHeight*i;(r.width!==x||r.height!==E)&&(r.width=x,r.height=E)},p=performance.now()/1e3,f=()=>{A(),e.viewport(0,0,r.width,r.height),e.useProgram(n),e.uniform1f(_,performance.now()/1e3-p),e.uniform2f(R,r.width,r.height),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,d),e.uniform1i(y,0),e.enableVertexAttribArray(u),e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(u,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLES,0,6),a.current=requestAnimationFrame(f)},T=i=>{i.preventDefault(),cancelAnimationFrame(a.current),r.style.opacity="0"};return r.addEventListener("webglcontextlost",T,!1),a.current=requestAnimationFrame(f),()=>{m=!0,cancelAnimationFrame(a.current),r.removeEventListener("webglcontextlost",T),e.deleteProgram(n),e.deleteShader(o),e.deleteShader(c),e.deleteBuffer(s),e.deleteTexture(d)}},[]),v.jsxs("div",{className:"AnimatedBackground","aria-hidden":!0,children:[v.jsx("div",{className:"AnimatedBackground__fallback",style:{backgroundImage:`url(${w})`}}),v.jsx("canvas",{ref:t,className:"AnimatedBackground__canvas"})]})}export{L as default};
80
+ `;function g(t,a,r){const e=t.createShader(a);return e?(t.shaderSource(e,r),t.compileShader(e),t.getShaderParameter(e,t.COMPILE_STATUS)?e:(console.error("Shader compile error:",t.getShaderInfoLog(e)),t.deleteShader(e),null)):null}function P(t,a,r){const e=t.createProgram();return e?(t.attachShader(e,a),t.attachShader(e,r),t.linkProgram(e),t.getProgramParameter(e,t.LINK_STATUS)?e:(console.error("Program link error:",t.getProgramInfoLog(e)),t.deleteProgram(e),null)):null}function D(t,a,r){const e=t.createTexture();if(!e)return null;t.bindTexture(t.TEXTURE_2D,e),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array([128,128,128,255]));const o=new Image;return o.crossOrigin="anonymous",o.onload=()=>{r!=null&&r()||(t.bindTexture(t.TEXTURE_2D,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.generateMipmap(t.TEXTURE_2D))},o.src=a,e}function L(){const t=l.useRef(null),a=l.useRef(0);return l.useEffect(()=>{var h;const r=t.current;if(!r||(h=window.matchMedia)!=null&&h.call(window,"(prefers-reduced-motion: reduce)").matches)return;const e=r.getContext("webgl",{alpha:!1,antialias:!1});if(!e)return;const o=g(e,e.VERTEX_SHADER,U),c=g(e,e.FRAGMENT_SHADER,b);if(!o||!c){o&&e.deleteShader(o),c&&e.deleteShader(c);return}const n=P(e,o,c);if(!n){e.deleteShader(o),e.deleteShader(c);return}const u=e.getAttribLocation(n,"a_position"),_=e.getUniformLocation(n,"u_time"),R=e.getUniformLocation(n,"u_resolution"),y=e.getUniformLocation(n,"u_overlayTex"),s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);let m=!1;const d=D(e,S,()=>m),A=()=>{const i=window.devicePixelRatio||1,x=r.clientWidth*i,E=r.clientHeight*i;(r.width!==x||r.height!==E)&&(r.width=x,r.height=E)},p=performance.now()/1e3,f=()=>{A(),e.viewport(0,0,r.width,r.height),e.useProgram(n),e.uniform1f(_,performance.now()/1e3-p),e.uniform2f(R,r.width,r.height),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,d),e.uniform1i(y,0),e.enableVertexAttribArray(u),e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(u,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLES,0,6),a.current=requestAnimationFrame(f)},T=i=>{i.preventDefault(),cancelAnimationFrame(a.current),r.style.opacity="0"};return r.addEventListener("webglcontextlost",T,!1),a.current=requestAnimationFrame(f),()=>{m=!0,cancelAnimationFrame(a.current),r.removeEventListener("webglcontextlost",T),e.deleteProgram(n),e.deleteShader(o),e.deleteShader(c),e.deleteBuffer(s),e.deleteTexture(d)}},[]),v.jsxs("div",{className:"AnimatedBackground","aria-hidden":!0,children:[v.jsx("div",{className:"AnimatedBackground__fallback",style:{backgroundImage:`url(${w})`}}),v.jsx("canvas",{ref:t,className:"AnimatedBackground__canvas"})]})}export{L as default};
@@ -1 +1 @@
1
- import{u as le,r as i,j as e}from"./react-yytiy0wi.js";import{u as ce,t as W,C,A as T,f as oe}from"./index-DgPN63Jh.js";import{m as de}from"./mana-rate-DM_I1GlP.js";import{u as ue,M as me}from"./MarketCheckout-Qn1ixrkb.js";import{S as $,C as pe,R as _e,F as fe,a as B,b as xe}from"./categories-CS5KEV15.js";import{L as he}from"./LoadMore-CiZkVzux.js";import{u as be}from"./useInfiniteGrid-BwrFUhaa.js";import"./ethers-DArfy-QF.js";import"./index-B2Zw4G7Z.js";import"./buy-D_7yggiZ.js";import"./trade-encoding-CWQaROcB.js";import"./buy-gasless-DdXBIm99.js";const ge=48,t=1e5;function Ne(r){return{tradeId:r.tradeId??r.id,listingType:"primary",contractAddress:r.contractAddress,itemId:r.itemId??"",name:r.name,thumbnail:r.thumbnail,rarity:r.rarity,category:r.category,wearableCategory:r.wearableCategory??null,creator:r.creator,manaWei:r.manaWei??"0",available:1,network:r.network,chainId:r.chainId,createdAt:0}}function Fe(){const[r]=le(),n=(r.get("q")??"").trim().toLowerCase(),G=ce(),[m,R]=i.useState("wearable"),[o,S]=i.useState(null),[l,A]=i.useState([]),[f,k]=i.useState(""),[x,M]=i.useState(""),[p,K]=i.useState("newest"),[w,Q]=i.useState(!1),[h,_]=i.useState(!1),[F,P]=i.useState(null);i.useEffect(()=>{if(!h)return;const s=a=>{a.key==="Escape"&&_(!1)};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[h]);const d=f&&!Number.isNaN(Number(f))?Number(f):void 0,u=x&&!Number.isNaN(Number(x))?Number(x):void 0,U=o?xe[o]:void 0,D=($.find(s=>s.key===p)??$[0]).server,I={category:m,rarities:l.length?l:void 0,wearableCategories:U,minPriceCredits:d,maxPriceCredits:u,search:n||void 0,sortBy:D},{items:b,total:L,isLoading:c,error:J,hasNextPage:X,isFetchingNextPage:O,fetchNextPage:Z}=be(["unified-listings",I],s=>oe({...I,first:ge,skip:s})),g=L,{data:N,isError:z}=ue(),H=s=>N&&s.manaWei?de(s.manaWei,N):null,q=i.useRef(null);i.useEffect(()=>{c||!n||q.current===n||(q.current=n,W("Shop Searched",{query:n,result_count:g}))},[n,c,g]);const j=i.useRef("__init__");i.useEffect(()=>{if(c)return;const s=JSON.stringify({category:m,subCategory:o,rarities:l,min:d,max:u,sort:p});if(j.current==="__init__"||j.current===s){j.current=s;return}j.current=s,W("Shop Applied Filter",{filters:{category:m,sub_category:o,rarities:l,min_price_credits:d??null,max_price_credits:u??null,sort:p},result_count:g})},[m,o,l,d,u,p,c,g]);function V(s){R(s),S(null)}function Y(s){A(a=>a.includes(s)?a.filter(E=>E!==s):[...a,s])}function ee(){R("wearable"),S(null),A([]),k(""),M("")}function se(s){const a=b.find(E=>E.id===s.id);a&&a.source==="legacy"&&a.manaWei&&P(Ne(a))}function ae(){G.invalidateQueries({queryKey:["unified-listings"]})}const y=d!=null?Math.min(d,t):0,v=u!=null?Math.min(u,t):t,re=y/t*100,ie=v/t*100;function te(s){const a=Math.min(s,v);k(a<=0?"":String(a))}function ne(s){const a=Math.max(s,y);M(a>=t?"":String(a))}return e.jsxs("div",{className:"browse browse--sidebar",children:[h?e.jsx("div",{className:"browse__scrim",onClick:()=>_(!1),"aria-hidden":!0}):null,e.jsxs("aside",{className:`browse__sidebar${h?" is-open":""}`,children:[e.jsxs("div",{className:"browse__sidebar-head",children:[e.jsx("span",{className:"browse__sidebar-title",children:"Filters"}),e.jsx("button",{className:"browse__sidebar-close",onClick:()=>_(!1),"aria-label":"Close filters",children:"✕"})]}),e.jsx("div",{className:"sidebar__section-label",children:"Category"}),e.jsx(pe,{category:m,subCategory:o,onCategory:V,onSub:S}),e.jsx("div",{className:"sidebar__divider"}),e.jsx("div",{className:"sidebar__section-label",children:"Price"}),e.jsxs("div",{className:"price-filter",children:[e.jsxs("div",{className:"price-filter__inputs",children:[e.jsxs("label",{className:"price-filter__field",children:[e.jsx("span",{className:"price-filter__field-label",children:"Min"}),e.jsxs("span",{className:"price-filter__box",children:[e.jsx(C,{className:"price-filter__coin"}),e.jsx("input",{type:"number",min:"0","aria-label":"Minimum price",placeholder:"0",value:f,onChange:s=>k(s.target.value)})]})]}),e.jsx("span",{className:"price-filter__to",children:"to"}),e.jsxs("label",{className:"price-filter__field",children:[e.jsx("span",{className:"price-filter__field-label",children:"Max"}),e.jsxs("span",{className:"price-filter__box",children:[e.jsx(C,{className:"price-filter__coin"}),e.jsx("input",{type:"number",min:"0","aria-label":"Maximum price",placeholder:"0",value:x,onChange:s=>M(s.target.value)})]})]})]}),e.jsxs("div",{className:"price-filter__slider",style:{"--min-pct":`${re}%`,"--max-pct":`${ie}%`},children:[e.jsx("div",{className:"price-filter__track","aria-hidden":!0}),e.jsx("div",{className:"price-filter__fill","aria-hidden":!0}),e.jsx("input",{type:"range",min:0,max:t,value:y,"aria-label":"Minimum price slider",onChange:s=>te(Number(s.target.value))}),e.jsx("input",{type:"range",min:0,max:t,value:v,"aria-label":"Maximum price slider",onChange:s=>ne(Number(s.target.value))})]}),e.jsxs("div",{className:"price-filter__range",children:[e.jsxs("span",{className:"price-filter__range-val",children:[e.jsx(C,{className:"price-filter__coin"}),y.toLocaleString()]}),e.jsxs("span",{className:"price-filter__range-val",children:[e.jsx(C,{className:"price-filter__coin"}),v.toLocaleString()]})]})]}),e.jsx("div",{className:"sidebar__divider"}),e.jsxs("button",{type:"button",className:"sidebar__section-toggle","aria-expanded":w,onClick:()=>Q(s=>!s),children:[e.jsx("span",{className:"sidebar__section-label",children:"Rarity"}),e.jsx("span",{className:`ico ico-chevron sidebar__section-chev${w?" is-up":""}`,"aria-hidden":!0})]}),w?e.jsx("div",{className:"rarity-filter",children:_e.map(s=>e.jsxs("label",{className:`rarity-filter__check${l.includes(s)?" is-on":""}`,children:[e.jsx("input",{type:"checkbox",checked:l.includes(s),onChange:()=>Y(s)}),e.jsx("span",{children:s})]},s))}):null,e.jsxs("div",{className:"browse__sidebar-foot",children:[e.jsx("button",{type:"button",className:"browse__clear",onClick:ee,children:"Clear Filters"}),e.jsx("button",{type:"button",className:"browse__apply",onClick:()=>_(!1),children:"Apply"})]})]}),e.jsxs("div",{className:"browse__main",children:[e.jsx(fe,{sort:p,onSort:K,total:L,loading:c,query:n,onOpenFilters:()=>_(!0)}),z&&b.some(s=>s.source==="legacy")?e.jsx("p",{className:"market-banner market-banner--warn",children:"Some market prices are temporarily unavailable — buying those items is paused for a moment. Please try again shortly."}):null,J?e.jsx("p",{className:"error",children:"Couldn’t load items — please try again."}):null,e.jsx("div",{className:"grid",children:c?e.jsx(B,{count:15}):e.jsxs(e.Fragment,{children:[b.map(s=>s.source==="legacy"?e.jsx(T,{item:s,mode:"market",marketPriceCredits:H(s),onBuyNow:se},s.id):e.jsx(T,{item:s},s.id)),O?e.jsx(B,{count:6}):null]})}),e.jsx(he,{hasNextPage:X,isFetching:O,onLoadMore:()=>void Z()}),!c&&b.length===0?e.jsx("p",{className:"muted",children:"No items match your filters."}):null]}),F&&N?e.jsx(me,{listing:F,rate:N,onClose:()=>P(null),onSold:()=>{P(null),ae()}}):null]})}export{Fe as Assets};
1
+ import{u as le,r as i,j as e}from"./react-yytiy0wi.js";import{u as ce,t as W,C,A as T,f as oe}from"./index-CYWpV70P.js";import{m as de}from"./mana-rate-DgCtJ5pM.js";import{u as ue,M as me}from"./MarketCheckout-k3hh1fMb.js";import{S as $,C as pe,R as _e,F as fe,a as B,b as xe}from"./categories-Dqa3M8i7.js";import{L as he}from"./LoadMore-CiZkVzux.js";import{u as be}from"./useInfiniteGrid-BAS-zEte.js";import"./ethers-DArfy-QF.js";import"./index-Ct5KJb97.js";import"./buy-C_OnDZx3.js";import"./trade-encoding-Drnx1u3j.js";import"./buy-gasless-uH5qu5A8.js";const ge=48,t=1e5;function Ne(r){return{tradeId:r.tradeId??r.id,listingType:"primary",contractAddress:r.contractAddress,itemId:r.itemId??"",name:r.name,thumbnail:r.thumbnail,rarity:r.rarity,category:r.category,wearableCategory:r.wearableCategory??null,creator:r.creator,manaWei:r.manaWei??"0",available:1,network:r.network,chainId:r.chainId,createdAt:0}}function Fe(){const[r]=le(),n=(r.get("q")??"").trim().toLowerCase(),G=ce(),[m,R]=i.useState("wearable"),[o,S]=i.useState(null),[l,A]=i.useState([]),[f,k]=i.useState(""),[x,M]=i.useState(""),[p,K]=i.useState("newest"),[w,Q]=i.useState(!1),[h,_]=i.useState(!1),[F,P]=i.useState(null);i.useEffect(()=>{if(!h)return;const s=a=>{a.key==="Escape"&&_(!1)};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[h]);const d=f&&!Number.isNaN(Number(f))?Number(f):void 0,u=x&&!Number.isNaN(Number(x))?Number(x):void 0,U=o?xe[o]:void 0,D=($.find(s=>s.key===p)??$[0]).server,I={category:m,rarities:l.length?l:void 0,wearableCategories:U,minPriceCredits:d,maxPriceCredits:u,search:n||void 0,sortBy:D},{items:b,total:L,isLoading:c,error:J,hasNextPage:X,isFetchingNextPage:O,fetchNextPage:Z}=be(["unified-listings",I],s=>oe({...I,first:ge,skip:s})),g=L,{data:N,isError:z}=ue(),H=s=>N&&s.manaWei?de(s.manaWei,N):null,q=i.useRef(null);i.useEffect(()=>{c||!n||q.current===n||(q.current=n,W("Shop Searched",{query:n,result_count:g}))},[n,c,g]);const j=i.useRef("__init__");i.useEffect(()=>{if(c)return;const s=JSON.stringify({category:m,subCategory:o,rarities:l,min:d,max:u,sort:p});if(j.current==="__init__"||j.current===s){j.current=s;return}j.current=s,W("Shop Applied Filter",{filters:{category:m,sub_category:o,rarities:l,min_price_credits:d??null,max_price_credits:u??null,sort:p},result_count:g})},[m,o,l,d,u,p,c,g]);function V(s){R(s),S(null)}function Y(s){A(a=>a.includes(s)?a.filter(E=>E!==s):[...a,s])}function ee(){R("wearable"),S(null),A([]),k(""),M("")}function se(s){const a=b.find(E=>E.id===s.id);a&&a.source==="legacy"&&a.manaWei&&P(Ne(a))}function ae(){G.invalidateQueries({queryKey:["unified-listings"]})}const y=d!=null?Math.min(d,t):0,v=u!=null?Math.min(u,t):t,re=y/t*100,ie=v/t*100;function te(s){const a=Math.min(s,v);k(a<=0?"":String(a))}function ne(s){const a=Math.max(s,y);M(a>=t?"":String(a))}return e.jsxs("div",{className:"browse browse--sidebar",children:[h?e.jsx("div",{className:"browse__scrim",onClick:()=>_(!1),"aria-hidden":!0}):null,e.jsxs("aside",{className:`browse__sidebar${h?" is-open":""}`,children:[e.jsxs("div",{className:"browse__sidebar-head",children:[e.jsx("span",{className:"browse__sidebar-title",children:"Filters"}),e.jsx("button",{className:"browse__sidebar-close",onClick:()=>_(!1),"aria-label":"Close filters",children:"✕"})]}),e.jsx("div",{className:"sidebar__section-label",children:"Category"}),e.jsx(pe,{category:m,subCategory:o,onCategory:V,onSub:S}),e.jsx("div",{className:"sidebar__divider"}),e.jsx("div",{className:"sidebar__section-label",children:"Price"}),e.jsxs("div",{className:"price-filter",children:[e.jsxs("div",{className:"price-filter__inputs",children:[e.jsxs("label",{className:"price-filter__field",children:[e.jsx("span",{className:"price-filter__field-label",children:"Min"}),e.jsxs("span",{className:"price-filter__box",children:[e.jsx(C,{className:"price-filter__coin"}),e.jsx("input",{type:"number",min:"0","aria-label":"Minimum price",placeholder:"0",value:f,onChange:s=>k(s.target.value)})]})]}),e.jsx("span",{className:"price-filter__to",children:"to"}),e.jsxs("label",{className:"price-filter__field",children:[e.jsx("span",{className:"price-filter__field-label",children:"Max"}),e.jsxs("span",{className:"price-filter__box",children:[e.jsx(C,{className:"price-filter__coin"}),e.jsx("input",{type:"number",min:"0","aria-label":"Maximum price",placeholder:"0",value:x,onChange:s=>M(s.target.value)})]})]})]}),e.jsxs("div",{className:"price-filter__slider",style:{"--min-pct":`${re}%`,"--max-pct":`${ie}%`},children:[e.jsx("div",{className:"price-filter__track","aria-hidden":!0}),e.jsx("div",{className:"price-filter__fill","aria-hidden":!0}),e.jsx("input",{type:"range",min:0,max:t,value:y,"aria-label":"Minimum price slider",onChange:s=>te(Number(s.target.value))}),e.jsx("input",{type:"range",min:0,max:t,value:v,"aria-label":"Maximum price slider",onChange:s=>ne(Number(s.target.value))})]}),e.jsxs("div",{className:"price-filter__range",children:[e.jsxs("span",{className:"price-filter__range-val",children:[e.jsx(C,{className:"price-filter__coin"}),y.toLocaleString()]}),e.jsxs("span",{className:"price-filter__range-val",children:[e.jsx(C,{className:"price-filter__coin"}),v.toLocaleString()]})]})]}),e.jsx("div",{className:"sidebar__divider"}),e.jsxs("button",{type:"button",className:"sidebar__section-toggle","aria-expanded":w,onClick:()=>Q(s=>!s),children:[e.jsx("span",{className:"sidebar__section-label",children:"Rarity"}),e.jsx("span",{className:`ico ico-chevron sidebar__section-chev${w?" is-up":""}`,"aria-hidden":!0})]}),w?e.jsx("div",{className:"rarity-filter",children:_e.map(s=>e.jsxs("label",{className:`rarity-filter__check${l.includes(s)?" is-on":""}`,children:[e.jsx("input",{type:"checkbox",checked:l.includes(s),onChange:()=>Y(s)}),e.jsx("span",{children:s})]},s))}):null,e.jsxs("div",{className:"browse__sidebar-foot",children:[e.jsx("button",{type:"button",className:"browse__clear",onClick:ee,children:"Clear Filters"}),e.jsx("button",{type:"button",className:"browse__apply",onClick:()=>_(!1),children:"Apply"})]})]}),e.jsxs("div",{className:"browse__main",children:[e.jsx(fe,{sort:p,onSort:K,total:L,loading:c,query:n,onOpenFilters:()=>_(!0)}),z&&b.some(s=>s.source==="legacy")?e.jsx("p",{className:"market-banner market-banner--warn",children:"Some market prices are temporarily unavailable — buying those items is paused for a moment. Please try again shortly."}):null,J?e.jsx("p",{className:"error",children:"Couldn’t load items — please try again."}):null,e.jsx("div",{className:"grid",children:c?e.jsx(B,{count:15}):e.jsxs(e.Fragment,{children:[b.map(s=>s.source==="legacy"?e.jsx(T,{item:s,mode:"market",marketPriceCredits:H(s),onBuyNow:se},s.id):e.jsx(T,{item:s},s.id)),O?e.jsx(B,{count:6}):null]})}),e.jsx(he,{hasNextPage:X,isFetching:O,onLoadMore:()=>void Z()}),!c&&b.length===0?e.jsx("p",{className:"muted",children:"No items match your filters."}):null]}),F&&N?e.jsx(me,{listing:F,rate:N,onClose:()=>P(null),onSold:()=>{P(null),ae()}}):null]})}export{Fe as Assets};
@@ -1 +1 @@
1
- import{j as e,a as be,b as xe,r as b,L as je}from"./react-yytiy0wi.js";import{C as v,ae as R,af as N,b as fe,d as ke,v as ge,u as Ne,q as Y,ag as ve,A as Ce,t as q,ah as se,ai as we,k as B,h as Se,j as Me,y as Pe,w as ae,aj as Le,z as te,l as Ee,ak as Ie}from"./index-DgPN63Jh.js";import{a as ce}from"./buy-D_7yggiZ.js";import{g as Be,a as Re,w as Te,S as We,G as Ae}from"./buy-gasless-DdXBIm99.js";import{R as F,r as qe}from"./cart-checkout-C6slCzLp.js";import{c as Fe,C as Ue}from"./payments-Cz9uOQEa.js";import"./ethers-DArfy-QF.js";import"./trade-encoding-CWQaROcB.js";import"./index-B2Zw4G7Z.js";function ze(a){const{phase:c,balanceCredits:d,onClose:l}=a,C=c==="processing",i=c!=="complete",P=c==="nofunds"?"Buy Credits and Items":"Buy Assets",h=c==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":"Check out your cart",children:[e.jsx("div",{className:"buy-modal__scrim",onClick:C?void 0:l,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${h?" buy-modal__card--tall":""}`,children:[i&&e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:P}),!C&&e.jsx("button",{className:"buy-modal__x",onClick:l,"aria-label":"Close",children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:c==="nofunds"?"DCL Balance:":"My Credits Balance:"}),e.jsx(v,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:R(d)})]})]}),c==="processing"&&e.jsx($e,{step:a.step??1,total:a.total??1}),c==="nofunds"&&e.jsx(Ke,{lines:a.lines??[],shortfallCredits:a.shortfallCredits??0,packs:a.packs??[],selectedPack:a.selectedPack??"",onSelectPack:a.onSelectPack??(()=>{}),onBuyPacks:a.onBuyPacks??(()=>{}),onCancel:l}),c==="complete"&&e.jsx(Ye,{purchased:a.purchased??[],onMyAssets:a.onMyAssets??l,onTryInWorld:a.onTryInWorld??l}),c==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx("p",{className:"buy-modal__error",children:a.message}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:l,children:"Close"})})]})]})]})}function $e({step:a,total:c}){return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:"/icon-192.png",alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:"Completing transaction…"}),e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})}),e.jsxs("span",{className:"cart-checkout__step",children:[a,"/",c]})]})]})}function Ke({lines:a,shortfallCredits:c,packs:d,selectedPack:l,onSelectPack:C,onBuyPacks:i,onCancel:P}){const h=d.find(n=>n.id===l);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:"buy-modal__warning-ico",children:[e.jsx("path",{d:"M12 3L2 20h20L12 3z",fill:"none",stroke:"#691fa9",strokeWidth:"1.8",strokeLinejoin:"round"}),e.jsx("path",{d:"M12 9v5",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"17",r:"1.1",fill:"#691fa9"})]}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:"Insufficient Funds."})," You will need to buy ",e.jsxs("b",{children:[Math.max(0,c)," Credits"]})," to purchase",a.length===1?" this item.":" these items."]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:a.map(n=>e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:n.item.thumbnail?e.jsx("img",{src:n.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsx("div",{className:"buy-modal__asset-name",title:n.item.name,children:n.item.name||"Item"}),n.item.creator?e.jsxs("div",{className:"buy-modal__asset-creator",children:["By ",n.item.creator]}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(v,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:R(n.priceCredits)})]})]})]},n.item.id))}),e.jsx("div",{className:"buy-modal__packs",children:d.map(n=>{const w=n.id===l;return e.jsxs("button",{className:`buy-modal__pack${w?" buy-modal__pack--on":""}`,onClick:()=>C(n.id),children:[e.jsx(v,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:R(n.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(v,{className:"buy-modal__total-ico"}),e.jsx("span",{children:R((h==null?void 0:h.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((h==null?void 0:h.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:P,children:"Cancel"}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:i,children:"Buy"})]})]})}function Ye({purchased:a,onMyAssets:c,onTryInWorld:d}){return e.jsxs("div",{className:"buy-modal__body cart-checkout__done-body",children:[e.jsxs("div",{className:"buy-modal__success",children:[e.jsxs("svg",{viewBox:"0 0 64 64",width:"60",height:"60","aria-hidden":!0,children:[e.jsx("circle",{cx:"32",cy:"32",r:"32",fill:"#34ce77"}),e.jsx("path",{d:"M20 33l8 8 16-18",fill:"none",stroke:"#fff",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsxs("p",{className:"buy-modal__success-text",children:[e.jsx("b",{children:"Your purchase was successful!"})," You can find your item in the My Assets tab."]})]}),e.jsx("div",{className:"cart-checkout__done",children:e.jsx("div",{className:"cart-checkout__done-scroll",children:a.map(l=>e.jsxs("div",{className:"cart-checkout__done-row",children:[e.jsxs("div",{className:"cart-checkout__done-thumb",children:[l.thumbnail?e.jsx("img",{src:l.thumbnail,alt:""}):null,e.jsx("span",{className:"cart-checkout__done-check","aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 18 18",width:"12",height:"12",children:e.jsx("path",{d:"M4 9l3.5 3.5L14 5",fill:"none",stroke:"#fff",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"cart-checkout__done-info",children:[e.jsx("div",{className:"cart-checkout__done-name",title:l.name,children:l.name||"Item"}),l.creator?e.jsxs("div",{className:"cart-checkout__done-creator",children:["By ",l.creator]}):null]}),e.jsxs("div",{className:"cart-checkout__done-price",children:[e.jsx(v,{className:"cart-checkout__done-price-ico"}),e.jsx("span",{children:R(l.priceCredits)})]})]},l.id))})}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:c,children:"My assets"}),e.jsxs("button",{className:"buy-modal__btn buy-modal__btn--ruby",onClick:d,children:["Try in world",e.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20","aria-hidden":!0,children:e.jsx("path",{d:"M5 12h12M13 7l5 5-5 5",fill:"none",stroke:"#fcfcfc",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})}function re(a){const c=a,d=(c.message??"").toLowerCase();return c.code===4001||d.includes("reject")||d.includes("denied")||d.includes("cancel")?"You cancelled the request.":d.includes("insufficient")?`You don't have enough ${Me.name} — get more first.`:d.includes("no active listing")||d.includes("your own listing")?c.message:"Couldn't complete checkout — please try again."}function Qe(a){const c=a;return c.code===402||c.status===402||(c.message??"").toLowerCase().includes("insufficient")}const Oe=12e4,U=Ue.slice(0,3),Ge=Se.chainId===80002?"https://decentraland.zone/jump":"https://decentraland.org/jump";function De(a){const c=[];return a.unavailable.length&&c.push(`${a.unavailable.length} no longer available`),a.own.length&&c.push(`${a.own.length} you can't buy (your own listing)`),`Removed ${c.join(" and ")} from your cart.`}function cs(){const a=N(s=>s.items),c=N(s=>s.remove),d=N(s=>s.clear),l=N(s=>s.restore),C=N(s=>s.setFittingOpen),{session:i}=fe(),P=a.some(s=>s.category!=="emote"),{data:h}=ke({queryKey:["upsell-listings"],queryFn:()=>Ie({first:40}),staleTime:6e4}),{data:n}=ge(i),w=Ne(),T=be(),{state:S}=xe(),[Q,L]=b.useState(null),[O,f]=b.useState(null),[G,W]=b.useState(null),[ne,M]=b.useState(!1),[y,E]=b.useState(null),D=b.useRef(0),[o,k]=b.useState(null),[z,J]=b.useState(""),ie=a.reduce((s,t)=>s+t.priceCredits,0),le=y?y.liveTotalCredits:ie,oe=new Set(a.map(s=>s.id)),V=((h==null?void 0:h.items)??[]).filter(s=>!oe.has(s.id)).slice(0,6),de=new Map(y==null?void 0:y.buyable.map(s=>[s.item.id,s])),A=(n==null?void 0:n.credits)??0,ue=we;function H(s){s(),E(null),W(null),f(null)}function he(){k(null),M(!1)}function X(s){const t=s.reduce((x,u)=>x+u.priceCredits,0),r=Math.max(0,t-A),p=U.find(x=>x.credits>=r)??U[U.length-1];J(p.id),q("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:t,credits_balance:A,shortfall:r}),k({phase:"nofunds",lines:s.map(x=>({item:x.item,priceCredits:x.priceCredits})),shortfall:r}),M(!1)}async function me(s){if(!i||s.length===0)return;const t=s.map(u=>({...u.item,priceCredits:u.priceCredits})),r=[];let p="authorize",x=!1;k({phase:"processing",step:1,total:s.length});try{const u=[];for(let m=0;m<s.length;m++){const g=s[m];k({phase:"processing",step:m+1,total:s.length});try{const{credit:_,maxCreditedValue:K}=await Pe(i.identity,g.usdCents,g.trade.id);r.push(_.id),u.push({trade:g.trade,credits:[_],maxCreditedValue:K})}catch(_){if(Qe(_)){if(r.length){try{await ae(i.identity,r)}catch(K){B(K,{flow:"cart_checkout",step:"release"})}w.invalidateQueries({queryKey:["usd-balance"]})}X(s);return}throw _}}p="submit";let j=[];if(Be())try{j=await Re({purchases:u,buyer:i.address,signer:i.signer});const g=(await Promise.allSettled(j.map(_=>Te(_)))).flatMap(_=>_.status==="rejected"?[_.reason]:[]);if(g.length&&!g.some(_=>_ instanceof We))throw g[0];x=!0}catch(m){if(!(m instanceof Ae))throw m;j=await ce({purchases:u,buyer:i.address,signer:i.signer})}else j=await ce({purchases:u,buyer:i.address,signer:i.signer});s.forEach(m=>c(m.item.id)),E(null),q("Shop Completed Purchase",{...Le(t),payment_type:"credits",no_crypto_step:x,transaction_hash:j[0]??null}),w.invalidateQueries({queryKey:["usd-balance"]}),k({phase:"complete",purchased:t})}catch(u){if(te(u)||B(u,{flow:"cart_checkout",step:p,cart_size:s.length}),q(te(u)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:p,error_code:Ee(u),value_usd:se(t.reduce((j,m)=>j+m.priceCredits,0)),cart_size:s.length}),r.length){try{await ae(i.identity,r)}catch(j){B(j,{flow:"cart_checkout",step:"release"})}w.invalidateQueries({queryKey:["usd-balance"]})}k({phase:"error",message:re(u)})}}function Z(s){const t=s.reduce((r,p)=>r+p.priceCredits,0);if(n!=null&&n.credits<t){X(s);return}me(s)}async function $(){if(!i){f("Sign in to check out.");return}const s=N.getState().items;if(s.length!==0){f(null),W(null),M(!0),q("Shop Started Checkout",{cart_size:s.length,cart_value_credits:s.reduce((t,r)=>t+r.priceCredits,0),cart_value_usd:se(s.reduce((t,r)=>t+r.priceCredits,0)),has_sufficient_credits:A>=s.reduce((t,r)=>t+r.priceCredits,0)});try{L("Reviewing your cart…");const t=await qe(s,i.address,ue),r=[...t.unavailable,...t.own];if(r.length&&(r.forEach(p=>c(p.id)),W(De(t))),t.buyable.length===0){f("None of these items are available to buy right now."),E(null),L(null);return}if(t.orderChanged){E(t),D.current=Date.now(),L(null);return}L(null),Z(t.buyable)}catch(t){B(t,{flow:"cart_checkout",step:"review",cart_size:s.length}),f(re(t)),L(null)}finally{M(!1)}}}async function _e(){if(y){if(!i){f("Sign in to check out.");return}if(Date.now()-D.current>Oe){E(null),W(null),await $();return}f(null),Z(y.buyable)}}async function pe(){if(z){try{sessionStorage.setItem(F,JSON.stringify(N.getState().items))}catch{}M(!0);try{const s=await Fe(z,i?{address:i.address,identity:i.identity}:void 0);if(s.url){window.location.href=s.url;return}T("/credits")}catch(s){try{sessionStorage.removeItem(F)}catch{}B(s,{flow:"cart_buy_credits"}),k({phase:"error",message:"Couldn't start the credits checkout — please try again."})}finally{M(!1)}}}const ee=b.useRef(!1);b.useEffect(()=>{if(!(S!=null&&S.resumeCheckout)||ee.current)return;ee.current=!0;try{const t=sessionStorage.getItem(F);if(t){sessionStorage.removeItem(F);const r=JSON.parse(t);Array.isArray(r)&&r.length&&l(r)}}catch{}w.invalidateQueries({queryKey:["usd-balance"]});const s=setTimeout(()=>void $(),0);return()=>clearTimeout(s)},[S==null?void 0:S.resumeCheckout]);const I=ne||(o==null?void 0:o.phase)==="processing";if(a.length===0&&!o)return e.jsxs("div",{className:"cart cart--empty",children:[e.jsx("span",{className:"ico ico-cart cart-empty__ico","aria-hidden":!0}),e.jsx("p",{className:"cart-empty__title",children:Y("cart.empty.title")}),e.jsx("p",{className:"muted",children:Y("cart.empty.body")}),e.jsx(je,{className:"btn btn--purple",to:"/assets",children:Y("cart.empty.cta")})]});const ye=a.length===1?"Item":"Items";return e.jsxs("div",{className:"checkout",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>T(-1),type:"button",children:[e.jsx("span",{className:"ico ico-arrow-left","aria-hidden":!0}),"Cart"]}),e.jsxs("div",{className:"checkout__body",children:[e.jsxs("section",{className:"checkout__panel",children:[e.jsxs("div",{className:"checkout__panel-head",children:[e.jsx("button",{className:"checkout__panel-back",onClick:()=>T(-1),type:"button","aria-label":"Go back",children:e.jsx("span",{className:"ico ico-arrow-left","aria-hidden":!0})}),e.jsxs("h1",{className:"checkout__panel-title",children:["Cart: ",a.length," ",ye]}),P?e.jsxs("button",{className:"checkout__fitting",onClick:()=>C(!0),disabled:I,children:[e.jsx("span",{className:"ico ico-emote-dance checkout__fitting-ico","aria-hidden":!0}),"Fitting Room"]}):null]}),e.jsx("div",{className:"checkout__list",children:a.map(s=>{const t=de.get(s.id),r=t?t.priceCredits:s.priceCredits,p=!!t&&t.priceCredits!==s.priceCredits;return e.jsxs("div",{className:"checkout__card",children:[e.jsxs("div",{className:"checkout__thumb",children:[s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null,e.jsx("span",{className:"checkout__thumb-check","aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"checkout__info",children:[e.jsxs("div",{className:"checkout__desc",children:[e.jsx("div",{className:"checkout__name",title:s.name,children:s.name}),s.creator?e.jsx(ve,{address:s.creator,className:"checkout__creator",linkToProfile:!0}):null]}),e.jsxs("div",{className:"checkout__foot",children:[e.jsxs("span",{className:"checkout__qty","aria-label":"Quantity: 1",children:[e.jsx("span",{className:"checkout__qty-sign","aria-hidden":!0,children:"−"}),e.jsx("span",{className:"checkout__qty-num",children:"1"}),e.jsx("span",{className:"checkout__qty-sign","aria-hidden":!0,children:"+"})]}),e.jsxs("div",{className:"checkout__price",children:[e.jsx(v,{className:"checkout__price-ico"})," ",r,p?e.jsx("span",{className:"checkout__price-was",children:s.priceCredits}):null]})]})]}),e.jsx("button",{className:"checkout__remove",onClick:()=>H(()=>c(s.id)),disabled:I,"aria-label":`Remove ${s.name}`,title:"Remove",children:e.jsx("span",{className:"ico ico-trash","aria-hidden":!0})})]},s.id)})}),e.jsxs("div",{className:"checkout__utils",children:[e.jsx("button",{className:"link",onClick:()=>H(d),disabled:I,children:"Clear cart"}),null]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:"Purchase Summary"}),e.jsxs("div",{className:"checkout__summary-body",children:[e.jsxs("div",{className:"checkout__total-line",children:[e.jsxs("span",{className:"checkout__total-label",children:["Total: ",a.length," ",a.length===1?"item":"items"]}),e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(v,{className:"checkout__total-ico"})," ",le]})]}),e.jsx("button",{className:"checkout__cta",onClick:y?_e:$,disabled:I,children:I?"Working…":y?"Confirm purchase":"Buy now"}),y?e.jsx("p",{className:"muted checkout__msg",children:"Prices or availability changed since you added these — review the updated total and confirm to buy."}):null,G?e.jsx("p",{className:"muted checkout__msg",children:G}):null,Q?e.jsx("p",{className:"muted checkout__msg",children:Q}):null,O?e.jsx("p",{className:"error checkout__msg",children:O}):null]})]})]}),V.length>0?e.jsxs("section",{className:"row cart-upsell",children:[e.jsx("div",{className:"row__head",children:e.jsx("h2",{className:"row__title",children:"You might also like"})}),e.jsx("div",{className:"row__track",children:V.map(s=>e.jsx(Ce,{item:s},s.id))})]}):null,o?e.jsx(ze,{phase:o.phase,balanceCredits:A,onClose:he,step:o.phase==="processing"?o.step:void 0,total:o.phase==="processing"?o.total:void 0,lines:o.phase==="nofunds"?o.lines:void 0,shortfallCredits:o.phase==="nofunds"?o.shortfall:void 0,packs:U,selectedPack:z,onSelectPack:J,onBuyPacks:pe,purchased:o.phase==="complete"?o.purchased:void 0,onMyAssets:()=>T("/assets?tab=mine"),onTryInWorld:()=>window.open(Ge,"_blank","noopener"),message:o.phase==="error"?o.message:void 0}):null]})}export{cs as Cart};
1
+ import{j as e,a as be,b as xe,r as b,L as je}from"./react-yytiy0wi.js";import{C as v,ae as R,af as N,b as fe,d as ke,v as ge,u as Ne,q as Y,ag as ve,A as Ce,t as q,ah as se,ai as we,k as B,h as Se,j as Me,y as Pe,w as ae,aj as Le,z as te,l as Ee,ak as Ie}from"./index-CYWpV70P.js";import{a as ce}from"./buy-C_OnDZx3.js";import{g as Be,a as Re,w as Te,S as We,G as Ae}from"./buy-gasless-uH5qu5A8.js";import{R as F,r as qe}from"./cart-checkout-DJSPllz1.js";import{c as Fe,C as Ue}from"./payments-CFEkq9jj.js";import"./ethers-DArfy-QF.js";import"./trade-encoding-Drnx1u3j.js";import"./index-Ct5KJb97.js";function ze(a){const{phase:c,balanceCredits:d,onClose:l}=a,C=c==="processing",i=c!=="complete",P=c==="nofunds"?"Buy Credits and Items":"Buy Assets",h=c==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":"Check out your cart",children:[e.jsx("div",{className:"buy-modal__scrim",onClick:C?void 0:l,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${h?" buy-modal__card--tall":""}`,children:[i&&e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:P}),!C&&e.jsx("button",{className:"buy-modal__x",onClick:l,"aria-label":"Close",children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:c==="nofunds"?"DCL Balance:":"My Credits Balance:"}),e.jsx(v,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:R(d)})]})]}),c==="processing"&&e.jsx($e,{step:a.step??1,total:a.total??1}),c==="nofunds"&&e.jsx(Ke,{lines:a.lines??[],shortfallCredits:a.shortfallCredits??0,packs:a.packs??[],selectedPack:a.selectedPack??"",onSelectPack:a.onSelectPack??(()=>{}),onBuyPacks:a.onBuyPacks??(()=>{}),onCancel:l}),c==="complete"&&e.jsx(Ye,{purchased:a.purchased??[],onMyAssets:a.onMyAssets??l,onTryInWorld:a.onTryInWorld??l}),c==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx("p",{className:"buy-modal__error",children:a.message}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:l,children:"Close"})})]})]})]})}function $e({step:a,total:c}){return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:"/icon-192.png",alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:"Completing transaction…"}),e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})}),e.jsxs("span",{className:"cart-checkout__step",children:[a,"/",c]})]})]})}function Ke({lines:a,shortfallCredits:c,packs:d,selectedPack:l,onSelectPack:C,onBuyPacks:i,onCancel:P}){const h=d.find(n=>n.id===l);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:"buy-modal__warning-ico",children:[e.jsx("path",{d:"M12 3L2 20h20L12 3z",fill:"none",stroke:"#691fa9",strokeWidth:"1.8",strokeLinejoin:"round"}),e.jsx("path",{d:"M12 9v5",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"17",r:"1.1",fill:"#691fa9"})]}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:"Insufficient Funds."})," You will need to buy ",e.jsxs("b",{children:[Math.max(0,c)," Credits"]})," to purchase",a.length===1?" this item.":" these items."]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:a.map(n=>e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:n.item.thumbnail?e.jsx("img",{src:n.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsx("div",{className:"buy-modal__asset-name",title:n.item.name,children:n.item.name||"Item"}),n.item.creator?e.jsxs("div",{className:"buy-modal__asset-creator",children:["By ",n.item.creator]}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(v,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:R(n.priceCredits)})]})]})]},n.item.id))}),e.jsx("div",{className:"buy-modal__packs",children:d.map(n=>{const w=n.id===l;return e.jsxs("button",{className:`buy-modal__pack${w?" buy-modal__pack--on":""}`,onClick:()=>C(n.id),children:[e.jsx(v,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:R(n.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(v,{className:"buy-modal__total-ico"}),e.jsx("span",{children:R((h==null?void 0:h.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((h==null?void 0:h.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:P,children:"Cancel"}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:i,children:"Buy"})]})]})}function Ye({purchased:a,onMyAssets:c,onTryInWorld:d}){return e.jsxs("div",{className:"buy-modal__body cart-checkout__done-body",children:[e.jsxs("div",{className:"buy-modal__success",children:[e.jsxs("svg",{viewBox:"0 0 64 64",width:"60",height:"60","aria-hidden":!0,children:[e.jsx("circle",{cx:"32",cy:"32",r:"32",fill:"#34ce77"}),e.jsx("path",{d:"M20 33l8 8 16-18",fill:"none",stroke:"#fff",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsxs("p",{className:"buy-modal__success-text",children:[e.jsx("b",{children:"Your purchase was successful!"})," You can find your item in the My Assets tab."]})]}),e.jsx("div",{className:"cart-checkout__done",children:e.jsx("div",{className:"cart-checkout__done-scroll",children:a.map(l=>e.jsxs("div",{className:"cart-checkout__done-row",children:[e.jsxs("div",{className:"cart-checkout__done-thumb",children:[l.thumbnail?e.jsx("img",{src:l.thumbnail,alt:""}):null,e.jsx("span",{className:"cart-checkout__done-check","aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 18 18",width:"12",height:"12",children:e.jsx("path",{d:"M4 9l3.5 3.5L14 5",fill:"none",stroke:"#fff",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"cart-checkout__done-info",children:[e.jsx("div",{className:"cart-checkout__done-name",title:l.name,children:l.name||"Item"}),l.creator?e.jsxs("div",{className:"cart-checkout__done-creator",children:["By ",l.creator]}):null]}),e.jsxs("div",{className:"cart-checkout__done-price",children:[e.jsx(v,{className:"cart-checkout__done-price-ico"}),e.jsx("span",{children:R(l.priceCredits)})]})]},l.id))})}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:c,children:"My assets"}),e.jsxs("button",{className:"buy-modal__btn buy-modal__btn--ruby",onClick:d,children:["Try in world",e.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20","aria-hidden":!0,children:e.jsx("path",{d:"M5 12h12M13 7l5 5-5 5",fill:"none",stroke:"#fcfcfc",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})}function re(a){const c=a,d=(c.message??"").toLowerCase();return c.code===4001||d.includes("reject")||d.includes("denied")||d.includes("cancel")?"You cancelled the request.":d.includes("insufficient")?`You don't have enough ${Me.name} — get more first.`:d.includes("no active listing")||d.includes("your own listing")?c.message:"Couldn't complete checkout — please try again."}function Qe(a){const c=a;return c.code===402||c.status===402||(c.message??"").toLowerCase().includes("insufficient")}const Oe=12e4,U=Ue.slice(0,3),Ge=Se.chainId===80002?"https://decentraland.zone/jump":"https://decentraland.org/jump";function De(a){const c=[];return a.unavailable.length&&c.push(`${a.unavailable.length} no longer available`),a.own.length&&c.push(`${a.own.length} you can't buy (your own listing)`),`Removed ${c.join(" and ")} from your cart.`}function cs(){const a=N(s=>s.items),c=N(s=>s.remove),d=N(s=>s.clear),l=N(s=>s.restore),C=N(s=>s.setFittingOpen),{session:i}=fe(),P=a.some(s=>s.category!=="emote"),{data:h}=ke({queryKey:["upsell-listings"],queryFn:()=>Ie({first:40}),staleTime:6e4}),{data:n}=ge(i),w=Ne(),T=be(),{state:S}=xe(),[Q,L]=b.useState(null),[O,f]=b.useState(null),[G,W]=b.useState(null),[ne,M]=b.useState(!1),[y,E]=b.useState(null),D=b.useRef(0),[o,k]=b.useState(null),[z,J]=b.useState(""),ie=a.reduce((s,t)=>s+t.priceCredits,0),le=y?y.liveTotalCredits:ie,oe=new Set(a.map(s=>s.id)),V=((h==null?void 0:h.items)??[]).filter(s=>!oe.has(s.id)).slice(0,6),de=new Map(y==null?void 0:y.buyable.map(s=>[s.item.id,s])),A=(n==null?void 0:n.credits)??0,ue=we;function H(s){s(),E(null),W(null),f(null)}function he(){k(null),M(!1)}function X(s){const t=s.reduce((x,u)=>x+u.priceCredits,0),r=Math.max(0,t-A),p=U.find(x=>x.credits>=r)??U[U.length-1];J(p.id),q("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:t,credits_balance:A,shortfall:r}),k({phase:"nofunds",lines:s.map(x=>({item:x.item,priceCredits:x.priceCredits})),shortfall:r}),M(!1)}async function me(s){if(!i||s.length===0)return;const t=s.map(u=>({...u.item,priceCredits:u.priceCredits})),r=[];let p="authorize",x=!1;k({phase:"processing",step:1,total:s.length});try{const u=[];for(let m=0;m<s.length;m++){const g=s[m];k({phase:"processing",step:m+1,total:s.length});try{const{credit:_,maxCreditedValue:K}=await Pe(i.identity,g.usdCents,g.trade.id);r.push(_.id),u.push({trade:g.trade,credits:[_],maxCreditedValue:K})}catch(_){if(Qe(_)){if(r.length){try{await ae(i.identity,r)}catch(K){B(K,{flow:"cart_checkout",step:"release"})}w.invalidateQueries({queryKey:["usd-balance"]})}X(s);return}throw _}}p="submit";let j=[];if(Be())try{j=await Re({purchases:u,buyer:i.address,signer:i.signer});const g=(await Promise.allSettled(j.map(_=>Te(_)))).flatMap(_=>_.status==="rejected"?[_.reason]:[]);if(g.length&&!g.some(_=>_ instanceof We))throw g[0];x=!0}catch(m){if(!(m instanceof Ae))throw m;j=await ce({purchases:u,buyer:i.address,signer:i.signer})}else j=await ce({purchases:u,buyer:i.address,signer:i.signer});s.forEach(m=>c(m.item.id)),E(null),q("Shop Completed Purchase",{...Le(t),payment_type:"credits",no_crypto_step:x,transaction_hash:j[0]??null}),w.invalidateQueries({queryKey:["usd-balance"]}),k({phase:"complete",purchased:t})}catch(u){if(te(u)||B(u,{flow:"cart_checkout",step:p,cart_size:s.length}),q(te(u)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:p,error_code:Ee(u),value_usd:se(t.reduce((j,m)=>j+m.priceCredits,0)),cart_size:s.length}),r.length){try{await ae(i.identity,r)}catch(j){B(j,{flow:"cart_checkout",step:"release"})}w.invalidateQueries({queryKey:["usd-balance"]})}k({phase:"error",message:re(u)})}}function Z(s){const t=s.reduce((r,p)=>r+p.priceCredits,0);if(n!=null&&n.credits<t){X(s);return}me(s)}async function $(){if(!i){f("Sign in to check out.");return}const s=N.getState().items;if(s.length!==0){f(null),W(null),M(!0),q("Shop Started Checkout",{cart_size:s.length,cart_value_credits:s.reduce((t,r)=>t+r.priceCredits,0),cart_value_usd:se(s.reduce((t,r)=>t+r.priceCredits,0)),has_sufficient_credits:A>=s.reduce((t,r)=>t+r.priceCredits,0)});try{L("Reviewing your cart…");const t=await qe(s,i.address,ue),r=[...t.unavailable,...t.own];if(r.length&&(r.forEach(p=>c(p.id)),W(De(t))),t.buyable.length===0){f("None of these items are available to buy right now."),E(null),L(null);return}if(t.orderChanged){E(t),D.current=Date.now(),L(null);return}L(null),Z(t.buyable)}catch(t){B(t,{flow:"cart_checkout",step:"review",cart_size:s.length}),f(re(t)),L(null)}finally{M(!1)}}}async function _e(){if(y){if(!i){f("Sign in to check out.");return}if(Date.now()-D.current>Oe){E(null),W(null),await $();return}f(null),Z(y.buyable)}}async function pe(){if(z){try{sessionStorage.setItem(F,JSON.stringify(N.getState().items))}catch{}M(!0);try{const s=await Fe(z,i?{address:i.address,identity:i.identity}:void 0);if(s.url){window.location.href=s.url;return}T("/credits")}catch(s){try{sessionStorage.removeItem(F)}catch{}B(s,{flow:"cart_buy_credits"}),k({phase:"error",message:"Couldn't start the credits checkout — please try again."})}finally{M(!1)}}}const ee=b.useRef(!1);b.useEffect(()=>{if(!(S!=null&&S.resumeCheckout)||ee.current)return;ee.current=!0;try{const t=sessionStorage.getItem(F);if(t){sessionStorage.removeItem(F);const r=JSON.parse(t);Array.isArray(r)&&r.length&&l(r)}}catch{}w.invalidateQueries({queryKey:["usd-balance"]});const s=setTimeout(()=>void $(),0);return()=>clearTimeout(s)},[S==null?void 0:S.resumeCheckout]);const I=ne||(o==null?void 0:o.phase)==="processing";if(a.length===0&&!o)return e.jsxs("div",{className:"cart cart--empty",children:[e.jsx("span",{className:"ico ico-cart cart-empty__ico","aria-hidden":!0}),e.jsx("p",{className:"cart-empty__title",children:Y("cart.empty.title")}),e.jsx("p",{className:"muted",children:Y("cart.empty.body")}),e.jsx(je,{className:"btn btn--purple",to:"/assets",children:Y("cart.empty.cta")})]});const ye=a.length===1?"Item":"Items";return e.jsxs("div",{className:"checkout",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>T(-1),type:"button",children:[e.jsx("span",{className:"ico ico-arrow-left","aria-hidden":!0}),"Cart"]}),e.jsxs("div",{className:"checkout__body",children:[e.jsxs("section",{className:"checkout__panel",children:[e.jsxs("div",{className:"checkout__panel-head",children:[e.jsx("button",{className:"checkout__panel-back",onClick:()=>T(-1),type:"button","aria-label":"Go back",children:e.jsx("span",{className:"ico ico-arrow-left","aria-hidden":!0})}),e.jsxs("h1",{className:"checkout__panel-title",children:["Cart: ",a.length," ",ye]}),P?e.jsxs("button",{className:"checkout__fitting",onClick:()=>C(!0),disabled:I,children:[e.jsx("span",{className:"ico ico-emote-dance checkout__fitting-ico","aria-hidden":!0}),"Fitting Room"]}):null]}),e.jsx("div",{className:"checkout__list",children:a.map(s=>{const t=de.get(s.id),r=t?t.priceCredits:s.priceCredits,p=!!t&&t.priceCredits!==s.priceCredits;return e.jsxs("div",{className:"checkout__card",children:[e.jsxs("div",{className:"checkout__thumb",children:[s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null,e.jsx("span",{className:"checkout__thumb-check","aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"checkout__info",children:[e.jsxs("div",{className:"checkout__desc",children:[e.jsx("div",{className:"checkout__name",title:s.name,children:s.name}),s.creator?e.jsx(ve,{address:s.creator,className:"checkout__creator",linkToProfile:!0}):null]}),e.jsxs("div",{className:"checkout__foot",children:[e.jsxs("span",{className:"checkout__qty","aria-label":"Quantity: 1",children:[e.jsx("span",{className:"checkout__qty-sign","aria-hidden":!0,children:"−"}),e.jsx("span",{className:"checkout__qty-num",children:"1"}),e.jsx("span",{className:"checkout__qty-sign","aria-hidden":!0,children:"+"})]}),e.jsxs("div",{className:"checkout__price",children:[e.jsx(v,{className:"checkout__price-ico"})," ",r,p?e.jsx("span",{className:"checkout__price-was",children:s.priceCredits}):null]})]})]}),e.jsx("button",{className:"checkout__remove",onClick:()=>H(()=>c(s.id)),disabled:I,"aria-label":`Remove ${s.name}`,title:"Remove",children:e.jsx("span",{className:"ico ico-trash","aria-hidden":!0})})]},s.id)})}),e.jsxs("div",{className:"checkout__utils",children:[e.jsx("button",{className:"link",onClick:()=>H(d),disabled:I,children:"Clear cart"}),null]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:"Purchase Summary"}),e.jsxs("div",{className:"checkout__summary-body",children:[e.jsxs("div",{className:"checkout__total-line",children:[e.jsxs("span",{className:"checkout__total-label",children:["Total: ",a.length," ",a.length===1?"item":"items"]}),e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(v,{className:"checkout__total-ico"})," ",le]})]}),e.jsx("button",{className:"checkout__cta",onClick:y?_e:$,disabled:I,children:I?"Working…":y?"Confirm purchase":"Buy now"}),y?e.jsx("p",{className:"muted checkout__msg",children:"Prices or availability changed since you added these — review the updated total and confirm to buy."}):null,G?e.jsx("p",{className:"muted checkout__msg",children:G}):null,Q?e.jsx("p",{className:"muted checkout__msg",children:Q}):null,O?e.jsx("p",{className:"error checkout__msg",children:O}):null]})]})]}),V.length>0?e.jsxs("section",{className:"row cart-upsell",children:[e.jsx("div",{className:"row__head",children:e.jsx("h2",{className:"row__title",children:"You might also like"})}),e.jsx("div",{className:"row__track",children:V.map(s=>e.jsx(Ce,{item:s},s.id))})]}):null,o?e.jsx(ze,{phase:o.phase,balanceCredits:A,onClose:he,step:o.phase==="processing"?o.step:void 0,total:o.phase==="processing"?o.total:void 0,lines:o.phase==="nofunds"?o.lines:void 0,shortfallCredits:o.phase==="nofunds"?o.shortfall:void 0,packs:U,selectedPack:z,onSelectPack:J,onBuyPacks:pe,purchased:o.phase==="complete"?o.purchased:void 0,onMyAssets:()=>T("/assets?tab=mine"),onTryInWorld:()=>window.open(Ge,"_blank","noopener"),message:o.phase==="error"?o.message:void 0}):null]})}export{cs as Cart};
@@ -1,4 +1,4 @@
1
- import{N,O as U,P as w,Q as z,R as o,S as E,U as c,V as I,X as g,Y as D,Z as R}from"./index-DgPN63Jh.js";import{r as F,j as v}from"./react-yytiy0wi.js";function K(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const V=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,S,b,$;const t=44,W=R(P||(P=l`
1
+ import{N,O as U,P as w,Q as z,R as o,S as E,U as c,V as I,X as g,Y as D,Z as R}from"./index-CYWpV70P.js";import{r as F,j as v}from"./react-yytiy0wi.js";function K(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const V=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,S,b,$;const t=44,W=R(P||(P=l`
2
2
  0% {
3
3
  transform: rotate(0deg);
4
4
  }
@@ -1 +1 @@
1
- import{j as e,r as m,d as O,a as Q}from"./react-yytiy0wi.js";import{G as Y,q as t,h as Z,k as z,d as J,j as V,A as W,an as X,ao as ee}from"./index-DgPN63Jh.js";import{d as ae,s as M,g as re,a as se,A as te}from"./collection-BB4WIsDf.js";import{u as ce}from"./useStore-D9l09yvh.js";import{S as T,C as oe,F as ie,c as le,a as F,b as ne}from"./categories-CS5KEV15.js";import{L as de}from"./LoadMore-CiZkVzux.js";import{u as me}from"./useInfiniteGrid-BwrFUhaa.js";import"./ethers-DArfy-QF.js";function ue({name:r,creator:a}){const{data:c}=ce(a),i=(c==null?void 0:c.cover)||ae;return e.jsxs("section",{className:"collection-hero","aria-label":r,children:[e.jsxs("div",{className:"collection-hero__cover",children:[e.jsx("img",{className:"collection-hero__cover-img",src:i,alt:"",loading:"eager"}),e.jsx("div",{className:"collection-hero__scrim","aria-hidden":!0})]}),e.jsx("h1",{className:"collection-hero__title",children:r})]})}function pe({address:r}){var x,o;const{data:a}=Y(r),[c,i]=m.useState(!1);if(!r)return null;const l=(a==null?void 0:a.name)||M(r),u=(o=(x=a==null?void 0:a.avatar)==null?void 0:x.snapshots)==null?void 0:o.face256,p=`${Z.profileUrl}/${r}`,g=re(se({name:a==null?void 0:a.name,hasClaimedName:a==null?void 0:a.hasClaimedName,ethAddress:(a==null?void 0:a.ethAddress)??r}));async function n(){try{await navigator.clipboard.writeText(r),i(!0),window.setTimeout(()=>i(!1),1500)}catch(_){z(_,{flow:"copy_creator_address"})}}return e.jsxs("div",{className:"creator-card",children:[u?e.jsx("img",{className:"creator-card__ava",src:u,alt:"",loading:"eager",style:{backgroundColor:g}}):e.jsx("span",{className:"creator-card__ava creator-card__ava--ph","aria-hidden":!0,style:{backgroundColor:g}}),e.jsx("h2",{className:"creator-card__name",title:l,children:l}),e.jsxs("button",{type:"button",className:"creator-card__account",onClick:()=>void n(),title:c?t("collection.copied"):t("collection.copyAddress"),"aria-label":c?t("collection.copied"):t("collection.copyAddress"),children:[e.jsx("span",{className:"creator-card__account-text",children:M(r)}),e.jsx("span",{className:"ico ico-copy creator-card__copy","aria-hidden":!0})]}),e.jsx("a",{className:"creator-card__view",href:p,target:"_blank",rel:"noopener noreferrer",children:t("collection.viewProfile")})]})}const he=48;function Ce(){var k;const{contractAddress:r}=O(),a=Q(),[c,i]=m.useState("wearable"),[l,u]=m.useState(null),[p,g]=m.useState([]),[n,x]=m.useState(""),[o,_]=m.useState(""),[v,R]=m.useState("newest"),f=n&&!Number.isNaN(Number(n))?Number(n):void 0,C=o&&!Number.isNaN(Number(o))?Number(o):void 0,B=l?ne[l]:void 0,E=(T.find(s=>s.key===v)??T[0]).server,y={category:c,rarities:p.length?p:void 0,wearableCategories:B,minPriceCredits:f,maxPriceCredits:C,sortBy:E},{items:b,total:L,isLoading:N,error:w,hasNextPage:U,isFetchingNextPage:A,fetchNextPage:$}=me(["collection-page",r,y],s=>X(r,{...y,first:he,skip:s}),{enabled:!!r}),{data:h}=J({queryKey:["collection-meta",r],queryFn:()=>ee(r),enabled:!!r,staleTime:5*6e4}),S=(h==null?void 0:h.name)||t("collection.fallbackTitle"),P=(h==null?void 0:h.creator)||((k=b[0])==null?void 0:k.creator);function q(s){i(s),u(null)}function G(s){g(d=>d.includes(s)?d.filter(H=>H!==s):[...d,s])}function I(){i("wearable"),u(null),g([]),x(""),_("")}const j=!!(f||C),K=j?`${n||"0"}–${o||"∞"}`:t("filter.price"),D=c!=="wearable"||!!l||p.length>0||j;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":"Breadcrumb",children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>a("/assets"),children:t("collection.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:S})]}),e.jsx(ue,{name:S,creator:P}),e.jsxs("div",{className:"browse browse--sidebar collection-page__browse",children:[e.jsxs("aside",{className:"browse__sidebar",children:[e.jsx(pe,{address:P}),e.jsx(oe,{category:c,subCategory:l,onCategory:q,onSub:u,title:t("collection.category"),flat:!0})]}),e.jsxs("div",{className:"browse__main",children:[!N&&b.length>0?e.jsx(te,{items:b,source:"collection"}):null,e.jsx(ie,{rarities:p,onToggleRarity:G,sort:v,onSort:R,total:L,loading:N,anyActive:D,onClear:I,renderTrailing:s=>e.jsx(le,{panelKey:"price",label:K,active:j,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":"Minimum price",placeholder:"Min",value:n,onChange:d=>x(d.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":"Maximum price",placeholder:"Max",value:o,onChange:d=>_(d.target.value)})]}),e.jsxs("p",{className:"filter-pop__hint",children:["Price in ",V.name]})]})})}),w?e.jsx("p",{className:"error",children:t("collection.error")}):null,e.jsx("div",{className:"grid",children:N?e.jsx(F,{count:15}):e.jsxs(e.Fragment,{children:[b.map(s=>e.jsx(W,{item:s},s.id)),A?e.jsx(F,{count:6}):null]})}),e.jsx(de,{hasNextPage:U,isFetching:A,onLoadMore:()=>void $()}),!N&&!w&&b.length===0?e.jsx("p",{className:"muted",children:t("collection.empty")}):null]})]})]})}export{Ce as Collection,Ce as default};
1
+ import{j as e,r as m,d as O,a as Q}from"./react-yytiy0wi.js";import{G as Y,q as t,h as Z,k as z,d as J,j as V,A as W,an as X,ao as ee}from"./index-CYWpV70P.js";import{d as ae,s as M,g as re,a as se,A as te}from"./collection-DOsbvafd.js";import{u as ce}from"./useStore-D0Fp5fnX.js";import{S as T,C as oe,F as ie,c as le,a as F,b as ne}from"./categories-Dqa3M8i7.js";import{L as de}from"./LoadMore-CiZkVzux.js";import{u as me}from"./useInfiniteGrid-BAS-zEte.js";import"./ethers-DArfy-QF.js";function ue({name:r,creator:a}){const{data:c}=ce(a),i=(c==null?void 0:c.cover)||ae;return e.jsxs("section",{className:"collection-hero","aria-label":r,children:[e.jsxs("div",{className:"collection-hero__cover",children:[e.jsx("img",{className:"collection-hero__cover-img",src:i,alt:"",loading:"eager"}),e.jsx("div",{className:"collection-hero__scrim","aria-hidden":!0})]}),e.jsx("h1",{className:"collection-hero__title",children:r})]})}function pe({address:r}){var x,o;const{data:a}=Y(r),[c,i]=m.useState(!1);if(!r)return null;const l=(a==null?void 0:a.name)||M(r),u=(o=(x=a==null?void 0:a.avatar)==null?void 0:x.snapshots)==null?void 0:o.face256,p=`${Z.profileUrl}/${r}`,g=re(se({name:a==null?void 0:a.name,hasClaimedName:a==null?void 0:a.hasClaimedName,ethAddress:(a==null?void 0:a.ethAddress)??r}));async function n(){try{await navigator.clipboard.writeText(r),i(!0),window.setTimeout(()=>i(!1),1500)}catch(_){z(_,{flow:"copy_creator_address"})}}return e.jsxs("div",{className:"creator-card",children:[u?e.jsx("img",{className:"creator-card__ava",src:u,alt:"",loading:"eager",style:{backgroundColor:g}}):e.jsx("span",{className:"creator-card__ava creator-card__ava--ph","aria-hidden":!0,style:{backgroundColor:g}}),e.jsx("h2",{className:"creator-card__name",title:l,children:l}),e.jsxs("button",{type:"button",className:"creator-card__account",onClick:()=>void n(),title:c?t("collection.copied"):t("collection.copyAddress"),"aria-label":c?t("collection.copied"):t("collection.copyAddress"),children:[e.jsx("span",{className:"creator-card__account-text",children:M(r)}),e.jsx("span",{className:"ico ico-copy creator-card__copy","aria-hidden":!0})]}),e.jsx("a",{className:"creator-card__view",href:p,target:"_blank",rel:"noopener noreferrer",children:t("collection.viewProfile")})]})}const he=48;function Ce(){var k;const{contractAddress:r}=O(),a=Q(),[c,i]=m.useState("wearable"),[l,u]=m.useState(null),[p,g]=m.useState([]),[n,x]=m.useState(""),[o,_]=m.useState(""),[v,R]=m.useState("newest"),f=n&&!Number.isNaN(Number(n))?Number(n):void 0,C=o&&!Number.isNaN(Number(o))?Number(o):void 0,B=l?ne[l]:void 0,E=(T.find(s=>s.key===v)??T[0]).server,y={category:c,rarities:p.length?p:void 0,wearableCategories:B,minPriceCredits:f,maxPriceCredits:C,sortBy:E},{items:b,total:L,isLoading:N,error:w,hasNextPage:U,isFetchingNextPage:A,fetchNextPage:$}=me(["collection-page",r,y],s=>X(r,{...y,first:he,skip:s}),{enabled:!!r}),{data:h}=J({queryKey:["collection-meta",r],queryFn:()=>ee(r),enabled:!!r,staleTime:5*6e4}),S=(h==null?void 0:h.name)||t("collection.fallbackTitle"),P=(h==null?void 0:h.creator)||((k=b[0])==null?void 0:k.creator);function q(s){i(s),u(null)}function G(s){g(d=>d.includes(s)?d.filter(H=>H!==s):[...d,s])}function I(){i("wearable"),u(null),g([]),x(""),_("")}const j=!!(f||C),K=j?`${n||"0"}–${o||"∞"}`:t("filter.price"),D=c!=="wearable"||!!l||p.length>0||j;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":"Breadcrumb",children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>a("/assets"),children:t("collection.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:S})]}),e.jsx(ue,{name:S,creator:P}),e.jsxs("div",{className:"browse browse--sidebar collection-page__browse",children:[e.jsxs("aside",{className:"browse__sidebar",children:[e.jsx(pe,{address:P}),e.jsx(oe,{category:c,subCategory:l,onCategory:q,onSub:u,title:t("collection.category"),flat:!0})]}),e.jsxs("div",{className:"browse__main",children:[!N&&b.length>0?e.jsx(te,{items:b,source:"collection"}):null,e.jsx(ie,{rarities:p,onToggleRarity:G,sort:v,onSort:R,total:L,loading:N,anyActive:D,onClear:I,renderTrailing:s=>e.jsx(le,{panelKey:"price",label:K,active:j,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":"Minimum price",placeholder:"Min",value:n,onChange:d=>x(d.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":"Maximum price",placeholder:"Max",value:o,onChange:d=>_(d.target.value)})]}),e.jsxs("p",{className:"filter-pop__hint",children:["Price in ",V.name]})]})})}),w?e.jsx("p",{className:"error",children:t("collection.error")}):null,e.jsx("div",{className:"grid",children:N?e.jsx(F,{count:15}):e.jsxs(e.Fragment,{children:[b.map(s=>e.jsx(W,{item:s},s.id)),A?e.jsx(F,{count:6}):null]})}),e.jsx(de,{hasNextPage:U,isFetching:A,onLoadMore:()=>void $()}),!N&&!w&&b.length===0?e.jsx("p",{className:"muted",children:t("collection.empty")}):null]})]})]})}export{Ce as Collection,Ce as default};
@@ -1 +1 @@
1
- import{g as ee}from"./react-yytiy0wi.js";import{B as H}from"./index-DgPN63Jh.js";import{r as te}from"./index-C8i-4YQe.js";import{p as N}from"./ethers-DArfy-QF.js";import{r as ne}from"./browser-ponyfill-jziBOMa-.js";function re(o,E){for(var M=0;M<E.length;M++){const y=E[M];if(typeof y!="string"&&!Array.isArray(y)){for(const C in y)if(C!=="default"&&!(C in o)){const F=Object.getOwnPropertyDescriptor(y,C);F&&Object.defineProperty(o,C,F.get?F:{enumerable:!0,get:()=>y[C]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}var R={},Q,W;function ie(){return W||(W=1,Q=typeof self=="object"?self.FormData:window.FormData),Q}var V={},I={},q={},L={},z;function ae(){if(z)return L;z=1,Object.defineProperty(L,"__esModule",{value:!0}),L.isUsingNode=void 0;function o(){return typeof N<"u"&&N.release&&N.release.name==="node"}return L.isUsingNode=o,L}var G;function se(){if(G)return q;G=1;var o=q&&q.__createBinding||(Object.create?(function(a,l,m,d){d===void 0&&(d=m);var g=Object.getOwnPropertyDescriptor(l,m);(!g||("get"in g?!l.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return l[m]}}),Object.defineProperty(a,d,g)}):(function(a,l,m,d){d===void 0&&(d=m),a[d]=l[m]})),E=q&&q.__setModuleDefault||(Object.create?(function(a,l){Object.defineProperty(a,"default",{enumerable:!0,value:l})}):function(a,l){a.default=l}),M=q&&q.__importStar||function(a){if(a&&a.__esModule)return a;var l={};if(a!=null)for(var m in a)m!=="default"&&Object.prototype.hasOwnProperty.call(a,m)&&o(l,a,m);return E(l,a),l},y=q&&q.__rest||function(a,l){var m={};for(var d in a)Object.prototype.hasOwnProperty.call(a,d)&&l.indexOf(d)<0&&(m[d]=a[d]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function")for(var g=0,d=Object.getOwnPropertySymbols(a);g<d.length;g++)l.indexOf(d[g])<0&&Object.prototype.propertyIsEnumerable.call(a,d[g])&&(m[d[g]]=a[d[g]]);return m};Object.defineProperty(q,"__esModule",{value:!0}),q.createFetchComponent=void 0;const C=M(ne()),F=ae(),D=[400,401,403,404],U=["GET","HEAD","OPTIONS","PUT","DELETE"];async function _(a,l){const{timeout:m,abortController:d,signal:g,retryDelay:$}=l;let O=l.attempts,r=null,e;do try{m&&(r=setTimeout(()=>{d.abort()},m));const i=C.default(a.toString(),Object.assign(Object.assign({},l),{signal:g})),t=Promise.race([i,new Promise((c,v)=>{g.addEventListener("abort",()=>{c(new C.Response("timeout",{status:408,statusText:"Request Timeout"}))})})]);--O,e=await t,r&&clearTimeout(r)}finally{if(e&&(e.ok||D.includes(e.status)||O===0))break;await new Promise(i=>setTimeout(i,$))}while((!e||!e.ok)&&O>0);return e}function j(a){async function l(m,d){const $=Object.assign(Object.assign({},a==null?void 0:a.defaultFetcherOptions),d)||{},{timeout:O,method:r="GET",retryDelay:e=0,abortController:i}=$,t=y($,["timeout","method","retryDelay","abortController"]);let c=t.attempts||1;const v=i||new AbortController,{signal:s}=v;a!=null&&a.defaultHeaders&&(t.headers=Object.assign(Object.assign({},a==null?void 0:a.defaultHeaders),t.headers||{})),U.includes(r.toUpperCase())||(c=1);const n=await _(m,Object.assign(Object.assign({},t),{attempts:c,method:r,timeout:O,retryDelay:e,signal:s,abortController:v}));if(!(n!=null&&n.ok)){const u=await(n==null?void 0:n.text());throw new Error(`Failed to fetch ${m}. Got status ${n==null?void 0:n.status}. Response was '${u}'`)}return!(0,F.isUsingNode)()&&n&&Object.defineProperty(n,"buffer",{value:async function(){return H.from(await n.arrayBuffer())},configurable:!0}),s.aborted?void 0:n}return{fetch:l}}return q.createFetchComponent=j,q}var Y;function oe(){return Y||(Y=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.createFetchComponent=void 0;var E=se();Object.defineProperty(o,"createFetchComponent",{enumerable:!0,get:function(){return E.createFetchComponent}})})(I)),I}const le="0.0.0-development",ue={version:le};var X;function ce(){return X||(X=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.QueryBuilder=o.sanitizeUrl=o.mergeRequestOptions=o.isNode=o.convertFiltersToQueryParams=o.splitValuesIntoManyQueries=o.splitValuesIntoManyQueryBuilders=o.splitAndFetchPaginated=o.splitAndFetch=o.MAX_URL_LENGTH=o.addModelToFormData=o.getCurrentVersion=void 0;const E=oe(),M=ue;function y(){return M.version}o.getCurrentVersion=y;function C(r,e,i=""){for(const t in r){if(!r.hasOwnProperty(t)||r[t]===null||r[t]===void 0)continue;const c=i?`${i}[${t}]`:t;r[t]instanceof Date?e.append(c,r[t].toISOString()):r[t]instanceof Array?r[t].forEach((v,s)=>{const n=`${c}[${s}]`;C(v,e,n)}):typeof r[t]=="object"?C(r[t],e,c):e.append(c,r[t].toString())}return e}o.addModelToFormData=C;function F(r){return Array.from(new Set(r))}o.MAX_URL_LENGTH=2048;async function D({baseUrl:r,path:e,queryParams:i,fetcher:t,uniqueBy:c,options:v}){t=t||(0,E.createFetchComponent)();const s=a({baseUrl:r,path:e,queryParams:i}),n=new Map;for(const u of s)(await(await t.fetch(u,{...v,headers:{"Content-Type":"application/json"}})).json()).forEach(w=>n.set(c?w[c]:n.size,w));return Array.from(n.values())}o.splitAndFetch=D;const U=7;async function _({baseUrl:r,path:e,queryParams:i,elementsProperty:t,uniqueBy:c,options:v,fetcher:s}){s=s||(0,E.createFetchComponent)();const u=a({baseUrl:r,path:e,queryParams:i,reservedParams:new Map([["offset",U]])}),f=new Map;let w=!1;for(let b=0;b<u.length&&!w;b++){let p=u[b];for(;p&&!w;)try{const P=(await s.fetch(p,v)).json();P[t].forEach(A=>f.set(A[c],A));const T=P.pagination.next;p=T?new URL(T,p).toString():void 0}catch{w=!0}}return Array.from(f.values())}o.splitAndFetchPaginated=_;function j({queryParams:r,baseUrl:e,path:i,reservedParams:t}){const c="name"in r?new Map([[r.name,r.values]]):r;if(c.size===0)return[new O(e+i,c,t)];const s=Array.from(c.entries()).map(([p,P])=>[p,F(P)]).sort(([p,P],[h,T])=>P.length-T.length),n=new O(e+i,new Map,t);for(let p=0;p<s.length-1;p++){const[P,h]=s[p];if(!n.canSetParams(P,h))throw new Error("This library can split one query param into many HTTP requests, but it can't split more than one. You will need to do that on the client side.");n.setParams(P,h)}let u=O.clone(n);const[f,w]=s[s.length-1],b=[];for(const p of w)u.canAddParam(f,p)||(b.push(u),u=O.clone(n)),u.addParam(f,p);return b.push(u),b}o.splitValuesIntoManyQueryBuilders=j;function a(r){return j(r).map(i=>i.toString())}o.splitValuesIntoManyQueries=a;function l(r){if(!r)return new Map;const e=Object.entries(r).filter(([i,t])=>!!t).map(([i,t])=>{const c=i.endsWith("s")?i.slice(0,-1):i;let v;if(Array.isArray(t))v=[...t].filter(g).map(s=>`${s}`);else if(g(t))v=[`${t}`];else throw new Error("Query params must be either a string, a number, a boolean or an array of the types just mentioned");return[c,v]}).filter(([i,t])=>t.length>0);return new Map(e)}o.convertFiltersToQueryParams=l;function m(){return Object.prototype.toString.call(typeof N<"u"?N:0)==="[object process]"}o.isNode=m;function d(r,e){const i={...r==null?void 0:r.headers,...e==null?void 0:e.headers};return{...r,...e,headers:i}}o.mergeRequestOptions=d;function g(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"}function $(r){return r=r.trim(),!r.startsWith("https://")&&!r.startsWith("http://")&&(r="https://"+r),r.endsWith("/")&&(r=r.slice(0,-1)),r}o.sanitizeUrl=$;class O{constructor(e,i=new Map,t=new Map){this.baseUrl=e,this.queryParams=i,this.reservedParams=t,this.length=this.calculateUrlLength(i,t)}canAddParam(e,i){return this.length+e.length+i.length+2<o.MAX_URL_LENGTH}addParam(e,i){if(!this.canAddParam(e,i))throw new Error(`You can't add this parameter '${e}', since it would exceed the max url length`);const t=this.queryParams.get(e),c=t||[];return c.push(i),this.queryParams.set(e,c),this.length+=this.calculateAddedLength(e,[i]),this}canSetParams(e,i){const t=new Map([...this.queryParams,[e,i]]);return this.calculateUrlLength(t,this.reservedParams)<o.MAX_URL_LENGTH}setParams(e,i){if(!this.canSetParams(e,i))throw new Error(`You can't add this parameter '${e}', since it would exceed the max url length`);return this.queryParams.set(e,i.map(t=>`${t}`)),this.length=this.calculateUrlLength(this.queryParams,this.reservedParams),this}setParam(e,i){return this.setParams(e,[i]),this}toString(){let e=this.baseUrl,i=!1;for(const[t,c]of this.queryParams)for(const v of c)i?e+=`&${t}=${v}`:(e+=`?${t}=${v}`,i=!0);return e}calculateUrlLength(e,i){let t=this.baseUrl.length;for(const[c,v]of i)this.queryParams.has(c)||(t+=c.length+2+v);for(const[c,v]of e)t+=this.calculateAddedLength(c,v);return t}static clone(e){return new O(e.baseUrl,new Map(e.queryParams),e.reservedParams)}calculateAddedLength(e,i){return this.calculateArrayLength(i)+(e.length+2)*i.length}calculateArrayLength(e){return e.map(i=>`${i}`).reduce((i,t)=>i+t.length,0)}}o.QueryBuilder=O})(V)),V}var B={},J;function fe(){if(J)return B;J=1,Object.defineProperty(B,"__esModule",{value:!0}),B.retry=void 0;async function o(E,M,y,C){for(;y>0;)try{return await M()}catch(F){if(y--,y>0)console.info(`Failed to ${E}. Still have ${y} attempt/s left. Will try again in ${C}`),await new Promise(D=>setTimeout(D,C));else throw F}throw new Error("Please specify more than one attempt for the retry function")}return B.retry=o,B}var k;function de(){if(k)return R;k=1;var o=R&&R.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(R,"__esModule",{value:!0}),R.createContentClient=R.downloadContent=void 0;const E=te(),M=o(ie()),y=ce(),C=fe();function F(_){return _.buffer?_.buffer:_}async function D(_,j,a,l){const{attempts:m=3,retryDelay:d=500}=l||{},g=l!=null&&l.timeout?{timeout:l.timeout}:{};return(0,C.retry)(`fetch file with hash ${a} from ${j}`,async()=>{const $=await _.fetch(`${j}/${a}`,g),O=H.from(await $.arrayBuffer());if(!(l!=null&&l.avoidChecks)&&(a.startsWith("Qm")?await(0,E.hashV0)(O):await(0,E.hashV1)(O))!==a)throw new Error(`Failed to fetch file with hash ${a} from ${j}`);return O},m,d)}R.downloadContent=D;function U(_){const{fetcher:j,logger:a}=_,l=(0,y.sanitizeUrl)(_.url),m=_==null?void 0:_.parallelConfig;async function d(s,n,u){const f=new AbortController,w=f.signal,b=(0,y.mergeRequestOptions)(u,{signal:w});return new Promise(async p=>{let P=s.length;const h=()=>{P--,P===0&&p([])},T=A=>A&&Array.isArray(A)&&A.length>0?(f.abort(),p(A),!0):!1;s.forEach(async A=>{try{const S=(0,y.sanitizeUrl)(A),Z=await j.fetch(`${S}${n}`,b);if(w.aborted){h();return}const x=await Z.json();T(x)||h()}catch(S){w.aborted||a==null||a.warn(`Failed to fetch from ${A}:`,S),h()}})})}async function g(s,n,u){const w=(await Promise.allSettled(s.map(async h=>{try{const T=(0,y.sanitizeUrl)(h);return await(await j.fetch(`${T}${n}`,u)).json()}catch(T){return a==null||a.warn(`Failed to fetch from ${h}:`,T),[]}}))).filter(h=>h.status==="fulfilled").map(h=>h.value||[]),b=w.flatMap(h=>h),p=w.filter(h=>h.length===0).length,P=new Map;return b.forEach(h=>{(!P.has(h.id)||h.timestamp>P.get(h.id).timestamp)&&P.set(h.id,h)}),{entities:Array.from(P.values()),emptyResults:p}}async function $(s,n){const u=(0,y.isNode)(),f=new M.default;f.append("entityId",s.entityId),(0,y.addModelToFormData)(s.authChain,f,"authChain");const w=await c(Array.from(s.files.keys()),n);for(const[b,p]of s.files)(!w.has(b)||b===s.entityId)&&(u?f.append(b,H.isBuffer(p)?p:H.from(F(p)),b):f.append(b,new Blob([F(p)]),b));return f}async function O(s,n){const u=await $(s,n),f=(0,y.mergeRequestOptions)(n||{},{body:u,method:"POST"});return await j.fetch(`${l}/entities`,f)}async function r(s,n){if(s.length===0)return Promise.reject("You must set at least one pointer.");const u=(0,y.mergeRequestOptions)(n||{},{body:JSON.stringify({pointers:s}),method:"POST",headers:{"Content-Type":"application/json"}});return(await j.fetch(`${l}/entities/active`,u)).json()}async function e(s,n){if(s.length===0)return Promise.reject("You must set at least one id.");const u=(0,y.mergeRequestOptions)(n||{},{body:JSON.stringify({ids:s}),method:"POST",headers:{"Content-Type":"application/json"}}),f=(n==null?void 0:n.parallel)||m;return f!=null&&f.urls&&(f==null?void 0:f.urls.length)>0?d([l,...f.urls],"/entities/active",u):(await j.fetch(`${l}/entities/active`,u)).json()}async function i(s,n){const u=await e([s],n);return u.length===0?Promise.reject(`Failed to find an entity with id '${s}'.`):u[0]}function t(s,n){return s.length===0?Promise.reject("You must set at least one cid."):(0,y.splitAndFetch)({fetcher:j,options:n,baseUrl:l,path:"/available-content",queryParams:{name:"cid",values:s},uniqueBy:"cid"})}async function c(s,n){const f=(await t(s,n)).filter(w=>w.available).map(({cid:w})=>w);return new Set(f)}async function v(s,n){const u=(n==null?void 0:n.parallel)||m;if(!(u!=null&&u.urls)||u.urls.length===0)throw new Error("Parallel configuration is required for checking pointer consistency");const f=(0,y.mergeRequestOptions)(n||{},{body:JSON.stringify({pointers:[s]}),method:"POST",headers:{"Content-Type":"application/json"}}),w=[l,...u.urls],{entities:b,emptyResults:p}=await g(w,"/entities/active",f);if(b.length===0)return{isConsistent:!0,upToDateEntities:void 0,outdatedEntities:void 0};const P=Math.max(...b.map(S=>S.timestamp)),h=b.filter(S=>S.timestamp===P),T=b.filter(S=>S.timestamp<P);return{isConsistent:T.length===0&&p===0,upToDateEntities:h.length>0?h:void 0,outdatedEntities:T.length>0?T:void 0}}return{buildEntityFormDataForDeployment:$,fetchEntitiesByPointers:r,fetchEntitiesByIds:e,fetchEntityById:i,downloadContent:(s,n)=>D(j,l+"/contents",s,n),deploy:O,isContentAvailable:t,checkPointerConsistency:v}}return R.createContentClient=U,R}var K=de();const he=ee(K),we=re({__proto__:null,default:he},[K]);export{we as C};
1
+ import{g as ee}from"./react-yytiy0wi.js";import{B as H}from"./index-CYWpV70P.js";import{r as te}from"./index-eL578oJV.js";import{p as N}from"./ethers-DArfy-QF.js";import{r as ne}from"./browser-ponyfill-jziBOMa-.js";function re(o,E){for(var M=0;M<E.length;M++){const y=E[M];if(typeof y!="string"&&!Array.isArray(y)){for(const C in y)if(C!=="default"&&!(C in o)){const F=Object.getOwnPropertyDescriptor(y,C);F&&Object.defineProperty(o,C,F.get?F:{enumerable:!0,get:()=>y[C]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}var R={},Q,W;function ie(){return W||(W=1,Q=typeof self=="object"?self.FormData:window.FormData),Q}var V={},I={},q={},L={},z;function ae(){if(z)return L;z=1,Object.defineProperty(L,"__esModule",{value:!0}),L.isUsingNode=void 0;function o(){return typeof N<"u"&&N.release&&N.release.name==="node"}return L.isUsingNode=o,L}var G;function se(){if(G)return q;G=1;var o=q&&q.__createBinding||(Object.create?(function(a,l,m,d){d===void 0&&(d=m);var g=Object.getOwnPropertyDescriptor(l,m);(!g||("get"in g?!l.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return l[m]}}),Object.defineProperty(a,d,g)}):(function(a,l,m,d){d===void 0&&(d=m),a[d]=l[m]})),E=q&&q.__setModuleDefault||(Object.create?(function(a,l){Object.defineProperty(a,"default",{enumerable:!0,value:l})}):function(a,l){a.default=l}),M=q&&q.__importStar||function(a){if(a&&a.__esModule)return a;var l={};if(a!=null)for(var m in a)m!=="default"&&Object.prototype.hasOwnProperty.call(a,m)&&o(l,a,m);return E(l,a),l},y=q&&q.__rest||function(a,l){var m={};for(var d in a)Object.prototype.hasOwnProperty.call(a,d)&&l.indexOf(d)<0&&(m[d]=a[d]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function")for(var g=0,d=Object.getOwnPropertySymbols(a);g<d.length;g++)l.indexOf(d[g])<0&&Object.prototype.propertyIsEnumerable.call(a,d[g])&&(m[d[g]]=a[d[g]]);return m};Object.defineProperty(q,"__esModule",{value:!0}),q.createFetchComponent=void 0;const C=M(ne()),F=ae(),D=[400,401,403,404],U=["GET","HEAD","OPTIONS","PUT","DELETE"];async function _(a,l){const{timeout:m,abortController:d,signal:g,retryDelay:$}=l;let O=l.attempts,r=null,e;do try{m&&(r=setTimeout(()=>{d.abort()},m));const i=C.default(a.toString(),Object.assign(Object.assign({},l),{signal:g})),t=Promise.race([i,new Promise((c,v)=>{g.addEventListener("abort",()=>{c(new C.Response("timeout",{status:408,statusText:"Request Timeout"}))})})]);--O,e=await t,r&&clearTimeout(r)}finally{if(e&&(e.ok||D.includes(e.status)||O===0))break;await new Promise(i=>setTimeout(i,$))}while((!e||!e.ok)&&O>0);return e}function j(a){async function l(m,d){const $=Object.assign(Object.assign({},a==null?void 0:a.defaultFetcherOptions),d)||{},{timeout:O,method:r="GET",retryDelay:e=0,abortController:i}=$,t=y($,["timeout","method","retryDelay","abortController"]);let c=t.attempts||1;const v=i||new AbortController,{signal:s}=v;a!=null&&a.defaultHeaders&&(t.headers=Object.assign(Object.assign({},a==null?void 0:a.defaultHeaders),t.headers||{})),U.includes(r.toUpperCase())||(c=1);const n=await _(m,Object.assign(Object.assign({},t),{attempts:c,method:r,timeout:O,retryDelay:e,signal:s,abortController:v}));if(!(n!=null&&n.ok)){const u=await(n==null?void 0:n.text());throw new Error(`Failed to fetch ${m}. Got status ${n==null?void 0:n.status}. Response was '${u}'`)}return!(0,F.isUsingNode)()&&n&&Object.defineProperty(n,"buffer",{value:async function(){return H.from(await n.arrayBuffer())},configurable:!0}),s.aborted?void 0:n}return{fetch:l}}return q.createFetchComponent=j,q}var Y;function oe(){return Y||(Y=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.createFetchComponent=void 0;var E=se();Object.defineProperty(o,"createFetchComponent",{enumerable:!0,get:function(){return E.createFetchComponent}})})(I)),I}const le="0.0.0-development",ue={version:le};var X;function ce(){return X||(X=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.QueryBuilder=o.sanitizeUrl=o.mergeRequestOptions=o.isNode=o.convertFiltersToQueryParams=o.splitValuesIntoManyQueries=o.splitValuesIntoManyQueryBuilders=o.splitAndFetchPaginated=o.splitAndFetch=o.MAX_URL_LENGTH=o.addModelToFormData=o.getCurrentVersion=void 0;const E=oe(),M=ue;function y(){return M.version}o.getCurrentVersion=y;function C(r,e,i=""){for(const t in r){if(!r.hasOwnProperty(t)||r[t]===null||r[t]===void 0)continue;const c=i?`${i}[${t}]`:t;r[t]instanceof Date?e.append(c,r[t].toISOString()):r[t]instanceof Array?r[t].forEach((v,s)=>{const n=`${c}[${s}]`;C(v,e,n)}):typeof r[t]=="object"?C(r[t],e,c):e.append(c,r[t].toString())}return e}o.addModelToFormData=C;function F(r){return Array.from(new Set(r))}o.MAX_URL_LENGTH=2048;async function D({baseUrl:r,path:e,queryParams:i,fetcher:t,uniqueBy:c,options:v}){t=t||(0,E.createFetchComponent)();const s=a({baseUrl:r,path:e,queryParams:i}),n=new Map;for(const u of s)(await(await t.fetch(u,{...v,headers:{"Content-Type":"application/json"}})).json()).forEach(w=>n.set(c?w[c]:n.size,w));return Array.from(n.values())}o.splitAndFetch=D;const U=7;async function _({baseUrl:r,path:e,queryParams:i,elementsProperty:t,uniqueBy:c,options:v,fetcher:s}){s=s||(0,E.createFetchComponent)();const u=a({baseUrl:r,path:e,queryParams:i,reservedParams:new Map([["offset",U]])}),f=new Map;let w=!1;for(let b=0;b<u.length&&!w;b++){let p=u[b];for(;p&&!w;)try{const P=(await s.fetch(p,v)).json();P[t].forEach(A=>f.set(A[c],A));const T=P.pagination.next;p=T?new URL(T,p).toString():void 0}catch{w=!0}}return Array.from(f.values())}o.splitAndFetchPaginated=_;function j({queryParams:r,baseUrl:e,path:i,reservedParams:t}){const c="name"in r?new Map([[r.name,r.values]]):r;if(c.size===0)return[new O(e+i,c,t)];const s=Array.from(c.entries()).map(([p,P])=>[p,F(P)]).sort(([p,P],[h,T])=>P.length-T.length),n=new O(e+i,new Map,t);for(let p=0;p<s.length-1;p++){const[P,h]=s[p];if(!n.canSetParams(P,h))throw new Error("This library can split one query param into many HTTP requests, but it can't split more than one. You will need to do that on the client side.");n.setParams(P,h)}let u=O.clone(n);const[f,w]=s[s.length-1],b=[];for(const p of w)u.canAddParam(f,p)||(b.push(u),u=O.clone(n)),u.addParam(f,p);return b.push(u),b}o.splitValuesIntoManyQueryBuilders=j;function a(r){return j(r).map(i=>i.toString())}o.splitValuesIntoManyQueries=a;function l(r){if(!r)return new Map;const e=Object.entries(r).filter(([i,t])=>!!t).map(([i,t])=>{const c=i.endsWith("s")?i.slice(0,-1):i;let v;if(Array.isArray(t))v=[...t].filter(g).map(s=>`${s}`);else if(g(t))v=[`${t}`];else throw new Error("Query params must be either a string, a number, a boolean or an array of the types just mentioned");return[c,v]}).filter(([i,t])=>t.length>0);return new Map(e)}o.convertFiltersToQueryParams=l;function m(){return Object.prototype.toString.call(typeof N<"u"?N:0)==="[object process]"}o.isNode=m;function d(r,e){const i={...r==null?void 0:r.headers,...e==null?void 0:e.headers};return{...r,...e,headers:i}}o.mergeRequestOptions=d;function g(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"}function $(r){return r=r.trim(),!r.startsWith("https://")&&!r.startsWith("http://")&&(r="https://"+r),r.endsWith("/")&&(r=r.slice(0,-1)),r}o.sanitizeUrl=$;class O{constructor(e,i=new Map,t=new Map){this.baseUrl=e,this.queryParams=i,this.reservedParams=t,this.length=this.calculateUrlLength(i,t)}canAddParam(e,i){return this.length+e.length+i.length+2<o.MAX_URL_LENGTH}addParam(e,i){if(!this.canAddParam(e,i))throw new Error(`You can't add this parameter '${e}', since it would exceed the max url length`);const t=this.queryParams.get(e),c=t||[];return c.push(i),this.queryParams.set(e,c),this.length+=this.calculateAddedLength(e,[i]),this}canSetParams(e,i){const t=new Map([...this.queryParams,[e,i]]);return this.calculateUrlLength(t,this.reservedParams)<o.MAX_URL_LENGTH}setParams(e,i){if(!this.canSetParams(e,i))throw new Error(`You can't add this parameter '${e}', since it would exceed the max url length`);return this.queryParams.set(e,i.map(t=>`${t}`)),this.length=this.calculateUrlLength(this.queryParams,this.reservedParams),this}setParam(e,i){return this.setParams(e,[i]),this}toString(){let e=this.baseUrl,i=!1;for(const[t,c]of this.queryParams)for(const v of c)i?e+=`&${t}=${v}`:(e+=`?${t}=${v}`,i=!0);return e}calculateUrlLength(e,i){let t=this.baseUrl.length;for(const[c,v]of i)this.queryParams.has(c)||(t+=c.length+2+v);for(const[c,v]of e)t+=this.calculateAddedLength(c,v);return t}static clone(e){return new O(e.baseUrl,new Map(e.queryParams),e.reservedParams)}calculateAddedLength(e,i){return this.calculateArrayLength(i)+(e.length+2)*i.length}calculateArrayLength(e){return e.map(i=>`${i}`).reduce((i,t)=>i+t.length,0)}}o.QueryBuilder=O})(V)),V}var B={},J;function fe(){if(J)return B;J=1,Object.defineProperty(B,"__esModule",{value:!0}),B.retry=void 0;async function o(E,M,y,C){for(;y>0;)try{return await M()}catch(F){if(y--,y>0)console.info(`Failed to ${E}. Still have ${y} attempt/s left. Will try again in ${C}`),await new Promise(D=>setTimeout(D,C));else throw F}throw new Error("Please specify more than one attempt for the retry function")}return B.retry=o,B}var k;function de(){if(k)return R;k=1;var o=R&&R.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(R,"__esModule",{value:!0}),R.createContentClient=R.downloadContent=void 0;const E=te(),M=o(ie()),y=ce(),C=fe();function F(_){return _.buffer?_.buffer:_}async function D(_,j,a,l){const{attempts:m=3,retryDelay:d=500}=l||{},g=l!=null&&l.timeout?{timeout:l.timeout}:{};return(0,C.retry)(`fetch file with hash ${a} from ${j}`,async()=>{const $=await _.fetch(`${j}/${a}`,g),O=H.from(await $.arrayBuffer());if(!(l!=null&&l.avoidChecks)&&(a.startsWith("Qm")?await(0,E.hashV0)(O):await(0,E.hashV1)(O))!==a)throw new Error(`Failed to fetch file with hash ${a} from ${j}`);return O},m,d)}R.downloadContent=D;function U(_){const{fetcher:j,logger:a}=_,l=(0,y.sanitizeUrl)(_.url),m=_==null?void 0:_.parallelConfig;async function d(s,n,u){const f=new AbortController,w=f.signal,b=(0,y.mergeRequestOptions)(u,{signal:w});return new Promise(async p=>{let P=s.length;const h=()=>{P--,P===0&&p([])},T=A=>A&&Array.isArray(A)&&A.length>0?(f.abort(),p(A),!0):!1;s.forEach(async A=>{try{const S=(0,y.sanitizeUrl)(A),Z=await j.fetch(`${S}${n}`,b);if(w.aborted){h();return}const x=await Z.json();T(x)||h()}catch(S){w.aborted||a==null||a.warn(`Failed to fetch from ${A}:`,S),h()}})})}async function g(s,n,u){const w=(await Promise.allSettled(s.map(async h=>{try{const T=(0,y.sanitizeUrl)(h);return await(await j.fetch(`${T}${n}`,u)).json()}catch(T){return a==null||a.warn(`Failed to fetch from ${h}:`,T),[]}}))).filter(h=>h.status==="fulfilled").map(h=>h.value||[]),b=w.flatMap(h=>h),p=w.filter(h=>h.length===0).length,P=new Map;return b.forEach(h=>{(!P.has(h.id)||h.timestamp>P.get(h.id).timestamp)&&P.set(h.id,h)}),{entities:Array.from(P.values()),emptyResults:p}}async function $(s,n){const u=(0,y.isNode)(),f=new M.default;f.append("entityId",s.entityId),(0,y.addModelToFormData)(s.authChain,f,"authChain");const w=await c(Array.from(s.files.keys()),n);for(const[b,p]of s.files)(!w.has(b)||b===s.entityId)&&(u?f.append(b,H.isBuffer(p)?p:H.from(F(p)),b):f.append(b,new Blob([F(p)]),b));return f}async function O(s,n){const u=await $(s,n),f=(0,y.mergeRequestOptions)(n||{},{body:u,method:"POST"});return await j.fetch(`${l}/entities`,f)}async function r(s,n){if(s.length===0)return Promise.reject("You must set at least one pointer.");const u=(0,y.mergeRequestOptions)(n||{},{body:JSON.stringify({pointers:s}),method:"POST",headers:{"Content-Type":"application/json"}});return(await j.fetch(`${l}/entities/active`,u)).json()}async function e(s,n){if(s.length===0)return Promise.reject("You must set at least one id.");const u=(0,y.mergeRequestOptions)(n||{},{body:JSON.stringify({ids:s}),method:"POST",headers:{"Content-Type":"application/json"}}),f=(n==null?void 0:n.parallel)||m;return f!=null&&f.urls&&(f==null?void 0:f.urls.length)>0?d([l,...f.urls],"/entities/active",u):(await j.fetch(`${l}/entities/active`,u)).json()}async function i(s,n){const u=await e([s],n);return u.length===0?Promise.reject(`Failed to find an entity with id '${s}'.`):u[0]}function t(s,n){return s.length===0?Promise.reject("You must set at least one cid."):(0,y.splitAndFetch)({fetcher:j,options:n,baseUrl:l,path:"/available-content",queryParams:{name:"cid",values:s},uniqueBy:"cid"})}async function c(s,n){const f=(await t(s,n)).filter(w=>w.available).map(({cid:w})=>w);return new Set(f)}async function v(s,n){const u=(n==null?void 0:n.parallel)||m;if(!(u!=null&&u.urls)||u.urls.length===0)throw new Error("Parallel configuration is required for checking pointer consistency");const f=(0,y.mergeRequestOptions)(n||{},{body:JSON.stringify({pointers:[s]}),method:"POST",headers:{"Content-Type":"application/json"}}),w=[l,...u.urls],{entities:b,emptyResults:p}=await g(w,"/entities/active",f);if(b.length===0)return{isConsistent:!0,upToDateEntities:void 0,outdatedEntities:void 0};const P=Math.max(...b.map(S=>S.timestamp)),h=b.filter(S=>S.timestamp===P),T=b.filter(S=>S.timestamp<P);return{isConsistent:T.length===0&&p===0,upToDateEntities:h.length>0?h:void 0,outdatedEntities:T.length>0?T:void 0}}return{buildEntityFormDataForDeployment:$,fetchEntitiesByPointers:r,fetchEntitiesByIds:e,fetchEntityById:i,downloadContent:(s,n)=>D(j,l+"/contents",s,n),deploy:O,isContentAvailable:t,checkPointerConsistency:v}}return R.createContentClient=U,R}var K=de();const he=ee(K),we=re({__proto__:null,default:he},[K]);export{we as C};
@@ -1 +1 @@
1
- import{a as I,j as e,L as ee,d as ae,u as se,r as p}from"./react-yytiy0wi.js";import{as as re,at as te,ag as oe,q as o,au as $,G as U,b as ce,h as le,j as ne,A as ie,ak as de,av as me}from"./index-DgPN63Jh.js";import{s as K,d as ue,g as he,a as ge,A as xe}from"./collection-BB4WIsDf.js";import{u as _e,L as Ne}from"./useStore-D9l09yvh.js";import{S as R,C as je,a as w,F as pe,c as be,b as fe}from"./categories-CS5KEV15.js";import{L as T}from"./LoadMore-CiZkVzux.js";import{u as B}from"./useInfiniteGrid-BwrFUhaa.js";import"./ethers-DArfy-QF.js";function ve({collection:r,cover:a,itemCount:t}){const n=I(),{contractAddress:m,name:N,creator:g}=r,j=a==null||t==null,{data:i}=re(m,j),_=a==null?(i==null?void 0:i.items)??[]:[],h=t??(i==null?void 0:i.total);function x(){n(`/collection/${m}`)}return e.jsxs("article",{className:"coll-card",role:"link",tabIndex:0,onClick:x,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),x())},children:[e.jsx("div",{className:"coll-card__media",children:a?e.jsx("img",{className:"coll-card__img",src:a,alt:"",loading:"lazy"}):_.length>0?e.jsx(te,{items:_,className:"coll-card__cover"}):null}),e.jsxs("div",{className:"coll-card__body",children:[e.jsx("h3",{className:"coll-card__name",title:N,children:N}),e.jsxs("div",{className:"coll-card__meta",children:[g?e.jsx(oe,{address:g,className:"coll-card__creator",linkToProfile:!0}):e.jsx("span",{className:"coll-card__creator",children:" "}),e.jsx("span",{className:"coll-card__count",children:h==null?"…":o("collectionCard.itemCount",{count:h})})]}),e.jsx("button",{className:"coll-card__view",onClick:d=>{d.stopPropagation(),x()},tabIndex:-1,children:o("collectionCard.viewCollection")})]})]})}function Ce({address:r,className:a=""}){const t=$(m=>m.followed.includes(r.toLowerCase())),n=$(m=>m.toggle);return r?e.jsx("button",{type:"button",className:`btn btn--sm ${t?"btn--ghost":"btn--outline"} ${a}`.trim(),"aria-pressed":t,title:t?o("creator.unfollowTitle"):o("creator.followTitle"),onClick:()=>n(r),children:t?o("creator.following"):o("creator.follow")}):null}const we={website:"ico-website",twitter:"ico-twitter",discord:"ico-discord",facebook:"ico-facebook"};function ke({address:r}){var d,b;const{data:a}=U(r),{data:t}=_e(r),n=ce(l=>{var f;return(f=l.session)==null?void 0:f.address}),m=!!n&&n.toLowerCase()===r.toLowerCase(),N=(a==null?void 0:a.name)||K(r),g=(b=(d=a==null?void 0:a.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,j=(t==null?void 0:t.cover)||ue,i=t==null?void 0:t.description,_=`${le.profileUrl}/${r}`,h=Ne.filter(l=>t==null?void 0:t.links[l]),x=he(ge({name:a==null?void 0:a.name,hasClaimedName:a==null?void 0:a.hasClaimedName,ethAddress:(a==null?void 0:a.ethAddress)??r}));return e.jsxs("section",{className:"creator-hero","aria-label":`${N} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:j,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link",href:(t==null?void 0:t.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:o(`creator.link.${l}`),"aria-label":o(`creator.link.${l}`),children:e.jsx("span",{className:`ico ${we[l]}`,"aria-hidden":!0})},l)),m&&e.jsx(ee,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:o("creator.editStore"),"aria-label":o("creator.editStore"),children:e.jsx("span",{className:"ico ico-pen","aria-hidden":!0})})]}),e.jsxs("div",{className:"creator-hero__body",children:[g?e.jsx("img",{className:"creator-hero__ava",src:g,alt:"",loading:"eager",style:{backgroundColor:x}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:x}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:N}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view",href:_,target:"_blank",rel:"noopener noreferrer",children:o("creator.viewProfile")}),e.jsx(Ce,{address:r,className:"creator-hero__follow"})]})]})]})}const E=48;function Re(){const{address:r}=ae(),a=I(),[t]=se(),n=t.has("collections"),{data:m}=U(r),N=(m==null?void 0:m.name)||(r?K(r):o("creator.fallbackName")),[g,j]=p.useState("wearable"),[i,_]=p.useState(null),[h,x]=p.useState([]),[d,b]=p.useState(""),[l,f]=p.useState(""),[P,D]=p.useState("newest"),S=d&&!Number.isNaN(Number(d))?Number(d):void 0,y=l&&!Number.isNaN(Number(l))?Number(l):void 0,G=i?fe[i]:void 0,O=(R.find(s=>s.key===P)??R[0]).server,L={creator:r,category:g,rarities:h.length?h:void 0,wearableCategories:G,minPriceCredits:S,maxPriceCredits:y,sortBy:O},{items:v,total:Y,isLoading:C,error:A,hasNextPage:q,isFetchingNextPage:F,fetchNextPage:z}=B(["creator-listings",L],s=>de({...L,first:E,skip:s}),{enabled:!!r&&!n}),u=B(["creator-collections",r],s=>me(r,{first:E,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!r&&n});function H(s){j(s),_(null),n&&M()}function M(){const s=new URLSearchParams(t);s.delete("collections");const c=s.toString();a({search:c?`?${c}`:""},{replace:!0})}function W(){if(n){M();return}const s=new URLSearchParams(t);s.delete("collections");const c=s.toString();a({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function Z(s){x(c=>c.includes(s)?c.filter(X=>X!==s):[...c,s])}function J(){j("wearable"),_(null),x([]),b(""),f("")}const k=!!(S||y),Q=k?`${d||"0"}–${l||"∞"}`:o("filter.price"),V=g!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":"Breadcrumb",children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>a("/assets"),children:o("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:N})]}),r?e.jsx(ke,{address:r}):null,!n&&!C&&v.length>0?e.jsx(xe,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(je,{category:g,subCategory:i,onCategory:H,onSub:_,title:o("creator.category"),flat:!0,collections:n,onCollections:W})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":o("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx("p",{className:"error",children:o("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(ve,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx(T,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:o("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(pe,{rarities:h,onToggleRarity:Z,sort:P,onSort:D,total:Y,loading:C,anyActive:V,onClear:J,renderTrailing:s=>e.jsx(be,{panelKey:"price",label:Q,active:k,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":"Minimum price",placeholder:"Min",value:d,onChange:c=>b(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":"Maximum price",placeholder:"Max",value:l,onChange:c=>f(c.target.value)})]}),e.jsxs("p",{className:"filter-pop__hint",children:["Price in ",ne.name]})]})})}),A?e.jsx("p",{className:"error",children:o("creator.error")}):null,e.jsx("div",{className:"grid",children:C?e.jsx(w,{count:15}):e.jsxs(e.Fragment,{children:[v.map(s=>e.jsx(ie,{item:s},s.id)),F?e.jsx(w,{count:6}):null]})}),e.jsx(T,{hasNextPage:q,isFetching:F,onLoadMore:()=>void z()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:o("creator.empty")}):null]})})]})]})}export{Re as Creator,Re as default};
1
+ import{a as I,j as e,L as ee,d as ae,u as se,r as p}from"./react-yytiy0wi.js";import{as as re,at as te,ag as oe,q as o,au as $,G as U,b as ce,h as le,j as ne,A as ie,ak as de,av as me}from"./index-CYWpV70P.js";import{s as K,d as ue,g as he,a as ge,A as xe}from"./collection-DOsbvafd.js";import{u as _e,L as Ne}from"./useStore-D0Fp5fnX.js";import{S as R,C as je,a as w,F as pe,c as be,b as fe}from"./categories-Dqa3M8i7.js";import{L as T}from"./LoadMore-CiZkVzux.js";import{u as B}from"./useInfiniteGrid-BAS-zEte.js";import"./ethers-DArfy-QF.js";function ve({collection:r,cover:a,itemCount:t}){const n=I(),{contractAddress:m,name:N,creator:g}=r,j=a==null||t==null,{data:i}=re(m,j),_=a==null?(i==null?void 0:i.items)??[]:[],h=t??(i==null?void 0:i.total);function x(){n(`/collection/${m}`)}return e.jsxs("article",{className:"coll-card",role:"link",tabIndex:0,onClick:x,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),x())},children:[e.jsx("div",{className:"coll-card__media",children:a?e.jsx("img",{className:"coll-card__img",src:a,alt:"",loading:"lazy"}):_.length>0?e.jsx(te,{items:_,className:"coll-card__cover"}):null}),e.jsxs("div",{className:"coll-card__body",children:[e.jsx("h3",{className:"coll-card__name",title:N,children:N}),e.jsxs("div",{className:"coll-card__meta",children:[g?e.jsx(oe,{address:g,className:"coll-card__creator",linkToProfile:!0}):e.jsx("span",{className:"coll-card__creator",children:" "}),e.jsx("span",{className:"coll-card__count",children:h==null?"…":o("collectionCard.itemCount",{count:h})})]}),e.jsx("button",{className:"coll-card__view",onClick:d=>{d.stopPropagation(),x()},tabIndex:-1,children:o("collectionCard.viewCollection")})]})]})}function Ce({address:r,className:a=""}){const t=$(m=>m.followed.includes(r.toLowerCase())),n=$(m=>m.toggle);return r?e.jsx("button",{type:"button",className:`btn btn--sm ${t?"btn--ghost":"btn--outline"} ${a}`.trim(),"aria-pressed":t,title:t?o("creator.unfollowTitle"):o("creator.followTitle"),onClick:()=>n(r),children:t?o("creator.following"):o("creator.follow")}):null}const we={website:"ico-website",twitter:"ico-twitter",discord:"ico-discord",facebook:"ico-facebook"};function ke({address:r}){var d,b;const{data:a}=U(r),{data:t}=_e(r),n=ce(l=>{var f;return(f=l.session)==null?void 0:f.address}),m=!!n&&n.toLowerCase()===r.toLowerCase(),N=(a==null?void 0:a.name)||K(r),g=(b=(d=a==null?void 0:a.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,j=(t==null?void 0:t.cover)||ue,i=t==null?void 0:t.description,_=`${le.profileUrl}/${r}`,h=Ne.filter(l=>t==null?void 0:t.links[l]),x=he(ge({name:a==null?void 0:a.name,hasClaimedName:a==null?void 0:a.hasClaimedName,ethAddress:(a==null?void 0:a.ethAddress)??r}));return e.jsxs("section",{className:"creator-hero","aria-label":`${N} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:j,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link",href:(t==null?void 0:t.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:o(`creator.link.${l}`),"aria-label":o(`creator.link.${l}`),children:e.jsx("span",{className:`ico ${we[l]}`,"aria-hidden":!0})},l)),m&&e.jsx(ee,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:o("creator.editStore"),"aria-label":o("creator.editStore"),children:e.jsx("span",{className:"ico ico-pen","aria-hidden":!0})})]}),e.jsxs("div",{className:"creator-hero__body",children:[g?e.jsx("img",{className:"creator-hero__ava",src:g,alt:"",loading:"eager",style:{backgroundColor:x}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:x}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:N}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view",href:_,target:"_blank",rel:"noopener noreferrer",children:o("creator.viewProfile")}),e.jsx(Ce,{address:r,className:"creator-hero__follow"})]})]})]})}const E=48;function Re(){const{address:r}=ae(),a=I(),[t]=se(),n=t.has("collections"),{data:m}=U(r),N=(m==null?void 0:m.name)||(r?K(r):o("creator.fallbackName")),[g,j]=p.useState("wearable"),[i,_]=p.useState(null),[h,x]=p.useState([]),[d,b]=p.useState(""),[l,f]=p.useState(""),[P,D]=p.useState("newest"),S=d&&!Number.isNaN(Number(d))?Number(d):void 0,y=l&&!Number.isNaN(Number(l))?Number(l):void 0,G=i?fe[i]:void 0,O=(R.find(s=>s.key===P)??R[0]).server,L={creator:r,category:g,rarities:h.length?h:void 0,wearableCategories:G,minPriceCredits:S,maxPriceCredits:y,sortBy:O},{items:v,total:Y,isLoading:C,error:A,hasNextPage:q,isFetchingNextPage:F,fetchNextPage:z}=B(["creator-listings",L],s=>de({...L,first:E,skip:s}),{enabled:!!r&&!n}),u=B(["creator-collections",r],s=>me(r,{first:E,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!r&&n});function H(s){j(s),_(null),n&&M()}function M(){const s=new URLSearchParams(t);s.delete("collections");const c=s.toString();a({search:c?`?${c}`:""},{replace:!0})}function W(){if(n){M();return}const s=new URLSearchParams(t);s.delete("collections");const c=s.toString();a({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function Z(s){x(c=>c.includes(s)?c.filter(X=>X!==s):[...c,s])}function J(){j("wearable"),_(null),x([]),b(""),f("")}const k=!!(S||y),Q=k?`${d||"0"}–${l||"∞"}`:o("filter.price"),V=g!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":"Breadcrumb",children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>a("/assets"),children:o("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:N})]}),r?e.jsx(ke,{address:r}):null,!n&&!C&&v.length>0?e.jsx(xe,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(je,{category:g,subCategory:i,onCategory:H,onSub:_,title:o("creator.category"),flat:!0,collections:n,onCollections:W})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":o("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx("p",{className:"error",children:o("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(ve,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx(T,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:o("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(pe,{rarities:h,onToggleRarity:Z,sort:P,onSort:D,total:Y,loading:C,anyActive:V,onClear:J,renderTrailing:s=>e.jsx(be,{panelKey:"price",label:Q,active:k,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":"Minimum price",placeholder:"Min",value:d,onChange:c=>b(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":"Maximum price",placeholder:"Max",value:l,onChange:c=>f(c.target.value)})]}),e.jsxs("p",{className:"filter-pop__hint",children:["Price in ",ne.name]})]})})}),A?e.jsx("p",{className:"error",children:o("creator.error")}):null,e.jsx("div",{className:"grid",children:C?e.jsx(w,{count:15}):e.jsxs(e.Fragment,{children:[v.map(s=>e.jsx(ie,{item:s},s.id)),F?e.jsx(w,{count:6}):null]})}),e.jsx(T,{hasNextPage:q,isFetching:F,onLoadMore:()=>void z()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:o("creator.empty")}):null]})})]})]})}export{Re as Creator,Re as default};
@@ -1,4 +1,4 @@
1
- import{b0 as U,b1 as Ue,R as C,b2 as qe,b3 as Qe,a1 as Ye,b4 as Je,aQ as Xe,Q as W,aV as K,aU as Te,b5 as a,b6 as Ze,b7 as Le,T as et,a$ as tt}from"./index-DgPN63Jh.js";import{R as rt,g as ot}from"./getOverlayAlpha-CM9JvcJV.js";import{j as T,r as y}from"./react-yytiy0wi.js";import{u as nt,a as Be}from"./useTheme-Bf8Lxsxi.js";function ne(r){const o=Ue(r);return r!==o&&o.styles?(o.styles.match(/^@layer\s+[^{]*$/)||(o.styles=`@layer global{${o.styles}}`),o):r}function at({styles:r,themeId:o,defaultTheme:n={}}){const i=nt(n),s=o&&i[o]||i;let l=typeof r=="function"?r(s):r;return s.modularCssLayers&&(Array.isArray(l)?l=l.map(d=>ne(typeof d=="function"?d(s):d)):l=ne(l)),T.jsx(U,{styles:l})}const Ee=y.createContext(null);function se(){return y.useContext(Ee)}const it=typeof Symbol=="function"&&Symbol.for,st=it?Symbol.for("mui.nested"):"__THEME_NESTED__";function lt(r,o){return typeof o=="function"?o(r):C({},r,o)}function ct(r){const{children:o,theme:n}=r,i=se(),s=y.useMemo(()=>{const l=i===null?n:lt(i,n);return l!=null&&(l[st]=i!==null),l},[n,i]);return T.jsx(Ee.Provider,{value:s,children:o})}function dt(r){const o=Be(),n=qe()||"",{modularCssLayers:i}=r;let s="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!i||o!==null?s="":typeof i=="string"?s=i.replace(/mui(?!\.)/g,s):s=`@layer ${s};`,Qe(()=>{const l=document.querySelector("head");if(!l)return;const d=l.firstChild;if(s){var m;if(d&&(m=d.hasAttribute)!=null&&m.call(d,"data-mui-layer-order")&&d.getAttribute("data-mui-layer-order")===n)return;const S=document.createElement("style");S.setAttribute("data-mui-layer-order",n),S.textContent=s,l.prepend(S)}else{var f;(f=l.querySelector(`style[data-mui-layer-order="${n}"]`))==null||f.remove()}},[s,n]),s?T.jsx(at,{styles:s}):null}const $e={};function xe(r,o,n,i=!1){return y.useMemo(()=>{const s=r&&o[r]||o;if(typeof n=="function"){const l=n(s),d=r?C({},o,{[r]:l}):l;return i?()=>d:d}return r?C({},o,{[r]:n}):C({},o,n)},[r,o,n,i])}function ut(r){const{children:o,theme:n,themeId:i}=r,s=Be($e),l=se()||$e,d=xe(i,s,n),m=xe(i,l,n,!0),f=d.direction==="rtl",S=dt(d);return T.jsx(ct,{theme:m,children:T.jsx(Ye.Provider,{value:d,children:T.jsx(rt,{value:f,children:T.jsxs(Je,{value:d==null?void 0:d.components,children:[S,o]})})})})}const le="mode",ce="color-scheme",Ie="data-color-scheme";function mt(r){const{defaultMode:o="light",defaultLightColorScheme:n="light",defaultDarkColorScheme:i="dark",modeStorageKey:s=le,colorSchemeStorageKey:l=ce,attribute:d=Ie,colorSchemeNode:m="document.documentElement",nonce:f}=r||{};return T.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?f:"",dangerouslySetInnerHTML:{__html:`(function() {
1
+ import{b0 as U,b1 as Ue,R as C,b2 as qe,b3 as Qe,a1 as Ye,b4 as Je,aQ as Xe,Q as W,aV as K,aU as Te,b5 as a,b6 as Ze,b7 as Le,T as et,a$ as tt}from"./index-CYWpV70P.js";import{R as rt,g as ot}from"./getOverlayAlpha-CPeU_wtJ.js";import{j as T,r as y}from"./react-yytiy0wi.js";import{u as nt,a as Be}from"./useTheme-DU7pyJai.js";function ne(r){const o=Ue(r);return r!==o&&o.styles?(o.styles.match(/^@layer\s+[^{]*$/)||(o.styles=`@layer global{${o.styles}}`),o):r}function at({styles:r,themeId:o,defaultTheme:n={}}){const i=nt(n),s=o&&i[o]||i;let l=typeof r=="function"?r(s):r;return s.modularCssLayers&&(Array.isArray(l)?l=l.map(d=>ne(typeof d=="function"?d(s):d)):l=ne(l)),T.jsx(U,{styles:l})}const Ee=y.createContext(null);function se(){return y.useContext(Ee)}const it=typeof Symbol=="function"&&Symbol.for,st=it?Symbol.for("mui.nested"):"__THEME_NESTED__";function lt(r,o){return typeof o=="function"?o(r):C({},r,o)}function ct(r){const{children:o,theme:n}=r,i=se(),s=y.useMemo(()=>{const l=i===null?n:lt(i,n);return l!=null&&(l[st]=i!==null),l},[n,i]);return T.jsx(Ee.Provider,{value:s,children:o})}function dt(r){const o=Be(),n=qe()||"",{modularCssLayers:i}=r;let s="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!i||o!==null?s="":typeof i=="string"?s=i.replace(/mui(?!\.)/g,s):s=`@layer ${s};`,Qe(()=>{const l=document.querySelector("head");if(!l)return;const d=l.firstChild;if(s){var m;if(d&&(m=d.hasAttribute)!=null&&m.call(d,"data-mui-layer-order")&&d.getAttribute("data-mui-layer-order")===n)return;const S=document.createElement("style");S.setAttribute("data-mui-layer-order",n),S.textContent=s,l.prepend(S)}else{var f;(f=l.querySelector(`style[data-mui-layer-order="${n}"]`))==null||f.remove()}},[s,n]),s?T.jsx(at,{styles:s}):null}const $e={};function xe(r,o,n,i=!1){return y.useMemo(()=>{const s=r&&o[r]||o;if(typeof n=="function"){const l=n(s),d=r?C({},o,{[r]:l}):l;return i?()=>d:d}return r?C({},o,{[r]:n}):C({},o,n)},[r,o,n,i])}function ut(r){const{children:o,theme:n,themeId:i}=r,s=Be($e),l=se()||$e,d=xe(i,s,n),m=xe(i,l,n,!0),f=d.direction==="rtl",S=dt(d);return T.jsx(ct,{theme:m,children:T.jsx(Ye.Provider,{value:d,children:T.jsx(rt,{value:f,children:T.jsxs(Je,{value:d==null?void 0:d.components,children:[S,o]})})})})}const le="mode",ce="color-scheme",Ie="data-color-scheme";function mt(r){const{defaultMode:o="light",defaultLightColorScheme:n="light",defaultDarkColorScheme:i="dark",modeStorageKey:s=le,colorSchemeStorageKey:l=ce,attribute:d=Ie,colorSchemeNode:m="document.documentElement",nonce:f}=r||{};return T.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?f:"",dangerouslySetInnerHTML:{__html:`(function() {
2
2
  try {
3
3
  var mode = localStorage.getItem('${s}') || '${o}';
4
4
  var colorScheme = '';