@dcl/shop 0.1.0-29994094833.commit-84e34c2 → 0.1.0-29994098968.commit-46a6a0c

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 (171) hide show
  1. package/assets/{AnimatedBackground-DW1UTWMl.js → AnimatedBackground-BtxoZ_fw.js} +1 -1
  2. package/assets/{Assets-D0Gpv-gx.js → Assets-ClMZMx1a.js} +1 -1
  3. package/assets/{Assets.styles-Dz0IZ5_I.js → Assets.styles-JVRlU2lC.js} +1 -1
  4. package/assets/{Authorizations-hlWKflXp.js → Authorizations-wPj_fvn3.js} +3 -3
  5. package/assets/{Cart-BNmwscGt.js → Cart-BShdrrZS.js} +1 -1
  6. package/assets/{CircularProgress-CzgFv03I.js → CircularProgress-CLSvO83K.js} +3 -3
  7. package/assets/{Collection-CdFCCFbq.js → Collection-BYyH6eXu.js} +1 -1
  8. package/assets/{CollectionCarousel-D6IuiIc2.js → CollectionCarousel-Dyw-XZFx.js} +1 -1
  9. package/assets/{Creator-CaxOzhEa.js → Creator-DqVjR99e.js} +1 -1
  10. package/assets/{CssVarsProvider-F9lbInZM.js → CssVarsProvider-Dze6xxok.js} +3 -3
  11. package/assets/{ExchangeController-DgDdAAKd.js → ExchangeController-CEtbskqk.js} +1 -1
  12. package/assets/{GetCredits-B-aIxpHv.js → GetCredits-CATIgZsR.js} +1 -1
  13. package/assets/{HelpersUtil-CYLAmB96.js → HelpersUtil-BxqSV8ZH.js} +1 -1
  14. package/assets/{ImportListings-wLBEk5Jj.js → ImportListings-CbvJ0vxX.js} +1 -1
  15. package/assets/{ItemDetail-DYEljYNo.js → ItemDetail-CcoMXI-P.js} +3 -3
  16. package/assets/{LoadMore-DAM-bEob.js → LoadMore-BFtkV8IC.js} +1 -1
  17. package/assets/{MarketCheckout-BemjD_ML.js → MarketCheckout-Dlac-3dT.js} +1 -1
  18. package/assets/MyAssets-Cl5a0ipv.js +258 -0
  19. package/assets/{MyFavorites-D4nPx2R8.js → MyFavorites-B1ctQKxs.js} +1 -1
  20. package/assets/{MyPurchases-cVdBxnoE.js → MyPurchases-xeoqVcYT.js} +4 -4
  21. package/assets/{NotFound-8rhBEKBk.js → NotFound-BuZmXlNo.js} +1 -1
  22. package/assets/{PrimaryListModal-DRCA3QS9.js → PrimaryListModal-ByimAoht.js} +1 -1
  23. package/assets/{StoreSettings-ggmmaFdw.js → StoreSettings-cBFiQNG0.js} +2 -2
  24. package/assets/{Success-BTcAti-s.js → Success-KErTN6A-.js} +1 -1
  25. package/assets/{SwapController-DAWHQ4ok.js → SwapController-BqhWyeug.js} +1 -1
  26. package/assets/{Tooltip-CAVGsqiJ.js → Tooltip-CWYX2BtV.js} +1 -1
  27. package/assets/{TradeService-Bq-E9rL5.js → TradeService-vOc7cmM-.js} +1 -1
  28. package/assets/{W3MFrameProviderSingleton-CO4_1ccR.js → W3MFrameProviderSingleton-bzfGoYP9.js} +3 -3
  29. package/assets/{WebCryptoP256-DHiXQ6Dv.js → WebCryptoP256-0n5GC_Ut.js} +1 -1
  30. package/assets/{authorizations-mnih5q8o.js → authorizations-4HFkBc9K.js} +1 -1
  31. package/assets/{basic-DIfzBgGC.js → basic-BTIll8Fi.js} +1 -1
  32. package/assets/{biconomy-Btr8t9M_.js → biconomy-BW4ch8hb.js} +1 -1
  33. package/assets/{buy-CHyPhIFc.js → buy-Djb-kNlV.js} +1 -1
  34. package/assets/{buy-gasless-DRDa-VRS.js → buy-gasless-Bpg3rjq9.js} +1 -1
  35. package/assets/{cart-checkout-4SY4EejM.js → cart-checkout-C350oS3_.js} +1 -1
  36. package/assets/{categories-7ZUMUxRc.js → categories-DY58IjaQ.js} +1 -1
  37. package/assets/{ccip-DQPPdysF.js → ccip-B_QBYF5J.js} +1 -1
  38. package/assets/{ccip-CKzYrGsq.js → ccip-CeLfuW_O.js} +1 -1
  39. package/assets/collection-CC5CSnLx.js +1 -0
  40. package/assets/{controller-oqfUGC7Q.js → controller-DSyyj9lD.js} +2 -2
  41. package/assets/{core-BnR4IbQF.js → core-BV9Uqx3a.js} +4 -4
  42. package/assets/{custom-LYbOpT74.js → custom-CftAA_1-.js} +1 -1
  43. package/assets/{data-capture-DvxW9LWJ.js → data-capture-BDFC_AAZ.js} +1 -1
  44. package/assets/{email-DblmG_9w.js → email-NQmHVcSX.js} +1 -1
  45. package/assets/{embedded-wallet-BIBD3NXe.js → embedded-wallet-BaACcSds.js} +1 -1
  46. package/assets/emotion-styled.browser.esm-CBmI5nIt.js +1 -0
  47. package/assets/{engine-Q3dlwVZc.js → engine-CJaBRUsg.js} +1 -1
  48. package/assets/{errors-B3Jy0VAJ.js → errors-Cs9fnU9I.js} +1 -1
  49. package/assets/{estimate-l1-fee-DPrAoRm1.js → estimate-l1-fee-Cy1M04Vs.js} +1 -1
  50. package/assets/{execute-GsOG5tOz.js → execute-BuQfuqwm.js} +2 -2
  51. package/assets/{features-BHjaYixx.js → features-DUkOU29X.js} +1 -1
  52. package/assets/{fetchTokenMetadata-CIsTf8qh.js → fetchTokenMetadata-DgDl3_sf.js} +2 -2
  53. package/assets/{get-ecosystem-wallet-info-B8oiqf_g.js → get-ecosystem-wallet-info-CVTh7CfJ.js} +1 -1
  54. package/assets/{getBalance-Q-FuT0Qm.js → getBalance-BIyXRLDy.js} +1 -1
  55. package/assets/{getNFT-DBtyLr3S.js → getNFT-cGRZcqJv.js} +1 -1
  56. package/assets/{getNFT-BonpS0wI.js → getNFT-rv6yBkGa.js} +1 -1
  57. package/assets/{getOverlayAlpha-5GYRyW4x.js → getOverlayAlpha-BFopV-KN.js} +1 -1
  58. package/assets/{hashTypedData-l7BbP1BP.js → hashTypedData-BdsAWz2G.js} +1 -1
  59. package/assets/{hashTypedData-BhuoQuOn.js → hashTypedData-BfzJ0TS-.js} +1 -1
  60. package/assets/{import-a0kWnC35.js → import-DzTakhaX.js} +1 -1
  61. package/assets/{in-app-ESN8W__G.js → in-app-B8isPC0y.js} +1 -1
  62. package/assets/{in-app-wallet-calls-BYj88Ef-.js → in-app-wallet-calls-ClTovWdh.js} +1 -1
  63. package/assets/{index-DiBhVrGy.js → index-1DxtfhSJ.js} +1 -1
  64. package/assets/{index-CNzygfnu.js → index-3d7PO8q_.js} +1 -1
  65. package/assets/{index-BnPeVq62.js → index-4bTa1qff.js} +1 -1
  66. package/assets/{index-BeJqoBti.js → index-6hSJkqDq.js} +1 -1
  67. package/assets/{index-BTUsGa6S.js → index-B1DqMYiX.js} +1 -1
  68. package/assets/{index-L6AnZu2-.js → index-B3cwJw_u.js} +1 -1
  69. package/assets/{index-_zid9pow.js → index-B5Kj0FW_.js} +1 -1
  70. package/assets/{index-DqNB5gIy.js → index-BEIRvEFT.js} +1 -1
  71. package/assets/{index-CDM_k6C9.js → index-BFk849bZ.js} +1 -1
  72. package/assets/{index-BsaSZdou.js → index-BGdPOxCz.js} +1 -1
  73. package/assets/{index-DlCwuyBG.js → index-BOhj5LdJ.js} +1 -1
  74. package/assets/{index-D4JXiKx_.js → index-BOngn0q7.js} +1 -1
  75. package/assets/{index-Np3Taixr.js → index-BP4skMl2.js} +1 -1
  76. package/assets/{index-BDLTpYuD.js → index-BQ4rZ0Kg.js} +1 -1
  77. package/assets/{index-DD7JYX6I.js → index-BZ_-xKre.js} +2 -2
  78. package/assets/{index-DmGRJRWs.js → index-BeFcjOKO.js} +1 -1
  79. package/assets/{index-nccYW6P3.js → index-Bkpu5jNe.js} +1 -1
  80. package/assets/{index-BQMla4xK.js → index-Bvrid8NA.js} +1 -1
  81. package/assets/{index-D_vAUTlU.js → index-BwS7sI1B.js} +1 -1
  82. package/assets/{index-DjtMF_FP.js → index-C4L5vZQw.js} +1 -1
  83. package/assets/{index-DNgvtVPS.js → index-C50En1tW.js} +1 -1
  84. package/assets/{index-Dz17wnbD.js → index-CCFR9hc6.js} +2 -2
  85. package/assets/{index-Cup4Stx2.js → index-CDgxS1kA.js} +1 -1
  86. package/assets/{index-BeGn7EwY.js → index-CFIjjpBo.js} +1 -1
  87. package/assets/{index-CnnU_mLv.js → index-CJlRo57i.js} +1 -1
  88. package/assets/{index-Ctb1grEl.js → index-CPgX0p-K.js} +1 -1
  89. package/assets/{index-u26i2x4Z.js → index-CQ0Ros7W.js} +1 -1
  90. package/assets/{index-B_w7D_1t.js → index-CSgDOfxq.js} +1 -1
  91. package/assets/{index-BZLlD7vv.js → index-CW8mL8-A.js} +1 -1
  92. package/assets/{index-B5qcYwN0.js → index-Cd5420Rq.js} +1 -1
  93. package/assets/{index-BI7O7l1f.js → index-CfltZkIg.js} +3 -3
  94. package/assets/{index-BZcSxyRp.js → index-Ckg159RR.js} +2 -2
  95. package/assets/{index-BJj2KSp_.js → index-D-fHYuz6.js} +1 -1
  96. package/assets/{index-GAPC_47T.js → index-D1kzW8fy.js} +1 -1
  97. package/assets/{index-CcLECkyd.js → index-D5HjNYdn.js} +1 -1
  98. package/assets/{index-CJZmNG9i.js → index-DDIhscgO.js} +1 -1
  99. package/assets/{index-NuJxOSl-.js → index-DDdtoGEi.js} +1 -1
  100. package/assets/{index-DDV0fT7b.js → index-DEMmrYiw.js} +1 -1
  101. package/assets/{index-BYcynwJw.js → index-DFmvL2Cv.js} +1 -1
  102. package/assets/{index-zU9Uj5fP.js → index-DK9SMaUV.js} +3 -3
  103. package/assets/{index-BTNH3ieH.js → index-DLTp8-1W.js} +1 -1
  104. package/assets/{index-B7MM-EDJ.js → index-D_5sPEkx.js} +3 -3
  105. package/assets/{index-BCPi-ClS.js → index-De5ttsh0.js} +2 -2
  106. package/assets/{index-hxYvqItN.js → index-DgI6b_1k.js} +1 -1
  107. package/assets/{index-B-6uQuND.js → index-DqtVIf4M.js} +1 -1
  108. package/assets/{index-DfEfFqPo.js → index-HZG2j8cz.js} +1 -1
  109. package/assets/{index-BU99LwmJ.js → index-Mkx_BzFP.js} +1 -1
  110. package/assets/{index-D2u3qo5-.js → index-P7Sau0I5.js} +15 -15
  111. package/assets/{index-DNIRbQMj.js → index-X_kzACYR.js} +1 -1
  112. package/assets/{index-Cyn8gRvH.js → index-i-9qXVIl.js} +1 -1
  113. package/assets/{index-YTUbuYV5.js → index-kcM3wjmL.js} +2 -2
  114. package/assets/{index-T7BPymVH.js → index-zbbepWkd.js} +1 -1
  115. package/assets/{index.es-CZyih3uZ.js → index.es-BAM5UZfH.js} +4 -4
  116. package/assets/{index.es-BVmvZPLl.js → index.es-BuXQjTmU.js} +1 -1
  117. package/assets/{index.es-DVSJ83NI.js → index.es-CtE5jBFg.js} +1 -1
  118. package/assets/{localBatchGatewayRequest-CjdETprd.js → localBatchGatewayRequest-BmJtIlOK.js} +1 -1
  119. package/assets/{mana-rate-DcCwt7oF.js → mana-rate-DXdP8JQC.js} +1 -1
  120. package/assets/{networks-Gp8grhfL.js → networks-CUafijuQ.js} +1 -1
  121. package/assets/{onramp-DzUZOn5v.js → onramp--Iu6rhXk.js} +1 -1
  122. package/assets/{openzeppelin-Re-ToQ3G.js → openzeppelin-GNxIJhIO.js} +1 -1
  123. package/assets/{parseNft-DvKM3tDX.js → parseNft-BxE7m6kg.js} +2 -2
  124. package/assets/{parseSignature-CTjdilwC.js → parseSignature-BWe0ZDDZ.js} +1 -1
  125. package/assets/{parseSignature-ChGXlmjA.js → parseSignature-DykTAPWJ.js} +3 -3
  126. package/assets/{passkeys-O7R8Skr8.js → passkeys-DHqYP34I.js} +1 -1
  127. package/assets/{pay-with-exchange-CGXWXub_.js → pay-with-exchange-D66UeJj2.js} +1 -1
  128. package/assets/{qr-overlay-DQBJWl2U.js → qr-overlay-C7ZyUZLi.js} +1 -1
  129. package/assets/{receive-amOjcYAx.js → receive-Tu6Iesz3.js} +1 -1
  130. package/assets/{resolveImplementation-CstEI2ba.js → resolveImplementation-CWJsUrAo.js} +1 -1
  131. package/assets/{rpc-ZYSy-eJG.js → rpc-BZZfKitN.js} +1 -1
  132. package/assets/{secp256k1-DADPdC2O.js → secp256k1-C76o0bDB.js} +1 -1
  133. package/assets/{secp256k1-CdMvj0c6.js → secp256k1-CQNFBqGb.js} +1 -1
  134. package/assets/{secp256k1-DfE_4Njp.js → secp256k1-DEWXJb0G.js} +1 -1
  135. package/assets/{send-B9WVOIIy.js → send-OHcFalUD.js} +1 -1
  136. package/assets/{send-batch-transaction-BpIXP8aL.js → send-batch-transaction-BjHqNEHy.js} +1 -1
  137. package/assets/{send-eip712-transaction-C-UOcWS2.js → send-eip712-transaction-Bdiu-MHL.js} +2 -2
  138. package/assets/{send-gasless-transaction-D2HEIqEd.js → send-gasless-transaction-C0KhDzDb.js} +2 -2
  139. package/assets/{send-transaction-rA10MuVm.js → send-transaction-D66Dvp6I.js} +2 -2
  140. package/assets/{sendRawTransaction-FATzwmfZ.js → sendRawTransaction-Cx8JQgbZ.js} +3 -3
  141. package/assets/{serializeTransaction-DixmbC2c.js → serializeTransaction-PO2i8zfn.js} +1 -1
  142. package/assets/{session-proposal-BOIm4XSE.js → session-proposal-U6d-r0h1.js} +1 -1
  143. package/assets/{session-request-c_OnJFO0.js → session-request-BWDFEy4d.js} +2 -2
  144. package/assets/{signing-41DxLyFg.js → signing-647xzxe_.js} +3 -3
  145. package/assets/{socials-BWQzaLAW.js → socials-CSe9kiyp.js} +1 -1
  146. package/assets/{swaps-CivCXKBU.js → swaps-0ZQ3ykaN.js} +1 -1
  147. package/assets/{thirdweb-C8KpcE8I.js → thirdweb-8PhoY169.js} +3 -3
  148. package/assets/{to-serializable-transaction-BWjd1RMk.js → to-serializable-transaction-BosnrISG.js} +2 -2
  149. package/assets/{trade-encoding-CtfVB9K4.js → trade-encoding-DLx_mjRt.js} +1 -1
  150. package/assets/{transactionReceipt-Coqh5oX3.js → transactionReceipt-XOTwrGYa.js} +1 -1
  151. package/assets/{transactions-C7og5tua.js → transactions-D7zvnmjK.js} +1 -1
  152. package/assets/{useCreditPacks-Djg10PxH.js → useCreditPacks-D-Oae9wZ.js} +1 -1
  153. package/assets/{useInfiniteGrid-Cg-FBhvv.js → useInfiniteGrid-DpzTC5bY.js} +1 -1
  154. package/assets/{useStore-Bvj7HKvJ.js → useStore-DDADUZbP.js} +1 -1
  155. package/assets/useTheme-CJjDEqR6.js +1 -0
  156. package/assets/useTheme-Da_Gtdq6.js +1 -0
  157. package/assets/{verifyHash--D25lC81.js → verifyHash-DWxhTdFY.js} +1 -1
  158. package/assets/{w3m-modal-B0pocWlf.js → w3m-modal-Bm1VCEs7.js} +1 -1
  159. package/assets/{w3m-modal-BG_0bUMI.js → w3m-modal-Duh5YevD.js} +1 -1
  160. package/assets/{wait-for-tx-receipt-DxxlAWDR.js → wait-for-tx-receipt-BH0Nmt__.js} +1 -1
  161. package/assets/{wallets-DsPPoviJ.js → wallets-C9WwqLIm.js} +5 -5
  162. package/assets/{web-connector-Brej9YrP.js → web-connector-Djci4K78.js} +3 -3
  163. package/assets/{writeContract-CgNduh80.js → writeContract-hVW1D3JA.js} +1 -1
  164. package/assets/{zoraTestnet-Bc68rMQr.js → zoraTestnet-BdlBNZA4.js} +1 -1
  165. package/index.html +11 -11
  166. package/package.json +2 -2
  167. package/assets/MyAssets-uGWTenCp.js +0 -258
  168. package/assets/collection-LjzTm4kD.js +0 -1
  169. package/assets/emotion-styled.browser.esm-CtG7z_nw.js +0 -1
  170. package/assets/useTheme-BDMGaPba.js +0 -1
  171. package/assets/useTheme-DpYzrDIG.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as l,j as v}from"./react-BrLDncxD.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-29994094833.commit-84e34c2/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-29994094833.commit-84e34c2/assets/DCL_LogoPattern-BryBPc3d.png",U=`
1
+ import{r as l,j as v}from"./react-BrLDncxD.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-29994098968.commit-46a6a0c/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-29994098968.commit-46a6a0c/assets/DCL_LogoPattern-BryBPc3d.png",U=`
2
2
  attribute vec2 a_position;
3
3
  varying vec2 v_uv;
