@abtnode/blocklet-services 1.16.52-beta-20251003-083412-fdfc4e36 → 1.16.52-beta-20251005-235515-42ad5caf

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 (254) hide show
  1. package/api/libs/connect/session.js +16 -1
  2. package/api/middlewares/check-running.js +9 -8
  3. package/api/middlewares/ensure-org-enabled.js +17 -0
  4. package/api/routes/blocklet.js +3 -3
  5. package/api/routes/user.js +175 -1
  6. package/api/services/auth/connect/switch-passport.js +2 -1
  7. package/api/services/auth/session.js +30 -0
  8. package/dist/assets/{AdapterDayjs-CAaLcejt.js → AdapterDayjs-wck-CfDF.js} +1 -1
  9. package/dist/assets/{Google-BMeng9mn.js → Google-BFauCF2k.js} +1 -1
  10. package/dist/assets/{access-control-BbcaXOFy.js → access-control-0wy7XAQb.js} +1 -1
  11. package/dist/assets/{actions-DbBJOD0d.js → actions-B4VXcSRp.js} +1 -1
  12. package/dist/assets/{add-component-core--Z5nF5rL.js → add-component-core-BM7p_09p.js} +23 -23
  13. package/dist/assets/add-resource-DbQFT7Gg.js +1 -0
  14. package/dist/assets/{addon-CnJnEleb.js → addon-CUvC0k6Y.js} +1 -1
  15. package/dist/assets/{advanced-DlEH3ib_.js → advanced-BhCewgzQ.js} +3 -3
  16. package/dist/assets/{aigne-CnGxZFk3.js → aigne-BQckonxP.js} +1 -1
  17. package/dist/assets/api-rC33aBSs.js +1 -0
  18. package/dist/assets/{appearance-DKR3ZZ-t.js → appearance-CjrhZWhd.js} +1 -1
  19. package/dist/assets/ar-CHd3xUx5.js +7 -0
  20. package/dist/assets/{arrow-down.svg-B_TkYBj9.js → arrow-down.svg-f3YCmAji.js} +1 -1
  21. package/dist/assets/{audit-logs-CY22RcFd.js → audit-logs-CASGp36e.js} +2 -2
  22. package/dist/assets/{authorize-DoJw-6hl.js → authorize-CkVYs-vE.js} +1 -1
  23. package/dist/assets/{base-chart-BbbiwJIa.js → base-chart-UFWO9a3P.js} +1 -1
  24. package/dist/assets/{base32-CgLd9kUN.js → base32-Cyneng4p.js} +1 -1
  25. package/dist/assets/{bind-account-CKozG7iQ.js → bind-account-D6KenxOW.js} +1 -1
  26. package/dist/assets/{branding-T8GaJvdM.js → branding-BVr5wVa5.js} +5 -5
  27. package/dist/assets/{branding-DqgDW-Pg.js → branding-CHhPscOd.js} +2 -2
  28. package/dist/assets/branding-DLDF3ZZP.js +1 -0
  29. package/dist/assets/{bundle-avatar-BALJ_pZQ.js → bundle-avatar-BpummNxa.js} +1 -1
  30. package/dist/assets/button-DGHIlhos.js +1 -0
  31. package/dist/assets/{click-to-copy-CVHuu877.js → click-to-copy-B379bwP3.js} +1 -1
  32. package/dist/assets/{cloneDeep-E2Pxqpbv.js → cloneDeep-LRq4Ya2k.js} +1 -1
  33. package/dist/assets/{collapse-DhGi244c.js → collapse-DJGzUM1Q.js} +1 -1
  34. package/dist/assets/complete-CQkeXJPL.js +39 -0
  35. package/dist/assets/{component-tJC1J22-.js → component-DWN2cI-c.js} +34 -34
  36. package/dist/assets/{config-CuaqTz1E.js → config-BgdQYz7Z.js} +2 -2
  37. package/dist/assets/{config-DkBKIb7u.js → config-CPB45HHq.js} +4 -4
  38. package/dist/assets/{config-CiixR7JW.js → config-CRxOjKmb.js} +1 -1
  39. package/dist/assets/config-navigation-D1TBA90f.js +40 -0
  40. package/dist/assets/config-space-DpOC6rFp.js +1 -0
  41. package/dist/assets/{confirm-BUTyrkJR.js → confirm-BfJfcPyj.js} +1 -1
  42. package/dist/assets/{connect-C2T5mJpT.js → connect-BbLXTlyu.js} +1 -1
  43. package/dist/assets/{connect-CwCzBgdq.js → connect-ZcwxKVuN.js} +1 -1
  44. package/dist/assets/{connect-to-C62UBG81.js → connect-to-Skv-ek56.js} +1 -1
  45. package/dist/assets/{content-layout-CaGd-JXO.js → content-layout-B9tc9LCL.js} +1 -1
  46. package/dist/assets/create-passport-svg-DosyhcHP.js +1 -0
  47. package/dist/assets/{createClass-BuhPvJV8.js → createClass-HFwzUuOB.js} +1 -1
  48. package/dist/assets/dashboard-DJ6Tc_2L.js +106 -0
  49. package/dist/assets/de-CD44Obtw.js +7 -0
  50. package/dist/assets/{delete-confirm-zH2oZyqM.js → delete-confirm-DNg1Z1xV.js} +1 -1
  51. package/dist/assets/{did-address-CeTjTMC4.js → did-address-Dbg_LiWL.js} +1 -1
  52. package/dist/assets/{domain-BmzmdNfA.js → domain-3JvbKqlt.js} +1 -1
  53. package/dist/assets/{domain-action-card-BM27YVmt.js → domain-action-card-BixPviaZ.js} +2 -2
  54. package/dist/assets/domains-D8QMeppe.js +1 -0
  55. package/dist/assets/{email-vdkECdsC.js → email-C6m1mnbN.js} +1 -1
  56. package/dist/assets/{empty-spinner-CkCqfxFX.js → empty-spinner-LXNYl6_1.js} +1 -1
  57. package/dist/assets/engine-DkWTqqhM.js +1 -0
  58. package/dist/assets/es-DNFAt0y7.js +9 -0
  59. package/dist/assets/{exchange-passport-DdKgNabQ.js → exchange-passport-BraV0EOe.js} +1 -1
  60. package/dist/assets/{form-DD1zzF-R.js → form-BIoto8u8.js} +1 -1
  61. package/dist/assets/form-text-input-BgpOkOYh.js +11 -0
  62. package/dist/assets/{form-wrapper-DNqXvSru.js → form-wrapper-Dt1iJZge.js} +1 -1
  63. package/dist/assets/fr-C9xE9tD4.js +7 -0
  64. package/dist/assets/{fuel-h75SX900.js → fuel-Dwo_gklT.js} +1 -1
  65. package/dist/assets/gen-access-key-DuRApUI5.js +1 -0
  66. package/dist/assets/{gen-simple-access-key-Bq7DCyW7.js → gen-simple-access-key-xXyYChfi.js} +1 -1
  67. package/dist/assets/get-safe-url-HFT553nb.js +1 -0
  68. package/dist/assets/hi-D_0DFJcS.js +5 -0
  69. package/dist/assets/{home-B3HQdfZf.js → home-D0rR9_38.js} +1 -1
  70. package/dist/assets/id-BgJjfH2L.js +7 -0
  71. package/dist/assets/iframe-COascK-f.js +1 -0
  72. package/dist/assets/{index-Dr9NaKfR.js → index-3ePiAFIp.js} +1 -1
  73. package/dist/assets/{index-BjcHj49D.js → index-A5fXAFXl.js} +1 -1
  74. package/dist/assets/{index-BtHqqZ50.js → index-AMzbVwE1.js} +1 -1
  75. package/dist/assets/{index-C_YGTMJ4.js → index-B3o5bPY9.js} +1 -1
  76. package/dist/assets/{index-Chi1YHs4.js → index-BAMrdOx5.js} +1 -1
  77. package/dist/assets/{index-BVRSxJRS.js → index-BO080WnZ.js} +1 -1
  78. package/dist/assets/index-BU5Qj_Uf.js +93 -0
  79. package/dist/assets/index-BiMTr9N1.js +6 -0
  80. package/dist/assets/index-BkMwz7Ha.js +281 -0
  81. package/dist/assets/{index-CZkVe8t1.js → index-BoF74OVD.js} +12 -12
  82. package/dist/assets/{index-6IwthDxj.js → index-BrrIKxMS.js} +1 -1
  83. package/dist/assets/{index-3xeMR-Qg.js → index-Bx-RW9vi.js} +1 -1
  84. package/dist/assets/{index-CKsy2_Ph.js → index-CARCeLG0.js} +2 -2
  85. package/dist/assets/index-CX8XMi66.js +1 -0
  86. package/dist/assets/{index-BzFZ1zhO.js → index-CjUelepA.js} +1 -1
  87. package/dist/assets/{index-BNDipwdR.js → index-Cv0WQg6r.js} +3 -3
  88. package/dist/assets/{index-BiLQGAIi.js → index-DKQpQSIL.js} +2 -2
  89. package/dist/assets/index-DKp1VidC.js +7 -0
  90. package/dist/assets/index-DOTZtBXk.js +113 -0
  91. package/dist/assets/{index-ImKSuLO2.js → index-DXDOA6wf.js} +2 -2
  92. package/dist/assets/{index-CmjYsAgT.js → index-DcGTEgwU.js} +4 -4
  93. package/dist/assets/index-DnsQF6x_.js +1 -0
  94. package/dist/assets/{index-BYry2QZ3.js → index-Ds4S1_JK.js} +3 -3
  95. package/dist/assets/index-DsZw1jDU.js +1039 -0
  96. package/dist/assets/{index-DbXxI_D0.js → index-IYdn8PnM.js} +1 -1
  97. package/dist/assets/index-Z8qCN0P1.js +200 -0
  98. package/dist/assets/{index-CzlhyS8_.js → index-cc7PDHui.js} +1 -1
  99. package/dist/assets/{index-BluBXQJ4.js → index-d3X4O8S1.js} +4 -4
  100. package/dist/assets/{index-KJrnzKIu.js → index-g1J2WU69.js} +1 -1
  101. package/dist/assets/index-o5365tSi.js +124 -0
  102. package/dist/assets/{index-CD_JYNBB.js → index-pMD5HObM.js} +10 -10
  103. package/dist/assets/{index-C2DPoZpQ.js → index-un8ZaNww.js} +5 -5
  104. package/dist/assets/{index-CGXZRmKt.js → index-yINGgTD8.js} +6 -6
  105. package/dist/assets/{invitation-CMi0GWFt.js → invitation-HIuSHONR.js} +7 -7
  106. package/dist/assets/invitations-Bol3LHDV.js +3 -0
  107. package/dist/assets/invite--kfNCB-y.js +1 -0
  108. package/dist/assets/{isURL-CSKc4kTl.js → isURL-NLB1KXWU.js} +1 -1
  109. package/dist/assets/issue-passport-DEKfDU5Q.js +1 -0
  110. package/dist/assets/{item-DsH8hlQV.js → item-8d2bomfb.js} +1 -1
  111. package/dist/assets/ja-SFs9TI5a.js +9 -0
  112. package/dist/assets/ko-CHdBh-EI.js +9 -0
  113. package/dist/assets/{landing-page-CAdZF71_.js → landing-page-BKWBeaB2.js} +1 -1
  114. package/dist/assets/{launch-result-message-B0--4ubW.js → launch-result-message-DW948RfZ.js} +1 -1
  115. package/dist/assets/{layout-CN4YohUY.js → layout-BCGFP2fM.js} +1 -1
  116. package/dist/assets/{list-Bf1rfvw3.js → list-CLnYaffq.js} +2 -2
  117. package/dist/assets/{list-2lBZBVJD.js → list-CjwYZK4C.js} +2 -2
  118. package/dist/assets/{list-header-DlrmpNef.js → list-header-DMpz8A8v.js} +1 -1
  119. package/dist/assets/localization-D4M90esB.js +1 -0
  120. package/dist/assets/{log-CKMWqM_9.js → log-CwhRn7dG.js} +1 -1
  121. package/dist/assets/logger-GZGSMwyW.js +1 -0
  122. package/dist/assets/login-D6vdg4tV.js +1 -0
  123. package/dist/assets/{login-oauth-callback-B4wL5LK5.js → login-oauth-callback-DNSbhkTX.js} +1 -1
  124. package/dist/assets/{logo-uploader-CgW-ljTo.js → logo-uploader-CehwiZZl.js} +2 -2
  125. package/dist/assets/{lost-passport-BiaJ8Qil.js → lost-passport-JcRjjJMu.js} +3 -3
  126. package/dist/assets/{observability-3BjnzXRV.js → observability-pdEZhjSl.js} +1 -1
  127. package/dist/assets/{omit-r-0RLWOV.js → omit-BQZKecPT.js} +1 -1
  128. package/dist/assets/{open-window-BAToG1Zw.js → open-window-5tX5UogI.js} +1 -1
  129. package/dist/assets/{over-due-invoice-payment-D4EbV_XU.js → over-due-invoice-payment-BQTpVcW4.js} +1 -1
  130. package/dist/assets/overview-8cijjh6D.js +85 -0
  131. package/dist/assets/{page-header-DP0csqkR.js → page-header-DvSb4Cmz.js} +1 -1
  132. package/dist/assets/passport-dBKTMShn.js +1 -0
  133. package/dist/assets/{passport-item-DTKCI96Q.js → passport-item-DybXmjDL.js} +1 -1
  134. package/dist/assets/{permission-DWlLl3B8.js → permission-DPZmpN88.js} +1 -1
  135. package/dist/assets/{playground-BEhnKrD-.js → playground-C0bWoIDS.js} +1 -1
  136. package/dist/assets/preferences-CSIWwAIC.js +1 -0
  137. package/dist/assets/profile-embed-Dxmu0kHv.js +1 -0
  138. package/dist/assets/pt-BJowi6tZ.js +5 -0
  139. package/dist/assets/publish-resource-BEWgZsl5.js +1 -0
  140. package/dist/assets/{react-beautiful-dnd.esm-9QLg1KOC.js → react-beautiful-dnd.esm-BbVphn6n.js} +1 -1
  141. package/dist/assets/{react-stripe.esm-DWiCVD55.js → react-stripe.esm-C51Uah32.js} +1 -1
  142. package/dist/assets/{required-BUAaYcMZ.js → required-BT8zXV8U.js} +1 -1
  143. package/dist/assets/ru-DTjDV3Pw.js +5 -0
  144. package/dist/assets/runtime-Dw23IX1l.js +1 -0
  145. package/dist/assets/{sanitize-mRppk1lK.js → sanitize-C5jEFDvG.js} +1 -1
  146. package/dist/assets/sdk-BIWRdmX9.js +1 -0
  147. package/dist/assets/{section-CCfmWVdK.js → section-ZPKr6_ii.js} +1 -1
  148. package/dist/assets/{security-D--MQBTg.js → security-D_vkAC2F.js} +1 -1
  149. package/dist/assets/session-tOfkTx-G.js +1 -0
  150. package/dist/assets/{setup-BS5cDalg.js → setup-eJiK00ap.js} +1 -1
  151. package/dist/assets/{shorten-label-DAXPWCI6.js → shorten-label-DVy6K5I7.js} +1 -1
  152. package/dist/assets/simple-select-BeAlThKq.js +1 -0
  153. package/dist/assets/{spaces-6iUrdnzs.js → spaces-f3sezu1Y.js} +1 -1
  154. package/dist/assets/start-tshF2U2D.js +187 -0
  155. package/dist/assets/starting-progress-CNhbI5kz.js +40 -0
  156. package/dist/assets/status-aauXt2lH.js +1 -0
  157. package/dist/assets/{step-actions-3Nz2nPoP.js → step-actions-B_qluS-3.js} +1 -1
  158. package/dist/assets/{studio-C6g9y1mS.js → studio-ahebVj52.js} +1 -1
  159. package/dist/assets/{switch-control-Bs2D4JNi.js → switch-control-B8BKalcv.js} +1 -1
  160. package/dist/assets/{table-tips-B1dFVdej.js → table-tips-CIe4hASP.js} +1 -1
  161. package/dist/assets/team-DJZO6TyJ.js +146 -0
  162. package/dist/assets/th-A3GLGlJ1.js +5 -0
  163. package/dist/assets/traffic-Dh4U8pnc.js +1 -0
  164. package/dist/assets/{transfer-B90XYpQX.js → transfer-CuvzwKCQ.js} +1 -1
  165. package/dist/assets/{unsubscribe-DBJXxz9h.js → unsubscribe-B1yTQQGf.js} +1 -1
  166. package/dist/assets/{use-app-logo-Cs4SrcDi.js → use-app-logo-CqD9SoXr.js} +1 -1
  167. package/dist/assets/{use-mobile-BW9mTiYC.js → use-mobile-BQQpAf3i.js} +1 -1
  168. package/dist/assets/{use-mobile-B_fpUHD7.js → use-mobile-D6YQgajG.js} +1 -1
  169. package/dist/assets/{use-server-logo-R848M-JH.js → use-server-logo-ClR4qaF0.js} +1 -1
  170. package/dist/assets/{use-window-close-Dk0lXOqo.js → use-window-close-CLNOz9Uq.js} +1 -1
  171. package/dist/assets/{useAsync-DkQHu4t4.js → useAsync-DVtDVEv6.js} +1 -1
  172. package/dist/assets/{useAsync-DoI7Qt9M.js → useAsync-fWwm3Jbj.js} +1 -1
  173. package/dist/assets/{useAsyncRetry-DNTidBXG.js → useAsyncRetry-EEjDgDMR.js} +1 -1
  174. package/dist/assets/{useLocalStorage-BzRs3x-K.js → useLocalStorage-BPSCf_zz.js} +1 -1
  175. package/dist/assets/user-center-DDfna1uE.js +126 -0
  176. package/dist/assets/user-follower-Cc-51q-9.js +32 -0
  177. package/dist/assets/{user-sessions-DqMaEduy.js → user-sessions-DkchVQBO.js} +1 -1
  178. package/dist/assets/{util-C8ahPkmT.js → util-B8Xud4vY.js} +1 -1
  179. package/dist/assets/{util-CRzq0bMY.js → util-D8KMfML_.js} +1 -1
  180. package/dist/assets/{vendor-arcblock-BhtOu00C.js → vendor-arcblock-CSGgL93G.js} +1 -1
  181. package/dist/assets/{vendor-hooks-BtDnIwBH.js → vendor-hooks-BlA8TRnZ.js} +2 -2
  182. package/dist/assets/vendor-mui-core-DRxbhqaK.js +250 -0
  183. package/dist/assets/{vendor-mui-x-DWX99wt-.js → vendor-mui-x-Qp6zkx78.js} +1 -1
  184. package/dist/assets/{vendor-utils-CVwaKsP9.js → vendor-utils-CUDP56Ff.js} +1 -1
  185. package/dist/assets/{vendor-ux-Cfhaj-oj.js → vendor-ux-CDOuCaX1.js} +3 -3
  186. package/dist/assets/vi-DGXwnYQW.js +5 -0
  187. package/dist/assets/{wait-connect-E47qTAaT.js → wait-connect-CGOeOXHL.js} +1 -1
  188. package/dist/assets/{wizard-2kfr1LiF.js → wizard-B7NraPoW.js} +1 -1
  189. package/dist/assets/{wizard-components-De0Ol72d.js → wizard-components-Bl0PwqPC.js} +7 -7
  190. package/dist/assets/wrap-locale-BQiQiZG-.js +1 -0
  191. package/dist/assets/zh-CJ0qBy8e.js +10 -0
  192. package/dist/assets/{zh-Du23hKEW.js → zh-DQ2rCoQ5.js} +1 -1
  193. package/dist/assets/zh-tw-Cs-zRk58.js +9 -0
  194. package/dist/index.html +6 -6
  195. package/dist/service-worker.js +1 -1
  196. package/package.json +32 -32
  197. package/dist/assets/add-resource-DRGO7kDY.js +0 -1
  198. package/dist/assets/api-BUbloWod.js +0 -1
  199. package/dist/assets/ar-DDKSNNIB.js +0 -7
  200. package/dist/assets/branding-Dc9wDqPm.js +0 -1
  201. package/dist/assets/button-BG8yGG9e.js +0 -1
  202. package/dist/assets/complete-Td6_SOPf.js +0 -39
  203. package/dist/assets/config-navigation-BFl1_q-j.js +0 -40
  204. package/dist/assets/config-space-B8dCR8jO.js +0 -1
  205. package/dist/assets/dashboard-B0Fy6SmC.js +0 -106
  206. package/dist/assets/de-C5jW-Aco.js +0 -7
  207. package/dist/assets/domains-CEkJn9DL.js +0 -1
  208. package/dist/assets/engine-CCa9THLZ.js +0 -1
  209. package/dist/assets/es-DnE5Se03.js +0 -9
  210. package/dist/assets/form-text-input-CqoNK3mi.js +0 -11
  211. package/dist/assets/fr-BpXortYf.js +0 -7
  212. package/dist/assets/gen-access-key-BZebBcUZ.js +0 -1
  213. package/dist/assets/get-safe-url-CeMtySPx.js +0 -1
  214. package/dist/assets/hi-CeUu25BW.js +0 -5
  215. package/dist/assets/id-BugYMmLN.js +0 -7
  216. package/dist/assets/iframe-ASQIizLx.js +0 -1
  217. package/dist/assets/index-6B51asLP.js +0 -292
  218. package/dist/assets/index-BIIL1VhU.js +0 -1039
  219. package/dist/assets/index-BlTmYBsg.js +0 -124
  220. package/dist/assets/index-CmsJ8Fn7.js +0 -1
  221. package/dist/assets/index-DBJZdu-W.js +0 -113
  222. package/dist/assets/index-Dn4pwRtk.js +0 -1
  223. package/dist/assets/index-DwQNuuxR.js +0 -283
  224. package/dist/assets/index-ajyKTkxP.js +0 -7
  225. package/dist/assets/invite-DpA2tJ_s.js +0 -1
  226. package/dist/assets/issue-passport-B0QyEUjC.js +0 -1
  227. package/dist/assets/ja-DaREJWmX.js +0 -9
  228. package/dist/assets/ko-DGXdpX64.js +0 -9
  229. package/dist/assets/localization-D12SXxDi.js +0 -1
  230. package/dist/assets/logger-CsgnUk8i.js +0 -1
  231. package/dist/assets/login-y-09uRl4.js +0 -1
  232. package/dist/assets/overview-C734Rasc.js +0 -85
  233. package/dist/assets/preferences-DTgCHjY9.js +0 -1
  234. package/dist/assets/profile-embed-4R2fOO01.js +0 -1
  235. package/dist/assets/pt-CIqefLTL.js +0 -5
  236. package/dist/assets/publish-resource-CHMkx0I2.js +0 -1
  237. package/dist/assets/ru-B4h3WudR.js +0 -5
  238. package/dist/assets/runtime-CUzpUEb5.js +0 -1
  239. package/dist/assets/sdk-CxjuM-ya.js +0 -1
  240. package/dist/assets/session-B_RHNjCZ.js +0 -1
  241. package/dist/assets/simple-select-BHPmFba3.js +0 -1
  242. package/dist/assets/start-ByPfhiAj.js +0 -187
  243. package/dist/assets/starting-progress-CxdsmebW.js +0 -40
  244. package/dist/assets/status-DA0S9WgZ.js +0 -1
  245. package/dist/assets/team-CcIOrTIk.js +0 -146
  246. package/dist/assets/th-BjttL5p9.js +0 -5
  247. package/dist/assets/traffic-KIPRLJPY.js +0 -1
  248. package/dist/assets/user-center-bNIwz7Mp.js +0 -126
  249. package/dist/assets/user-follower-UoHvZnoE.js +0 -32
  250. package/dist/assets/vendor-mui-core-BIZOanxj.js +0 -250
  251. package/dist/assets/vi-C-IhikR1.js +0 -5
  252. package/dist/assets/wrap-locale-Ck3zJtU5.js +0 -1
  253. package/dist/assets/zh-CWvcoHsp.js +0 -10
  254. package/dist/assets/zh-tw-D_73qm-O.js +0 -9
