@dcl/shop 0.1.0-29342337543.commit-e62debf → 0.1.0-29406413150.commit-a91cd9f

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 (164) hide show
  1. package/assets/{AnimatedBackground-De9Qp4KR.js → AnimatedBackground-BnwRfsiv.js} +3 -3
  2. package/assets/{Assets-1bNeklxr.js → Assets-D-a9hqWT.js} +1 -1
  3. package/assets/{Button-u4Y_U_Lz.js → Button-Dywi_vIa.js} +2 -2
  4. package/assets/{Cart-gIn2SSad.js → Cart-DVjQHvBQ.js} +1 -1
  5. package/assets/{CircularProgress-j19iz-El.js → CircularProgress-og3LyasF.js} +3 -3
  6. package/assets/{Collection-BZksCNg9.js → Collection-CbMYzkC9.js} +1 -1
  7. package/assets/{Creator-pYPGRDX3.js → Creator-DQJPFH3p.js} +1 -1
  8. package/assets/{ExchangeController-C6LdMnhd.js → ExchangeController-qNcM_tdT.js} +1 -1
  9. package/assets/{GetCredits-BFYRErFS.js → GetCredits-CrQ1Yqnd.js} +2 -2
  10. package/assets/{HelpersUtil-BMey9OQC.js → HelpersUtil-DwV51RvI.js} +1 -1
  11. package/assets/{ImportListings-BJS8ANY1.js → ImportListings-CM9NUDqh.js} +1 -1
  12. package/assets/{ItemDetail-BfnmM6Wd.js → ItemDetail-D8tmZfcC.js} +2 -2
  13. package/assets/{MenuItem-ynqlyh9y.js → MenuItem-DVXN6fPs.js} +2 -2
  14. package/assets/{MyAssets-n058kEFs.js → MyAssets-DrTGapSq.js} +1 -1
  15. package/assets/{MyFavorites-D2YHdh9H.js → MyFavorites-DPxWR9i_.js} +1 -1
  16. package/assets/{MyPurchases-Cj9XFiMA.js → MyPurchases-UlV2Ejo9.js} +1 -1
  17. package/assets/{NotFound-30ZleK4O.js → NotFound-dQCK8o3W.js} +1 -1
  18. package/assets/{RealCheckout-DdB_2aXB.js → RealCheckout-D9TYwWxz.js} +1 -1
  19. package/assets/{ShopFooterInner-C2m2Dyez.js → ShopFooterInner-Biy4Ywkz.js} +3 -3
  20. package/assets/Success-Bad6c-Jo.js +1 -0
  21. package/assets/{SwapController-2gLg4R4h.js → SwapController-CQZXQ4Q5.js} +1 -1
  22. package/assets/{TradeService-CxOFjzRK.js → TradeService-DuSSbU0G.js} +1 -1
  23. package/assets/{W3MFrameProviderSingleton-BwXooI70.js → W3MFrameProviderSingleton-B6_3Zs6I.js} +3 -3
  24. package/assets/{WebCryptoP256-Dtj06UwI.js → WebCryptoP256-CMFEoyaK.js} +1 -1
  25. package/assets/{basic-Dq2uHR0o.js → basic-Dq5ood5R.js} +1 -1
  26. package/assets/{biconomy-h_5HWh_l.js → biconomy-C3pzeqHG.js} +1 -1
  27. package/assets/{buy-KvjWmHql.js → buy-BXsYo32e.js} +1 -1
  28. package/assets/{buy-gasless-DuWzXmm_.js → buy-gasless-CB45oj-8.js} +1 -1
  29. package/assets/{ccip-nHQJrzNM.js → ccip-C2qRMCzb.js} +1 -1
  30. package/assets/{ccip-9mCO1EZs.js → ccip-zOJ8fkH-.js} +1 -1
  31. package/assets/{collection-ae9B_wBl.js → collection-B34IwUC5.js} +1 -1
  32. package/assets/{controller-Bm814olt.js → controller-0cnw-xyq.js} +2 -2
  33. package/assets/{core-2GzKX_V0.js → core-CRifUzKO.js} +4 -4
  34. package/assets/{custom-Dg9059mJ.js → custom-BRRAon-U.js} +1 -1
  35. package/assets/{data-capture-Cs7uNAyj.js → data-capture-cSGzOBZI.js} +1 -1
  36. package/assets/decimals-B19-5xj3.js +1 -0
  37. package/assets/{decimals-BozxDRnr.js → decimals-DFdgeb5g.js} +1 -1
  38. package/assets/{detectExtension-BcudqjHr.js → detectExtension-D3QIkn81.js} +1 -1
  39. package/assets/{email-CkxGvJ7n.js → email-Bt1Wqrpu.js} +1 -1
  40. package/assets/{embedded-wallet-DCvtWtAo.js → embedded-wallet-BAvMzBcs.js} +1 -1
  41. package/assets/{emotion-styled.browser.esm-aJQM59uX.js → emotion-styled.browser.esm-DeLQmdM_.js} +1 -1
  42. package/assets/{engine-DJykDFYI.js → engine-C-4f510Q.js} +1 -1
  43. package/assets/{estimate-l1-fee-BHy3gQeo.js → estimate-l1-fee-TD6Eeaga.js} +1 -1
  44. package/assets/{eth_estimateGas-4echzN6X.js → eth_estimateGas-c0ilyWBq.js} +1 -1
  45. package/assets/{eth_getStorageAt-gLuffVw8.js → eth_getStorageAt-CiqYqck8.js} +1 -1
  46. package/assets/{eth_getTransactionCount-CPFlNa2B.js → eth_getTransactionCount-CFplLmOA.js} +1 -1
  47. package/assets/{extractIPFS-BuYfN-sn.js → extractIPFS-COa8X7sF.js} +1 -1
  48. package/assets/{features-C0YNwzWv.js → features-7-b4Om7J.js} +1 -1
  49. package/assets/{fetchTokenMetadata-DPimZ4m_.js → fetchTokenMetadata-BTszSGhS.js} +2 -2
  50. package/assets/{get-ecosystem-wallet-info-CgRHuJjM.js → get-ecosystem-wallet-info-T0L6dsNV.js} +1 -1
  51. package/assets/{getBalance-CRqNHI0S.js → getBalance-BArf24DT.js} +1 -1
  52. package/assets/{getInstalledModules-QJB7fy_4.js → getInstalledModules-CzBtswDW.js} +1 -1
  53. package/assets/{getNFT-D8bkf2cV.js → getNFT-CmB-EUw9.js} +2 -2
  54. package/assets/{getNFT-D0APw_WL.js → getNFT-iLCDuS_Q.js} +1 -1
  55. package/assets/{hashTypedData-BaiVsItZ.js → hashTypedData-CoXLJrY2.js} +1 -1
  56. package/assets/{hashTypedData-C3gUj3RL.js → hashTypedData-Duzplq5M.js} +1 -1
  57. package/assets/{import-DI2r0vcY.js → import-1qZmk-ve.js} +1 -1
  58. package/assets/{in-app-wallet-calls-Bb3GeV4R.js → in-app-wallet-calls-B7ySKt0n.js} +1 -1
  59. package/assets/{index-BObGhUwb.js → index-BBQ72VSQ.js} +1 -1
  60. package/assets/{index-CdYVhV-8.js → index-BGGbgdSQ.js} +1 -1
  61. package/assets/{index-B_Ooxv1v.js → index-BHjzvMc_.js} +1 -1
  62. package/assets/{index-Cpng5QLO.js → index-BTusn-cp.js} +1 -1
  63. package/assets/{index-DvAy35iS.js → index-BW6d6BbH.js} +28 -28
  64. package/assets/{index-BFep7uQJ.js → index-BZDBkXn3.js} +1 -1
  65. package/assets/{index-DL8xJTzj.js → index-BdDGInRO.js} +1 -1
  66. package/assets/{index-BGmSS9--.js → index-BdGF7Khq.js} +1 -1
  67. package/assets/{index-1EmEZY58.js → index-Be9jJ2sK.js} +1 -1
  68. package/assets/{index-D03fBLru.js → index-BftIY8GG.js} +1 -1
  69. package/assets/{index-BeV9LW2a.js → index-Bh_U9TSe.js} +1 -1
  70. package/assets/{index-CEEwIfoI.js → index-BhrfOLeY.js} +1 -1
  71. package/assets/{index-BplwFt6_.js → index-Bn1ikbQg.js} +3 -3
  72. package/assets/{index-B96emzZW.js → index-BnIGy6dE.js} +1 -1
  73. package/assets/{index-KbyFXy1r.js → index-Bo1FAQNs.js} +1 -1
  74. package/assets/{index-8qREWc4C.js → index-BrsEF-BM.js} +1 -1
  75. package/assets/{index-BJcsuoFJ.js → index-BvrzCkDl.js} +2 -2
  76. package/assets/{index-CxNuM1Pe.js → index-C0dr4jyr.js} +1 -1
  77. package/assets/{index-CmnC7TX_.js → index-C1X_Y6wr.js} +3 -3
  78. package/assets/{index-zdwEHMJV.js → index-C2WEBoZJ.js} +1 -1
  79. package/assets/{index-DoxdT7ta.js → index-C344ardt.js} +1 -1
  80. package/assets/{index-DQ-JVIh_.js → index-C3h4AdEY.js} +1 -1
  81. package/assets/{index-dh70gAb1.js → index-C6WtN49a.js} +1 -1
  82. package/assets/{index-V84TKWVc.js → index-C92KiAOk.js} +1 -1
  83. package/assets/{index-B_vGP-LB.js → index-CTabxOqV.js} +1 -1
  84. package/assets/{index-CGu_c1E3.js → index-CbH9kfUc.js} +1 -1
  85. package/assets/{index-DgnsXd1K.js → index-Ce0_-pFA.js} +1 -1
  86. package/assets/{index-Cm0Bd7M5.js → index-Cpy2Et_p.js} +1 -1
  87. package/assets/{index-CUDTJiCv.js → index-CuI-U7nJ.js} +1 -1
  88. package/assets/{index-sdenODYs.js → index-Cw9pJ_Ha.js} +1 -1
  89. package/assets/{index-BYJZLO0l.js → index-CwzaSU41.js} +1 -1
  90. package/assets/{index-7vBeJ6h0.js → index-Cz2F4NKm.js} +1 -1
  91. package/assets/{index-kJ2Om4DY.js → index-D-ixZxf4.js} +1 -1
  92. package/assets/{index-DXpWAbYJ.js → index-D36yN0Bf.js} +1 -1
  93. package/assets/{index-C18kHZS6.js → index-D3awFASU.js} +1 -1
  94. package/assets/{index-CTrKkOgC.js → index-D3y-kuFx.js} +1 -1
  95. package/assets/{index-B33BKn4f.js → index-DCd0GVdP.js} +2 -2
  96. package/assets/{index-DxTXRx_1.js → index-DUM-eWFe.js} +1 -1
  97. package/assets/{index-CZx6HzWG.js → index-DfrLYsxF.js} +1 -1
  98. package/assets/{index-B9VcNONK.js → index-Di33sB2B.js} +1 -1
  99. package/assets/{index-DYbx7tio.js → index-DnTfBax2.js} +1 -1
  100. package/assets/{index-D_4bro34.js → index-DsCvbsUU.js} +1 -1
  101. package/assets/{index-CZE9iM0w.js → index-DurG2hyR.js} +1 -1
  102. package/assets/{index-BJI9-eQ3.js → index-MbmnIks7.js} +1 -1
  103. package/assets/{index-2ABFVZj7.js → index-ScY6mRRU.js} +1 -1
  104. package/assets/{index-CS6NyySB.js → index-T3Ioic-d.js} +1 -1
  105. package/assets/{index-4fviM57_.js → index-TyqRL5ux.js} +1 -1
  106. package/assets/{index-BVmP09nN.js → index-UB1Y0F7Y.js} +2 -2
  107. package/assets/{index-BXZNWPQo.js → index-cziX_kqw.js} +1 -1
  108. package/assets/{index-UUD5CaBO.js → index-euu_zF1P.js} +1 -1
  109. package/assets/{index-CWRdMktG.js → index-hlRGU2X9.js} +1 -1
  110. package/assets/{index-Cedadicw.js → index-hzzqz-oN.js} +1 -1
  111. package/assets/{index-C2KSBy5B.js → index-sdNj_XXp.js} +1 -1
  112. package/assets/{index.es-DkJWnksP.js → index.es-1POdP2bT.js} +1 -1
  113. package/assets/{index.es-COvtwZfe.js → index.es-B3cqCuuu.js} +1 -1
  114. package/assets/{index.es-BM0IDFYO.js → index.es-DwtUIInR.js} +4 -4
  115. package/assets/{localBatchGatewayRequest-BX9seGap.js → localBatchGatewayRequest-UGxosVgP.js} +1 -1
  116. package/assets/{mana-rate-BmhpEynZ.js → mana-rate-DbXjP8PT.js} +1 -1
  117. package/assets/network-CnO47bm0.js +1 -0
  118. package/assets/{networks-D5uQp84i.js → networks-zejNBfN0.js} +1 -1
  119. package/assets/{onramp-BcSAlX0-.js → onramp-uaAenXK_.js} +1 -1
  120. package/assets/{openzeppelin-BNaf3Kr3.js → openzeppelin-CNJo1xvT.js} +1 -1
  121. package/assets/{ownerOf-3r-8WATC.js → ownerOf-ClGvWr7v.js} +1 -1
  122. package/assets/{parseNft-Bc_K1PCu.js → parseNft-Dmi4dKW_.js} +2 -2
  123. package/assets/{parseSignature-fjZSf4e-.js → parseSignature-C2I1o9hQ.js} +3 -3
  124. package/assets/{parseSignature-C6RtDqHk.js → parseSignature-DqHdoBSK.js} +1 -1
  125. package/assets/{pay-with-exchange-DWMiqDBV.js → pay-with-exchange-CZLFCtg1.js} +1 -1
  126. package/assets/{qr-overlay-BevbfqIg.js → qr-overlay-CLbuZX6n.js} +1 -1
  127. package/assets/{receive-C3dfyqOo.js → receive-lRcrhl2d.js} +1 -1
  128. package/assets/{resolveImplementation-DXxkRbEQ.js → resolveImplementation-CSXfyN2u.js} +1 -1
  129. package/assets/{rpc-CUZ4dR7x.js → rpc-B07HiX5J.js} +1 -1
  130. package/assets/{secp256k1-Bd5EX38Z.js → secp256k1-BiQ03web.js} +1 -1
  131. package/assets/{secp256k1-Cf36qiOc.js → secp256k1-CbZoHEaI.js} +1 -1
  132. package/assets/{secp256k1-D3J1vgG3.js → secp256k1-CwJslARV.js} +1 -1
  133. package/assets/{send-C-bE7JsL.js → send-BViJVaUq.js} +1 -1
  134. package/assets/{send-batch-transaction-x2iJTEAe.js → send-batch-transaction-CxjHPlkH.js} +1 -1
  135. package/assets/{send-eip712-transaction-s2GicVHp.js → send-eip712-transaction-BP9m4G9l.js} +2 -2
  136. package/assets/{send-gasless-transaction-CZ-7RvQf.js → send-gasless-transaction-ChxzGYfX.js} +2 -2
  137. package/assets/{sendRawTransaction-DDaLAHUQ.js → sendRawTransaction-BN4kGE5P.js} +3 -3
  138. package/assets/{serializeTransaction-9vMytB_d.js → serializeTransaction-BcmfsEg1.js} +1 -1
  139. package/assets/{session-proposal-RKf_pb2T.js → session-proposal-BRstm0bQ.js} +1 -1
  140. package/assets/{session-request-D7IOp8Re.js → session-request-C4lEtLnN.js} +2 -2
  141. package/assets/{sha256-B7mufoJi.js → sha256-DkvO414S.js} +1 -1
  142. package/assets/{signing-2DKT9LNu.js → signing-D3pU2o1I.js} +4 -4
  143. package/assets/{socials-L3VYxM6J.js → socials-DXBXCHxv.js} +1 -1
  144. package/assets/{swaps-CRa3_MsX.js → swaps-4ySgWDaa.js} +1 -1
  145. package/assets/{thirdweb-CG-tYItw.js → thirdweb-DjdWszGQ.js} +3 -3
  146. package/assets/{totalSupply-ppOlQsps.js → totalSupply-Cp-tbUyO.js} +1 -1
  147. package/assets/{trade-encoding-CmkOOQWS.js → trade-encoding-CgWHvMsc.js} +1 -1
  148. package/assets/{transactionReceipt-CGXAX_4G.js → transactionReceipt-Y7v69biI.js} +1 -1
  149. package/assets/{transactions-DqEiSEGD.js → transactions-DHEcEI8t.js} +1 -1
  150. package/assets/{useInfiniteGrid-DBBDC6CU.js → useInfiniteGrid-Dvh83G5j.js} +1 -1
  151. package/assets/{verifyHash-CJuroX1V.js → verifyHash-DYm9NRaH.js} +1 -1
  152. package/assets/{w3m-modal-SC-8Yppy.js → w3m-modal-BJW5AFLD.js} +1 -1
  153. package/assets/{w3m-modal-BGeUUrbk.js → w3m-modal-DO45d0QA.js} +1 -1
  154. package/assets/{wait-for-tx-receipt-BNoaz4x5.js → wait-for-tx-receipt-rpydharh.js} +1 -1
  155. package/assets/{wallet-kind-D56TeB0g.js → wallet-kind-C_qy0E-X.js} +1 -1
  156. package/assets/{wallets-C3sYPWeN.js → wallets-Bl61iVPq.js} +6 -6
  157. package/assets/{web-connector-Ci6UxTsz.js → web-connector-BrGZ8Hxc.js} +3 -3
  158. package/assets/{writeContract-DjDZhUiF.js → writeContract-sz1xzStO.js} +1 -1
  159. package/assets/{zoraTestnet-DecFal9Q.js → zoraTestnet-U_QF4fFv.js} +1 -1
  160. package/index.html +8 -8
  161. package/package.json +2 -2
  162. package/assets/Success-DKBdybry.js +0 -1
  163. package/assets/decimals-CmjPenXw.js +0 -1
  164. package/assets/network-CirTws7i.js +0 -1