4
4
  void main() {
@@ -1,4 +1,4 @@
1
- import{a as Ke,r as p,j as e,b as Qe}from"./react-BrLDncxD.js";import{c as F,w as Ze,q as Je,L as Xe,s,F as t,d as Te,n as Ye,o as ze,j as Ie,e as et,t as o,I as z,g as B,v as pe,x as D,y as tt,z as nt,u as Ne,G as st,A as K,au as ot,av as it}from"./index-D2u3qo5-.js";import{r as rt,a as at,m as _e}from"./mana-rate-DcCwt7oF.js";import{u as Ae,M as lt}from"./MarketCheckout-BemjD_ML.js";import{g as ct,h as dt,i as ft,j as pt,k as ut,C as xt,l as ht,o as mt,m as gt,n as bt,M as yt}from"./Assets.styles-Dz0IZ5_I.js";import{d as ue,R as wt,F as vt,S as xe,b as jt}from"./categories-7ZUMUxRc.js";import{L as $t}from"./LoadMore-DAM-bEob.js";import{u as Ct}from"./useInfiniteGrid-Cg-FBhvv.js";import{E as kt}from"./ErrorNotice-BDH9xoG4.js";import{d as St}from"./dcl-schemas-BICTSpB5.js";import{u as Rt,G as Et,w as Tt,S as zt}from"./buy-gasless-DRDa-VRS.js";import{s as It}from"./buy-CHyPhIFc.js";import{h as Nt}from"./trade-encoding-CtfVB9K4.js";import{f as _t}from"./errors-B3Jy0VAJ.js";import{J as At,C as Pt,B as ne}from"./ethers-BIvjmL85.js";import{l as Mt}from"./loader-logo-BzY9EKdC.js";import{n as Lt}from"./emotion-CSxEP8yM.js";import"./sentry-DYZXk5O5.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./authorizations-mnih5q8o.js";import"./Tooltip-CAVGsqiJ.js";function Q(n){const i=n.source??"item",f=n.tradeId||`${n.contractAddress}-${n.tokenId??n.itemId??""}`;return`${i}:${f}`}const W="100000000000000000000",Pe=2,V=15,Bt=/^[a-zA-Z0-9]+$/;function he(n){const i=n.trim();return i.length===0?{ok:!1,reason:"empty"}:Bt.test(i)?i.length<Pe?{ok:!1,reason:"too-short"}:i.length>V?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Ft(n){return n.replace(/[^a-zA-Z0-9]/g,"").slice(0,V)}const Wt=["function available(string _subdomain) view returns (bool)"],me={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Ht(){return F.chainId===St.ChainId.MATIC_MAINNET?me.mainnet:me.sepolia}async function Ut(n,i={}){var d;const{rpc:f,address:u}=Ht(),l=new At(f),c=new Pt(u,Wt,l);console.info(`[names] availability check → DCLRegistrar(${u}).available("${n}") on ${f}`);const x=await c.available(n);if((d=i.signal)!=null&&d.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${n}" available=${x}`),x?"available":"taken"}const Ot="https://app.across.to/api";class Me extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function Gt(n){return at(W,n)}async function qt(n,i,f={}){var d;const u=f.chainId??F.chainId,l=f.provider??"across",c=`${F.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(i)}&chainId=${u}&provider=${l}`,x=await Xe(c,{method:"GET",identity:n,metadata:{}});if(!x.ok){let a;try{a=(d=await x.json())==null?void 0:d.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new Me:new Error(`fetchNameCreditRoute ${x.status}`)}return x.json()}function Dt(n,i){const f=ne.from(n.availableAmount),l=ne.from(W).sub(f);return{credits:[{value:n.amount,expiresAt:Number(n.expiresAt),salt:Nt(n.id)}],creditsSignatures:[n.signature],externalCall:{target:i.externalCall.target,selector:i.externalCall.selector,data:i.externalCall.data,expiresAt:i.externalCall.expiresAt,salt:i.externalCall.salt},customExternalCallSignature:i.customExternalCallSignature,maxUncreditedValue:l.isNegative()?"0":l.toString(),maxCreditedValue:W}}async function Vt(n,i={}){const f=Ot,u=i.intervalMs??1e4,l=i.maxAttempts??60;let c={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let x=0;x<l;x++){try{const d=await fetch(`${f}/deposit/status?originChainId=137&depositTxHash=${n}`);if(d.ok){const a=await d.json(),m=(a.status??"pending").toLowerCase(),w=a.fillTx??a.fillTxnRef??null,y=a.actionsSucceeded!==!1;if(m==="filled")return{status:"filled",destinationTxHash:w,actionsSucceeded:y};if(m==="refunded"||m==="expired")return{status:m,destinationTxHash:null,actionsSucceeded:!1};c={status:"pending",destinationTxHash:w,actionsSucceeded:y}}}catch{}x<l-1&&await new Promise(d=>setTimeout(d,u))}return c}async function Kt(n){const{name:i,identity:f,signer:u}=n,l=n.chainId??F.chainId,c=n.provider??"across",x=(n.beneficiary??await u.getAddress()).toLowerCase();let d=null,a=!1;console.info("[names] register start",{name:i,buyer:x,chainId:l,provider:c});try{const m=await rt(l),w=Gt(m);console.info("[names] step 1/6 sized reservation",{usdCents:w,manaRate:m});const y=await qt(f,i,{chainId:l,provider:c});console.info("[names] step 2/6 route fetched",{target:y.externalCall.target,selector:y.externalCall.selector,provider:y.provider,quoteId:y.quoteId});const v=await Ze(f,w);if(d=v.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:v.credit.id,maxCreditedValue:v.maxCreditedValue}),ne.from(v.maxCreditedValue).lt(W))throw new Error("Credit under-sized for the name price");const C=Dt(v.credit,y);let h;try{h=await Rt({chainId:l,buyer:x,signer:u,args:C})}catch(b){if(!(b instanceof Et))throw b;h=await It(l,C,u)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:h}),await Tt(h),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:h}),c==="across"){const b=await Vt(h,n.acrossPoll);if(console.info("[names] step 6/6 across status",b),b.status==="pending")return{status:"pending",originTxHash:h};if(b.status!=="filled"||!b.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:h,destinationTxHash:b.destinationTxHash}}return{status:"pending",originTxHash:h}}catch(m){if(console.error("[names] register failed — raw error:",m,{name:i,buyer:x,originConfirmed:a}),m instanceof zt)return{status:"pending",originTxHash:m.txHash};throw d&&!a&&await Je(f,[d]).catch(()=>{}),m instanceof Me?m:new Error(_t(m,"Couldn't register the name. Please try again.",{sale:!0}))}}const Qt=s.div`
1
+ import{a as Ke,r as p,j as e,b as Qe}from"./react-BrLDncxD.js";import{c as F,w as Ze,q as Je,M as Xe,s,F as t,d as Te,n as Ye,o as ze,j as Ie,e as et,t as o,I as z,g as B,v as pe,x as D,y as tt,z as nt,u as Ne,G as st,A as K,av as ot,aw as it}from"./index-P7Sau0I5.js";import{r as rt,a as at,m as _e}from"./mana-rate-DXdP8JQC.js";import{u as Ae,M as lt}from"./MarketCheckout-Dlac-3dT.js";import{g as ct,h as dt,i as ft,j as pt,k as ut,C as xt,l as ht,o as mt,m as gt,n as bt,M as yt}from"./Assets.styles-JVRlU2lC.js";import{d as ue,R as wt,F as vt,S as xe,b as jt}from"./categories-DY58IjaQ.js";import{L as $t}from"./LoadMore-BFtkV8IC.js";import{u as Ct}from"./useInfiniteGrid-DpzTC5bY.js";import{E as kt}from"./ErrorNotice-BDH9xoG4.js";import{d as St}from"./dcl-schemas-BICTSpB5.js";import{u as Rt,G as Et,w as Tt,S as zt}from"./buy-gasless-Bpg3rjq9.js";import{s as It}from"./buy-Djb-kNlV.js";import{h as Nt}from"./trade-encoding-DLx_mjRt.js";import{f as _t}from"./errors-Cs9fnU9I.js";import{J as At,C as Pt,B as ne}from"./ethers-BIvjmL85.js";import{l as Mt}from"./loader-logo-BzY9EKdC.js";import{n as Lt}from"./emotion-CSxEP8yM.js";import"./sentry-DYZXk5O5.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./authorizations-4HFkBc9K.js";import"./Tooltip-CWYX2BtV.js";function Q(n){const i=n.source??"item",f=n.tradeId||`${n.contractAddress}-${n.tokenId??n.itemId??""}`;return`${i}:${f}`}const W="100000000000000000000",Pe=2,V=15,Bt=/^[a-zA-Z0-9]+$/;function he(n){const i=n.trim();return i.length===0?{ok:!1,reason:"empty"}:Bt.test(i)?i.length<Pe?{ok:!1,reason:"too-short"}:i.length>V?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Ft(n){return n.replace(/[^a-zA-Z0-9]/g,"").slice(0,V)}const Wt=["function available(string _subdomain) view returns (bool)"],me={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Ht(){return F.chainId===St.ChainId.MATIC_MAINNET?me.mainnet:me.sepolia}async function Ut(n,i={}){var d;const{rpc:f,address:u}=Ht(),l=new At(f),c=new Pt(u,Wt,l);console.info(`[names] availability check → DCLRegistrar(${u}).available("${n}") on ${f}`);const x=await c.available(n);if((d=i.signal)!=null&&d.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${n}" available=${x}`),x?"available":"taken"}const Ot="https://app.across.to/api";class Me extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function Gt(n){return at(W,n)}async function qt(n,i,f={}){var d;const u=f.chainId??F.chainId,l=f.provider??"across",c=`${F.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(i)}&chainId=${u}&provider=${l}`,x=await Xe(c,{method:"GET",identity:n,metadata:{}});if(!x.ok){let a;try{a=(d=await x.json())==null?void 0:d.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new Me:new Error(`fetchNameCreditRoute ${x.status}`)}return x.json()}function Dt(n,i){const f=ne.from(n.availableAmount),l=ne.from(W).sub(f);return{credits:[{value:n.amount,expiresAt:Number(n.expiresAt),salt:Nt(n.id)}],creditsSignatures:[n.signature],externalCall:{target:i.externalCall.target,selector:i.externalCall.selector,data:i.externalCall.data,expiresAt:i.externalCall.expiresAt,salt:i.externalCall.salt},customExternalCallSignature:i.customExternalCallSignature,maxUncreditedValue:l.isNegative()?"0":l.toString(),maxCreditedValue:W}}async function Vt(n,i={}){const f=Ot,u=i.intervalMs??1e4,l=i.maxAttempts??60;let c={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let x=0;x<l;x++){try{const d=await fetch(`${f}/deposit/status?originChainId=137&depositTxHash=${n}`);if(d.ok){const a=await d.json(),m=(a.status??"pending").toLowerCase(),w=a.fillTx??a.fillTxnRef??null,y=a.actionsSucceeded!==!1;if(m==="filled")return{status:"filled",destinationTxHash:w,actionsSucceeded:y};if(m==="refunded"||m==="expired")return{status:m,destinationTxHash:null,actionsSucceeded:!1};c={status:"pending",destinationTxHash:w,actionsSucceeded:y}}}catch{}x<l-1&&await new Promise(d=>setTimeout(d,u))}return c}async function Kt(n){const{name:i,identity:f,signer:u}=n,l=n.chainId??F.chainId,c=n.provider??"across",x=(n.beneficiary??await u.getAddress()).toLowerCase();let d=null,a=!1;console.info("[names] register start",{name:i,buyer:x,chainId:l,provider:c});try{const m=await rt(l),w=Gt(m);console.info("[names] step 1/6 sized reservation",{usdCents:w,manaRate:m});const y=await qt(f,i,{chainId:l,provider:c});console.info("[names] step 2/6 route fetched",{target:y.externalCall.target,selector:y.externalCall.selector,provider:y.provider,quoteId:y.quoteId});const v=await Ze(f,w);if(d=v.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:v.credit.id,maxCreditedValue:v.maxCreditedValue}),ne.from(v.maxCreditedValue).lt(W))throw new Error("Credit under-sized for the name price");const C=Dt(v.credit,y);let h;try{h=await Rt({chainId:l,buyer:x,signer:u,args:C})}catch(b){if(!(b instanceof Et))throw b;h=await It(l,C,u)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:h}),await Tt(h),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:h}),c==="across"){const b=await Vt(h,n.acrossPoll);if(console.info("[names] step 6/6 across status",b),b.status==="pending")return{status:"pending",originTxHash:h};if(b.status!=="filled"||!b.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:h,destinationTxHash:b.destinationTxHash}}return{status:"pending",originTxHash:h}}catch(m){if(console.error("[names] register failed — raw error:",m,{name:i,buyer:x,originConfirmed:a}),m instanceof zt)return{status:"pending",originTxHash:m.txHash};throw d&&!a&&await Je(f,[d]).catch(()=>{}),m instanceof Me?m:new Error(_t(m,"Couldn't register the name. Please try again.",{sale:!0}))}}const Qt=s.div`
2
2
  position: fixed;
3
3
  inset: 0;
4
4
  z-index: 10000;
@@ -1,4 +1,4 @@
1
- import{r as y,j as t}from"./react-BrLDncxD.js";import{R as z,a as oe,C as ie,c as ne}from"./categories-7ZUMUxRc.js";import{T as se}from"./Tooltip-CAVGsqiJ.js";import{F as e,s as o,I as m,t as s,G as re,C as v}from"./index-D2u3qo5-.js";import{n as c}from"./emotion-CSxEP8yM.js";const ae=o.div`
1
+ import{r as y,j as t}from"./react-BrLDncxD.js";import{R as z,a as oe,C as ie,c as ne}from"./categories-DY58IjaQ.js";import{T as se}from"./Tooltip-CWYX2BtV.js";import{F as e,s as o,I as m,t as s,G as re,C as v}from"./index-P7Sau0I5.js";import{n as c}from"./emotion-CSxEP8yM.js";const ae=o.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 12px;
@@ -1,4 +1,4 @@
1
- import{j as t,L as R,r as L}from"./react-BrLDncxD.js";import{s as a,B as q,F as e,M as B,u as D,t as i,d as N,e as F,I as x,g as G,m as A,o as H,c as M,J as y,E as Q,H as z}from"./index-D2u3qo5-.js";import{b as K,c as W,s as J,d as O}from"./authorizations-mnih5q8o.js";import{f as P}from"./errors-B3Jy0VAJ.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-iOoE_Tw3.js";const X=B`
1
+ import{j as t,L as R,r as L}from"./react-BrLDncxD.js";import{s as a,B as N,F as e,N as q,u as B,t as i,d as D,e as F,I as x,g as G,m as A,o as H,c as Q,J as y,E as K,H as z}from"./index-P7Sau0I5.js";import{b as M,c as W,s as J,d as O}from"./authorizations-4HFkBc9K.js";import{f as P}from"./errors-Cs9fnU9I.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-iOoE_Tw3.js";const X=q`
2
2
  to { transform: rotate(360deg); }
3
3
  `,U=a.section`
4
4
  width: 100%;
@@ -158,6 +158,6 @@ import{j as t,L as R,r as L}from"./react-BrLDncxD.js";import{s as a,B as q,F as
158
158
  font-size: 22px;
159
159
  font-weight: 700;
160
160
  margin: 6px 0 0;
161
- `,ct=a(q)`
161
+ `,ct=a(N)`
162
162
  margin-top: 12px;
163
- `;function C({descriptor:o,owner:n,signer:l,name:s,description:d,image:r,icon:u}){const T=H(),[m,g]=L.useState(!1),{data:c,isLoading:p,refetch:E}=A({queryKey:["authorization",o.id,n],queryFn:()=>O(o,n),staleTime:3e4});async function I(){if(m||p)return;const h=!c;g(!0);try{await J({auth:o,signer:l,active:h}),await E(),T.setQueryData(["authorization",o.id,n],h),y.success(h?i("authorizations.toastActivated",{name:s}):i("authorizations.toastDeactivated",{name:s}))}catch(f){Q(f,{flow:"authorizations",step:h?"grant":"revoke"}),y.error(P(f,i("authorizations.errorGeneric")))}finally{g(!1)}}const S=p?i("authorizations.checking"):c?i("authorizations.active"):i("authorizations.inactive");return t.jsxs(_,{"data-testid":`authorization-${o.id}`,"data-active":!!c,children:[t.jsx(tt,{children:r?t.jsx("img",{src:r,alt:""}):u}),t.jsxs(it,{children:[t.jsx(ot,{title:s,children:s}),t.jsx(et,{children:d})]}),t.jsxs(st,{children:[t.jsx(at,{"data-active":!!c,children:S}),m?t.jsx(rt,{"aria-label":i("authorizations.working")}):t.jsx(nt,{type:"button","data-testid":`authorization-toggle-${o.id}`,"data-active":!!c,role:"switch","aria-checked":!!c,"aria-label":c?i("authorizations.deactivateAria",{name:s}):i("authorizations.activateAria",{name:s}),disabled:p,onClick:()=>void I()})]})]})}function lt(o){return A({queryKey:["owned-collections",o],enabled:!!o,staleTime:6e4,queryFn:async()=>{const[n,l]=await Promise.all([z(o,{category:"wearable",first:96}),z(o,{category:"emote",first:96})]),s=new Map;for(const d of[...n.assets,...l.assets]){const r=d.contractAddress.toLowerCase();s.has(r)||s.set(r,d)}return[...s.values()]}})}function zt(){D({title:i("authorizations.title"),noindex:!0});const{session:o}=N(),n=M.chainId,l=F(o==null?void 0:o.providerType),{data:s,isLoading:d}=lt(l?o==null?void 0:o.address:void 0);if(!o)return t.jsxs($,{children:[t.jsx(x,{name:"info",size:40,color:"var(--muted-2)"}),t.jsx(k,{children:i("authorizations.signInTitle")}),t.jsx("p",{className:"muted",children:i("authorizations.signInBody")})]});if(!l)return t.jsxs($,{children:[t.jsx(x,{name:"check",size:40,color:"var(--ok)"}),t.jsx(k,{children:i("authorizations.managedTitle")}),t.jsx("p",{className:"muted",children:i("authorizations.managedBody")}),t.jsx(ct,{as:R,to:"/assets",variant:"purple",children:i("authorizations.managedCta")})]});const r=K(n);return t.jsxs(U,{children:[t.jsxs(V,{children:[t.jsx(Y,{children:i("authorizations.title")}),t.jsx(Z,{children:i("authorizations.intro")})]}),t.jsxs(j,{children:[t.jsx(w,{children:i("authorizations.buyingTitle")}),t.jsx(b,{children:t.jsx(C,{descriptor:r,owner:o.address,signer:o.signer,name:i("authorizations.creditsName"),description:i("authorizations.creditsDesc"),icon:t.jsx(G,{className:"ccy-mark"})})})]}),t.jsxs(j,{children:[t.jsx(w,{children:i("authorizations.sellingTitle")}),d?t.jsx(v,{children:i("authorizations.checking")}):s&&s.length>0?t.jsx(b,{children:s.map(u=>t.jsx(C,{descriptor:W(u.contractAddress,n),owner:o.address,signer:o.signer,name:u.name||i("authorizations.collectionFallback"),description:i("authorizations.sellingDesc"),image:u.image,icon:t.jsx(x,{name:"pen",size:18})},u.contractAddress))}):t.jsx(v,{children:i("authorizations.sellingEmpty")})]})]})}export{zt as Authorizations};
163
+ `;function C({descriptor:o,owner:n,signer:l,name:s,description:d,image:r,icon:u}){const T=H(),[m,g]=L.useState(!1),{data:c,isLoading:p,refetch:E}=A({queryKey:["authorization",o.id,n],queryFn:()=>O(o,n),staleTime:3e4});async function I(){if(m||p)return;const h=!c;g(!0);try{await J({auth:o,signer:l,active:h}),await E(),T.setQueryData(["authorization",o.id,n],h),y.success(h?i("authorizations.toastActivated",{name:s}):i("authorizations.toastDeactivated",{name:s}))}catch(f){K(f,{flow:"authorizations",step:h?"grant":"revoke"}),y.error(P(f,i("authorizations.errorGeneric")))}finally{g(!1)}}const S=p?i("authorizations.checking"):c?i("authorizations.active"):i("authorizations.inactive");return t.jsxs(_,{"data-testid":`authorization-${o.id}`,"data-active":!!c,children:[t.jsx(tt,{children:r?t.jsx("img",{src:r,alt:""}):u}),t.jsxs(it,{children:[t.jsx(ot,{title:s,children:s}),t.jsx(et,{children:d})]}),t.jsxs(st,{children:[t.jsx(at,{"data-active":!!c,children:S}),m?t.jsx(rt,{"aria-label":i("authorizations.working")}):t.jsx(nt,{type:"button","data-testid":`authorization-toggle-${o.id}`,"data-active":!!c,role:"switch","aria-checked":!!c,"aria-label":c?i("authorizations.deactivateAria",{name:s}):i("authorizations.activateAria",{name:s}),disabled:p,onClick:()=>void I()})]})]})}function lt(o){return A({queryKey:["owned-collections",o],enabled:!!o,staleTime:6e4,queryFn:async()=>{const[n,l]=await Promise.all([z(o,{category:"wearable",first:96}),z(o,{category:"emote",first:96})]),s=new Map;for(const d of[...n.assets,...l.assets]){const r=d.contractAddress.toLowerCase();s.has(r)||s.set(r,d)}return[...s.values()]}})}function zt(){B({title:i("authorizations.title"),noindex:!0});const{session:o}=D(),n=Q.chainId,l=F(o==null?void 0:o.providerType),{data:s,isLoading:d}=lt(l?o==null?void 0:o.address:void 0);if(!o)return t.jsxs($,{children:[t.jsx(x,{name:"info",size:40,color:"var(--muted-2)"}),t.jsx(k,{children:i("authorizations.signInTitle")}),t.jsx("p",{className:"muted",children:i("authorizations.signInBody")})]});if(!l)return t.jsxs($,{children:[t.jsx(x,{name:"check",size:40,color:"var(--ok)"}),t.jsx(k,{children:i("authorizations.managedTitle")}),t.jsx("p",{className:"muted",children:i("authorizations.managedBody")}),t.jsx(ct,{as:R,to:"/assets",variant:"purple",children:i("authorizations.managedCta")})]});const r=M(n);return t.jsxs(U,{children:[t.jsxs(V,{children:[t.jsx(Y,{children:i("authorizations.title")}),t.jsx(Z,{children:i("authorizations.intro")})]}),t.jsxs(j,{children:[t.jsx(w,{children:i("authorizations.buyingTitle")}),t.jsx(b,{children:t.jsx(C,{descriptor:r,owner:o.address,signer:o.signer,name:i("authorizations.creditsName"),description:i("authorizations.creditsDesc"),icon:t.jsx(G,{className:"ccy-mark"})})})]}),t.jsxs(j,{children:[t.jsx(w,{children:i("authorizations.sellingTitle")}),d?t.jsx(v,{children:i("authorizations.checking")}):s&&s.length>0?t.jsx(b,{children:s.map(u=>t.jsx(C,{descriptor:W(u.contractAddress,n),owner:o.address,signer:o.signer,name:u.name||i("authorizations.collectionFallback"),description:i("authorizations.sellingDesc"),image:u.image,icon:t.jsx(x,{name:"pen",size:18})},u.contractAddress))}):t.jsx(v,{children:i("authorizations.sellingEmpty")})]})]})}export{zt as Authorizations};
@@ -1,3 +1,3 @@
1
- import{j as e,r as y,a as qe,u as Ie,L as se}from"./react-BrLDncxD.js";import{t as a,g as R,j as J,u as Te,ae as v,a as ue,d as Fe,m as Re,n as Ae,o as Be,I as F,h as Le,e as Ue,x as D,ag as he,ah as We,E as U,s as ze,B as $e,C as Ke,w as Qe,q as me,ai as Oe,z as _e,y as Ge,aj as De}from"./index-D2u3qo5-.js";import{a as ye}from"./buy-CHyPhIFc.js";import{a as He,w as Je,S as Ve,G as Ye}from"./buy-gasless-DRDa-VRS.js";import{R as H,r as Xe}from"./cart-checkout-4SY4EejM.js";import{a as Ze}from"./authorizations-mnih5q8o.js";import{u as es,M as ss,c as as}from"./useCreditPacks-Djg10PxH.js";import{W as ts,C as rs,a as cs}from"./CollectionCarousel-D6IuiIc2.js";import{l as ns}from"./loader-logo-BzY9EKdC.js";import{i as os,a as is}from"./errors-B3Jy0VAJ.js";import{E as ls}from"./ErrorNotice-BDH9xoG4.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-CtfVB9K4.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./address-DrURAr9O.js";const ds="https://cdn.decentraland.org/@dcl/shop/0.1.0-29994094833.commit-84e34c2/assets/buy-error-22UunaPC.png";function us(r){const{phase:n,balanceCredits:u,onClose:h}=r,C=n==="processing",w=n==="error"?a("cartCheckout.errorTitle"):n==="nofunds"?a("cartCheckout.titleNoFunds"):a("cartCheckout.titleBuy"),S=n==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:C?void 0:h,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${S?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:w}),!C&&e.jsx("button",{className:"buy-modal__x",onClick:h,"aria-label":a("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:n==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),e.jsx(R,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:J(u)})]})]}),n==="processing"&&e.jsx(hs,{stage:r.stage??"reserving",step:r.step??1,total:r.total??1,isSelfCustody:!!r.isSelfCustody}),n==="nofunds"&&e.jsx(ms,{lines:r.lines??[],shortfallCredits:r.shortfallCredits??0,packs:r.packs??[],selectedPack:r.selectedPack??"",onSelectPack:r.onSelectPack??(()=>{}),onBuyPacks:r.onBuyPacks??(()=>{}),onCancel:h}),n==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:ds,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:a("cartCheckout.errorHeadline")})," ",a("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:h,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:r.onRetry??h,children:a("cartCheckout.tryAgain")})]})]})]})]})}function hs({stage:r,step:n,total:u,isSelfCustody:h}){const C=r==="reserving",w=u>0?Math.min(100,Math.round(n/u*100)):0,S=r==="awaiting-signature"?h?a("buyModal.confirmToContinue"):a("buyModal.completingTransaction"):r==="settling"?a("buyModal.completingTransaction"):a("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:ns,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:S}),C?e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill buy-modal__progress-fill--step",style:{width:`${w}%`}})}),u>1?e.jsxs("span",{className:"cart-checkout__step",children:[n,"/",u]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function ms({lines:r,shortfallCredits:n,packs:u,selectedPack:h,onSelectPack:C,onBuyPacks:w,onCancel:S}){const N=u.find(t=>t.id===h),V=r.reduce((t,m)=>t+(m.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(ts,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,n)})})," ",a("buyModal.warningToPurchase",{count:V})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:r.map(t=>{const m=t.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"buy-modal__asset-name",title:t.item.name,children:[t.item.name||a("buyModal.itemFallback"),m>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:a("cartCheckout.qty",{count:m})}):null]}),t.item.creator?e.jsx(rs,{address:t.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(R,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:J(t.priceCredits*m)})]})]})]},t.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:u.map(t=>{const m=t.id===h;return e.jsxs("button",{className:`buy-modal__pack${m?" buy-modal__pack--on":""}`,onClick:()=>C(t.id),children:[e.jsx(R,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:J(t.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",t.usd.toFixed(2),")"]})]},t.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(R,{className:"buy-modal__total-ico"}),e.jsx("span",{children:J((N==null?void 0:N.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((N==null?void 0:N.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:S,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:w,children:a("buyModal.buy")})]})]})}const _s=ze($e)`
1
+ import{j as e,r as y,a as qe,u as Ie,L as se}from"./react-BrLDncxD.js";import{t as a,g as R,j as J,u as Te,af as v,a as ue,d as Fe,m as Re,n as Ae,o as Be,I as F,h as Le,e as Ue,x as D,ah as he,ai as We,E as U,s as ze,B as $e,C as Ke,w as Qe,q as me,aj as Oe,z as _e,y as Ge,ak as De}from"./index-P7Sau0I5.js";import{a as ye}from"./buy-Djb-kNlV.js";import{a as He,w as Je,S as Ve,G as Ye}from"./buy-gasless-Bpg3rjq9.js";import{R as H,r as Xe}from"./cart-checkout-C350oS3_.js";import{a as Ze}from"./authorizations-4HFkBc9K.js";import{u as es,M as ss,c as as}from"./useCreditPacks-D-Oae9wZ.js";import{W as ts,C as rs,a as cs}from"./CollectionCarousel-Dyw-XZFx.js";import{l as ns}from"./loader-logo-BzY9EKdC.js";import{i as os,a as is}from"./errors-Cs9fnU9I.js";import{E as ls}from"./ErrorNotice-BDH9xoG4.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-DLx_mjRt.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./address-DrURAr9O.js";const ds="https://cdn.decentraland.org/@dcl/shop/0.1.0-29994098968.commit-46a6a0c/assets/buy-error-22UunaPC.png";function us(r){const{phase:n,balanceCredits:u,onClose:h}=r,C=n==="processing",w=n==="error"?a("cartCheckout.errorTitle"):n==="nofunds"?a("cartCheckout.titleNoFunds"):a("cartCheckout.titleBuy"),S=n==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:C?void 0:h,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${S?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:w}),!C&&e.jsx("button",{className:"buy-modal__x",onClick:h,"aria-label":a("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:n==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),e.jsx(R,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:J(u)})]})]}),n==="processing"&&e.jsx(hs,{stage:r.stage??"reserving",step:r.step??1,total:r.total??1,isSelfCustody:!!r.isSelfCustody}),n==="nofunds"&&e.jsx(ms,{lines:r.lines??[],shortfallCredits:r.shortfallCredits??0,packs:r.packs??[],selectedPack:r.selectedPack??"",onSelectPack:r.onSelectPack??(()=>{}),onBuyPacks:r.onBuyPacks??(()=>{}),onCancel:h}),n==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:ds,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:a("cartCheckout.errorHeadline")})," ",a("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:h,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:r.onRetry??h,children:a("cartCheckout.tryAgain")})]})]})]})]})}function hs({stage:r,step:n,total:u,isSelfCustody:h}){const C=r==="reserving",w=u>0?Math.min(100,Math.round(n/u*100)):0,S=r==="awaiting-signature"?h?a("buyModal.confirmToContinue"):a("buyModal.completingTransaction"):r==="settling"?a("buyModal.completingTransaction"):a("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:ns,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:S}),C?e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill buy-modal__progress-fill--step",style:{width:`${w}%`}})}),u>1?e.jsxs("span",{className:"cart-checkout__step",children:[n,"/",u]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function ms({lines:r,shortfallCredits:n,packs:u,selectedPack:h,onSelectPack:C,onBuyPacks:w,onCancel:S}){const N=u.find(t=>t.id===h),V=r.reduce((t,m)=>t+(m.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(ts,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,n)})})," ",a("buyModal.warningToPurchase",{count:V})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:r.map(t=>{const m=t.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"buy-modal__asset-name",title:t.item.name,children:[t.item.name||a("buyModal.itemFallback"),m>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:a("cartCheckout.qty",{count:m})}):null]}),t.item.creator?e.jsx(rs,{address:t.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(R,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:J(t.priceCredits*m)})]})]})]},t.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:u.map(t=>{const m=t.id===h;return e.jsxs("button",{className:`buy-modal__pack${m?" buy-modal__pack--on":""}`,onClick:()=>C(t.id),children:[e.jsx(R,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:J(t.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",t.usd.toFixed(2),")"]})]},t.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(R,{className:"buy-modal__total-ico"}),e.jsx("span",{children:J((N==null?void 0:N.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((N==null?void 0:N.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:S,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:w,children:a("buyModal.buy")})]})]})}const _s=ze($e)`
2
2
  margin-top: 12px;
3
3
  `;function pe(r){if(os(r))return a("errors.rejected");const n=(r.message??"").toLowerCase();return n.includes("insufficient")?a("cart.error.insufficient",{currency:Ke.name}):n.includes("no active listing")||n.includes("your own listing")?a("cart.error.listingChanged"):a("marketCheckout.error.generic")}const ys=12e4;function ps(r){const n=[];return r.unavailable.length&&n.push(a("cart.drop.unavailable",{count:r.unavailable.length})),r.own.length&&n.push(a("cart.drop.own",{count:r.own.length})),a("cart.drop.removed",{items:n.join(` ${a("cart.drop.and")} `)})}const be=r=>r.reduce((n,u)=>n+u.priceCredits*u.quantity,0),bs=r=>r.flatMap(n=>Array.from({length:n.quantity},()=>({...n,quantity:1})));function As(){Te({title:a("nav.cart"),noindex:!0});const r=v(s=>s.items),n=v(s=>s.remove),u=v(s=>s.increment),h=v(s=>s.decrement),C=v(s=>s.clear),w=v(s=>s.restore),S=v(s=>s.setFittingOpen),N=ue(s=>s.items),V=ue(s=>s.toggle),{session:t}=Fe(),m=es().packs.slice(0,ss);y.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const ge=r.some(s=>s.category!=="emote"),{data:Y}=Re({queryKey:["upsell-listings"],queryFn:()=>De({first:40}),staleTime:6e4}),{data:A}=Ae(t),W=Be(),z=qe(),{state:M}=Ie(),[ae,B]=y.useState(null),[fe,E]=y.useState(null),[te,$]=y.useState(null),[xe,P]=y.useState(!1),[f,L]=y.useState(null),re=y.useRef(0),[l,j]=y.useState(null),[X,ce]=y.useState(""),Z=y.useRef(null),je=r.reduce((s,c)=>s+c.priceCredits*c.quantity,0),ne=r.reduce((s,c)=>s+c.quantity,0),ke=f?f.liveTotalCredits:je,ve=new Set(r.map(s=>s.id)),oe=((Y==null?void 0:Y.items)??[]).filter(s=>!ve.has(s.id)).slice(0,12),Ce=new Map(f==null?void 0:f.buyable.map(s=>[s.item.id,s])),K=(A==null?void 0:A.credits)??0,Ne=We;function Q(s){s(),L(null),$(null),E(null)}function we(){j(null),P(!1)}function ie(s){const c=be(s),o=Math.max(0,c-K),p=m.find(d=>d.credits>=o)??m[m.length-1];ce(p.id),D("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:c,credits_balance:K,shortfall:o}),j({phase:"nofunds",lines:s.map(d=>({item:d.item,priceCredits:d.priceCredits,quantity:d.quantity})),shortfall:o}),P(!1)}async function Se(s){if(!t||s.length===0)return;const c=bs(s),o=c.map(i=>({...i.item,priceCredits:i.priceCredits})),p=s.map(i=>({...i.item,priceCredits:i.priceCredits,quantity:i.quantity})),d=[];let k="authorize",G=!1;j({phase:"processing",stage:"reserving",step:1,total:c.length});try{const i=[];for(let x=0;x<c.length;x++){const T=c[x];j({phase:"processing",stage:"reserving",step:x+1,total:c.length});try{const{credit:_,maxCreditedValue:ee}=await Qe(t.identity,T.usdCents,T.trade.id);d.push(_.id),i.push({trade:T.trade,credits:[_],maxCreditedValue:ee})}catch(_){if(is(_)){if(d.length){try{await me(t.identity,d)}catch(ee){U(ee,{flow:"cart_checkout",step:"release"})}W.invalidateQueries({queryKey:["usd-balance"]})}ie(s);return}throw _}}k="submit";const b=()=>j({phase:"processing",stage:"settling",step:c.length,total:c.length});j({phase:"processing",stage:"awaiting-signature",step:c.length,total:c.length});let g=[];if(Ze())try{g=await He({purchases:i,buyer:t.address,signer:t.signer,onSigned:b});const T=(await Promise.allSettled(g.map(_=>Je(_)))).flatMap(_=>_.status==="rejected"?[_.reason]:[]);if(T.length&&!T.some(_=>_ instanceof Ve))throw T[0];G=!0}catch(x){if(!(x instanceof Ye))throw x;g=await ye({purchases:i,buyer:t.address,signer:t.signer,onSigned:b})}else g=await ye({purchases:i,buyer:t.address,signer:t.signer});s.forEach(x=>n(x.item.id)),L(null),D("Shop Completed Purchase",{...Oe(o),payment_type:"credits",no_crypto_step:G,transaction_hash:g[0]??null}),W.invalidateQueries({queryKey:["usd-balance"]});const I=Z.current;Z.current=null,j(null),P(!1);const Pe={items:p,txHash:g[0]??void 0,settled:!0,...I?{creditsAdded:I}:{}};z("/success",{state:Pe,replace:!0})}catch(i){if(_e(i)||U(i,{flow:"cart_checkout",step:k,cart_size:s.length}),D(_e(i)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:k,error_code:Ge(i),value_usd:he(o.reduce((b,g)=>b+g.priceCredits,0)),cart_size:c.length}),d.length){try{await me(t.identity,d)}catch(b){U(b,{flow:"cart_checkout",step:"release"})}W.invalidateQueries({queryKey:["usd-balance"]})}j({phase:"error",message:pe(i)})}}function le(s){const c=be(s);if(A!=null&&A.credits<c){ie(s);return}Se(s)}async function O(){if(!t){E(a("buyModal.signInToCheckout"));return}const s=v.getState().items;if(s.length===0)return;E(null),$(null),P(!0);const c=s.reduce((o,p)=>o+p.priceCredits*p.quantity,0);D("Shop Started Checkout",{cart_size:s.length,cart_value_credits:c,cart_value_usd:he(c),has_sufficient_credits:K>=c});try{B(a("cart.status.reviewing"));const o=await Xe(s,t.address,Ne),p=[...o.unavailable,...o.own];if(p.length&&(p.forEach(d=>n(d.id)),$(ps(o))),o.buyable.length===0){E(a("cart.error.noneAvailable")),L(null),B(null);return}if(o.orderChanged){L(o),re.current=Date.now(),B(null);return}B(null),le(o.buyable)}catch(o){U(o,{flow:"cart_checkout",step:"review",cart_size:s.length}),E(pe(o)),B(null)}finally{P(!1)}}async function Me(){if(f){if(!t){E(a("buyModal.signInToCheckout"));return}if(Date.now()-re.current>ys){L(null),$(null),await O();return}E(null),le(f.buyable)}}async function Ee(){if(X){try{sessionStorage.setItem(H,JSON.stringify(v.getState().items))}catch{}P(!0);try{const s=await as(X,t?{address:t.address,identity:t.identity}:void 0);if(s.url){window.location.href=s.url;return}z("/credits")}catch(s){try{sessionStorage.removeItem(H)}catch{}U(s,{flow:"cart_buy_credits"}),j({phase:"error",message:a("buyModal.error.creditsCheckout")})}finally{P(!1)}}}const de=y.useRef(!1);y.useEffect(()=>{if(!(M!=null&&M.resumeCheckout)||de.current)return;de.current=!0,Z.current=M.creditsAdded??null;try{const c=sessionStorage.getItem(H);if(c){sessionStorage.removeItem(H);const o=JSON.parse(c);Array.isArray(o)&&o.length&&w(o)}}catch{}W.invalidateQueries({queryKey:["usd-balance"]});const s=setTimeout(()=>void O(),0);return()=>clearTimeout(s)},[M==null?void 0:M.resumeCheckout]);const q=xe||(l==null?void 0:l.phase)==="processing";return r.length===0&&!l?e.jsxs("div",{className:"cart cart--empty",children:[e.jsx(F,{name:"cart",size:44,color:"var(--muted-2)"}),e.jsx("p",{className:"cart-empty__title",children:a("cart.empty.title")}),e.jsx("p",{className:"muted",children:a("cart.empty.body")}),e.jsx(_s,{as:se,to:"/assets",variant:"purple",children:a("cart.empty.cta")})]}):e.jsxs("div",{className:"checkout",children:[e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>z(-1),type:"button",children:[e.jsx(F,{name:"arrow-left"}),a("nav.cart")]}),e.jsxs("div",{className:"checkout__body",children:[e.jsxs("div",{className:"checkout__left",children:[e.jsxs("div",{className:"checkout__head-card",children:[e.jsx("button",{className:"checkout__panel-back",onClick:()=>z(-1),type:"button","aria-label":a("cart.goBack"),children:e.jsx(F,{name:"arrow-left"})}),e.jsx("h1",{className:"checkout__panel-title",children:a("cart.panelTitle",{count:ne})}),ge?e.jsxs("button",{className:"checkout__fitting",onClick:()=>S(!0),disabled:q,children:[e.jsx(F,{name:"fitting-room"}),a("cart.fittingRoom")]}):null]}),e.jsxs("section",{className:"checkout__panel",children:[e.jsx("div",{className:"checkout__list",children:r.map(s=>{const c=Ce.get(s.id),o=c?c.priceCredits:s.priceCredits,p=!!c&&c.priceCredits!==s.priceCredits,d=!s.tokenId,k=s.quantity,G=typeof s.available=="number"&&k>=s.available,i=o*k,b=!!N[s.id],g=s.tokenId??s.itemId,I=s.contractAddress&&g?`/item/${s.contractAddress}/${g}`:null;return e.jsxs("div",{className:"checkout__card",children:[e.jsxs("div",{className:"checkout__thumb",children:[I?e.jsx(se,{className:"checkout__thumb-link",to:I,state:{item:s,tradeId:s.tradeId},"aria-label":s.name,children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null}):s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null,e.jsx("span",{className:"checkout__thumb-check","aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"checkout__info",children:[e.jsxs("div",{className:"checkout__desc",children:[I?e.jsx(se,{className:"checkout__name",to:I,state:{item:s,tradeId:s.tradeId},title:s.name,children:s.name}):e.jsx("div",{className:"checkout__name",title:s.name,children:s.name}),s.creator?e.jsx(Le,{address:s.creator,className:"checkout__creator",linkToProfile:!0}):null]}),e.jsxs("div",{className:"checkout__foot",children:[d?e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>Q(()=>h(s.id)),disabled:q||k<=1,"aria-label":a("cart.decreaseQuantity",{name:s.name}),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx("span",{className:"checkout__qty",children:k}),e.jsx("button",{className:"checkout__step",onClick:()=>Q(()=>u(s.id)),disabled:q||G,"aria-label":a("cart.increaseQuantity"),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null,e.jsxs("div",{className:"checkout__price",children:[e.jsx(R,{className:"checkout__price-ico"})," ",i,p?e.jsx("span",{className:"checkout__price-was",children:s.priceCredits*k}):null]})]})]}),e.jsxs("div",{className:"checkout__actions",children:[e.jsx("button",{className:`checkout__fav${b?" is-on":""}`,onClick:()=>V(s),"aria-label":b?a("cart.removeFromFavorites",{name:s.name}):a("cart.addToFavorites",{name:s.name}),title:b?a("assetCard.removeFromFavorites"):a("assetCard.addToFavorites"),children:e.jsx(F,{name:b?"heart-solid":"heart"})}),e.jsx("button",{className:"checkout__remove",onClick:()=>Q(()=>n(s.id)),disabled:q,"aria-label":a("cart.remove",{name:s.name}),title:a("cart.removeTitle"),children:e.jsx(F,{name:"trash",size:24})})]})]},s.id)})}),e.jsx("div",{className:"checkout__utils",children:e.jsx("button",{className:"link",onClick:()=>Q(C),disabled:q,children:a("cart.clearCart")})})]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:a("cart.purchaseSummary")}),e.jsxs("div",{className:"checkout__summary-body",children:[e.jsxs("div",{className:"checkout__total-line",children:[e.jsx("span",{className:"checkout__total-label",children:a("cart.totalItems",{count:ne})}),e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(R,{className:"checkout__total-ico"})," ",ke]})]}),e.jsx("button",{className:"checkout__cta",onClick:()=>void(f?Me():O()),disabled:q,children:q?a("cart.working"):f?a("marketCheckout.confirmPurchase"):a("assetCard.buyNow")}),f?e.jsx("p",{className:"muted checkout__msg",children:a("cart.priceChanged")}):null,te?e.jsx("p",{className:"muted checkout__msg",children:te}):null,ae?e.jsx("p",{className:"muted checkout__msg",children:ae}):null,e.jsx(ls,{message:fe,className:"checkout__msg"})]})]})]})]}),oe.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(cs,{title:a("cart.youMightAlsoLike"),items:oe})}):null,l?e.jsx(us,{phase:l.phase,balanceCredits:K,onClose:we,stage:l.phase==="processing"?l.stage:void 0,step:l.phase==="processing"?l.step:void 0,total:l.phase==="processing"?l.total:void 0,isSelfCustody:Ue(t==null?void 0:t.providerType),lines:l.phase==="nofunds"?l.lines:void 0,shortfallCredits:l.phase==="nofunds"?l.shortfall:void 0,packs:m,selectedPack:X,onSelectPack:ce,onBuyPacks:()=>void Ee(),message:l.phase==="error"?l.message:void 0,onRetry:()=>void O()}):null]})}export{As as Cart};
@@ -1,4 +1,4 @@
1
- import{N,O as U,P as w,Q as z,R as o,S as E,U as c,V as I,W as g,X as D,M}from"./index-D2u3qo5-.js";import{r as W,j as v}from"./react-BrLDncxD.js";function F(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const K=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,S,b,$;const t=44,V=M(P||(P=l`
1
+ import{O as N,P as U,Q as w,R as z,S as o,U as E,V as c,W as I,X as g,Y as D,N as R}from"./index-P7Sau0I5.js";import{r as W,j as v}from"./react-BrLDncxD.js";function F(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const K=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,S,b,$;const t=44,V=R(P||(P=l`
2
2
  0% {
3
3
  transform: rotate(0deg);
4
4
  }
@@ -6,7 +6,7 @@ import{N,O as U,P as w,Q as z,R as o,S as E,U as c,V as I,W as g,X as D,M}from".
6
6
  100% {
7
7
  transform: rotate(360deg);
8
8
  }
9
- `)),B=M(S||(S=l`
9
+ `)),B=R(S||(S=l`
10
10
  0% {
11
11
  stroke-dasharray: 1px, 200px;
12
12
  stroke-dashoffset: 0;
@@ -25,4 +25,4 @@ import{N,O as U,P as w,Q as z,R as o,S as E,U as c,V as I,W as g,X as D,M}from".
25
25
  animation: ${0} 1.4s linear infinite;
26
26
  `),V)),O=g("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(r,e)=>e.svg})({display:"block"}),Q=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
- `),B)),q=W.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,K),n=o({},a,{color:u,disableShrink:R,size:m,thickness:i,value:p,variant:k}),f=G(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(L,o({className:E(f.root,d),style:o({width:m,height:m},x,_),ownerState:n,ref:s,role:"progressbar"},y,j,{children:v.jsx(O,{className:f.svg,ownerState:n,viewBox:`${t/2} ${t/2} ${t} ${t}`,children:v.jsx(Q,{className:f.circle,style:h,ownerState:n,cx:t,cy:t,r:(t-i)/2,fill:"none",strokeWidth:i})})}))});export{q as C};
28
+ `),B)),Z=W.forwardRef(function(e,s){const a=w({props:e,name:"MuiCircularProgress"}),{className:d,color:u="primary",disableShrink:M=!1,size:m=40,style:_,thickness:i=3.6,value:p=0,variant:k="indeterminate"}=a,j=z(a,K),n=o({},a,{color:u,disableShrink:M,size:m,thickness:i,value:p,variant:k}),f=G(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(L,o({className:E(f.root,d),style:o({width:m,height:m},x,_),ownerState:n,ref:s,role:"progressbar"},y,j,{children:v.jsx(O,{className:f.svg,ownerState:n,viewBox:`${t/2} ${t/2} ${t} ${t}`,children:v.jsx(Q,{className:f.circle,style:h,ownerState:n,cx:t,cy:t,r:(t-i)/2,fill:"none",strokeWidth:i})})}))});export{Z as C};
@@ -1,4 +1,4 @@
1
- import{j as e,r as p,d as Q,a as Y}from"./react-BrLDncxD.js";import{F as N,s as v,ak as Z,I as J,t,c as V,E as W,m as X,u as ee,A as ae,ao as te,C as re,ap as se}from"./index-D2u3qo5-.js";import{E as oe}from"./ErrorNotice-BDH9xoG4.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-LjzTm4kD.js";import{u as de}from"./useStore-Bvj7HKvJ.js";import{s as E}from"./address-DrURAr9O.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-7ZUMUxRc.js";import{L as xe}from"./LoadMore-DAM-bEob.js";import{u as he}from"./useInfiniteGrid-Cg-FBhvv.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";const be=v.section`
1
+ import{j as e,r as p,d as Q,a as Y}from"./react-BrLDncxD.js";import{F as N,s as v,al as Z,I as J,t,c as V,E as W,m as X,u as ee,A as ae,ap as te,C as re,aq as se}from"./index-P7Sau0I5.js";import{E as oe}from"./ErrorNotice-BDH9xoG4.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-CC5CSnLx.js";import{u as de}from"./useStore-DDADUZbP.js";import{s as E}from"./address-DrURAr9O.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-DY58IjaQ.js";import{L as xe}from"./LoadMore-BFtkV8IC.js";import{u as he}from"./useInfiniteGrid-DpzTC5bY.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";const be=v.section`
2
2
  position: relative;
3
3
  border-radius: ${N.radius.card};
4
4
  overflow: hidden;
@@ -1 +1 @@
1
- import{j as e,r as o}from"./react-BrLDncxD.js";import{ak as b,G as N,t as n,I as E,al as _,A as W}from"./index-D2u3qo5-.js";import{s as A}from"./address-DrURAr9O.js";function M({address:c,className:i}){const{data:l}=b(c),s=l!=null&&l.name?N(l.name):A(c);return e.jsx("div",{className:i,children:n("search.byCreator",{name:s})})}function P({className:c}){return e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:c,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"#691fa9",strokeWidth:"1.8"}),e.jsx("path",{d:"M12 7v6",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"16.5",r:"1.1",fill:"#691fa9"})]})}function z({title:c,items:i,onViewAll:l}){const s=o.useRef(null),[d,v]=o.useState(1),[h,j]=o.useState(0),[g,k]=o.useState(!0),[p,C]=o.useState(!1),a=o.useCallback(()=>{const r=s.current;if(!r)return;const{scrollLeft:t,scrollWidth:f,clientWidth:u}=r,x=Math.max(1,Math.ceil(f/u));v(x),j(Math.min(x-1,Math.round(t/u))),k(t<=1),C(t+u>=f-1)},[]);if(o.useEffect(()=>{a();const r=s.current;if(r)return r.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a),()=>{r.removeEventListener("scroll",a),window.removeEventListener("resize",a)}},[a,i.length]),i.length===0)return null;function m(r){const t=s.current;t&&t.scrollBy({left:r*t.clientWidth,behavior:"smooth"})}function w(r){const t=s.current;t&&t.scrollTo({left:r*t.clientWidth,behavior:"smooth"})}return e.jsxs("section",{className:"collection-carousel",children:[e.jsxs("div",{className:"collection-carousel__head",children:[e.jsx("h2",{className:"collection-carousel__title",children:c}),l?e.jsxs("button",{className:"collection-carousel__viewall",onClick:l,children:[n("collectionCarousel.viewAll"),e.jsx(E,{name:"chevron-down",size:16,className:"collection-carousel__viewall-ico"})]}):null]}),e.jsxs("div",{className:"collection-carousel__viewport",children:[e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--left",onClick:()=>m(-1),"aria-label":n("collectionCarousel.scrollLeft"),disabled:g,children:e.jsx("img",{src:_,alt:"","aria-hidden":!0})}),e.jsx("div",{className:"collection-carousel__track",ref:s,children:i.map(r=>e.jsx(W,{item:r},r.id))}),e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>m(1),"aria-label":n("collectionCarousel.scrollRight"),disabled:p,children:e.jsx("img",{src:_,alt:"","aria-hidden":!0})})]}),d>1?e.jsx("div",{className:"collection-carousel__dots","aria-label":n("collectionCarousel.pages"),children:Array.from({length:d}).map((r,t)=>e.jsx("button",{className:`collection-carousel__dot${t===h?" is-active":""}`,"aria-label":n("collectionCarousel.goToPage",{page:t+1}),"aria-current":t===h?"true":void 0,onClick:()=>w(t)},t))}):null]})}export{M as C,P as W,z as a};
1
+ import{j as e,r as o}from"./react-BrLDncxD.js";import{al as b,G as N,t as n,I as E,am as _,A as W}from"./index-P7Sau0I5.js";import{s as A}from"./address-DrURAr9O.js";function M({address:c,className:i}){const{data:l}=b(c),s=l!=null&&l.name?N(l.name):A(c);return e.jsx("div",{className:i,children:n("search.byCreator",{name:s})})}function P({className:c}){return e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:c,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"#691fa9",strokeWidth:"1.8"}),e.jsx("path",{d:"M12 7v6",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"16.5",r:"1.1",fill:"#691fa9"})]})}function z({title:c,items:i,onViewAll:l}){const s=o.useRef(null),[d,v]=o.useState(1),[h,j]=o.useState(0),[g,p]=o.useState(!0),[k,C]=o.useState(!1),a=o.useCallback(()=>{const r=s.current;if(!r)return;const{scrollLeft:t,scrollWidth:f,clientWidth:u}=r,x=Math.max(1,Math.ceil(f/u));v(x),j(Math.min(x-1,Math.round(t/u))),p(t<=1),C(t+u>=f-1)},[]);if(o.useEffect(()=>{a();const r=s.current;if(r)return r.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a),()=>{r.removeEventListener("scroll",a),window.removeEventListener("resize",a)}},[a,i.length]),i.length===0)return null;function m(r){const t=s.current;t&&t.scrollBy({left:r*t.clientWidth,behavior:"smooth"})}function w(r){const t=s.current;t&&t.scrollTo({left:r*t.clientWidth,behavior:"smooth"})}return e.jsxs("section",{className:"collection-carousel",children:[e.jsxs("div",{className:"collection-carousel__head",children:[e.jsx("h2",{className:"collection-carousel__title",children:c}),l?e.jsxs("button",{className:"collection-carousel__viewall",onClick:l,children:[n("collectionCarousel.viewAll"),e.jsx(E,{name:"chevron-down",size:16,className:"collection-carousel__viewall-ico"})]}):null]}),e.jsxs("div",{className:"collection-carousel__viewport",children:[e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--left",onClick:()=>m(-1),"aria-label":n("collectionCarousel.scrollLeft"),disabled:g,children:e.jsx("img",{src:_,alt:"","aria-hidden":!0})}),e.jsx("div",{className:"collection-carousel__track",ref:s,children:i.map(r=>e.jsx(W,{item:r},r.id))}),e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>m(1),"aria-label":n("collectionCarousel.scrollRight"),disabled:k,children:e.jsx("img",{src:_,alt:"","aria-hidden":!0})})]}),d>1?e.jsx("div",{className:"collection-carousel__dots","aria-label":n("collectionCarousel.pages"),children:Array.from({length:d}).map((r,t)=>e.jsx("button",{className:`collection-carousel__dot${t===h?" is-active":""}`,"aria-label":n("collectionCarousel.goToPage",{page:t+1}),"aria-current":t===h?"true":void 0,onClick:()=>w(t)},t))}):null]})}export{M as C,P as W,z as a};
@@ -1 +1 @@
1
- import{a as K,j as e,L as re,d as se,b as te,r as N}from"./react-BrLDncxD.js";import{aq as oe,ar as ce,h as le,t as a,as as E,B as ne,ak as D,d as ie,I,c as de,u as me,A as ue,aj as he,at as ge,C as xe}from"./index-D2u3qo5-.js";import{d as _e,g as pe,a as je,A as Ne}from"./collection-LjzTm4kD.js";import{u as be,L as fe}from"./useStore-Bvj7HKvJ.js";import{s as O}from"./address-DrURAr9O.js";import{d as $,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-7ZUMUxRc.js";import{L as B}from"./LoadMore-DAM-bEob.js";import{u as R}from"./useInfiniteGrid-Cg-FBhvv.js";import{E as T}from"./ErrorNotice-BDH9xoG4.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";function Pe({collection:t,cover:r,itemCount:o}){const n=K(),{contractAddress:m,name:g,creator:x}=t,j=r==null||o==null,{data:i}=oe(m,j),p=r==null?(i==null?void 0:i.items)??[]:[],h=o??(i==null?void 0:i.total);function _(){n(`/collection/${m}`)}return e.jsxs("article",{className:"coll-card",role:"link",tabIndex:0,onClick:_,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),_())},children:[e.jsx("div",{className:"coll-card__media",children:r?e.jsx("img",{className:"coll-card__img","data-testid":"coll-card-img",src:r,alt:"",loading:"lazy"}):p.length>0?e.jsx(ce,{items:p,className:"coll-card__cover"}):null}),e.jsxs("div",{className:"coll-card__body",children:[e.jsx("h3",{className:"coll-card__name",title:g,children:g}),e.jsxs("div",{className:"coll-card__meta",children:[x?e.jsx(le,{address:x,className:"coll-card__creator",linkToProfile:!0}):e.jsx("span",{className:"coll-card__creator",children:" "}),e.jsx("span",{className:"coll-card__count",children:h==null?"…":a("collectionCard.itemCount",{count:h})})]}),e.jsx("button",{className:"coll-card__view",onClick:d=>{d.stopPropagation(),_()},tabIndex:-1,children:a("collectionCard.viewCollection")})]})]})}function Se({address:t,className:r=""}){const o=E(m=>m.followed.includes(t.toLowerCase())),n=E(m=>m.toggle);return t?e.jsx(ne,{type:"button",size:"sm",variant:o?"ghost":"outline",className:r||void 0,"aria-pressed":o,title:o?a("creator.unfollowTitle"):a("creator.followTitle"),onClick:()=>n(t),children:o?a("creator.following"):a("creator.follow")}):null}const ye={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function Le({address:t}){var d,b;const{data:r}=D(t),{data:o}=be(t),n=ie(l=>{var f;return(f=l.session)==null?void 0:f.address}),m=!!n&&n.toLowerCase()===t.toLowerCase(),g=(r==null?void 0:r.name)||O(t),x=(b=(d=r==null?void 0:r.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,j=(o==null?void 0:o.cover)||_e,i=o==null?void 0:o.description,p=`${de.profileUrl}/${t}`,h=fe.filter(l=>o==null?void 0:o.links[l]),_=pe(je({name:r==null?void 0:r.name,hasClaimedName:r==null?void 0:r.hasClaimedName,ethAddress:(r==null?void 0:r.ethAddress)??t}));return e.jsxs("section",{className:"creator-hero","aria-label":`${g} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:j,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link","data-testid":"creator-hero-link",href:(o==null?void 0:o.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:a(`creator.link.${l}`),"aria-label":a(`creator.link.${l}`),children:e.jsx(I,{name:ye[l]})},l)),m&&e.jsx(re,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:a("creator.editStore"),"aria-label":a("creator.editStore"),children:e.jsx(I,{name:"pen"})})]}),e.jsxs("div",{className:"creator-hero__body",children:[x?e.jsx("img",{className:"creator-hero__ava",src:x,alt:"",loading:"eager",style:{backgroundColor:_}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:_}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:g}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view","data-testid":"creator-hero-view",href:p,target:"_blank",rel:"noopener noreferrer",children:a("creator.viewProfile")}),e.jsx(Se,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function Ge(){const{address:t}=se(),r=K(),[o]=te(),n=o.has("collections"),{data:m}=D(t),g=(m==null?void 0:m.name)||(t?O(t):a("creator.fallbackName"));me({title:g,description:a("seo.creator.description",{name:g})});const[x,j]=N.useState("wearable"),[i,p]=N.useState(null),[h,_]=N.useState([]),[d,b]=N.useState(""),[l,f]=N.useState(""),[P,z]=N.useState("newest"),S=d&&!Number.isNaN(Number(d))?Number(d):void 0,y=l&&!Number.isNaN(Number(l))?Number(l):void 0,G=i?ke[i]:void 0,H=($.find(s=>s.key===P)??$[0]).server,L={creator:t,category:x,rarities:h.length?h:void 0,wearableCategories:G,minPriceCredits:S,maxPriceCredits:y,sortBy:H},{items:v,total:Y,isLoading:C,error:A,hasNextPage:q,isFetchingNextPage:F,fetchNextPage:W}=R(["creator-listings",L],s=>he({...L,first:U,skip:s}),{enabled:!!t&&!n}),u=R(["creator-collections",t],s=>ge(t,{first:U,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!t&&n});function Z(s){j(s),p(null),n&&M()}function M(){const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}`:""},{replace:!0})}function J(){if(n){M();return}const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function Q(s){_(c=>c.includes(s)?c.filter(ae=>ae!==s):[...c,s])}function V(){j("wearable"),p(null),_([]),b(""),f("")}const k=!!(S||y),X=k?`${d||"0"}–${l||"∞"}`:a("filter.price"),ee=x!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":a("creator.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:a("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:g})]}),t?e.jsx(Le,{address:t}):null,!n&&!C&&v.length>0?e.jsx(Ne,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(ve,{category:x,subCategory:i,onCategory:Z,onSub:p,title:a("creator.category"),flat:!0,collections:n,onCollections:J})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":a("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(Pe,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:a("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{rarities:h,onToggleRarity:Q,sort:P,onSort:z,total:Y,loading:C,anyActive:ee,onClear:V,renderTrailing:s=>e.jsx(we,{panelKey:"price",label:X,active:k,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMin"),placeholder:a("creator.priceMinPlaceholder"),value:d,onChange:c=>b(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMax"),placeholder:a("creator.priceMaxPlaceholder"),value:l,onChange:c=>f(c.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:a("creator.priceHint",{currency:xe.name})})]})})}),A?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid",children:C?e.jsx(w,{count:15}):e.jsxs(e.Fragment,{children:[v.map(s=>e.jsx(ue,{item:s},s.id)),F?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:q,isFetching:F,onLoadMore:()=>void W()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:a("creator.empty")}):null]})})]})]})}export{Ge as Creator,Ge as default};
1
+ import{a as K,j as e,L as re,d as se,b as te,r as j}from"./react-BrLDncxD.js";import{ar as oe,as as ce,h as le,t as a,at as E,B as ne,al as D,d as ie,I,c as de,u as me,A as ue,ak as he,au as ge,C as xe}from"./index-P7Sau0I5.js";import{d as _e,g as pe,a as Ne,A as je}from"./collection-CC5CSnLx.js";import{u as be,L as fe}from"./useStore-DDADUZbP.js";import{s as O}from"./address-DrURAr9O.js";import{d as $,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-DY58IjaQ.js";import{L as B}from"./LoadMore-BFtkV8IC.js";import{u as R}from"./useInfiniteGrid-DpzTC5bY.js";import{E as T}from"./ErrorNotice-BDH9xoG4.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";function Pe({collection:t,cover:r,itemCount:o}){const n=K(),{contractAddress:m,name:g,creator:x}=t,N=r==null||o==null,{data:i}=oe(m,N),p=r==null?(i==null?void 0:i.items)??[]:[],h=o??(i==null?void 0:i.total);function _(){n(`/collection/${m}`)}return e.jsxs("article",{className:"coll-card",role:"link",tabIndex:0,onClick:_,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),_())},children:[e.jsx("div",{className:"coll-card__media",children:r?e.jsx("img",{className:"coll-card__img","data-testid":"coll-card-img",src:r,alt:"",loading:"lazy"}):p.length>0?e.jsx(ce,{items:p,className:"coll-card__cover"}):null}),e.jsxs("div",{className:"coll-card__body",children:[e.jsx("h3",{className:"coll-card__name",title:g,children:g}),e.jsxs("div",{className:"coll-card__meta",children:[x?e.jsx(le,{address:x,className:"coll-card__creator",linkToProfile:!0}):e.jsx("span",{className:"coll-card__creator",children:" "}),e.jsx("span",{className:"coll-card__count",children:h==null?"…":a("collectionCard.itemCount",{count:h})})]}),e.jsx("button",{className:"coll-card__view",onClick:d=>{d.stopPropagation(),_()},tabIndex:-1,children:a("collectionCard.viewCollection")})]})]})}function Se({address:t,className:r=""}){const o=E(m=>m.followed.includes(t.toLowerCase())),n=E(m=>m.toggle);return t?e.jsx(ne,{type:"button",size:"sm",variant:o?"ghost":"outline",className:r||void 0,"aria-pressed":o,title:o?a("creator.unfollowTitle"):a("creator.followTitle"),onClick:()=>n(t),children:o?a("creator.following"):a("creator.follow")}):null}const ye={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function Le({address:t}){var d,b;const{data:r}=D(t),{data:o}=be(t),n=ie(l=>{var f;return(f=l.session)==null?void 0:f.address}),m=!!n&&n.toLowerCase()===t.toLowerCase(),g=(r==null?void 0:r.name)||O(t),x=(b=(d=r==null?void 0:r.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,N=(o==null?void 0:o.cover)||_e,i=o==null?void 0:o.description,p=`${de.profileUrl}/${t}`,h=fe.filter(l=>o==null?void 0:o.links[l]),_=pe(Ne({name:r==null?void 0:r.name,hasClaimedName:r==null?void 0:r.hasClaimedName,ethAddress:(r==null?void 0:r.ethAddress)??t}));return e.jsxs("section",{className:"creator-hero","aria-label":`${g} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:N,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link","data-testid":"creator-hero-link",href:(o==null?void 0:o.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:a(`creator.link.${l}`),"aria-label":a(`creator.link.${l}`),children:e.jsx(I,{name:ye[l]})},l)),m&&e.jsx(re,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:a("creator.editStore"),"aria-label":a("creator.editStore"),children:e.jsx(I,{name:"pen"})})]}),e.jsxs("div",{className:"creator-hero__body",children:[x?e.jsx("img",{className:"creator-hero__ava",src:x,alt:"",loading:"eager",style:{backgroundColor:_}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:_}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:g}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view","data-testid":"creator-hero-view",href:p,target:"_blank",rel:"noopener noreferrer",children:a("creator.viewProfile")}),e.jsx(Se,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function Ge(){const{address:t}=se(),r=K(),[o]=te(),n=o.has("collections"),{data:m}=D(t),g=(m==null?void 0:m.name)||(t?O(t):a("creator.fallbackName"));me({title:g,description:a("seo.creator.description",{name:g})});const[x,N]=j.useState("wearable"),[i,p]=j.useState(null),[h,_]=j.useState([]),[d,b]=j.useState(""),[l,f]=j.useState(""),[P,z]=j.useState("newest"),S=d&&!Number.isNaN(Number(d))?Number(d):void 0,y=l&&!Number.isNaN(Number(l))?Number(l):void 0,G=i?ke[i]:void 0,H=($.find(s=>s.key===P)??$[0]).server,L={creator:t,category:x,rarities:h.length?h:void 0,wearableCategories:G,minPriceCredits:S,maxPriceCredits:y,sortBy:H},{items:v,total:Y,isLoading:C,error:A,hasNextPage:W,isFetchingNextPage:F,fetchNextPage:Z}=R(["creator-listings",L],s=>he({...L,first:U,skip:s}),{enabled:!!t&&!n}),u=R(["creator-collections",t],s=>ge(t,{first:U,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!t&&n});function q(s){N(s),p(null),n&&M()}function M(){const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}`:""},{replace:!0})}function J(){if(n){M();return}const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function Q(s){_(c=>c.includes(s)?c.filter(ae=>ae!==s):[...c,s])}function V(){N("wearable"),p(null),_([]),b(""),f("")}const k=!!(S||y),X=k?`${d||"0"}–${l||"∞"}`:a("filter.price"),ee=x!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":a("creator.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:a("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:g})]}),t?e.jsx(Le,{address:t}):null,!n&&!C&&v.length>0?e.jsx(je,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(ve,{category:x,subCategory:i,onCategory:q,onSub:p,title:a("creator.category"),flat:!0,collections:n,onCollections:J})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":a("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(Pe,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:a("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{rarities:h,onToggleRarity:Q,sort:P,onSort:z,total:Y,loading:C,anyActive:ee,onClear:V,renderTrailing:s=>e.jsx(we,{panelKey:"price",label:X,active:k,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMin"),placeholder:a("creator.priceMinPlaceholder"),value:d,onChange:c=>b(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMax"),placeholder:a("creator.priceMaxPlaceholder"),value:l,onChange:c=>f(c.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:a("creator.priceHint",{currency:xe.name})})]})})}),A?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid",children:C?e.jsx(w,{count:15}):e.jsxs(e.Fragment,{children:[v.map(s=>e.jsx(ue,{item:s},s.id)),F?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:W,isFetching:F,onLoadMore:()=>void Z()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:a("creator.empty")}):null]})})]})]})}export{Ge as Creator,Ge as default};
@@ -1,4 +1,4 @@
1
- import{b7 as U,b8 as Ue,R as C,b9 as qe,ba as Ye,$ as Qe,bb as Je,aW as Xe,Q as R,a$ as K,a_ as Te,bc as a,bd as Ze,be as Le,T as et,b5 as tt}from"./index-D2u3qo5-.js";import{R as rt,g as ot}from"./getOverlayAlpha-5GYRyW4x.js";import{j as T,r as y}from"./react-BrLDncxD.js";import{u as nt,a as Be}from"./useTheme-BDMGaPba.js";function ne(r){const o=Ue(r);return r!==o&&o.styles?(o.styles.match(/^@layer\s+[^{]*$/)||(o.styles=`@layer global{${o.styles}}`),o):r}function at({styles:r,themeId:o,defaultTheme:n={}}){const i=nt(n),s=o&&i[o]||i;let l=typeof r=="function"?r(s):r;return s.modularCssLayers&&(Array.isArray(l)?l=l.map(d=>ne(typeof d=="function"?d(s):d)):l=ne(l)),T.jsx(U,{styles:l})}const Ee=y.createContext(null);function se(){return y.useContext(Ee)}const it=typeof Symbol=="function"&&Symbol.for,st=it?Symbol.for("mui.nested"):"__THEME_NESTED__";function lt(r,o){return typeof o=="function"?o(r):C({},r,o)}function ct(r){const{children:o,theme:n}=r,i=se(),s=y.useMemo(()=>{const l=i===null?n:lt(i,n);return l!=null&&(l[st]=i!==null),l},[n,i]);return T.jsx(Ee.Provider,{value:s,children:o})}function dt(r){const o=Be(),n=qe()||"",{modularCssLayers:i}=r;let s="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!i||o!==null?s="":typeof i=="string"?s=i.replace(/mui(?!\.)/g,s):s=`@layer ${s};`,Ye(()=>{const l=document.querySelector("head");if(!l)return;const d=l.firstChild;if(s){var m;if(d&&(m=d.hasAttribute)!=null&&m.call(d,"data-mui-layer-order")&&d.getAttribute("data-mui-layer-order")===n)return;const S=document.createElement("style");S.setAttribute("data-mui-layer-order",n),S.textContent=s,l.prepend(S)}else{var f;(f=l.querySelector(`style[data-mui-layer-order="${n}"]`))==null||f.remove()}},[s,n]),s?T.jsx(at,{styles:s}):null}const $e={};function xe(r,o,n,i=!1){return y.useMemo(()=>{const s=r&&o[r]||o;if(typeof n=="function"){const l=n(s),d=r?C({},o,{[r]:l}):l;return i?()=>d:d}return r?C({},o,{[r]:n}):C({},o,n)},[r,o,n,i])}function ut(r){const{children:o,theme:n,themeId:i}=r,s=Be($e),l=se()||$e,d=xe(i,s,n),m=xe(i,l,n,!0),f=d.direction==="rtl",S=dt(d);return T.jsx(ct,{theme:m,children:T.jsx(Qe.Provider,{value:d,children:T.jsx(rt,{value:f,children:T.jsxs(Je,{value:d==null?void 0:d.components,children:[S,o]})})})})}const le="mode",ce="color-scheme",Ie="data-color-scheme";function mt(r){const{defaultMode:o="light",defaultLightColorScheme:n="light",defaultDarkColorScheme:i="dark",modeStorageKey:s=le,colorSchemeStorageKey:l=ce,attribute:d=Ie,colorSchemeNode:m="document.documentElement",nonce:f}=r||{};return T.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?f:"",dangerouslySetInnerHTML:{__html:`(function() {
1
+ import{b8 as U,b9 as Ue,S as C,ba as qe,bb as Ye,a0 as Qe,bc as Xe,aX as Je,R as W,b0 as K,a$ as Te,bd as a,be as Ze,bf as Le,T as et,b6 as tt}from"./index-P7Sau0I5.js";import{R as rt,g as ot}from"./getOverlayAlpha-BFopV-KN.js";import{j as T,r as y}from"./react-BrLDncxD.js";import{u as nt,a as Be}from"./useTheme-Da_Gtdq6.js";function ne(r){const o=Ue(r);return r!==o&&o.styles?(o.styles.match(/^@layer\s+[^{]*$/)||(o.styles=`@layer global{${o.styles}}`),o):r}function at({styles:r,themeId:o,defaultTheme:n={}}){const i=nt(n),s=o&&i[o]||i;let l=typeof r=="function"?r(s):r;return s.modularCssLayers&&(Array.isArray(l)?l=l.map(d=>ne(typeof d=="function"?d(s):d)):l=ne(l)),T.jsx(U,{styles:l})}const Ee=y.createContext(null);function se(){return y.useContext(Ee)}const it=typeof Symbol=="function"&&Symbol.for,st=it?Symbol.for("mui.nested"):"__THEME_NESTED__";function lt(r,o){return typeof o=="function"?o(r):C({},r,o)}function ct(r){const{children:o,theme:n}=r,i=se(),s=y.useMemo(()=>{const l=i===null?n:lt(i,n);return l!=null&&(l[st]=i!==null),l},[n,i]);return T.jsx(Ee.Provider,{value:s,children:o})}function dt(r){const o=Be(),n=qe()||"",{modularCssLayers:i}=r;let s="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!i||o!==null?s="":typeof i=="string"?s=i.replace(/mui(?!\.)/g,s):s=`@layer ${s};`,Ye(()=>{const l=document.querySelector("head");if(!l)return;const d=l.firstChild;if(s){var m;if(d&&(m=d.hasAttribute)!=null&&m.call(d,"data-mui-layer-order")&&d.getAttribute("data-mui-layer-order")===n)return;const S=document.createElement("style");S.setAttribute("data-mui-layer-order",n),S.textContent=s,l.prepend(S)}else{var f;(f=l.querySelector(`style[data-mui-layer-order="${n}"]`))==null||f.remove()}},[s,n]),s?T.jsx(at,{styles:s}):null}const $e={};function xe(r,o,n,i=!1){return y.useMemo(()=>{const s=r&&o[r]||o;if(typeof n=="function"){const l=n(s),d=r?C({},o,{[r]:l}):l;return i?()=>d:d}return r?C({},o,{[r]:n}):C({},o,n)},[r,o,n,i])}function ut(r){const{children:o,theme:n,themeId:i}=r,s=Be($e),l=se()||$e,d=xe(i,s,n),m=xe(i,l,n,!0),f=d.direction==="rtl",S=dt(d);return T.jsx(ct,{theme:m,children:T.jsx(Qe.Provider,{value:d,children:T.jsx(rt,{value:f,children:T.jsxs(Xe,{value:d==null?void 0:d.components,children:[S,o]})})})})}const le="mode",ce="color-scheme",Ie="data-color-scheme";function mt(r){const{defaultMode:o="light",defaultLightColorScheme:n="light",defaultDarkColorScheme:i="dark",modeStorageKey:s=le,colorSchemeStorageKey:l=ce,attribute:d=Ie,colorSchemeNode:m="document.documentElement",nonce:f}=r||{};return T.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?f:"",dangerouslySetInnerHTML:{__html:`(function() {
2
2
  try {
3
3
  var mode = localStorage.getItem('${s}') || '${o}';
4
4
  var colorScheme = '';
@@ -20,5 +20,5 @@ try {
20
20
  if (colorScheme) {
21
21
  ${m}.setAttribute('${d}', colorScheme);
22
22
  }
23
- } catch(e){}})();`}},"mui-color-scheme-init")}function Ae(r){if(typeof window<"u"&&r==="system")return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Me(r,o){if(r.mode==="light"||r.mode==="system"&&r.systemMode==="light")return o("light");if(r.mode==="dark"||r.mode==="system"&&r.systemMode==="dark")return o("dark")}function ft(r){return Me(r,o=>{if(o==="light")return r.lightColorScheme;if(o==="dark")return r.darkColorScheme})}function ae(r,o){if(typeof window>"u")return;let n;try{n=localStorage.getItem(r)||void 0,n||localStorage.setItem(r,o)}catch{}return n||o}function ht(r){const{defaultMode:o="light",defaultLightColorScheme:n,defaultDarkColorScheme:i,supportedColorSchemes:s=[],modeStorageKey:l=le,colorSchemeStorageKey:d=ce,storageWindow:m=typeof window>"u"?void 0:window}=r,f=s.join(","),[S,b]=y.useState(()=>{const h=ae(l,o),c=ae(`${d}-light`,n),g=ae(`${d}-dark`,i);return{mode:h,systemMode:Ae(h),lightColorScheme:c,darkColorScheme:g}}),A=ft(S),M=y.useCallback(h=>{b(c=>{if(h===c.mode)return c;const g=h??o;try{localStorage.setItem(l,g)}catch{}return C({},c,{mode:g,systemMode:Ae(g)})})},[l,o]),v=y.useCallback(h=>{h?typeof h=="string"?h&&!f.includes(h)?console.error(`\`${h}\` does not exist in \`theme.colorSchemes\`.`):b(c=>{const g=C({},c);return Me(c,w=>{try{localStorage.setItem(`${d}-${w}`,h)}catch{}w==="light"&&(g.lightColorScheme=h),w==="dark"&&(g.darkColorScheme=h)}),g}):b(c=>{const g=C({},c),w=h.light===null?n:h.light,L=h.dark===null?i:h.dark;if(w)if(!f.includes(w))console.error(`\`${w}\` does not exist in \`theme.colorSchemes\`.`);else{g.lightColorScheme=w;try{localStorage.setItem(`${d}-light`,w)}catch{}}if(L)if(!f.includes(L))console.error(`\`${L}\` does not exist in \`theme.colorSchemes\`.`);else{g.darkColorScheme=L;try{localStorage.setItem(`${d}-dark`,L)}catch{}}return g}):b(c=>{try{localStorage.setItem(`${d}-light`,n),localStorage.setItem(`${d}-dark`,i)}catch{}return C({},c,{lightColorScheme:n,darkColorScheme:i})})},[f,d,n,i]),k=y.useCallback(h=>{S.mode==="system"&&b(c=>{const g=h!=null&&h.matches?"dark":"light";return c.systemMode===g?c:C({},c,{systemMode:g})})},[S.mode]),$=y.useRef(k);return $.current=k,y.useEffect(()=>{const h=(...g)=>$.current(...g),c=window.matchMedia("(prefers-color-scheme: dark)");return c.addListener(h),h(c),()=>{c.removeListener(h)}},[]),y.useEffect(()=>{if(m){const h=c=>{const g=c.newValue;typeof c.key=="string"&&c.key.startsWith(d)&&(!g||f.match(g))&&(c.key.endsWith("light")&&v({light:g}),c.key.endsWith("dark")&&v({dark:g})),c.key===l&&(!g||["light","dark","system"].includes(g))&&M(g||o)};return m.addEventListener("storage",h),()=>{m.removeEventListener("storage",h)}}},[v,M,l,d,f,o,m]),C({},S,{colorScheme:A,setMode:M,setColorScheme:v})}const gt=["colorSchemes","components","generateCssVars","cssVarPrefix"],pt="*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";function St(r){const{themeId:o,theme:n={},attribute:i=Ie,modeStorageKey:s=le,colorSchemeStorageKey:l=ce,defaultMode:d="light",defaultColorScheme:m,disableTransitionOnChange:f=!1,resolveTheme:S,excludeVariablesFromRoot:b}=r;(!n.colorSchemes||typeof m=="string"&&!n.colorSchemes[m]||typeof m=="object"&&!n.colorSchemes[m==null?void 0:m.light]||typeof m=="object"&&!n.colorSchemes[m==null?void 0:m.dark])&&console.error(`MUI: \`${m}\` does not exist in \`theme.colorSchemes\`.`);const A=y.createContext(void 0),M=()=>{const c=y.useContext(A);if(!c)throw new Error(Xe(19));return c};function v(c){const{children:g,theme:w=n,modeStorageKey:L=s,colorSchemeStorageKey:B=l,attribute:e=i,defaultMode:u=d,defaultColorScheme:p=m,disableTransitionOnChange:_=f,storageWindow:q=typeof window>"u"?void 0:window,documentNode:j=typeof document>"u"?void 0:document,colorSchemeNode:Y=typeof document>"u"?void 0:document.documentElement,colorSchemeSelector:N=":root",disableNestedContext:je=!1,disableStyleSheetGeneration:Pe=!1}=c,Q=y.useRef(!1),de=se(),J=y.useContext(A),X=!!J&&!je,ue=w[o],me=ue||w,{colorSchemes:Z={},components:Ve={},generateCssVars:fe=()=>({vars:{},css:{}}),cssVarPrefix:ee}=me,Fe=R(me,gt),te=Object.keys(Z),he=typeof p=="string"?p:p.light,ge=typeof p=="string"?p:p.dark,{mode:Oe,setMode:pe,systemMode:Se,lightColorScheme:Ce,darkColorScheme:ye,colorScheme:Ge,setColorScheme:ve}=ht({supportedColorSchemes:te,defaultLightColorScheme:he,defaultDarkColorScheme:ge,modeStorageKey:L,colorSchemeStorageKey:B,defaultMode:u,storageWindow:q});let O=Oe,P=Ge;X&&(O=J.mode,P=J.colorScheme);const We=O||(u==="system"?d:u),Re=P||(We==="dark"?ge:he),{css:Ke,vars:be}=fe(),D=C({},Fe,{components:Ve,colorSchemes:Z,cssVarPrefix:ee,vars:be,getColorSchemeSelector:x=>`[${e}="${x}"] &`}),re={},ke={};Object.entries(Z).forEach(([x,V])=>{const{css:z,vars:Ne}=fe(x);D.vars=K(D.vars,Ne),x===Re&&(Object.keys(V).forEach(E=>{V[E]&&typeof V[E]=="object"?D[E]=C({},D[E],V[E]):D[E]=V[E]}),D.palette&&(D.palette.colorScheme=x));const ze=typeof p=="string"?p:u==="dark"?p.dark:p.light;if(x===ze){if(b){const E={};b(ee).forEach(oe=>{E[oe]=z[oe],delete z[oe]}),re[`[${e}="${x}"]`]=E}re[`${N}, [${e}="${x}"]`]=z}else ke[`${N===":root"?"":N}[${e}="${x}"]`]=z}),D.vars=K(D.vars,be),y.useEffect(()=>{P&&Y&&Y.setAttribute(e,P)},[P,e,Y]),y.useEffect(()=>{let x;if(_&&Q.current&&j){const V=j.createElement("style");V.appendChild(j.createTextNode(pt)),j.head.appendChild(V),window.getComputedStyle(j.body),x=setTimeout(()=>{j.head.removeChild(V)},1)}return()=>{clearTimeout(x)}},[P,_,j]),y.useEffect(()=>(Q.current=!0,()=>{Q.current=!1}),[]);const He=y.useMemo(()=>({allColorSchemes:te,colorScheme:P,darkColorScheme:ye,lightColorScheme:Ce,mode:O,setColorScheme:ve,setMode:pe,systemMode:Se}),[te,P,ye,Ce,O,ve,pe,Se]);let _e=!0;(Pe||X&&(de==null?void 0:de.cssVarPrefix)===ee)&&(_e=!1);const we=T.jsxs(y.Fragment,{children:[_e&&T.jsxs(y.Fragment,{children:[T.jsx(U,{styles:{[N]:Ke}}),T.jsx(U,{styles:re}),T.jsx(U,{styles:ke})]}),T.jsx(ut,{themeId:ue?o:void 0,theme:S?S(D):D,children:g})]});return X?we:T.jsx(A.Provider,{value:He,children:we})}const k=typeof m=="string"?m:m.light,$=typeof m=="string"?m:m.dark;return{CssVarsProvider:v,useColorScheme:M,getInitColorSchemeScript:c=>mt(C({attribute:i,colorSchemeStorageKey:l,defaultMode:d,defaultLightColorScheme:k,defaultDarkColorScheme:$,modeStorageKey:s},c))}}function Ct(r=""){function o(...i){if(!i.length)return"";const s=i[0];return typeof s=="string"&&!s.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${r?`${r}-`:""}${s}${o(...i.slice(1))})`:`, ${s}`}return(i,...s)=>`var(--${r?`${r}-`:""}${i}${o(...s)})`}const De=(r,o,n,i=[])=>{let s=r;o.forEach((l,d)=>{d===o.length-1?Array.isArray(s)?s[Number(l)]=n:s&&typeof s=="object"&&(s[l]=n):s&&typeof s=="object"&&(s[l]||(s[l]=i.includes(l)?[]:{}),s=s[l])})},yt=(r,o,n)=>{function i(s,l=[],d=[]){Object.entries(s).forEach(([m,f])=>{(!n||n&&!n([...l,m]))&&f!=null&&(typeof f=="object"&&Object.keys(f).length>0?i(f,[...l,m],Array.isArray(f)?[...d,m]:d):o([...l,m],f,d))})}i(r)},vt=(r,o)=>typeof o=="number"?["lineHeight","fontWeight","opacity","zIndex"].some(i=>r.includes(i))||r[r.length-1].toLowerCase().indexOf("opacity")>=0?o:`${o}px`:o;function ie(r,o){const{prefix:n,shouldSkipGeneratingVar:i}=o||{},s={},l={},d={};return yt(r,(m,f,S)=>{if((typeof f=="string"||typeof f=="number")&&(!i||!i(m,f))){const b=`--${n?`${n}-`:""}${m.join("-")}`;Object.assign(s,{[b]:vt(m,f)}),De(l,m,`var(${b})`,S),De(d,m,`var(${b}, ${f})`,S)}},m=>m[0]==="vars"),{css:s,vars:l,varsWithDefaults:d}}function H(r){"@babel/helpers - typeof";return H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},H(r)}function bt(r,o){if(H(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var i=n.call(r,o);if(H(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function kt(r){var o=bt(r,"string");return H(o)=="symbol"?o:o+""}const _t=["colorSchemes","components","defaultColorScheme"];function wt(r,o){const{colorSchemes:n={},defaultColorScheme:i="light"}=r,s=R(r,_t),{vars:l,css:d,varsWithDefaults:m}=ie(s,o);let f=m;const S={},{[i]:b}=n,A=R(n,[i].map(kt));if(Object.entries(A||{}).forEach(([v,k])=>{const{vars:$,css:h,varsWithDefaults:c}=ie(k,o);f=K(f,c),S[v]={css:h,vars:$}}),b){const{css:v,vars:k,varsWithDefaults:$}=ie(b,o);f=K(f,$),S[i]={css:v,vars:k}}return{vars:f,generateCssVars:v=>{var k;if(!v){var $;const c=C({},d);return{css:c,vars:l,selector:(o==null||($=o.getSelector)==null?void 0:$.call(o,v,c))||":root"}}const h=C({},S[v].css);return{css:h,vars:S[v].vars,selector:(o==null||(k=o.getSelector)==null?void 0:k.call(o,v,h))||":root"}}}}function Tt(r){var o;return!!r[0].match(/(cssVarPrefix|typography|mixins|breakpoints|direction|transitions)/)||!!r[0].match(/sxConfig$/)||r[0]==="palette"&&!!((o=r[1])!=null&&o.match(/(mode|contrastThreshold|tonalOffset)/))}const $t=["colorSchemes","cssVarPrefix","shouldSkipGeneratingVar"],xt=["palette"],At=[...Array(25)].map((r,o)=>{if(o===0)return;const n=ot(o);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function Dt(r,o){o.forEach(n=>{r[n]||(r[n]={})})}function t(r,o,n){!r[o]&&n&&(r[o]=n)}function W(r){return!r||!r.startsWith("hsl")?r:a.hslToRgb(r)}function F(r,o){`${o}Channel`in r||(r[`${o}Channel`]=a.private_safeColorChannel(W(r[o]),`MUI: Can't create \`palette.${o}Channel\` because \`palette.${o}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
24
- To suppress this warning, you need to explicitly provide the \`palette.${o}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}const I=r=>{try{return r()}catch{}},Lt=(r="mui")=>Ct(r);function Bt(r={},...o){var n,i,s,l,d,m;const{colorSchemes:f={},cssVarPrefix:S="mui",shouldSkipGeneratingVar:b=Tt}=r,A=R(r,$t),M=Lt(S),v=Te(C({},A,f.light&&{palette:(n=f.light)==null?void 0:n.palette})),{palette:k}=v,$=R(v,xt),{palette:h}=Te({palette:C({mode:"dark"},(i=f.dark)==null?void 0:i.palette)});let c=C({},$,{cssVarPrefix:S,getCssVar:M,colorSchemes:C({},f,{light:C({},f.light,{palette:k,opacity:C({inputPlaceholder:.42,inputUnderline:.42,switchTrackDisabled:.12,switchTrack:.38},(s=f.light)==null?void 0:s.opacity),overlays:((l=f.light)==null?void 0:l.overlays)||[]}),dark:C({},f.dark,{palette:h,opacity:C({inputPlaceholder:.5,inputUnderline:.7,switchTrackDisabled:.2,switchTrack:.3},(d=f.dark)==null?void 0:d.opacity),overlays:((m=f.dark)==null?void 0:m.overlays)||At})})});Object.keys(c.colorSchemes).forEach(B=>{const e=c.colorSchemes[B].palette,u=p=>{const _=p.split("-"),q=_[1],j=_[2];return M(p,e[q][j])};if(B==="light"?(t(e.common,"background","#fff"),t(e.common,"onBackground","#000")):(t(e.common,"background","#000"),t(e.common,"onBackground","#fff")),Dt(e,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),B==="light"){t(e.Alert,"errorColor",a.private_safeDarken(e.error.light,.6)),t(e.Alert,"infoColor",a.private_safeDarken(e.info.light,.6)),t(e.Alert,"successColor",a.private_safeDarken(e.success.light,.6)),t(e.Alert,"warningColor",a.private_safeDarken(e.warning.light,.6)),t(e.Alert,"errorFilledBg",u("palette-error-main")),t(e.Alert,"infoFilledBg",u("palette-info-main")),t(e.Alert,"successFilledBg",u("palette-success-main")),t(e.Alert,"warningFilledBg",u("palette-warning-main")),t(e.Alert,"errorFilledColor",I(()=>k.getContrastText(e.error.main))),t(e.Alert,"infoFilledColor",I(()=>k.getContrastText(e.info.main))),t(e.Alert,"successFilledColor",I(()=>k.getContrastText(e.success.main))),t(e.Alert,"warningFilledColor",I(()=>k.getContrastText(e.warning.main))),t(e.Alert,"errorStandardBg",a.private_safeLighten(e.error.light,.9)),t(e.Alert,"infoStandardBg",a.private_safeLighten(e.info.light,.9)),t(e.Alert,"successStandardBg",a.private_safeLighten(e.success.light,.9)),t(e.Alert,"warningStandardBg",a.private_safeLighten(e.warning.light,.9)),t(e.Alert,"errorIconColor",u("palette-error-main")),t(e.Alert,"infoIconColor",u("palette-info-main")),t(e.Alert,"successIconColor",u("palette-success-main")),t(e.Alert,"warningIconColor",u("palette-warning-main")),t(e.AppBar,"defaultBg",u("palette-grey-100")),t(e.Avatar,"defaultBg",u("palette-grey-400")),t(e.Button,"inheritContainedBg",u("palette-grey-300")),t(e.Button,"inheritContainedHoverBg",u("palette-grey-A100")),t(e.Chip,"defaultBorder",u("palette-grey-400")),t(e.Chip,"defaultAvatarColor",u("palette-grey-700")),t(e.Chip,"defaultIconColor",u("palette-grey-700")),t(e.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),t(e.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),t(e.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),t(e.LinearProgress,"primaryBg",a.private_safeLighten(e.primary.main,.62)),t(e.LinearProgress,"secondaryBg",a.private_safeLighten(e.secondary.main,.62)),t(e.LinearProgress,"errorBg",a.private_safeLighten(e.error.main,.62)),t(e.LinearProgress,"infoBg",a.private_safeLighten(e.info.main,.62)),t(e.LinearProgress,"successBg",a.private_safeLighten(e.success.main,.62)),t(e.LinearProgress,"warningBg",a.private_safeLighten(e.warning.main,.62)),t(e.Skeleton,"bg",`rgba(${u("palette-text-primaryChannel")} / 0.11)`),t(e.Slider,"primaryTrack",a.private_safeLighten(e.primary.main,.62)),t(e.Slider,"secondaryTrack",a.private_safeLighten(e.secondary.main,.62)),t(e.Slider,"errorTrack",a.private_safeLighten(e.error.main,.62)),t(e.Slider,"infoTrack",a.private_safeLighten(e.info.main,.62)),t(e.Slider,"successTrack",a.private_safeLighten(e.success.main,.62)),t(e.Slider,"warningTrack",a.private_safeLighten(e.warning.main,.62));const p=a.private_safeEmphasize(e.background.default,.8);t(e.SnackbarContent,"bg",p),t(e.SnackbarContent,"color",I(()=>k.getContrastText(p))),t(e.SpeedDialAction,"fabHoverBg",a.private_safeEmphasize(e.background.paper,.15)),t(e.StepConnector,"border",u("palette-grey-400")),t(e.StepContent,"border",u("palette-grey-400")),t(e.Switch,"defaultColor",u("palette-common-white")),t(e.Switch,"defaultDisabledColor",u("palette-grey-100")),t(e.Switch,"primaryDisabledColor",a.private_safeLighten(e.primary.main,.62)),t(e.Switch,"secondaryDisabledColor",a.private_safeLighten(e.secondary.main,.62)),t(e.Switch,"errorDisabledColor",a.private_safeLighten(e.error.main,.62)),t(e.Switch,"infoDisabledColor",a.private_safeLighten(e.info.main,.62)),t(e.Switch,"successDisabledColor",a.private_safeLighten(e.success.main,.62)),t(e.Switch,"warningDisabledColor",a.private_safeLighten(e.warning.main,.62)),t(e.TableCell,"border",a.private_safeLighten(a.private_safeAlpha(e.divider,1),.88)),t(e.Tooltip,"bg",a.private_safeAlpha(e.grey[700],.92))}else{t(e.Alert,"errorColor",a.private_safeLighten(e.error.light,.6)),t(e.Alert,"infoColor",a.private_safeLighten(e.info.light,.6)),t(e.Alert,"successColor",a.private_safeLighten(e.success.light,.6)),t(e.Alert,"warningColor",a.private_safeLighten(e.warning.light,.6)),t(e.Alert,"errorFilledBg",u("palette-error-dark")),t(e.Alert,"infoFilledBg",u("palette-info-dark")),t(e.Alert,"successFilledBg",u("palette-success-dark")),t(e.Alert,"warningFilledBg",u("palette-warning-dark")),t(e.Alert,"errorFilledColor",I(()=>h.getContrastText(e.error.dark))),t(e.Alert,"infoFilledColor",I(()=>h.getContrastText(e.info.dark))),t(e.Alert,"successFilledColor",I(()=>h.getContrastText(e.success.dark))),t(e.Alert,"warningFilledColor",I(()=>h.getContrastText(e.warning.dark))),t(e.Alert,"errorStandardBg",a.private_safeDarken(e.error.light,.9)),t(e.Alert,"infoStandardBg",a.private_safeDarken(e.info.light,.9)),t(e.Alert,"successStandardBg",a.private_safeDarken(e.success.light,.9)),t(e.Alert,"warningStandardBg",a.private_safeDarken(e.warning.light,.9)),t(e.Alert,"errorIconColor",u("palette-error-main")),t(e.Alert,"infoIconColor",u("palette-info-main")),t(e.Alert,"successIconColor",u("palette-success-main")),t(e.Alert,"warningIconColor",u("palette-warning-main")),t(e.AppBar,"defaultBg",u("palette-grey-900")),t(e.AppBar,"darkBg",u("palette-background-paper")),t(e.AppBar,"darkColor",u("palette-text-primary")),t(e.Avatar,"defaultBg",u("palette-grey-600")),t(e.Button,"inheritContainedBg",u("palette-grey-800")),t(e.Button,"inheritContainedHoverBg",u("palette-grey-700")),t(e.Chip,"defaultBorder",u("palette-grey-700")),t(e.Chip,"defaultAvatarColor",u("palette-grey-300")),t(e.Chip,"defaultIconColor",u("palette-grey-300")),t(e.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),t(e.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),t(e.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),t(e.LinearProgress,"primaryBg",a.private_safeDarken(e.primary.main,.5)),t(e.LinearProgress,"secondaryBg",a.private_safeDarken(e.secondary.main,.5)),t(e.LinearProgress,"errorBg",a.private_safeDarken(e.error.main,.5)),t(e.LinearProgress,"infoBg",a.private_safeDarken(e.info.main,.5)),t(e.LinearProgress,"successBg",a.private_safeDarken(e.success.main,.5)),t(e.LinearProgress,"warningBg",a.private_safeDarken(e.warning.main,.5)),t(e.Skeleton,"bg",`rgba(${u("palette-text-primaryChannel")} / 0.13)`),t(e.Slider,"primaryTrack",a.private_safeDarken(e.primary.main,.5)),t(e.Slider,"secondaryTrack",a.private_safeDarken(e.secondary.main,.5)),t(e.Slider,"errorTrack",a.private_safeDarken(e.error.main,.5)),t(e.Slider,"infoTrack",a.private_safeDarken(e.info.main,.5)),t(e.Slider,"successTrack",a.private_safeDarken(e.success.main,.5)),t(e.Slider,"warningTrack",a.private_safeDarken(e.warning.main,.5));const p=a.private_safeEmphasize(e.background.default,.98);t(e.SnackbarContent,"bg",p),t(e.SnackbarContent,"color",I(()=>h.getContrastText(p))),t(e.SpeedDialAction,"fabHoverBg",a.private_safeEmphasize(e.background.paper,.15)),t(e.StepConnector,"border",u("palette-grey-600")),t(e.StepContent,"border",u("palette-grey-600")),t(e.Switch,"defaultColor",u("palette-grey-300")),t(e.Switch,"defaultDisabledColor",u("palette-grey-600")),t(e.Switch,"primaryDisabledColor",a.private_safeDarken(e.primary.main,.55)),t(e.Switch,"secondaryDisabledColor",a.private_safeDarken(e.secondary.main,.55)),t(e.Switch,"errorDisabledColor",a.private_safeDarken(e.error.main,.55)),t(e.Switch,"infoDisabledColor",a.private_safeDarken(e.info.main,.55)),t(e.Switch,"successDisabledColor",a.private_safeDarken(e.success.main,.55)),t(e.Switch,"warningDisabledColor",a.private_safeDarken(e.warning.main,.55)),t(e.TableCell,"border",a.private_safeDarken(a.private_safeAlpha(e.divider,1),.68)),t(e.Tooltip,"bg",a.private_safeAlpha(e.grey[700],.92))}F(e.background,"default"),F(e.background,"paper"),F(e.common,"background"),F(e.common,"onBackground"),F(e,"divider"),Object.keys(e).forEach(p=>{const _=e[p];_&&typeof _=="object"&&(_.main&&t(e[p],"mainChannel",a.private_safeColorChannel(W(_.main))),_.light&&t(e[p],"lightChannel",a.private_safeColorChannel(W(_.light))),_.dark&&t(e[p],"darkChannel",a.private_safeColorChannel(W(_.dark))),_.contrastText&&t(e[p],"contrastTextChannel",a.private_safeColorChannel(W(_.contrastText))),p==="text"&&(F(e[p],"primary"),F(e[p],"secondary")),p==="action"&&(_.active&&F(e[p],"active"),_.selected&&F(e[p],"selected")))})}),c=o.reduce((B,e)=>K(B,e),c);const g={prefix:S,shouldSkipGeneratingVar:b},{vars:w,generateCssVars:L}=wt(c,g);return c.vars=w,c.generateCssVars=L,c.shouldSkipGeneratingVar=b,c.unstable_sxConfig=C({},Ze,A==null?void 0:A.unstable_sxConfig),c.unstable_sx=function(e){return Le({sx:e,theme:this})},c}const Et=r=>[...[...Array(24)].map((o,n)=>`--${r?`${r}-`:""}overlays-${n+1}`),`--${r?`${r}-`:""}palette-AppBar-darkBg`,`--${r?`${r}-`:""}palette-AppBar-darkColor`],G={attribute:"data-mui-color-scheme",colorSchemeStorageKey:"mui-color-scheme",defaultLightColorScheme:"light",defaultDarkColorScheme:"dark",modeStorageKey:"mui-mode"},It=Bt(),{CssVarsProvider:Ot,useColorScheme:Gt,getInitColorSchemeScript:Mt}=St({themeId:et,theme:It,attribute:G.attribute,colorSchemeStorageKey:G.colorSchemeStorageKey,modeStorageKey:G.modeStorageKey,defaultColorScheme:{light:G.defaultLightColorScheme,dark:G.defaultDarkColorScheme},resolveTheme:r=>{const o=C({},r,{typography:tt(r.palette,r.typography)});return o.unstable_sx=function(i){return Le({sx:i,theme:this})},o},excludeVariablesFromRoot:Et}),Wt=Mt;export{Ot as C,at as G,ut as T,Et as a,Bt as e,Wt as g,Tt as s,Gt as u};
23
+ } catch(e){}})();`}},"mui-color-scheme-init")}function Ae(r){if(typeof window<"u"&&r==="system")return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Me(r,o){if(r.mode==="light"||r.mode==="system"&&r.systemMode==="light")return o("light");if(r.mode==="dark"||r.mode==="system"&&r.systemMode==="dark")return o("dark")}function ft(r){return Me(r,o=>{if(o==="light")return r.lightColorScheme;if(o==="dark")return r.darkColorScheme})}function ae(r,o){if(typeof window>"u")return;let n;try{n=localStorage.getItem(r)||void 0,n||localStorage.setItem(r,o)}catch{}return n||o}function ht(r){const{defaultMode:o="light",defaultLightColorScheme:n,defaultDarkColorScheme:i,supportedColorSchemes:s=[],modeStorageKey:l=le,colorSchemeStorageKey:d=ce,storageWindow:m=typeof window>"u"?void 0:window}=r,f=s.join(","),[S,b]=y.useState(()=>{const h=ae(l,o),c=ae(`${d}-light`,n),g=ae(`${d}-dark`,i);return{mode:h,systemMode:Ae(h),lightColorScheme:c,darkColorScheme:g}}),A=ft(S),M=y.useCallback(h=>{b(c=>{if(h===c.mode)return c;const g=h??o;try{localStorage.setItem(l,g)}catch{}return C({},c,{mode:g,systemMode:Ae(g)})})},[l,o]),v=y.useCallback(h=>{h?typeof h=="string"?h&&!f.includes(h)?console.error(`\`${h}\` does not exist in \`theme.colorSchemes\`.`):b(c=>{const g=C({},c);return Me(c,w=>{try{localStorage.setItem(`${d}-${w}`,h)}catch{}w==="light"&&(g.lightColorScheme=h),w==="dark"&&(g.darkColorScheme=h)}),g}):b(c=>{const g=C({},c),w=h.light===null?n:h.light,L=h.dark===null?i:h.dark;if(w)if(!f.includes(w))console.error(`\`${w}\` does not exist in \`theme.colorSchemes\`.`);else{g.lightColorScheme=w;try{localStorage.setItem(`${d}-light`,w)}catch{}}if(L)if(!f.includes(L))console.error(`\`${L}\` does not exist in \`theme.colorSchemes\`.`);else{g.darkColorScheme=L;try{localStorage.setItem(`${d}-dark`,L)}catch{}}return g}):b(c=>{try{localStorage.setItem(`${d}-light`,n),localStorage.setItem(`${d}-dark`,i)}catch{}return C({},c,{lightColorScheme:n,darkColorScheme:i})})},[f,d,n,i]),k=y.useCallback(h=>{S.mode==="system"&&b(c=>{const g=h!=null&&h.matches?"dark":"light";return c.systemMode===g?c:C({},c,{systemMode:g})})},[S.mode]),$=y.useRef(k);return $.current=k,y.useEffect(()=>{const h=(...g)=>$.current(...g),c=window.matchMedia("(prefers-color-scheme: dark)");return c.addListener(h),h(c),()=>{c.removeListener(h)}},[]),y.useEffect(()=>{if(m){const h=c=>{const g=c.newValue;typeof c.key=="string"&&c.key.startsWith(d)&&(!g||f.match(g))&&(c.key.endsWith("light")&&v({light:g}),c.key.endsWith("dark")&&v({dark:g})),c.key===l&&(!g||["light","dark","system"].includes(g))&&M(g||o)};return m.addEventListener("storage",h),()=>{m.removeEventListener("storage",h)}}},[v,M,l,d,f,o,m]),C({},S,{colorScheme:A,setMode:M,setColorScheme:v})}const gt=["colorSchemes","components","generateCssVars","cssVarPrefix"],pt="*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";function St(r){const{themeId:o,theme:n={},attribute:i=Ie,modeStorageKey:s=le,colorSchemeStorageKey:l=ce,defaultMode:d="light",defaultColorScheme:m,disableTransitionOnChange:f=!1,resolveTheme:S,excludeVariablesFromRoot:b}=r;(!n.colorSchemes||typeof m=="string"&&!n.colorSchemes[m]||typeof m=="object"&&!n.colorSchemes[m==null?void 0:m.light]||typeof m=="object"&&!n.colorSchemes[m==null?void 0:m.dark])&&console.error(`MUI: \`${m}\` does not exist in \`theme.colorSchemes\`.`);const A=y.createContext(void 0),M=()=>{const c=y.useContext(A);if(!c)throw new Error(Je(19));return c};function v(c){const{children:g,theme:w=n,modeStorageKey:L=s,colorSchemeStorageKey:B=l,attribute:e=i,defaultMode:u=d,defaultColorScheme:p=m,disableTransitionOnChange:_=f,storageWindow:q=typeof window>"u"?void 0:window,documentNode:j=typeof document>"u"?void 0:document,colorSchemeNode:Y=typeof document>"u"?void 0:document.documentElement,colorSchemeSelector:N=":root",disableNestedContext:je=!1,disableStyleSheetGeneration:Pe=!1}=c,Q=y.useRef(!1),de=se(),X=y.useContext(A),J=!!X&&!je,ue=w[o],me=ue||w,{colorSchemes:Z={},components:Ve={},generateCssVars:fe=()=>({vars:{},css:{}}),cssVarPrefix:ee}=me,Fe=W(me,gt),te=Object.keys(Z),he=typeof p=="string"?p:p.light,ge=typeof p=="string"?p:p.dark,{mode:Oe,setMode:pe,systemMode:Se,lightColorScheme:Ce,darkColorScheme:ye,colorScheme:Ge,setColorScheme:ve}=ht({supportedColorSchemes:te,defaultLightColorScheme:he,defaultDarkColorScheme:ge,modeStorageKey:L,colorSchemeStorageKey:B,defaultMode:u,storageWindow:q});let O=Oe,P=Ge;J&&(O=X.mode,P=X.colorScheme);const Re=O||(u==="system"?d:u),We=P||(Re==="dark"?ge:he),{css:Ke,vars:be}=fe(),D=C({},Fe,{components:Ve,colorSchemes:Z,cssVarPrefix:ee,vars:be,getColorSchemeSelector:x=>`[${e}="${x}"] &`}),re={},ke={};Object.entries(Z).forEach(([x,V])=>{const{css:z,vars:Ne}=fe(x);D.vars=K(D.vars,Ne),x===We&&(Object.keys(V).forEach(E=>{V[E]&&typeof V[E]=="object"?D[E]=C({},D[E],V[E]):D[E]=V[E]}),D.palette&&(D.palette.colorScheme=x));const ze=typeof p=="string"?p:u==="dark"?p.dark:p.light;if(x===ze){if(b){const E={};b(ee).forEach(oe=>{E[oe]=z[oe],delete z[oe]}),re[`[${e}="${x}"]`]=E}re[`${N}, [${e}="${x}"]`]=z}else ke[`${N===":root"?"":N}[${e}="${x}"]`]=z}),D.vars=K(D.vars,be),y.useEffect(()=>{P&&Y&&Y.setAttribute(e,P)},[P,e,Y]),y.useEffect(()=>{let x;if(_&&Q.current&&j){const V=j.createElement("style");V.appendChild(j.createTextNode(pt)),j.head.appendChild(V),window.getComputedStyle(j.body),x=setTimeout(()=>{j.head.removeChild(V)},1)}return()=>{clearTimeout(x)}},[P,_,j]),y.useEffect(()=>(Q.current=!0,()=>{Q.current=!1}),[]);const He=y.useMemo(()=>({allColorSchemes:te,colorScheme:P,darkColorScheme:ye,lightColorScheme:Ce,mode:O,setColorScheme:ve,setMode:pe,systemMode:Se}),[te,P,ye,Ce,O,ve,pe,Se]);let _e=!0;(Pe||J&&(de==null?void 0:de.cssVarPrefix)===ee)&&(_e=!1);const we=T.jsxs(y.Fragment,{children:[_e&&T.jsxs(y.Fragment,{children:[T.jsx(U,{styles:{[N]:Ke}}),T.jsx(U,{styles:re}),T.jsx(U,{styles:ke})]}),T.jsx(ut,{themeId:ue?o:void 0,theme:S?S(D):D,children:g})]});return J?we:T.jsx(A.Provider,{value:He,children:we})}const k=typeof m=="string"?m:m.light,$=typeof m=="string"?m:m.dark;return{CssVarsProvider:v,useColorScheme:M,getInitColorSchemeScript:c=>mt(C({attribute:i,colorSchemeStorageKey:l,defaultMode:d,defaultLightColorScheme:k,defaultDarkColorScheme:$,modeStorageKey:s},c))}}function Ct(r=""){function o(...i){if(!i.length)return"";const s=i[0];return typeof s=="string"&&!s.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${r?`${r}-`:""}${s}${o(...i.slice(1))})`:`, ${s}`}return(i,...s)=>`var(--${r?`${r}-`:""}${i}${o(...s)})`}const De=(r,o,n,i=[])=>{let s=r;o.forEach((l,d)=>{d===o.length-1?Array.isArray(s)?s[Number(l)]=n:s&&typeof s=="object"&&(s[l]=n):s&&typeof s=="object"&&(s[l]||(s[l]=i.includes(l)?[]:{}),s=s[l])})},yt=(r,o,n)=>{function i(s,l=[],d=[]){Object.entries(s).forEach(([m,f])=>{(!n||n&&!n([...l,m]))&&f!=null&&(typeof f=="object"&&Object.keys(f).length>0?i(f,[...l,m],Array.isArray(f)?[...d,m]:d):o([...l,m],f,d))})}i(r)},vt=(r,o)=>typeof o=="number"?["lineHeight","fontWeight","opacity","zIndex"].some(i=>r.includes(i))||r[r.length-1].toLowerCase().indexOf("opacity")>=0?o:`${o}px`:o;function ie(r,o){const{prefix:n,shouldSkipGeneratingVar:i}=o||{},s={},l={},d={};return yt(r,(m,f,S)=>{if((typeof f=="string"||typeof f=="number")&&(!i||!i(m,f))){const b=`--${n?`${n}-`:""}${m.join("-")}`;Object.assign(s,{[b]:vt(m,f)}),De(l,m,`var(${b})`,S),De(d,m,`var(${b}, ${f})`,S)}},m=>m[0]==="vars"),{css:s,vars:l,varsWithDefaults:d}}function H(r){"@babel/helpers - typeof";return H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},H(r)}function bt(r,o){if(H(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var i=n.call(r,o);if(H(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function kt(r){var o=bt(r,"string");return H(o)=="symbol"?o:o+""}const _t=["colorSchemes","components","defaultColorScheme"];function wt(r,o){const{colorSchemes:n={},defaultColorScheme:i="light"}=r,s=W(r,_t),{vars:l,css:d,varsWithDefaults:m}=ie(s,o);let f=m;const S={},{[i]:b}=n,A=W(n,[i].map(kt));if(Object.entries(A||{}).forEach(([v,k])=>{const{vars:$,css:h,varsWithDefaults:c}=ie(k,o);f=K(f,c),S[v]={css:h,vars:$}}),b){const{css:v,vars:k,varsWithDefaults:$}=ie(b,o);f=K(f,$),S[i]={css:v,vars:k}}return{vars:f,generateCssVars:v=>{var k;if(!v){var $;const c=C({},d);return{css:c,vars:l,selector:(o==null||($=o.getSelector)==null?void 0:$.call(o,v,c))||":root"}}const h=C({},S[v].css);return{css:h,vars:S[v].vars,selector:(o==null||(k=o.getSelector)==null?void 0:k.call(o,v,h))||":root"}}}}function Tt(r){var o;return!!r[0].match(/(cssVarPrefix|typography|mixins|breakpoints|direction|transitions)/)||!!r[0].match(/sxConfig$/)||r[0]==="palette"&&!!((o=r[1])!=null&&o.match(/(mode|contrastThreshold|tonalOffset)/))}const $t=["colorSchemes","cssVarPrefix","shouldSkipGeneratingVar"],xt=["palette"],At=[...Array(25)].map((r,o)=>{if(o===0)return;const n=ot(o);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function Dt(r,o){o.forEach(n=>{r[n]||(r[n]={})})}function t(r,o,n){!r[o]&&n&&(r[o]=n)}function R(r){return!r||!r.startsWith("hsl")?r:a.hslToRgb(r)}function F(r,o){`${o}Channel`in r||(r[`${o}Channel`]=a.private_safeColorChannel(R(r[o]),`MUI: Can't create \`palette.${o}Channel\` because \`palette.${o}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
24
+ To suppress this warning, you need to explicitly provide the \`palette.${o}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}const I=r=>{try{return r()}catch{}},Lt=(r="mui")=>Ct(r);function Bt(r={},...o){var n,i,s,l,d,m;const{colorSchemes:f={},cssVarPrefix:S="mui",shouldSkipGeneratingVar:b=Tt}=r,A=W(r,$t),M=Lt(S),v=Te(C({},A,f.light&&{palette:(n=f.light)==null?void 0:n.palette})),{palette:k}=v,$=W(v,xt),{palette:h}=Te({palette:C({mode:"dark"},(i=f.dark)==null?void 0:i.palette)});let c=C({},$,{cssVarPrefix:S,getCssVar:M,colorSchemes:C({},f,{light:C({},f.light,{palette:k,opacity:C({inputPlaceholder:.42,inputUnderline:.42,switchTrackDisabled:.12,switchTrack:.38},(s=f.light)==null?void 0:s.opacity),overlays:((l=f.light)==null?void 0:l.overlays)||[]}),dark:C({},f.dark,{palette:h,opacity:C({inputPlaceholder:.5,inputUnderline:.7,switchTrackDisabled:.2,switchTrack:.3},(d=f.dark)==null?void 0:d.opacity),overlays:((m=f.dark)==null?void 0:m.overlays)||At})})});Object.keys(c.colorSchemes).forEach(B=>{const e=c.colorSchemes[B].palette,u=p=>{const _=p.split("-"),q=_[1],j=_[2];return M(p,e[q][j])};if(B==="light"?(t(e.common,"background","#fff"),t(e.common,"onBackground","#000")):(t(e.common,"background","#000"),t(e.common,"onBackground","#fff")),Dt(e,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),B==="light"){t(e.Alert,"errorColor",a.private_safeDarken(e.error.light,.6)),t(e.Alert,"infoColor",a.private_safeDarken(e.info.light,.6)),t(e.Alert,"successColor",a.private_safeDarken(e.success.light,.6)),t(e.Alert,"warningColor",a.private_safeDarken(e.warning.light,.6)),t(e.Alert,"errorFilledBg",u("palette-error-main")),t(e.Alert,"infoFilledBg",u("palette-info-main")),t(e.Alert,"successFilledBg",u("palette-success-main")),t(e.Alert,"warningFilledBg",u("palette-warning-main")),t(e.Alert,"errorFilledColor",I(()=>k.getContrastText(e.error.main))),t(e.Alert,"infoFilledColor",I(()=>k.getContrastText(e.info.main))),t(e.Alert,"successFilledColor",I(()=>k.getContrastText(e.success.main))),t(e.Alert,"warningFilledColor",I(()=>k.getContrastText(e.warning.main))),t(e.Alert,"errorStandardBg",a.private_safeLighten(e.error.light,.9)),t(e.Alert,"infoStandardBg",a.private_safeLighten(e.info.light,.9)),t(e.Alert,"successStandardBg",a.private_safeLighten(e.success.light,.9)),t(e.Alert,"warningStandardBg",a.private_safeLighten(e.warning.light,.9)),t(e.Alert,"errorIconColor",u("palette-error-main")),t(e.Alert,"infoIconColor",u("palette-info-main")),t(e.Alert,"successIconColor",u("palette-success-main")),t(e.Alert,"warningIconColor",u("palette-warning-main")),t(e.AppBar,"defaultBg",u("palette-grey-100")),t(e.Avatar,"defaultBg",u("palette-grey-400")),t(e.Button,"inheritContainedBg",u("palette-grey-300")),t(e.Button,"inheritContainedHoverBg",u("palette-grey-A100")),t(e.Chip,"defaultBorder",u("palette-grey-400")),t(e.Chip,"defaultAvatarColor",u("palette-grey-700")),t(e.Chip,"defaultIconColor",u("palette-grey-700")),t(e.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),t(e.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),t(e.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),t(e.LinearProgress,"primaryBg",a.private_safeLighten(e.primary.main,.62)),t(e.LinearProgress,"secondaryBg",a.private_safeLighten(e.secondary.main,.62)),t(e.LinearProgress,"errorBg",a.private_safeLighten(e.error.main,.62)),t(e.LinearProgress,"infoBg",a.private_safeLighten(e.info.main,.62)),t(e.LinearProgress,"successBg",a.private_safeLighten(e.success.main,.62)),t(e.LinearProgress,"warningBg",a.private_safeLighten(e.warning.main,.62)),t(e.Skeleton,"bg",`rgba(${u("palette-text-primaryChannel")} / 0.11)`),t(e.Slider,"primaryTrack",a.private_safeLighten(e.primary.main,.62)),t(e.Slider,"secondaryTrack",a.private_safeLighten(e.secondary.main,.62)),t(e.Slider,"errorTrack",a.private_safeLighten(e.error.main,.62)),t(e.Slider,"infoTrack",a.private_safeLighten(e.info.main,.62)),t(e.Slider,"successTrack",a.private_safeLighten(e.success.main,.62)),t(e.Slider,"warningTrack",a.private_safeLighten(e.warning.main,.62));const p=a.private_safeEmphasize(e.background.default,.8);t(e.SnackbarContent,"bg",p),t(e.SnackbarContent,"color",I(()=>k.getContrastText(p))),t(e.SpeedDialAction,"fabHoverBg",a.private_safeEmphasize(e.background.paper,.15)),t(e.StepConnector,"border",u("palette-grey-400")),t(e.StepContent,"border",u("palette-grey-400")),t(e.Switch,"defaultColor",u("palette-common-white")),t(e.Switch,"defaultDisabledColor",u("palette-grey-100")),t(e.Switch,"primaryDisabledColor",a.private_safeLighten(e.primary.main,.62)),t(e.Switch,"secondaryDisabledColor",a.private_safeLighten(e.secondary.main,.62)),t(e.Switch,"errorDisabledColor",a.private_safeLighten(e.error.main,.62)),t(e.Switch,"infoDisabledColor",a.private_safeLighten(e.info.main,.62)),t(e.Switch,"successDisabledColor",a.private_safeLighten(e.success.main,.62)),t(e.Switch,"warningDisabledColor",a.private_safeLighten(e.warning.main,.62)),t(e.TableCell,"border",a.private_safeLighten(a.private_safeAlpha(e.divider,1),.88)),t(e.Tooltip,"bg",a.private_safeAlpha(e.grey[700],.92))}else{t(e.Alert,"errorColor",a.private_safeLighten(e.error.light,.6)),t(e.Alert,"infoColor",a.private_safeLighten(e.info.light,.6)),t(e.Alert,"successColor",a.private_safeLighten(e.success.light,.6)),t(e.Alert,"warningColor",a.private_safeLighten(e.warning.light,.6)),t(e.Alert,"errorFilledBg",u("palette-error-dark")),t(e.Alert,"infoFilledBg",u("palette-info-dark")),t(e.Alert,"successFilledBg",u("palette-success-dark")),t(e.Alert,"warningFilledBg",u("palette-warning-dark")),t(e.Alert,"errorFilledColor",I(()=>h.getContrastText(e.error.dark))),t(e.Alert,"infoFilledColor",I(()=>h.getContrastText(e.info.dark))),t(e.Alert,"successFilledColor",I(()=>h.getContrastText(e.success.dark))),t(e.Alert,"warningFilledColor",I(()=>h.getContrastText(e.warning.dark))),t(e.Alert,"errorStandardBg",a.private_safeDarken(e.error.light,.9)),t(e.Alert,"infoStandardBg",a.private_safeDarken(e.info.light,.9)),t(e.Alert,"successStandardBg",a.private_safeDarken(e.success.light,.9)),t(e.Alert,"warningStandardBg",a.private_safeDarken(e.warning.light,.9)),t(e.Alert,"errorIconColor",u("palette-error-main")),t(e.Alert,"infoIconColor",u("palette-info-main")),t(e.Alert,"successIconColor",u("palette-success-main")),t(e.Alert,"warningIconColor",u("palette-warning-main")),t(e.AppBar,"defaultBg",u("palette-grey-900")),t(e.AppBar,"darkBg",u("palette-background-paper")),t(e.AppBar,"darkColor",u("palette-text-primary")),t(e.Avatar,"defaultBg",u("palette-grey-600")),t(e.Button,"inheritContainedBg",u("palette-grey-800")),t(e.Button,"inheritContainedHoverBg",u("palette-grey-700")),t(e.Chip,"defaultBorder",u("palette-grey-700")),t(e.Chip,"defaultAvatarColor",u("palette-grey-300")),t(e.Chip,"defaultIconColor",u("palette-grey-300")),t(e.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),t(e.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),t(e.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),t(e.LinearProgress,"primaryBg",a.private_safeDarken(e.primary.main,.5)),t(e.LinearProgress,"secondaryBg",a.private_safeDarken(e.secondary.main,.5)),t(e.LinearProgress,"errorBg",a.private_safeDarken(e.error.main,.5)),t(e.LinearProgress,"infoBg",a.private_safeDarken(e.info.main,.5)),t(e.LinearProgress,"successBg",a.private_safeDarken(e.success.main,.5)),t(e.LinearProgress,"warningBg",a.private_safeDarken(e.warning.main,.5)),t(e.Skeleton,"bg",`rgba(${u("palette-text-primaryChannel")} / 0.13)`),t(e.Slider,"primaryTrack",a.private_safeDarken(e.primary.main,.5)),t(e.Slider,"secondaryTrack",a.private_safeDarken(e.secondary.main,.5)),t(e.Slider,"errorTrack",a.private_safeDarken(e.error.main,.5)),t(e.Slider,"infoTrack",a.private_safeDarken(e.info.main,.5)),t(e.Slider,"successTrack",a.private_safeDarken(e.success.main,.5)),t(e.Slider,"warningTrack",a.private_safeDarken(e.warning.main,.5));const p=a.private_safeEmphasize(e.background.default,.98);t(e.SnackbarContent,"bg",p),t(e.SnackbarContent,"color",I(()=>h.getContrastText(p))),t(e.SpeedDialAction,"fabHoverBg",a.private_safeEmphasize(e.background.paper,.15)),t(e.StepConnector,"border",u("palette-grey-600")),t(e.StepContent,"border",u("palette-grey-600")),t(e.Switch,"defaultColor",u("palette-grey-300")),t(e.Switch,"defaultDisabledColor",u("palette-grey-600")),t(e.Switch,"primaryDisabledColor",a.private_safeDarken(e.primary.main,.55)),t(e.Switch,"secondaryDisabledColor",a.private_safeDarken(e.secondary.main,.55)),t(e.Switch,"errorDisabledColor",a.private_safeDarken(e.error.main,.55)),t(e.Switch,"infoDisabledColor",a.private_safeDarken(e.info.main,.55)),t(e.Switch,"successDisabledColor",a.private_safeDarken(e.success.main,.55)),t(e.Switch,"warningDisabledColor",a.private_safeDarken(e.warning.main,.55)),t(e.TableCell,"border",a.private_safeDarken(a.private_safeAlpha(e.divider,1),.68)),t(e.Tooltip,"bg",a.private_safeAlpha(e.grey[700],.92))}F(e.background,"default"),F(e.background,"paper"),F(e.common,"background"),F(e.common,"onBackground"),F(e,"divider"),Object.keys(e).forEach(p=>{const _=e[p];_&&typeof _=="object"&&(_.main&&t(e[p],"mainChannel",a.private_safeColorChannel(R(_.main))),_.light&&t(e[p],"lightChannel",a.private_safeColorChannel(R(_.light))),_.dark&&t(e[p],"darkChannel",a.private_safeColorChannel(R(_.dark))),_.contrastText&&t(e[p],"contrastTextChannel",a.private_safeColorChannel(R(_.contrastText))),p==="text"&&(F(e[p],"primary"),F(e[p],"secondary")),p==="action"&&(_.active&&F(e[p],"active"),_.selected&&F(e[p],"selected")))})}),c=o.reduce((B,e)=>K(B,e),c);const g={prefix:S,shouldSkipGeneratingVar:b},{vars:w,generateCssVars:L}=wt(c,g);return c.vars=w,c.generateCssVars=L,c.shouldSkipGeneratingVar=b,c.unstable_sxConfig=C({},Ze,A==null?void 0:A.unstable_sxConfig),c.unstable_sx=function(e){return Le({sx:e,theme:this})},c}const Et=r=>[...[...Array(24)].map((o,n)=>`--${r?`${r}-`:""}overlays-${n+1}`),`--${r?`${r}-`:""}palette-AppBar-darkBg`,`--${r?`${r}-`:""}palette-AppBar-darkColor`],G={attribute:"data-mui-color-scheme",colorSchemeStorageKey:"mui-color-scheme",defaultLightColorScheme:"light",defaultDarkColorScheme:"dark",modeStorageKey:"mui-mode"},It=Bt(),{CssVarsProvider:Ot,useColorScheme:Gt,getInitColorSchemeScript:Mt}=St({themeId:et,theme:It,attribute:G.attribute,colorSchemeStorageKey:G.colorSchemeStorageKey,modeStorageKey:G.modeStorageKey,defaultColorScheme:{light:G.defaultLightColorScheme,dark:G.defaultDarkColorScheme},resolveTheme:r=>{const o=C({},r,{typography:tt(r.palette,r.typography)});return o.unstable_sx=function(i){return Le({sx:i,theme:this})},o},excludeVariablesFromRoot:Et}),Rt=Mt;export{Ot as C,at as G,ut as T,Et as a,Bt as e,Rt as g,Tt as s,Gt as u};
@@ -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-CO4_1ccR.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-BI7O7l1f.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
1
+ 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-bzfGoYP9.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-CfltZkIg.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
@@ -1 +1 @@
1
- import{a as $,b as q,r as i,j as e}from"./react-BrLDncxD.js";import{u as H,t as s,d as Q,o as V,x as g,C as d,E as P,y as I,g as W,r as z}from"./index-D2u3qo5-.js";import{R as G}from"./resume-buy-Bf0zIH7y.js";import{R as D}from"./cart-checkout-4SY4EejM.js";import{l as J}from"./loader-logo-BzY9EKdC.js";import{u as Z,p as X,c as ee,i as se}from"./useCreditPacks-Djg10PxH.js";import{C as te}from"./CircularProgress-CzgFv03I.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";const j="https://cdn.decentraland.org/@dcl/shop/0.1.0-29994094833.commit-84e34c2/assets/pack-chips--HnOpf5U.webp",re="https://cdn.decentraland.org/@dcl/shop/0.1.0-29994094833.commit-84e34c2/assets/credit-coin-CmcTCd5i.webp",ce="data:image/svg+xml,%3csvg%20width='60'%20height='60'%20viewBox='0%200%2060%2060'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='60'%20height='60'%20rx='30'%20fill='%2334CE77'/%3e%3cpath%20d='M21.6583%2046.1067L11.4656%2036.0591C10.1688%2034.829%2010.1905%2032.7207%2011.4769%2031.4622L13.6868%2029.3591C14.9732%2028.1006%2017.1615%2028.1058%2018.4582%2029.3359L23.8747%2034.6197L41.9704%2015.6527C43.2568%2014.3942%2045.4291%2014.2093%2046.7258%2015.4394L48.8765%2017.3628C50.1732%2018.5929%2050.3491%2020.6844%2049.0626%2021.9429L26.6112%2045.8766C25.1433%2047.342%2022.955%2047.3368%2021.6583%2046.1067Z'%20fill='%23FCFCFC'/%3e%3c/svg%3e",x=se()?"mock":"stripe",ae={pack_5:j,pack_10:j,pack_25:j,pack_50:j},ne="https://docs.decentraland.org";function M(l){const r=l;if((r==null?void 0:r.name)==="AbortError")return s("getCredits.errorCanceled");const m=((r==null?void 0:r.message)??"").toLowerCase();return m.includes("sign in")?s("getCredits.errorSignIn",{currency:d.name}):m.includes("timed out")?s("getCredits.errorTimeout",{currency:d.name}):s("getCredits.errorGeneric")}function je(){H({title:s("nav.getCredits",{currency:d.name}),noindex:!0});const l=$(),{session:r,signIn:m}=Q(),n=V(),[N,w]=q(),{packs:F,isLoading:T}=Z(),[p,o]=i.useState("select"),[a,E]=i.useState(null),[R,L]=i.useState(null),[U,h]=i.useState(null),[K,f]=i.useState(!1),b=i.useRef(null);i.useEffect(()=>()=>{var t;return(t=b.current)==null?void 0:t.abort()},[]);const A=i.useCallback(()=>{w(t=>{const c=new URLSearchParams(t);return c.delete("order"),c.delete("canceled"),c},{replace:!0})},[w]),y=i.useCallback(async t=>{o("processing");const c=new AbortController;b.current=c;try{const u=await X(t,{signal:c.signal,address:r==null?void 0:r.address,identity:r==null?void 0:r.identity});if(u.status==="credited"){const _=u.creditsGranted??(a==null?void 0:a.credits)??0;L(_>0?_:null),o("success"),g("Shop Completed Buy Credits",{order_id:t,pack_usd:(a==null?void 0:a.usd)??null,credits:_>0?_:null,provider:x}),n.invalidateQueries({queryKey:["usd-balance"]});try{if(sessionStorage.getItem(D)){const k={resumeCheckout:!0,..._>0?{creditsAdded:_}:{}};l("/cart",{state:k});return}}catch{}try{const k=sessionStorage.getItem(G);if(k){sessionStorage.removeItem(G);const C=JSON.parse(k),B=C.tokenId??C.itemId;if(C.contractAddress&&B){l(`/item/${C.contractAddress}/${B}`,{state:{item:C,resumeBuy:!0}});return}}}catch{}}else u.status==="pending"?(g("Shop Buy Credits Pending",{step:"grant",pack_usd:(a==null?void 0:a.usd)??null}),n.invalidateQueries({queryKey:["usd-balance"]}),o("pending")):(g("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(a==null?void 0:a.usd)??null}),h(u.error??s("getCredits.errorGrant",{currency:d.name})),o("error"))}catch(u){P(u,{flow:"get_credits",step:"grant",order_id:t}),g("Shop Buy Credits Failed",{step:"grant",error_code:I(u),pack_usd:(a==null?void 0:a.usd)??null}),h(M(u)),o("error")}},[a,r,n,l]),O=i.useCallback(async t=>{if(!r){m();return}h(null),f(!1),E(t),o(x==="mock"?"processing":"redirecting"),g("Shop Started Buy Credits",{pack_usd:t.usd,credits:t.credits,provider:x});try{const c=await ee(t.id,{address:r.address,identity:r.identity});if(c.mock)y(c.orderId);else if(c.url)g("Shop Redirected To Stripe",{order_id:c.orderId,pack_usd:t.usd,credits:t.credits}),window.location.href=c.url;else throw new Error("Checkout did not return a redirect url")}catch(c){P(c,{flow:"get_credits",step:"checkout",provider:x}),g("Shop Buy Credits Failed",{step:"checkout",error_code:I(c),pack_usd:t.usd}),h(M(c)),o("error")}},[r,m,y]),v=i.useRef(!1);i.useEffect(()=>{if(v.current)return;const t=N.get("order");if(N.get("canceled")!=null){v.current=!0,g("Shop Buy Credits Cancelled",{order_id:t,provider:x}),A(),f(!0),o("select");return}t&&(o("processing"),r&&(v.current=!0,A(),y(t)))},[N,r]);function S(){var t;(t=b.current)==null||t.abort(),o("select"),E(null),L(null),h(null),f(!1)}const Y=p==="select";return e.jsxs("div",{className:"getcredits",children:[Y&&e.jsxs("header",{className:"getcredits__head",children:[e.jsx("h1",{className:"getcredits__title",children:s("getCredits.title",{currency:d.name})}),e.jsxs("p",{className:"getcredits__sub",children:[s("getCredits.subtitle",{currency:d.name})," ",e.jsxs("a",{className:"getcredits__learn",href:ne,target:"_blank",rel:"noreferrer",children:[s("getCredits.learnMore"),e.jsxs("svg",{className:"getcredits__learn-ico",viewBox:"0 0 13 13","aria-hidden":!0,fill:"none",children:[e.jsx("path",{d:"M4 2h7v7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M11 2 2 11",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})]}),p==="select"&&e.jsxs(e.Fragment,{children:[K&&e.jsx("p",{className:"getcredits__note muted",role:"status",children:s("getCredits.canceledNote")}),e.jsx(ie,{packs:F,loading:T,onSelect:t=>void O(t)})]}),p==="redirecting"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(te,{size:32}),e.jsx("p",{className:"muted",children:s("getCredits.redirecting")})]}),p==="processing"&&e.jsxs("div",{className:"gc-processing",role:"status","aria-live":"polite",children:[e.jsx("img",{className:"gc-processing__logo",src:J,alt:"",width:61,height:61}),e.jsxs("div",{className:"gc-processing__body",children:[e.jsxs("p",{className:"gc-processing__title",children:[e.jsx("strong",{children:s("getCredits.processing")}),"…"]}),e.jsxs("div",{className:"gc-progress","aria-hidden":!0,children:[e.jsx("span",{className:"gc-progress__track",children:e.jsx("span",{className:"gc-progress__fill"})}),e.jsx("span",{className:"gc-progress__count",children:"1/1"})]})]})]}),p==="success"&&e.jsxs("div",{className:"gc-success",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"gc-banner",children:[e.jsx("img",{className:"gc-banner__icon",src:ce,alt:"",width:60,height:60}),e.jsxs("p",{className:"gc-banner__text",children:[e.jsx("strong",{children:s("getCredits.successTitle")})," ",s("getCredits.successBody",{currency:d.name})]})]}),R!=null&&e.jsx("div",{className:"gc-credits",children:e.jsxs("div",{className:"gc-credits__row",children:[e.jsx("img",{className:"gc-credits__coin",src:re,alt:"",width:93,height:93}),e.jsxs("p",{className:"gc-credits__text",children:[e.jsx(W,{className:"gc-credits__diamond"}),e.jsxs("span",{children:[e.jsx("strong",{className:"gc-credits__amount",children:s("getCredits.creditsAmount",{credits:R,currency:d.name})})," ",e.jsx("span",{className:"gc-credits__added",children:s("getCredits.creditsAdded")})]})]})]})}),e.jsxs("div",{className:"gc-actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:S,children:s("getCredits.buyMore",{currency:d.name})}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:s("getCredits.startShopping")})]})]}),p==="pending"&&e.jsxs("div",{className:"gc-status",role:"status","aria-live":"polite",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.pendingTitle",{currency:d.name})}),e.jsx("p",{className:"muted",children:s("getCredits.pendingBody")}),e.jsxs("div",{className:"gc-status__actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:s("getCredits.startShopping")}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:S,children:s("getCredits.done")})]})]}),p==="error"&&e.jsxs("div",{className:"gc-status gc-status--err",role:"alert",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.errorTitle")}),e.jsx("p",{className:"error",children:U}),e.jsx("div",{className:"gc-status__actions",children:e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:S,children:s("getCredits.tryAgain")})})]})]})}function ie({packs:l,loading:r,onSelect:m}){return r?e.jsx("div",{className:"packs","aria-busy":"true","aria-label":s("getCredits.packsLoading",{currency:d.name}),children:[0,1,2,3].map(n=>e.jsx("div",{className:"pack pack--skeleton","aria-hidden":!0,children:e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"skeleton pack__label-sk"}),e.jsx("span",{className:"skeleton pack__art-sk"}),e.jsx("span",{className:"skeleton pack__cta-sk"})]})},n))}):e.jsx("div",{className:"packs",children:l.map(n=>e.jsxs("button",{type:"button",className:`pack${n.bestValue?" pack--best":""}`,"data-testid":"pack",onClick:()=>m(n),"aria-label":s("getCredits.packAria",{amount:z(n.credits),usd:n.usd}),children:[n.bestValue&&e.jsx("span",{className:"pack__badge",children:s("getCredits.packBadge")}),e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"pack__label",children:s("getCredits.creditsAmount",{credits:n.credits,currency:d.name})}),e.jsx("span",{className:"pack__art",children:e.jsx("img",{src:ae[n.id]??j,alt:"",loading:"lazy"})}),e.jsx("span",{className:"pack__cta-wrap",children:e.jsxs("span",{className:"pack__cta",children:["$",n.usd.toFixed(2)]})})]})]},n.id))})}export{je as GetCredits,je as default};
1
+ import{a as $,b as q,r as i,j as e}from"./react-BrLDncxD.js";import{u as H,t as s,d as Q,o as V,x as g,C as d,E as P,y as I,g as W,r as z}from"./index-P7Sau0I5.js";import{R as G}from"./resume-buy-Bf0zIH7y.js";import{R as D}from"./cart-checkout-C350oS3_.js";import{l as J}from"./loader-logo-BzY9EKdC.js";import{u as Z,p as X,c as ee,i as se}from"./useCreditPacks-D-Oae9wZ.js";import{C as te}from"./CircularProgress-CLSvO83K.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";const j="https://cdn.decentraland.org/@dcl/shop/0.1.0-29994098968.commit-46a6a0c/assets/pack-chips--HnOpf5U.webp",re="https://cdn.decentraland.org/@dcl/shop/0.1.0-29994098968.commit-46a6a0c/assets/credit-coin-CmcTCd5i.webp",ae="data:image/svg+xml,%3csvg%20width='60'%20height='60'%20viewBox='0%200%2060%2060'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='60'%20height='60'%20rx='30'%20fill='%2334CE77'/%3e%3cpath%20d='M21.6583%2046.1067L11.4656%2036.0591C10.1688%2034.829%2010.1905%2032.7207%2011.4769%2031.4622L13.6868%2029.3591C14.9732%2028.1006%2017.1615%2028.1058%2018.4582%2029.3359L23.8747%2034.6197L41.9704%2015.6527C43.2568%2014.3942%2045.4291%2014.2093%2046.7258%2015.4394L48.8765%2017.3628C50.1732%2018.5929%2050.3491%2020.6844%2049.0626%2021.9429L26.6112%2045.8766C25.1433%2047.342%2022.955%2047.3368%2021.6583%2046.1067Z'%20fill='%23FCFCFC'/%3e%3c/svg%3e",x=se()?"mock":"stripe",ce={pack_5:j,pack_10:j,pack_25:j,pack_50:j},ne="https://docs.decentraland.org";function M(l){const r=l;if((r==null?void 0:r.name)==="AbortError")return s("getCredits.errorCanceled");const m=((r==null?void 0:r.message)??"").toLowerCase();return m.includes("sign in")?s("getCredits.errorSignIn",{currency:d.name}):m.includes("timed out")?s("getCredits.errorTimeout",{currency:d.name}):s("getCredits.errorGeneric")}function je(){H({title:s("nav.getCredits",{currency:d.name}),noindex:!0});const l=$(),{session:r,signIn:m}=Q(),n=V(),[N,w]=q(),{packs:F,isLoading:T}=Z(),[p,o]=i.useState("select"),[c,E]=i.useState(null),[R,L]=i.useState(null),[U,h]=i.useState(null),[K,f]=i.useState(!1),b=i.useRef(null);i.useEffect(()=>()=>{var t;return(t=b.current)==null?void 0:t.abort()},[]);const A=i.useCallback(()=>{w(t=>{const a=new URLSearchParams(t);return a.delete("order"),a.delete("canceled"),a},{replace:!0})},[w]),y=i.useCallback(async t=>{o("processing");const a=new AbortController;b.current=a;try{const u=await X(t,{signal:a.signal,address:r==null?void 0:r.address,identity:r==null?void 0:r.identity});if(u.status==="credited"){const _=u.creditsGranted??(c==null?void 0:c.credits)??0;L(_>0?_:null),o("success"),g("Shop Completed Buy Credits",{order_id:t,pack_usd:(c==null?void 0:c.usd)??null,credits:_>0?_:null,provider:x}),n.invalidateQueries({queryKey:["usd-balance"]});try{if(sessionStorage.getItem(D)){const k={resumeCheckout:!0,..._>0?{creditsAdded:_}:{}};l("/cart",{state:k});return}}catch{}try{const k=sessionStorage.getItem(G);if(k){sessionStorage.removeItem(G);const C=JSON.parse(k),B=C.tokenId??C.itemId;if(C.contractAddress&&B){l(`/item/${C.contractAddress}/${B}`,{state:{item:C,resumeBuy:!0}});return}}}catch{}}else u.status==="pending"?(g("Shop Buy Credits Pending",{step:"grant",pack_usd:(c==null?void 0:c.usd)??null}),n.invalidateQueries({queryKey:["usd-balance"]}),o("pending")):(g("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(c==null?void 0:c.usd)??null}),h(u.error??s("getCredits.errorGrant",{currency:d.name})),o("error"))}catch(u){P(u,{flow:"get_credits",step:"grant",order_id:t}),g("Shop Buy Credits Failed",{step:"grant",error_code:I(u),pack_usd:(c==null?void 0:c.usd)??null}),h(M(u)),o("error")}},[c,r,n,l]),O=i.useCallback(async t=>{if(!r){m();return}h(null),f(!1),E(t),o(x==="mock"?"processing":"redirecting"),g("Shop Started Buy Credits",{pack_usd:t.usd,credits:t.credits,provider:x});try{const a=await ee(t.id,{address:r.address,identity:r.identity});if(a.mock)y(a.orderId);else if(a.url)g("Shop Redirected To Stripe",{order_id:a.orderId,pack_usd:t.usd,credits:t.credits}),window.location.href=a.url;else throw new Error("Checkout did not return a redirect url")}catch(a){P(a,{flow:"get_credits",step:"checkout",provider:x}),g("Shop Buy Credits Failed",{step:"checkout",error_code:I(a),pack_usd:t.usd}),h(M(a)),o("error")}},[r,m,y]),v=i.useRef(!1);i.useEffect(()=>{if(v.current)return;const t=N.get("order");if(N.get("canceled")!=null){v.current=!0,g("Shop Buy Credits Cancelled",{order_id:t,provider:x}),A(),f(!0),o("select");return}t&&(o("processing"),r&&(v.current=!0,A(),y(t)))},[N,r]);function S(){var t;(t=b.current)==null||t.abort(),o("select"),E(null),L(null),h(null),f(!1)}const Y=p==="select";return e.jsxs("div",{className:"getcredits",children:[Y&&e.jsxs("header",{className:"getcredits__head",children:[e.jsx("h1",{className:"getcredits__title",children:s("getCredits.title",{currency:d.name})}),e.jsxs("p",{className:"getcredits__sub",children:[s("getCredits.subtitle",{currency:d.name})," ",e.jsxs("a",{className:"getcredits__learn",href:ne,target:"_blank",rel:"noreferrer",children:[s("getCredits.learnMore"),e.jsxs("svg",{className:"getcredits__learn-ico",viewBox:"0 0 13 13","aria-hidden":!0,fill:"none",children:[e.jsx("path",{d:"M4 2h7v7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M11 2 2 11",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})]}),p==="select"&&e.jsxs(e.Fragment,{children:[K&&e.jsx("p",{className:"getcredits__note muted",role:"status",children:s("getCredits.canceledNote")}),e.jsx(ie,{packs:F,loading:T,onSelect:t=>void O(t)})]}),p==="redirecting"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(te,{size:32}),e.jsx("p",{className:"muted",children:s("getCredits.redirecting")})]}),p==="processing"&&e.jsxs("div",{className:"gc-processing",role:"status","aria-live":"polite",children:[e.jsx("img",{className:"gc-processing__logo",src:J,alt:"",width:61,height:61}),e.jsxs("div",{className:"gc-processing__body",children:[e.jsxs("p",{className:"gc-processing__title",children:[e.jsx("strong",{children:s("getCredits.processing")}),"…"]}),e.jsxs("div",{className:"gc-progress","aria-hidden":!0,children:[e.jsx("span",{className:"gc-progress__track",children:e.jsx("span",{className:"gc-progress__fill"})}),e.jsx("span",{className:"gc-progress__count",children:"1/1"})]})]})]}),p==="success"&&e.jsxs("div",{className:"gc-success",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"gc-banner",children:[e.jsx("img",{className:"gc-banner__icon",src:ae,alt:"",width:60,height:60}),e.jsxs("p",{className:"gc-banner__text",children:[e.jsx("strong",{children:s("getCredits.successTitle")})," ",s("getCredits.successBody",{currency:d.name})]})]}),R!=null&&e.jsx("div",{className:"gc-credits",children:e.jsxs("div",{className:"gc-credits__row",children:[e.jsx("img",{className:"gc-credits__coin",src:re,alt:"",width:93,height:93}),e.jsxs("p",{className:"gc-credits__text",children:[e.jsx(W,{className:"gc-credits__diamond"}),e.jsxs("span",{children:[e.jsx("strong",{className:"gc-credits__amount",children:s("getCredits.creditsAmount",{credits:R,currency:d.name})})," ",e.jsx("span",{className:"gc-credits__added",children:s("getCredits.creditsAdded")})]})]})]})}),e.jsxs("div",{className:"gc-actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:S,children:s("getCredits.buyMore",{currency:d.name})}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:s("getCredits.startShopping")})]})]}),p==="pending"&&e.jsxs("div",{className:"gc-status",role:"status","aria-live":"polite",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.pendingTitle",{currency:d.name})}),e.jsx("p",{className:"muted",children:s("getCredits.pendingBody")}),e.jsxs("div",{className:"gc-status__actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:s("getCredits.startShopping")}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:S,children:s("getCredits.done")})]})]}),p==="error"&&e.jsxs("div",{className:"gc-status gc-status--err",role:"alert",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.errorTitle")}),e.jsx("p",{className:"error",children:U}),e.jsx("div",{className:"gc-status__actions",children:e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:S,children:s("getCredits.tryAgain")})})]})]})}function ie({packs:l,loading:r,onSelect:m}){return r?e.jsx("div",{className:"packs","aria-busy":"true","aria-label":s("getCredits.packsLoading",{currency:d.name}),children:[0,1,2,3].map(n=>e.jsx("div",{className:"pack pack--skeleton","aria-hidden":!0,children:e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"skeleton pack__label-sk"}),e.jsx("span",{className:"skeleton pack__art-sk"}),e.jsx("span",{className:"skeleton pack__cta-sk"})]})},n))}):e.jsx("div",{className:"packs",children:l.map(n=>e.jsxs("button",{type:"button",className:`pack${n.bestValue?" pack--best":""}`,"data-testid":"pack",onClick:()=>m(n),"aria-label":s("getCredits.packAria",{amount:z(n.credits),usd:n.usd}),children:[n.bestValue&&e.jsx("span",{className:"pack__badge",children:s("getCredits.packBadge")}),e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"pack__label",children:s("getCredits.creditsAmount",{credits:n.credits,currency:d.name})}),e.jsx("span",{className:"pack__art",children:e.jsx("img",{src:ce[n.id]??j,alt:"",loading:"lazy"})}),e.jsx("span",{className:"pack__cta-wrap",children:e.jsxs("span",{className:"pack__cta",children:["$",n.usd.toFixed(2)]})})]})]},n.id))})}export{je as GetCredits,je as default};
@@ -1,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-BQMla4xK.js";import{d as g,r as v}from"./index-BI7O7l1f.js";import{C as c}from"./ConstantsUtil-DO6FyoSW.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-CO4_1ccR.js";import{au as y}from"./NetworkUtil-BGlQiKvg.js";const b=g`
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-Bvrid8NA.js";import{d as g,r as v}from"./index-CfltZkIg.js";import{C as c}from"./ConstantsUtil-DO6FyoSW.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-bzfGoYP9.js";import{au as y}from"./NetworkUtil-BGlQiKvg.js";const b=g`
2
2
  :host {
3
3
  display: flex;
4
4
  justify-content: center;
@@ -1,4 +1,4 @@
1
- import{a as K,r as u,j as e,L as B}from"./react-BrLDncxD.js";import{e as $,t as s,C as w,B as k,g as L,x as P,E as A,u as U,d as W,o as O,m as z,s as Q,J}from"./index-D2u3qo5-.js";import{i as Y,R as D,f as G}from"./import-a0kWnC35.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./buy-CHyPhIFc.js";import"./authorizations-mnih5q8o.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./trade-encoding-CtfVB9K4.js";import"./mana-rate-DcCwt7oF.js";function H({queue:n,session:T,onClose:j,onDone:h}){const N=K(),d=$(T.providerType),[m,f]=u.useState(()=>n.map(()=>"pending")),[I,E]=u.useState("running"),S=u.useRef(!1);u.useEffect(()=>{if(S.current)return;S.current=!0;let t=!1;return(async()=>{for(let r=0;r<n.length;r++){if(t)return;f(p=>p.map((g,o)=>o===r?"active":g));try{await Y(n[r].item,n[r].priceCredits,T),P("Shop Migrated Listing",{item_id:n[r].item.itemId??n[r].item.oldTradeId??null,contract_address:n[r].item.contractAddress,new_price_credits:n[r].priceCredits,new_price_usd:n[r].priceCredits/10}),t||f(p=>p.map((g,o)=>o===r?"done":g))}catch(p){if(p instanceof D)A(p,{flow:"import_listing",step:"relist",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(g=>g.map((o,b)=>b===r?"unlisted":o));else{const g=p,o=g.code===4001||/reject|denied|cancel/i.test(g.message??"");o||A(p,{flow:"import_listing",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(b=>b.map((a,l)=>l===r?o?"skipped":"failed":a))}}}t||E("finished")})(),()=>{t=!0}},[]);const _=m.filter(t=>t==="done").length,v=m.findIndex(t=>t==="active"),x=Math.round(m.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function y(){h(),j()}if(I==="finished"){const t=m.filter(r=>r==="skipped"||r==="failed").length,c=m.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:_>0?s("migrate.successTitle"):s("migrate.nothingTitle")}),e.jsxs("p",{className:"muted",style:{margin:0},children:[_>0?s("migrate.listedSummary",{count:_,currency:w.name}):s("migrate.noneListed"),t>0?" "+s("migrate.skippedSummary",{count:t}):"",c>0?" "+s("migrate.unlistedSummary",{count:c}):""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(k,{variant:"ghost",onClick:y,children:s("getCredits.done")}),c>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/my-assets")},children:s("migrate.goToMyAssets")}):_>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/assets")},children:s("migrate.viewInShop")}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate","data-testid":"modal",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:s("migrate.listingTitle")}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[d?s("migrate.subConfirm"):s("migrate.subManaged")," ",v>=0?s("migrate.progressCount",{current:v+1,total:n.length}):""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${x}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,c)=>e.jsxs("li",{className:`migrate__row migrate__row--${m[c]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||s("migrate.itemFallback")}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(L,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:m[c]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",d?s("migrate.statusConfirm"):s("migrate.statusAdding")]}):m[c]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):m[c]==="skipped"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusSkipped")}):m[c]==="failed"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusFailed")}):m[c]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:s("migrate.unlistedTooltip"),children:s("migrate.statusUnlisted")}):e.jsx("span",{className:"migrate__wait",children:s("migrate.statusWaiting")})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:d?s("migrate.hintConfirm"):s("migrate.hintManaged")})]})})}const F=Q(k)`
1
+ import{a as K,r as u,j as e,L as B}from"./react-BrLDncxD.js";import{e as $,t as s,C as w,B as k,g as L,x as P,E as A,u as U,d as W,o as O,m as z,s as Q,J}from"./index-P7Sau0I5.js";import{i as Y,R as D,f as G}from"./import-DzTakhaX.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-BIvjmL85.js";import"./intl-CBcMB1D2.js";import"./buy-Djb-kNlV.js";import"./authorizations-4HFkBc9K.js";import"./sendMetaTransaction-iOoE_Tw3.js";import"./trade-encoding-DLx_mjRt.js";import"./mana-rate-DXdP8JQC.js";function H({queue:n,session:T,onClose:j,onDone:h}){const N=K(),d=$(T.providerType),[m,f]=u.useState(()=>n.map(()=>"pending")),[I,E]=u.useState("running"),S=u.useRef(!1);u.useEffect(()=>{if(S.current)return;S.current=!0;let t=!1;return(async()=>{for(let r=0;r<n.length;r++){if(t)return;f(p=>p.map((g,o)=>o===r?"active":g));try{await Y(n[r].item,n[r].priceCredits,T),P("Shop Migrated Listing",{item_id:n[r].item.itemId??n[r].item.oldTradeId??null,contract_address:n[r].item.contractAddress,new_price_credits:n[r].priceCredits,new_price_usd:n[r].priceCredits/10}),t||f(p=>p.map((g,o)=>o===r?"done":g))}catch(p){if(p instanceof D)A(p,{flow:"import_listing",step:"relist",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(g=>g.map((o,b)=>b===r?"unlisted":o));else{const g=p,o=g.code===4001||/reject|denied|cancel/i.test(g.message??"");o||A(p,{flow:"import_listing",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(b=>b.map((a,l)=>l===r?o?"skipped":"failed":a))}}}t||E("finished")})(),()=>{t=!0}},[]);const _=m.filter(t=>t==="done").length,v=m.findIndex(t=>t==="active"),x=Math.round(m.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function y(){h(),j()}if(I==="finished"){const t=m.filter(r=>r==="skipped"||r==="failed").length,c=m.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:_>0?s("migrate.successTitle"):s("migrate.nothingTitle")}),e.jsxs("p",{className:"muted",style:{margin:0},children:[_>0?s("migrate.listedSummary",{count:_,currency:w.name}):s("migrate.noneListed"),t>0?" "+s("migrate.skippedSummary",{count:t}):"",c>0?" "+s("migrate.unlistedSummary",{count:c}):""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(k,{variant:"ghost",onClick:y,children:s("getCredits.done")}),c>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/my-assets")},children:s("migrate.goToMyAssets")}):_>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/assets")},children:s("migrate.viewInShop")}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate","data-testid":"modal",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:s("migrate.listingTitle")}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[d?s("migrate.subConfirm"):s("migrate.subManaged")," ",v>=0?s("migrate.progressCount",{current:v+1,total:n.length}):""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${x}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,c)=>e.jsxs("li",{className:`migrate__row migrate__row--${m[c]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||s("migrate.itemFallback")}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(L,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:m[c]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",d?s("migrate.statusConfirm"):s("migrate.statusAdding")]}):m[c]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):m[c]==="skipped"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusSkipped")}):m[c]==="failed"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusFailed")}):m[c]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:s("migrate.unlistedTooltip"),children:s("migrate.statusUnlisted")}):e.jsx("span",{className:"migrate__wait",children:s("migrate.statusWaiting")})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:d?s("migrate.hintConfirm"):s("migrate.hintManaged")})]})})}const F=Q(k)`
2
2
  margin-top: 10px;
3
3
  `,V=Q(k)`
4
4
  padding: 13px 24px;