@@ -1,124 +0,0 @@
1
- import{j as e,y as Pt,bb as Re,M as ae,ak as x,Q as H,W as u,J as xe,c0 as Rt,I as $,aN as It,T as I,aj as Tt,b5 as Be,P as We,b6 as X,a5 as Oe,z as Qe,A as Xe,ci as At,bf as Mt,U as Ce,d7 as zt,d8 as Et,at as te,d9 as Lt,a6 as Z,n as le,D as Bt,da as Wt,ar as De,b1 as Ie,db as Ot,aX as Dt,ai as Nt,am as J,bp as $t,bq as ve,a$ as Ft,cS as Ut}from"./vendor-mui-core-BIZOanxj.js";import{r as b,a as _t,u as qt,j as Ht}from"./vendor-react-Dvs43sk9.js";import{t as Je,Z as Gt,a8 as Kt,R as Ne,D as Vt,C as ce,n as Y,A as Yt}from"./vendor-utils-CVwaKsP9.js";import{a as Zt,G as Qt,bx as Xt,c as Te,d as Jt,X as er,by as tr,aX as Ae,V as fe,bd as rr,bz as nr,a4 as or,aZ as sr,a5 as ir,bA as ar}from"./index-BIIL1VhU.js";import{a as R,h as et,k as re,g as G,b as z,j as lr}from"./vendor-hooks-BtDnIwBH.js";import{l as tt}from"./arrow-down.svg-B_TkYBj9.js";import{c as Me,O,T as W,aw as cr,p as rt,ax as dr,H as q,ay as ur,az as pr,aA as $e,f as xr,n as nt,e as ze,aB as fr,aC as M,B as hr,A as gr,$ as ot,aD as mr,aE as br,x as yr,o as de,G as Fe,P as vr,a1 as Ue}from"./vendor-ux-Cfhaj-oj.js";import{N as wr}from"./list-2lBZBVJD.js";import{d as jr}from"./search-4YYphs0l.js";import{B as _e}from"./bundle-avatar-BALJ_pZQ.js";import{h as qe,T as Cr}from"./team-CcIOrTIk.js";import{b as Sr,d as kr,a as Pr,c as Rr,e as Ir,f as Tr,h as Ar,_ as Mr}from"./user-center-bNIwz7Mp.js";import{N as st,U as it}from"./index-C2DPoZpQ.js";import{u as Q}from"./use-mobile-B_fpUHD7.js";import zr from"./index-BzFZ1zhO.js";import{f as ee}from"./index-DBs9Ljax.js";import{u as Se}from"./index-BjcHj49D.js";import{U as we}from"./user-sessions-DqMaEduy.js";import Er from"./index-CGXZRmKt.js";import{o as Lr}from"./vendor-arcblock-BhtOu00C.js";import{c as Br,b as ue,a as Wr,S as Or}from"./index-BYry2QZ3.js";import"./index-6IwthDxj.js";import"./index-BojVbZw0.js";import{U as Dr}from"./user-follower-UoHvZnoE.js";import"./lottie-web-4koyQiv_.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-BtHqqZ50.js";import"./util-CRzq0bMY.js";import"./base32-CgLd9kUN.js";import"./session-B_RHNjCZ.js";import"./isURL-CSKc4kTl.js";import"./use-app-logo-Cs4SrcDi.js";import"./index-BluBXQJ4.js";import"./api-BUbloWod.js";import"./table-tips-B1dFVdej.js";import"./use-mobile-BW9mTiYC.js";import"./passport-item-DTKCI96Q.js";import"./did-address-CeTjTMC4.js";import"./index-Dn4pwRtk.js";import"./vendor-mui-x-DWX99wt-.js";import"./AdapterDayjs-CAaLcejt.js";import"./confirm-BUTyrkJR.js";import"./click-to-copy-CVHuu877.js";import"./delete-confirm-zH2oZyqM.js";import"./permission-DWlLl3B8.js";import"./actions-DbBJOD0d.js";import"./index-DRYJ0xIl.js";function Nr(){let t=new Map;function o({root:s,rootMargin:n,threshold:a}){let i=t.get(s);i||(i=new Map,t.set(s,i));let l=JSON.stringify({rootMargin:n,threshold:a}),p=i.get(l);if(!p){let r=new Map;p={observer:new IntersectionObserver(f=>{f.forEach(m=>{r.get(m.target)?.(m)})},{root:s,rootMargin:n,threshold:a}),entryCallbacks:r},i.set(l,p)}return{observe:(r,f)=>{p.entryCallbacks.set(r,f),p.observer.observe(r)},unobserve:r=>{p.entryCallbacks.delete(r),p.observer.unobserve(r)}}}return{getObserver:o}}var $r="0px",Fr=[0],Ur=Nr();function _r(t){let o=t?.rootMargin??$r,s=t?.threshold??Fr,n=b.useRef(null),a=b.useRef(null),i=b.useRef(null),[l,p]=b.useState(),r=b.useCallback(()=>{let C=n.current;if(!C){p(void 0);return}let v=Ur.getObserver({root:a.current,rootMargin:o,threshold:s});v.observe(C,c=>{p(c)}),i.current=v},[o,s]),f=b.useCallback(()=>{let C=i.current,v=n.current;v&&C?.unobserve(v),i.current=null},[]),m=b.useCallback(C=>{f(),n.current=C,r()},[r,f]),g=b.useCallback(C=>{f(),a.current=C,r()},[r,f]);return[m,{entry:l,rootRef:g}]}var qr=_r;function Hr(t){let[o,s]=qr(t),n=!!s.entry?.isIntersecting,[a,i]=b.useState(n);return n&&!a&&i(!0),[o,{...s,isVisible:n,wasEverVisible:a}]}var Gr=Hr,Kr=100;function Vr({loading:t,hasNextPage:o,onLoadMore:s,rootMargin:n,disabled:a,delayInMs:i=Kr}){let l=b.useRef(s),[p,{rootRef:r,isVisible:f}]=Gr({rootMargin:n});b.useEffect(()=>{l.current=s},[s]);let m=!a&&!t&&f&&o;return b.useEffect(()=>{if(m){let g=setTimeout(()=>{l.current()},i);return()=>{clearTimeout(g)}}},[m,i]),[p,{rootRef:r}]}var Yr=Vr;const je={info:"#3B82F6",success:"#10B981",warning:"#F59E0B",error:"#EF4444"};pe.propTypes={severity:u.oneOf(["info","success","warning","error",""]).isRequired,size:u.number};function pe({severity:t,size:o=8}){return je[t]?e.jsx(x,{component:"span",sx:{display:"inline-block",width:o,height:o,borderRadius:"50%",backgroundColor:je[t]||je.info}}):null}at.propTypes={theme:u.string,type:u.oneOf(["button","line","select"]),onSelectType:u.func,extra:u.node,loading:u.bool,currentTab:u.oneOf(["info","success","warning","error",""])};function at({theme:t="dark",type:o="button",onSelectType:s,extra:n=void 0,currentTab:a="",loading:i=!1,...l}){const{t:p}=b.useContext(Me),r=[{label:p("notification.allSeverity"),value:""},{label:p("notification.severityType.info"),value:"info"},{label:p("notification.severityType.success"),value:"success"},{label:p("notification.severityType.warning"),value:"warning"},{label:p("notification.severityType.error"),value:"error"}],f=h=>{(h!==a||!i)&&s(h)},m=b.useMemo(()=>{const h={width:"100%",bgcolor:t==="dark"?"#F9FAFB":"",overflowY:"auto",paddingTop:o==="select"?"0":"5px",whiteSpace:"nowrap",borderRadius:0,display:"flex",justifyContent:"space-between",alignItems:"flex-end",flexWrap:"wrap",gap:"8px"};return o==="line"?Object.assign(h,{}):h},[o,t]),g=(h,S,T)=>e.jsx(H,{disabled:i,onClick:()=>f(h.value),className:`profile-button ${S?"active":""}`,...l,children:h.label},h.value||T),C=(h,S,T)=>e.jsx(H,{variant:"text",disabled:i,onClick:()=>f(h.value),className:`profile-line-button ${S?"active":""}`,...l,children:h.label},h.value||T),v=()=>r?.map((h,S)=>{const T=a===h?.value;return o==="line"?e.jsx(b.Fragment,{children:C(h,T,S)},h.value||S):e.jsx(b.Fragment,{children:g(h,T,S)},h.value||S)}),c=h=>{const{value:S}=h.target;f(S==="all"?"":S)};return o==="select"?e.jsx(Pt,{sx:{maxWidth:300},children:e.jsx(Re,{value:a||"all",onChange:c,size:"small",label:"Severity",IconComponent:h=>e.jsx(tt,{...h,width:20,height:20}),MenuProps:{autoFocus:!1,PaperProps:{style:{maxHeight:400,overflowY:"auto",borderRadius:"8px",boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},variant:"outlined",sx:{fieldset:{border:"none"}},children:r.map((h,S)=>e.jsx(ae,{value:h.value||"all",children:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(pe,{severity:h.value}),h.label]})},h.value||S))})}):e.jsxs(x,{className:"severity-tabs",sx:m,children:[e.jsx(x,{sx:{...o==="line"?{flex:1,borderBottom:"1px solid",borderColor:"grey.200"}:{display:"flex",gap:"24px"}},children:v()}),n]})}lt.propTypes={paging:u.objectOf(u.any).isRequired,loading:u.bool.isRequired,onChange:u.func.isRequired};function lt({loading:t,paging:o,onChange:s}){const{t:n}=b.useContext(Me),a=xe(r=>r.breakpoints.down("md"));if(o.pageCount<=0||a)return null;const i=(r,f)=>{s({page:f+1})},l=r=>{const f=Number(r.target.value);s({page:1,pageSize:f})},p=o.page-1<=0?0:o.page-1;return e.jsx(x,{className:"notification-pagination",sx:{mt:2,display:"flex",justifyContent:"flex-end"},children:e.jsx(Rt,{component:"div",disabled:t,count:o.total,page:p,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:n("pagination.rowsPerPage"),labelDisplayedRows:({from:r,to:f,count:m})=>`${r}–${f} / ${m!==-1?m:`${n()}more than ${f}`}`,rowsPerPage:o.pageSize,onPageChange:i,onRowsPerPageChange:l})})}const Zr=b.memo(lt),Qr={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4h16v2.172a2 2 0 0 1-.586 1.414L15 12v7l-6 2v-8.5L4.52 7.572A2 2 0 0 1 4 6.227V4z"/>'},He=6,Ge={"& .MuiCheckbox-root":{padding:"4px"},"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"1.35rem"},"& .MuiCheckbox-root:not(.Mui-checked)":{color:"divider"},"& .MuiCheckbox-root.Mui-checked":{color:"primary.main"},"& .MuiCheckbox-root .css-i4bv87-MuiSvgIcon-root":{width:"1.1em",height:"1.1em"},"& .MuiCheckbox-root svg":{stroke:"divider",strokeWidth:.7}},Xr={border:"1px solid",borderColor:"divider",borderRadius:1,overflow:"hidden",backgroundColor:"background.paper",backgroundImage:"none",transition:"all 0.2s ease-in-out"},Ke=()=>({...Xr,width:"calc(50% - 8px)"});ct.propTypes={loading:u.bool,type:u.oneOf(["server","service"]),onFilterChange:u.func,blockletMap:u.object,filterType:u.oneOf(["component","entity"]),selectedId:u.array,severity:u.array,enableMarkAllAsRead:u.bool,unReadCount:u.number,onReadFilterChange:u.func,currentReadFilter:u.string};function ct({onFilterChange:t=()=>{},loading:o=!1,type:s="service",blockletMap:n={},filterType:a="component",selectedId:i=[],severity:l=[],enableMarkAllAsRead:p=!0,unReadCount:r=0,onReadFilterChange:f=()=>{},currentReadFilter:m="all"}){const{t:g}=b.useContext(Me),[C,v]=b.useState(null),c=!!C,[h,S]=b.useState(i),[T,P]=b.useState(l),[y,E]=b.useState(!1),[L,U]=b.useState(""),[N,j]=b.useState([]);b.useEffect(()=>{S(i),P(l)},[i,l]);const k=[{label:g("notification.filterType.all"),value:"all"},{label:g("notification.filterType.unread"),value:"unread"}],D=d=>{(d!==m||!o)&&f(d)},K=[{label:g("notification.severityType.info"),value:"info"},{label:g("notification.severityType.success"),value:"success"},{label:g("notification.severityType.warning"),value:"warning"},{label:g("notification.severityType.error"),value:"error"}],ne=d=>{v(d.currentTarget),U(""),E(!1)},ge=()=>{v(null)},oe=d=>{const w=h.includes(d)?h.filter(A=>A!==d):[...h,d];S(w),t({id:w,severity:T})},se=d=>{const w=T.includes(d)?T.filter(A=>A!==d):[...T,d];P(w),t({severity:w,id:h})},me=d=>{U(d.target.value)},be=()=>{E(!y)},V=_t.useMemo(()=>{if(!n.size)return[];const d=[];return a==="component"&&d.push({label:g("notification.system"),id:"system"}),Array.from(n).forEach(([,w])=>{const A=w.did||w.meta?.did,B=w.title||w.meta?.title||"",_=w.appPid||w.appDid;(a==="component"&&_!==A||a==="entity"&&_===A)&&d.push({label:B,id:A,blocklet:w,ancestors:w.ancestors})}),d},[n,a,g]);b.useEffect(()=>{if(L.trim()==="")j(V);else{const d=L.toLowerCase(),w=V.filter(A=>A.label.toLowerCase().includes(d));j(w)}},[L,V]);const ye=L.trim()!==""||y?N:N.slice(0,He);return e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:p?"space-between":"flex-end",alignItems:"flex-start",flexWrap:"wrap",gap:1},children:[p&&e.jsx(x,{sx:{display:"flex",gap:1.5},children:k.map(d=>e.jsxs(H,{disabled:o,onClick:()=>D(d.value),className:`profile-button ${m===d.value?"active":""}`,sx:{...s==="service"&&m===d.value?{color:"secondary.main"}:{},color:"red",fontWeight:m===d.value?"bold":"normal"},children:[d.label,d.value==="unread"&&r>0&&` (${r})`]},d.value))}),e.jsxs(x,{sx:{display:"flex",justifyContent:"flex-end",gap:2},children:[e.jsx($,{size:"small",onClick:ne,disabled:o,sx:{minWidth:"auto",borderRadius:1,border:"1px solid",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:e.jsx(O,{icon:Qr,hFlip:!0})}),e.jsx(It,{open:c,anchorEl:C,onClose:ge,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{p:3,width:450,maxHeight:500,overflowY:"auto",backgroundColor:"background.paper",backgroundImage:"none",borderRadius:1,boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},children:e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,height:"28px"},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold"},children:g("notification.severity")}),e.jsx(x,{sx:{minWidth:"60px",display:"flex",justifyContent:"flex-end"},children:(h.length>0||T.length>0)&&e.jsx(H,{size:"small",onClick:()=>{S([]),P([]),t({severity:[],id:[]})},startIcon:e.jsx(Tt,{fontSize:"small"}),sx:{color:"text.secondary",textTransform:"none",minWidth:"auto","&:hover":{backgroundColor:"transparent"},"& .MuiButton-startIcon":{marginRight:"2px"}},children:g("notification.clear")})})]}),e.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(Be,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,flex:1},children:K.map(d=>e.jsx(We,{elevation:0,sx:Ke(T.includes(d.value)),children:e.jsx(X,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{display:"flex",alignItems:"center",gap:1,fontSize:"0.875rem"},...Ge},control:e.jsx(Oe,{checked:T.includes(d.value),onChange:()=>se(d.value),disabled:o,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5},children:[e.jsx(pe,{severity:d.value}),d.label]})})},d.value))})}),e.jsxs(x,{sx:{mb:2},children:[e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:1.5},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold",width:"calc(100% - 36px)"},children:g("notification.from")}),e.jsx(x,{sx:{display:"flex",alignItems:"center",width:"calc(100% - 36px)"},children:e.jsx(Qe,{size:"small",placeholder:"search",value:L,onChange:me,sx:{width:"100%","& .MuiOutlinedInput-input":{padding:"6px 4px 6px 0"},".MuiOutlinedInput-root":{"&:hover":{fieldset:{borderColor:"divider"}},"&.Mui-focused":{fieldset:{borderColor:"divider"}}},fieldset:{borderColor:"divider"}},slotProps:{input:{size:"small",startAdornment:e.jsx(Xe,{position:"start",sx:{marginRight:"2px"},children:e.jsx(O,{icon:jr})})}}})})]}),e.jsx(Be,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2},children:ye.map(d=>e.jsx(We,{elevation:0,sx:Ke(h.includes(d.id)),children:e.jsx(X,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{fontSize:"0.875rem",width:"calc(100% - 36px)"},...Ge},control:e.jsx(Oe,{checked:h.includes(d.id),onChange:()=>oe(d.id),disabled:o,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,minWidth:0,width:"100%"},children:[d.blocklet&&e.jsx(_e,{size:20,blocklet:d.blocklet,ancestors:d.ancestors,style:{borderRadius:4,flexShrink:0}}),e.jsx(I,{noWrap:!0,variant:"body2",component:"span",title:d.label,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:d.label})]})})},d.id))}),N.length>He&&L.trim()===""&&e.jsx(H,{fullWidth:!0,size:"small",onClick:be,sx:{mt:1},endIcon:y?e.jsx(At,{}):e.jsx(Mt,{})})]})]})})]})]}),h.length>0||T.length>0?e.jsxs(x,{className:"notification-filter-content",sx:{display:"flex",flexWrap:"wrap",gap:1,mt:2},children:[T.map(d=>{const w=K.find(A=>A.value===d);return e.jsx(Ce,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(pe,{severity:d}),w?w.label:d]}),onDelete:()=>se(d),size:"small",variant:"outlined",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`severity-${d}`)}),h.map(d=>{const w=V.find(A=>A.id===d);return e.jsx(Ce,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[w?.blocklet&&e.jsx(_e,{size:16,blocklet:w.blocklet,ancestors:w.ancestors,style:{borderRadius:4,flexShrink:0}}),w?w.label:d]}),variant:"outlined",onDelete:()=>oe(d),size:"small",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`component-${d}`)})]}):null]})}const Jr=te(Lt)`
2
- position: fixed;
3
- bottom: 20px;
4
- right: 20px;
5
- z-index: 1000;
6
- @media (max-width: 600px) {
7
- bottom: 16px;
8
- right: 16px;
9
- transform: scale(0.9);
10
- }
11
- `;function en(){const[t,o]=b.useState(!1);b.useEffect(()=>{const n=Je(()=>{o(window.pageYOffset>300)},200);return window.addEventListener("scroll",n),n(),()=>window.removeEventListener("scroll",n)},[]);const s=()=>{try{"scrollTo"in window?window.scrollTo({top:0,behavior:"smooth"}):window.scrollTo(0,0)}catch{window.scrollTo(0,0)}};return e.jsx(zt,{in:t,children:e.jsx(Jr,{color:"primary",size:"small","aria-label":"scroll back to top",onClick:s,children:e.jsx(Et,{})})})}const tn=te.div`
12
- display: flex;
13
- flex-direction: column;
14
- gap: ${t=>t.inDialog?0:"24px"};
15
- .MuiContainer-root {
16
- padding-right: 0;
17
- }
18
-
19
- .profile-button.MuiButtonBase-root {
20
- border-radius: 9999px;
21
- margin-right: 2px;
22
- padding: 5px 12px;
23
- line-height: 22px;
24
- font-size: 13px;
25
- border: 1px solid transparent;
26
- background-color: ${({theme:t})=>t.palette.background.default};
27
- color: ${({theme:t})=>t.palette.text.primary};
28
- font-weight: 400;
29
- border: 1px solid ${({theme:t})=>t.palette.divider} !important;
30
- }
31
- .profile-button.active.MuiButtonBase-root,
32
- .profile-button.active.MuiButtonBase-root:hover {
33
- color: ${({theme:t})=>t.palette.primary.main};
34
- font-weight: 600;
35
- background-color: ${({theme:t})=>le(t.palette.primary.main,.1)};
36
- border: 1px solid ${({theme:t})=>le(t.palette.primary.main,.24)} !important;
37
- }
38
-
39
- .profile-button.MuiButtonBase-root:hover {
40
- background-color: rgba(0, 0, 0, 0.04);
41
- }
42
-
43
- .profile-line-button.MuiButtonBase-root {
44
- margin-right: 2px;
45
- color: ${({theme:t})=>t.palette.text.secondary};
46
- padding: 5px 12px;
47
- line-height: 22px;
48
- font-size: 13px;
49
- border: none !important;
50
- border-radius: 0;
51
- }
52
-
53
- .profile-line-button.active.MuiButtonBase-root {
54
- color: ${({theme:t})=>t.palette.text.primary};
55
- border-bottom: 1px solid ${({theme:t})=>t.palette.text.primary} !important;
56
- }
57
-
58
- .profile-button.MuiButtonBase-root:last-of-type,
59
- .profile-line-button.MuiButtonBase-root {
60
- margin-right: 0;
61
- }
62
-
63
- .profile-line-button.MuiButtonBase-root:hover {
64
- color: ${({theme:t})=>t.palette.text.primary};
65
- background-color: unset;
66
- }
67
-
68
- * {
69
- scrollbar-width: none; /* Firefox */
70
- -ms-overflow-style: none; /* IE and Edge */
71
- }
72
-
73
- *::-webkit-scrollbar {
74
- display: none; /* Chrome, Safari and Opera */
75
- }
76
- `;dt.propTypes={blocklets:u.array,context:u.object,pagination:u.bool,inDialog:u.bool,filterType:u.oneOf(["component","entity"]),toViewAll:u.func,type:u.oneOf(["server","service"])};function dt({blocklets:t=[],context:o,pagination:s=!0,inDialog:n=!1,filterType:a="component",toViewAll:i=()=>{},type:l="service"}){const{data:p,paging:r,refresh:f,loading:m,params:g,onReadNotification:C,componentDids:v,filterUnReadCount:c,initial:h}=o,S=d=>{f({...g,severity:d&&typeof d=="string"?[d]:d||[],paging:{...g.paging,page:1}})},[T]=qt(),P=R(()=>T.get("id"),[T]),y=xe(d=>d.breakpoints.down("md")),[E,L]=b.useState(0),[U,N]=b.useState(!1),j=b.useMemo(()=>g.read===!1?"unread":"all",[g.read]),k=R(()=>Je(d=>{if(m)return;const w=p.length,A=p.filter(_=>!qe(_)).length;let B={...g,append:!0,paging:{...g.paging,...d,currentPage:(r.currentPage||0)+1}};j==="unread"&&A<w&&d.page>g.paging.page&&(B={...g,append:!0,paging:{...g.paging,...d,page:g.paging.page||1,currentPage:(r.currentPage||0)+1}}),f(B)},500),[p,g,j,r,m,f]);et(()=>{h&&typeof h=="function"&&h()}),b.useEffect(()=>{(!r.currentPage||r.currentPage===1)&&L(r.total)},[r.total,r.currentPage]),b.useEffect(()=>{setTimeout(()=>{const d=document.getElementById(P);d&&d.scrollIntoView({behavior:"smooth",block:"center"}),N(!0)},100),setTimeout(()=>{N(!1)},3e3)},[P]);const D=R(()=>p?.length>0&&p.length<E,[p,E]),K=b.useCallback(d=>{const{blocklet:w={}}=window,A=[w?.did,...(w?.ancestors||[]).map(B=>B)];return v?.includes(d)||A.findIndex(B=>B===d)>-1},[v]),ne=b.useMemo(()=>{const d=new Map;return t.length&&t.forEach(w=>{const A=w?.did||w.meta?.did;A&&!d.has(A)&&(w.ancestors=[],d.set(A,w),w?.alsoKnownAs?.length>0&&w.alsoKnownAs.forEach(B=>{d.has(B)||d.set(B,w)})),w?.children?.length>0&&w.children.forEach(B=>{const _=B?.did||B.meta?.did;_&&!d.has(_)&&K(_)&&(B.ancestors=[w],d.set(_,B))})}),d},[t,K]),ge=b.useCallback(()=>{m||k({page:r.page+1})},[r.page,m,k]),[oe]=Yr({loading:m,hasNextPage:D,onLoadMore:ge}),se=d=>{!d||qe(d)||C(d.id).then(()=>{n&&i()})},me=({severity:d,id:w})=>{if(m)return;let A={};a==="component"?A={entityId:[],componentDid:w}:a==="entity"&&(A={componentDid:[],entityId:w}),f({...g,severity:d,...A,paging:{...g.paging,page:1}})},be=d=>{if(m)return;let w={...g,paging:{...g.paging,page:1}};d==="unread"?(w.read=!1,w.paging.currentPage=1):w=Gt(w,"read"),f(w)},V=R(()=>a==="component"?Array.isArray(g.componentDid)?g.componentDid:[]:a==="entity"?Array.isArray(g.entityId)?g.entityId:[]:[],[g,a]),ye=R(()=>(Array.isArray(g.severity)?g.severity:[])[0]||"",[g.severity]);return e.jsxs(tn,{inDialog:!!n,children:[n?e.jsx(at,{currentTab:ye,type:"line",theme:"light",onSelectType:S}):e.jsx(ct,{loading:m,blockletMap:ne,unReadCount:c,filterType:a,type:l,selectedId:V,onFilterChange:me,severity:g.severity,onReadFilterChange:be,currentReadFilter:j}),!y&&m?e.jsx(x,{sx:{display:"flex",width:"100%",minHeight:400,justifyContent:"center",alignItems:"center"},children:e.jsx(Z,{})}):e.jsx(wr,{data:p,blockletMap:ne,onReadNotification:se,onReadBatch:C,inDialog:n,highlightId:P,highlight:!n&&U,type:l}),s&&!y?e.jsx(Zr,{loading:m,paging:r,onChange:k}):null,s&&y&&(m||D)?e.jsx(x,{ref:oe,sx:{display:"flex",width:"100%",minHeight:100,justifyContent:"center",alignItems:"center"},children:e.jsx(Z,{})}):null,!n&&y?e.jsx(en,{}):null]})}const rn=b.memo(dt),F=new Xt;function he(t){const{userDid:o=""}={},{session:s}=Zt(),n=R(()=>{if(o)return o;const r=window.location.href,f=Kt(r);return f?.did?Array.isArray(f.did)?f.did[0]:f.did:s?.user?.did},[s?.user?.did,o]),a=R(()=>s.user,[s]),i=R(()=>a?n===a?.did:!1,[n,a?.did]),l=re(async()=>{if(await Qt(()=>s?.initialized),i)return s.user;if(n)return F.user.getUserPublicInfo({did:n})},{refreshDeps:[n,i,s?.initialized,a]}),p=R(()=>a.passports?.some(r=>r.role===Te.ROLES.OWNER),[a]);return{currentDid:n,session:s,isMyself:i,user:a,viewUser:l.data,isOwner:p}}function ut({user:t,...o}){const{t:s}=W(),n=Bt(),a=R(()=>{const p=(t?.passports||[]).map(r=>({...r,revoked:r.status===cr.REVOKED}));return p.sort((r,f)=>r.revoked===f.revoked?0:r.revoked?1:-1),Ne(p.filter(r=>!r.display),"role").concat(Ne(p.filter(r=>r.display),"display.content"))},[t?.passports]),i=R(()=>a?.find(p=>p.name===t.role),[a,t?.role]),l=n.palette.primary.main;return a.length===0?e.jsx(x,{children:e.jsx(rt,{children:s("userCenter.noPassport")})}):e.jsx(x,{...o,sx:{display:"grid",justifyItems:"start",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(2, 1fr)",md:"repeat(3, 1fr)",lg:"repeat(5, 1fr)"},gap:2.5,...o.sx},children:a.map(p=>e.jsx(Sr,{passport:p,user:t,color:window.blocklet.passportColor,createPassportSvg:Jt,title:i&&i.role===p.role?s("userCenter.currentPassport"):"",sx:{flexDirection:"column",alignItems:"center",gap:1,".passport-item__display":{width:166,height:166,borderRadius:1,px:2,display:"flex",justifyContent:"center",backgroundColor:"grey.50",boxShadow:i&&i.role===p.role?`0px 2px 4px 0px ${l}, 0px 1px 2px -1px ${l}, 0px 0px 0px 1px ${l} !important`:"unset"},".passport-item__body":{marginLeft:"0 !important"}}},p.id))})}ut.propTypes={user:u.object.isRequired};function nn({visible:t,onClose:o,nft:s}){return!t||!s?null:e.jsx(on,{children:e.jsx(Wt,{open:t,onClose:o,children:e.jsx(sn,{onClick:o,children:e.jsx(st,{data:it(s),address:s.address,inset:!0})})})})}const on=te.div`
77
- position: relative;
78
- width: 100%;
79
- height: 100%;
80
- cursor: pointer;
81
-
82
- &:hover {
83
- .mask {
84
- opacity: 1;
85
- }
86
- }
87
-
88
- .mask {
89
- position: absolute;
90
- top: 0;
91
- left: 0;
92
- display: flex;
93
- align-items: center;
94
- justify-content: center;
95
- width: 100%;
96
- height: 100%;
97
- background: rgba(0, 0, 0, 0.6);
98
- opacity: 0;
99
- transition: opacity 0.2s;
100
- }
101
- `,sn=te.div`
102
- display: flex;
103
- justify-content: center;
104
- align-items: center;
105
- height: 100vh;
106
- width: 100vw;
107
-
108
- img,
109
- object {
110
- max-width: 90vw;
111
- max-height: 75vh;
112
- }
113
-
114
- .nft-display--inset {
115
- > .MuiBox-root,
116
- .nft-display__loading {
117
- width: 75vmin;
118
- height: 75vmin;
119
- }
120
- }
121
- `,an=t=>({position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.6)",opacity:0,transition:"opacity 0.3s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1,"& .mask-item":{backgroundColor:le(t.palette.background.paper,.9),color:"text.primary","&:hover":{backgroundColor:le(t.palette.background.paper,1)}}}),ln={position:"absolute",bottom:0,left:0,right:0,height:24,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",gap:1,zIndex:1,"& .mask-item":{width:20,height:20,color:"white"}},Ve="https://main.abtnetwork.io/explorer";function pt({user:t}){const{t:o}=W(),s=Q(),[n,a]=b.useState({visible:!1,nft:null}),[i,l]=b.useState({anchorEl:null,props:null}),p=P=>{const y=ce(Ve,"assets",P);window.open(y,"_blank")},r=(P,y)=>{let E="";typeof y.data?.value=="string"?E=JSON.parse(y.data?.value)?.domain:E=y.data?.value?.domain,l({anchorEl:P,props:{title:E?`Hey, I just won an NFT at the ${E} event!`:"Hey, I just won an NFT!",url:ce(Ve,"assets",y.address)}})},f=P=>{a({visible:!0,nft:P})},m=G({page:1,size:20}),g=re(async(P=m)=>(await Vt.get(`${Te.WELLKNOWN_SERVICE_PATH_PREFIX}/ocap/listAssets`,{params:{ownerAddress:t.did,...P}})).data,{ready:t?.did&&m,defaultParams:[m],refreshDeps:[t?.did,m]}),{loading:C,data:v}=g,c=v?.page??{cursor:0,next:!1,total:0},h=(P,y)=>{m.page=y,g.run(m)},S=z(P=>[e.jsx($,{size:"small",className:"mask-item",onClick:y=>{y.stopPropagation(),p(P.address)},children:e.jsx(O,{icon:"tabler:link",fontSize:18})},"link"),e.jsx($,{size:"small",onClick:y=>{y.stopPropagation(),r(y.currentTarget,P)},className:"mask-item",children:e.jsx(O,{icon:"tabler:share-2",fontSize:18})},"share"),e.jsx($,{size:"small",onClick:y=>{y.stopPropagation(),f(P)},className:"mask-item",children:e.jsx(O,{icon:"tabler:eye",fontSize:18})},"view")]),T=R(()=>{if(C){const P=["skeleton-1","skeleton-2","skeleton-3","skeleton-4","skeleton-5"].map(y=>e.jsx(De,{variant:"rectangular",width:"15%",height:166,sx:{borderRadius:1,flexShrink:0}},y));return e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(De,{width:"20%"}),e.jsx(x,{sx:{display:"flex",flexDirection:"row",gap:2,flexWrap:"nowrap"},children:P})]})}return e.jsxs(e.Fragment,{children:[e.jsx(I,{sx:{color:"grey.A700",fontWeight:600,mb:2.5},children:o("userCenter.common.nft")}),v?.assets?.length===0&&!C&&e.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},children:e.jsx(rt,{children:o("userCenter.common.noNFT")})}),e.jsx(x,{className:"nft-list-wrapper",sx:{display:"grid",justifyItems:"start",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(3, 1fr)",md:"repeat(3, 1fr)",lg:"repeat(5, 1fr)"},gap:2.5},children:v?.assets?.map(P=>e.jsxs(x,{sx:{flexShrink:0,width:{xs:120,sm:120,md:120,lg:166},height:{xs:120,sm:120,md:120,lg:166},position:"relative",borderRadius:1,overflow:"hidden",cursor:"pointer",...s?{}:{"&:hover .mask":{opacity:1}}},children:[e.jsx(st,{data:it(P),address:P.address,inset:!0,imageFilter:{imageFilter:"resize",w:"500",f:"webp"}}),s?e.jsx(x,{className:"footer-mask",sx:ln,children:S(P)}):e.jsx(x,{className:"mask",sx:an,children:e.jsx(Ie,{direction:"row",spacing:1,children:S(P)})})]},P.address))}),c.next||m.page>1?e.jsx(Ot,{sx:{display:"flex",justifyContent:"center",mt:2},page:m.page,onChange:h,count:Math.ceil(c.total/m.size),size:"small"}):null,e.jsx(nn,{visible:n.visible&&!!n.nft,nft:n.nft,onClose:()=>{a({visible:!1,nft:null})}}),e.jsx(dr,{anchorEl:i.anchorEl,onClose:()=>{l({anchorEl:null,props:null})},sharedProps:i.props||{title:"",url:""}})]})},[C,c,m.page,m.size,h,i,n]);return e.jsx(x,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2,mb:5},children:T})}pt.propTypes={user:u.object.isRequired};function cn(){const{t}=W(),{user:o,isMyself:s,viewUser:n}=he();return e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[s?e.jsxs(x,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,p:2},children:[e.jsx(I,{sx:{color:"text.primary",fontWeight:600,mb:2.5},children:t("userCenter.passport")}),e.jsx(ut,{user:o})]}):null,e.jsx(pt,{user:s?o:n})]})}const dn=[{name:"English",code:"en"},{name:"中文",code:"zh"}];function xt({user:t,onSave:o}){const{t:s,changeLocale:n}=W(),a=G({locale:t.locale,loading:!1}),i=z(async l=>{try{const{value:p}=l.target;a.loading=!0,await F.user.saveProfile({locale:p}),await o("profile"),n(p),a.locale=p}catch(p){q.error(ee(p))}finally{a.loading=!1}});return e.jsxs(x,{sx:{gap:1,display:"grid",alignItems:"center",gridTemplateColumns:{xs:"1fr",sm:"max-content 1fr"}},children:[e.jsx(x,{children:s("userCenter.commonSetting.locale")}),e.jsx(x,{children:e.jsx(Re,{value:a.locale,onChange:i,size:"small",IconComponent:l=>e.jsx(tt,{...l,width:20,height:20}),sx:{minWidth:200,"&:hover":{"fieldset.MuiOutlinedInput-notchedOutline":{borderColor:"divider"}},fieldset:{borderColor:"divider"}},children:(window.blocklet.languages||dn).map(l=>e.jsx(ae,{value:l.code,children:l.name},l.code))})})]})}xt.propTypes={user:u.shape({locale:u.string}).isRequired,onSave:u.func.isRequired};function ke({onTest:t=Y,onDelete:o=Y,onSave:s=Y,onCancel:n=Y,type:a="slack",url:i="",edit:l=!1}){const{t:p}=W(),r=G({type:a||"slack",url:i||"",edit:l??!1,error:"",loading:!1}),f=z(()=>r.url?er(r.url)?(r.error="",!0):(r.error=p("common.invalid"),!1):(r.error=p("common.required"),!1)),m=z(()=>{r.edit=!1,r.url=i||"",r.type=a||"slack",r.error="",r.loading=!1,n()}),g=z(async c=>{r.loading=!0,await t(c),r.loading=!1}),C=z(c=>()=>{f()&&c({type:r.type,url:r.url})}),v=R(()=>r.error?e.jsx(I,{component:"span",color:"error",children:r.error}):r.edit?r.loading?e.jsx(Z,{size:16}):e.jsx($,{size:"small",onClick:C(g),sx:{mr:-1},children:e.jsx(O,{icon:kr})}):null,[r.error,r.edit,r.loading]);return e.jsxs(x,{sx:{display:"flex",gap:1.5,width:"100%",alignItems:{xs:"flex-start",md:"center"},flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(Re,{sx:{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}},disabled:!r.edit||r.loading,size:"small",value:r.type,onChange:c=>{r.type=c.target.value},children:[e.jsx(ae,{value:"api",children:p("userCenter.webhook.url")}),e.jsx(ae,{value:"slack",children:p("userCenter.webhook.slack")})]}),e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5,width:"100%"},children:[e.jsx(Qe,{sx:{flex:1,".MuiInputBase-root":{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}}},disabled:!r.edit||r.loading,fullWidth:!0,size:"small",required:!0,value:r.url,onChange:c=>{r.url=c.target.value,f()},error:!!r.error,slotProps:{input:{endAdornment:e.jsx(Xe,{position:"end",children:v})}}}),e.jsx(x,{sx:{display:"flex",gap:.5},children:r.edit?e.jsxs(e.Fragment,{children:[e.jsx($,{color:"success",onClick:C((...c)=>{s(...c),r.edit=!1}),sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(O,{icon:ur})}),e.jsx($,{color:"error",onClick:m,sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(O,{icon:pr})})]}):e.jsxs(e.Fragment,{children:[e.jsx($,{onClick:()=>{r.edit=!0},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(O,{icon:Pr})}),e.jsx($,{color:"error",onClick:()=>{o({type:r.type,url:r.url})},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(O,{icon:Rr})})]})})]})]})}ke.propTypes={onTest:u.func,onDelete:u.func,onSave:u.func,onCancel:u.func,type:u.oneOf(["api","slack"]),url:u.string,edit:u.bool};function ie({title:t=void 0,description:o=void 0,value:s,onChange:n,isMobile:a}){const i=z(l=>{l.stopPropagation()});return e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Se,{checked:s,size:"small",onChange:n}),e.jsxs(I,{component:"div",onClick:i,sx:{color:"text.primary",fontSize:14,display:"flex",flexWrap:a?"wrap":"nowrap",columnGap:1,flex:1,whiteSpace:a?"normal":"nowrap"},children:[t,o]})]})}ie.propTypes={title:u.string,description:u.node,value:u.bool.isRequired,onChange:u.func.isRequired,isMobile:u.bool.isRequired};function ft({user:t,isMobile:o}){const{t:s}=W(),n=G({showAdd:!1}),a=re(async()=>await F.user.getUserNotificationConfig(),{refreshDeps:[t],loadingDelay:300}),i=R(()=>({wallet:!0,email:!0,phone:!1,push:!0,...a?.data?.notifications||{}}),[a?.data?.notifications]),l=R(()=>a?.data?.webhooks||[],[a?.data?.webhooks]),p=z(async v=>{try{await F.user.saveUserNotificationConfig(v),q.success(s("userCenter.saveSuccess")),a.run()}catch(c){q.error(ee(c))}}),r=z(async(v,c)=>{await p({notifications:{[v]:c}})}),f=async v=>{try{await F.user.testNotificationWebhook(v),q.success(s("userCenter.webhookTested"))}catch(c){q.error(ee(c))}},m=z(async v=>{await p({webhooks:l.filter((c,h)=>h!==v)})}),g=z(async(v,c)=>{await p({webhooks:l.map((h,S)=>S===v?c:h)})}),C=z(async v=>{await p({webhooks:[...l,v]}),n.showAdd=!1});return a.error?e.jsx(Dt,{severity:"error",children:a.error.message}):a.loading||!a.data?e.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px"},children:e.jsx(Z,{})}):e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}},".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:[e.jsx(ie,{value:i.wallet,isMobile:o,title:s("userCenter.walletNotification"),onChange:v=>r("wallet",v.target.checked),description:$e(t)&&e.jsx(xr,{did:$e(t),showQrcode:!1,showAvatar:!o,copyable:!0,compact:!0,responsive:!0,startChars:o?2:6})}),e.jsx(ie,{value:i.email,isMobile:o,onChange:v=>r("email",v.target.checked),title:s("userCenter.emailNotification"),description:t?.email&&e.jsx(I,{component:"span",sx:{color:"text.secondary",fontSize:13},children:t?.email})}),e.jsx(ie,{isMobile:o,value:i.push,title:s("userCenter.pushNotification"),onChange:v=>r("push",v.target.checked)})]}),e.jsxs(Ie,{spacing:1.5,useFlexGap:!0,direction:"column",sx:{alignItems:"start"},children:[l.map((v,c)=>e.jsx(ke,{onTest:f,onDelete:()=>m(c),onSave:(...h)=>g(c,...h),type:v.type,url:v.url,edit:!1},`${c}_${v.url}`)),n.showAdd&&e.jsx(ke,{onTest:f,onCancel:()=>{n.showAdd=!1},onSave:(...v)=>C(...v),edit:!0},"add"),e.jsx(nt,{variant:"outlined",size:"small",sx:{color:"text.primary",borderColor:"divider","&:hover":{borderColor:"divider"},py:.5,borderRadius:1},startIcon:e.jsx(O,{icon:Ir}),onClick:()=>{n.showAdd=!0},children:s("userCenter.addWebhook")})]})]})}ft.propTypes={user:u.object.isRequired,isMobile:u.bool.isRequired};function Pe({children:t,...o}){const s=Q(),[n,a]=b.useState(!1),i=z(()=>{a(!n)});return b.useEffect(()=>{a(!1)},[s]),s?e.jsx(Nt,{onClickAway:()=>a(!1),children:e.jsx(J,{...o,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,slotProps:{popper:{disablePortal:!0}},open:n,onClose:i,children:b.cloneElement(t,{onClick:i})})}):e.jsx(J,{...o,children:t})}Pe.propTypes={children:u.node.isRequired};function ht({item:t}){const o=ze(),{blocklet:s}=tr(),{confirmApi:n,confirmHolder:a}=Ae(),i=G({loading:!1}),{t:l}=W(),{session:p}=b.use(fe),{bindOAuth:r,unbindOAuth:f,setBaseUrl:m,baseUrl:g}=p.useOAuth(),{disconnectPasskey:C,setTargetAppPid:v}=p.usePasskey(),c=R(()=>fr[t?.provider]||"unknown",[t?.provider]),h=z(y=>y?._bind?y.provider===M.WALLET&&y.did?l("userCenter.thirdPartyLogin.walletAccountCantRemove"):y.provider===M.PASSKEY&&o.arcSphere?l("userCenter.thirdPartyLogin.dontSupportRemoveinArcSphere"):y._mainProvider&&o.arcSphere?l("userCenter.thirdPartyLogin.mainProviderCantRemove"):"":""),S=z(async()=>{if(t?.provider===M.PASSKEY){await new Promise((y,E)=>{n.open({title:l("userCenter.thirdPartyLogin.disconnectPasskey",{name:c}),content:l("userCenter.thirdPartyLogin.disconnectPasskeyDescription",{name:c}),confirmButtonText:l("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:l("common.cancel"),onConfirm(L){C({session:p,connectedAccount:t}).then(y).catch(E),L()},onCancel:y})});return}try{i.loading=!0,await new Promise((y,E)=>{if(t?._bind)n.open({title:l("userCenter.thirdPartyLogin.confirmUnbind",{name:c}),content:l("userCenter.thirdPartyLogin.confirmUnbindDescription",{name:c}),confirmButtonText:l("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:l("common.cancel"),onConfirm(L){f({session:p,connectedAccount:{...Yt(t,["did","pk"]),showProvider:t.provider,provider:t._rawProvider}}).then(y).catch(E),L()},onCancel:y});else if(t.provider===M.WALLET)p.bindWallet({onSuccess:y,onCancel:E});else{const L=g,U=window?.blocklet;let N="/";const j=hr(U),k=gr(U);j&&k?.appPid&&p?.user?.sourceAppPid&&(N=k.appUrl),m(N),v(s?.appPid),r({session:p,oauthItem:{...t,provider:t._rawProvider}}).then(y).catch(E).finally(()=>{m(L),v()})}})}catch(y){console.error(`Failed to ${t?._bind?"unbind":"bind"} oauth account`,y)}finally{i.loading=!1}}),T=z(y=>y.provider===M.WALLET&&y.did?l("userCenter.thirdPartyLogin.walletAccount"):y._mainProvider?l("userCenter.thirdPartyLogin.mainAccount"):y?._bind?l("userCenter.thirdPartyLogin.disconnect"):l("userCenter.thirdPartyLogin.connect")),P=z(y=>y.provider===M.WALLET&&y.did||y.provider===M.PASSKEY&&(o.arcSphere||o.wallet)?!0:!!t._mainProvider,[o.arcSphere]);return e.jsxs(e.Fragment,{children:[e.jsxs(x,{sx:{borderRadius:1,border:"1px solid",borderColor:"divider",backgroundColor:"grey.50",display:"flex",alignItems:"center",py:1,px:1.5,gap:.75,fontSize:"14px",lineHeight:1,overflow:"hidden"},children:[e.jsx(rr,{provider:t?.provider,sx:{width:"1em",height:"1em",flexShrink:0,fontSize:16}}),e.jsx(x,{sx:{flex:1,display:{xs:t.userInfo?.email||t.did?"none":"block",sm:"block"}},children:c}),t.userInfo?.email||t.did?e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5,overflow:"hidden"},children:[e.jsx(x,{sx:{flex:1,textOverflow:"ellipsis",overflow:"hidden",lineHeight:"normal"},children:t.userInfo?.email||t.did}),t.userInfo?.name?e.jsx(Pe,{title:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ot,{size:36,variant:"circle",shape:"circle",src:t.userInfo?.picture,did:t.did}),e.jsxs(x,{children:[e.jsx(I,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:t.userInfo?.name}),e.jsx(I,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:t.userInfo?.email})]})]}),children:e.jsx(x,{component:O,icon:nr,sx:{color:"text.secondary",fontSize:16,cursor:"pointer",flexShrink:0}})}):null]}):null]}),e.jsx(Pe,{title:h(t),placement:"auto",children:e.jsx(x,{children:e.jsx(nt,{variant:"outlined",size:"small",sx:y=>{const E=y.palette.error.main,L=y.palette.primary.main;return{color:t?._bind?E:L,borderColor:t?._bind?E:L,backgroundColor:"background.default","&:hover":{borderColor:t?._bind?E:L,backgroundColor:"action.hover"},py:.5,borderRadius:1,fontWeight:500,whiteSpace:"nowrap"}},fullWidth:!0,startIcon:i.loading?null:e.jsx(O,{icon:Tr}),onClick:S,disabled:P(t),loading:i.loading,children:T(t)})})}),a]})}ht.propTypes={item:u.shape({provider:u.string,did:u.string,pk:u.string,userInfo:u.object,id:u.string,_bind:u.bool,_rawProvider:u.string,_mainProvider:u.bool}).isRequired};function gt({user:t}){const{session:o}=b.use(fe),[s,n]=b.useState({}),{getOAuthConfigs:a}=o.useOAuth(),i=ze();lr(async()=>{const r=await a({sourceAppPid:t?.sourceAppPid});n(r)},[t?.sourceAppPid]);const l=R(()=>{const r=Object.keys(s).map(f=>({...s[f],provider:f})).filter(f=>f.enabled);return[{provider:M.WALLET,order:-1},...r,{provider:M.PASSKEY,order:1/0}]},[s]),p=R(()=>{const r=mr(t);let f=!1,m="",g=br(t);const C=r.find(c=>c.provider===M.AUTH0);return C&&(C.id.startsWith("google-oauth2|")&&(r.some(c=>c.provider==="google")||(f=!0,m=M.GOOGLE,g===M.AUTH0&&(g=M.GOOGLE))),C.id.startsWith("appleid|")&&(r.some(c=>c.provider===M.APPLE)||(f=!0,m=M.APPLE,g===M.AUTH0&&(g=M.APPLE))),C.id.startsWith("github|")&&(r.some(c=>c.provider===M.GITHUB)||(f=!0,m=M.GITHUB,g===M.AUTH0&&(g=M.GITHUB)))),l.map(c=>{if(c.provider===M.AUTH0&&f)return null;const h=f&&c.provider===m?r.find(S=>S.provider===M.AUTH0):r.find(S=>S.provider===c.provider);return h?{...c,provider:c.provider,did:h.did,pk:h.pk,userInfo:h.userInfo,_bind:!0,_rawProvider:h.provider,_mainProvider:c.provider===g}:{...c,provider:c.provider,_rawProvider:c.provider,_mainProvider:c.provider===g}}).filter(c=>!(!c||c.provider===M.PASSKEY&&!c.did)).sort((c,h)=>c._mainProvider?-1:c?.order!==void 0&&h?.order!==void 0?c.order-h.order:c?.order!==void 0?-1:1)},[t?.connectedAccounts,l]);return e.jsxs(x,{sx:{gap:1,display:"grid",gridTemplateColumns:"1fr min-content"},children:[p.map(r=>e.jsx(ht,{item:r},r?.provider)),i.wallet||i.arcSphere?null:e.jsx(or,{behavior:"only-new",action:"connect",createMode:"connect",createButtonText:"Add New Passkey",onSuccess:Y,onError:Y,dense:!0,sx:{px:1.5,py:1,gap:.75}})]})}gt.propTypes={user:u.object.isRequired};function mt({configList:t,onSave:o}){const[s,n]=b.useState(t),{t:a}=W(),i=z(async(l,p)=>{try{const r=await F.user.saveUserPrivacyConfig({[l]:typeof p=="string"?p:!p});n(s.map(f=>({...f,value:r?.[f.key]??f.value}))),q.success(a("userCenter.saveSuccess")),o("privacy")}catch(r){q.error(ee(r))}});return b.useEffect(()=>{n(t)},[t]),e.jsx(x,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}},".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:s.map(l=>{if(l.isPrivate)return null;const p=!l.value||["all","follower-only"].includes(l.value);return e.jsxs(x,{children:[e.jsx(Se,{checked:p,labelProps:{label:e.jsx(I,{sx:{color:"text.primary",fontSize:14,display:"flex",flexFlow:"wrap",columnGap:1,flex:1},children:a("userCenter.toPublic",{name:l.name})})},size:"small",onChange:r=>{const{checked:f}=r.target;l.followersOnly?i(l.key,f?"all":"private"):i(l.key,f)}},l.key),l.followersOnly&&p&&e.jsx(x,{sx:{pl:3,pt:1},children:e.jsx(Se,{checked:l.value==="follower-only",labelProps:{label:e.jsx(I,{sx:{color:"text.primary",fontSize:14,display:"flex",flexFlow:"wrap",columnGap:1,flex:1},children:a("team.userFollowers.followersOnly")})},size:"small",onChange:r=>{const{checked:f}=r.target;i(l.key,f?"follower-only":"all")}})})]})})})}mt.propTypes={configList:u.arrayOf(u.shape({key:u.string.isRequired,name:u.string.isRequired,value:u.bool.isRequired,isPrivate:u.bool})).isRequired,onSave:u.func.isRequired};function bt({user:t,sessionUser:o}){const s=R(()=>(t?.passports||[])?.find(n=>n.name===o.role),[t?.passports,o?.role]);return e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ot,{size:40,variant:"circle",shape:"circle",src:o.avatar,did:o.did,sx:{flexShrink:0}}),e.jsxs(x,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(J,{title:o.fullName,children:e.jsx(I,{sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1},children:o.fullName})}),e.jsx(Ce,{label:s?.title||s?.name||"Guest",size:"small",variant:"outlined",sx:{flexShrink:0,fontWeight:"bold",fontSize:"12px",color:"text.primary",borderColor:"grey.300",backgroundColor:"transparent",textTransform:"capitalize",pr:.5,pl:0,height:"auto"}})]}),e.jsx(J,{title:o.email,children:e.jsx(I,{variant:"body2",color:"grey",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.email})})]})]})}bt.propTypes={user:u.object.isRequired,sessionUser:u.shape({role:u.string,avatar:u.string,did:u.string,fullName:u.string,email:u.string}).isRequired};const un=()=>Promise.resolve(""),Ye=t=>new we(t,{browser:[[/(ArcWallet)\/([\w\.]+)/i],[we.BROWSER.NAME,we.BROWSER.VERSION]]}).getResult(),Ze={display:"flex",justifyContent:"flex-end",textAlign:"right"},pn=new sr({concurrency:1}),Ee=b.memo(({userSession:t,isMobile:o=!1})=>{const s=G({loading:!0,ipRegion:""}),{t:n}=W();b.useEffect(()=>{pn.add(async()=>{try{s.ipRegion=await un(t.lastLoginIp)}finally{s.loading=!1}})},[s,t.lastLoginIp]);const a=R(()=>o?{display:"flex",justifyContent:"flex-end"}:{},[o]);return e.jsx(x,{...o&&{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:1,flexWrap:"wrap"},children:s.ipRegion?e.jsxs(e.Fragment,{children:[e.jsx(I,{variant:"body2",children:s.ipRegion}),e.jsx(Ue,{size:16,className:"ip-address",style:a,children:t.lastLoginIp||n("userCenter.unknown")})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ue,{size:16,className:"ip-address",style:a,children:t.lastLoginIp||n("userCenter.unknown")}),s.loading?e.jsx(I,{variant:"body2",color:"grey",sx:{textAlign:"center"},children:e.jsx(Z,{size:12,color:"inherit"})}):null]})})});Ee.propTypes={userSession:u.object.isRequired,isMobile:u.bool};Ee.defaultProps={isMobile:!1};function yt({user:t,showAction:o=!0,showUser:s=!0,getUserSessions:n,showOffline:a=!1}){const i=G({status:"online",page:1,pageSize:10}),l=G({online:0,expired:0,offline:0}),p=yr(),{t:r,locale:f}=W(),m=Q({key:"md"}),g=xe(j=>j.breakpoints.down("lg")),{confirmApi:C,confirmHolder:v}=Ae(),c=z(async()=>{const j=await n({page:i.page,pageSize:i.pageSize,status:i.status}),k=j?.paging?.total||0;return l[i.status]=k,{total:k,list:j?.list||[]}});et(async()=>{const j=await n({page:1,pageSize:1,status:"expired"});l.expired=j?.paging?.total||0;const k=await n({page:1,pageSize:1,status:"offline"});l.offline=k?.paging?.total||0});const h=re(c,{refreshDeps:[i.status,i.page,i.pageSize]}),S=R(()=>h.data?.list||[],[h.data?.list]),T=R(()=>{const{status:j}=i;return j==="online"?l[j]<=1:l[j]===0},[S,p]),P=R(()=>de({},m?Ze:{}),[m]),y=z(({visitorId:j})=>{C.open({title:r("userCenter.logoutThisSession"),content:r("userCenter.logoutThisSessionConfirm"),confirmButtonText:r("userCenter.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:r("userCenter.cancel"),onConfirm:async()=>{await F.user.logout({visitorId:j,includeFederated:!0});const{page:k=0}=i,{list:D=[]}=h.data||{},K=D.length||0;k>1&&K===1&&(i.page=Math.max(k-1,1)),h.refresh(),C.close()}})}),E=z(()=>{C.open({title:r("userCenter.logoutAllSession",{type:r(i.status)}),content:r("userCenter.logoutAllSessionConfirm",{type:r(i.status)}),confirmButtonText:r("userCenter.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:r("userCenter.cancel"),onConfirm:async()=>{await F.user.logout({status:i.status,visitorId:p,includeFederated:!0}),i.page=1,h.refresh(),C.close()}})}),L=[];o&&L.push(e.jsx(J,{title:r("userCenter.logoutAllTips",{type:r(i.status)}),children:e.jsx(H,{sx:{ml:.5},size:"small",variant:"contained",color:"error",onClick:E,disabled:T,children:r("userCenter.logoutAll",{type:r(i.status)})})},"logoutAll"));const U=R(()=>({search:!1,sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!1,searchDebounceTime:600,page:i.page-1,rowsPerPage:i.pageSize,count:h.data?.total||0}),[h.data?.total,i.page,i.pageSize]),N=[{label:r("userCenter.platform"),name:"platform",options:{customBodyRenderLite:j=>{const k=S[j],D=Ye(k?.ua);return e.jsx(x,{sx:P,children:[D.os?.name,D.os?.version].filter(Boolean).join("/")||r("userCenter.unknown")})}}},{label:r("userCenter.deviceType"),name:"deviceType",options:{customBodyRenderLite:j=>{const k=S[j],D=Ye(k?.ua);return e.jsx(x,{sx:P,children:[D.browser?.name,D.browser?.version].filter(Boolean).join("/")||r("userCenter.unknown")})}}},{label:r("userCenter.walletOS"),name:"walletOS",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(x,{sx:P,children:k.extra?.walletOS?k.extra.walletOS.toUpperCase():r("userCenter.unknown")})}}},s&&{label:r("userCenter.user"),name:"user",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(x,{sx:de({minWidth:150,maxWidth:250},m?Ze:{}),children:e.jsx(bt,{sessionUser:k.user,user:t})})}}},{label:r("userCenter.createdAt"),name:"createdAt",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(x,{sx:P,children:k.createdAt?e.jsx(Fe,{value:k.createdAt,relativeRange:3*86400*1e3}):r("userCenter.unknown")})}}},!a&&{label:r("userCenter.updatedAt"),name:"updatedAt",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(x,{sx:P,children:k.status==="expired"?r("userCenter.expired"):e.jsx(Fe,{value:k.updatedAt,relativeRange:3*86400*1e3})})}}},{label:r("userCenter.lastLoginIp"),name:"lastLoginIp",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(Ee,{userSession:k,isMobile:m})}}},o&&{label:r("userCenter.actions"),name:"actions",options:{customBodyRenderLite:j=>{const k=S[j];return e.jsx(x,{sx:P,children:e.jsx(H,{sx:{whiteSpace:"nowrap",fontSize:"12px !important",lineHeight:"1.25",px:1},disabled:p===k.visitorId,variant:"outlined",size:"small",color:"error",onClick:()=>y({visitorId:k.visitorId}),children:k.status==="expired"?r("userCenter.remove"):p===k.visitorId?r("userCenter.currentSession"):r("userCenter.logout")})})}}}].filter(Boolean);return e.jsxs(x,{className:"pc-user-sessions",sx:{maxWidth:m?"unset":g?"calc(100vw - 300px)":"100%",...m&&{".pc-user-sessions-table > div:nth-child(2)":{border:"1px solid",borderColor:"divider",borderRadius:1}},".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableRow-root":{border:"unset","&:nth-child(even)":{backgroundColor:"grey.50","&:hover":{backgroundColor:j=>`${j.palette.grey[50]} !important`}}},".MuiTableRow-hover":{"&:hover":{backgroundColor:"inherit !important"}},".MuiTableCell-root":{paddingRight:"8px",paddingLeft:"8px",color:"text.secondary",...m&&{padding:"8px !important","&:first-child":{paddingTop:"20px!important"},"&:last-child":{paddingBottom:"20px!important"}}}},children:[v,e.jsx(vr,{count:h.data?.total||0,data:S,columns:N,customButtons:L,options:U,locale:f,loading:h.loading,className:"pc-user-sessions-table",title:e.jsxs($t,{row:!0,sx:{lineHeight:1,ml:1},onChange:j=>{i.status=j.target.value},children:[e.jsx(X,{value:"online",control:e.jsx(ve,{size:"small",sx:{lineHeight:1,fontSize:0},checked:i.status==="online"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.online"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",l.online,")"]})]})}),e.jsx(X,{value:"expired",control:e.jsx(ve,{size:"small",sx:{lineHeight:1,fontSize:0},checked:i.status==="expired"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.expired"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",l.expired,")"]})]})}),a?e.jsx(X,{value:"offline",control:e.jsx(ve,{size:"small",sx:{lineHeight:1,fontSize:0},checked:i.status==="offline"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.offline"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",l.offline,")"]})]})}):null]}),onChange:j=>{i.page=j.page+1,i.pageSize=j.rowsPerPage}})]})}yt.propTypes={user:u.object.isRequired,showAction:u.bool,showUser:u.bool,showOffline:u.bool,getUserSessions:u.func.isRequired};function vt({onDestroySelf:t=void 0}){const{confirmHolder:o}=Ae(),{t:s}=W(),{session:n}=b.use(fe),a=z(async()=>{if(!t||typeof t!="function")return;const i=n.withSecondaryAuth(t,{extraParams:{removeUserDid:n?.user?.did,input:{user:{did:n?.user?.did},teamDid:window?.blocklet?.did}},operation:"destroySelf"});try{await i(),n.logout()}catch(l){q.error(l?.message||s("userCenter.destroyMyself.error"))}});return e.jsxs(e.Fragment,{children:[e.jsx(x,{children:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"space-between",flexWrap:"wrap"},children:[e.jsxs(x,{children:[e.jsx(I,{variant:"h6",sx:{fontSize:"0.875rem !important",fontWeight:"bold"},children:s("userCenter.dangerZone.deleteAccount")}),e.jsx(I,{variant:"caption",sx:{color:"text.secondary"},children:s("userCenter.dangerZone.deleteAccountDescription")})]}),e.jsx(H,{variant:"contained",color:"error",size:"small",onClick:a,children:s("userCenter.dangerZone.delete")})]})}),o]})}vt.propTypes={onDestroySelf:u.func};function xn(){const t=Q({key:"md"}),o=xe(a=>a.breakpoints.down("lg")),s={display:"flex",justifyContent:"flex-end",flexWrap:"wrap",textAlign:"right","&.expired-at > div":{maxWidth:160,justifyContent:"flex-end",flexWrap:"wrap"}},n=R(()=>de({},t?s:{}),[t]);return e.jsx(x,{id:"user-center-access-key-setting",sx:{maxWidth:t?"unset":o?"calc(100vw - 300px)":"100%",...t&&{".pc-access-key-table > div:nth-child(2)":{border:"1px solid",borderColor:"divider",borderRadius:1}},".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableRow-root":{border:"unset","&:nth-child(even)":{backgroundColor:"grey.50","&:hover":{backgroundColor:a=>`${a.palette.grey[50]} !important`}}},".MuiTableRow-hover":{"&:hover":{backgroundColor:"inherit !important"}},".MuiTableCell-root":{paddingRight:"8px",paddingLeft:"8px",color:"text.secondary",...t&&{padding:"8px !important","&:first-child":{paddingTop:"20px!important"},"&:last-child":{paddingBottom:"20px!important"}}}},children:e.jsx(Er,{isSelf:!0,columnSx:n})})}function wt({onDestroySelf:t=void 0,userCenterTabs:o=[]}){const{t:s}=W(),{user:n,session:a,isMyself:i,isOwner:l}=he(),r=ze().arcSphere,f=Q({key:"md"}),m=re(async()=>n&&i?await F.user.getUserPrivacyConfig({did:n.did}):null,{refreshDeps:[n,i],loadingDelay:300}),g=R(()=>o.map(c=>({key:c.value,name:c.label,value:c.protected,isPrivate:c.isPrivate,followersOnly:c.followersOnly})),[o]),C=z(async c=>c==="privacy"?(await m.runAsync(),m.data):(c==="profile"&&await a.refresh(),null));b.useEffect(()=>{const c=window.location.hash.slice(1);c&&document.getElementById(c)?.scrollIntoView({behavior:"smooth"})},[]);const v=R(()=>[r?void 0:{label:s("userCenter.commonSetting.title"),value:"common",content:e.jsx(xt,{user:n,onSave:C})},{label:s("userCenter.notificationManagement"),value:"notification",content:e.jsx(ft,{user:n,isMobile:f})},{label:s("userCenter.thirdPartyLogin.title"),value:"thirdPartyLogin",content:e.jsx(gt,{user:n})},{label:s("common.accessKeys"),value:"accessKeys",content:e.jsx(xn,{isSelf:!0})},{label:s("common.mcpServers"),value:"mcpServers",content:e.jsx(zr,{})},{label:s("userCenter.privacyManagement"),value:"privacy",content:e.jsx(mt,{configList:g,onSave:C})},{label:s("userCenter.sessionManagement"),value:"session",content:e.jsx(yt,{user:n,showUser:!1,getUserSessions:c=>F.userSession.getMyLoginSessions({},c)})},!l&&t&&typeof t=="function"?{label:s("userCenter.dangerZone.title"),value:"dangerZone",content:e.jsx(vt,{onDestroySelf:t}),sx:{borderColor:"error.main"}}:null].filter(Boolean),[n,g,f,l,t]);return i?e.jsx(x,{className:"user-center-settings",sx:{display:"flex",flexDirection:"column",gap:2.5,minWidth:{md:500},"@media (min-width: 1200px) and (max-width: 1260px)":{maxWidth:750},"@media (min-width: 1100px) and (max-width: 1199px)":{maxWidth:650},"@media (min-width: 1000px) and (max-width: 1099px)":{maxWidth:600},"@media (max-width: 1049px)":{maxWidth:"100%"}},children:v.map(c=>c?e.jsxs(x,{id:c.value,sx:de({border:"1px solid",borderColor:"divider",borderRadius:1,p:2,"&:last-child":{mb:5}},c.sx),children:[e.jsx(I,{sx:{color:"text.primary",fontWeight:600},children:c.label}),e.jsx(x,{sx:{mt:2.5},children:c.content})]},c.value):null)}):null}wt.propTypes={onDestroySelf:u.func,userCenterTabs:u.array};const jt=b.createContext({}),{Provider:fn,Consumer:ho}=jt;function Ct({children:t}){const[o]=b.useState(!1),{session:s}=b.use(fe),{user:n}=s,[a,i]=b.useState(),l=b.useMemo(()=>n?.didSpace?.endpoint,[n?.didSpace]);b.useEffect(()=>{i(n?.didSpace)},[n?.didSpace]);const p=async()=>{i(void 0)},r=g=>{},f=async g=>{i(g),await r(g.endpoint)},m=!!(l&&a);return e.jsx(fn,{value:{loading:o,spaceGateway:a,session:s,deleteSpaceGateway:p,updateSpaceGateway:f,storageEndpoint:l,settingStorageEndpoint:r,hasStorageEndpoint:m},children:t})}function Le(){return b.use(jt)}Ct.propTypes={children:u.node.isRequired};function hn(t){const o=t.replace(/\/api\/space\/.+/,""),n=t.replace(/\/$/,"").split("/").at(-4);return ce(o,"space",n)}function St({session:t,spaceGateway:o,spaceStatus:s,refresh:n}){return e.jsxs(Ie,{direction:"row",spacing:1,children:[s===Br.DISCONNECTED&&e.jsx(ue,{reconnect:!0,variant:"outlined",session:t,spaceDid:t.user?.didSpace?.did,spaceGatewayUrl:t.user?.didSpace?.url,connectScope:"user",onSuccess:async()=>{await n()},onError:a=>{console.error(a),q.error(ee(a))}}),e.jsx($,{size:"small",LinkComponent:Ft,href:hn(o.endpoint),target:"_blank",children:e.jsx(Ut,{})})]})}St.propTypes={session:u.object.isRequired,spaceGateway:u.object.isRequired,spaceStatus:u.string.isRequired,refresh:u.func.isRequired};function kt({spaceGateway:t=void 0}){const{t:o}=W(),{updateSpaceGateway:s,session:n}=Le(),a=Q(),i=({spaceGateway:l})=>s(l);return e.jsxs(x,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(x,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[e.jsx(I,{sx:{fontSize:"16px",fontWeight:"bold"},children:o("userCenter.storage.spaces.connected.title")}),!a&&e.jsx(ue,{connectScope:"user",connectText:o("userCenter.storage.spaces.connected.switch"),session:n,onSuccess:i})]}),e.jsx(x,{children:t&&e.jsx(Wr,{endpoint:t.endpoint,deps:[t],selected:!0,footer:!0,action:l=>e.jsx(St,{session:n,...l})},t.endpoint)}),a&&e.jsx(x,{sx:{display:"flex",alignItems:"center",justifyContent:"center",marginTop:2},children:e.jsx(ue,{connectScope:"user",connectText:o("userCenter.storage.spaces.connected.switch"),session:n,onSuccess:i})})]})}kt.propTypes={spaceGateway:u.object};function gn(){const{t}=W(),{updateSpaceGateway:o,session:s}=Le(),n=({spaceGateway:a})=>o(a);return e.jsxs(x,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(I,{sx:{fontSize:"16px",fontWeight:"bold"},children:t("userCenter.storage.spaces.connect.providerForStorage")}),e.jsx(Or,{viewBox:"0 0 228 258",style:{width:"156px",height:"156px",margin:"16px 0"}}),e.jsx(x,{children:e.jsx(ue,{session:s,onSuccess:n})})]})}function mn(){const{spaceGateway:t,hasStorageEndpoint:o,loading:s}=Le(),{isMyself:n}=he();return n?s?e.jsx(Lr,{relative:"parent",children:e.jsx(Z,{})}):e.jsx(yn,{children:e.jsx(x,{sx:{maxWidth:"720px"},children:o?e.jsx(kt,{spaceGateway:t}):e.jsx(gn,{})})}):null}function bn(){return e.jsx(Ct,{children:e.jsx(mn,{})})}const yn=te(x)`
122
- height: 100%;
123
- overflow-y: auto;
124
- `;function vn(){const{user:t,isMyself:o,viewUser:s}=he(),{followed:n}=Ar();return e.jsx(x,{children:e.jsx(Dr,{teamDid:window?.blocklet?.did||"",user:o?t:s,showInvitees:o,followed:n})})}function go(){const{api:t}=ir(),o=b.useRef(null),n=Ht().tab,i=new URLSearchParams(window.location.search).get("embed")||window.sessionStorage?.getItem("embed"),l=ar(),p=R(()=>({...window.blocklet,meta:{did:window.blocklet.did,name:window.blocklet.did},children:window?.blocklet?.componentMountPoints.map(f=>({...f,meta:{...f,did:f.did,name:f.name||f.title||"",logo:"logo.png"}}))})),r=async f=>{const{input:m,sessionId:g}=f;try{await t.destroySelf({input:{...m,sessionId:g}})}catch(C){console.error("destroy myself error",C)}};return e.jsx(Cr,{children:e.jsxs(Mr,{ref:o,embed:i==="1",currentTab:n?ce(Te.WELLKNOWN_SERVICE_PATH_PREFIX,"user",n):"",disableAutoRedirect:n==="settings",children:[n==="notifications"?e.jsx(rn,{blocklets:[p],context:l}):null,n==="nfts"?e.jsx(cn,{}):null,n==="settings"?e.jsx(wt,{onDestroySelf:r}):null,n==="did-spaces"?e.jsx(bn,{}):null,n==="user-followers"?e.jsx(vn,{}):null]})})}export{go as default};
@@ -1 +0,0 @@
1
- import{j as t,at as r}from"./vendor-mui-core-BIZOanxj.js";import{r as s}from"./vendor-react-Dvs43sk9.js";import{c as a}from"./vendor-ux-Cfhaj-oj.js";import{t as n}from"./index-BIIL1VhU.js";import"./vendor-utils-CVwaKsP9.js";import"./vendor-hooks-BtDnIwBH.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BhtOu00C.js";function l(){const{t:o}=s.useContext(a);return t.jsx(i,{style:{paddingTop:"25vh"},children:t.jsx(n,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const i=r.main``;export{l as default};
@@ -1,113 +0,0 @@
1
- import{g as Wt,r as v}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as y,z as Q,b6 as me,be as Ke,y as V,am as ut,c_ as Bt,bm as Kt,at as ae,b1 as mt,W as h,T as ee,U as Ge,c$ as pt,b5 as qe,a5 as Me,Q as Fe,d0 as Ye,aN as Ue,a6 as ft,D as ht,d1 as qt,ad as xt,d2 as Mt,d3 as Ut,c1 as st,n as Ht,x as $t,bb as Vt,M as it,cv as Gt,I as Yt,d4 as Jt}from"./vendor-mui-core-BIZOanxj.js";import{A as gt,J as Xt,C as Qt,e as le,F as Zt,a3 as je}from"./vendor-utils-CVwaKsP9.js";import{T as te,H as M,n as ce,c as en,j as bt,a3 as tn,au as nn,m as jt,$ as vt,P as yt,av as Ae,b as St,G as sn,a0 as an}from"./vendor-ux-Cfhaj-oj.js";import{aD as rn,Y as Je,a7 as Ct,aX as wt,K as _e,c as _,ao as Z,p as on,aM as at}from"./index-BIIL1VhU.js";import{g as ye,b as $,a as se}from"./vendor-hooks-BtDnIwBH.js";import{u as Rt,C as J}from"./index.esm-JPZAjt0x.js";import{i as He}from"./isURL-CSKc4kTl.js";import{S as X}from"./section-CCfmWVdK.js";import{A as ln,a as cn,b as dn}from"./collapse-DhGi244c.js";import{S as Se}from"./shorten-label-DAXPWCI6.js";import{v as Tt}from"./index-DbXxI_D0.js";import{R as Nt,A as un,S as mn,a as pn,B as fn}from"./list-2lBZBVJD.js";import{j as hn,c as xn,N as gn}from"./team-CcIOrTIk.js";import{W as bn}from"./did-address-CeTjTMC4.js";import{p as It}from"./util-CRzq0bMY.js";import{D as jn,g as vn}from"./traffic-KIPRLJPY.js";import{B as Et}from"./bundle-avatar-BALJ_pZQ.js";import{u as yn}from"./use-mobile-BW9mTiYC.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BhtOu00C.js";import"./required-BUAaYcMZ.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-BtHqqZ50.js";import"./session-B_RHNjCZ.js";import"./use-app-logo-Cs4SrcDi.js";import"./base32-CgLd9kUN.js";import"./useAsyncRetry-DNTidBXG.js";import"./useAsync-DkQHu4t4.js";import"./iframe-ASQIizLx.js";import"./index-C_YGTMJ4.js";import"./index-DBs9Ljax.js";import"./base-chart-BbbiwJIa.js";import"./index-Dr9NaKfR.js";import"./vendor-mui-x-DWX99wt-.js";import"./AdapterDayjs-CAaLcejt.js";var Te={exports:{}},Ne={exports:{}},Ie={exports:{}},rt;function Sn(){return rt||(rt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=t;function t(r){return r==null}n.exports=s.default,n.exports.default=s.default}(Ie,Ie.exports)),Ie.exports}var ot;function Cn(){return ot||(ot=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=u;var t=o(rn()),r=o(Sn());function o(p){return p&&p.__esModule?p:{default:p}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,b=/^[-+]?[0-9]+$/;function u(p,i){(0,t.default)(p),i=i||{};var N=i.allow_leading_zeroes===!1?l:b,I=!i.hasOwnProperty("min")||(0,r.default)(i.min)||p>=i.min,S=!i.hasOwnProperty("max")||(0,r.default)(i.max)||p<=i.max,j=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||p<i.lt,E=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||p>i.gt;return N.test(p)&&I&&S&&j&&E}n.exports=s.default,n.exports.default=s.default}(Ne,Ne.exports)),Ne.exports}var lt;function wn(){return lt||(lt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=o;var t=r(Cn());function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,t.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=s.default,n.exports.default=s.default}(Te,Te.exports)),Te.exports}var Rn=wn();const Tn=Wt(Rn),ze={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Nn(){const{api:n}=Je(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,b=Object.assign({...ze},s?.settings?.notification?.email||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=Rt({defaultValues:gt(b,Object.keys(ze))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(a,T,O=!0)=>{try{const{blocklet:D}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),re=Object.assign({...ze},D?.settings?.notification?.email||{});I(re),O&&M.success(t("oauth.saveSuccess"))}catch(D){if(O)M.error(D.message||t("oauth.saveFailed"));else throw D}}),G=$(async(a,T,O)=>{try{i.isDirty&&await E(a,T,!1),await n.sendEmail({input:{did:l,receiver:O,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification",attachments:[{type:"link",data:{url:"https://community.arcblock.io",title:"Community",image:"https://community.arcblock.io/.well-known/service/blocklet/logo-rect-dark",utm:{campaign:"test-campaign"}}}],utm:{content:"test-email-button"}})}}),M.success(t("notification.email.testSuccess"))}catch(D){M.error(D.message||t("notification.email.testfailed"))}}),z=$((a,T)=>{S.testReceiver=localStorage.getItem("test-receiver")||"",S.testReceiverError="",r.open({title:t("notification.email.testSendEmail"),content:()=>e.jsx(y,{sx:{width:"300px"},children:e.jsx(Q,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.email.inputTestReceiver"),value:S.testReceiver,onChange:O=>{S.testReceiver=O.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(O){const D=S.testReceiver?.trim();if(!D){S.testReceiverError=t("notification.email.receiverRequired");return}if(!_e(D)){S.testReceiverError=t("notification.email.receiverInvalid");return}S.testReceiverError="",await G(a,T,D),O()}})}),F=$(a=>{const T=a?.trim();return T?_e(T)?!0:t("notification.email.fromInvalid"):t("notification.email.fromRequired")}),B=$(a=>{const T=a?.trim();return T?He(T,{require_host:!1,protocols:[]})?!0:t("notification.email.hostInvalid"):t("notification.email.hostRequired")}),w=$(a=>a?Tn(a)?!0:t("notification.email.portInvalid"):t("notification.email.portRequired")),K=$(a=>a?.trim()?!0:t("notification.email.userRequired")),q=$(a=>a?.trim()?!0:t("notification.email.passwordRequired")),f=$(a=>a?.trim()&&!He(a,{protocols:["http","https"],require_protocol:!0})?t("notification.email.linkInvalid"):!0),R=$(a=>a?.trim()&&!_e(a)?t("notification.email.emailInvalid"):!0),C=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(In,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.email.enable"),my:2.5,children:e.jsx(J,{name:"enabled",control:p,render:({field:a})=>e.jsx(me,{control:e.jsx(Ke,{checked:a.value,...a})})})}),e.jsx(X,{title:t("notification.email.from"),children:e.jsx(J,{name:"from",control:p,rules:{validate:j?F:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,label:t("notification.email.from"),error:!!i.errors[a.name],helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.host"),children:e.jsx(J,{name:"host",control:p,rules:{validate:j?B:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.host"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.port"),children:e.jsx(J,{name:"port",control:p,rules:{validate:j?w:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:t("notification.email.port"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.user"),children:e.jsx(J,{name:"user",control:p,rules:{validate:j?K:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.user"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.password"),children:e.jsx(J,{name:"password",control:p,rules:{validate:j?q:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:t("notification.email.password"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.secure"),children:e.jsx(J,{name:"secure",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(me,{control:e.jsx(Ke,{checked:a.value,...a,disabled:!j})})})})}),e.jsxs(ln,{children:[e.jsxs(cn,{expandIcon:e.jsx(Kt,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[t("notification.email.signature"),e.jsx(ut,{title:t("notification.email.signatureTooltip"),children:e.jsx(Bt,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(dn,{children:[e.jsx(X,{title:t("notification.email.companyName"),children:e.jsx(J,{name:"companyName",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyName"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyLink"),children:e.jsx(J,{name:"companyLink",control:p,rules:{validate:j?f:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyLink"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyAddress"),children:e.jsx(J,{name:"companyAddress",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyAddress"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.supportEmail"),children:e.jsx(J,{name:"supportEmail",control:p,rules:{validate:j?R:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:t("notification.email.supportEmail"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})})]})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const In=ae(mt)``,We={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function En(){const{api:n}=Je(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,b=Object.assign({...We},s?.settings?.notification?.pushKit||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=Rt({defaultValues:gt(b,Object.keys(We))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(w,K,q=!0)=>{try{const{blocklet:f}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:w})}}),R=Object.assign({...We},f?.settings?.notification?.pushKit||{});I(R),q&&M.success(t("oauth.saveSuccess"))}catch(f){if(q)M.error(f.message||t("oauth.saveFailed"));else throw f}}),G=$(async(w,K)=>{try{i.isDirty&&await E(w,K,!1);const q=(s?.configs||[]).find(C=>C.key==="BLOCKLET_APP_URL")?.value,f=Xt(Qt(q,_.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:s?.meta?.version,t:new Date(s?.updatedAt||0).getTime()}),R={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:s?.appDid,fullName:s?.meta?.title,avatar:f}}}};await n.sendPush({input:{did:l,receiver:S.testReceiver,notification:JSON.stringify(R)}}),M.success(t("notification.pushKit.testSuccess"))}catch(q){M.error(q.message||t("notification.pushKit.testfailed"))}}),z=$((w,K)=>{S.testReceiverError="",r.open({title:t("notification.pushKit.testSend"),content:()=>e.jsx(y,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(Q,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.pushKit.inputTestReceiver"),value:S.testReceiver,onChange:q=>{S.testReceiver=q.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(q){if(!S.testReceiver?.trim()){S.testReceiverError=t("notification.pushKit.receiverRequired");return}S.testReceiverError="",await G(w,K),q()}})}),F=$(w=>{const K=w?.trim();return K?He(K)?!0:t("notification.pushKit.endpointInvalid"):t("notification.pushKit.endpointRequired")}),B=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(kn,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.pushKit.enable"),my:2.5,children:e.jsx(J,{name:"enabled",control:p,render:({field:w})=>e.jsx(me,{control:e.jsx(Ke,{checked:w.value,...w})})})}),e.jsx(X,{title:t("notification.pushKit.endpoint"),children:e.jsx(J,{name:"endpoint",control:p,rules:{validate:j?F:B},render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...w,size:"small",required:!0,label:t("notification.pushKit.endpoint"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})})}),e.jsxs(X,{title:t("notification.pushKit.customOptions"),children:[e.jsx(J,{name:"did",control:p,render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...w,size:"small",label:t("notification.pushKit.did"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})}),e.jsx(J,{name:"pushPath",control:p,render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...w,size:"small",label:t("notification.pushKit.pushPath"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const kn=ae(mt)``,ct=[{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"}];function An(){const[n,s]=v.useState(ct[0].value),{locale:t}=v.useContext(en),r=se(()=>({email:e.jsx(Nn,{}),pushKit:e.jsx(En,{})}),[t]),o=v.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(y,{children:[e.jsx(bt,{tabs:ct,current:n,onChange:s}),e.jsx(y,{style:o,children:r[n]})]})}const kt=v.createContext({}),{Provider:On,Consumer:Ws}=kt;function Dn({children:n,blocklet:s=""}){const{api:t,inService:r,ws:{useSubscription:o}}=Je(),[l,b]=v.useState([]),[u,p]=v.useState({total:0,pageSize:20,pageCount:0,page:1}),i=se(()=>s.meta?.did,[s]),[N,I]=v.useState([]),[S,j]=v.useState({}),E=se(()=>l.length?new Set(l.map(f=>f.id)):new Set,[l]),G=async({page:f=1,pageSize:R=20,...C}={})=>{if(!i)return[];try{const a={paging:{page:f,pageSize:R},...C,teamDid:i,dateRange:C.dateRange?[Z(C.dateRange[0]).toISOString(),Z(C.dateRange[1]).toISOString()]:void 0},{dids:T,...O}=a;let D="";T&&T.includes("system")&&(D="system");const re=T?T.filter(pe=>pe!=="system"):[],ue={...O,source:D,componentDids:re},oe=await t.getNotificationSendLog({input:ue});return j(ue),b(oe.list),p(oe.paging),oe.list}catch(a){return M.error(a.message),[]}},z=async()=>{const f=await t.getNotificationComponents({input:{teamDid:i}});I(f.componentDids)},F=v.useCallback(f=>{const R=s.children.find(C=>C.meta?.did===f);if(R)return R.ancestors=[s],R},[s]),B=async({notificationId:f,receivers:R,channels:C,...a})=>{await t.resendNotification({input:{teamDid:i,notificationId:f,receivers:R,channels:C.map(T=>T==="wallet"?_.NOTIFICATION_SEND_CHANNEL.WALLET:T==="pushKit"?_.NOTIFICATION_SEND_CHANNEL.PUSH:T),...a}})},w=v.useCallback(async f=>(await t.getUser({input:{teamDid:i,user:{did:f},options:{enableConnectedAccount:!0}}})).user,[t,i]),K=v.useCallback(async({page:f=1,pageSize:R=20,...C}={})=>{try{const a={paging:{page:f,pageSize:R},...C,userName:C.searchText||"",teamDid:i,dateRange:C.dateRange?[Z(C.dateRange[0]).toISOString(),Z(C.dateRange[1]).toISOString()]:void 0};return await t.getReceivers({input:a})}catch(a){throw M.error(a.message),a}},[t,i]);v.useEffect(()=>{i&&z()},[i]),o(_.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,f=>{E.has(f.notificationId)&&G(S)},[E,S]),o(_.EVENTS.NOTIFICATION_BLOCKLET_CREATE,f=>{E.has(f.id)||G(S)},[E,S]);const q={fetch:G,data:l,paging:u,blocklet:s,getComponent:F,resendNotification:B,getUser:w,componentDids:N,getReceivers:K,inService:r,teamDid:i};return e.jsx(On,{value:{notificationRecords:q},children:n})}function Xe(){const{notificationRecords:n}=v.useContext(kt);return n}Ce.propTypes={severity:h.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ln={info:"primary",success:"success",error:"error",warning:"warning"};function Ce({severity:n="info"}){return e.jsx(tn,{type:Ln[n],children:n})}const Pn=(n,s,t="")=>{if(!t||!s)return"";switch(t){case _.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return t}};function At(n,s,t={}){const{status:r,updatedAt:o,reason:l="",channel:b="wallet"}=t,u=o?n("notification.sendStatus.sentTime",{date:on(o,s)}):"",p=Pn(n,b,l);return r===_.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:u,reason:p}:r===_.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:n("notification.sendStatus.pending"),reason:p,sentTime:u}}const $e={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ve=["wallet","pushKit","email"],dt=["info","success","error","warning"],Ot=n=>{const{settings:s}=n;return s?.notification?.email?.enabled},Dt=n=>{const{settings:s}=n;return s?.notification?.pushKit?.enabled},Fn=(n,s)=>{const t=le(s,"extra.notifications.email",!0);return{available:Ot(n),enabled:t}},_n=(n,s)=>{const t=le(s,"extra.notifications.push",!0);return{available:Dt(n),enabled:t}},zn=n=>({enabled:le(n,"extra.notifications.wallet",!0)}),Wn=n=>({enabled:le(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(s=>{setTimeout(()=>{s()},n*1e3)}),Bn=(n,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:n("notification.sendStatus.reason.available",{channel:s}),fail:n("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:[],ke=(n=[])=>{const s=Z().startOf("day");return n.filter(t=>Z(t.sendAt).isSame(s,"day")).length},Kn=(n,s="")=>{if(s&&Ve.includes(s)){const l=`${s}SendRecord`,b=le(n,l,[]);return ke(b)}const t=le(n,"webhook",{}),r=Object.keys(t??{})??[];if(s&&r.includes(s)){const l=t[s]??[];return ke(l)}const o={};return Ve.forEach(l=>{const b=`${l}SendRecord`,u=le(n,b,[]),p=ke(u);o[l]=p}),r.length>0&&r.forEach(l=>{const b=t[l]??[],u=ke(b);o[l]=u}),o},Oe=(n,s,t)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[t].splice(s,1),n},De=(n,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(n):!1},qn=n=>{switch(n){case _.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case _.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case _.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case _.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Lt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:s=!0,showTitle:t=!1,children:r=null}){const{status:o,title:l="",sentTime:b="",reason:u=""}=n,p=[l,u].filter(Boolean).join(", ");return e.jsx(ut,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:p}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(y,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(y,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(y,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:$e[o]}}),e.jsx(y,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:$e[o]}})]}),e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:t?l:r})]})})}de.propTypes={config:h.object.isRequired,enableTooltip:h.bool,showTitle:h.bool,children:h.node};Le.propTypes={list:h.array.isRequired,label:h.string.isRequired,onDelete:h.func};function Le({list:n,label:s,onDelete:t=()=>{}}){const{t:r,locale:o}=te();return e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),n.map(l=>{const b=At(r,o,{status:l});return e.jsx(Ge,{size:"small",label:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(de,{config:b,enableTooltip:!1,children:b.title})}),onDelete:u=>t(u,l)},l)})]})}Qe.propTypes={filterList:h.array.isRequired,onChange:h.func.isRequired,index:h.number.isRequired,column:h.object.isRequired,filterValues:h.array.isRequired,label:h.string.isRequired,renderLabel:h.func.isRequired};function Qe({filterList:n,onChange:s,index:t,column:r,filterValues:o,label:l,renderLabel:b}){return e.jsxs(V,{className:"filter-container",children:[e.jsx(pt,{component:"legend",children:l}),e.jsx(qe,{row:!0,children:o.map(u=>e.jsx(me,{control:e.jsx(Me,{checked:n[t].indexOf(u.value??u)>-1,onChange:p=>{const i=[...n];p.target.checked?i[t]=[...i[t],u.value??u]:i[t]=i[t].filter(N=>N!==(u.value??u)),s(i[t],t,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(u)})},u.value??u))})]})}function Be(n){return e.jsx(Qe,{...n,renderLabel:s=>e.jsx(de,{enableTooltip:!1,config:{status:s.status},children:s.label})})}xe.propTypes={status:h.number.isRequired,updatedAt:h.string.isRequired,reason:h.string,channel:h.string,onResend:h.func};function xe({status:n,updatedAt:s,reason:t="",channel:r="wallet",onResend:o}){const{t:l,locale:b}=te(),u=At(l,b,{status:n,updatedAt:s,reason:t,channel:r});return e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(de,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Fe,{className:"resend-btn",size:"small",startIcon:e.jsx(Ye,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}Ze.propTypes={value:h.array.isRequired,onChange:h.func};function Ze({value:n,onChange:s}){const{locale:t}=te(),r=Z().toDate(),[o,l]=v.useState(null),b=v.useCallback(i=>{l(o?null:i.currentTarget)},[o]),u=!!o,p=v.useCallback(i=>{if(!i.startDate||!i.endDate){M.error("Please select a date range");return}if(Z(i.startDate).isAfter(i.endDate)||!Z(i.startDate).isValid()||!Z(i.endDate).isValid()){M.error("Invalid date range");return}s([i.startDate,i.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(ee,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Fe,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[at(n[0],t)," - ",at(n[1],t)]})}),e.jsx(Ue,{open:u,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(jn,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:b,definedRanges:vn(r),onChange:p})})]})}et.propTypes={itemComponent:h.elementType.isRequired};function et({itemComponent:n,...s}){const{t}=te();return!s?.filterList?.filter(o=>o.length).length?null:e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:t("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(nn.TableFilterList,{...s,ItemComponent:n})})]})}function tt({label:n,onDelete:s,canDelete:t=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let l=!0;return t&&typeof t=="function"&&(l=t({label:n,...r})),e.jsx(Ge,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}tt.propTypes={label:h.string.isRequired,onDelete:h.func,canDelete:h.func};const Mn=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Pt.propTypes={loading:h.bool,onCancel:h.func,onConfirm:h.func};function Pt({loading:n=!1,onCancel:s=()=>{},onConfirm:t=()=>{}}){const{t:r}=te(),[o,l]=v.useState(Mn),[b,u]=v.useState(!0),p=(N,I)=>{I.checked=N.target.checked;const S=o.map(j=>({...j,checked:j.value===I.value?I.checked:j.checked}));l(S)},i=N=>{N.stopPropagation(),t({channels:o.filter(I=>I.checked).map(I=>I.value),isResendFailedOnly:b})};return e.jsxs(y,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ee,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(y,{className:"choose-channel",children:e.jsxs(V,{component:"fieldset",variant:"standard",children:[e.jsx(pt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(N=>e.jsx(me,{control:e.jsx(Me,{checked:N.checked,onChange:I=>p(I,N),name:N.value}),label:N.label},N.value))})]})}),e.jsx(y,{className:"resend-config-footer",children:e.jsx(qe,{children:e.jsx(me,{control:e.jsx(Me,{checked:b,onChange:N=>u(N.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(y,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Fe,{onClick:N=>{N.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Fe,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(ft,{size:16}),r("common.confirm")]})]})]})}Ft.propTypes={notificationId:h.string.isRequired,handleResend:h.func,resending:h.bool};function Ft({notificationId:n,handleResend:s,resending:t=!1}){const{t:r,locale:o}=te(),l=ht(),b=v.useMemo(()=>jt(l,Lt()),[l]),{getReceivers:u,inService:p,teamDid:i,getUser:N,blocklet:I}=Xe(),[S,j]=v.useState(!1),[E,G]=v.useState([]),z=ye({anchorEl:null,position:null}),F=ye({anchorEl:null,position:null}),[B,w]=v.useState(null),[K,q]=v.useState({total:0,pageSize:10,pageCount:0,page:1}),[f,R]=v.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[Z().subtract(1,"month").startOf("day").toDate(),Z().endOf("day").toDate()]}),[C,a]=v.useState([]),T=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],O=async()=>{if(!S&&n)try{j(!0);const c=await u({notificationId:n,...f}),d=c.list.map(m=>({...m,receiverUser:{...m.receiverUser,avatar:It(m.receiverUser.avatar,i,p)}}));G(d),q(c.paging),j(!1)}catch(c){M.error(c.message),j(!1)}};v.useEffect(()=>{O()},[f]);const D=c=>{c.stopPropagation();const d=c.currentTarget;F.anchorEl=d;const m=d.getBoundingClientRect();F.position={top:m.top+window.scrollY,left:m.left+window.scrollX}},re=c=>c.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(ce,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Ye,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:D,children:r("notification.resend")})}):null,ue={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:K.page-1,rowsPerPage:K.pageSize,count:K.total,searchText:f.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:C,onRowSelectionChange:(c,d)=>{a(d.map(m=>m.dataIndex))},customToolbarSelect:re},oe=({page:c,rowsPerPage:d,searchText:m,filterList:A})=>{const[,U=[],ne=[],Y=[]]=A;f.pageSize!==d?R(H=>({...H,pageSize:d,page:1})):f.page!==c+1?R(H=>({...H,page:c+1})):f.searchText!==m?R(H=>({...H,searchText:m,page:1})):je(U,f.walletSendStatus)?je(ne,f.pushKitSendStatus)?je(Y,f.emailSendStatus)||R(H=>({...H,emailSendStatus:Y,page:1})):R(H=>({...H,pushKitSendStatus:ne,page:1})):R(H=>({...H,walletSendStatus:U,page:1}))},pe=v.useCallback(async(c,d)=>{if(!d)return!1;const m=await N(d);return m?c==="wallet"?zn(m):c==="email"?Fn(I,m):c==="pushKit"?_n(I,m):c==="webhook"?Wn(m):!0:!1},[N,I]),we=v.useCallback(c=>Bn(r,c),[r]),fe=()=>{z.anchorEl=null,z.position=null,w(null)},he=()=>{F.anchorEl=null,F.position=null},g=async(c,d,m=!0,A="")=>{if(!(!d.length||!c.length))try{s(c,d,m,A),F.anchorEl||(await Ee(.5),fe())}catch(U){console.error("handleResend error",{error:U})}},x=async({channels:c,isResendFailedOnly:d})=>{const m=C.map(A=>E[A].receiver);await g(c,m,d),await Ee(.5),he(),a([])},k=async(c,d=[],m=!0)=>{try{await g(["webhook"],[c.receiver],m,d)}catch(A){M.error(A.response?A.response.statusText:A.message)}},L=async(c,d,m,A=[],U=!0)=>{if(c.stopPropagation(),Kn(d,m)>=4){M.warning(r("notification.resendLimit"));return}if(!Ve.includes(m)){await k(d,A,U);return}if(c){const Y=c.currentTarget,H=Y.getBoundingClientRect();z.anchorEl=Y,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}w({channel:m});try{const Y=await pe(m,d.receiver);await Ee(1),w({channel:m,result:Y}),(typeof Y=="boolean"&&Y||Zt(Y)&&Object.values(Y).every(H=>!!H))&&(await s([m],[d.receiver],U),F.anchorEl||(await Ee(.5),fe()))}catch(Y){M.error(Y.message)}},W=c=>{R(d=>({...d,dateRange:c,page:1}))},P=(c,d,m,A)=>{c.stopPropagation();const U=m.filter(ne=>ne!==d);R(ne=>({...ne,[A]:U,page:1}))},ie=se(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:c=>{const{receiverUser:d,receiver:m}=E[c];return d?e.jsxs(y,{"data-cy":`member-name-${d.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(vt,{src:`${d.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:m,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Se,{children:d.fullName})]},m):e.jsx(bn,{size:14,responsive:!1,compact:!0,copyable:!1,did:m})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:f.walletSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Wallet",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[1].options.filterList,"walletSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,A)=>e.jsx(Be,{label:"Wallet",filterList:c,onChange:d,index:m,column:A,filterValues:T})},customBodyRenderLite:c=>{const{walletSendStatus:d,walletSendAt:m,walletSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"wallet",onResend:U=>L(U,E[c],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{pushKitSendStatus:d,pushKitSendAt:m,pushKitSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"pushkit",onResend:U=>L(U,E[c],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:f.pushKitSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Push Kit",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[2].options.filterList,"pushKitSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,A)=>e.jsx(Be,{label:"Push Kit",filterList:c,onChange:d,index:m,column:A,filterValues:T})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:d,emailSendAt:m,emailSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"email",onResend:U=>L(U,E[c],"email",[],!1)})},filter:!0,filterType:"custom",filterList:f.emailSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Email",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[3].options.filterList,"emailSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,A)=>e.jsx(Be,{label:"Email",filterList:c,onChange:d,index:m,column:A,filterValues:T})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{webhook:d}=E[c];if(!d)return null;const m=Object.entries(d)[0];if(!m)return null;const[A,U]=m,ne=U[0];return e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(y,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(Se,{maxLength:30,children:A},A),e.jsx(xe,{status:ne.status,updatedAt:ne.sendAt,reason:ne.failedReason,channel:"webhook",onResend:Y=>L(Y,E[c],"webhook",[A],!1)})]},A)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:c=>{const{createdAt:d}=E[c];return e.jsx(Nt,{value:d,locale:o,shouldUpdate:!0})}}}],[E,o,f,r]),Re=[e.jsx(Ze,{value:f.dateRange,onChange:W},"date-picker"),e.jsx(ce,{variant:"contained",size:"small",color:"primary",loading:S,startIcon:e.jsx(qt,{}),onClick:()=>O(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(y,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(Hn,{children:e.jsxs(xt,{theme:b,children:[e.jsx(yt,{className:"receivers-table",locale:o,loading:S,columns:ie,data:E,onChange:oe,options:ue,customButtons:Re,components:{TableFilterList:c=>e.jsx(et,{...c,itemComponent:d=>e.jsx(tt,{...d,canDelete:()=>!1})})}}),z.anchorEl&&e.jsx(Ue,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:fe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs($n,{children:[e.jsxs(ee,{variant:"body1",component:"div",className:"check-title",children:[B?.channel," Checking"]}),e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:we(B?.channel).map(c=>{const{type:d,pass:m,fail:A}=c;return!B?.result||B?.result?.[d]?e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:B?.result?.[d]?Ae.success.main:"inherit"},children:[B?.result?e.jsx(Mt,{}):e.jsx(ft,{size:12,sx:{color:Ae.primary.main}}),e.jsx("span",{children:m})]},d):e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:Ae.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:A})]},d)})})]})}),F.anchorEl&&e.jsx(Ue,{open:!!F.anchorEl,anchorReference:"anchorPosition",anchorPosition:F.position,onClose:he,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Pt,{loading:t,onCancel:he,onConfirm:x})})]})})})}const Un=v.memo(Ft),Hn=ae.div`
2
- td.MuiTableCell-footer {
3
- border: none !important;
4
- }
5
- .sent-status-cell {
6
- .resend-btn {
7
- display: none;
8
- }
9
- &:hover {
10
- .resend-btn {
11
- display: flex;
12
- }
13
- }
14
- }
15
- `,$n=ae.div`
16
- padding: 8px 16px;
17
- .check-title {
18
- font-weight: 500;
19
- margin-bottom: 8px;
20
- &::first-letter {
21
- text-transform: uppercase;
22
- }
23
- }
24
- .check-item {
25
- svg {
26
- font-size: 16px;
27
- }
28
- font-size: 12px;
29
- }
30
- `,ve=n=>n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:n;function Vn(n){const{wallet:s,push:t,email:r,webhook:o}=n;return[{name:"Wallet",value:e.jsx(ge,{item:s})},{name:"Push",value:e.jsx(ge,{item:t})},{name:"Email",value:e.jsx(ge,{item:r})},...o.total>0?[{name:"Webhook",value:e.jsx(ge,{item:o,isWebhook:!0})}]:[]]}function Gn(n,s,t){const{wallet:r,push:o,email:l,webhook:b}=n;return[{name:"Wallet",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:s})},{name:"Push",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:s})},{name:"Email",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.EMAIL,item:l,onResend:s})},...b.total>0?[{name:"Webhook",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:b,isWebhook:!0,onResend:s})}]:[]]}nt.propTypes={statistics:h.object.isRequired,onResend:h.func,mode:h.oneOf(["simple","detail"]),resending:h.bool};ge.propTypes={item:h.object.isRequired,isWebhook:h.bool};function ge({item:n,isWebhook:s=!1}){const{t}=te(),r=s?n.success.length:n.success,o=n.total,l=r===o?"success":"failed";return e.jsx(y,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2},children:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsxs(de,{config:{status:l},enableTooltip:!1,children:[ve(r)," / ",ve(o)," ",t("notification.sendStatus.success")]})})})}be.propTypes={item:h.object.isRequired,isWebhook:h.bool,channel:h.string,onResend:h.func,loading:h.bool};function be({channel:n=_.NOTIFICATION_SEND_CHANNEL.WALLET,item:s,isWebhook:t=!1,onResend:r=()=>{},loading:o=!1}){const{t:l}=te(),{success:b,failed:u,pending:p}=s,i=qn(n),N=t?b.length:b,I=t?u.length:u,S=t?p.length:p,j=async F=>{F.stopPropagation();const B=t?[...new Set([...b,...u].map(w=>w))]:[];await r([n],[],!0,B)},E=N+I,G=E>0?N/E*100:0,z=E>0?I/E*100:0;return e.jsxs(Yn,{successRatio:G,failedRatio:z,children:[e.jsxs(ee,{variant:"h6",children:[i," (",s.total,")"]}),e.jsxs(ee,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:$e.success,fontWeight:600,fontSize:24},children:ve(N)}),e.jsx("small",{style:{paddingLeft:4},children:l("notification.sendStatus.success")})]}),e.jsxs(y,{className:"unsent-area",children:[e.jsxs(y,{children:[e.jsxs(de,{config:{status:"failed"},enableTooltip:!1,children:[ve(I)," ",l("notification.sendStatus.failed")]}),e.jsxs(de,{config:{status:"pending"},enableTooltip:!1,children:[ve(S)," ",l("notification.sendStatus.pending")]})]}),I>0&&e.jsx(y,{className:"resend-btn",children:e.jsx(ce,{size:"small",color:"primary",loading:o,variant:"contained",startIcon:e.jsx(Ye,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:j,children:l("notification.resend")})})]})]})}function nt({statistics:n,mode:s="simple",onResend:t=()=>{},resending:r=!1}){const o=se(()=>s==="simple"?Vn(n):Gn(n,t,r),[n,s]);return s==="simple"?e.jsx("div",{children:o.map(l=>e.jsx(Tt,{style:{alignItems:"flex-start",marginBottom:s==="simple"?0:16},valueComponent:"div",nameWidth:100,name:l.name,children:l.value},l.name))}):e.jsx(st,{container:!0,spacing:2,children:o.map(l=>e.jsx(st,{size:{md:4,sm:6,xs:12},children:l.value},l.name))})}const Yn=ae(y)`
31
- display: flex;
32
- flex-direction: column;
33
- align-items: flex-start;
34
- padding: 16px;
35
- border-radius: 8px;
36
- background: ${({successRatio:n,failedRatio:s,theme:t})=>n===0&&s===0?t.palette.grey[300]:`linear-gradient(to right, ${Ht(t.palette.success.light,.4)} ${n}%, ${t.palette.grey[100]} ${n}%)`};
37
- transition: 'background 0.5s ease';
38
- cursor: pointer;
39
- .unsent-area {
40
- width: 100%;
41
- position: relative;
42
- .resend-btn {
43
- position: absolute;
44
- right: 0;
45
- bottom: 0;
46
- }
47
- }
48
- `;_t.propTypes={notification:h.object.isRequired,onCancel:h.func,blocklet:h.object.isRequired,tab:h.string};function _t({notification:n,onCancel:s=()=>{},blocklet:t,tab:r="info"}){const{t:o,locale:l}=te(),{getComponent:b,resendNotification:u}=Xe(),[p,i]=v.useState(!1),N=se(()=>b(n.componentDid)||t,[t,n.componentDid]),I=ye({tab:r||"info"}),S=v.useCallback(async(f,R,C=!0,a=[])=>{if(!f.length||!n.id)return;const T=R.length>0?R:n?.receivers?.map(D=>D.receiver);if(!T.length)return;let O=[...f];if(O.includes(_.NOTIFICATION_SEND_CHANNEL.PUSH)&&!Dt(t)&&(M.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),O=O.filter(D=>D!==_.NOTIFICATION_SEND_CHANNEL.PUSH)),O.includes(_.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!Ot(t)&&(M.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),O=O.filter(D=>D!==_.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!O.length)try{i(!0),await u({notificationId:n.id,receivers:T,channels:O,resendFailedOnly:C,...O.includes("webhook")&&a.length?{webhookUrls:a}:{}}),M.success("Message has been sent!")}catch(D){console.error("handleResend error",{error:D}),M.error(D.response?D.response.statusText:D.message)}finally{i(!1)}},[t,n.id,n?.receivers,u,o]),j=se(()=>hn(n),[n]),E=se(()=>xn(n),[n]),G=se(()=>j?n?.actorInfo:[],[n]),z=se(()=>t?.did||t?.meta?.did||"",[t]);function F(){return[{name:o("notification.from"),value:j&&E?e.jsx(un,{actors:G,teamDid:z,size:32,showName:!0}):e.jsx(mn,{size:32,blocklet:N,showName:!0,hideDot:!0})},{name:o("notification.notificationTitle"),value:e.jsx(Se,{maxLength:50,children:n.title})},{name:o("notification.body"),value:j?e.jsx(pn,{notification:n,blocklet:t}):e.jsx(gn,{notification:n,rows:0})},{name:o("notification.severity"),value:e.jsx(Ce,{severity:n.severity})},{name:o("notification.createdAt"),value:e.jsx(sn,{value:n.createdAt,locale:l,shouldUpdate:!0,type:"all"})}].map(R=>e.jsx(Tt,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:R.name,children:R.value},R.name))}const B={info:{label:o("common.basicInfo"),value:"info",component:F},receivers:{label:o("notification.receiver"),value:"receivers"},statistics:{label:o("notification.statistics"),value:"statistics"}},w=Object.values(B).map(({label:f,value:R})=>({label:f,value:R})),K=B[I.tab]||B.info,q=f=>{I.tab=f};return e.jsx(St,{title:o("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{I.tab="info",s()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(Xn,{children:[e.jsx(y,{className:"tabs",sx:{mx:3},children:e.jsx(bt,{tabs:w,current:I.tab,onChange:q,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[I.tab==="receivers"&&e.jsx(Un,{notificationId:n.id,resending:p,handleResend:S}),I.tab==="statistics"&&e.jsx(nt,{statistics:n.statistics,mode:"detail",resending:p,onResend:S}),I.tab==="info"&&e.jsx(K.component,{})]})]})})}const Jn=v.memo(_t),Xn=ae.div`
49
- & > .notification-row {
50
- padding: 0;
51
- }
52
-
53
- .tabs {
54
- margin: 0;
55
- }
56
- .body {
57
- margin-top: 16px;
58
- }
59
-
60
- .channel-item {
61
- display: flex;
62
- padding: 4px;
63
- justify-content: flex-start;
64
- align-items: center;
65
- gap: 8px;
66
- > p {
67
- font-size: 15px;
68
- }
69
- .resend-btn {
70
- svg {
71
- font-size: 16px;
72
- }
73
- display: flex;
74
- align-items: center;
75
- font-size: 12px;
76
- cursor: pointer;
77
- &.disabled {
78
- cursor: not-allowed;
79
- color: ${Ae.text.disabled};
80
- }
81
- }
82
- }
83
- `;Pe.propTypes={blocklet:h.object,label:h.string};const Qn=ae.div`
84
- display: flex;
85
- justify-items: flex-start;
86
- align-items: center;
87
- gap: 8px;
88
- .name {
89
- display: block;
90
- max-width: 260px;
91
- white-space: nowrap;
92
- overflow: hidden;
93
- text-overflow: ellipsis;
94
- }
95
- `;function Pe({blocklet:n=null,label:s=""}){return e.jsx(Qn,{children:n?e.jsxs(e.Fragment,{children:[e.jsx(Et,{size:24,blocklet:n,ancestors:n.ancestors}),e.jsx("span",{className:"name",children:n.title||n.meta?.title})]}):e.jsx("span",{className:"name",children:s})})}zt.propTypes={list:h.array.isRequired,label:h.string.isRequired,onDelete:h.func};function zt({list:n,label:s,onDelete:t=()=>{}}){return e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),n.map(r=>e.jsx(Ge,{size:"small",label:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(Ce,{severity:r})}),onDelete:o=>t(o,r)},r))]})}function Zn(n){return e.jsx(Qe,{...n,renderLabel:s=>e.jsx(Ce,{severity:s})})}function es({customTableButtons:n}){const{t:s,locale:t}=te(),r=ht(),o=v.useMemo(()=>jt(r,Lt()),[r]),[l,b]=v.useState(!1),{data:u,paging:p,blocklet:i,fetch:N,getComponent:I,componentDids:S,inService:j,teamDid:E}=Xe(),G=v.useRef(null),[z,F]=v.useState(null),[B,w]=v.useState("info"),K=yn(),[q,f]=v.useState(!1),R=`notification-records-${i.meta?.did}`,C=an(R),[a,T]=v.useState({pageSize:C.rowsPerPage||10,page:C.page?C.page+1:1,dids:C.dids||[],dateRange:C.dateRange||[Z().subtract(1,"month").startOf("day").toDate(),Z().endOf("day").toDate()]}),O=se(()=>{if(!i.children||!i.children.length)return[];const g=[];return i.children.forEach(x=>{const k=x.did||x.meta?.did;S.includes(k)&&(x.ancestors=[i],g.push(x))}),g},[S,i]),D=async g=>{try{b(!0),await N(g),b(!1)}finally{b(!1)}};v.useEffect(()=>{D(a)},[a]),v.useEffect(()=>{const g=u.find(x=>x.id===z?.id);z&&g&&F({...g})},[u]);const re=(g,x,k,L)=>{g.stopPropagation();const W=k.filter(P=>P!==x);T(P=>({...P,[L]:W,page:1}))},ue=({page:g,rowsPerPage:x,filterList:k})=>{const[L=[],,,,W=[]]=k;a.pageSize!==x?T(P=>({...P,pageSize:x,page:1})):a.page!==g+1?T(P=>({...P,page:g+1})):je(a.dids,L)?je(a.severities,W)||T(P=>({...P,severities:W,page:1})):T(P=>({...P,dids:L,page:1}))},oe=v.useCallback(()=>{F(null),w("info")},[]),pe=v.useCallback(()=>{N(a)},[N,a]),we=[{label:s("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:g=>g.map((x,k)=>{if(x==="system")return e.jsx("span",{children:s("notification.system")},`system-${k}`);const L=O.find(W=>(W.did||W.meta?.did)===x);return e.jsx(Pe,{blocklet:L,label:L?.title||L?.meta?.title},x)}),update:(g,x,k)=>(g[k].splice(x,1),g)},filterOptions:{names:O,logic:(g,x)=>x.length?!x.includes(g):!1,display:(g,x,k,L)=>e.jsxs(V,{style:{width:"380px"},children:[e.jsx($t,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(Vt,{multiple:!0,value:g[k],renderValue:W=>e.jsx(y,{style:{overflow:"hidden",textOverflow:"ellipsis"},sx:{display:"flex",gap:1,alignItems:"center"},children:W.map(P=>{if(P==="system")return e.jsx("span",{children:s("notification.system")},P);const ie=O.find(Re=>(Re.did||Re.meta?.did)===P);return e.jsx(Pe,{blocklet:ie,label:ie?.title||ie?.meta?.title},P)})}),onChange:W=>{g[k]=W.target.value,x(g[k],k,L)},children:[e.jsx(it,{value:"system",children:s("notification.system")}),O.map(W=>{const P=W.did||W.meta?.did;return e.jsx(it,{value:P,children:e.jsx(Pe,{blocklet:W,label:W.title||W.meta?.title})},P)})]})]})},customBodyRenderLite:g=>{const x=u[g],k=I(x.componentDid);return e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1},children:[k?e.jsx(Et,{size:32,blocklet:k,ancestors:k.ancestors??[]}):e.jsx(fn,{blocklet:i,size:32}),e.jsx(Se,{maxLength:50,children:k?.meta?.title||i?.meta?.title})]})}}},{label:s("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:g=>{const x=u[g],{receivers:k}=x;return e.jsx(Gt,{total:k.length,renderSurplus:L=>L<100?e.jsxs("span",{children:["+",L]}):e.jsx("span",{children:"99+"}),max:3,sx:{justifyContent:"flex-end",height:"32px",".MuiAvatar-root":{width:"32px",height:"32px",fontSize:"12px",border:0,zIndex:2}},onClick:L=>{L.stopPropagation(),F(x),w("receivers")},children:k.map(L=>{const{receiverUser:W}=L,P=It(W.avatar,E,j);return e.jsx(vt,{alt:W.fullName,src:`${P}?imageFilter=resize&w=48&h=48`,size:32,did:L.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},L.receiver)})})}}},{label:s("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:g=>{const x=u[g];return e.jsx(y,{onClick:k=>{k.stopPropagation(),F(x),w("statistics")},children:e.jsx(nt,{statistics:x.statistics})})}}},{label:s("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:g=>{const x=u[g];return e.jsx(Se,{maxLength:50,children:x.title})}}},{label:s("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:g=>{const x=u[g];return e.jsx(Ce,{severity:x.severity})},filter:!0,filterType:"custom",filterList:a.severities??[],customFilterListOptions:{render:g=>e.jsx(zt,{list:g,label:s("notification.severity"),onDelete:(x,k)=>{x.stopPropagation(),re(x,k,we[4].options.filterList,"severities")}}),update:Oe},filterOptions:{names:dt,fullWidth:!0,logic:De,display:(g,x,k,L)=>e.jsx(Zn,{label:s("notification.severity"),filterList:g,onChange:x,index:k,column:L,filterValues:dt})}}},{label:s("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:g=>{const{createdAt:x}=u[g];return e.jsx(Nt,{value:x,locale:t,shouldUpdate:!0})}}}],fe=g=>{T(x=>({...x,dateRange:g,page:1}))},he=[e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[e.jsx(Yt,{onClick:()=>f(!0),sx:{p:K?0:void 0},children:e.jsx(Jt,{})},"settings"),K?e.jsx(ee,{children:s("common.setting")}):null]}),...n||[]];return e.jsxs(y,{ref:G,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(ts,{children:e.jsx(xt,{theme:o,children:e.jsx(yt,{className:"main-table",verticalKeyWidth:100,loading:l,locale:t,columns:we,data:u,durable:R,onChange:ue,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:p.page-1,rowsPerPage:p.pageSize,count:p.total,...C,onRowClick:(g,{dataIndex:x})=>{F(u[x])}},customPreButtons:[e.jsx(Ze,{value:a.dateRange,onChange:fe})],customButtons:he,components:{TableFilterList:g=>e.jsx(et,{...g,itemComponent:x=>e.jsx(tt,{...x,canDelete:k=>k?.columnNames?.[k?.index||0]?.name==="sender"})})}})})}),z&&e.jsx(Jn,{refresh:pe,onCancel:oe,notification:z,blocklet:i,tab:B}),e.jsx(St,{title:`${s("common.notification")} ${s("common.setting")}`,fullWidth:!0,maxWidth:"md",open:q,onClose:()=>f(!1),PaperProps:{style:{minHeight:"500px"}},children:e.jsx(y,{sx:{mt:"-16px",overflowY:"hidden"},children:e.jsx(An,{})})})]})}const ts=ae.div`
96
- td.MuiTableCell-footer {
97
- border: none !important;
98
- }
99
- .sent-status-cell {
100
- .resend-btn {
101
- display: none;
102
- }
103
- &:hover {
104
- .resend-btn {
105
- display: flex;
106
- }
107
- }
108
- }
109
-
110
- .custom-toobar-btns {
111
- gap: 4px;
112
- }
113
- `;ns.propTypes={blocklet:h.object.isRequired,customTableButtons:h.array};function ns({blocklet:n={},customTableButtons:s=[]}){return e.jsx(Dn,{blocklet:n,children:e.jsx(es,{customTableButtons:s})})}export{ns as default};
@@ -1 +0,0 @@
1
- import{r as p}from"./vendor-react-Dvs43sk9.js";import{j as a,y as b,W as t,z as y,M as E,ak as I}from"./vendor-mui-core-BIZOanxj.js";import{a as j}from"./vendor-hooks-BtDnIwBH.js";import{ao as r}from"./index-BIIL1VhU.js";import{T as A}from"./vendor-ux-Cfhaj-oj.js";import{l as C}from"./arrow-down.svg-B_TkYBj9.js";import{L as O,D as H}from"./vendor-mui-x-DWX99wt-.js";import{A as R}from"./AdapterDayjs-CAaLcejt.js";function v({value:s=null,onChange:i,error:l=!1,helperText:c="",label:T="",timezone:e="",minDateTime:f=null}){const d=j(()=>{let n=r();return s&&(n=e?r(s).tz(e):r(s)),n},[s,e]),m=n=>{const h=e?r(n).tz(e):r(n);i(new Date(h.format("YYYY-MM-DD HH:mm:00")))};return a.jsx(O,{dateAdapter:R,children:a.jsx(b,{fullWidth:!0,error:l,children:a.jsx(H,{label:T,minDateTime:f,value:d,onChange:m,slotProps:{textField:{error:l,helperText:l?c:""}},format:"YYYY-MM-DD HH:mm"})})})}v.propTypes={value:t.oneOfType([t.string,t.instanceOf(Date)]),onChange:t.func.isRequired,error:t.bool,helperText:t.string,label:t.string,timezone:t.string,minDateTime:t.instanceOf(Date)};function U(s){return a.jsx(C,{...s,width:20,height:20})}const u={MINUTES_30:30*60*1e3,HOUR_1:60*60*1e3,HOURS_3:3*60*60*1e3,DAY_1:24*60*60*1e3,DAYS_7:7*24*60*60*1e3,DAYS_30:30*24*60*60*1e3};function $({placeholder:s="",value:i="",onChange:l,timezone:c="",showError:T=!0}){const{t:e}=A(),[f,d]=p.useState(i||""),[m,n]=p.useState(null),[h,Y]=p.useState(null),x=p.useMemo(()=>[{value:u.MINUTES_30,label:`30 ${e("common.minutes")}`},{value:u.HOUR_1,label:`1 ${e("common.hour")}`},{value:u.HOURS_3,label:`3 ${e("common.hours")}`},{value:u.DAY_1,label:`1 ${e("common.day")}`},{value:u.DAYS_7,label:`7 ${e("common.days")}`},{value:u.DAYS_30,label:`30 ${e("common.days")}`},{value:"custom",label:e("common.custom")}],[e]),M=o=>{if(d(o),o==="custom"){const D=c?r().tz(c):r(),S=D.add(1,"day").toDate();Y(D),n(S),l(S)}else l(new Date(Date.now()+o))},_=o=>{n(o),l(o)};p.useEffect(()=>{i&&(x.find(D=>r(D.value).isSame(i))||(d("custom"),n(i)))},[]);const g=j(()=>T?!!(!m||r(m).isBefore(r())):!1,[m,e]);return a.jsxs(a.Fragment,{children:[a.jsx(b,{fullWidth:!0,children:a.jsx(y,{select:!0,value:f,label:s||e("team.passport.passportExpireTime"),onChange:o=>M(o.target.value),variant:"outlined",slotProps:{select:{IconComponent:U}},sx:{"& .MuiInputLabel-root":{width:"calc(100% - 46px)"}},children:x.map(o=>a.jsx(E,{value:o.value,children:o.label},o.value))})}),f==="custom"&&a.jsx(I,{children:a.jsx(v,{value:m,onChange:_,label:e("team.passport.customExpireTime"),timezone:c,error:!!g,helperText:g?e("team.passport.customExpireTimeIsInvalid"):void 0,minDateTime:h})})]})}$.propTypes={value:t.oneOfType([t.string,t.instanceOf(Date)]),onChange:t.func.isRequired,timezone:t.string,placeholder:t.string,showError:t.bool};export{$ as T};