@@ -1,11 +1,11 @@
1
- import{r as l,j as v}from"./react-CQ5qhqs6.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-29342337543.commit-e62debf/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-29342337543.commit-e62debf/assets/DCL_LogoPattern-BryBPc3d.png",b=`
1
+ import{r as l,j as v}from"./react-CQ5qhqs6.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-29406413150.commit-a91cd9f/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-29406413150.commit-a91cd9f/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{r as u,j as e,a as he,d as pe}from"./react-CQ5qhqs6.js";import{u as _e,i as Y,c as fe,v as ye,w as ae,h as be,q as xe,E as ge,I as P,y as E,H as Q,G as D,e as I,ah as z,x as U,A as V,ak as ke}from"./index-DvAy35iS.js";import{r as je,a as W,m as ve}from"./mana-rate-BmhpEynZ.js";import{S as Z}from"./SkeletonCards-DSpqiDzZ.js";import{L as Ne}from"./LoadMore-7qZApSeo.js";import{a as J}from"./buy-KvjWmHql.js";import{g as Ce,a as we,w as Se,S as Ie,G as Me}from"./buy-gasless-DuWzXmm_.js";import{u as Pe}from"./useInfiniteGrid-DBBDC6CU.js";import"./ethers-DXxh-eEm.js";import"./index-CUDTJiCv.js";import"./trade-encoding-CmkOOQWS.js";function Ee(){return _e({queryKey:["mana-rate",Y.chainId],queryFn:()=>je(Y.chainId),staleTime:6e4,refetchInterval:6e4,retry:1})}const Fe=[{key:"all",label:"Shop All"},{key:"wearable",label:"Wearables",expandable:!0,subs:[{key:"Head",label:"Head",icon:"cat-head"},{key:"Upper Body",label:"Upper Body",icon:"cat-upper"},{key:"Handwear",label:"Handwear",icon:"cat-handwear"},{key:"Lower Body",label:"Lower Body",icon:"cat-lower"},{key:"Feet",label:"Feet",icon:"cat-feet"},{key:"Accessories",label:"Accessories",icon:"cat-accessories"},{key:"Skins",label:"Skins",icon:"cat-skins"}]},{key:"emote",label:"Emotes",expandable:!0,subs:[{key:"Dance",label:"Dance",icon:"emote-dance"},{key:"Stunt",label:"Stunt",icon:"emote-stunt"},{key:"Greetings",label:"Greetings",icon:"emote-greetings"},{key:"Fun",label:"Fun",icon:"emote-fun"},{key:"Poses",label:"Poses",icon:"emote-poses"},{key:"Reactions",label:"Reactions",icon:"emote-reactions"},{key:"Horror",label:"Horror",icon:"emote-horror"},{key:"Miscellaneous",label:"Miscellaneous",icon:"emote-misc"}]}];function Re({category:a,subCategory:i,onCategory:d,onSub:f}){const[t,n]=u.useState(()=>a==="wearable"?"wearable":null);function b(r){r.subs?n(_=>{const h=_!==r.key;return h&&d(r.key),h?r.key:null}):(d(r.key),n(null))}return e.jsx("div",{className:"catfilter",children:Fe.map(r=>{const _=t===r.key&&!!r.subs,h=r.key===a;return e.jsxs("div",{className:"catfilter__group",children:[e.jsxs("button",{type:"button",className:`catfilter__cat${_?" is-expanded":""}${h?" is-selected":""}`,onClick:()=>b(r),children:[e.jsx("span",{className:"catfilter__cat-label",children:r.label}),r.expandable?e.jsx("span",{className:`ico ico-chevron catfilter__chev${_?" is-up":""}`,"aria-hidden":!0}):null]}),r.subs?e.jsx("div",{className:`catfilter__subs${_?" is-open":""}`,children:e.jsx("div",{className:"catfilter__subs-inner",children:r.subs.map(p=>e.jsx("button",{type:"button",className:`catfilter__sub${i===p.key?" is-active":""}`,onClick:()=>f(i===p.key?null:p.key),children:e.jsxs("span",{className:"catfilter__sub-left",children:[e.jsx("span",{className:`ico ico-${p.icon} catfilter__sub-ico`,"aria-hidden":!0}),e.jsx("span",{className:"catfilter__sub-label",children:p.label})]})},p.key))})}):null]},r.key)})})}const Ae=["common","uncommon","rare","epic","legendary","mythic","unique","exotic"],O=[{key:"newest",label:"Newest",server:"newest"},{key:"price-asc",label:"Price: Low to High",server:"cheapest"},{key:"price-desc",label:"Price: High to Low",server:"most_expensive"},{key:"name",label:"Name (A–Z)",server:"name"}];function X({panelKey:a,label:i,active:d,badge:f,align:t="left",panel:n,children:b}){const r=n.open===a,_=t==="right"?"filterbar__sort":"filterbar__trigger";return e.jsxs("div",{className:"filterbar__item",children:[e.jsxs("button",{className:`${_}${r?" is-open":""}${d?" is-active":""}`,onClick:()=>n.toggle(a),children:[i," ",f?e.jsx("span",{className:"filterbar__badge",children:f}):null," ",e.jsx("span",{className:`ico ico-chevron filterbar__chev${r?" is-up":""}`,"aria-hidden":!0})]}),r?b:null]})}function Le({rarities:a,onToggleRarity:i,rarityOptions:d=Ae,sort:f,onSort:t,sortOptions:n=O,total:b,loading:r,query:_}){const[h,p]=u.useState(null),x={open:h,toggle:m=>p(g=>g===m?null:m),close:()=>p(null)};return e.jsxs(e.Fragment,{children:[h?e.jsx("div",{className:"filterbar__scrim",onClick:x.close,"aria-hidden":!0}):null,e.jsxs("div",{className:"browse__toolbar",children:[e.jsxs("span",{className:"browse__count",children:[r?"…":`${b.toLocaleString()} Item${b===1?"":"s"}`,_?` for “${_}”`:""]}),e.jsxs("div",{className:"browse__dropdowns",children:[e.jsx(X,{panelKey:"rarity",label:"Rarity",active:a.length>0,badge:a.length||void 0,align:"right",panel:x,children:e.jsx("div",{className:"filter-pop filter-pop--rarity",children:d.map(m=>e.jsxs("label",{className:"filter-pop__check",children:[e.jsx("input",{type:"checkbox",checked:a.includes(m),onChange:()=>i(m)}),e.jsx("span",{children:m})]},m))})}),e.jsx(X,{panelKey:"sort",label:"Sort By",align:"right",panel:x,children:e.jsx("div",{className:"filter-pop filter-pop--sort",children:n.map(m=>e.jsx("button",{className:`filter-pop__sort${m.key===f?" is-active":""}`,onClick:()=>{t(m.key),x.close()},children:m.label},m.key))})})]})]})]})}function ee(a){const i=a,d=(i.message??"").toLowerCase();return i.code===4001||d.includes("reject")||d.includes("denied")||d.includes("cancel")?"You cancelled the request.":d.includes("insufficient")?`Not enough ${U.name} — get more first.`:d.includes("not found")||d.includes("no active listing")||d.includes("404")?"This item was just sold or removed. Refreshing the market…":d.includes("your own listing")?"You can't buy your own listing.":"Couldn't complete checkout — please try again."}function $e(a){return{id:a.tradeId,tradeId:a.tradeId,name:a.name,creator:a.creator,contractAddress:a.contractAddress,itemId:a.itemId,category:a.category,wearableCategory:a.wearableCategory??void 0,rarity:a.rarity,network:a.network,chainId:a.chainId,thumbnail:a.thumbnail,priceCredits:0,gender:null}}function Be({listing:a,rate:i,onClose:d,onSold:f}){const{session:t}=fe(),{data:n}=ye(t),b=ae(),r=he(),[_,h]=u.useState("confirm"),[p,x]=u.useState("Locking today’s price…"),[m,g]=u.useState(null),[c,F]=u.useState(null),k=u.useRef(null),C=Math.ceil(W(a.manaWei,i)/10);u.useEffect(()=>{let j=!1;if(!t){h("error"),g("Sign in to check out.");return}return(async()=>{try{const o=await be(a.tradeId);if(!o)throw new Error("not found");if(xe(o,t.address))throw new Error("You can't buy your own listing.");const l=W(a.manaWei,i);if(!Number.isFinite(l)||l<=0)throw new Error("price unavailable");const{credit:N,maxCreditedValue:G,usdCents:M}=await ge(t.identity,l,a.tradeId);if(j){P(t.identity,[N.id]).catch(()=>{});return}k.current=N.id,F({trade:o,credit:N,maxCreditedValue:G,usdCents:M,credits:Math.ceil(M/10)}),x("")}catch(o){if(j)return;console.error("[market] authorize failed",o),E(D(o)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:Q(o),value_usd:Math.round(W(a.manaWei,i))/100}),h("error"),g(ee(o))}})(),()=>{j=!0,k.current&&t&&(P(t.identity,[k.current]).catch(()=>{}),k.current=null)}},[]);const v=!!c&&((n==null?void 0:n.credits)??0)<c.credits;async function q(){if(!t||!c)return;if(v){P(t.identity,[c.credit.id]).catch(()=>{}),k.current=null,r("/credits");return}h("working"),g(null);let j=!1;try{x("Confirming your purchase…");const o={trade:c.trade,buyer:t.address,signer:t.signer,credits:[c.credit],maxCreditedValue:c.maxCreditedValue};let l;if(Ce())try{l=await we(o),await Se(l),j=!0}catch(N){if(N instanceof Ie)j=!0;else if(N instanceof Me)l=await J(o);else throw N}else l=await J(o);k.current=null,E("Shop Completed Purchase",{items:[{item_id:a.itemId??null,contract_address:a.contractAddress,token_id:null,price_usd:c.usdCents/100}],value_credits:c.credits,value_usd:c.usdCents/100,purchase_type:"item",is_primary:!0,payment_type:"credits",no_crypto_step:j,transaction_hash:l??null}),b.invalidateQueries({queryKey:["usd-balance"]}),r("/success",{state:{items:[$e(a)],txHash:l}})}catch(o){console.error("[market] buy now failed",o),P(t.identity,[c.credit.id]).catch(()=>{}),k.current=null,E(D(o)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:Q(o),value_usd:c.usdCents/100}),b.invalidateQueries({queryKey:["usd-balance"]});const l=ee(o);g(l),h("error"),/sold or removed/i.test(l)&&f()}}function R(){t&&c&&P(t.identity,[c.credit.id]).catch(()=>{}),k.current=null,d()}const S=_==="working";return e.jsxs("div",{className:"mkt-modal",role:"dialog","aria-modal":"true","aria-label":`Buy ${a.name}`,children:[e.jsx("div",{className:"mkt-modal__scrim",onClick:S?void 0:R,"aria-hidden":!0}),e.jsxs("div",{className:"mkt-modal__card",children:[e.jsxs("div",{className:"mkt-modal__head",children:[e.jsx("div",{className:"mkt-modal__thumb",children:a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:""}):null}),e.jsxs("div",{children:[e.jsx("div",{className:"mkt-modal__name",title:a.name,children:a.name||"Item"}),e.jsx("span",{className:"chip chip--rarity",children:a.rarity})]})]}),e.jsx("div",{className:"mkt-modal__price",children:c?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mkt-modal__price-label",children:"Final price"}),e.jsxs("div",{className:"mkt-modal__price-value",children:[e.jsx(I,{className:"mkt-modal__diamond"}),z(c.credits)]}),e.jsxs("div",{className:"mkt-modal__price-sub muted",children:["Locked for this purchase · $",(c.usdCents/100).toFixed(2)]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mkt-modal__price-label",children:"Today’s price"}),e.jsxs("div",{className:"mkt-modal__price-value mkt-modal__price-value--approx",children:[e.jsx("span",{className:"mkt-modal__approx","aria-hidden":!0,children:"≈"}),e.jsx(I,{className:"mkt-modal__diamond"}),z(C)]}),e.jsx("div",{className:"mkt-modal__price-sub muted",children:p||"Locking today’s price…"})]})}),t?e.jsxs("div",{className:"mkt-modal__balance muted",children:["Your balance: ",e.jsx(I,{className:"ccy-mark"})," ",(n==null?void 0:n.credits)??0]}):null,v?e.jsxs("p",{className:"muted mkt-modal__note",children:["You’ll need a few more ",U.name," to buy this."]}):null,p&&_==="working"?e.jsx("p",{className:"muted mkt-modal__note",children:p}):null,m?e.jsx("p",{className:"error mkt-modal__note",children:m}):null,e.jsxs("div",{className:"mkt-modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:R,disabled:S,children:"Cancel"}),e.jsx("button",{className:"btn btn--purple",onClick:q,disabled:S||!c,children:S?"Buying…":v?`Get ${U.name}`:"Confirm purchase"})]})]})]})}const Te=48,w=1e5,qe={Head:["head","hat","hair","facial_hair","eyes","eyebrows","mouth","mask","helmet","tiara","top_head"],"Upper Body":["upper_body"],Handwear:["hands_wear"],"Lower Body":["lower_body"],Feet:["feet"],Accessories:["earring","eyewear"],Skins:["skin"],Dance:["dance"],Stunt:["stunt"],Greetings:["greetings"],Fun:["fun"],Poses:["poses"],Reactions:["reactions"],Horror:["horror"],Miscellaneous:["miscellaneous"]};function Ge(a){return{tradeId:a.tradeId??a.id,listingType:"primary",contractAddress:a.contractAddress,itemId:a.itemId??"",name:a.name,thumbnail:a.thumbnail,rarity:a.rarity,category:a.category,wearableCategory:a.wearableCategory??null,creator:a.creator,manaWei:a.manaWei??"0",available:1,network:a.network,chainId:a.chainId,createdAt:0}}function Je(){const[a]=pe(),i=(a.get("q")??"").trim().toLowerCase(),d=ae(),[f,t]=u.useState("wearable"),[n,b]=u.useState(null),[r,_]=u.useState([]),[h,p]=u.useState(""),[x,m]=u.useState(""),[g,c]=u.useState("newest"),[F,k]=u.useState(null),C=h&&!Number.isNaN(Number(h))?Number(h):void 0,v=x&&!Number.isNaN(Number(x))?Number(x):void 0,q=n?qe[n]:void 0,R=(O.find(s=>s.key===g)??O[0]).server,S={category:f,rarities:r.length?r:void 0,wearableCategories:q,minPriceCredits:C,maxPriceCredits:v,search:i||void 0,sortBy:R},{items:j,total:o,isLoading:l,error:N,hasNextPage:G,isFetchingNextPage:M,fetchNextPage:se}=Pe(["unified-listings",S],s=>ke({...S,first:Te,skip:s})),A=o,{data:L,isError:re}=Ee(),te=s=>L&&s.manaWei?ve(s.manaWei,L):null,K=u.useRef(null);u.useEffect(()=>{l||!i||K.current===i||(K.current=i,E("Shop Searched",{query:i,result_count:A}))},[i,l,A]);const $=u.useRef("__init__");u.useEffect(()=>{if(l)return;const s=JSON.stringify({category:f,subCategory:n,rarities:r,min:C,max:v,sort:g});if($.current==="__init__"||$.current===s){$.current=s;return}$.current=s,E("Shop Applied Filter",{filters:{category:f,sub_category:n,rarities:r,min_price_credits:C??null,max_price_credits:v??null,sort:g},result_count:A})},[f,n,r,C,v,g,l,A]);function ie(s){t(s),b(null)}function ne(s){_(y=>y.includes(s)?y.filter(H=>H!==s):[...y,s])}function le(s){const y=j.find(H=>H.id===s.id);y&&y.source==="legacy"&&y.manaWei&&k(Ge(y))}function ce(){d.invalidateQueries({queryKey:["unified-listings"]})}const B=C!=null?Math.min(C,w):0,T=v!=null?Math.min(v,w):w,oe=B/w*100,de=T/w*100;function ue(s){const y=Math.min(s,T);p(y<=0?"":String(y))}function me(s){const y=Math.max(s,B);m(y>=w?"":String(y))}return e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsxs("aside",{className:"browse__sidebar",children:[e.jsx("div",{className:"sidebar__section-label",children:"Category"}),e.jsx(Re,{category:f,subCategory:n,onCategory:ie,onSub:b}),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(I,{className:"price-filter__coin"}),e.jsx("input",{type:"number",min:"0","aria-label":"Minimum price",placeholder:"0",value:h,onChange:s=>p(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(I,{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":`${oe}%`,"--max-pct":`${de}%`},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:w,value:B,"aria-label":"Minimum price slider",onChange:s=>ue(Number(s.target.value))}),e.jsx("input",{type:"range",min:0,max:w,value:T,"aria-label":"Maximum price slider",onChange:s=>me(Number(s.target.value))})]}),e.jsxs("div",{className:"price-filter__range",children:[e.jsxs("span",{className:"price-filter__range-val",children:[e.jsx(I,{className:"price-filter__coin"}),B.toLocaleString()]}),e.jsxs("span",{className:"price-filter__range-val",children:[e.jsx(I,{className:"price-filter__coin"}),T.toLocaleString()]})]})]})]}),e.jsxs("div",{className:"browse__main",children:[e.jsx(Le,{rarities:r,onToggleRarity:ne,sort:g,onSort:c,total:o,loading:l,query:i}),re&&j.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,N?e.jsx("p",{className:"error",children:"Couldn’t load items — please try again."}):null,e.jsx("div",{className:"grid",children:l?e.jsx(Z,{count:15}):e.jsxs(e.Fragment,{children:[j.map(s=>s.source==="legacy"?e.jsx(V,{item:s,mode:"market",marketPriceCredits:te(s),onBuyNow:le},s.id):e.jsx(V,{item:s},s.id)),M?e.jsx(Z,{count:6}):null]})}),e.jsx(Ne,{hasNextPage:G,isFetching:M,onLoadMore:()=>se()}),!l&&j.length===0?e.jsx("p",{className:"muted",children:"No items match your filters."}):null]}),F&&L?e.jsx(Be,{listing:F,rate:L,onClose:()=>k(null),onSold:()=>{k(null),ce()}}):null]})}export{Je as Assets};
1
+ import{r as u,j as e,a as he,d as pe}from"./react-CQ5qhqs6.js";import{u as _e,i as Y,c as fe,v as ye,w as ae,h as be,q as xe,E as ge,I as P,y as E,H as Q,G as D,e as I,ai as z,x as U,A as V,al as ke}from"./index-BW6d6BbH.js";import{r as je,a as W,m as ve}from"./mana-rate-DbXjP8PT.js";import{S as Z}from"./SkeletonCards-DSpqiDzZ.js";import{L as Ne}from"./LoadMore-7qZApSeo.js";import{a as J}from"./buy-BXsYo32e.js";import{g as Ce,a as we,w as Se,S as Ie,G as Me}from"./buy-gasless-CB45oj-8.js";import{u as Pe}from"./useInfiniteGrid-Dvh83G5j.js";import"./ethers-DXxh-eEm.js";import"./index-CuI-U7nJ.js";import"./trade-encoding-CgWHvMsc.js";function Ee(){return _e({queryKey:["mana-rate",Y.chainId],queryFn:()=>je(Y.chainId),staleTime:6e4,refetchInterval:6e4,retry:1})}const Fe=[{key:"all",label:"Shop All"},{key:"wearable",label:"Wearables",expandable:!0,subs:[{key:"Head",label:"Head",icon:"cat-head"},{key:"Upper Body",label:"Upper Body",icon:"cat-upper"},{key:"Handwear",label:"Handwear",icon:"cat-handwear"},{key:"Lower Body",label:"Lower Body",icon:"cat-lower"},{key:"Feet",label:"Feet",icon:"cat-feet"},{key:"Accessories",label:"Accessories",icon:"cat-accessories"},{key:"Skins",label:"Skins",icon:"cat-skins"}]},{key:"emote",label:"Emotes",expandable:!0,subs:[{key:"Dance",label:"Dance",icon:"emote-dance"},{key:"Stunt",label:"Stunt",icon:"emote-stunt"},{key:"Greetings",label:"Greetings",icon:"emote-greetings"},{key:"Fun",label:"Fun",icon:"emote-fun"},{key:"Poses",label:"Poses",icon:"emote-poses"},{key:"Reactions",label:"Reactions",icon:"emote-reactions"},{key:"Horror",label:"Horror",icon:"emote-horror"},{key:"Miscellaneous",label:"Miscellaneous",icon:"emote-misc"}]}];function Re({category:a,subCategory:i,onCategory:d,onSub:f}){const[t,n]=u.useState(()=>a==="wearable"?"wearable":null);function b(r){r.subs?n(_=>{const h=_!==r.key;return h&&d(r.key),h?r.key:null}):(d(r.key),n(null))}return e.jsx("div",{className:"catfilter",children:Fe.map(r=>{const _=t===r.key&&!!r.subs,h=r.key===a;return e.jsxs("div",{className:"catfilter__group",children:[e.jsxs("button",{type:"button",className:`catfilter__cat${_?" is-expanded":""}${h?" is-selected":""}`,onClick:()=>b(r),children:[e.jsx("span",{className:"catfilter__cat-label",children:r.label}),r.expandable?e.jsx("span",{className:`ico ico-chevron catfilter__chev${_?" is-up":""}`,"aria-hidden":!0}):null]}),r.subs?e.jsx("div",{className:`catfilter__subs${_?" is-open":""}`,children:e.jsx("div",{className:"catfilter__subs-inner",children:r.subs.map(p=>e.jsx("button",{type:"button",className:`catfilter__sub${i===p.key?" is-active":""}`,onClick:()=>f(i===p.key?null:p.key),children:e.jsxs("span",{className:"catfilter__sub-left",children:[e.jsx("span",{className:`ico ico-${p.icon} catfilter__sub-ico`,"aria-hidden":!0}),e.jsx("span",{className:"catfilter__sub-label",children:p.label})]})},p.key))})}):null]},r.key)})})}const Ae=["common","uncommon","rare","epic","legendary","mythic","unique","exotic"],O=[{key:"newest",label:"Newest",server:"newest"},{key:"price-asc",label:"Price: Low to High",server:"cheapest"},{key:"price-desc",label:"Price: High to Low",server:"most_expensive"},{key:"name",label:"Name (A–Z)",server:"name"}];function X({panelKey:a,label:i,active:d,badge:f,align:t="left",panel:n,children:b}){const r=n.open===a,_=t==="right"?"filterbar__sort":"filterbar__trigger";return e.jsxs("div",{className:"filterbar__item",children:[e.jsxs("button",{className:`${_}${r?" is-open":""}${d?" is-active":""}`,onClick:()=>n.toggle(a),children:[i," ",f?e.jsx("span",{className:"filterbar__badge",children:f}):null," ",e.jsx("span",{className:`ico ico-chevron filterbar__chev${r?" is-up":""}`,"aria-hidden":!0})]}),r?b:null]})}function Le({rarities:a,onToggleRarity:i,rarityOptions:d=Ae,sort:f,onSort:t,sortOptions:n=O,total:b,loading:r,query:_}){const[h,p]=u.useState(null),x={open:h,toggle:m=>p(g=>g===m?null:m),close:()=>p(null)};return e.jsxs(e.Fragment,{children:[h?e.jsx("div",{className:"filterbar__scrim",onClick:x.close,"aria-hidden":!0}):null,e.jsxs("div",{className:"browse__toolbar",children:[e.jsxs("span",{className:"browse__count",children:[r?"…":`${b.toLocaleString()} Item${b===1?"":"s"}`,_?` for “${_}”`:""]}),e.jsxs("div",{className:"browse__dropdowns",children:[e.jsx(X,{panelKey:"rarity",label:"Rarity",active:a.length>0,badge:a.length||void 0,align:"right",panel:x,children:e.jsx("div",{className:"filter-pop filter-pop--rarity",children:d.map(m=>e.jsxs("label",{className:"filter-pop__check",children:[e.jsx("input",{type:"checkbox",checked:a.includes(m),onChange:()=>i(m)}),e.jsx("span",{children:m})]},m))})}),e.jsx(X,{panelKey:"sort",label:"Sort By",align:"right",panel:x,children:e.jsx("div",{className:"filter-pop filter-pop--sort",children:n.map(m=>e.jsx("button",{className:`filter-pop__sort${m.key===f?" is-active":""}`,onClick:()=>{t(m.key),x.close()},children:m.label},m.key))})})]})]})]})}function ee(a){const i=a,d=(i.message??"").toLowerCase();return i.code===4001||d.includes("reject")||d.includes("denied")||d.includes("cancel")?"You cancelled the request.":d.includes("insufficient")?`Not enough ${U.name} — get more first.`:d.includes("not found")||d.includes("no active listing")||d.includes("404")?"This item was just sold or removed. Refreshing the market…":d.includes("your own listing")?"You can't buy your own listing.":"Couldn't complete checkout — please try again."}function $e(a){return{id:a.tradeId,tradeId:a.tradeId,name:a.name,creator:a.creator,contractAddress:a.contractAddress,itemId:a.itemId,category:a.category,wearableCategory:a.wearableCategory??void 0,rarity:a.rarity,network:a.network,chainId:a.chainId,thumbnail:a.thumbnail,priceCredits:0,gender:null}}function Be({listing:a,rate:i,onClose:d,onSold:f}){const{session:t}=fe(),{data:n}=ye(t),b=ae(),r=he(),[_,h]=u.useState("confirm"),[p,x]=u.useState("Locking today’s price…"),[m,g]=u.useState(null),[c,F]=u.useState(null),k=u.useRef(null),C=Math.ceil(W(a.manaWei,i)/10);u.useEffect(()=>{let j=!1;if(!t){h("error"),g("Sign in to check out.");return}return(async()=>{try{const o=await be(a.tradeId);if(!o)throw new Error("not found");if(xe(o,t.address))throw new Error("You can't buy your own listing.");const l=W(a.manaWei,i);if(!Number.isFinite(l)||l<=0)throw new Error("price unavailable");const{credit:N,maxCreditedValue:G,usdCents:M}=await ge(t.identity,l,a.tradeId);if(j){P(t.identity,[N.id]).catch(()=>{});return}k.current=N.id,F({trade:o,credit:N,maxCreditedValue:G,usdCents:M,credits:Math.ceil(M/10)}),x("")}catch(o){if(j)return;console.error("[market] authorize failed",o),E(D(o)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:Q(o),value_usd:Math.round(W(a.manaWei,i))/100}),h("error"),g(ee(o))}})(),()=>{j=!0,k.current&&t&&(P(t.identity,[k.current]).catch(()=>{}),k.current=null)}},[]);const v=!!c&&((n==null?void 0:n.credits)??0)<c.credits;async function q(){if(!t||!c)return;if(v){P(t.identity,[c.credit.id]).catch(()=>{}),k.current=null,r("/credits");return}h("working"),g(null);let j=!1;try{x("Confirming your purchase…");const o={trade:c.trade,buyer:t.address,signer:t.signer,credits:[c.credit],maxCreditedValue:c.maxCreditedValue};let l;if(Ce())try{l=await we(o),await Se(l),j=!0}catch(N){if(N instanceof Ie)j=!0;else if(N instanceof Me)l=await J(o);else throw N}else l=await J(o);k.current=null,E("Shop Completed Purchase",{items:[{item_id:a.itemId??null,contract_address:a.contractAddress,token_id:null,price_usd:c.usdCents/100}],value_credits:c.credits,value_usd:c.usdCents/100,purchase_type:"item",is_primary:!0,payment_type:"credits",no_crypto_step:j,transaction_hash:l??null}),b.invalidateQueries({queryKey:["usd-balance"]}),r("/success",{state:{items:[$e(a)],txHash:l}})}catch(o){console.error("[market] buy now failed",o),P(t.identity,[c.credit.id]).catch(()=>{}),k.current=null,E(D(o)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:Q(o),value_usd:c.usdCents/100}),b.invalidateQueries({queryKey:["usd-balance"]});const l=ee(o);g(l),h("error"),/sold or removed/i.test(l)&&f()}}function R(){t&&c&&P(t.identity,[c.credit.id]).catch(()=>{}),k.current=null,d()}const S=_==="working";return e.jsxs("div",{className:"mkt-modal",role:"dialog","aria-modal":"true","aria-label":`Buy ${a.name}`,children:[e.jsx("div",{className:"mkt-modal__scrim",onClick:S?void 0:R,"aria-hidden":!0}),e.jsxs("div",{className:"mkt-modal__card",children:[e.jsxs("div",{className:"mkt-modal__head",children:[e.jsx("div",{className:"mkt-modal__thumb",children:a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:""}):null}),e.jsxs("div",{children:[e.jsx("div",{className:"mkt-modal__name",title:a.name,children:a.name||"Item"}),e.jsx("span",{className:"chip chip--rarity",children:a.rarity})]})]}),e.jsx("div",{className:"mkt-modal__price",children:c?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mkt-modal__price-label",children:"Final price"}),e.jsxs("div",{className:"mkt-modal__price-value",children:[e.jsx(I,{className:"mkt-modal__diamond"}),z(c.credits)]}),e.jsxs("div",{className:"mkt-modal__price-sub muted",children:["Locked for this purchase · $",(c.usdCents/100).toFixed(2)]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mkt-modal__price-label",children:"Today’s price"}),e.jsxs("div",{className:"mkt-modal__price-value mkt-modal__price-value--approx",children:[e.jsx("span",{className:"mkt-modal__approx","aria-hidden":!0,children:"≈"}),e.jsx(I,{className:"mkt-modal__diamond"}),z(C)]}),e.jsx("div",{className:"mkt-modal__price-sub muted",children:p||"Locking today’s price…"})]})}),t?e.jsxs("div",{className:"mkt-modal__balance muted",children:["Your balance: ",e.jsx(I,{className:"ccy-mark"})," ",(n==null?void 0:n.credits)??0]}):null,v?e.jsxs("p",{className:"muted mkt-modal__note",children:["You’ll need a few more ",U.name," to buy this."]}):null,p&&_==="working"?e.jsx("p",{className:"muted mkt-modal__note",children:p}):null,m?e.jsx("p",{className:"error mkt-modal__note",children:m}):null,e.jsxs("div",{className:"mkt-modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:R,disabled:S,children:"Cancel"}),e.jsx("button",{className:"btn btn--purple",onClick:q,disabled:S||!c,children:S?"Buying…":v?`Get ${U.name}`:"Confirm purchase"})]})]})]})}const Te=48,w=1e5,qe={Head:["head","hat","hair","facial_hair","eyes","eyebrows","mouth","mask","helmet","tiara","top_head"],"Upper Body":["upper_body"],Handwear:["hands_wear"],"Lower Body":["lower_body"],Feet:["feet"],Accessories:["earring","eyewear"],Skins:["skin"],Dance:["dance"],Stunt:["stunt"],Greetings:["greetings"],Fun:["fun"],Poses:["poses"],Reactions:["reactions"],Horror:["horror"],Miscellaneous:["miscellaneous"]};function Ge(a){return{tradeId:a.tradeId??a.id,listingType:"primary",contractAddress:a.contractAddress,itemId:a.itemId??"",name:a.name,thumbnail:a.thumbnail,rarity:a.rarity,category:a.category,wearableCategory:a.wearableCategory??null,creator:a.creator,manaWei:a.manaWei??"0",available:1,network:a.network,chainId:a.chainId,createdAt:0}}function Je(){const[a]=pe(),i=(a.get("q")??"").trim().toLowerCase(),d=ae(),[f,t]=u.useState("wearable"),[n,b]=u.useState(null),[r,_]=u.useState([]),[h,p]=u.useState(""),[x,m]=u.useState(""),[g,c]=u.useState("newest"),[F,k]=u.useState(null),C=h&&!Number.isNaN(Number(h))?Number(h):void 0,v=x&&!Number.isNaN(Number(x))?Number(x):void 0,q=n?qe[n]:void 0,R=(O.find(s=>s.key===g)??O[0]).server,S={category:f,rarities:r.length?r:void 0,wearableCategories:q,minPriceCredits:C,maxPriceCredits:v,search:i||void 0,sortBy:R},{items:j,total:o,isLoading:l,error:N,hasNextPage:G,isFetchingNextPage:M,fetchNextPage:se}=Pe(["unified-listings",S],s=>ke({...S,first:Te,skip:s})),A=o,{data:L,isError:re}=Ee(),te=s=>L&&s.manaWei?ve(s.manaWei,L):null,K=u.useRef(null);u.useEffect(()=>{l||!i||K.current===i||(K.current=i,E("Shop Searched",{query:i,result_count:A}))},[i,l,A]);const $=u.useRef("__init__");u.useEffect(()=>{if(l)return;const s=JSON.stringify({category:f,subCategory:n,rarities:r,min:C,max:v,sort:g});if($.current==="__init__"||$.current===s){$.current=s;return}$.current=s,E("Shop Applied Filter",{filters:{category:f,sub_category:n,rarities:r,min_price_credits:C??null,max_price_credits:v??null,sort:g},result_count:A})},[f,n,r,C,v,g,l,A]);function ie(s){t(s),b(null)}function ne(s){_(y=>y.includes(s)?y.filter(H=>H!==s):[...y,s])}function le(s){const y=j.find(H=>H.id===s.id);y&&y.source==="legacy"&&y.manaWei&&k(Ge(y))}function ce(){d.invalidateQueries({queryKey:["unified-listings"]})}const B=C!=null?Math.min(C,w):0,T=v!=null?Math.min(v,w):w,oe=B/w*100,de=T/w*100;function ue(s){const y=Math.min(s,T);p(y<=0?"":String(y))}function me(s){const y=Math.max(s,B);m(y>=w?"":String(y))}return e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsxs("aside",{className:"browse__sidebar",children:[e.jsx("div",{className:"sidebar__section-label",children:"Category"}),e.jsx(Re,{category:f,subCategory:n,onCategory:ie,onSub:b}),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(I,{className:"price-filter__coin"}),e.jsx("input",{type:"number",min:"0","aria-label":"Minimum price",placeholder:"0",value:h,onChange:s=>p(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(I,{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":`${oe}%`,"--max-pct":`${de}%`},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:w,value:B,"aria-label":"Minimum price slider",onChange:s=>ue(Number(s.target.value))}),e.jsx("input",{type:"range",min:0,max:w,value:T,"aria-label":"Maximum price slider",onChange:s=>me(Number(s.target.value))})]}),e.jsxs("div",{className:"price-filter__range",children:[e.jsxs("span",{className:"price-filter__range-val",children:[e.jsx(I,{className:"price-filter__coin"}),B.toLocaleString()]}),e.jsxs("span",{className:"price-filter__range-val",children:[e.jsx(I,{className:"price-filter__coin"}),T.toLocaleString()]})]})]})]}),e.jsxs("div",{className:"browse__main",children:[e.jsx(Le,{rarities:r,onToggleRarity:ne,sort:g,onSort:c,total:o,loading:l,query:i}),re&&j.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,N?e.jsx("p",{className:"error",children:"Couldn’t load items — please try again."}):null,e.jsx("div",{className:"grid",children:l?e.jsx(Z,{count:15}):e.jsxs(e.Fragment,{children:[j.map(s=>s.source==="legacy"?e.jsx(V,{item:s,mode:"market",marketPriceCredits:te(s),onBuyNow:le},s.id):e.jsx(V,{item:s},s.id)),M?e.jsx(Z,{count:6}):null]})}),e.jsx(Ne,{hasNextPage:G,isFetching:M,onLoadMore:()=>se()}),!l&&j.length===0?e.jsx("p",{className:"muted",children:"No items match your filters."}):null]}),F&&L?e.jsx(Be,{listing:F,rate:L,onClose:()=>k(null),onSold:()=>{k(null),ce()}}):null]})}export{Je as Assets};
@@ -1,4 +1,4 @@
1
- import{a4 as Ge,ax as Xe,ay as Ye,az as qe,aA as Je,U as Y,V as b,X as z,S as ee,T as se,aB as Ze,$ as H,a1 as le,R as Ce,aC as be,aD as we,aE as Z,Z as Re,aF as Qe,aG as et,aH as tt,aI as ot,Y as T,aJ as nt,aK as w}from"./index-DvAy35iS.js";import{r as l,j as B,R as X}from"./react-CQ5qhqs6.js";function it(e){return Object.keys(e).length===0}function at(e=null){const t=l.useContext(Ge);return!t||it(t)?e:t}const rt=Xe();function st(e=rt){return at(e)}function Me(e){var t,o,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(o=Me(e[t]))&&(i&&(i+=" "),i+=o)}else for(o in e)e[o]&&(i&&(i+=" "),i+=o);return i}function lt(){for(var e,t,o=0,i="",n=arguments.length;o<n;o++)(e=arguments[o])&&(t=Me(e))&&(i&&(i+=" "),i+=t);return i}const ct=["className","component"];function ut(e={}){const{themeId:t,defaultTheme:o,defaultClassName:i="MuiBox-root",generateClassName:n}=e,a=Ye("div",{shouldForwardProp:u=>u!=="theme"&&u!=="sx"&&u!=="as"})(qe);return l.forwardRef(function(c,p){const f=st(o),g=Je(c),{className:m,component:v="div"}=g,h=Y(g,ct);return B.jsx(a,b({as:v,ref:p,className:lt(m,n?n(i):i),theme:t&&f[t]||f},h))})}function ae(e,t){return ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,i){return o.__proto__=i,o},ae(e,t)}function pt(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ae(e,t)}const ge=X.createContext(null);function dt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e,t){var o=function(a){return t&&l.isValidElement(a)?t(a):a},i=Object.create(null);return e&&l.Children.map(e,function(n){return n}).forEach(function(n){i[n.key]=o(n)}),i}function ft(e,t){e=e||{},t=t||{};function o(f){return f in t?t[f]:e[f]}var i=Object.create(null),n=[];for(var a in e)a in t?n.length&&(i[a]=n,n=[]):n.push(a);var r,u={};for(var c in t){if(i[c])for(r=0;r<i[c].length;r++){var p=i[c][r];u[i[c][r]]=o(p)}u[c]=o(c)}for(r=0;r<n.length;r++)u[n[r]]=o(n[r]);return u}function A(e,t,o){return o[t]!=null?o[t]:e.props[t]}function ht(e,t){return ce(e.children,function(o){return l.cloneElement(o,{onExited:t.bind(null,o),in:!0,appear:A(o,"appear",e),enter:A(o,"enter",e),exit:A(o,"exit",e)})})}function bt(e,t,o){var i=ce(e.children),n=ft(t,i);return Object.keys(n).forEach(function(a){var r=n[a];if(l.isValidElement(r)){var u=a in t,c=a in i,p=t[a],f=l.isValidElement(p)&&!p.props.in;c&&(!u||f)?n[a]=l.cloneElement(r,{onExited:o.bind(null,r),in:!0,exit:A(r,"exit",e),enter:A(r,"enter",e)}):!c&&u&&!f?n[a]=l.cloneElement(r,{in:!1}):c&&u&&l.isValidElement(p)&&(n[a]=l.cloneElement(r,{onExited:o.bind(null,r),in:p.props.in,exit:A(r,"exit",e),enter:A(r,"enter",e)}))}}),n}var gt=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},mt={component:"div",childFactory:function(t){return t}},ue=(function(e){pt(t,e);function t(i,n){var a;a=e.call(this,i,n)||this;var r=a.handleExited.bind(dt(a));return a.state={contextValue:{isMounting:!0},handleExited:r,firstRender:!0},a}var o=t.prototype;return o.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},o.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(n,a){var r=a.children,u=a.handleExited,c=a.firstRender;return{children:c?ht(n,u):bt(n,r,u),firstRender:!1}},o.handleExited=function(n,a){var r=ce(this.props.children);n.key in r||(n.props.onExited&&n.props.onExited(a),this.mounted&&this.setState(function(u){var c=b({},u.children);return delete c[n.key],{children:c}}))},o.render=function(){var n=this.props,a=n.component,r=n.childFactory,u=Y(n,["component","childFactory"]),c=this.state.contextValue,p=gt(this.state.children).map(r);return delete u.appear,delete u.enter,delete u.exit,a===null?X.createElement(ge.Provider,{value:c},p):X.createElement(ge.Provider,{value:c},X.createElement(a,u,p))},t})(X.Component);ue.propTypes={};ue.defaultProps=mt;function xt(e){const{className:t,classes:o,pulsate:i=!1,rippleX:n,rippleY:a,rippleSize:r,in:u,onExited:c,timeout:p}=e,[f,g]=l.useState(!1),m=z(t,o.ripple,o.rippleVisible,i&&o.ripplePulsate),v={width:r,height:r,top:-(r/2)+a,left:-(r/2)+n},h=z(o.child,f&&o.childLeaving,i&&o.childPulsate);return!u&&!f&&g(!0),l.useEffect(()=>{if(!u&&c!=null){const C=setTimeout(c,p);return()=>{clearTimeout(C)}}},[c,u,p]),B.jsx("span",{className:m,style:v,children:B.jsx("span",{className:h})})}const E=ee("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),vt=["center","classes","className"];let te=e=>e,me,xe,ve,ye;const re=550,yt=80,Ct=le(me||(me=te`
1
+ import{a5 as Ge,ay as Xe,az as Ye,aA as qe,aB as Je,V as Y,X as b,Y as z,T as ee,U as se,aC as Ze,a0 as H,a2 as le,S as Ce,aD as be,aE as we,aF as Z,$ as Re,aG as Qe,aH as et,aI as tt,aJ as ot,Z as T,aK as nt,aL as w}from"./index-BW6d6BbH.js";import{r as l,j as B,R as X}from"./react-CQ5qhqs6.js";function at(e){return Object.keys(e).length===0}function it(e=null){const t=l.useContext(Ge);return!t||at(t)?e:t}const rt=Xe();function st(e=rt){return it(e)}function Me(e){var t,o,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(o=Me(e[t]))&&(a&&(a+=" "),a+=o)}else for(o in e)e[o]&&(a&&(a+=" "),a+=o);return a}function lt(){for(var e,t,o=0,a="",n=arguments.length;o<n;o++)(e=arguments[o])&&(t=Me(e))&&(a&&(a+=" "),a+=t);return a}const ct=["className","component"];function ut(e={}){const{themeId:t,defaultTheme:o,defaultClassName:a="MuiBox-root",generateClassName:n}=e,i=Ye("div",{shouldForwardProp:u=>u!=="theme"&&u!=="sx"&&u!=="as"})(qe);return l.forwardRef(function(c,p){const f=st(o),g=Je(c),{className:m,component:v="div"}=g,h=Y(g,ct);return B.jsx(i,b({as:v,ref:p,className:lt(m,n?n(a):a),theme:t&&f[t]||f},h))})}function ie(e,t){return ie=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,a){return o.__proto__=a,o},ie(e,t)}function pt(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ie(e,t)}const ge=X.createContext(null);function dt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e,t){var o=function(i){return t&&l.isValidElement(i)?t(i):i},a=Object.create(null);return e&&l.Children.map(e,function(n){return n}).forEach(function(n){a[n.key]=o(n)}),a}function ft(e,t){e=e||{},t=t||{};function o(f){return f in t?t[f]:e[f]}var a=Object.create(null),n=[];for(var i in e)i in t?n.length&&(a[i]=n,n=[]):n.push(i);var r,u={};for(var c in t){if(a[c])for(r=0;r<a[c].length;r++){var p=a[c][r];u[a[c][r]]=o(p)}u[c]=o(c)}for(r=0;r<n.length;r++)u[n[r]]=o(n[r]);return u}function A(e,t,o){return o[t]!=null?o[t]:e.props[t]}function ht(e,t){return ce(e.children,function(o){return l.cloneElement(o,{onExited:t.bind(null,o),in:!0,appear:A(o,"appear",e),enter:A(o,"enter",e),exit:A(o,"exit",e)})})}function bt(e,t,o){var a=ce(e.children),n=ft(t,a);return Object.keys(n).forEach(function(i){var r=n[i];if(l.isValidElement(r)){var u=i in t,c=i in a,p=t[i],f=l.isValidElement(p)&&!p.props.in;c&&(!u||f)?n[i]=l.cloneElement(r,{onExited:o.bind(null,r),in:!0,exit:A(r,"exit",e),enter:A(r,"enter",e)}):!c&&u&&!f?n[i]=l.cloneElement(r,{in:!1}):c&&u&&l.isValidElement(p)&&(n[i]=l.cloneElement(r,{onExited:o.bind(null,r),in:p.props.in,exit:A(r,"exit",e),enter:A(r,"enter",e)}))}}),n}var gt=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},mt={component:"div",childFactory:function(t){return t}},ue=(function(e){pt(t,e);function t(a,n){var i;i=e.call(this,a,n)||this;var r=i.handleExited.bind(dt(i));return i.state={contextValue:{isMounting:!0},handleExited:r,firstRender:!0},i}var o=t.prototype;return o.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},o.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(n,i){var r=i.children,u=i.handleExited,c=i.firstRender;return{children:c?ht(n,u):bt(n,r,u),firstRender:!1}},o.handleExited=function(n,i){var r=ce(this.props.children);n.key in r||(n.props.onExited&&n.props.onExited(i),this.mounted&&this.setState(function(u){var c=b({},u.children);return delete c[n.key],{children:c}}))},o.render=function(){var n=this.props,i=n.component,r=n.childFactory,u=Y(n,["component","childFactory"]),c=this.state.contextValue,p=gt(this.state.children).map(r);return delete u.appear,delete u.enter,delete u.exit,i===null?X.createElement(ge.Provider,{value:c},p):X.createElement(ge.Provider,{value:c},X.createElement(i,u,p))},t})(X.Component);ue.propTypes={};ue.defaultProps=mt;function xt(e){const{className:t,classes:o,pulsate:a=!1,rippleX:n,rippleY:i,rippleSize:r,in:u,onExited:c,timeout:p}=e,[f,g]=l.useState(!1),m=z(t,o.ripple,o.rippleVisible,a&&o.ripplePulsate),v={width:r,height:r,top:-(r/2)+i,left:-(r/2)+n},h=z(o.child,f&&o.childLeaving,a&&o.childPulsate);return!u&&!f&&g(!0),l.useEffect(()=>{if(!u&&c!=null){const C=setTimeout(c,p);return()=>{clearTimeout(C)}}},[c,u,p]),B.jsx("span",{className:m,style:v,children:B.jsx("span",{className:h})})}const E=ee("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),vt=["center","classes","className"];let te=e=>e,me,xe,ve,ye;const re=550,yt=80,Ct=le(me||(me=te`
2
2
  0% {
3
3
  transform: scale(0);
4
4
  opacity: 0.1;
@@ -71,4 +71,4 @@ import{a4 as Ge,ax as Xe,ay as Ye,az as qe,aA as Je,U as Y,V as b,X as z,S as ee
71
71
  animation-iteration-count: infinite;
72
72
  animation-delay: 200ms;
73
73
  }
74
- `),E.rippleVisible,Ct,re,({theme:e})=>e.transitions.easing.easeInOut,E.ripplePulsate,({theme:e})=>e.transitions.duration.shorter,E.child,E.childLeaving,Rt,re,({theme:e})=>e.transitions.easing.easeInOut,E.childPulsate,Mt,({theme:e})=>e.transitions.easing.easeInOut),Tt=l.forwardRef(function(t,o){const i=se({props:t,name:"MuiTouchRipple"}),{center:n=!1,classes:a={},className:r}=i,u=Y(i,vt),[c,p]=l.useState([]),f=l.useRef(0),g=l.useRef(null);l.useEffect(()=>{g.current&&(g.current(),g.current=null)},[c]);const m=l.useRef(!1),v=Ze(),h=l.useRef(null),C=l.useRef(null),_=l.useCallback(d=>{const{pulsate:R,rippleX:x,rippleY:y,rippleSize:L,cb:O}=d;p(M=>[...M,B.jsx(Et,{classes:{ripple:z(a.ripple,E.ripple),rippleVisible:z(a.rippleVisible,E.rippleVisible),ripplePulsate:z(a.ripplePulsate,E.ripplePulsate),child:z(a.child,E.child),childLeaving:z(a.childLeaving,E.childLeaving),childPulsate:z(a.childPulsate,E.childPulsate)},timeout:re,pulsate:R,rippleX:x,rippleY:y,rippleSize:L},f.current)]),f.current+=1,g.current=O},[a]),V=l.useCallback((d={},R={},x=()=>{})=>{const{pulsate:y=!1,center:L=n||R.pulsate,fakeElement:O=!1}=R;if((d==null?void 0:d.type)==="mousedown"&&m.current){m.current=!1;return}(d==null?void 0:d.type)==="touchstart"&&(m.current=!0);const M=O?null:C.current,D=M?M.getBoundingClientRect():{width:0,height:0,left:0,top:0};let P,j,F;if(L||d===void 0||d.clientX===0&&d.clientY===0||!d.clientX&&!d.touches)P=Math.round(D.width/2),j=Math.round(D.height/2);else{const{clientX:W,clientY:k}=d.touches&&d.touches.length>0?d.touches[0]:d;P=Math.round(W-D.left),j=Math.round(k-D.top)}if(L)F=Math.sqrt((2*D.width**2+D.height**2)/3),F%2===0&&(F+=1);else{const W=Math.max(Math.abs((M?M.clientWidth:0)-P),P)*2+2,k=Math.max(Math.abs((M?M.clientHeight:0)-j),j)*2+2;F=Math.sqrt(W**2+k**2)}d!=null&&d.touches?h.current===null&&(h.current=()=>{_({pulsate:y,rippleX:P,rippleY:j,rippleSize:F,cb:x})},v.start(yt,()=>{h.current&&(h.current(),h.current=null)})):_({pulsate:y,rippleX:P,rippleY:j,rippleSize:F,cb:x})},[n,_,v]),S=l.useCallback(()=>{V({},{pulsate:!0})},[V]),I=l.useCallback((d,R)=>{if(v.clear(),(d==null?void 0:d.type)==="touchend"&&h.current){h.current(),h.current=null,v.start(0,()=>{I(d,R)});return}h.current=null,p(x=>x.length>0?x.slice(1):x),g.current=R},[v]);return l.useImperativeHandle(o,()=>({pulsate:S,start:V,stop:I}),[S,V,I]),B.jsx(zt,b({className:z(E.root,a.root,r),ref:C},u,{children:B.jsx(ue,{component:null,exit:!0,children:c})}))});function Bt(e){return Ce("MuiButtonBase",e)}const $t=ee("MuiButtonBase",["root","disabled","focusVisible"]),It=["action","centerRipple","children","className","component","disabled","disableRipple","disableTouchRipple","focusRipple","focusVisibleClassName","LinkComponent","onBlur","onClick","onContextMenu","onDragLeave","onFocus","onFocusVisible","onKeyDown","onKeyUp","onMouseDown","onMouseLeave","onMouseUp","onTouchEnd","onTouchMove","onTouchStart","tabIndex","TouchRippleProps","touchRippleRef","type"],Pt=e=>{const{disabled:t,focusVisible:o,focusVisibleClassName:i,classes:n}=e,r=Re({root:["root",t&&"disabled",o&&"focusVisible"]},Bt,n);return o&&i&&(r.root+=` ${i}`),r},kt=H("button",{name:"MuiButtonBase",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},[`&.${$t.disabled}`]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),Nt=l.forwardRef(function(t,o){const i=se({props:t,name:"MuiButtonBase"}),{action:n,centerRipple:a=!1,children:r,className:u,component:c="button",disabled:p=!1,disableRipple:f=!1,disableTouchRipple:g=!1,focusRipple:m=!1,LinkComponent:v="a",onBlur:h,onClick:C,onContextMenu:_,onDragLeave:V,onFocus:S,onFocusVisible:I,onKeyDown:d,onKeyUp:R,onMouseDown:x,onMouseLeave:y,onMouseUp:L,onTouchEnd:O,onTouchMove:M,onTouchStart:D,tabIndex:P=0,TouchRippleProps:j,touchRippleRef:F,type:W}=i,k=Y(i,It),K=l.useRef(null),$=l.useRef(null),Ee=be($,F),{isFocusVisibleRef:pe,onFocus:Te,onBlur:Be,ref:$e}=we(),[U,q]=l.useState(!1);p&&U&&q(!1),l.useImperativeHandle(n,()=>({focusVisible:()=>{q(!0),K.current.focus()}}),[]);const[oe,Ie]=l.useState(!1);l.useEffect(()=>{Ie(!0)},[]);const Pe=oe&&!f&&!p;l.useEffect(()=>{U&&m&&!f&&oe&&$.current.pulsate()},[f,m,U,oe]);function N(s,fe,Ke=g){return Z(he=>(fe&&fe(he),!Ke&&$.current&&$.current[s](he),!0))}const ke=N("start",x),Ne=N("stop",_),Ve=N("stop",V),Se=N("stop",L),Le=N("stop",s=>{U&&s.preventDefault(),y&&y(s)}),De=N("start",D),je=N("stop",O),Fe=N("stop",M),_e=N("stop",s=>{Be(s),pe.current===!1&&q(!1),h&&h(s)},!1),Oe=Z(s=>{K.current||(K.current=s.currentTarget),Te(s),pe.current===!0&&(q(!0),I&&I(s)),S&&S(s)}),ne=()=>{const s=K.current;return c&&c!=="button"&&!(s.tagName==="A"&&s.href)},ie=l.useRef(!1),We=Z(s=>{m&&!ie.current&&U&&$.current&&s.key===" "&&(ie.current=!0,$.current.stop(s,()=>{$.current.start(s)})),s.target===s.currentTarget&&ne()&&s.key===" "&&s.preventDefault(),d&&d(s),s.target===s.currentTarget&&ne()&&s.key==="Enter"&&!p&&(s.preventDefault(),C&&C(s))}),Ue=Z(s=>{m&&s.key===" "&&$.current&&U&&!s.defaultPrevented&&(ie.current=!1,$.current.stop(s,()=>{$.current.pulsate(s)})),R&&R(s),C&&s.target===s.currentTarget&&ne()&&s.key===" "&&!s.defaultPrevented&&C(s)});let J=c;J==="button"&&(k.href||k.to)&&(J=v);const G={};J==="button"?(G.type=W===void 0?"button":W,G.disabled=p):(!k.href&&!k.to&&(G.role="button"),p&&(G["aria-disabled"]=p));const Ae=be(o,$e,K),de=b({},i,{centerRipple:a,component:c,disabled:p,disableRipple:f,disableTouchRipple:g,focusRipple:m,tabIndex:P,focusVisible:U}),He=Pt(de);return B.jsxs(kt,b({as:J,className:z(He.root,u),ownerState:de,onBlur:_e,onClick:C,onContextMenu:Ne,onFocus:Oe,onKeyDown:We,onKeyUp:Ue,onMouseDown:ke,onMouseLeave:Le,onMouseUp:Se,onDragLeave:Ve,onTouchEnd:je,onTouchMove:Fe,onTouchStart:De,ref:Ae,tabIndex:p?-1:P,type:W},G,k,{children:[r,Pe?B.jsx(Tt,b({ref:Ee,center:a},j)):null]}))}),Vt=ee("MuiBox",["root"]),St=tt(),Gt=ut({themeId:et,defaultTheme:St,defaultClassName:Vt.root,generateClassName:Qe.generate});function Lt(e){return Ce("MuiButton",e)}const Q=ee("MuiButton",["root","text","textInherit","textPrimary","textSecondary","textSuccess","textError","textInfo","textWarning","outlined","outlinedInherit","outlinedPrimary","outlinedSecondary","outlinedSuccess","outlinedError","outlinedInfo","outlinedWarning","contained","containedInherit","containedPrimary","containedSecondary","containedSuccess","containedError","containedInfo","containedWarning","disableElevation","focusVisible","disabled","colorInherit","colorPrimary","colorSecondary","colorSuccess","colorError","colorInfo","colorWarning","textSizeSmall","textSizeMedium","textSizeLarge","outlinedSizeSmall","outlinedSizeMedium","outlinedSizeLarge","containedSizeSmall","containedSizeMedium","containedSizeLarge","sizeMedium","sizeSmall","sizeLarge","fullWidth","startIcon","endIcon","icon","iconSizeSmall","iconSizeMedium","iconSizeLarge"]),Dt=l.createContext({}),jt=l.createContext(void 0),Ft=["children","color","component","className","disabled","disableElevation","disableFocusRipple","endIcon","focusVisibleClassName","fullWidth","size","startIcon","type","variant"],_t=e=>{const{color:t,disableElevation:o,fullWidth:i,size:n,variant:a,classes:r}=e,u={root:["root",a,`${a}${T(t)}`,`size${T(n)}`,`${a}Size${T(n)}`,`color${T(t)}`,o&&"disableElevation",i&&"fullWidth"],label:["label"],startIcon:["icon","startIcon",`iconSize${T(n)}`],endIcon:["icon","endIcon",`iconSize${T(n)}`]},c=Re(u,Lt,r);return b({},r,c)},ze=e=>b({},e.size==="small"&&{"& > *:nth-of-type(1)":{fontSize:18}},e.size==="medium"&&{"& > *:nth-of-type(1)":{fontSize:20}},e.size==="large"&&{"& > *:nth-of-type(1)":{fontSize:22}}),Ot=H(Nt,{shouldForwardProp:e=>nt(e)||e==="classes",name:"MuiButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.root,t[o.variant],t[`${o.variant}${T(o.color)}`],t[`size${T(o.size)}`],t[`${o.variant}Size${T(o.size)}`],o.color==="inherit"&&t.colorInherit,o.disableElevation&&t.disableElevation,o.fullWidth&&t.fullWidth]}})(({theme:e,ownerState:t})=>{var o,i;const n=e.palette.mode==="light"?e.palette.grey[300]:e.palette.grey[800],a=e.palette.mode==="light"?e.palette.grey.A100:e.palette.grey[700];return b({},e.typography.button,{minWidth:64,padding:"6px 16px",borderRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create(["background-color","box-shadow","border-color","color"],{duration:e.transitions.duration.short}),"&:hover":b({textDecoration:"none",backgroundColor:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / ${e.vars.palette.action.hoverOpacity})`:w.alpha(e.palette.text.primary,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},t.variant==="text"&&t.color!=="inherit"&&{backgroundColor:e.vars?`rgba(${e.vars.palette[t.color].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:w.alpha(e.palette[t.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},t.variant==="outlined"&&t.color!=="inherit"&&{border:`1px solid ${(e.vars||e).palette[t.color].main}`,backgroundColor:e.vars?`rgba(${e.vars.palette[t.color].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:w.alpha(e.palette[t.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},t.variant==="contained"&&{backgroundColor:e.vars?e.vars.palette.Button.inheritContainedHoverBg:a,boxShadow:(e.vars||e).shadows[4],"@media (hover: none)":{boxShadow:(e.vars||e).shadows[2],backgroundColor:(e.vars||e).palette.grey[300]}},t.variant==="contained"&&t.color!=="inherit"&&{backgroundColor:(e.vars||e).palette[t.color].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t.color].main}}),"&:active":b({},t.variant==="contained"&&{boxShadow:(e.vars||e).shadows[8]}),[`&.${Q.focusVisible}`]:b({},t.variant==="contained"&&{boxShadow:(e.vars||e).shadows[6]}),[`&.${Q.disabled}`]:b({color:(e.vars||e).palette.action.disabled},t.variant==="outlined"&&{border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`},t.variant==="contained"&&{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground})},t.variant==="text"&&{padding:"6px 8px"},t.variant==="text"&&t.color!=="inherit"&&{color:(e.vars||e).palette[t.color].main},t.variant==="outlined"&&{padding:"5px 15px",border:"1px solid currentColor"},t.variant==="outlined"&&t.color!=="inherit"&&{color:(e.vars||e).palette[t.color].main,border:e.vars?`1px solid rgba(${e.vars.palette[t.color].mainChannel} / 0.5)`:`1px solid ${w.alpha(e.palette[t.color].main,.5)}`},t.variant==="contained"&&{color:e.vars?e.vars.palette.text.primary:(o=(i=e.palette).getContrastText)==null?void 0:o.call(i,e.palette.grey[300]),backgroundColor:e.vars?e.vars.palette.Button.inheritContainedBg:n,boxShadow:(e.vars||e).shadows[2]},t.variant==="contained"&&t.color!=="inherit"&&{color:(e.vars||e).palette[t.color].contrastText,backgroundColor:(e.vars||e).palette[t.color].main},t.color==="inherit"&&{color:"inherit",borderColor:"currentColor"},t.size==="small"&&t.variant==="text"&&{padding:"4px 5px",fontSize:e.typography.pxToRem(13)},t.size==="large"&&t.variant==="text"&&{padding:"8px 11px",fontSize:e.typography.pxToRem(15)},t.size==="small"&&t.variant==="outlined"&&{padding:"3px 9px",fontSize:e.typography.pxToRem(13)},t.size==="large"&&t.variant==="outlined"&&{padding:"7px 21px",fontSize:e.typography.pxToRem(15)},t.size==="small"&&t.variant==="contained"&&{padding:"4px 10px",fontSize:e.typography.pxToRem(13)},t.size==="large"&&t.variant==="contained"&&{padding:"8px 22px",fontSize:e.typography.pxToRem(15)},t.fullWidth&&{width:"100%"})},({ownerState:e})=>e.disableElevation&&{boxShadow:"none","&:hover":{boxShadow:"none"},[`&.${Q.focusVisible}`]:{boxShadow:"none"},"&:active":{boxShadow:"none"},[`&.${Q.disabled}`]:{boxShadow:"none"}}),Wt=H("span",{name:"MuiButton",slot:"StartIcon",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.startIcon,t[`iconSize${T(o.size)}`]]}})(({ownerState:e})=>b({display:"inherit",marginRight:8,marginLeft:-4},e.size==="small"&&{marginLeft:-2},ze(e))),Ut=H("span",{name:"MuiButton",slot:"EndIcon",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.endIcon,t[`iconSize${T(o.size)}`]]}})(({ownerState:e})=>b({display:"inherit",marginRight:-4,marginLeft:8},e.size==="small"&&{marginRight:-2},ze(e))),Xt=l.forwardRef(function(t,o){const i=l.useContext(Dt),n=l.useContext(jt),a=ot(i,t),r=se({props:a,name:"MuiButton"}),{children:u,color:c="primary",component:p="button",className:f,disabled:g=!1,disableElevation:m=!1,disableFocusRipple:v=!1,endIcon:h,focusVisibleClassName:C,fullWidth:_=!1,size:V="medium",startIcon:S,type:I,variant:d="text"}=r,R=Y(r,Ft),x=b({},r,{color:c,component:p,disabled:g,disableElevation:m,disableFocusRipple:v,fullWidth:_,size:V,type:I,variant:d}),y=_t(x),L=S&&B.jsx(Wt,{className:y.startIcon,ownerState:x,children:S}),O=h&&B.jsx(Ut,{className:y.endIcon,ownerState:x,children:h}),M=n||"";return B.jsxs(Ot,b({ownerState:x,className:z(i.className,y.root,f,M),component:p,disabled:g,focusRipple:!v,focusVisibleClassName:z(y.focusVisible,C),ref:o,type:I},R,{classes:y,children:[L,u,O]}))});export{Nt as B,ge as T,pt as _,at as a,Xt as b,Gt as c,Dt as d,jt as e,st as u};
74
+ `),E.rippleVisible,Ct,re,({theme:e})=>e.transitions.easing.easeInOut,E.ripplePulsate,({theme:e})=>e.transitions.duration.shorter,E.child,E.childLeaving,Rt,re,({theme:e})=>e.transitions.easing.easeInOut,E.childPulsate,Mt,({theme:e})=>e.transitions.easing.easeInOut),Tt=l.forwardRef(function(t,o){const a=se({props:t,name:"MuiTouchRipple"}),{center:n=!1,classes:i={},className:r}=a,u=Y(a,vt),[c,p]=l.useState([]),f=l.useRef(0),g=l.useRef(null);l.useEffect(()=>{g.current&&(g.current(),g.current=null)},[c]);const m=l.useRef(!1),v=Ze(),h=l.useRef(null),C=l.useRef(null),_=l.useCallback(d=>{const{pulsate:R,rippleX:x,rippleY:y,rippleSize:L,cb:O}=d;p(M=>[...M,B.jsx(Et,{classes:{ripple:z(i.ripple,E.ripple),rippleVisible:z(i.rippleVisible,E.rippleVisible),ripplePulsate:z(i.ripplePulsate,E.ripplePulsate),child:z(i.child,E.child),childLeaving:z(i.childLeaving,E.childLeaving),childPulsate:z(i.childPulsate,E.childPulsate)},timeout:re,pulsate:R,rippleX:x,rippleY:y,rippleSize:L},f.current)]),f.current+=1,g.current=O},[i]),V=l.useCallback((d={},R={},x=()=>{})=>{const{pulsate:y=!1,center:L=n||R.pulsate,fakeElement:O=!1}=R;if((d==null?void 0:d.type)==="mousedown"&&m.current){m.current=!1;return}(d==null?void 0:d.type)==="touchstart"&&(m.current=!0);const M=O?null:C.current,D=M?M.getBoundingClientRect():{width:0,height:0,left:0,top:0};let P,j,F;if(L||d===void 0||d.clientX===0&&d.clientY===0||!d.clientX&&!d.touches)P=Math.round(D.width/2),j=Math.round(D.height/2);else{const{clientX:W,clientY:k}=d.touches&&d.touches.length>0?d.touches[0]:d;P=Math.round(W-D.left),j=Math.round(k-D.top)}if(L)F=Math.sqrt((2*D.width**2+D.height**2)/3),F%2===0&&(F+=1);else{const W=Math.max(Math.abs((M?M.clientWidth:0)-P),P)*2+2,k=Math.max(Math.abs((M?M.clientHeight:0)-j),j)*2+2;F=Math.sqrt(W**2+k**2)}d!=null&&d.touches?h.current===null&&(h.current=()=>{_({pulsate:y,rippleX:P,rippleY:j,rippleSize:F,cb:x})},v.start(yt,()=>{h.current&&(h.current(),h.current=null)})):_({pulsate:y,rippleX:P,rippleY:j,rippleSize:F,cb:x})},[n,_,v]),S=l.useCallback(()=>{V({},{pulsate:!0})},[V]),I=l.useCallback((d,R)=>{if(v.clear(),(d==null?void 0:d.type)==="touchend"&&h.current){h.current(),h.current=null,v.start(0,()=>{I(d,R)});return}h.current=null,p(x=>x.length>0?x.slice(1):x),g.current=R},[v]);return l.useImperativeHandle(o,()=>({pulsate:S,start:V,stop:I}),[S,V,I]),B.jsx(zt,b({className:z(E.root,i.root,r),ref:C},u,{children:B.jsx(ue,{component:null,exit:!0,children:c})}))});function Bt(e){return Ce("MuiButtonBase",e)}const $t=ee("MuiButtonBase",["root","disabled","focusVisible"]),It=["action","centerRipple","children","className","component","disabled","disableRipple","disableTouchRipple","focusRipple","focusVisibleClassName","LinkComponent","onBlur","onClick","onContextMenu","onDragLeave","onFocus","onFocusVisible","onKeyDown","onKeyUp","onMouseDown","onMouseLeave","onMouseUp","onTouchEnd","onTouchMove","onTouchStart","tabIndex","TouchRippleProps","touchRippleRef","type"],Pt=e=>{const{disabled:t,focusVisible:o,focusVisibleClassName:a,classes:n}=e,r=Re({root:["root",t&&"disabled",o&&"focusVisible"]},Bt,n);return o&&a&&(r.root+=` ${a}`),r},kt=H("button",{name:"MuiButtonBase",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},[`&.${$t.disabled}`]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),Nt=l.forwardRef(function(t,o){const a=se({props:t,name:"MuiButtonBase"}),{action:n,centerRipple:i=!1,children:r,className:u,component:c="button",disabled:p=!1,disableRipple:f=!1,disableTouchRipple:g=!1,focusRipple:m=!1,LinkComponent:v="a",onBlur:h,onClick:C,onContextMenu:_,onDragLeave:V,onFocus:S,onFocusVisible:I,onKeyDown:d,onKeyUp:R,onMouseDown:x,onMouseLeave:y,onMouseUp:L,onTouchEnd:O,onTouchMove:M,onTouchStart:D,tabIndex:P=0,TouchRippleProps:j,touchRippleRef:F,type:W}=a,k=Y(a,It),K=l.useRef(null),$=l.useRef(null),Ee=be($,F),{isFocusVisibleRef:pe,onFocus:Te,onBlur:Be,ref:$e}=we(),[U,q]=l.useState(!1);p&&U&&q(!1),l.useImperativeHandle(n,()=>({focusVisible:()=>{q(!0),K.current.focus()}}),[]);const[oe,Ie]=l.useState(!1);l.useEffect(()=>{Ie(!0)},[]);const Pe=oe&&!f&&!p;l.useEffect(()=>{U&&m&&!f&&oe&&$.current.pulsate()},[f,m,U,oe]);function N(s,fe,Ke=g){return Z(he=>(fe&&fe(he),!Ke&&$.current&&$.current[s](he),!0))}const ke=N("start",x),Ne=N("stop",_),Ve=N("stop",V),Se=N("stop",L),Le=N("stop",s=>{U&&s.preventDefault(),y&&y(s)}),De=N("start",D),je=N("stop",O),Fe=N("stop",M),_e=N("stop",s=>{Be(s),pe.current===!1&&q(!1),h&&h(s)},!1),Oe=Z(s=>{K.current||(K.current=s.currentTarget),Te(s),pe.current===!0&&(q(!0),I&&I(s)),S&&S(s)}),ne=()=>{const s=K.current;return c&&c!=="button"&&!(s.tagName==="A"&&s.href)},ae=l.useRef(!1),We=Z(s=>{m&&!ae.current&&U&&$.current&&s.key===" "&&(ae.current=!0,$.current.stop(s,()=>{$.current.start(s)})),s.target===s.currentTarget&&ne()&&s.key===" "&&s.preventDefault(),d&&d(s),s.target===s.currentTarget&&ne()&&s.key==="Enter"&&!p&&(s.preventDefault(),C&&C(s))}),Ue=Z(s=>{m&&s.key===" "&&$.current&&U&&!s.defaultPrevented&&(ae.current=!1,$.current.stop(s,()=>{$.current.pulsate(s)})),R&&R(s),C&&s.target===s.currentTarget&&ne()&&s.key===" "&&!s.defaultPrevented&&C(s)});let J=c;J==="button"&&(k.href||k.to)&&(J=v);const G={};J==="button"?(G.type=W===void 0?"button":W,G.disabled=p):(!k.href&&!k.to&&(G.role="button"),p&&(G["aria-disabled"]=p));const Ae=be(o,$e,K),de=b({},a,{centerRipple:i,component:c,disabled:p,disableRipple:f,disableTouchRipple:g,focusRipple:m,tabIndex:P,focusVisible:U}),He=Pt(de);return B.jsxs(kt,b({as:J,className:z(He.root,u),ownerState:de,onBlur:_e,onClick:C,onContextMenu:Ne,onFocus:Oe,onKeyDown:We,onKeyUp:Ue,onMouseDown:ke,onMouseLeave:Le,onMouseUp:Se,onDragLeave:Ve,onTouchEnd:je,onTouchMove:Fe,onTouchStart:De,ref:Ae,tabIndex:p?-1:P,type:W},G,k,{children:[r,Pe?B.jsx(Tt,b({ref:Ee,center:i},j)):null]}))}),Vt=ee("MuiBox",["root"]),St=tt(),Gt=ut({themeId:et,defaultTheme:St,defaultClassName:Vt.root,generateClassName:Qe.generate});function Lt(e){return Ce("MuiButton",e)}const Q=ee("MuiButton",["root","text","textInherit","textPrimary","textSecondary","textSuccess","textError","textInfo","textWarning","outlined","outlinedInherit","outlinedPrimary","outlinedSecondary","outlinedSuccess","outlinedError","outlinedInfo","outlinedWarning","contained","containedInherit","containedPrimary","containedSecondary","containedSuccess","containedError","containedInfo","containedWarning","disableElevation","focusVisible","disabled","colorInherit","colorPrimary","colorSecondary","colorSuccess","colorError","colorInfo","colorWarning","textSizeSmall","textSizeMedium","textSizeLarge","outlinedSizeSmall","outlinedSizeMedium","outlinedSizeLarge","containedSizeSmall","containedSizeMedium","containedSizeLarge","sizeMedium","sizeSmall","sizeLarge","fullWidth","startIcon","endIcon","icon","iconSizeSmall","iconSizeMedium","iconSizeLarge"]),Dt=l.createContext({}),jt=l.createContext(void 0),Ft=["children","color","component","className","disabled","disableElevation","disableFocusRipple","endIcon","focusVisibleClassName","fullWidth","size","startIcon","type","variant"],_t=e=>{const{color:t,disableElevation:o,fullWidth:a,size:n,variant:i,classes:r}=e,u={root:["root",i,`${i}${T(t)}`,`size${T(n)}`,`${i}Size${T(n)}`,`color${T(t)}`,o&&"disableElevation",a&&"fullWidth"],label:["label"],startIcon:["icon","startIcon",`iconSize${T(n)}`],endIcon:["icon","endIcon",`iconSize${T(n)}`]},c=Re(u,Lt,r);return b({},r,c)},ze=e=>b({},e.size==="small"&&{"& > *:nth-of-type(1)":{fontSize:18}},e.size==="medium"&&{"& > *:nth-of-type(1)":{fontSize:20}},e.size==="large"&&{"& > *:nth-of-type(1)":{fontSize:22}}),Ot=H(Nt,{shouldForwardProp:e=>nt(e)||e==="classes",name:"MuiButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.root,t[o.variant],t[`${o.variant}${T(o.color)}`],t[`size${T(o.size)}`],t[`${o.variant}Size${T(o.size)}`],o.color==="inherit"&&t.colorInherit,o.disableElevation&&t.disableElevation,o.fullWidth&&t.fullWidth]}})(({theme:e,ownerState:t})=>{var o,a;const n=e.palette.mode==="light"?e.palette.grey[300]:e.palette.grey[800],i=e.palette.mode==="light"?e.palette.grey.A100:e.palette.grey[700];return b({},e.typography.button,{minWidth:64,padding:"6px 16px",borderRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create(["background-color","box-shadow","border-color","color"],{duration:e.transitions.duration.short}),"&:hover":b({textDecoration:"none",backgroundColor:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / ${e.vars.palette.action.hoverOpacity})`:w.alpha(e.palette.text.primary,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},t.variant==="text"&&t.color!=="inherit"&&{backgroundColor:e.vars?`rgba(${e.vars.palette[t.color].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:w.alpha(e.palette[t.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},t.variant==="outlined"&&t.color!=="inherit"&&{border:`1px solid ${(e.vars||e).palette[t.color].main}`,backgroundColor:e.vars?`rgba(${e.vars.palette[t.color].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:w.alpha(e.palette[t.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},t.variant==="contained"&&{backgroundColor:e.vars?e.vars.palette.Button.inheritContainedHoverBg:i,boxShadow:(e.vars||e).shadows[4],"@media (hover: none)":{boxShadow:(e.vars||e).shadows[2],backgroundColor:(e.vars||e).palette.grey[300]}},t.variant==="contained"&&t.color!=="inherit"&&{backgroundColor:(e.vars||e).palette[t.color].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t.color].main}}),"&:active":b({},t.variant==="contained"&&{boxShadow:(e.vars||e).shadows[8]}),[`&.${Q.focusVisible}`]:b({},t.variant==="contained"&&{boxShadow:(e.vars||e).shadows[6]}),[`&.${Q.disabled}`]:b({color:(e.vars||e).palette.action.disabled},t.variant==="outlined"&&{border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`},t.variant==="contained"&&{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground})},t.variant==="text"&&{padding:"6px 8px"},t.variant==="text"&&t.color!=="inherit"&&{color:(e.vars||e).palette[t.color].main},t.variant==="outlined"&&{padding:"5px 15px",border:"1px solid currentColor"},t.variant==="outlined"&&t.color!=="inherit"&&{color:(e.vars||e).palette[t.color].main,border:e.vars?`1px solid rgba(${e.vars.palette[t.color].mainChannel} / 0.5)`:`1px solid ${w.alpha(e.palette[t.color].main,.5)}`},t.variant==="contained"&&{color:e.vars?e.vars.palette.text.primary:(o=(a=e.palette).getContrastText)==null?void 0:o.call(a,e.palette.grey[300]),backgroundColor:e.vars?e.vars.palette.Button.inheritContainedBg:n,boxShadow:(e.vars||e).shadows[2]},t.variant==="contained"&&t.color!=="inherit"&&{color:(e.vars||e).palette[t.color].contrastText,backgroundColor:(e.vars||e).palette[t.color].main},t.color==="inherit"&&{color:"inherit",borderColor:"currentColor"},t.size==="small"&&t.variant==="text"&&{padding:"4px 5px",fontSize:e.typography.pxToRem(13)},t.size==="large"&&t.variant==="text"&&{padding:"8px 11px",fontSize:e.typography.pxToRem(15)},t.size==="small"&&t.variant==="outlined"&&{padding:"3px 9px",fontSize:e.typography.pxToRem(13)},t.size==="large"&&t.variant==="outlined"&&{padding:"7px 21px",fontSize:e.typography.pxToRem(15)},t.size==="small"&&t.variant==="contained"&&{padding:"4px 10px",fontSize:e.typography.pxToRem(13)},t.size==="large"&&t.variant==="contained"&&{padding:"8px 22px",fontSize:e.typography.pxToRem(15)},t.fullWidth&&{width:"100%"})},({ownerState:e})=>e.disableElevation&&{boxShadow:"none","&:hover":{boxShadow:"none"},[`&.${Q.focusVisible}`]:{boxShadow:"none"},"&:active":{boxShadow:"none"},[`&.${Q.disabled}`]:{boxShadow:"none"}}),Wt=H("span",{name:"MuiButton",slot:"StartIcon",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.startIcon,t[`iconSize${T(o.size)}`]]}})(({ownerState:e})=>b({display:"inherit",marginRight:8,marginLeft:-4},e.size==="small"&&{marginLeft:-2},ze(e))),Ut=H("span",{name:"MuiButton",slot:"EndIcon",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.endIcon,t[`iconSize${T(o.size)}`]]}})(({ownerState:e})=>b({display:"inherit",marginRight:-4,marginLeft:8},e.size==="small"&&{marginRight:-2},ze(e))),Xt=l.forwardRef(function(t,o){const a=l.useContext(Dt),n=l.useContext(jt),i=ot(a,t),r=se({props:i,name:"MuiButton"}),{children:u,color:c="primary",component:p="button",className:f,disabled:g=!1,disableElevation:m=!1,disableFocusRipple:v=!1,endIcon:h,focusVisibleClassName:C,fullWidth:_=!1,size:V="medium",startIcon:S,type:I,variant:d="text"}=r,R=Y(r,Ft),x=b({},r,{color:c,component:p,disabled:g,disableElevation:m,disableFocusRipple:v,fullWidth:_,size:V,type:I,variant:d}),y=_t(x),L=S&&B.jsx(Wt,{className:y.startIcon,ownerState:x,children:S}),O=h&&B.jsx(Ut,{className:y.endIcon,ownerState:x,children:h}),M=n||"";return B.jsxs(Ot,b({ownerState:x,className:z(a.className,y.root,f,M),component:p,disabled:g,focusRipple:!v,focusVisibleClassName:z(y.focusVisible,C),ref:o,type:I},R,{classes:y,children:[L,u,O]}))});export{Nt as B,ge as T,pt as _,it as a,Xt as b,Gt as c,Dt as d,jt as e,st as u};
@@ -1 +1 @@
1
- import{a as ee,r as x,j as s,L as A}from"./react-CQ5qhqs6.js";import{q as se,s as te,m as P,c as ae,u as re,v as ne,w as ce,t as R,C as ie,e as I,x as Q,A as le,y as F,z as B,D as q,E as oe,F as de,G as D,H as ue,I as he,h as me,J as pe,K as fe}from"./index-DvAy35iS.js";import{b as K}from"./buy-KvjWmHql.js";import{g as _e,b as ye,w as ge,S as be,G as xe}from"./buy-gasless-DuWzXmm_.js";import"./ethers-DXxh-eEm.js";import"./trade-encoding-CmkOOQWS.js";import"./index-CUDTJiCv.js";function ve(t){return Math.ceil(t/10)}async function je(t,r,d){var C;const g=[],a=[],v=[];for(const n of t)try{const m=await d(n);if(!m){a.push(n);continue}if(se(m,r)){v.push(n);continue}const c=te((C=m.received[0])==null?void 0:C.amount);if(!Number.isFinite(c)||c<=0){a.push(n);continue}g.push({item:n,trade:m,usdCents:c,priceCredits:ve(c)})}catch{a.push(n)}const j=g.reduce((n,m)=>n+m.priceCredits,0),p=a.length>0||v.length>0||g.some(n=>n.priceCredits!==n.item.priceCredits);return{buyable:g,unavailable:a,own:v,liveTotalCredits:j,orderChanged:p}}function O(t){const r=t,d=(r.message??"").toLowerCase();return r.code===4001||d.includes("reject")||d.includes("denied")||d.includes("cancel")?"You cancelled the request.":d.includes("insufficient")?`You don't have enough ${Q.name} — get more first.`:d.includes("no active listing")||d.includes("your own listing")?r.message:"Couldn't complete checkout — please try again."}const Ce=12e4;function Ne(t){const r=[];return t.unavailable.length&&r.push(`${t.unavailable.length} no longer available`),t.own.length&&r.push(`${t.own.length} you can't buy (your own listing)`),`Removed ${r.join(" and ")} from your cart.`}function Ie(){const t=P(e=>e.items),r=P(e=>e.remove),d=P(e=>e.clear),g=P(e=>e.setFittingOpen),{session:a}=ae(),v=t.some(e=>e.category!=="emote"),{data:j}=re({queryKey:["upsell-listings"],queryFn:()=>fe({first:40}),staleTime:6e4}),{data:p}=ne(a),C=ce(),n=ee(),[m,c]=x.useState(null),[z,f]=x.useState(null),[G,S]=x.useState(null),[N,E]=x.useState(!1),[u,w]=x.useState(null),L=x.useRef(0),T=t.reduce((e,i)=>e+i.priceCredits,0),H=u?u.liveTotalCredits:T,V=new Set(t.map(e=>e.id)),M=((j==null?void 0:j.items)??[]).filter(e=>!V.has(e.id)).slice(0,6),J=new Map(u==null?void 0:u.buyable.map(e=>[e.item.id,e])),X=e=>e.tradeId?me(e.tradeId):pe(e.contractAddress,e.itemId??"");function U(e){e(),w(null),S(null),f(null)}async function W(e){if(!a||e.length===0)return;const i=e.map(l=>({...l.item,priceCredits:l.priceCredits})),y=[];let k="authorize",$=!1;try{c("Preparing your order…");const l=[];for(const o of e){const{credit:b,maxCreditedValue:_}=await oe(a.identity,o.usdCents,o.item.tradeId);y.push(b.id),l.push({trade:o.trade,credits:[b],maxCreditedValue:_})}c("Confirming your purchase…"),k="submit";let h=[];if(_e())try{h=await ye({purchases:l,buyer:a.address,signer:a.signer});const b=(await Promise.allSettled(h.map(_=>ge(_)))).flatMap(_=>_.status==="rejected"?[_.reason]:[]);if(b.length&&!b.some(_=>_ instanceof be))throw b[0];$=!0}catch(o){if(!(o instanceof xe))throw o;h=await K({purchases:l,buyer:a.address,signer:a.signer})}else h=await K({purchases:l,buyer:a.address,signer:a.signer});e.forEach(o=>r(o.item.id)),w(null),c("Purchased! 🎉"),F("Shop Completed Purchase",{...de(i),payment_type:"credits",no_crypto_step:$,transaction_hash:h[0]??null}),C.invalidateQueries({queryKey:["usd-balance"]}),n("/success",{state:{items:i,txHash:h[0]}})}catch(l){if(D(l)||q(l,{flow:"cart_checkout",step:k,cart_size:e.length}),F(D(l)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:k,error_code:ue(l),value_usd:B(i.reduce((h,o)=>h+o.priceCredits,0)),cart_size:e.length}),y.length){try{await he(a.identity,y)}catch(h){q(h,{flow:"cart_checkout",step:"release"})}C.invalidateQueries({queryKey:["usd-balance"]})}f(O(l)),c(null)}}async function Y(){if(!a){f("Sign in to check out.");return}f(null),S(null),E(!0),F("Shop Started Checkout",{cart_size:t.length,cart_value_credits:T,cart_value_usd:B(T),has_sufficient_credits:((p==null?void 0:p.credits)??0)>=T});try{c("Reviewing your cart…");const e=await je(t,a.address,X),i=[...e.unavailable,...e.own];if(i.length&&(i.forEach(y=>r(y.id)),S(Ne(e))),e.buyable.length===0){f("None of these items are available to buy right now."),w(null),c(null);return}if(e.orderChanged){w(e),L.current=Date.now(),c(null);return}await W(e.buyable)}catch(e){q(e,{flow:"cart_checkout",step:"review",cart_size:t.length}),f(O(e)),c(null)}finally{E(!1)}}async function Z(){if(u){if(!a){f("Sign in to check out.");return}if(Date.now()-L.current>Ce){w(null),S(null),await Y();return}f(null),E(!0);try{await W(u.buyable)}finally{E(!1)}}}return t.length===0?s.jsxs("div",{className:"cart cart--empty",children:[s.jsx("span",{className:"ico ico-cart cart-empty__ico","aria-hidden":!0}),s.jsx("p",{className:"cart-empty__title",children:R("cart.empty.title")}),s.jsx("p",{className:"muted",children:R("cart.empty.body")}),s.jsx(A,{className:"btn btn--purple",to:"/assets",children:R("cart.empty.cta")})]}):s.jsxs("div",{className:"cart",children:[s.jsxs("h1",{children:["Cart (",t.length,")"]}),s.jsxs("div",{className:"cart__body",children:[s.jsxs("div",{className:"cart__main",children:[s.jsx("div",{className:"cart__list",children:t.map(e=>{const i=J.get(e.id),y=i?i.priceCredits:e.priceCredits,k=!!i&&i.priceCredits!==e.priceCredits;return s.jsxs("div",{className:"cart__row",children:[s.jsx("div",{className:"cart__thumb",children:e.thumbnail?s.jsx("img",{src:e.thumbnail,alt:e.name}):null}),s.jsxs("div",{className:"cart__info",children:[s.jsx("div",{className:"cart__name",children:e.name}),e.creator?s.jsx(ie,{address:e.creator,className:"cart__creator",linkToProfile:!0}):null]}),s.jsxs("div",{className:"cart__price",children:[s.jsx(I,{className:"ccy-mark"})," ",y,k?s.jsx("span",{className:"muted",style:{marginLeft:6,textDecoration:"line-through"},children:e.priceCredits}):null]}),s.jsx("button",{className:"cart__remove",onClick:()=>U(()=>r(e.id)),disabled:N,"aria-label":`Remove ${e.name}`,title:"Remove",children:s.jsx("span",{className:"ico ico-trash","aria-hidden":!0})})]},e.id)})}),s.jsxs("div",{className:"cart__utils",children:[s.jsx("button",{className:"link",onClick:()=>U(d),disabled:N,children:"Clear cart"}),null]})]}),s.jsxs("aside",{className:"cart__summary",children:[s.jsx("h2",{className:"cart__summary-title",children:"Order summary"}),s.jsxs("div",{className:"cart__total",children:[s.jsxs("div",{className:"cart__total-line",children:[s.jsx("span",{children:"Total"}),s.jsxs("strong",{children:[s.jsx(I,{className:"ccy-mark"})," ",H]})]}),a?s.jsxs("div",{className:"muted cart__balance",children:["Your balance: ",s.jsx(I,{className:"ccy-mark"})," ",(p==null?void 0:p.credits)??0]}):null]}),s.jsxs("div",{className:"cart__actions",children:[s.jsx("button",{className:"btn btn--purple cart__checkout",onClick:u?Z:Y,disabled:N,children:N?"Working…":u?"Confirm purchase":"Checkout"}),s.jsxs(A,{className:"btn btn--ghost",to:"/credits",children:["Get ",Q.name]}),v?s.jsx("button",{className:"btn btn--ghost",onClick:()=>g(!0),disabled:N,children:"Try on outfit"}):null]}),u?s.jsx("p",{className:"muted cart__msg",children:"Prices or availability changed since you added these — review the updated total and confirm to buy."}):null,G?s.jsx("p",{className:"muted cart__msg",children:G}):null,m?s.jsx("p",{className:"muted cart__msg",children:m}):null,z?s.jsx("p",{className:"error cart__msg",children:z}):null]})]}),M.length>0?s.jsxs("section",{className:"row cart-upsell",children:[s.jsx("div",{className:"row__head",children:s.jsx("h2",{className:"row__title",children:"You might also like"})}),s.jsx("div",{className:"row__track",children:M.map(e=>s.jsx(le,{item:e},e.id))})]}):null]})}export{Ie as Cart};
1
+ import{a as ee,r as x,j as s,L as A}from"./react-CQ5qhqs6.js";import{q as se,s as te,m as P,c as ae,u as re,v as ne,w as ce,t as R,C as ie,e as I,x as Q,A as le,y as F,z as B,D as q,E as oe,F as de,G as D,H as ue,I as he,h as me,J as pe,K as fe}from"./index-BW6d6BbH.js";import{b as K}from"./buy-BXsYo32e.js";import{g as _e,b as ye,w as ge,S as be,G as xe}from"./buy-gasless-CB45oj-8.js";import"./ethers-DXxh-eEm.js";import"./trade-encoding-CgWHvMsc.js";import"./index-CuI-U7nJ.js";function ve(t){return Math.ceil(t/10)}async function je(t,r,d){var C;const g=[],a=[],v=[];for(const n of t)try{const m=await d(n);if(!m){a.push(n);continue}if(se(m,r)){v.push(n);continue}const c=te((C=m.received[0])==null?void 0:C.amount);if(!Number.isFinite(c)||c<=0){a.push(n);continue}g.push({item:n,trade:m,usdCents:c,priceCredits:ve(c)})}catch{a.push(n)}const j=g.reduce((n,m)=>n+m.priceCredits,0),p=a.length>0||v.length>0||g.some(n=>n.priceCredits!==n.item.priceCredits);return{buyable:g,unavailable:a,own:v,liveTotalCredits:j,orderChanged:p}}function O(t){const r=t,d=(r.message??"").toLowerCase();return r.code===4001||d.includes("reject")||d.includes("denied")||d.includes("cancel")?"You cancelled the request.":d.includes("insufficient")?`You don't have enough ${Q.name} — get more first.`:d.includes("no active listing")||d.includes("your own listing")?r.message:"Couldn't complete checkout — please try again."}const Ce=12e4;function Ne(t){const r=[];return t.unavailable.length&&r.push(`${t.unavailable.length} no longer available`),t.own.length&&r.push(`${t.own.length} you can't buy (your own listing)`),`Removed ${r.join(" and ")} from your cart.`}function Ie(){const t=P(e=>e.items),r=P(e=>e.remove),d=P(e=>e.clear),g=P(e=>e.setFittingOpen),{session:a}=ae(),v=t.some(e=>e.category!=="emote"),{data:j}=re({queryKey:["upsell-listings"],queryFn:()=>fe({first:40}),staleTime:6e4}),{data:p}=ne(a),C=ce(),n=ee(),[m,c]=x.useState(null),[z,f]=x.useState(null),[G,S]=x.useState(null),[N,E]=x.useState(!1),[u,w]=x.useState(null),L=x.useRef(0),T=t.reduce((e,i)=>e+i.priceCredits,0),H=u?u.liveTotalCredits:T,V=new Set(t.map(e=>e.id)),M=((j==null?void 0:j.items)??[]).filter(e=>!V.has(e.id)).slice(0,6),J=new Map(u==null?void 0:u.buyable.map(e=>[e.item.id,e])),X=e=>e.tradeId?me(e.tradeId):pe(e.contractAddress,e.itemId??"");function U(e){e(),w(null),S(null),f(null)}async function W(e){if(!a||e.length===0)return;const i=e.map(l=>({...l.item,priceCredits:l.priceCredits})),y=[];let k="authorize",$=!1;try{c("Preparing your order…");const l=[];for(const o of e){const{credit:b,maxCreditedValue:_}=await oe(a.identity,o.usdCents,o.item.tradeId);y.push(b.id),l.push({trade:o.trade,credits:[b],maxCreditedValue:_})}c("Confirming your purchase…"),k="submit";let h=[];if(_e())try{h=await ye({purchases:l,buyer:a.address,signer:a.signer});const b=(await Promise.allSettled(h.map(_=>ge(_)))).flatMap(_=>_.status==="rejected"?[_.reason]:[]);if(b.length&&!b.some(_=>_ instanceof be))throw b[0];$=!0}catch(o){if(!(o instanceof xe))throw o;h=await K({purchases:l,buyer:a.address,signer:a.signer})}else h=await K({purchases:l,buyer:a.address,signer:a.signer});e.forEach(o=>r(o.item.id)),w(null),c("Purchased! 🎉"),F("Shop Completed Purchase",{...de(i),payment_type:"credits",no_crypto_step:$,transaction_hash:h[0]??null}),C.invalidateQueries({queryKey:["usd-balance"]}),n("/success",{state:{items:i,txHash:h[0]}})}catch(l){if(D(l)||q(l,{flow:"cart_checkout",step:k,cart_size:e.length}),F(D(l)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:k,error_code:ue(l),value_usd:B(i.reduce((h,o)=>h+o.priceCredits,0)),cart_size:e.length}),y.length){try{await he(a.identity,y)}catch(h){q(h,{flow:"cart_checkout",step:"release"})}C.invalidateQueries({queryKey:["usd-balance"]})}f(O(l)),c(null)}}async function Y(){if(!a){f("Sign in to check out.");return}f(null),S(null),E(!0),F("Shop Started Checkout",{cart_size:t.length,cart_value_credits:T,cart_value_usd:B(T),has_sufficient_credits:((p==null?void 0:p.credits)??0)>=T});try{c("Reviewing your cart…");const e=await je(t,a.address,X),i=[...e.unavailable,...e.own];if(i.length&&(i.forEach(y=>r(y.id)),S(Ne(e))),e.buyable.length===0){f("None of these items are available to buy right now."),w(null),c(null);return}if(e.orderChanged){w(e),L.current=Date.now(),c(null);return}await W(e.buyable)}catch(e){q(e,{flow:"cart_checkout",step:"review",cart_size:t.length}),f(O(e)),c(null)}finally{E(!1)}}async function Z(){if(u){if(!a){f("Sign in to check out.");return}if(Date.now()-L.current>Ce){w(null),S(null),await Y();return}f(null),E(!0);try{await W(u.buyable)}finally{E(!1)}}}return t.length===0?s.jsxs("div",{className:"cart cart--empty",children:[s.jsx("span",{className:"ico ico-cart cart-empty__ico","aria-hidden":!0}),s.jsx("p",{className:"cart-empty__title",children:R("cart.empty.title")}),s.jsx("p",{className:"muted",children:R("cart.empty.body")}),s.jsx(A,{className:"btn btn--purple",to:"/assets",children:R("cart.empty.cta")})]}):s.jsxs("div",{className:"cart",children:[s.jsxs("h1",{children:["Cart (",t.length,")"]}),s.jsxs("div",{className:"cart__body",children:[s.jsxs("div",{className:"cart__main",children:[s.jsx("div",{className:"cart__list",children:t.map(e=>{const i=J.get(e.id),y=i?i.priceCredits:e.priceCredits,k=!!i&&i.priceCredits!==e.priceCredits;return s.jsxs("div",{className:"cart__row",children:[s.jsx("div",{className:"cart__thumb",children:e.thumbnail?s.jsx("img",{src:e.thumbnail,alt:e.name}):null}),s.jsxs("div",{className:"cart__info",children:[s.jsx("div",{className:"cart__name",children:e.name}),e.creator?s.jsx(ie,{address:e.creator,className:"cart__creator",linkToProfile:!0}):null]}),s.jsxs("div",{className:"cart__price",children:[s.jsx(I,{className:"ccy-mark"})," ",y,k?s.jsx("span",{className:"muted",style:{marginLeft:6,textDecoration:"line-through"},children:e.priceCredits}):null]}),s.jsx("button",{className:"cart__remove",onClick:()=>U(()=>r(e.id)),disabled:N,"aria-label":`Remove ${e.name}`,title:"Remove",children:s.jsx("span",{className:"ico ico-trash","aria-hidden":!0})})]},e.id)})}),s.jsxs("div",{className:"cart__utils",children:[s.jsx("button",{className:"link",onClick:()=>U(d),disabled:N,children:"Clear cart"}),null]})]}),s.jsxs("aside",{className:"cart__summary",children:[s.jsx("h2",{className:"cart__summary-title",children:"Order summary"}),s.jsxs("div",{className:"cart__total",children:[s.jsxs("div",{className:"cart__total-line",children:[s.jsx("span",{children:"Total"}),s.jsxs("strong",{children:[s.jsx(I,{className:"ccy-mark"})," ",H]})]}),a?s.jsxs("div",{className:"muted cart__balance",children:["Your balance: ",s.jsx(I,{className:"ccy-mark"})," ",(p==null?void 0:p.credits)??0]}):null]}),s.jsxs("div",{className:"cart__actions",children:[s.jsx("button",{className:"btn btn--purple cart__checkout",onClick:u?Z:Y,disabled:N,children:N?"Working…":u?"Confirm purchase":"Checkout"}),s.jsxs(A,{className:"btn btn--ghost",to:"/credits",children:["Get ",Q.name]}),v?s.jsx("button",{className:"btn btn--ghost",onClick:()=>g(!0),disabled:N,children:"Try on outfit"}):null]}),u?s.jsx("p",{className:"muted cart__msg",children:"Prices or availability changed since you added these — review the updated total and confirm to buy."}):null,G?s.jsx("p",{className:"muted cart__msg",children:G}):null,m?s.jsx("p",{className:"muted cart__msg",children:m}):null,z?s.jsx("p",{className:"error cart__msg",children:z}):null]})]}),M.length>0?s.jsxs("section",{className:"row cart-upsell",children:[s.jsx("div",{className:"row__head",children:s.jsx("h2",{className:"row__title",children:"You might also like"})}),s.jsx("div",{className:"row__track",children:M.map(e=>s.jsx(le,{item:e},e.id))})]}):null]})}export{Ie as Cart};
@@ -1,4 +1,4 @@
1
- import{R as N,S as U,T as w,U as z,V as o,X as E,Y as c,Z as I,$ as g,a0 as D,a1 as R}from"./index-DvAy35iS.js";import{r as F,j as v}from"./react-CQ5qhqs6.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{S as N,T as U,U as w,V as z,X as o,Y as E,Z as c,$ as I,a0 as g,a1 as D,a2 as M}from"./index-BW6d6BbH.js";import{r as F,j as v}from"./react-CQ5qhqs6.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=M(P||(P=l`
2
2
  0% {
3
3
  transform: rotate(0deg);
4
4
  }
@@ -6,7 +6,7 @@ import{R as N,S as U,T as w,U as z,V as o,X as E,Y as c,Z as I,$ as g,a0 as D,a1
6
6
  100% {
7
7
  transform: rotate(360deg);
8
8
  }
9
- `)),Z=R(S||(S=l`
9
+ `)),Z=M(S||(S=l`
10
10
  0% {
11
11
  stroke-dasharray: 1px, 200px;
12
12
  stroke-dashoffset: 0;
@@ -25,4 +25,4 @@ import{R as N,S as U,T as w,U as z,V as o,X as E,Y as c,Z as I,$ as g,a0 as D,a1
25
25
  animation: ${0} 1.4s linear infinite;
26
26
  `),W)),L=g("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(r,e)=>e.svg})({display:"block"}),T=g("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(r,e)=>{const{ownerState:s}=r;return[e.circle,e[`circle${c(s.variant)}`],s.disableShrink&&e.circleDisableShrink]}})(({ownerState:r,theme:e})=>o({stroke:"currentColor"},r.variant==="determinate"&&{transition:e.transitions.create("stroke-dashoffset")},r.variant==="indeterminate"&&{strokeDasharray:"80px, 200px",strokeDashoffset:0}),({ownerState:r})=>r.variant==="indeterminate"&&!r.disableShrink&&D($||($=l`
27
27
  animation: ${0} 1.4s ease-in-out infinite;
28
- `),Z)),q=F.forwardRef(function(e,s){const a=w({props:e,name:"MuiCircularProgress"}),{className:d,color:u="primary",disableShrink:M=!1,size:m=40,style:_,thickness:i=3.6,value:p=0,variant:k="indeterminate"}=a,j=z(a,V),n=o({},a,{color:u,disableShrink:M,size:m,thickness:i,value:p,variant:k}),f=B(n),h={},x={},y={};if(k==="determinate"){const C=2*Math.PI*((t-i)/2);h.strokeDasharray=C.toFixed(3),y["aria-valuenow"]=Math.round(p),h.strokeDashoffset=`${((100-p)/100*C).toFixed(3)}px`,x.transform="rotate(-90deg)"}return v.jsx(G,o({className:E(f.root,d),style:o({width:m,height:m},x,_),ownerState:n,ref:s,role:"progressbar"},y,j,{children:v.jsx(L,{className:f.svg,ownerState:n,viewBox:`${t/2} ${t/2} ${t} ${t}`,children:v.jsx(T,{className:f.circle,style:h,ownerState:n,cx:t,cy:t,r:(t-i)/2,fill:"none",strokeWidth:i})})}))});export{q as C};
28
+ `),Z)),q=F.forwardRef(function(e,s){const a=w({props:e,name:"MuiCircularProgress"}),{className:d,color:u="primary",disableShrink:R=!1,size:m=40,style:_,thickness:i=3.6,value:p=0,variant:k="indeterminate"}=a,j=z(a,V),n=o({},a,{color:u,disableShrink:R,size:m,thickness:i,value:p,variant:k}),f=B(n),h={},x={},y={};if(k==="determinate"){const C=2*Math.PI*((t-i)/2);h.strokeDasharray=C.toFixed(3),y["aria-valuenow"]=Math.round(p),h.strokeDashoffset=`${((100-p)/100*C).toFixed(3)}px`,x.transform="rotate(-90deg)"}return v.jsx(G,o({className:E(f.root,d),style:o({width:m,height:m},x,_),ownerState:n,ref:s,role:"progressbar"},y,j,{children:v.jsx(L,{className:f.svg,ownerState:n,viewBox:`${t/2} ${t/2} ${t} ${t}`,children:v.jsx(T,{className:f.circle,style:h,ownerState:n,cx:t,cy:t,r:(t-i)/2,fill:"none",strokeWidth:i})})}))});export{q as C};
@@ -1 +1 @@
1
- import{u as j,a as _,j as e}from"./react-CQ5qhqs6.js";import{u as N,t as u,C as f,A as b,f as C,a as A}from"./index-DvAy35iS.js";import{A as v}from"./collection-ae9B_wBl.js";import{S as h}from"./SkeletonCards-DSpqiDzZ.js";import{L as y}from"./LoadMore-7qZApSeo.js";import{u as L}from"./useInfiniteGrid-DBBDC6CU.js";import"./ethers-DXxh-eEm.js";const P=48;function B(){var d;const{contractAddress:a}=j(),p=_(),{items:t,total:o,isLoading:l,error:r,hasNextPage:g,isFetchingNextPage:n,fetchNextPage:x}=L(["collection-page",a],c=>C(a,{first:P,skip:c}),{enabled:!!a}),{data:s}=N({queryKey:["collection-meta",a],queryFn:()=>A(a),enabled:!!a,staleTime:5*6e4}),i=(s==null?void 0:s.name)||u("collection.fallbackTitle"),m=(s==null?void 0:s.creator)||((d=t[0])==null?void 0:d.creator);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:()=>p("/assets"),children:u("collection.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:i})]}),e.jsxs("header",{className:"collection-page__head",children:[e.jsx("h1",{className:"collection-page__title",children:i}),m?e.jsx(f,{address:m,className:"collection-page__creator"}):null,e.jsx("span",{className:"muted collection-page__count",children:l?"…":`${o.toLocaleString()} item${o===1?"":"s"}`})]}),!l&&t.length>0?e.jsx(v,{items:t,source:"collection"}):null,r?e.jsx("p",{className:"error",children:"Couldn’t load this collection — please try again."}):null,e.jsx("div",{className:"grid",children:l?e.jsx(h,{count:12}):e.jsxs(e.Fragment,{children:[t.map(c=>e.jsx(b,{item:c},c.id)),n?e.jsx(h,{count:6}):null]})}),e.jsx(y,{hasNextPage:g,isFetching:n,onLoadMore:()=>x()}),!l&&!r&&t.length===0?e.jsx("p",{className:"muted",children:"This collection has no items to show."}):null]})}export{B as Collection,B as default};
1
+ import{u as j,a as _,j as e}from"./react-CQ5qhqs6.js";import{u as N,t as u,C as f,A as b,f as C,a as A}from"./index-BW6d6BbH.js";import{A as v}from"./collection-B34IwUC5.js";import{S as h}from"./SkeletonCards-DSpqiDzZ.js";import{L as y}from"./LoadMore-7qZApSeo.js";import{u as L}from"./useInfiniteGrid-Dvh83G5j.js";import"./ethers-DXxh-eEm.js";const P=48;function B(){var d;const{contractAddress:a}=j(),p=_(),{items:t,total:o,isLoading:l,error:r,hasNextPage:g,isFetchingNextPage:n,fetchNextPage:x}=L(["collection-page",a],c=>C(a,{first:P,skip:c}),{enabled:!!a}),{data:s}=N({queryKey:["collection-meta",a],queryFn:()=>A(a),enabled:!!a,staleTime:5*6e4}),i=(s==null?void 0:s.name)||u("collection.fallbackTitle"),m=(s==null?void 0:s.creator)||((d=t[0])==null?void 0:d.creator);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:()=>p("/assets"),children:u("collection.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:i})]}),e.jsxs("header",{className:"collection-page__head",children:[e.jsx("h1",{className:"collection-page__title",children:i}),m?e.jsx(f,{address:m,className:"collection-page__creator"}):null,e.jsx("span",{className:"muted collection-page__count",children:l?"…":`${o.toLocaleString()} item${o===1?"":"s"}`})]}),!l&&t.length>0?e.jsx(v,{items:t,source:"collection"}):null,r?e.jsx("p",{className:"error",children:"Couldn’t load this collection — please try again."}):null,e.jsx("div",{className:"grid",children:l?e.jsx(h,{count:12}):e.jsxs(e.Fragment,{children:[t.map(c=>e.jsx(b,{item:c},c.id)),n?e.jsx(h,{count:6}):null]})}),e.jsx(y,{hasNextPage:g,isFetching:n,onLoadMore:()=>x()}),!l&&!r&&t.length===0?e.jsx("p",{className:"muted",children:"This collection has no items to show."}):null]})}export{B as Collection,B as default};
@@ -1 +1 @@
1
- import{j as e,u as g,a as p}from"./react-CQ5qhqs6.js";import{k as i,C as h,A as x,l as j}from"./index-DvAy35iS.js";import{A as f}from"./collection-ae9B_wBl.js";import{S as m}from"./SkeletonCards-DSpqiDzZ.js";import{L as N}from"./LoadMore-7qZApSeo.js";import{u as b}from"./useInfiniteGrid-DBBDC6CU.js";import"./ethers-DXxh-eEm.js";function _({address:s,className:r=""}){const o=i(t=>t.followed.includes(s.toLowerCase())),a=i(t=>t.toggle);return s?e.jsx("button",{type:"button",className:`btn btn--sm ${o?"btn--ghost":"btn--outline"} ${r}`.trim(),"aria-pressed":o,title:o?"Unfollow creator":"Follow creator",onClick:()=>a(s),children:o?"Following":"Follow"}):null}const C=48;function S(){const{address:s}=g(),r=p(),{items:o,total:a,isLoading:t,error:n,hasNextPage:u,isFetchingNextPage:c,fetchNextPage:d}=b(["creator-page",s],l=>j(s,{first:C,skip:l}),{enabled:!!s});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:()=>r("/assets"),children:"Collectibles"}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:"Creator"})]}),e.jsxs("header",{className:"collection-page__head",children:[s?e.jsx(h,{address:s,className:"collection-page__title-creator"}):null,s?e.jsx(_,{address:s}):null,e.jsx("span",{className:"muted collection-page__count",children:t?"…":`${a.toLocaleString()} item${a===1?"":"s"}`})]}),!t&&o.length>0?e.jsx(f,{items:o,source:"creator"}):null,n?e.jsx("p",{className:"error",children:"Couldn’t load this creator — please try again."}):null,e.jsx("div",{className:"grid",children:t?e.jsx(m,{count:12}):e.jsxs(e.Fragment,{children:[o.map(l=>e.jsx(x,{item:l},l.id)),c?e.jsx(m,{count:6}):null]})}),e.jsx(N,{hasNextPage:u,isFetching:c,onLoadMore:()=>d()}),!t&&!n&&o.length===0?e.jsx("p",{className:"muted",children:"This creator has no items to show yet."}):null]})}export{S as Creator,S as default};
1
+ import{j as e,u as g,a as p}from"./react-CQ5qhqs6.js";import{k as i,C as h,A as x,l as j}from"./index-BW6d6BbH.js";import{A as f}from"./collection-B34IwUC5.js";import{S as m}from"./SkeletonCards-DSpqiDzZ.js";import{L as N}from"./LoadMore-7qZApSeo.js";import{u as b}from"./useInfiniteGrid-Dvh83G5j.js";import"./ethers-DXxh-eEm.js";function _({address:s,className:r=""}){const o=i(t=>t.followed.includes(s.toLowerCase())),a=i(t=>t.toggle);return s?e.jsx("button",{type:"button",className:`btn btn--sm ${o?"btn--ghost":"btn--outline"} ${r}`.trim(),"aria-pressed":o,title:o?"Unfollow creator":"Follow creator",onClick:()=>a(s),children:o?"Following":"Follow"}):null}const C=48;function S(){const{address:s}=g(),r=p(),{items:o,total:a,isLoading:t,error:n,hasNextPage:u,isFetchingNextPage:c,fetchNextPage:d}=b(["creator-page",s],l=>j(s,{first:C,skip:l}),{enabled:!!s});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:()=>r("/assets"),children:"Collectibles"}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:"Creator"})]}),e.jsxs("header",{className:"collection-page__head",children:[s?e.jsx(h,{address:s,className:"collection-page__title-creator"}):null,s?e.jsx(_,{address:s}):null,e.jsx("span",{className:"muted collection-page__count",children:t?"…":`${a.toLocaleString()} item${a===1?"":"s"}`})]}),!t&&o.length>0?e.jsx(f,{items:o,source:"creator"}):null,n?e.jsx("p",{className:"error",children:"Couldn’t load this creator — please try again."}):null,e.jsx("div",{className:"grid",children:t?e.jsx(m,{count:12}):e.jsxs(e.Fragment,{children:[o.map(l=>e.jsx(x,{item:l},l.id)),c?e.jsx(m,{count:6}):null]})}),e.jsx(N,{hasNextPage:u,isFetching:c,onLoadMore:()=>d()}),!t&&!n&&o.length===0?e.jsx("p",{className:"muted",children:"This creator has no items to show yet."}):null]})}export{S as Creator,S as default};
@@ -1 +1 @@
1
- import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-BwXooI70.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-BplwFt6_.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
1
+ import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-B6_3Zs6I.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-Bn1ikbQg.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RealCheckout-DdB_2aXB.js","assets/react-CQ5qhqs6.js","assets/index-DvAy35iS.js","assets/ethers-DXxh-eEm.js","assets/index-D5NMP22o.css"])))=>i.map(i=>d[i]);
2
- import{af as $,i as y,ag as U,c as F,w as L,y as _,D as S,H as E,x as u,e as N,ah as R,_ as V}from"./index-DvAy35iS.js";import{a as K,r as l,j as e}from"./react-CQ5qhqs6.js";import{C as k}from"./CircularProgress-j19iz-El.js";import"./ethers-DXxh-eEm.js";function I(){return y.shopServerUrl||y.creditsServerUrl}async function Y(t,s){const r=await $(`${I()}/credits/checkout`,{method:"POST",identity:s,metadata:{},headers:{"Content-Type":"application/json"},body:JSON.stringify({packId:t})});if(!r.ok)throw new Error(`checkout ${r.status}: ${await r.text()}`);const{orderId:a,clientSecret:n}=await r.json();return{orderId:a,clientSecret:n,mock:!1}}async function z(t,s,r={}){const{intervalMs:a=1500,timeoutMs:n=6e4,signal:c}=r,i=Date.now()+n;for(;;){if(c!=null&&c.aborted)throw new DOMException("Aborted","AbortError");const m=await q(t,s,c);if(m.status!=="processing")return m;if(Date.now()>i)return{status:"failed",error:"Timed out waiting for your credits."};await H(a,c)}}async function q(t,s,r){const a=await $(`${I()}/credits/orders/${t}`,{method:"GET",identity:s,metadata:{},signal:r});if(!a.ok)throw new Error(`order status ${a.status}`);return a.json()}function H(t,s){return new Promise((r,a)=>{const n=setTimeout(r,t);s==null||s.addEventListener("abort",()=>{clearTimeout(n),a(new DOMException("Aborted","AbortError"))})})}const W=.1,T=[{id:"pack_5",usd:5,credits:f(5)},{id:"pack_10",usd:10,credits:f(10)},{id:"pack_25",usd:25,credits:f(25),bestValue:!0},{id:"pack_50",usd:50,credits:f(50)}];function f(t){return Math.round(t/W)}function G(t){return T.find(s=>s.id===t)}const x="mock_cs_",J=new Set([80002,11155111,1337,31337]);function C(){const t=!y.stripePublishableKey;if(t&&!J.has(y.chainId))throw new Error(`Stripe publishable key is missing on chainId=${y.chainId}, which is not a recognized test network. Refusing to fall back to mock payments in a real-money environment — configure STRIPE_PUBLISHABLE_KEY.`);return t}async function Q(t,s){const r=G(t);if(!r)throw new Error("Unknown pack");if(C())return Z(r);if(!(s!=null&&s.identity))throw new Error("Sign in to get credits.");return Y(t,s.identity)}async function X(t,s={}){const{intervalMs:r,timeoutMs:a,signal:n,identity:c}=s;if(C()||t.startsWith(x))return ee(t,s);if(!c)throw new Error("Sign in to get credits.");return z(t,c,{intervalMs:r,timeoutMs:a,signal:n})}function Z(t){const s=`${x}${t.id}_${Date.now()}`;return M(400).then(()=>({orderId:s,clientSecret:`${x}${t.id}`,mock:!0}))}async function ee(t,s={}){await M(s.intervalMs??900);const r=t.replace(x,"").replace(/_\d+$/,""),a=G(r),n=(a==null?void 0:a.credits)??0;if(s.address&&a)try{const c=await U(s.address,Math.round(a.usd*100));return{status:"credited",creditsGranted:n,newBalance:c.credits}}catch(c){return{status:"failed",error:c.message}}return{status:"credited",creditsGranted:n,newBalance:n}}function M(t,s){return new Promise((r,a)=>{setTimeout(r,t)})}const b=C()?"mock":"stripe",se=l.lazy(()=>V(()=>import("./RealCheckout-DdB_2aXB.js"),__vite__mapDeps([0,1,2,3,4])));function P(t){const s=t;if((s==null?void 0:s.name)==="AbortError")return"You cancelled the request.";const r=((s==null?void 0:s.message)??"").toLowerCase();return r.includes("sign in")?`Sign in to get ${u.name}.`:r.includes("timed out")?`This is taking longer than usual — your ${u.name} will appear shortly.`:"Couldn't complete your purchase — please try again."}function de(){const t=K(),{session:s,signIn:r}=F(),a=L(),[n,c]=l.useState("select"),[i,m]=l.useState(null),[h,w]=l.useState(null),[D,v]=l.useState(null),[A,p]=l.useState(null),g=l.useRef(null);l.useEffect(()=>()=>{var o;return(o=g.current)==null?void 0:o.abort()},[]);const B=l.useCallback(async o=>{if(!s){r();return}p(null),m(o),c("paying"),_("Shop Started Buy Credits",{pack_usd:o.usd,credits:o.credits,provider:b});try{const d=await Q(o.id,{address:s.address,identity:s.identity});w(d)}catch(d){S(d,{flow:"get_credits",step:"checkout",provider:b}),_("Shop Buy Credits Failed",{step:"checkout",error_code:E(d),pack_usd:o.usd}),p(P(d)),c("error")}},[s,r]),O=l.useCallback(async()=>{if(!h)return;c("processing");const o=new AbortController;g.current=o;try{const d=await X(h.orderId,{signal:o.signal,address:s==null?void 0:s.address,identity:s==null?void 0:s.identity});d.status==="credited"?(v(d.creditsGranted??(i==null?void 0:i.credits)??0),c("success"),_("Shop Completed Buy Credits",{order_id:h.orderId,pack_usd:(i==null?void 0:i.usd)??null,credits:d.creditsGranted??(i==null?void 0:i.credits)??0,provider:b}),a.invalidateQueries({queryKey:["usd-balance"]})):(_("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(i==null?void 0:i.usd)??null}),p(d.error??`Couldn't add your ${u.name} — please try again.`),c("error"))}catch(d){S(d,{flow:"get_credits",step:"grant",order_id:h.orderId}),_("Shop Buy Credits Failed",{step:"grant",error_code:E(d),pack_usd:(i==null?void 0:i.usd)??null}),p(P(d)),c("error")}},[h,i,s,a]);function j(){var o;(o=g.current)==null||o.abort(),c("select"),m(null),w(null),v(null),p(null)}return e.jsxs("div",{className:"getcredits",children:[e.jsxs("header",{className:"getcredits__head",children:[e.jsxs("h1",{className:"getcredits__title",children:["Get ",u.name]}),e.jsxs("p",{className:"muted",children:["Add ",u.name," to your account to shop. Pay with any card."]})]}),s?e.jsxs(e.Fragment,{children:[n==="select"&&e.jsx(te,{onSelect:B}),n==="paying"&&i&&e.jsx(re,{pack:i,checkout:h,onPaid:O,onCancel:j}),n==="processing"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(k,{size:40}),e.jsxs("p",{className:"getcredits__status-title",children:["Adding your ",u.name,"…"]}),e.jsx("p",{className:"muted",children:"Payment received. Just a moment while we top up your balance."})]}),n==="success"&&e.jsxs("div",{className:"getcredits__status getcredits__status--ok",role:"status","aria-live":"polite",children:[e.jsx("div",{className:"getcredits__confetti","aria-hidden":!0,children:"🎉"}),e.jsx("p",{className:"getcredits__status-title",children:"You’re all set!"}),e.jsxs("p",{className:"muted",children:[e.jsxs("strong",{children:[e.jsx(N,{className:"ccy-mark"})," ",D]})," ",u.name," added to your account."]}),e.jsxs("div",{className:"getcredits__status-actions",children:[e.jsx("button",{className:"btn",onClick:()=>t("/cart"),children:"Back to cart"}),e.jsxs("button",{className:"btn btn--ghost",onClick:j,children:["Get more ",u.name]})]})]}),n==="error"&&e.jsxs("div",{className:"getcredits__status getcredits__status--err",role:"alert",children:[e.jsx("p",{className:"getcredits__status-title",children:"Something went wrong"}),e.jsx("p",{className:"error",children:A}),e.jsx("div",{className:"getcredits__status-actions",children:e.jsx("button",{className:"btn",onClick:j,children:"Try again"})})]})]}):e.jsxs("div",{className:"getcredits__status",role:"status",children:[e.jsxs("p",{className:"getcredits__status-title",children:["Sign in to get ",u.name]}),e.jsxs("p",{className:"muted",children:["Connect your account to buy ",u.name," and start shopping."]}),e.jsx("div",{className:"getcredits__status-actions",children:e.jsx("button",{className:"btn btn--purple",onClick:r,children:"Sign in"})})]})]})}function te({onSelect:t}){return e.jsx("div",{className:"packs",children:T.map(s=>e.jsxs("button",{type:"button",className:`pack${s.bestValue?" pack--best":""}`,onClick:()=>t(s),"aria-label":`Get ${R(s.credits)} for $${s.usd}`,children:[s.bestValue&&e.jsx("span",{className:"pack__ribbon",children:"Best value"}),e.jsxs("span",{className:"pack__credits",children:[e.jsx(N,{className:"pack__credits-ico"}),s.credits]}),e.jsx("span",{className:"pack__label",children:u.name}),e.jsxs("span",{className:"pack__price",children:["$",s.usd]}),e.jsxs("span",{className:"pack__cta",children:["Get ",u.name]})]},s.id))})}function re({pack:t,checkout:s,onPaid:r,onCancel:a}){return e.jsxs("div",{className:"pay",children:[e.jsxs("div",{className:"pay__summary",children:[e.jsx("button",{className:"link",onClick:a,children:"← Choose a different pack"}),e.jsxs("div",{className:"pay__summary-row",children:[e.jsx("span",{children:"You’ll get"}),e.jsxs("strong",{children:[e.jsx(N,{className:"ccy-mark"})," ",R(t.credits)]})]}),e.jsxs("div",{className:"pay__summary-row pay__summary-row--total",children:[e.jsx("span",{children:"You pay"}),e.jsxs("strong",{children:["$",t.usd]})]})]}),e.jsx("div",{className:"pay__form",children:s?s.mock?e.jsx(ae,{onPaid:r,amountUsd:t.usd}):e.jsx(l.Suspense,{fallback:e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(k,{size:32}),e.jsx("p",{className:"muted",children:"Getting the payment form ready…"})]}),children:e.jsx(se,{clientSecret:s.clientSecret,onComplete:r})}):e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(k,{size:32}),e.jsx("p",{className:"muted",children:"Getting the payment form ready…"})]})})]})}function ae({onPaid:t,amountUsd:s}){const[r,a]=l.useState("4242 4242 4242 4242"),[n,c]=l.useState(!1);function i(){c(!0),setTimeout(()=>t(),700)}return e.jsxs("div",{className:"card-form","aria-label":"Payment details",children:[e.jsx("p",{className:"muted small card-form__note",children:"Demo mode — no real charge is made."}),e.jsxs("label",{className:"field",children:[e.jsx("span",{children:"Card number"}),e.jsx("input",{value:r,onChange:m=>a(m.target.value),disabled:n,inputMode:"numeric"})]}),e.jsxs("div",{className:"card-form__row",children:[e.jsxs("label",{className:"field",children:[e.jsx("span",{children:"Expiry"}),e.jsx("input",{defaultValue:"12 / 34",disabled:n})]}),e.jsxs("label",{className:"field",children:[e.jsx("span",{children:"CVC"}),e.jsx("input",{defaultValue:"123",disabled:n,inputMode:"numeric"})]})]}),e.jsx("button",{className:"btn btn--purple card-form__pay",onClick:i,disabled:n,children:n?"Processing…":`Pay $${s}`})]})}export{de as GetCredits,de as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RealCheckout-D9TYwWxz.js","assets/react-CQ5qhqs6.js","assets/index-BW6d6BbH.js","assets/ethers-DXxh-eEm.js","assets/index-D5NMP22o.css"])))=>i.map(i=>d[i]);
2
+ import{ag as $,i as y,ah as U,c as F,w as L,y as _,D as S,H as E,x as u,e as N,ai as R,_ as V}from"./index-BW6d6BbH.js";import{a as K,r as l,j as e}from"./react-CQ5qhqs6.js";import{C as k}from"./CircularProgress-og3LyasF.js";import"./ethers-DXxh-eEm.js";function I(){return y.shopServerUrl||y.creditsServerUrl}async function Y(t,s){const r=await $(`${I()}/credits/checkout`,{method:"POST",identity:s,metadata:{},headers:{"Content-Type":"application/json"},body:JSON.stringify({packId:t})});if(!r.ok)throw new Error(`checkout ${r.status}: ${await r.text()}`);const{orderId:a,clientSecret:n}=await r.json();return{orderId:a,clientSecret:n,mock:!1}}async function z(t,s,r={}){const{intervalMs:a=1500,timeoutMs:n=6e4,signal:c}=r,i=Date.now()+n;for(;;){if(c!=null&&c.aborted)throw new DOMException("Aborted","AbortError");const m=await q(t,s,c);if(m.status!=="processing")return m;if(Date.now()>i)return{status:"failed",error:"Timed out waiting for your credits."};await H(a,c)}}async function q(t,s,r){const a=await $(`${I()}/credits/orders/${t}`,{method:"GET",identity:s,metadata:{},signal:r});if(!a.ok)throw new Error(`order status ${a.status}`);return a.json()}function H(t,s){return new Promise((r,a)=>{const n=setTimeout(r,t);s==null||s.addEventListener("abort",()=>{clearTimeout(n),a(new DOMException("Aborted","AbortError"))})})}const W=.1,T=[{id:"pack_5",usd:5,credits:f(5)},{id:"pack_10",usd:10,credits:f(10)},{id:"pack_25",usd:25,credits:f(25),bestValue:!0},{id:"pack_50",usd:50,credits:f(50)}];function f(t){return Math.round(t/W)}function G(t){return T.find(s=>s.id===t)}const x="mock_cs_",J=new Set([80002,11155111,1337,31337]);function C(){const t=!y.stripePublishableKey;if(t&&!J.has(y.chainId))throw new Error(`Stripe publishable key is missing on chainId=${y.chainId}, which is not a recognized test network. Refusing to fall back to mock payments in a real-money environment — configure STRIPE_PUBLISHABLE_KEY.`);return t}async function Q(t,s){const r=G(t);if(!r)throw new Error("Unknown pack");if(C())return Z(r);if(!(s!=null&&s.identity))throw new Error("Sign in to get credits.");return Y(t,s.identity)}async function X(t,s={}){const{intervalMs:r,timeoutMs:a,signal:n,identity:c}=s;if(C()||t.startsWith(x))return ee(t,s);if(!c)throw new Error("Sign in to get credits.");return z(t,c,{intervalMs:r,timeoutMs:a,signal:n})}function Z(t){const s=`${x}${t.id}_${Date.now()}`;return M(400).then(()=>({orderId:s,clientSecret:`${x}${t.id}`,mock:!0}))}async function ee(t,s={}){await M(s.intervalMs??900);const r=t.replace(x,"").replace(/_\d+$/,""),a=G(r),n=(a==null?void 0:a.credits)??0;if(s.address&&a)try{const c=await U(s.address,Math.round(a.usd*100));return{status:"credited",creditsGranted:n,newBalance:c.credits}}catch(c){return{status:"failed",error:c.message}}return{status:"credited",creditsGranted:n,newBalance:n}}function M(t,s){return new Promise((r,a)=>{setTimeout(r,t)})}const b=C()?"mock":"stripe",se=l.lazy(()=>V(()=>import("./RealCheckout-D9TYwWxz.js"),__vite__mapDeps([0,1,2,3,4])));function P(t){const s=t;if((s==null?void 0:s.name)==="AbortError")return"You cancelled the request.";const r=((s==null?void 0:s.message)??"").toLowerCase();return r.includes("sign in")?`Sign in to get ${u.name}.`:r.includes("timed out")?`This is taking longer than usual — your ${u.name} will appear shortly.`:"Couldn't complete your purchase — please try again."}function de(){const t=K(),{session:s,signIn:r}=F(),a=L(),[n,c]=l.useState("select"),[i,m]=l.useState(null),[h,w]=l.useState(null),[D,v]=l.useState(null),[A,p]=l.useState(null),g=l.useRef(null);l.useEffect(()=>()=>{var o;return(o=g.current)==null?void 0:o.abort()},[]);const B=l.useCallback(async o=>{if(!s){r();return}p(null),m(o),c("paying"),_("Shop Started Buy Credits",{pack_usd:o.usd,credits:o.credits,provider:b});try{const d=await Q(o.id,{address:s.address,identity:s.identity});w(d)}catch(d){S(d,{flow:"get_credits",step:"checkout",provider:b}),_("Shop Buy Credits Failed",{step:"checkout",error_code:E(d),pack_usd:o.usd}),p(P(d)),c("error")}},[s,r]),O=l.useCallback(async()=>{if(!h)return;c("processing");const o=new AbortController;g.current=o;try{const d=await X(h.orderId,{signal:o.signal,address:s==null?void 0:s.address,identity:s==null?void 0:s.identity});d.status==="credited"?(v(d.creditsGranted??(i==null?void 0:i.credits)??0),c("success"),_("Shop Completed Buy Credits",{order_id:h.orderId,pack_usd:(i==null?void 0:i.usd)??null,credits:d.creditsGranted??(i==null?void 0:i.credits)??0,provider:b}),a.invalidateQueries({queryKey:["usd-balance"]})):(_("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(i==null?void 0:i.usd)??null}),p(d.error??`Couldn't add your ${u.name} — please try again.`),c("error"))}catch(d){S(d,{flow:"get_credits",step:"grant",order_id:h.orderId}),_("Shop Buy Credits Failed",{step:"grant",error_code:E(d),pack_usd:(i==null?void 0:i.usd)??null}),p(P(d)),c("error")}},[h,i,s,a]);function j(){var o;(o=g.current)==null||o.abort(),c("select"),m(null),w(null),v(null),p(null)}return e.jsxs("div",{className:"getcredits",children:[e.jsxs("header",{className:"getcredits__head",children:[e.jsxs("h1",{className:"getcredits__title",children:["Get ",u.name]}),e.jsxs("p",{className:"muted",children:["Add ",u.name," to your account to shop. Pay with any card."]})]}),s?e.jsxs(e.Fragment,{children:[n==="select"&&e.jsx(te,{onSelect:B}),n==="paying"&&i&&e.jsx(re,{pack:i,checkout:h,onPaid:O,onCancel:j}),n==="processing"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(k,{size:40}),e.jsxs("p",{className:"getcredits__status-title",children:["Adding your ",u.name,"…"]}),e.jsx("p",{className:"muted",children:"Payment received. Just a moment while we top up your balance."})]}),n==="success"&&e.jsxs("div",{className:"getcredits__status getcredits__status--ok",role:"status","aria-live":"polite",children:[e.jsx("div",{className:"getcredits__confetti","aria-hidden":!0,children:"🎉"}),e.jsx("p",{className:"getcredits__status-title",children:"You’re all set!"}),e.jsxs("p",{className:"muted",children:[e.jsxs("strong",{children:[e.jsx(N,{className:"ccy-mark"})," ",D]})," ",u.name," added to your account."]}),e.jsxs("div",{className:"getcredits__status-actions",children:[e.jsx("button",{className:"btn",onClick:()=>t("/cart"),children:"Back to cart"}),e.jsxs("button",{className:"btn btn--ghost",onClick:j,children:["Get more ",u.name]})]})]}),n==="error"&&e.jsxs("div",{className:"getcredits__status getcredits__status--err",role:"alert",children:[e.jsx("p",{className:"getcredits__status-title",children:"Something went wrong"}),e.jsx("p",{className:"error",children:A}),e.jsx("div",{className:"getcredits__status-actions",children:e.jsx("button",{className:"btn",onClick:j,children:"Try again"})})]})]}):e.jsxs("div",{className:"getcredits__status",role:"status",children:[e.jsxs("p",{className:"getcredits__status-title",children:["Sign in to get ",u.name]}),e.jsxs("p",{className:"muted",children:["Connect your account to buy ",u.name," and start shopping."]}),e.jsx("div",{className:"getcredits__status-actions",children:e.jsx("button",{className:"btn btn--purple",onClick:r,children:"Sign in"})})]})]})}function te({onSelect:t}){return e.jsx("div",{className:"packs",children:T.map(s=>e.jsxs("button",{type:"button",className:`pack${s.bestValue?" pack--best":""}`,onClick:()=>t(s),"aria-label":`Get ${R(s.credits)} for $${s.usd}`,children:[s.bestValue&&e.jsx("span",{className:"pack__ribbon",children:"Best value"}),e.jsxs("span",{className:"pack__credits",children:[e.jsx(N,{className:"pack__credits-ico"}),s.credits]}),e.jsx("span",{className:"pack__label",children:u.name}),e.jsxs("span",{className:"pack__price",children:["$",s.usd]}),e.jsxs("span",{className:"pack__cta",children:["Get ",u.name]})]},s.id))})}function re({pack:t,checkout:s,onPaid:r,onCancel:a}){return e.jsxs("div",{className:"pay",children:[e.jsxs("div",{className:"pay__summary",children:[e.jsx("button",{className:"link",onClick:a,children:"← Choose a different pack"}),e.jsxs("div",{className:"pay__summary-row",children:[e.jsx("span",{children:"You’ll get"}),e.jsxs("strong",{children:[e.jsx(N,{className:"ccy-mark"})," ",R(t.credits)]})]}),e.jsxs("div",{className:"pay__summary-row pay__summary-row--total",children:[e.jsx("span",{children:"You pay"}),e.jsxs("strong",{children:["$",t.usd]})]})]}),e.jsx("div",{className:"pay__form",children:s?s.mock?e.jsx(ae,{onPaid:r,amountUsd:t.usd}):e.jsx(l.Suspense,{fallback:e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(k,{size:32}),e.jsx("p",{className:"muted",children:"Getting the payment form ready…"})]}),children:e.jsx(se,{clientSecret:s.clientSecret,onComplete:r})}):e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(k,{size:32}),e.jsx("p",{className:"muted",children:"Getting the payment form ready…"})]})})]})}function ae({onPaid:t,amountUsd:s}){const[r,a]=l.useState("4242 4242 4242 4242"),[n,c]=l.useState(!1);function i(){c(!0),setTimeout(()=>t(),700)}return e.jsxs("div",{className:"card-form","aria-label":"Payment details",children:[e.jsx("p",{className:"muted small card-form__note",children:"Demo mode — no real charge is made."}),e.jsxs("label",{className:"field",children:[e.jsx("span",{children:"Card number"}),e.jsx("input",{value:r,onChange:m=>a(m.target.value),disabled:n,inputMode:"numeric"})]}),e.jsxs("div",{className:"card-form__row",children:[e.jsxs("label",{className:"field",children:[e.jsx("span",{children:"Expiry"}),e.jsx("input",{defaultValue:"12 / 34",disabled:n})]}),e.jsxs("label",{className:"field",children:[e.jsx("span",{children:"CVC"}),e.jsx("input",{defaultValue:"123",disabled:n,inputMode:"numeric"})]})]}),e.jsx("button",{className:"btn btn--purple card-form__pay",onClick:i,disabled:n,children:n?"Processing…":`Pay $${s}`})]})}export{de as GetCredits,de as default};
@@ -1,4 +1,4 @@
1
- import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-Cpng5QLO.js";import{d as g,r as v}from"./index-BplwFt6_.js";import{C as c}from"./ConstantsUtil-DrbbN8Db.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-BwXooI70.js";import{au as y}from"./NetworkUtil-BI8jZwmc.js";const b=g`
1
+ import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-BTusn-cp.js";import{d as g,r as v}from"./index-Bn1ikbQg.js";import{C as c}from"./ConstantsUtil-DrbbN8Db.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-B6_3Zs6I.js";import{au as y}from"./NetworkUtil-BI8jZwmc.js";const b=g`
2
2
  :host {
3
3
  display: flex;
4
4
  justify-content: center;
@@ -1 +1 @@
1
- import{a as E,r as p,j as e,L as A}from"./react-CQ5qhqs6.js";import{y as Q,D as L,x as S,e as v,c as R,w as F,u as K,o as P}from"./index-DvAy35iS.js";import{i as W,R as Y,f as G}from"./import-DI2r0vcY.js";import{s as O}from"./wallet-kind-D56TeB0g.js";import"./ethers-DXxh-eEm.js";import"./buy-KvjWmHql.js";import"./trade-encoding-CmkOOQWS.js";import"./index-CUDTJiCv.js";import"./mana-rate-BmhpEynZ.js";function B({queue:n,session:I,onClose:g,onDone:h}){const x=E(),c=O(I.providerType),[d,j]=p.useState(()=>n.map(()=>"pending")),[b,C]=p.useState("running"),w=p.useRef(!1);p.useEffect(()=>{if(w.current)return;w.current=!0;let t=!1;return(async()=>{for(let s=0;s<n.length;s++){if(t)return;j(r=>r.map((m,o)=>o===s?"active":m));try{await W(n[s].item,n[s].priceCredits,I),Q("Shop Migrated Listing",{item_id:n[s].item.itemId??n[s].item.oldTradeId??null,contract_address:n[s].item.contractAddress,new_price_credits:n[s].priceCredits,new_price_usd:n[s].priceCredits/10}),t||j(r=>r.map((m,o)=>o===s?"done":m))}catch(r){if(r instanceof Y)L(r,{flow:"import_listing",step:"relist",itemId:n[s].item.itemId??n[s].item.oldTradeId}),t||j(m=>m.map((o,y)=>y===s?"unlisted":o));else{const m=r,o=m.code===4001||/reject|denied|cancel/i.test(m.message??"");o||L(r,{flow:"import_listing",itemId:n[s].item.itemId??n[s].item.oldTradeId}),t||j(y=>y.map((T,a)=>a===s?o?"skipped":"failed":T))}}}t||C("finished")})(),()=>{t=!0}},[]);const u=d.filter(t=>t==="done").length,N=d.findIndex(t=>t==="active"),_=Math.round(d.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function f(){h(),g()}if(b==="finished"){const t=d.filter(r=>r==="skipped"||r==="failed").length,s=d.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:u>0?"You're in the Shop! 🎉":"Nothing listed"}),e.jsxs("p",{className:"muted",style:{margin:0},children:[u>0?`${u} ${u===1?"item is":"items are"} now for sale with ${S.name}.`:"No items were listed.",t>0?` ${t} skipped — you can try those again anytime.`:"",s>0?` ${s} ${s===1?"item was":"items were"} taken off the old marketplace but couldn't be re-listed — re-list ${s===1?"it":"them"} from My Assets.`:""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:f,children:"Done"}),s>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{h(),g(),x("/my-assets")},children:"Go to My Assets"}):u>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{h(),g(),x("/assets")},children:"View in Shop"}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:"Listing your items"}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[c?"We take down each old listing and re-list it for credits — confirm each step.":"Moving your items to the Shop."," ",N>=0?`${N+1} of ${n.length}`:""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${_}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,s)=>e.jsxs("li",{className:`migrate__row migrate__row--${d[s]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||"Item"}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(v,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:d[s]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",c?"Confirm…":"Adding…"]}):d[s]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):d[s]==="skipped"?e.jsx("span",{className:"migrate__skip",children:"Skipped"}):d[s]==="failed"?e.jsx("span",{className:"migrate__skip",children:"Failed"}):d[s]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:"Removed from the old marketplace but not re-listed — re-list it from My Assets.",children:"Not listed"}):e.jsx("span",{className:"migrate__wait",children:"Waiting"})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:c?"A couple of quick confirmations pop up per item (take down + re-list). Keep this open.":"This only takes a moment — keep this open."})]})})}const D=[{key:"creations",title:"Your creations",sub:"Items you made. Put them on sale in the Shop."},{key:"owned",title:"Items you own",sub:"Things you've bought elsewhere — resell them in the Shop."}];function se(){const{session:n,signIn:I,restore:g}=R(),h=F(),x=n==null?void 0:n.address;p.useEffect(()=>{g()},[g]);const{data:c,isLoading:d}=K({queryKey:["importable",x],queryFn:()=>G(x),enabled:!!x}),[j,b]=p.useState({}),[C,w]=p.useState(new Set),[u,N]=p.useState(null),_=p.useMemo(()=>[...(c==null?void 0:c.creations)??[],...(c==null?void 0:c.owned)??[]],[c]);p.useEffect(()=>{_.length&&b(a=>{const l={...a};for(const i of _)l[i.oldTradeId]==null&&(l[i.oldTradeId]=i.suggestedCredits);return l})},[_]);const f=a=>!C.has(a),t=a=>j[a.oldTradeId]??a.suggestedCredits,s=_.filter(a=>f(a.oldTradeId)),r=s.reduce((a,l)=>a+t(l),0);function m(a,l){const i=l.replace(/[^\d]/g,"");b(k=>({...k,[a]:i===""?0:parseInt(i,10)}))}function o(a){w(l=>{const i=new Set(l);return i.has(a)?i.delete(a):i.add(a),i})}function y(a){return a.map(l=>({item:l,priceCredits:Math.max(1,t(l))}))}function T(){h.invalidateQueries({queryKey:["importable"]}),h.invalidateQueries({queryKey:["unified-listings"]}),h.invalidateQueries({queryKey:["my-assets"]}),h.invalidateQueries({queryKey:["collection-sale-state"]}),P.success("Your Shop is updated.")}return n?!d&&_.length===0?e.jsxs("div",{className:"imp-empty",children:[e.jsx("span",{className:"imp-empty__ico","aria-hidden":!0,children:"✨"}),e.jsx("h1",{className:"imp-empty__title",children:"You're all caught up"}),e.jsx("p",{className:"muted",children:"Everything you sell is already in the Shop — nothing to import."}),e.jsx(A,{className:"btn btn--purple",to:"/my-assets",children:"Go to My Assets"})]}):e.jsxs("div",{className:"imp",children:[e.jsxs("header",{className:"imp__head",children:[e.jsx("span",{className:"imp__eyebrow",children:"Import to the Shop"}),e.jsxs("h1",{className:"imp__title",children:["Bring your listings ",e.jsx("span",{className:"imp__grad",children:"into the Shop"})]}),e.jsxs("p",{className:"imp__lede",children:["These items are already for sale elsewhere. We suggested a price in ",S.name," for each — matched to today's rate and rounded up. Adjust anything, then list them."]})]}),e.jsxs("div",{className:"imp__ratebar",children:[e.jsx(v,{className:"ccy-mark imp__diamond"})," 1 ",S.nameSingular," = $0.10 · prices rounded up"]}),d?e.jsx("div",{className:"imp__list",children:Array.from({length:4}).map((a,l)=>e.jsx("div",{className:"imp-row imp-row--skeleton"},l))}):D.map(a=>{const l=(c==null?void 0:c[a.key])??[];return l.length===0?null:e.jsxs("section",{className:"imp__section",children:[e.jsxs("div",{className:"imp__section-head",children:[e.jsx("h2",{className:"imp__section-title",children:a.title}),e.jsx("span",{className:"imp__section-sub",children:a.sub})]}),e.jsx("div",{className:"imp__list",children:l.map(i=>{const k=t(i),M=k!==i.suggestedCredits;return e.jsxs("article",{className:`imp-row${f(i.oldTradeId)?"":" is-off"}`,children:[e.jsx("input",{type:"checkbox",className:"imp-check",checked:f(i.oldTradeId),onChange:()=>o(i.oldTradeId),"aria-label":`Include ${i.name}`}),e.jsx("div",{className:"imp-thumb",children:i.thumbnail?e.jsx("img",{src:i.thumbnail,alt:""}):null}),e.jsxs("div",{className:"imp-meta",children:[e.jsx("div",{className:"imp-name",title:i.name,children:i.name||"Item"}),e.jsx("span",{className:"imp-chip",children:i.rarity})]}),e.jsxs("div",{className:"imp-price",children:[e.jsxs("div",{className:"imp-price__field",children:[e.jsx(v,{className:"ccy-mark imp-price__diamond"}),e.jsx("input",{className:"imp-price__input",inputMode:"numeric",value:k.toLocaleString(),onChange:$=>m(i.oldTradeId,$.target.value),"aria-label":`Price in ${S.name} for ${i.name}`})]}),e.jsxs("div",{className:"imp-price__sub",children:[e.jsxs("span",{children:["$",(k*.1).toFixed(2)]}),M?e.jsxs("button",{className:"imp-price__reset",onClick:()=>b($=>({...$,[i.oldTradeId]:i.suggestedCredits})),children:["Reset to ",e.jsx(v,{className:"ccy-mark"}),i.suggestedCredits.toLocaleString()]}):null]})]}),e.jsx("div",{className:"imp-action",children:e.jsx("button",{className:"btn btn--sm imp-row__list",disabled:!f(i.oldTradeId),onClick:()=>N(y([i])),children:"List"})})]},i.oldTradeId)})})]},a.key)}),e.jsx("div",{className:"imp-dock",children:e.jsxs("div",{className:"imp-dock__inner",children:[e.jsxs("div",{className:"imp-dock__summary",children:[e.jsxs("div",{className:"imp-dock__total",children:[e.jsx(v,{className:"ccy-mark imp__diamond"})," ",r.toLocaleString()]}),e.jsxs("div",{className:"imp-dock__sub",children:[s.length," item",s.length===1?"":"s"," selected · $",(r*.1).toFixed(2)]})]}),e.jsx("span",{className:"imp-dock__spacer"}),e.jsxs("button",{className:"btn btn--purple imp-dock__cta",disabled:s.length===0,onClick:()=>N(y(s)),children:["List all (",s.length,")"]})]})}),u&&n?e.jsx(B,{queue:u,session:n,onClose:()=>N(null),onDone:T}):null]}):e.jsxs("div",{className:"imp-empty",children:[e.jsx("span",{className:"imp-empty__ico","aria-hidden":!0,children:"📦"}),e.jsx("h1",{className:"imp-empty__title",children:"Import your listings"}),e.jsx("p",{className:"muted",children:"Sign in to bring the items you already sell into the Shop."}),e.jsx("button",{className:"btn btn--purple",onClick:()=>I(),children:"Sign in"})]})}export{se as ImportListings};
1
+ import{a as E,r as p,j as e,L as A}from"./react-CQ5qhqs6.js";import{y as Q,D as L,x as S,e as v,c as R,w as F,u as K,o as P}from"./index-BW6d6BbH.js";import{i as W,R as Y,f as G}from"./import-1qZmk-ve.js";import{s as O}from"./wallet-kind-C_qy0E-X.js";import"./ethers-DXxh-eEm.js";import"./buy-BXsYo32e.js";import"./trade-encoding-CgWHvMsc.js";import"./index-CuI-U7nJ.js";import"./mana-rate-DbXjP8PT.js";function B({queue:n,session:I,onClose:g,onDone:h}){const x=E(),c=O(I.providerType),[d,j]=p.useState(()=>n.map(()=>"pending")),[b,C]=p.useState("running"),w=p.useRef(!1);p.useEffect(()=>{if(w.current)return;w.current=!0;let t=!1;return(async()=>{for(let s=0;s<n.length;s++){if(t)return;j(r=>r.map((m,o)=>o===s?"active":m));try{await W(n[s].item,n[s].priceCredits,I),Q("Shop Migrated Listing",{item_id:n[s].item.itemId??n[s].item.oldTradeId??null,contract_address:n[s].item.contractAddress,new_price_credits:n[s].priceCredits,new_price_usd:n[s].priceCredits/10}),t||j(r=>r.map((m,o)=>o===s?"done":m))}catch(r){if(r instanceof Y)L(r,{flow:"import_listing",step:"relist",itemId:n[s].item.itemId??n[s].item.oldTradeId}),t||j(m=>m.map((o,y)=>y===s?"unlisted":o));else{const m=r,o=m.code===4001||/reject|denied|cancel/i.test(m.message??"");o||L(r,{flow:"import_listing",itemId:n[s].item.itemId??n[s].item.oldTradeId}),t||j(y=>y.map((T,a)=>a===s?o?"skipped":"failed":T))}}}t||C("finished")})(),()=>{t=!0}},[]);const u=d.filter(t=>t==="done").length,N=d.findIndex(t=>t==="active"),_=Math.round(d.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function f(){h(),g()}if(b==="finished"){const t=d.filter(r=>r==="skipped"||r==="failed").length,s=d.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:u>0?"You're in the Shop! 🎉":"Nothing listed"}),e.jsxs("p",{className:"muted",style:{margin:0},children:[u>0?`${u} ${u===1?"item is":"items are"} now for sale with ${S.name}.`:"No items were listed.",t>0?` ${t} skipped — you can try those again anytime.`:"",s>0?` ${s} ${s===1?"item was":"items were"} taken off the old marketplace but couldn't be re-listed — re-list ${s===1?"it":"them"} from My Assets.`:""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:f,children:"Done"}),s>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{h(),g(),x("/my-assets")},children:"Go to My Assets"}):u>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{h(),g(),x("/assets")},children:"View in Shop"}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:"Listing your items"}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[c?"We take down each old listing and re-list it for credits — confirm each step.":"Moving your items to the Shop."," ",N>=0?`${N+1} of ${n.length}`:""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${_}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,s)=>e.jsxs("li",{className:`migrate__row migrate__row--${d[s]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||"Item"}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(v,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:d[s]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",c?"Confirm…":"Adding…"]}):d[s]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):d[s]==="skipped"?e.jsx("span",{className:"migrate__skip",children:"Skipped"}):d[s]==="failed"?e.jsx("span",{className:"migrate__skip",children:"Failed"}):d[s]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:"Removed from the old marketplace but not re-listed — re-list it from My Assets.",children:"Not listed"}):e.jsx("span",{className:"migrate__wait",children:"Waiting"})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:c?"A couple of quick confirmations pop up per item (take down + re-list). Keep this open.":"This only takes a moment — keep this open."})]})})}const D=[{key:"creations",title:"Your creations",sub:"Items you made. Put them on sale in the Shop."},{key:"owned",title:"Items you own",sub:"Things you've bought elsewhere — resell them in the Shop."}];function se(){const{session:n,signIn:I,restore:g}=R(),h=F(),x=n==null?void 0:n.address;p.useEffect(()=>{g()},[g]);const{data:c,isLoading:d}=K({queryKey:["importable",x],queryFn:()=>G(x),enabled:!!x}),[j,b]=p.useState({}),[C,w]=p.useState(new Set),[u,N]=p.useState(null),_=p.useMemo(()=>[...(c==null?void 0:c.creations)??[],...(c==null?void 0:c.owned)??[]],[c]);p.useEffect(()=>{_.length&&b(a=>{const l={...a};for(const i of _)l[i.oldTradeId]==null&&(l[i.oldTradeId]=i.suggestedCredits);return l})},[_]);const f=a=>!C.has(a),t=a=>j[a.oldTradeId]??a.suggestedCredits,s=_.filter(a=>f(a.oldTradeId)),r=s.reduce((a,l)=>a+t(l),0);function m(a,l){const i=l.replace(/[^\d]/g,"");b(k=>({...k,[a]:i===""?0:parseInt(i,10)}))}function o(a){w(l=>{const i=new Set(l);return i.has(a)?i.delete(a):i.add(a),i})}function y(a){return a.map(l=>({item:l,priceCredits:Math.max(1,t(l))}))}function T(){h.invalidateQueries({queryKey:["importable"]}),h.invalidateQueries({queryKey:["unified-listings"]}),h.invalidateQueries({queryKey:["my-assets"]}),h.invalidateQueries({queryKey:["collection-sale-state"]}),P.success("Your Shop is updated.")}return n?!d&&_.length===0?e.jsxs("div",{className:"imp-empty",children:[e.jsx("span",{className:"imp-empty__ico","aria-hidden":!0,children:"✨"}),e.jsx("h1",{className:"imp-empty__title",children:"You're all caught up"}),e.jsx("p",{className:"muted",children:"Everything you sell is already in the Shop — nothing to import."}),e.jsx(A,{className:"btn btn--purple",to:"/my-assets",children:"Go to My Assets"})]}):e.jsxs("div",{className:"imp",children:[e.jsxs("header",{className:"imp__head",children:[e.jsx("span",{className:"imp__eyebrow",children:"Import to the Shop"}),e.jsxs("h1",{className:"imp__title",children:["Bring your listings ",e.jsx("span",{className:"imp__grad",children:"into the Shop"})]}),e.jsxs("p",{className:"imp__lede",children:["These items are already for sale elsewhere. We suggested a price in ",S.name," for each — matched to today's rate and rounded up. Adjust anything, then list them."]})]}),e.jsxs("div",{className:"imp__ratebar",children:[e.jsx(v,{className:"ccy-mark imp__diamond"})," 1 ",S.nameSingular," = $0.10 · prices rounded up"]}),d?e.jsx("div",{className:"imp__list",children:Array.from({length:4}).map((a,l)=>e.jsx("div",{className:"imp-row imp-row--skeleton"},l))}):D.map(a=>{const l=(c==null?void 0:c[a.key])??[];return l.length===0?null:e.jsxs("section",{className:"imp__section",children:[e.jsxs("div",{className:"imp__section-head",children:[e.jsx("h2",{className:"imp__section-title",children:a.title}),e.jsx("span",{className:"imp__section-sub",children:a.sub})]}),e.jsx("div",{className:"imp__list",children:l.map(i=>{const k=t(i),M=k!==i.suggestedCredits;return e.jsxs("article",{className:`imp-row${f(i.oldTradeId)?"":" is-off"}`,children:[e.jsx("input",{type:"checkbox",className:"imp-check",checked:f(i.oldTradeId),onChange:()=>o(i.oldTradeId),"aria-label":`Include ${i.name}`}),e.jsx("div",{className:"imp-thumb",children:i.thumbnail?e.jsx("img",{src:i.thumbnail,alt:""}):null}),e.jsxs("div",{className:"imp-meta",children:[e.jsx("div",{className:"imp-name",title:i.name,children:i.name||"Item"}),e.jsx("span",{className:"imp-chip",children:i.rarity})]}),e.jsxs("div",{className:"imp-price",children:[e.jsxs("div",{className:"imp-price__field",children:[e.jsx(v,{className:"ccy-mark imp-price__diamond"}),e.jsx("input",{className:"imp-price__input",inputMode:"numeric",value:k.toLocaleString(),onChange:$=>m(i.oldTradeId,$.target.value),"aria-label":`Price in ${S.name} for ${i.name}`})]}),e.jsxs("div",{className:"imp-price__sub",children:[e.jsxs("span",{children:["$",(k*.1).toFixed(2)]}),M?e.jsxs("button",{className:"imp-price__reset",onClick:()=>b($=>({...$,[i.oldTradeId]:i.suggestedCredits})),children:["Reset to ",e.jsx(v,{className:"ccy-mark"}),i.suggestedCredits.toLocaleString()]}):null]})]}),e.jsx("div",{className:"imp-action",children:e.jsx("button",{className:"btn btn--sm imp-row__list",disabled:!f(i.oldTradeId),onClick:()=>N(y([i])),children:"List"})})]},i.oldTradeId)})})]},a.key)}),e.jsx("div",{className:"imp-dock",children:e.jsxs("div",{className:"imp-dock__inner",children:[e.jsxs("div",{className:"imp-dock__summary",children:[e.jsxs("div",{className:"imp-dock__total",children:[e.jsx(v,{className:"ccy-mark imp__diamond"})," ",r.toLocaleString()]}),e.jsxs("div",{className:"imp-dock__sub",children:[s.length," item",s.length===1?"":"s"," selected · $",(r*.1).toFixed(2)]})]}),e.jsx("span",{className:"imp-dock__spacer"}),e.jsxs("button",{className:"btn btn--purple imp-dock__cta",disabled:s.length===0,onClick:()=>N(y(s)),children:["List all (",s.length,")"]})]})}),u&&n?e.jsx(B,{queue:u,session:n,onClose:()=>N(null),onDone:T}):null]}):e.jsxs("div",{className:"imp-empty",children:[e.jsx("span",{className:"imp-empty__ico","aria-hidden":!0,children:"📦"}),e.jsx("h1",{className:"imp-empty__title",children:"Import your listings"}),e.jsx("p",{className:"muted",children:"Sign in to bring the items you already sell into the Shop."}),e.jsx("button",{className:"btn btn--purple",onClick:()=>I(),children:"Sign in"})]})}export{se as ImportListings};