@abtnode/blocklet-services 1.16.44-beta-20250528-003415-7a5e5d90 → 1.16.44-beta-20250529-223630-10e16ac8

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 (185) hide show
  1. package/api/middlewares/proxy-to-daemon.js +2 -1
  2. package/api/routes/env.js +5 -0
  3. package/dist/assets/{AdapterDayjs-gCvKcGfu.js → AdapterDayjs-CDDcwz3P.js} +1 -1
  4. package/dist/assets/{ArrowDropDown-D32FY-Mt.js → ArrowDropDown-DPqiF9Rw.js} +1 -1
  5. package/dist/assets/{CheckCircle-BBSSDlcc.js → CheckCircle-Caqp5gKY.js} +1 -1
  6. package/dist/assets/{ChevronLeft-CF24ouxR.js → ChevronLeft-DONyUbIg.js} +1 -1
  7. package/dist/assets/{ChevronRight-DA9t_C-l.js → ChevronRight-DgAwWLdY.js} +1 -1
  8. package/dist/assets/{DeleteOutline-CzIOFoFP.js → DeleteOutline-DpNyWtNL.js} +1 -1
  9. package/dist/assets/{Done-MQdb8YLa.js → Done-BTd13H2U.js} +1 -1
  10. package/dist/assets/{Download-IxxF4Ujs.js → Download-Bm8sKXA2.js} +1 -1
  11. package/dist/assets/{Edit-DSht16TX.js → Edit-CUl1Rt8i.js} +1 -1
  12. package/dist/assets/{Error-CkoCqY66.js → Error-DEKvwVoF.js} +1 -1
  13. package/dist/assets/{ExpandLess-CudE_1oQ.js → ExpandLess-t1cH-Bc4.js} +1 -1
  14. package/dist/assets/{Google-AZBuQJFI.js → Google-Bn3zPWiu.js} +1 -1
  15. package/dist/assets/{Home-BaA3V3I7.js → Home-C3ax1tQ7.js} +1 -1
  16. package/dist/assets/{InfoOutlined-Cd28U1Oc.js → InfoOutlined-D3XnF0Vg.js} +1 -1
  17. package/dist/assets/{Launch-Ddo_WSQI.js → Launch-Dz9mQnYC.js} +1 -1
  18. package/dist/assets/{LaunchOutlined-CO4dugwH.js → LaunchOutlined-E7HcQu_6.js} +1 -1
  19. package/dist/assets/{MoreHoriz-D-L8sA4c.js → MoreHoriz-DpKn_fkc.js} +1 -1
  20. package/dist/assets/{PlayArrow-CLKgdv6H.js → PlayArrow-CDOOUxMp.js} +1 -1
  21. package/dist/assets/{TuneOutlined-BWqIZK2m.js → TuneOutlined-D0gGDoIJ.js} +1 -1
  22. package/dist/assets/{ViewList-DWudZTBg.js → ViewList-C8G9e3ft.js} +1 -1
  23. package/dist/assets/{access-control-DlT-JQML.js → access-control-BhxOcGdx.js} +1 -1
  24. package/dist/assets/{actions-azdiYocL.js → actions-DP7pj6xB.js} +1 -1
  25. package/dist/assets/{add-component-core-Cm8Y0zkt.js → add-component-core-XUReAzat.js} +1 -1
  26. package/dist/assets/{add-resource-CVCoahx_.js → add-resource-C3kDcfBw.js} +1 -1
  27. package/dist/assets/{addon-3ZMGwARO.js → addon-CRj4Enw7.js} +1 -1
  28. package/dist/assets/{advanced-Nvg1CqJg.js → advanced-hz-KSWn2.js} +3 -3
  29. package/dist/assets/appearance-ChvtVBNv.js +1 -0
  30. package/dist/assets/{ar-T0OvMFDJ.js → ar-CSZJf27k.js} +1 -1
  31. package/dist/assets/{audit-logs-BPjUleS-.js → audit-logs-DXoc97BV.js} +1 -1
  32. package/dist/assets/authorize-_fbQ19S4.js +1 -0
  33. package/dist/assets/{base32-CLrnUJal.js → base32-WurN0cIW.js} +1 -1
  34. package/dist/assets/{branding-B8r8EJ2R.js → branding-DpkSF6dd.js} +2 -2
  35. package/dist/assets/{branding-Cr4GBUXi.js → branding-DuPWVNlC.js} +1 -1
  36. package/dist/assets/{bundle-avatar-Br48PGS5.js → bundle-avatar-D4fwror8.js} +1 -1
  37. package/dist/assets/{button-8G90WP8a.js → button-_1HExv7r.js} +1 -1
  38. package/dist/assets/{click-to-copy-ByEMWZD_.js → click-to-copy-R7MF4AwY.js} +1 -1
  39. package/dist/assets/{collapse-Cliwxlbv.js → collapse-l9wHY9gJ.js} +1 -1
  40. package/dist/assets/{complete-CzlLydJT.js → complete-C5D4D-fJ.js} +1 -1
  41. package/dist/assets/{component-5_wmVxpp.js → component-CURpjZJ2.js} +1 -1
  42. package/dist/assets/{config-BnObxTpi.js → config-Cd14MJHa.js} +1 -1
  43. package/dist/assets/{config-emhMgKqq.js → config-e36Xplpo.js} +1 -1
  44. package/dist/assets/config-navigation-BvjYZI_j.js +26 -0
  45. package/dist/assets/{config-space-TsP5osn9.js → config-space-EoSm62Er.js} +1 -1
  46. package/dist/assets/{confirm-DI8TUyRK.js → confirm-Vzr2I9eM.js} +1 -1
  47. package/dist/assets/{connect-D55qWQWC.js → connect-B5Xr7MId.js} +1 -1
  48. package/dist/assets/{connect-B_BnGQjp.js → connect-DXOsnqkO.js} +1 -1
  49. package/dist/assets/{connect-to-DzPwhREN.js → connect-to-Bz9wYM04.js} +1 -1
  50. package/dist/assets/{dashboard-AdC8-kkA.js → dashboard-xUr1SbPS.js} +3 -3
  51. package/dist/assets/{de-WYW4JJdA.js → de-C-F2uwju.js} +1 -1
  52. package/dist/assets/de-CA1MfHz7.js +1 -0
  53. package/dist/assets/{delete-confirm-Bn1HZjaL.js → delete-confirm-DNn4Os6R.js} +1 -1
  54. package/dist/assets/{did-address-BlAXR08O.js → did-address-Dq-4__HB.js} +1 -1
  55. package/dist/assets/{domain-Cod_zL8_.js → domain-XXgOrJDa.js} +1 -1
  56. package/dist/assets/{domain-action-card-C4FpSn67.js → domain-action-card-Cf1AoKOi.js} +1 -1
  57. package/dist/assets/domains-DeFj6Ipl.js +1 -0
  58. package/dist/assets/{email-CqVIYJc4.js → email-BIVfXnpk.js} +1 -1
  59. package/dist/assets/{es-DaHPJdAX.js → es-B2TJqtV4.js} +1 -1
  60. package/dist/assets/{es-B6GuFK3b.js → es-CXgvF2gS.js} +1 -1
  61. package/dist/assets/{exchange-passport-C-hTCqg0.js → exchange-passport-C9Pvr9Da.js} +1 -1
  62. package/dist/assets/fr-CzO5Th4h.js +1 -0
  63. package/dist/assets/{fr-Sdn9hi8k.js → fr-DN38boH3.js} +1 -1
  64. package/dist/assets/{fuel-M5L6Wmxz.js → fuel-Cs--pEYt.js} +1 -1
  65. package/dist/assets/{gen-access-key-D6jr4e_G.js → gen-access-key-CIzULsBE.js} +1 -1
  66. package/dist/assets/{get-safe-url-CRv5HbAK.js → get-safe-url-Q70tRxL7.js} +1 -1
  67. package/dist/assets/{get-safe-url-DrR-6D-i.js → get-safe-url-c4iAcpvA.js} +1 -1
  68. package/dist/assets/{hi-dJuR0lt2.js → hi-5tixPGqk.js} +1 -1
  69. package/dist/assets/hi-lZ18vyMl.js +1 -0
  70. package/dist/assets/{home-C7e6Ftxj.js → home-BZ8WpcWZ.js} +1 -1
  71. package/dist/assets/{id-DuYS34H0.js → id-CIDM1ypY.js} +1 -1
  72. package/dist/assets/id-QM66qYoI.js +1 -0
  73. package/dist/assets/{iframe-DSG-Hd99.js → iframe-Dl8NEFc5.js} +1 -1
  74. package/dist/assets/{index-AetYfL_f.js → index-B7IOoVDF.js} +1 -1
  75. package/dist/assets/{index-yvg4DpNi.js → index-BCJADuMw.js} +5 -5
  76. package/dist/assets/{index-BJHSgjnI.js → index-BKKwhjBs.js} +1 -1
  77. package/dist/assets/{index-iQsPOXlb.js → index-BU2FTGFr.js} +1 -1
  78. package/dist/assets/{index-DSoHmrHd.js → index-BUHyq-oP.js} +1 -1
  79. package/dist/assets/{index-BM1ZGOPs.js → index-BoTgqYtV.js} +2 -2
  80. package/dist/assets/{index-C4vmLohg.js → index-C64IgZKt.js} +1 -1
  81. package/dist/assets/{index-bIHubQ8z.js → index-CsXmgylH.js} +3 -3
  82. package/dist/assets/index-D-Lxloq5.js +284 -0
  83. package/dist/assets/{index-Bj2-CpPI.js → index-D1kTR2xk.js} +1 -1
  84. package/dist/assets/{index-CEeLwMYO.js → index-DBqLPDUh.js} +1 -1
  85. package/dist/assets/index-DDXNOodN.js +99 -0
  86. package/dist/assets/{index-YbYWmpAT.js → index-DDoVX3je.js} +22 -22
  87. package/dist/assets/{index-B5_fBwtl.js → index-Drd9jydY.js} +1 -1
  88. package/dist/assets/{index-BUrgmCmL.js → index-Dsd9SXVN.js} +1 -1
  89. package/dist/assets/index-DvBh35bh.js +1 -0
  90. package/dist/assets/{index-BFWnCQrF.js → index-I6_gMaPh.js} +1 -1
  91. package/dist/assets/{index-C2F-GVrD.js → index-U3mAyHwS.js} +1 -1
  92. package/dist/assets/{index-BLbU4gf9.js → index-W_fQ-nuf.js} +2 -2
  93. package/dist/assets/{index-rn2nf2kX.js → index-wLX5GW2c.js} +1 -1
  94. package/dist/assets/{invitation-StUiuLYU.js → invitation-Dsnc8lab.js} +1 -1
  95. package/dist/assets/{invite-E96eT2DF.js → invite-CvAru4rZ.js} +1 -1
  96. package/dist/assets/{issue-passport-DrGPTNsG.js → issue-passport-CDE6vHUE.js} +1 -1
  97. package/dist/assets/{item-Dgu9vLko.js → item-rXnALS3b.js} +1 -1
  98. package/dist/assets/{ja-ACgKScTi.js → ja-C8AmHPMo.js} +1 -1
  99. package/dist/assets/{ja-Dh60q0r5.js → ja-pJLB4V2E.js} +1 -1
  100. package/dist/assets/{ko-CoqvBZUf.js → ko-D2NP5Ixe.js} +1 -1
  101. package/dist/assets/ko-xDWtmcv7.js +1 -0
  102. package/dist/assets/{landing-page-BOy_W1aP.js → landing-page-DrVLCVAm.js} +1 -1
  103. package/dist/assets/{layout-CYJJYqb_.js → layout-DYG0Wl7R.js} +1 -1
  104. package/dist/assets/{list-uPz9xAWJ.js → list-DLMy1vVs.js} +1 -1
  105. package/dist/assets/list-b96sX5Y6.js +2 -0
  106. package/dist/assets/localization-Bb0kc8SQ.js +1 -0
  107. package/dist/assets/{log-CzRRb9lq.js → log-Bwqh69bM.js} +1 -1
  108. package/dist/assets/{logger-B4ZKcD6x.js → logger-BAVOmOw2.js} +1 -1
  109. package/dist/assets/{login-D3GnBJn4.js → login-Ygmj8_J7.js} +1 -1
  110. package/dist/assets/{login-oauth-callback-CVS9TwNM.js → login-oauth-callback-BrnNJIOK.js} +1 -1
  111. package/dist/assets/{logo-uploader-CbM-N8qP.js → logo-uploader-CLwbDhA_.js} +3 -3
  112. package/dist/assets/{lost-passport-5P2EFbv0.js → lost-passport-CqzPSoLw.js} +1 -1
  113. package/dist/assets/{open-window-c9TGr49M.js → open-window-Bl24RBAD.js} +1 -1
  114. package/dist/assets/{overview-BZRXhA-K.js → overview-DqabCKYi.js} +1 -1
  115. package/dist/assets/{page-header-D_m0ANZl.js → page-header-BWqvvXOk.js} +1 -1
  116. package/dist/assets/{passport-item-DE-9Q-Cx.js → passport-item-C5-ZuTPM.js} +1 -1
  117. package/dist/assets/{permission-fpFyADH8.js → permission-DSHe73ba.js} +1 -1
  118. package/dist/assets/{preferences-0RYr2e_y.js → preferences-BzGNV3pM.js} +1 -1
  119. package/dist/assets/{profile-embed-BwbGy3El.js → profile-embed-iA-d50c3.js} +1 -1
  120. package/dist/assets/{pt-DCcbs0d0.js → pt-D1apbJwE.js} +1 -1
  121. package/dist/assets/pt-DSj10b9i.js +1 -0
  122. package/dist/assets/{publish-resource-CWz86TY0.js → publish-resource-ebKgw7OW.js} +1 -1
  123. package/dist/assets/{react-beautiful-dnd.esm-G9cRB9Uf.js → react-beautiful-dnd.esm-Ck4xzwyU.js} +1 -1
  124. package/dist/assets/ru-BNuzbw_f.js +1 -0
  125. package/dist/assets/{ru-WYTV5VzH.js → ru-D2AG9Iea.js} +1 -1
  126. package/dist/assets/{runtime-63aIXcah.js → runtime-B454s6Gb.js} +1 -1
  127. package/dist/assets/sdk-DeS3iq37.js +1 -0
  128. package/dist/assets/{section-BB6hVmdO.js → section-Ccxg0x_Y.js} +1 -1
  129. package/dist/assets/{security-YPRPQuQL.js → security-DCArL_za.js} +1 -1
  130. package/dist/assets/{session-Djj2U6sa.js → session-C_8V_o-O.js} +1 -1
  131. package/dist/assets/{setup-C9DGbmM7.js → setup-CX2pUl2y.js} +3 -3
  132. package/dist/assets/{spaces-fGcGlx-U.js → spaces-DApg1wzn.js} +1 -1
  133. package/dist/assets/{start-Cz_j6UYt.js → start-Dhbx5j_D.js} +1 -1
  134. package/dist/assets/{starting-progress-DHv9oucO.js → starting-progress-BHUTOY2b.js} +1 -1
  135. package/dist/assets/{status-B5ff49WY.js → status-D4K-kiXO.js} +1 -1
  136. package/dist/assets/{step-actions-CPiUgWLW.js → step-actions-CISMVGx2.js} +1 -1
  137. package/dist/assets/{studio-DnKLD9XD.js → studio-1mTu0Fgs.js} +1 -1
  138. package/dist/assets/{switch-control-DWjnOuBy.js → switch-control-CpCSorUo.js} +1 -1
  139. package/dist/assets/{table-tips-DEGQUNJa.js → table-tips-BfSSGl9N.js} +1 -1
  140. package/dist/assets/{th-Da4lMKTX.js → th-CRGgyPc5.js} +1 -1
  141. package/dist/assets/th-CsJSfFsn.js +1 -0
  142. package/dist/assets/{traffic-C262RTgV.js → traffic-BqHyn9L9.js} +1 -1
  143. package/dist/assets/{transfer-CXfjw5Xg.js → transfer-Bqv1gMqL.js} +1 -1
  144. package/dist/assets/{unsubscribe-CdFXzPwR.js → unsubscribe-B3OLQIVA.js} +1 -1
  145. package/dist/assets/{use-blocklet-logo-C_pDvfYN.js → use-blocklet-logo-Bhkp-Zm7.js} +1 -1
  146. package/dist/assets/use-server-logo-CxuMvwKh.js +1 -1
  147. package/dist/assets/{useLocalStorage-DO6t2PeQ.js → useLocalStorage-D6gvgmEW.js} +1 -1
  148. package/dist/assets/{user-center-DR1kV4iN.js → user-center-vIx28YXm.js} +3 -3
  149. package/dist/assets/{util-VM27PwRk.js → util-DMfPwzVN.js} +1 -1
  150. package/dist/assets/{util-Cs-QbPU0.js → util-Dnkhck-D.js} +1 -1
  151. package/dist/assets/{vendor-arcblock-DuPySS9V.js → vendor-arcblock-BlrkGjK9.js} +1 -1
  152. package/dist/assets/{vendor-ux-did-connect-DIlRfE_S.js → vendor-ux-did-connect-2jRoUb28.js} +3 -3
  153. package/dist/assets/vi-Ce8JEW56.js +1 -0
  154. package/dist/assets/{vi-BxzaqoH9.js → vi-IIi6v-et.js} +1 -1
  155. package/dist/assets/wrap-locale-C_UOH97U.js +1 -0
  156. package/dist/assets/{zh-Do6onry4.js → zh-DQX0RFjY.js} +1 -1
  157. package/dist/assets/zh-S-Nv5zr-.js +1 -0
  158. package/dist/assets/{zh-tw-BNgoHsYW.js → zh-tw-6n1CYpHc.js} +1 -1
  159. package/dist/assets/zh-tw-C-FYOTmO.js +1 -0
  160. package/dist/index.html +3 -3
  161. package/dist/service-worker.js +1 -1
  162. package/package.json +30 -30
  163. package/api/middlewares/check-admin-permission.js +0 -15
  164. package/dist/assets/appearance-CAsFMLaC.js +0 -1
  165. package/dist/assets/authorize-CdTK5Air.js +0 -1
  166. package/dist/assets/config-navigation-DbyhYIMw.js +0 -26
  167. package/dist/assets/de-BWtUXhCw.js +0 -1
  168. package/dist/assets/domains-BhqtMbC1.js +0 -1
  169. package/dist/assets/fr-DjhyyiEi.js +0 -1
  170. package/dist/assets/hi-CtKbt1J4.js +0 -1
  171. package/dist/assets/id-CCuL3FP-.js +0 -1
  172. package/dist/assets/index-BJbAX71g.js +0 -284
  173. package/dist/assets/index-CtLialsm.js +0 -99
  174. package/dist/assets/index-DthGrDK3.js +0 -1
  175. package/dist/assets/ko-gvJH4zFR.js +0 -1
  176. package/dist/assets/list-C8X2Voou.js +0 -2
  177. package/dist/assets/localization-CI5Q0B2F.js +0 -1
  178. package/dist/assets/pt-DzswFIpl.js +0 -1
  179. package/dist/assets/ru-EZJWVu3M.js +0 -1
  180. package/dist/assets/sdk-D4BoQHdn.js +0 -1
  181. package/dist/assets/th-Bn3Ch7SK.js +0 -1
  182. package/dist/assets/vi-CgnGroV4.js +0 -1
  183. package/dist/assets/wrap-locale-BWx2hEb7.js +0 -1
  184. package/dist/assets/zh-BWgwGxeZ.js +0 -1
  185. package/dist/assets/zh-tw-Ciod1pFs.js +0 -1
@@ -1,4 +1,4 @@
1
- import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,j as e,aa as T,O as te,bs as ge,bt as We,bo as Y,ad as xt,H as x,a9 as Je,T as ae,E as Xe,bz as gt,bQ as qe,bR as Ke,y as Le,b3 as Me,ab as bt,bI as jt,Y as vt,cp as yt,m as Ht,bb as dt,br as Vt,bn as Yt,q as ut,bY as Gt,I as Jt}from"./vendor-mui-core-BV2FUxWJ.js";import{J as St,z as Xt,A as Qt,e as fe,aB as ye,C as Zt}from"./vendor-utils-rHXShPKm.js";import{q as es,a as re,a8 as Ct,a0 as K,W as ke,bW as ts,B as me,b4 as ss,au as wt,j as W,b9 as ns,r as Qe,bX as is,$ as Tt,a9 as Rt,bt as Ae,ao as Nt,Y as as,bA as rs}from"./vendor-ux-did-connect-DIlRfE_S.js";import{D as Ze,G as Et,aA as It,aB as Q,y as se,n as os,K as pt}from"./index-YbYWmpAT.js";import{a as Te,u as V,f as ce}from"./vendor-hooks-BgUTpb6X.js";import{a as et,b as ls}from"./dashboard-AdC8-kkA.js";import{f as $e,i as cs,d as ds}from"./use-blocklet-logo-C_pDvfYN.js";import{A as us,a as ps,d as fs,b as ms}from"./collapse-Cliwxlbv.js";import{S as ee}from"./section-BB6hVmdO.js";import{S as Re}from"./shorten-label-DPIZ5X7v.js";import{I as At}from"./index-DSoHmrHd.js";import{R as Ot,A as hs,S as xs,a as gs,b as bs,B as js}from"./list-uPz9xAWJ.js";import{W as vs}from"./did-address-BlAXR08O.js";import{p as Dt}from"./util-VM27PwRk.js";import{D as ys,g as Ss}from"./traffic-C262RTgV.js";import{B as Lt}from"./bundle-avatar-Br48PGS5.js";import{u as Cs}from"./use-mobile-C21X4TYN.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-DuPySS9V.js";import"./useLocalStorage-DO6t2PeQ.js";import"./index-8eXqqyHQ.js";import"./confirm-DI8TUyRK.js";import"./PlayArrow-CLKgdv6H.js";import"./get-safe-url-DrR-6D-i.js";import"./session-Djj2U6sa.js";import"./InfoOutlined-Cd28U1Oc.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BAa0wi8o.js";import"./index-D2uDBC1o.js";import"./CheckCircle-BBSSDlcc.js";import"./index-Bj2-CpPI.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./base32-CLrnUJal.js";import"./iframe-DSG-Hd99.js";import"./LaunchOutlined-CO4dugwH.js";import"./ChevronLeft-CF24ouxR.js";import"./ChevronRight-DA9t_C-l.js";import"./index-iB7JyXwh.js";import"./base-chart-D6qRW4Yg.js";import"./index-J3Tqz9ZT.js";import"./vendor-mui-x-Bo-XOtzq.js";import"./AdapterDayjs-gCvKcGfu.js";var Ue={exports:{}},He={exports:{}},Ve={exports:{}};(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;function s(r){return r==null}n.exports=t.default,n.exports.default=t.default})(Ve,Ve.exports);var ws=Ve.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var s=o(es),r=o(ws);function o(h){return h&&h.__esModule?h:{default:h}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,y=/^[-+]?[0-9]+$/;function p(h,i){(0,s.default)(h),i=i||{};var A=i.allow_leading_zeroes===!1?l:y,O=!i.hasOwnProperty("min")||(0,r.default)(i.min)||h>=i.min,R=!i.hasOwnProperty("max")||(0,r.default)(i.max)||h<=i.max,S=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||h<i.lt,D=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||h>i.gt;return A.test(h)&&O&&R&&S&&D}n.exports=t.default,n.exports.default=t.default})(He,He.exports);var Ts=He.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var s=r(Ts);function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,s.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=t.default,n.exports.default=t.default})(Ue,Ue.exports);var Rs=Ue.exports;const Ns=Ut(Rs),Fe={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Es(){var N,E,P;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(N=t==null?void 0:t.meta)==null?void 0:N.did,y=Object.assign({...Fe},((P=(E=t==null?void 0:t.settings)==null?void 0:E.notification)==null?void 0:P.email)||{}),{handleSubmit:p,control:h,formState:i,watch:A,reset:O}=It({defaultValues:St(y,Object.keys(Fe))}),R=Te({testReceiver:"",testReceiverError:""}),S=A("enabled"),D=V(async(a,m,$=!0)=>{var U,oe;try{const{blocklet:le}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),pe=Object.assign({...Fe},((oe=(U=le==null?void 0:le.settings)==null?void 0:U.notification)==null?void 0:oe.email)||{});O(pe),$&&K.success(s("oauth.saveSuccess"))}catch(le){if($)K.error(le.message||s("oauth.saveFailed"));else throw le}}),G=V(async(a,m,$)=>{try{i.isDirty&&await D(a,m,!1),await n.sendEmail({input:{did:l,receiver:$,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),K.success(s("notification.email.testSuccess"))}catch(U){K.error(U.message||s("notification.email.testfailed"))}}),z=V((a,m)=>{R.testReceiver="",R.testReceiverError="",r.open({title:s("notification.email.testSendEmail"),content:()=>e.jsx(T,{sx:{width:"300px"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.email.inputTestReceiver"),value:R.testReceiver,onChange:$=>{R.testReceiver=$.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm($){var oe;const U=(oe=R.testReceiver)==null?void 0:oe.trim();if(!U){R.testReceiverError=s("notification.email.receiverRequired");return}if(!ke(U)){R.testReceiverError=s("notification.email.receiverInvalid");return}R.testReceiverError="",await G(a,m,U),$()}})}),B=V(a=>{const m=a==null?void 0:a.trim();return m?ke(m)?!0:s("notification.email.fromInvalid"):s("notification.email.fromRequired")}),_=V(a=>{const m=a==null?void 0:a.trim();return m?$e(m,{require_host:!1,protocols:[]})?!0:s("notification.email.hostInvalid"):s("notification.email.hostRequired")}),M=V(a=>a?Ns(a)?!0:s("notification.email.portInvalid"):s("notification.email.portRequired")),J=V(a=>a!=null&&a.trim()?!0:s("notification.email.userRequired")),ie=V(a=>a!=null&&a.trim()?!0:s("notification.email.passwordRequired")),c=V(a=>a!=null&&a.trim()&&!$e(a,{protocols:["http","https"],require_protocol:!0})?s("notification.email.linkInvalid"):!0),g=V(a=>a!=null&&a.trim()&&!ke(a)?s("notification.email.emailInvalid"):!0),j=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Is,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.email.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:a})=>e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a})})})}),e.jsx(ee,{title:s("notification.email.from"),children:e.jsx(Q,{name:"from",control:h,rules:{validate:S?B:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,label:s("notification.email.from"),error:!!i.errors[a.name],helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.host"),children:e.jsx(Q,{name:"host",control:h,rules:{validate:S?_:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.host"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.port"),children:e.jsx(Q,{name:"port",control:h,rules:{validate:S?M:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:s("notification.email.port"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.user"),children:e.jsx(Q,{name:"user",control:h,rules:{validate:S?J:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.user"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.password"),children:e.jsx(Q,{name:"password",control:h,rules:{validate:S?ie:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:s("notification.email.password"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.secure"),children:e.jsx(Q,{name:"secure",control:h,rules:{validate:j},render:({field:a})=>e.jsx(Y,{fullWidth:!0,children:e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a,disabled:!S})})})})}),e.jsxs(us,{children:[e.jsxs(ps,{expandIcon:e.jsx(fs,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[s("notification.email.signature"),e.jsx(xt,{title:s("notification.email.signatureTooltip"),children:e.jsx(ts,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ms,{children:[e.jsx(ee,{title:s("notification.email.companyName"),children:e.jsx(Q,{name:"companyName",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyName"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyLink"),children:e.jsx(Q,{name:"companyLink",control:h,rules:{validate:S?c:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyLink"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyAddress"),children:e.jsx(Q,{name:"companyAddress",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyAddress"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.supportEmail"),children:e.jsx(Q,{name:"supportEmail",control:h,rules:{validate:S?g:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:s("notification.email.supportEmail"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})})]})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(z),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Is=ue(ht)``,Be={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function As(){var M,J,ie;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(M=t==null?void 0:t.meta)==null?void 0:M.did,y=Object.assign({...Be},((ie=(J=t==null?void 0:t.settings)==null?void 0:J.notification)==null?void 0:ie.pushKit)||{}),{handleSubmit:p,control:h,formState:i,watch:A,reset:O}=It({defaultValues:St(y,Object.keys(Be))}),R=Te({testReceiver:"",testReceiverError:""}),S=A("enabled"),D=V(async(c,g,j=!0)=>{var N,E;try{const{blocklet:P}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:c})}}),a=Object.assign({...Be},((E=(N=P==null?void 0:P.settings)==null?void 0:N.notification)==null?void 0:E.pushKit)||{});O(a),j&&K.success(s("oauth.saveSuccess"))}catch(P){if(j)K.error(P.message||s("oauth.saveFailed"));else throw P}}),G=V(async(c,g)=>{var j,N,E;try{i.isDirty&&await D(c,g,!1);const P=(j=((t==null?void 0:t.configs)||[]).find($=>$.key==="BLOCKLET_APP_URL"))==null?void 0:j.value,a=Xt(Qt(P,"/.well-known/service/blocklet/logo"),{v:(N=t==null?void 0:t.meta)==null?void 0:N.version,t:new Date((t==null?void 0:t.updatedAt)||0).getTime()}),m={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:t==null?void 0:t.appDid,fullName:(E=t==null?void 0:t.meta)==null?void 0:E.title,avatar:a}}}};await n.sendPush({input:{did:l,receiver:R.testReceiver,notification:JSON.stringify(m)}}),K.success(s("notification.pushKit.testSuccess"))}catch(P){K.error(P.message||s("notification.pushKit.testfailed"))}}),z=V((c,g)=>{R.testReceiverError="",r.open({title:s("notification.pushKit.testSend"),content:()=>e.jsx(T,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.pushKit.inputTestReceiver"),value:R.testReceiver,onChange:j=>{R.testReceiver=j.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(j){var E;if(!((E=R.testReceiver)==null?void 0:E.trim())){R.testReceiverError=s("notification.pushKit.receiverRequired");return}R.testReceiverError="",await G(c,g),j()}})}),B=V(c=>{const g=c==null?void 0:c.trim();return g?$e(g)?!0:s("notification.pushKit.endpointInvalid"):s("notification.pushKit.endpointRequired")}),_=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Os,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.pushKit.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:c})=>e.jsx(ge,{control:e.jsx(We,{checked:c.value,...c})})})}),e.jsx(ee,{title:s("notification.pushKit.endpoint"),children:e.jsx(Q,{name:"endpoint",control:h,rules:{validate:S?B:_},render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",required:!0,label:s("notification.pushKit.endpoint"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})}),e.jsxs(ee,{title:s("notification.pushKit.customOptions"),children:[e.jsx(Q,{name:"did",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.did"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}}),e.jsx(Q,{name:"pushPath",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.pushPath"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(z),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Os=ue(ht)``,ft=[{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function Ds(){const[n,t]=C.useState(ft[0].value),{locale:s}=C.useContext(ss),r=ce(()=>({email:e.jsx(Es,{}),pushKit:e.jsx(As,{})}),[s]),o=C.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(T,{children:[e.jsx(wt,{tabs:ft,current:n,onChange:t}),e.jsx(T,{style:o,children:r[n]})]})}const Pt=C.createContext({}),{Provider:Ls,Consumer:oi}=Pt;function Ps({children:n,blocklet:t=""}){const{api:s,inService:r,ws:{useSubscription:o}}=Ze(),[l,y]=C.useState([]),[p,h]=C.useState({total:0,pageSize:20,pageCount:0,page:1}),i=ce(()=>{var c;return(c=t.meta)==null?void 0:c.did},[t]),[A,O]=C.useState([]),[R,S]=C.useState({}),D=ce(()=>l.length?new Set(l.map(c=>c.id)):new Set,[l]),G=async({page:c=1,pageSize:g=20,...j}={})=>{if(!i)return[];try{const N={paging:{page:c,pageSize:g},...j,teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0},{dids:E,...P}=N;let a="";E&&E.includes("system")&&(a="system");const m=E?E.filter(oe=>oe!=="system"):[],$={...P,source:a,componentDids:m},U=await s.getNotificationSendLog({input:$});return S($),y(U.list),h(U.paging),U.list}catch(N){return K.error(N.message),[]}},z=async()=>{const c=await s.getNotificationComponents({input:{teamDid:i}});O(c.componentDids)},B=C.useCallback(c=>{const g=t.children.find(j=>{var N;return((N=j.meta)==null?void 0:N.did)===c});if(g)return g.ancestors=[t],g},[t]),_=async({notificationId:c,receivers:g,channels:j,...N})=>{await s.resendNotification({input:{teamDid:i,notificationId:c,receivers:g,channels:j.map(E=>E==="wallet"?W.NOTIFICATION_SEND_CHANNEL.WALLET:E==="pushKit"?W.NOTIFICATION_SEND_CHANNEL.PUSH:E),...N}})},M=C.useCallback(async c=>(await s.getUser({input:{teamDid:i,user:{did:c}}})).user,[s,i]),J=C.useCallback(async({page:c=1,pageSize:g=20,...j}={})=>{try{const N={paging:{page:c,pageSize:g},...j,userName:j.searchText||"",teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:N})}catch(N){throw K.error(N.message),N}},[s,i]);C.useEffect(()=>{i&&z()},[i]),o(W.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,c=>{D.has(c.notificationId)&&G(R)},[D,R]),o(W.EVENTS.NOTIFICATION_BLOCKLET_CREATE,c=>{D.has(c.id)||G(R)},[D,R]);const ie={fetch:G,data:l,paging:p,blocklet:t,getComponent:B,resendNotification:_,getUser:M,componentDids:A,getReceivers:J,inService:r,teamDid:i};return e.jsx(Ls,{value:{notificationRecords:ie},children:n})}function tt(){const{notificationRecords:n}=C.useContext(Pt);return n}Ne.propTypes={severity:x.oneOf(Object.values(["info","success","error","warning"])).isRequired};const _s={info:"primary",success:"success",error:"error",warning:"warning"};function Ne({severity:n="info"}){return e.jsx(ns,{type:_s[n],children:n})}var st={},ks=Je;Object.defineProperty(st,"__esModule",{value:!0});var _t=st.default=void 0,Fs=ks(Qe()),Bs=e;_t=st.default=(0,Fs.default)((0,Bs.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var nt={},zs=Je;Object.defineProperty(nt,"__esModule",{value:!0});var kt=nt.default=void 0,Ws=zs(Qe()),qs=e;kt=nt.default=(0,Ws.default)((0,qs.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var it={},Ks=Je;Object.defineProperty(it,"__esModule",{value:!0});var Ft=it.default=void 0,Ms=Ks(Qe()),$s=e;Ft=it.default=(0,Ms.default)((0,$s.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Us=(n,t,s="")=>{if(!s||!t)return"";switch(s){case W.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return s}};function Bt(n,t,s={}){const{status:r,updatedAt:o,reason:l="",channel:y="wallet"}=s,p=o?n("notification.sendStatus.sentTime",{date:os(o,t)}):"",h=Us(n,y,l);return r===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:p,reason:h}:r===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:p}:{status:"pending",title:n("notification.sendStatus.pending"),reason:h,sentTime:p}}const Ye={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ge=["wallet","pushKit","email"],mt=["info","success","error","warning"],zt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.email)==null?void 0:r.enabled},Wt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.pushKit)==null?void 0:r.enabled},Hs=(n,t)=>{const s=fe(t,"extra.notifications.email",!0);return{available:zt(n),enabled:s}},Vs=(n,t)=>{const s=fe(t,"extra.notifications.push",!0);return{available:Wt(n),enabled:s}},Ys=n=>({enabled:fe(n,"extra.notifications.wallet",!0)}),Gs=n=>({enabled:fe(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(t=>{setTimeout(()=>{t()},n*1e3)}),Js=(n,t)=>t==="wallet"||t==="webhook"?[{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:t==="pushKit"||t==="email"?[{channel:t,type:"available",pass:n("notification.sendStatus.reason.available",{channel:t}),fail:n("notification.sendStatus.reason.unavailable",{channel:t})},{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:[],Ie=(n=[])=>{const t=se().startOf("day");return n.filter(s=>se(s.sendAt).isSame(t,"day")).length},Xs=(n,t="")=>{if(t&&Ge.includes(t)){const l=`${t}SendRecord`,y=fe(n,l,[]);return Ie(y)}const s=fe(n,"webhook",{}),r=Object.keys(s??{})??[];if(t&&r.includes(t)){const l=s[t]??[];return Ie(l)}const o={};return Ge.forEach(l=>{const y=`${l}SendRecord`,p=fe(n,y,[]),h=Ie(p);o[l]=h}),r.length>0&&r.forEach(l=>{const y=s[l]??[],p=Ie(y);o[l]=p}),o},Oe=(n,t,s)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[s].splice(t,1),n},De=(n,t)=>{if(!Array.isArray(t))throw new Error("filters must be an array");return t.length?!t.includes(n):!1},Qs=n=>{switch(n){case W.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case W.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case W.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case W.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},qt=()=>({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:t=!0,showTitle:s=!1,children:r}){const{status:o,title:l="",sentTime:y="",reason:p=""}=n,h=[l,p].filter(Boolean).join(", ");return e.jsx(xt,{title:t?e.jsxs(e.Fragment,{children:[e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:h}),e.jsx("span",{children:y})]}):null,arrow:!0,placement:"top",children:e.jsxs(T,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(T,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(T,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Ye[o],style:{opacity:.15}}),e.jsx(T,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Ye[o]})]}),e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:s?l:r})]})})}de.propTypes={config:x.object.isRequired,enableTooltip:x.bool,showTitle:x.bool,children:x.node};de.defaultProps={enableTooltip:!0,showTitle:!1,children:null};Se.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};Se.defaultProps={onDelete:()=>{}};function Se({list:n,label:t,onDelete:s}){const{t:r,locale:o}=re();return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(l=>{const y=Bt(r,o,{status:l});return e.jsx(Xe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(de,{config:y,enableTooltip:!1,children:y.title})}),onDelete:p=>s(p,l)},l)})]})}at.propTypes={filterList:x.array.isRequired,onChange:x.func.isRequired,index:x.number.isRequired,column:x.object.isRequired,filterValues:x.array.isRequired,label:x.string.isRequired,renderLabel:x.func.isRequired};function at({filterList:n,onChange:t,index:s,column:r,filterValues:o,label:l,renderLabel:y}){return e.jsxs(Y,{className:"filter-container",children:[e.jsx(gt,{component:"legend",children:l}),e.jsx(qe,{row:!0,children:o.map(p=>e.jsx(ge,{control:e.jsx(Ke,{checked:n[s].indexOf(p.value??p)>-1,onChange:h=>{const i=[...n];h.target.checked?i[s]=[...i[s],p.value??p]:i[s]=i[s].filter(A=>A!==(p.value??p)),t(i[s],s,r)},name:p.value??p}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:y(p)})},p.value??p))})]})}function ze(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(de,{enableTooltip:!1,config:{status:t.status},children:t.label})})}ve.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function ve({status:n,updatedAt:t,reason:s="",channel:r="wallet",onResend:o}){const{t:l,locale:y}=re(),p=Bt(l,y,{status:n,updatedAt:t,reason:s,channel:r});return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(de,{config:p,showTitle:!0}),p.status!=="success"&&e.jsx(Le,{className:"resend-btn",size:"small",startIcon:e.jsx(et,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}rt.propTypes={value:x.array.isRequired,onChange:x.func};function rt({value:n,onChange:t}){const{locale:s}=re(),r=se().toDate(),[o,l]=C.useState(null),y=C.useCallback(i=>{l(o?null:i.currentTarget)},[o]),p=!!o,h=C.useCallback(i=>{if(!i.startDate||!i.endDate){K.error("Please select a date range");return}if(se(i.startDate).isAfter(i.endDate)||!se(i.startDate).isValid()||!se(i.endDate).isValid()){K.error("Invalid date range");return}t([i.startDate,i.endDate]),l(null)},[t]);return e.jsxs("div",{children:[e.jsx(ae,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Le,{onClick:y,variant:"outlined",size:"small",color:"inherit",children:[pt(n[0],s)," - ",pt(n[1],s)]})}),e.jsx(Me,{open:p,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(ys,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:y,definedRanges:Ss(r),onChange:h})})]})}ot.propTypes={itemComponent:x.elementType.isRequired};function ot({itemComponent:n,...t}){var o;const{t:s}=re();return!((o=t==null?void 0:t.filterList)!=null&&o.filter(l=>l.length).length)?null:e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(is.TableFilterList,{...t,ItemComponent:n})})]})}function Pe({label:n,onDelete:t,canDelete:s=()=>!0,...r}){const o=t&&typeof t=="function"?t:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:n,...r})),e.jsx(Xe,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}Pe.propTypes={label:x.string.isRequired,onDelete:x.func,canDelete:x.func};Pe.defaultProps={canDelete:()=>!0};const Zs=[{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}];lt.propTypes={loading:x.bool,onCancel:x.func,onConfirm:x.func};lt.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function lt({loading:n=!1,onCancel:t,onConfirm:s}){const{t:r}=re(),[o,l]=C.useState(Zs),[y,p]=C.useState(!0),h=(A,O)=>{O.checked=A.target.checked;const R=o.map(S=>({...S,checked:S.value===O.value?O.checked:S.checked}));l(R)},i=A=>{A.stopPropagation(),s({channels:o.filter(O=>O.checked).map(O=>O.value),isResendFailedOnly:y})};return e.jsxs(T,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ae,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(T,{className:"choose-channel",children:e.jsxs(Y,{component:"fieldset",variant:"standard",children:[e.jsx(gt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(A=>e.jsx(ge,{control:e.jsx(Ke,{checked:A.checked,onChange:O=>h(O,A),name:A.value}),label:A.label},A.value))})]})}),e.jsx(T,{className:"resend-config-footer",children:e.jsx(qe,{children:e.jsx(ge,{control:e.jsx(Ke,{checked:y,onChange:A=>p(A.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(T,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Le,{onClick:A=>{A.stopPropagation(),t()},color:"inherit",children:r("common.cancel")}),e.jsxs(Le,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(bt,{size:16}),r("common.confirm")]})]})]})}Kt.propTypes={notificationId:x.string.isRequired,handleResend:x.func,resending:x.bool};function Kt({notificationId:n,handleResend:t,resending:s=!1}){const{t:r,locale:o}=re(),l=jt(),y=C.useMemo(()=>vt(l,qt()),[l]),{getReceivers:p,inService:h,teamDid:i,getUser:A,blocklet:O}=tt(),[R,S]=C.useState(!1),[D,G]=C.useState([]),z=Te({anchorEl:null,position:null}),B=Te({anchorEl:null,position:null}),[_,M]=C.useState(null),[J,ie]=C.useState({total:0,pageSize:10,pageCount:0,page:1}),[c,g]=C.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),[j,N]=C.useState([]),E=[{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"}],P=async()=>{if(!R&&n)try{S(!0);const d=await p({notificationId:n,...c}),u=d.list.map(f=>({...f,receiverUser:{...f.receiverUser,avatar:Dt(f.receiverUser.avatar,i,h)}}));G(u),ie(d.paging),S(!1)}catch(d){K.error(d.message),S(!1)}};C.useEffect(()=>{P()},[c]);const a=d=>{d.stopPropagation();const u=d.currentTarget;B.anchorEl=u;const f=u.getBoundingClientRect();B.position={top:f.top+window.scrollY,left:f.left+window.scrollX}},m=d=>d.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(me,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:r("notification.resend")})}):null,$={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:J.page-1,rowsPerPage:J.pageSize,count:J.total,searchText:c.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:j,onRowSelectionChange:(d,u)=>{N(u.map(f=>f.dataIndex))},customToolbarSelect:m},U=({page:d,rowsPerPage:u,searchText:f,filterList:L})=>{const[,q=[],Z=[],X=[]]=L;c.pageSize!==u?g(H=>({...H,pageSize:u,page:1})):c.page!==d+1?g(H=>({...H,page:d+1})):c.searchText!==f?g(H=>({...H,searchText:f,page:1})):ye(q,c.walletSendStatus)?ye(Z,c.pushKitSendStatus)?ye(X,c.emailSendStatus)||g(H=>({...H,emailSendStatus:X,page:1})):g(H=>({...H,pushKitSendStatus:Z,page:1})):g(H=>({...H,walletSendStatus:q,page:1}))},oe=C.useCallback(async(d,u)=>{if(!u)return!1;const f=await A(u);return f?d==="wallet"?Ys(f):d==="email"?Hs(O,f):d==="pushKit"?Vs(O,f):d==="webhook"?Gs(f):!0:!1},[A,O]),le=C.useCallback(d=>Js(r,d),[r]),pe=()=>{z.anchorEl=null,z.position=null,M(null)},be=()=>{B.anchorEl=null,B.position=null},je=async(d,u,f=!0,L="")=>{if(!(!u.length||!d.length))try{t(d,u,f,L),B.anchorEl||(await Ee(.5),pe())}catch(q){console.error("handleResend error",{error:q})}},v=async({channels:d,isResendFailedOnly:u})=>{const f=j.map(L=>D[L].receiver);await je(d,f,u),await Ee(.5),be(),N([])},b=async(d,u=[],f=!0)=>{try{await je(["webhook"],[d.receiver],f,u)}catch(L){K.error(L.response?L.response.statusText:L.message)}},w=async(d,u,f,L=[],q=!0)=>{if(d.stopPropagation(),Xs(u,f)>=4){K.warning(r("notification.resendLimit"));return}if(!Ge.includes(f)){await b(u,L,q);return}if(d){const X=d.currentTarget,H=X.getBoundingClientRect();z.anchorEl=X,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}M({channel:f});try{const X=await oe(f,u.receiver);await Ee(1),M({channel:f,result:X}),(typeof X=="boolean"&&X||Zt(X)&&Object.values(X).every(H=>!!H))&&(await t([f],[u.receiver],q),B.anchorEl||(await Ee(.5),pe()))}catch(X){K.error(X.message)}},I=d=>{g(u=>({...u,dateRange:d,page:1}))},k=(d,u,f,L)=>{d.stopPropagation();const q=f.filter(Z=>Z!==u);g(Z=>({...Z,[L]:q,page:1}))},F=ce(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:d=>{const{receiverUser:u,receiver:f}=D[d];return u?e.jsxs(T,{"data-cy":`member-name-${u.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(Tt,{src:`${u.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:f,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Re,{children:u.fullName})]},f):e.jsx(vs,{size:14,responsive:!1,compact:!0,copyable:!1,did:f})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:c.walletSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Wallet",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[1].options.filterList,"walletSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Wallet",filterList:d,onChange:u,index:f,column:L,filterValues:E})},customBodyRenderLite:d=>{const{walletSendStatus:u,walletSendAt:f,walletSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"wallet",onResend:q=>w(q,D[d],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{pushKitSendStatus:u,pushKitSendAt:f,pushKitSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"pushkit",onResend:q=>w(q,D[d],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:c.pushKitSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Push Kit",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[2].options.filterList,"pushKitSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Push Kit",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{emailSendStatus:u,emailSendAt:f,emailSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"email",onResend:q=>w(q,D[d],"email",[],!1)})},filter:!0,filterType:"custom",filterList:c.emailSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Email",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[3].options.filterList,"emailSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Email",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{webhook:u}=D[d];if(!u)return null;const f=Object.entries(u)[0];if(!f)return null;const[L,q]=f,Z=q[0];return e.jsx(T,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(T,{className:"webhook-item",fontSize:12,children:[e.jsx(Re,{maxLength:30,children:L},L),e.jsx(ve,{status:Z.status,updatedAt:Z.sendAt,reason:Z.failedReason,channel:"webhook",onResend:X=>w(X,D[d],"webhook",[L],!1)})]},L)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:d=>{const{createdAt:u}=D[d];return e.jsx(Ot,{value:u,locale:o,shouldUpdate:!0})}}}],[D,o,c,r]),ne=[e.jsx(rt,{value:c.dateRange,onChange:I},"date-picker"),e.jsx(me,{variant:"contained",size:"small",color:"primary",loading:R,startIcon:e.jsx(Ft,{}),onClick:()=>P(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(T,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(tn,{children:e.jsxs(yt,{theme:y,children:[e.jsx(Rt,{className:"receivers-table",locale:o,loading:R,columns:F,data:D,onChange:U,options:$,customButtons:ne,components:{TableFilterList:d=>e.jsx(ot,{...d,itemComponent:u=>e.jsx(Pe,{...u,canDelete:()=>!1})})}}),z.anchorEl&&e.jsx(Me,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:pe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(sn,{children:[e.jsxs(ae,{variant:"body1",component:"div",className:"check-title",children:[_==null?void 0:_.channel," Checking"]}),e.jsx(T,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:le(_==null?void 0:_.channel).map(d=>{var q,Z;const{type:u,pass:f,fail:L}=d;return!(_!=null&&_.result)||(q=_==null?void 0:_.result)!=null&&q[u]?e.jsxs(ae,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(Z=_==null?void 0:_.result)!=null&&Z[u]?Ae.success.main:"inherit"},children:[_!=null&&_.result?e.jsx(_t,{}):e.jsx(bt,{size:12,sx:{color:Ae.primary.main}}),e.jsx("span",{children:f})]},u):e.jsxs(ae,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Ae.error.main},children:[e.jsx(kt,{}),e.jsx("span",{children:L})]},u)})})]})}),B.anchorEl&&e.jsx(Me,{open:!!B.anchorEl,anchorReference:"anchorPosition",anchorPosition:B.position,onClose:be,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(lt,{loading:s,onCancel:be,onConfirm:v})})]})})})}const en=C.memo(Kt),tn=ue.div`
1
+ import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,j as e,aa as T,O as te,bs as ge,bt as We,bo as Y,ad as xt,H as x,a9 as Je,T as ae,E as Xe,bz as gt,bQ as qe,bR as Ke,y as Le,b3 as Me,ab as bt,bI as jt,Y as vt,cp as yt,m as Ht,bb as dt,br as Vt,bn as Yt,q as ut,bY as Gt,I as Jt}from"./vendor-mui-core-BV2FUxWJ.js";import{J as St,z as Xt,A as Qt,e as fe,aB as ye,C as Zt}from"./vendor-utils-rHXShPKm.js";import{q as es,a as re,a8 as Ct,a0 as K,W as ke,bW as ts,B as me,b4 as ss,au as wt,j as W,b9 as ns,r as Qe,bX as is,$ as Tt,a9 as Rt,bt as Ae,ao as Nt,Y as as,bA as rs}from"./vendor-ux-did-connect-2jRoUb28.js";import{D as Ze,G as Et,aB as It,aC as Q,y as se,n as os,K as pt}from"./index-DDoVX3je.js";import{a as Te,u as V,f as ce}from"./vendor-hooks-BgUTpb6X.js";import{a as et,b as ls}from"./dashboard-xUr1SbPS.js";import{f as $e,i as cs,d as ds}from"./use-blocklet-logo-Bhkp-Zm7.js";import{A as us,a as ps,d as fs,b as ms}from"./collapse-l9wHY9gJ.js";import{S as ee}from"./section-Ccxg0x_Y.js";import{S as Re}from"./shorten-label-DPIZ5X7v.js";import{I as At}from"./index-BUHyq-oP.js";import{R as Ot,A as hs,S as xs,a as gs,b as bs,B as js}from"./list-DLMy1vVs.js";import{W as vs}from"./did-address-Dq-4__HB.js";import{p as Dt}from"./util-DMfPwzVN.js";import{D as ys,g as Ss}from"./traffic-BqHyn9L9.js";import{B as Lt}from"./bundle-avatar-D4fwror8.js";import{u as Cs}from"./use-mobile-BAa0wi8o.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-BlrkGjK9.js";import"./useLocalStorage-D6gvgmEW.js";import"./index-8eXqqyHQ.js";import"./confirm-Vzr2I9eM.js";import"./PlayArrow-CDOOUxMp.js";import"./get-safe-url-c4iAcpvA.js";import"./session-C_8V_o-O.js";import"./InfoOutlined-D3XnF0Vg.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./index-D2uDBC1o.js";import"./CheckCircle-Caqp5gKY.js";import"./index-D1kTR2xk.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./base32-WurN0cIW.js";import"./iframe-Dl8NEFc5.js";import"./LaunchOutlined-E7HcQu_6.js";import"./ChevronLeft-DONyUbIg.js";import"./ChevronRight-DgAwWLdY.js";import"./index-iB7JyXwh.js";import"./base-chart-D6qRW4Yg.js";import"./index-J3Tqz9ZT.js";import"./vendor-mui-x-Bo-XOtzq.js";import"./AdapterDayjs-CDDcwz3P.js";var Ue={exports:{}},He={exports:{}},Ve={exports:{}};(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;function s(r){return r==null}n.exports=t.default,n.exports.default=t.default})(Ve,Ve.exports);var ws=Ve.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var s=o(es),r=o(ws);function o(h){return h&&h.__esModule?h:{default:h}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,y=/^[-+]?[0-9]+$/;function p(h,i){(0,s.default)(h),i=i||{};var A=i.allow_leading_zeroes===!1?l:y,O=!i.hasOwnProperty("min")||(0,r.default)(i.min)||h>=i.min,R=!i.hasOwnProperty("max")||(0,r.default)(i.max)||h<=i.max,S=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||h<i.lt,D=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||h>i.gt;return A.test(h)&&O&&R&&S&&D}n.exports=t.default,n.exports.default=t.default})(He,He.exports);var Ts=He.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var s=r(Ts);function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,s.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=t.default,n.exports.default=t.default})(Ue,Ue.exports);var Rs=Ue.exports;const Ns=Ut(Rs),Fe={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Es(){var N,E,P;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(N=t==null?void 0:t.meta)==null?void 0:N.did,y=Object.assign({...Fe},((P=(E=t==null?void 0:t.settings)==null?void 0:E.notification)==null?void 0:P.email)||{}),{handleSubmit:p,control:h,formState:i,watch:A,reset:O}=It({defaultValues:St(y,Object.keys(Fe))}),R=Te({testReceiver:"",testReceiverError:""}),S=A("enabled"),D=V(async(a,m,$=!0)=>{var U,oe;try{const{blocklet:le}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),pe=Object.assign({...Fe},((oe=(U=le==null?void 0:le.settings)==null?void 0:U.notification)==null?void 0:oe.email)||{});O(pe),$&&K.success(s("oauth.saveSuccess"))}catch(le){if($)K.error(le.message||s("oauth.saveFailed"));else throw le}}),G=V(async(a,m,$)=>{try{i.isDirty&&await D(a,m,!1),await n.sendEmail({input:{did:l,receiver:$,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),K.success(s("notification.email.testSuccess"))}catch(U){K.error(U.message||s("notification.email.testfailed"))}}),z=V((a,m)=>{R.testReceiver="",R.testReceiverError="",r.open({title:s("notification.email.testSendEmail"),content:()=>e.jsx(T,{sx:{width:"300px"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.email.inputTestReceiver"),value:R.testReceiver,onChange:$=>{R.testReceiver=$.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm($){var oe;const U=(oe=R.testReceiver)==null?void 0:oe.trim();if(!U){R.testReceiverError=s("notification.email.receiverRequired");return}if(!ke(U)){R.testReceiverError=s("notification.email.receiverInvalid");return}R.testReceiverError="",await G(a,m,U),$()}})}),B=V(a=>{const m=a==null?void 0:a.trim();return m?ke(m)?!0:s("notification.email.fromInvalid"):s("notification.email.fromRequired")}),_=V(a=>{const m=a==null?void 0:a.trim();return m?$e(m,{require_host:!1,protocols:[]})?!0:s("notification.email.hostInvalid"):s("notification.email.hostRequired")}),M=V(a=>a?Ns(a)?!0:s("notification.email.portInvalid"):s("notification.email.portRequired")),J=V(a=>a!=null&&a.trim()?!0:s("notification.email.userRequired")),ie=V(a=>a!=null&&a.trim()?!0:s("notification.email.passwordRequired")),c=V(a=>a!=null&&a.trim()&&!$e(a,{protocols:["http","https"],require_protocol:!0})?s("notification.email.linkInvalid"):!0),g=V(a=>a!=null&&a.trim()&&!ke(a)?s("notification.email.emailInvalid"):!0),j=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Is,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.email.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:a})=>e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a})})})}),e.jsx(ee,{title:s("notification.email.from"),children:e.jsx(Q,{name:"from",control:h,rules:{validate:S?B:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,label:s("notification.email.from"),error:!!i.errors[a.name],helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.host"),children:e.jsx(Q,{name:"host",control:h,rules:{validate:S?_:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.host"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.port"),children:e.jsx(Q,{name:"port",control:h,rules:{validate:S?M:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:s("notification.email.port"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.user"),children:e.jsx(Q,{name:"user",control:h,rules:{validate:S?J:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.user"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.password"),children:e.jsx(Q,{name:"password",control:h,rules:{validate:S?ie:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:s("notification.email.password"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.secure"),children:e.jsx(Q,{name:"secure",control:h,rules:{validate:j},render:({field:a})=>e.jsx(Y,{fullWidth:!0,children:e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a,disabled:!S})})})})}),e.jsxs(us,{children:[e.jsxs(ps,{expandIcon:e.jsx(fs,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[s("notification.email.signature"),e.jsx(xt,{title:s("notification.email.signatureTooltip"),children:e.jsx(ts,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ms,{children:[e.jsx(ee,{title:s("notification.email.companyName"),children:e.jsx(Q,{name:"companyName",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyName"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyLink"),children:e.jsx(Q,{name:"companyLink",control:h,rules:{validate:S?c:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyLink"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyAddress"),children:e.jsx(Q,{name:"companyAddress",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyAddress"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.supportEmail"),children:e.jsx(Q,{name:"supportEmail",control:h,rules:{validate:S?g:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:s("notification.email.supportEmail"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})})]})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(z),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Is=ue(ht)``,Be={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function As(){var M,J,ie;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(M=t==null?void 0:t.meta)==null?void 0:M.did,y=Object.assign({...Be},((ie=(J=t==null?void 0:t.settings)==null?void 0:J.notification)==null?void 0:ie.pushKit)||{}),{handleSubmit:p,control:h,formState:i,watch:A,reset:O}=It({defaultValues:St(y,Object.keys(Be))}),R=Te({testReceiver:"",testReceiverError:""}),S=A("enabled"),D=V(async(c,g,j=!0)=>{var N,E;try{const{blocklet:P}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:c})}}),a=Object.assign({...Be},((E=(N=P==null?void 0:P.settings)==null?void 0:N.notification)==null?void 0:E.pushKit)||{});O(a),j&&K.success(s("oauth.saveSuccess"))}catch(P){if(j)K.error(P.message||s("oauth.saveFailed"));else throw P}}),G=V(async(c,g)=>{var j,N,E;try{i.isDirty&&await D(c,g,!1);const P=(j=((t==null?void 0:t.configs)||[]).find($=>$.key==="BLOCKLET_APP_URL"))==null?void 0:j.value,a=Xt(Qt(P,"/.well-known/service/blocklet/logo"),{v:(N=t==null?void 0:t.meta)==null?void 0:N.version,t:new Date((t==null?void 0:t.updatedAt)||0).getTime()}),m={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:t==null?void 0:t.appDid,fullName:(E=t==null?void 0:t.meta)==null?void 0:E.title,avatar:a}}}};await n.sendPush({input:{did:l,receiver:R.testReceiver,notification:JSON.stringify(m)}}),K.success(s("notification.pushKit.testSuccess"))}catch(P){K.error(P.message||s("notification.pushKit.testfailed"))}}),z=V((c,g)=>{R.testReceiverError="",r.open({title:s("notification.pushKit.testSend"),content:()=>e.jsx(T,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.pushKit.inputTestReceiver"),value:R.testReceiver,onChange:j=>{R.testReceiver=j.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(j){var E;if(!((E=R.testReceiver)==null?void 0:E.trim())){R.testReceiverError=s("notification.pushKit.receiverRequired");return}R.testReceiverError="",await G(c,g),j()}})}),B=V(c=>{const g=c==null?void 0:c.trim();return g?$e(g)?!0:s("notification.pushKit.endpointInvalid"):s("notification.pushKit.endpointRequired")}),_=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Os,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.pushKit.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:c})=>e.jsx(ge,{control:e.jsx(We,{checked:c.value,...c})})})}),e.jsx(ee,{title:s("notification.pushKit.endpoint"),children:e.jsx(Q,{name:"endpoint",control:h,rules:{validate:S?B:_},render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",required:!0,label:s("notification.pushKit.endpoint"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})}),e.jsxs(ee,{title:s("notification.pushKit.customOptions"),children:[e.jsx(Q,{name:"did",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.did"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}}),e.jsx(Q,{name:"pushPath",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.pushPath"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(z),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Os=ue(ht)``,ft=[{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function Ds(){const[n,t]=C.useState(ft[0].value),{locale:s}=C.useContext(ss),r=ce(()=>({email:e.jsx(Es,{}),pushKit:e.jsx(As,{})}),[s]),o=C.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(T,{children:[e.jsx(wt,{tabs:ft,current:n,onChange:t}),e.jsx(T,{style:o,children:r[n]})]})}const Pt=C.createContext({}),{Provider:Ls,Consumer:oi}=Pt;function Ps({children:n,blocklet:t=""}){const{api:s,inService:r,ws:{useSubscription:o}}=Ze(),[l,y]=C.useState([]),[p,h]=C.useState({total:0,pageSize:20,pageCount:0,page:1}),i=ce(()=>{var c;return(c=t.meta)==null?void 0:c.did},[t]),[A,O]=C.useState([]),[R,S]=C.useState({}),D=ce(()=>l.length?new Set(l.map(c=>c.id)):new Set,[l]),G=async({page:c=1,pageSize:g=20,...j}={})=>{if(!i)return[];try{const N={paging:{page:c,pageSize:g},...j,teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0},{dids:E,...P}=N;let a="";E&&E.includes("system")&&(a="system");const m=E?E.filter(oe=>oe!=="system"):[],$={...P,source:a,componentDids:m},U=await s.getNotificationSendLog({input:$});return S($),y(U.list),h(U.paging),U.list}catch(N){return K.error(N.message),[]}},z=async()=>{const c=await s.getNotificationComponents({input:{teamDid:i}});O(c.componentDids)},B=C.useCallback(c=>{const g=t.children.find(j=>{var N;return((N=j.meta)==null?void 0:N.did)===c});if(g)return g.ancestors=[t],g},[t]),_=async({notificationId:c,receivers:g,channels:j,...N})=>{await s.resendNotification({input:{teamDid:i,notificationId:c,receivers:g,channels:j.map(E=>E==="wallet"?W.NOTIFICATION_SEND_CHANNEL.WALLET:E==="pushKit"?W.NOTIFICATION_SEND_CHANNEL.PUSH:E),...N}})},M=C.useCallback(async c=>(await s.getUser({input:{teamDid:i,user:{did:c}}})).user,[s,i]),J=C.useCallback(async({page:c=1,pageSize:g=20,...j}={})=>{try{const N={paging:{page:c,pageSize:g},...j,userName:j.searchText||"",teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:N})}catch(N){throw K.error(N.message),N}},[s,i]);C.useEffect(()=>{i&&z()},[i]),o(W.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,c=>{D.has(c.notificationId)&&G(R)},[D,R]),o(W.EVENTS.NOTIFICATION_BLOCKLET_CREATE,c=>{D.has(c.id)||G(R)},[D,R]);const ie={fetch:G,data:l,paging:p,blocklet:t,getComponent:B,resendNotification:_,getUser:M,componentDids:A,getReceivers:J,inService:r,teamDid:i};return e.jsx(Ls,{value:{notificationRecords:ie},children:n})}function tt(){const{notificationRecords:n}=C.useContext(Pt);return n}Ne.propTypes={severity:x.oneOf(Object.values(["info","success","error","warning"])).isRequired};const _s={info:"primary",success:"success",error:"error",warning:"warning"};function Ne({severity:n="info"}){return e.jsx(ns,{type:_s[n],children:n})}var st={},ks=Je;Object.defineProperty(st,"__esModule",{value:!0});var _t=st.default=void 0,Fs=ks(Qe()),Bs=e;_t=st.default=(0,Fs.default)((0,Bs.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var nt={},zs=Je;Object.defineProperty(nt,"__esModule",{value:!0});var kt=nt.default=void 0,Ws=zs(Qe()),qs=e;kt=nt.default=(0,Ws.default)((0,qs.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var it={},Ks=Je;Object.defineProperty(it,"__esModule",{value:!0});var Ft=it.default=void 0,Ms=Ks(Qe()),$s=e;Ft=it.default=(0,Ms.default)((0,$s.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Us=(n,t,s="")=>{if(!s||!t)return"";switch(s){case W.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return s}};function Bt(n,t,s={}){const{status:r,updatedAt:o,reason:l="",channel:y="wallet"}=s,p=o?n("notification.sendStatus.sentTime",{date:os(o,t)}):"",h=Us(n,y,l);return r===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:p,reason:h}:r===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:p}:{status:"pending",title:n("notification.sendStatus.pending"),reason:h,sentTime:p}}const Ye={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ge=["wallet","pushKit","email"],mt=["info","success","error","warning"],zt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.email)==null?void 0:r.enabled},Wt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.pushKit)==null?void 0:r.enabled},Hs=(n,t)=>{const s=fe(t,"extra.notifications.email",!0);return{available:zt(n),enabled:s}},Vs=(n,t)=>{const s=fe(t,"extra.notifications.push",!0);return{available:Wt(n),enabled:s}},Ys=n=>({enabled:fe(n,"extra.notifications.wallet",!0)}),Gs=n=>({enabled:fe(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(t=>{setTimeout(()=>{t()},n*1e3)}),Js=(n,t)=>t==="wallet"||t==="webhook"?[{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:t==="pushKit"||t==="email"?[{channel:t,type:"available",pass:n("notification.sendStatus.reason.available",{channel:t}),fail:n("notification.sendStatus.reason.unavailable",{channel:t})},{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:[],Ie=(n=[])=>{const t=se().startOf("day");return n.filter(s=>se(s.sendAt).isSame(t,"day")).length},Xs=(n,t="")=>{if(t&&Ge.includes(t)){const l=`${t}SendRecord`,y=fe(n,l,[]);return Ie(y)}const s=fe(n,"webhook",{}),r=Object.keys(s??{})??[];if(t&&r.includes(t)){const l=s[t]??[];return Ie(l)}const o={};return Ge.forEach(l=>{const y=`${l}SendRecord`,p=fe(n,y,[]),h=Ie(p);o[l]=h}),r.length>0&&r.forEach(l=>{const y=s[l]??[],p=Ie(y);o[l]=p}),o},Oe=(n,t,s)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[s].splice(t,1),n},De=(n,t)=>{if(!Array.isArray(t))throw new Error("filters must be an array");return t.length?!t.includes(n):!1},Qs=n=>{switch(n){case W.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case W.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case W.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case W.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},qt=()=>({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:t=!0,showTitle:s=!1,children:r}){const{status:o,title:l="",sentTime:y="",reason:p=""}=n,h=[l,p].filter(Boolean).join(", ");return e.jsx(xt,{title:t?e.jsxs(e.Fragment,{children:[e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:h}),e.jsx("span",{children:y})]}):null,arrow:!0,placement:"top",children:e.jsxs(T,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(T,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(T,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Ye[o],style:{opacity:.15}}),e.jsx(T,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Ye[o]})]}),e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:s?l:r})]})})}de.propTypes={config:x.object.isRequired,enableTooltip:x.bool,showTitle:x.bool,children:x.node};de.defaultProps={enableTooltip:!0,showTitle:!1,children:null};Se.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};Se.defaultProps={onDelete:()=>{}};function Se({list:n,label:t,onDelete:s}){const{t:r,locale:o}=re();return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(l=>{const y=Bt(r,o,{status:l});return e.jsx(Xe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(de,{config:y,enableTooltip:!1,children:y.title})}),onDelete:p=>s(p,l)},l)})]})}at.propTypes={filterList:x.array.isRequired,onChange:x.func.isRequired,index:x.number.isRequired,column:x.object.isRequired,filterValues:x.array.isRequired,label:x.string.isRequired,renderLabel:x.func.isRequired};function at({filterList:n,onChange:t,index:s,column:r,filterValues:o,label:l,renderLabel:y}){return e.jsxs(Y,{className:"filter-container",children:[e.jsx(gt,{component:"legend",children:l}),e.jsx(qe,{row:!0,children:o.map(p=>e.jsx(ge,{control:e.jsx(Ke,{checked:n[s].indexOf(p.value??p)>-1,onChange:h=>{const i=[...n];h.target.checked?i[s]=[...i[s],p.value??p]:i[s]=i[s].filter(A=>A!==(p.value??p)),t(i[s],s,r)},name:p.value??p}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:y(p)})},p.value??p))})]})}function ze(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(de,{enableTooltip:!1,config:{status:t.status},children:t.label})})}ve.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function ve({status:n,updatedAt:t,reason:s="",channel:r="wallet",onResend:o}){const{t:l,locale:y}=re(),p=Bt(l,y,{status:n,updatedAt:t,reason:s,channel:r});return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(de,{config:p,showTitle:!0}),p.status!=="success"&&e.jsx(Le,{className:"resend-btn",size:"small",startIcon:e.jsx(et,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}rt.propTypes={value:x.array.isRequired,onChange:x.func};function rt({value:n,onChange:t}){const{locale:s}=re(),r=se().toDate(),[o,l]=C.useState(null),y=C.useCallback(i=>{l(o?null:i.currentTarget)},[o]),p=!!o,h=C.useCallback(i=>{if(!i.startDate||!i.endDate){K.error("Please select a date range");return}if(se(i.startDate).isAfter(i.endDate)||!se(i.startDate).isValid()||!se(i.endDate).isValid()){K.error("Invalid date range");return}t([i.startDate,i.endDate]),l(null)},[t]);return e.jsxs("div",{children:[e.jsx(ae,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Le,{onClick:y,variant:"outlined",size:"small",color:"inherit",children:[pt(n[0],s)," - ",pt(n[1],s)]})}),e.jsx(Me,{open:p,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(ys,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:y,definedRanges:Ss(r),onChange:h})})]})}ot.propTypes={itemComponent:x.elementType.isRequired};function ot({itemComponent:n,...t}){var o;const{t:s}=re();return!((o=t==null?void 0:t.filterList)!=null&&o.filter(l=>l.length).length)?null:e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(is.TableFilterList,{...t,ItemComponent:n})})]})}function Pe({label:n,onDelete:t,canDelete:s=()=>!0,...r}){const o=t&&typeof t=="function"?t:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:n,...r})),e.jsx(Xe,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}Pe.propTypes={label:x.string.isRequired,onDelete:x.func,canDelete:x.func};Pe.defaultProps={canDelete:()=>!0};const Zs=[{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}];lt.propTypes={loading:x.bool,onCancel:x.func,onConfirm:x.func};lt.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function lt({loading:n=!1,onCancel:t,onConfirm:s}){const{t:r}=re(),[o,l]=C.useState(Zs),[y,p]=C.useState(!0),h=(A,O)=>{O.checked=A.target.checked;const R=o.map(S=>({...S,checked:S.value===O.value?O.checked:S.checked}));l(R)},i=A=>{A.stopPropagation(),s({channels:o.filter(O=>O.checked).map(O=>O.value),isResendFailedOnly:y})};return e.jsxs(T,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ae,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(T,{className:"choose-channel",children:e.jsxs(Y,{component:"fieldset",variant:"standard",children:[e.jsx(gt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(A=>e.jsx(ge,{control:e.jsx(Ke,{checked:A.checked,onChange:O=>h(O,A),name:A.value}),label:A.label},A.value))})]})}),e.jsx(T,{className:"resend-config-footer",children:e.jsx(qe,{children:e.jsx(ge,{control:e.jsx(Ke,{checked:y,onChange:A=>p(A.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(T,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Le,{onClick:A=>{A.stopPropagation(),t()},color:"inherit",children:r("common.cancel")}),e.jsxs(Le,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(bt,{size:16}),r("common.confirm")]})]})]})}Kt.propTypes={notificationId:x.string.isRequired,handleResend:x.func,resending:x.bool};function Kt({notificationId:n,handleResend:t,resending:s=!1}){const{t:r,locale:o}=re(),l=jt(),y=C.useMemo(()=>vt(l,qt()),[l]),{getReceivers:p,inService:h,teamDid:i,getUser:A,blocklet:O}=tt(),[R,S]=C.useState(!1),[D,G]=C.useState([]),z=Te({anchorEl:null,position:null}),B=Te({anchorEl:null,position:null}),[_,M]=C.useState(null),[J,ie]=C.useState({total:0,pageSize:10,pageCount:0,page:1}),[c,g]=C.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),[j,N]=C.useState([]),E=[{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"}],P=async()=>{if(!R&&n)try{S(!0);const d=await p({notificationId:n,...c}),u=d.list.map(f=>({...f,receiverUser:{...f.receiverUser,avatar:Dt(f.receiverUser.avatar,i,h)}}));G(u),ie(d.paging),S(!1)}catch(d){K.error(d.message),S(!1)}};C.useEffect(()=>{P()},[c]);const a=d=>{d.stopPropagation();const u=d.currentTarget;B.anchorEl=u;const f=u.getBoundingClientRect();B.position={top:f.top+window.scrollY,left:f.left+window.scrollX}},m=d=>d.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(me,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:r("notification.resend")})}):null,$={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:J.page-1,rowsPerPage:J.pageSize,count:J.total,searchText:c.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:j,onRowSelectionChange:(d,u)=>{N(u.map(f=>f.dataIndex))},customToolbarSelect:m},U=({page:d,rowsPerPage:u,searchText:f,filterList:L})=>{const[,q=[],Z=[],X=[]]=L;c.pageSize!==u?g(H=>({...H,pageSize:u,page:1})):c.page!==d+1?g(H=>({...H,page:d+1})):c.searchText!==f?g(H=>({...H,searchText:f,page:1})):ye(q,c.walletSendStatus)?ye(Z,c.pushKitSendStatus)?ye(X,c.emailSendStatus)||g(H=>({...H,emailSendStatus:X,page:1})):g(H=>({...H,pushKitSendStatus:Z,page:1})):g(H=>({...H,walletSendStatus:q,page:1}))},oe=C.useCallback(async(d,u)=>{if(!u)return!1;const f=await A(u);return f?d==="wallet"?Ys(f):d==="email"?Hs(O,f):d==="pushKit"?Vs(O,f):d==="webhook"?Gs(f):!0:!1},[A,O]),le=C.useCallback(d=>Js(r,d),[r]),pe=()=>{z.anchorEl=null,z.position=null,M(null)},be=()=>{B.anchorEl=null,B.position=null},je=async(d,u,f=!0,L="")=>{if(!(!u.length||!d.length))try{t(d,u,f,L),B.anchorEl||(await Ee(.5),pe())}catch(q){console.error("handleResend error",{error:q})}},v=async({channels:d,isResendFailedOnly:u})=>{const f=j.map(L=>D[L].receiver);await je(d,f,u),await Ee(.5),be(),N([])},b=async(d,u=[],f=!0)=>{try{await je(["webhook"],[d.receiver],f,u)}catch(L){K.error(L.response?L.response.statusText:L.message)}},w=async(d,u,f,L=[],q=!0)=>{if(d.stopPropagation(),Xs(u,f)>=4){K.warning(r("notification.resendLimit"));return}if(!Ge.includes(f)){await b(u,L,q);return}if(d){const X=d.currentTarget,H=X.getBoundingClientRect();z.anchorEl=X,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}M({channel:f});try{const X=await oe(f,u.receiver);await Ee(1),M({channel:f,result:X}),(typeof X=="boolean"&&X||Zt(X)&&Object.values(X).every(H=>!!H))&&(await t([f],[u.receiver],q),B.anchorEl||(await Ee(.5),pe()))}catch(X){K.error(X.message)}},I=d=>{g(u=>({...u,dateRange:d,page:1}))},k=(d,u,f,L)=>{d.stopPropagation();const q=f.filter(Z=>Z!==u);g(Z=>({...Z,[L]:q,page:1}))},F=ce(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:d=>{const{receiverUser:u,receiver:f}=D[d];return u?e.jsxs(T,{"data-cy":`member-name-${u.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(Tt,{src:`${u.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:f,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Re,{children:u.fullName})]},f):e.jsx(vs,{size:14,responsive:!1,compact:!0,copyable:!1,did:f})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:c.walletSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Wallet",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[1].options.filterList,"walletSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Wallet",filterList:d,onChange:u,index:f,column:L,filterValues:E})},customBodyRenderLite:d=>{const{walletSendStatus:u,walletSendAt:f,walletSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"wallet",onResend:q=>w(q,D[d],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{pushKitSendStatus:u,pushKitSendAt:f,pushKitSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"pushkit",onResend:q=>w(q,D[d],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:c.pushKitSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Push Kit",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[2].options.filterList,"pushKitSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Push Kit",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{emailSendStatus:u,emailSendAt:f,emailSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"email",onResend:q=>w(q,D[d],"email",[],!1)})},filter:!0,filterType:"custom",filterList:c.emailSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Email",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[3].options.filterList,"emailSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Email",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{webhook:u}=D[d];if(!u)return null;const f=Object.entries(u)[0];if(!f)return null;const[L,q]=f,Z=q[0];return e.jsx(T,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(T,{className:"webhook-item",fontSize:12,children:[e.jsx(Re,{maxLength:30,children:L},L),e.jsx(ve,{status:Z.status,updatedAt:Z.sendAt,reason:Z.failedReason,channel:"webhook",onResend:X=>w(X,D[d],"webhook",[L],!1)})]},L)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:d=>{const{createdAt:u}=D[d];return e.jsx(Ot,{value:u,locale:o,shouldUpdate:!0})}}}],[D,o,c,r]),ne=[e.jsx(rt,{value:c.dateRange,onChange:I},"date-picker"),e.jsx(me,{variant:"contained",size:"small",color:"primary",loading:R,startIcon:e.jsx(Ft,{}),onClick:()=>P(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(T,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(tn,{children:e.jsxs(yt,{theme:y,children:[e.jsx(Rt,{className:"receivers-table",locale:o,loading:R,columns:F,data:D,onChange:U,options:$,customButtons:ne,components:{TableFilterList:d=>e.jsx(ot,{...d,itemComponent:u=>e.jsx(Pe,{...u,canDelete:()=>!1})})}}),z.anchorEl&&e.jsx(Me,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:pe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(sn,{children:[e.jsxs(ae,{variant:"body1",component:"div",className:"check-title",children:[_==null?void 0:_.channel," Checking"]}),e.jsx(T,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:le(_==null?void 0:_.channel).map(d=>{var q,Z;const{type:u,pass:f,fail:L}=d;return!(_!=null&&_.result)||(q=_==null?void 0:_.result)!=null&&q[u]?e.jsxs(ae,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(Z=_==null?void 0:_.result)!=null&&Z[u]?Ae.success.main:"inherit"},children:[_!=null&&_.result?e.jsx(_t,{}):e.jsx(bt,{size:12,sx:{color:Ae.primary.main}}),e.jsx("span",{children:f})]},u):e.jsxs(ae,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Ae.error.main},children:[e.jsx(kt,{}),e.jsx("span",{children:L})]},u)})})]})}),B.anchorEl&&e.jsx(Me,{open:!!B.anchorEl,anchorReference:"anchorPosition",anchorPosition:B.position,onClose:be,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(lt,{loading:s,onCancel:be,onConfirm:v})})]})})})}const en=C.memo(Kt),tn=ue.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }
@@ -0,0 +1,99 @@
1
+ import{r as C}from"./vendor-react-DEoibe3W.js";import{a as D,Y as R,j as ie,B as U,b4 as Ce,ao as de,bT as re,a0 as ke,aC as Te,bA as Ke,c9 as ve,b6 as Ae,a9 as we,a2 as Se}from"./vendor-ux-did-connect-2jRoUb28.js";import{d as De}from"./Edit-CUl1Rt8i.js";import{f as Ie}from"./index-8eXqqyHQ.js";import{U as pe,C as me,I as ue}from"./index-D1kTR2xk.js";import{r as xe}from"./passport-item-C5-ZuTPM.js";import{D as _,n as M,aM as Re,G as Be,f as $e}from"./index-DDoVX3je.js";import{u as N}from"./dashboard-xUr1SbPS.js";import{j as e,H as u,bo as O,br as G,bn as H,q as V,aa as y,al as Q,O as E,ab as _e,bs as Ne,bR as Pe,ah as P,T as $,ad as ce,ak as We}from"./vendor-mui-core-BV2FUxWJ.js";import{B as Le,W as qe}from"./vendor-arcblock-BlrkGjK9.js";import{T as ye}from"./index-BU2FTGFr.js";import{C as fe}from"./confirm-Vzr2I9eM.js";import{a0 as ze}from"./vendor-utils-rHXShPKm.js";import{C as F}from"./click-to-copy-R7MF4AwY.js";import{D as Ue}from"./delete-confirm-DNn4Os6R.js";import{P as Me}from"./permission-DSHe73ba.js";import{B as Ee}from"./bundle-avatar-D4fwror8.js";import{W as Fe}from"./did-address-Dq-4__HB.js";import{A as Oe}from"./actions-DP7pj6xB.js";import{u as Ge}from"./use-mobile-BAa0wi8o.js";import{T as le}from"./table-tips-BfSSGl9N.js";import{y as He}from"./vendor-hooks-BgUTpb6X.js";import"./lottie-web-jYmAQWuC.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./util-DMfPwzVN.js";import"./base32-WurN0cIW.js";import"./useLocalStorage-D6gvgmEW.js";import"./PlayArrow-CDOOUxMp.js";import"./get-safe-url-c4iAcpvA.js";import"./session-C_8V_o-O.js";import"./use-blocklet-logo-Bhkp-Zm7.js";import"./InfoOutlined-D3XnF0Vg.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./vendor-mui-x-Bo-XOtzq.js";import"./AdapterDayjs-CDDcwz3P.js";import"./MoreHoriz-DpKn_fkc.js";function Y({value:t}){const{t:s,locale:d}=D(),r=new Date;return new Date(t)<r?e.jsxs("span",{style:{color:"red"},children:[e.jsx(R,{value:t,locale:d}),`${s("setting.accessKey.expired",{time:""})}`]}):e.jsx(R,{value:t,locale:d,type:"all"})}Y.propTypes={value:u.string.isRequired};function J({value:t,onChange:s,...d}){const{t:r}=D(),p=C.useMemo(()=>[{value:"signature",title:r("setting.accessKey.signature"),description:r("setting.accessKey.signatureDesc")},{value:"simple",title:r("setting.accessKey.simple"),description:r("setting.accessKey.simpleDesc")}],[r]);return e.jsxs(O,{style:{width:"100%"},variant:"outlined",...d,children:[e.jsx(G,{children:r("setting.accessKey.authType")}),e.jsx(H,{value:t,onChange:s,fullWidth:!0,label:r("setting.accessKey.authType"),children:p.map(n=>e.jsx(V,{value:n.value,children:e.jsxs(y,{children:[e.jsx("span",{children:n.title}),e.jsx(y,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:n.description})]})},n.value))})]})}J.propTypes={value:u.string.isRequired,onChange:u.func.isRequired};const L=()=>{const t=ie.RBAC_CONFIG.roles.filter(p=>p.passport),{inService:s}=_(),{roles:d}=N(),r=[...t,...s?d:[]];return ze(r,"name").filter(p=>p.name!==ie.ROLES.OWNER)};function X(t){const{remark:s,onCreate:d}=t,{api:r}=_(),{teamDid:p}=N(),{t:n}=D(),[k,h]=C.useState(!1),[x,g]=C.useState(null),c=L(),b=()=>{h(!1),g(null)},A=async a=>{const{remark:w,passport:j,authType:i}=a;h(!0);const m=await r.createAccessKey({input:{teamDid:p,remark:w.trim(),passport:j,expireAt:a.expireAt?new Date(a.expireAt).getTime():null,authType:i}}),{data:S}=m;d(S),g(null),h(!1)},f={title:`${n("common.create")} ${n("accessKey")}`,description:(a,w,j)=>e.jsxs(Q,{gap:3,children:[e.jsx(E,{label:n("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:a.remark,onChange:i=>{w({...a,remark:i.target.value,__disableConfirm:!a.passport||!i.target.value.trim()}),i.target.value.trim()?j(""):j(n("setting.accessKey.remarkInvalid"))}}),e.jsxs(O,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:n("setting.accessKey.passport")}),e.jsx(H,{"data-cy":"create-access-key-select-passport",value:a.passport,onChange:i=>{const m=i.target.value;j(null),w({...a,passport:m,__disableConfirm:!a.remark||!m})},fullWidth:!0,label:n("setting.accessKey.passport"),disabled:k,children:c.map(i=>e.jsx(V,{value:i.name,"data-cy":`create-access-key-passport-option-${i.name}`,children:e.jsxs(y,{children:[e.jsx("span",{children:i.title||i.name}),e.jsx(y,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:i.description})]})},i.name))})]}),e.jsx(J,{value:a.authType,onChange:i=>{w({...a,authType:i.target.value})}}),e.jsx(ye,{placeholder:n("setting.accessKey.expireTime"),value:a.expireAt,onChange:i=>{w({...a,expireAt:i,__disableConfirm:!a.passport||!a.remark||!i})}})]}),confirm:n("common.confirm"),cancel:n("common.cancel"),color:"primary",params:{remark:s,authType:"signature",__disableConfirm:!s.trim()},onConfirm:A,onCancel:b};return e.jsxs(e.Fragment,{children:[e.jsxs(U,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>g(f),className:"rule-action",children:[k?e.jsx(_e,{size:16}):e.jsx(Le,{style:{fontSize:16}}),n("common.create")]}),x&&e.jsx(fe,{title:x.title,description:x.description,confirm:x.confirm,color:x.color,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}X.propTypes={remark:u.string,onCreate:u.func};X.defaultProps={onCreate:()=>{},remark:""};function Z(t){const{onConfirm:s,accessKeyId:d,accessKeySecret:r,hideSecret:p}=t,{t:n}=C.useContext(Ce),[k,h]=C.useState(!1),[x,g]=C.useState(()=>p),c=()=>{g(!x)},b=a=>{h(a.target.checked)},A=C.useMemo(()=>{var a;return p?`const Client = require('@abtnode/client');
2
+
3
+ const client = new Client(fullEndpoint);
4
+ client.setAuthAccessKey({
5
+ accessKeyId: "${d}",
6
+ accessKeySecret: "${r}",
7
+ });
8
+ `:`curl -H "Authorization: Bearer ${r}" "${(a=window.blocklet)==null?void 0:a.appUrl}/.well-known/service/api/did/session"`},[p,d,r]),f=C.useMemo(()=>{var a;return p?`blocklet deploy --endpoint ${(a=window.blocklet)==null?void 0:a.appUrl} --access-key ${d} --access-secret ${r} {blockletPath}/.blocklet/bundle;`:null},[p,d,r]);return e.jsxs(de,{title:n("common.createSuccess"),fullWidth:!0,open:!0,disableEscapeKeyDown:!0,onClose:s,showCloseButton:!1,actions:e.jsx("div",{children:e.jsx(U,{disabled:p?!k:!1,onClick:s,color:"primary",autoFocus:!0,variant:"contained","data-cy":"submit-confirm-dialog",children:n("common.confirm")})}),"aria-labelledby":"simple-dialog-title",children:[e.jsx("div",{children:e.jsx(Ve,{children:n(p?"setting.accessKey.saveSecretTip":"setting.accessKey.viewSecret")})}),e.jsx("div",{style:{marginTop:"20px"}}),e.jsxs(z,{children:[e.jsx(q,{children:n("setting.accessKey.accessKeyId")}),e.jsx(F,{children:d})]}),e.jsxs(z,{children:[e.jsx(q,{children:n("setting.accessKey.accessKeySecret")}),x?e.jsx(U,{"data-cy":"show-secret-btn",color:"primary",onClick:c,children:n("setting.accessKey.showSecret")}):e.jsx(F,{children:r})]}),!x&&e.jsxs(z,{children:[e.jsx(q,{children:`Access Key ${n("setting.accessKey.usage")}`}),e.jsx(re,{code:A,language:"javascript"}),f&&e.jsx(re,{code:f,language:"bash"})]}),p&&e.jsx("div",{children:e.jsx(Ne,{value:"end",disabled:x,control:e.jsx(Pe,{checked:k,onChange:b}),label:n("setting.accessKey.iKnow"),labelPlacement:"end"})})]})}Z.propTypes={accessKeyId:u.string.isRequired,accessKeySecret:u.string.isRequired,onConfirm:u.func,hideSecret:u.bool};Z.defaultProps={onConfirm:()=>{},hideSecret:!0};const q=P.div`
9
+ display: flex;
10
+ justify-content: space-between;
11
+ align-items: center;
12
+ font-size: 16px;
13
+ margin-bottom: 8px;
14
+ `,z=P.div`
15
+ margin-bottom: 24px;
16
+ `,Ve=P.div`
17
+ font-size: 16px;
18
+ font-weight: bold;
19
+ `;function ee(t){const{t:s,locale:d}=D(),{api:r}=_(),{teamDid:p}=N(),{accessKeyId:n,time:k,remark:h,onDelete:x=()=>{},onClose:g=()=>{}}=t,c=()=>{g()},b=async()=>{try{await r.deleteAccessKey({input:{teamDid:p,accessKeyId:n}}),x()}catch(a){ke.error(a==null?void 0:a.message)}finally{c()}},A=a=>({key:`<b>${n}</b>`,name:`<b>${h}</b>`,time:M(a,d),timeAge:qe(new Date(a),Re(d))}),f={keyName:h,title:s("setting.accessKey.title"),description:k?`${s("setting.accessKey.description",A(k))}`:`${s("setting.accessKey.descriptionNoTime",{key:`<b>${n}</b>`,name:`<b>${h}</b>`})}`,confirmPlaceholder:s("setting.accessKey.confirm_desc",{name:h}),confirm:s("common.delConfirm"),cancel:s("common.cancel"),onConfirm:b,onCancel:c};return e.jsx(Ue,{keyName:f.keyName,title:f.title,description:f.description,confirmPlaceholder:f.confirmPlaceholder,confirm:f.confirm,cancel:f.cancel,params:f.params,onConfirm:f.onConfirm,onCancel:f.onCancel})}ee.propTypes={accessKeyId:u.string.isRequired,time:u.string.isRequired,remark:u.string.isRequired,onDelete:u.func,onClose:u.func};ee.defaultProps={onDelete:()=>{},onClose:()=>{}};function te(t){const{accessKeyId:s,remark:d,onUpdate:r,passport:p,expireAt:n,authType:k,onClose:h}=t,{api:x}=_(),{teamDid:g}=N(),{t:c}=D(),[b,A]=C.useState(!1),f=L(),a=()=>{A(!1),h()},w=async i=>{const{accessKeyId:m,remark:S="",passport:l,expireAt:I,authType:W}=i;A(!0),await x.updateAccessKey({input:{teamDid:g,accessKeyId:m,remark:S.trim(),passport:l,expireAt:I?new Date(I).getTime():null,authType:W}}),r(),a()},j={title:`${c("common.update")} ${c("accessKey")}`,description:(i,m,S)=>e.jsxs(Q,{gap:3,children:[e.jsx(E,{label:c("setting.accessKey.accessKeyId"),autoComplete:"off",variant:"outlined",name:"accessKeyId",fullWidth:!0,autoFocus:!0,margin:"dense",value:i.accessKeyId,disabled:!0}),e.jsx(E,{label:c("common.remark"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,value:i.remark,onChange:l=>{m({...i,remark:l.target.value,__disableConfirm:!l.target.value.trim()}),l.target.value.trim()?S(""):S(c("setting.accessKey.remarkInvalid"))}}),e.jsxs(O,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:c("setting.accessKey.passport")}),e.jsx(H,{"data-cy":"update-access-key-select-passport",value:i.passport,onChange:l=>{const I=l.target.value;S(null),m({...i,passport:I,__disableConfirm:!i.remark||!I})},fullWidth:!0,label:c("setting.accessKey.passport"),disabled:b,children:f.map(l=>e.jsx(V,{value:l.name,"data-cy":`update-access-key-passport-option-${l.name}`,children:e.jsxs(y,{children:[e.jsx("span",{children:l.title||l.name}),e.jsx(y,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:l.description})]})},l.name))})]}),e.jsx(J,{disabled:!0,value:i.authType,onChange:l=>{m({...i,authType:l.target.value})}}),e.jsx(ye,{placeholder:c("setting.accessKey.expireTime"),value:i.expireAt,onChange:l=>{m({...i,expireAt:l,__disableConfirm:!i.passport||!i.remark||!l})}})]}),confirm:c("common.confirm"),cancel:c("common.cancel"),color:"primary",params:{accessKeyId:s,remark:d,passport:p,expireAt:n,authType:k},onConfirm:w,onCancel:a};return e.jsx(fe,{title:j.title,description:j.description,confirm:j.confirm,color:j.color,cancel:j.cancel,params:j.params,onConfirm:j.onConfirm,onCancel:j.onCancel})}te.propTypes={accessKeyId:u.string.isRequired,remark:u.string,passport:u.string,expireAt:u.string,authType:u.string,onUpdate:u.func,onClose:u.func};te.defaultProps={onUpdate:()=>{},remark:"",passport:"",expireAt:"",authType:"signature",onClose:()=>{}};function se({accessKey:t,onCancel:s}){const{t:d}=D();return e.jsx(de,{title:d("accessKey"),onClose:s,open:!0,PaperProps:{style:{maxWidth:800}},fullWidth:!0,children:e.jsx(Qe,{children:e.jsx(he,{accessKey:t})})})}se.propTypes={accessKey:u.object.isRequired,onCancel:u.func.isRequired};se.defaultProps={};const Qe=P(y)`
20
+ margin-top: -16px;
21
+
22
+ .tabs {
23
+ margin-left: 0;
24
+ margin-right: 0;
25
+ }
26
+ `;function he({accessKey:t}){var g;const{t:s,locale:d}=D(),{blocklet:r}=Be(),p=L(),n=((r==null?void 0:r.children)||[]).find(c=>{var b;return((b=c==null?void 0:c.meta)==null?void 0:b.did)===t.componentDid}),k=p.find(c=>c.name===t.passport),h=k?k.title:t.passport,x=[{title:s("common.baseInfo"),items:[{label:s("setting.accessKey.accessKeyId"),content:e.jsx(Fe,{did:t.accessKeyId,showQrcode:!0})},...t.authType==="simple"?[{label:s("setting.accessKey.accessKeySecret"),content:e.jsx(F,{children:`blocklet-${Te.toBase58(t.accessKeyPublic)}`})}]:[],{label:s("common.role"),content:e.jsx(y,{children:xe(h,t.passport)})},{label:s("common.createdVia"),content:t.createdVia},{label:s("common.createdBy"),content:t.createdBy?e.jsx(pe,{showDid:!0,did:t.createdBy,cardType:me.Detailed,infoType:ue.Minimal,sx:{border:0,padding:0}}):"-"}]},{title:s("common.timeInfo"),items:[{label:s("common.createdAt"),content:t.createdAt?e.jsx(R,{value:t.createdAt,type:"all",locale:d}):"-"},{label:s("common.lastUsedAt"),content:t.lastUsedAt?e.jsx(R,{value:t.lastUsedAt,type:"all",locale:d}):"-"},{label:s("common.expiredAt"),content:t.expireAt?e.jsx(Y,{value:t.expireAt}):s("common.neverExpired")}]},{title:s("common.otherInfo"),items:[{label:s("setting.accessKey.authType"),content:t.authType},{label:s("common.remark"),content:t.remark},...t.authType!=="signature"?[{label:s("setting.accessKey.resourceType"),content:t.resourceType||"-"},{label:s("setting.accessKey.resourceId"),content:t.resourceId||"-"}]:[],...n?[{label:s("setting.accessKey.component"),content:e.jsxs(y,{width:{xs:250,sm:400},display:"flex",alignItems:"center",children:[e.jsx(Ee,{blocklet:n,ancestors:[r]}),e.jsx(y,{ml:"16px",sx:{minWidth:0},children:e.jsxs(y,{className:"component-header",children:[e.jsx(y,{className:"component-name",children:$e.getDisplayName(n,!0)}),e.jsx(y,{className:"component-version",children:(g=n==null?void 0:n.meta)==null?void 0:g.version})]})})]},n)}]:[]]}];return e.jsx(Ye,{gap:3,children:e.jsx(y,{className:"info-area",children:x.map(c=>e.jsxs(y,{mb:3,children:[e.jsx($,{variant:"h6",sx:{mb:1.5},children:c.title}),e.jsx(y,{className:"info-grid",children:c.items.map(b=>e.jsxs(y,{className:"info-item",children:[e.jsx(y,{className:"info-label",children:e.jsx($,{variant:"subtitle2",color:"textSecondary",children:b.label})}),e.jsx(y,{children:b.content})]},b.label))})]},c.title))})})}he.propTypes={accessKey:u.object.isRequired};const Ye=P(Q)`
27
+ .info-card {
28
+ margin-bottom: 24px;
29
+ overflow: hidden;
30
+ }
31
+
32
+ .card-content {
33
+ display: flex;
34
+ gap: 32px;
35
+ padding: 24px;
36
+ }
37
+
38
+ .passport-image {
39
+ width: 150px;
40
+ flex-shrink: 0;
41
+ transition: transform 0.2s ease-in-out;
42
+ cursor: pointer;
43
+
44
+ &:hover {
45
+ transform: scale(1.05);
46
+ }
47
+ }
48
+
49
+ .info-area {
50
+ flex: 1;
51
+ display: flex;
52
+ flex-direction: column;
53
+ }
54
+
55
+ .info-header {
56
+ padding-bottom: 16px;
57
+ border-bottom: 1px solid #eee;
58
+ }
59
+
60
+ .info-grid {
61
+ display: flex;
62
+ flex-direction: column;
63
+ gap: 12px;
64
+ }
65
+
66
+ .info-item {
67
+ display: flex;
68
+ gap: 8px;
69
+ }
70
+
71
+ .info-label {
72
+ display: flex;
73
+ align-items: center;
74
+ gap: 8px;
75
+ width: 140px;
76
+ }
77
+
78
+ .logs-card {
79
+ .card-header {
80
+ display: flex;
81
+ align-items: center;
82
+ gap: 8px;
83
+ padding: 16px 24px;
84
+ border-bottom: 1px solid #eee;
85
+ }
86
+
87
+ .MuiTimeline-root {
88
+ padding: 24px;
89
+ }
90
+
91
+ .MuiTimelineContent-root {
92
+ padding: 0px 16px;
93
+ }
94
+
95
+ .MuiTimelineDot-root {
96
+ margin: 0;
97
+ }
98
+ }
99
+ `;function qt(){var oe,ae;const{t,locale:s}=D(),{api:d,inService:r}=_(),{teamDid:p}=N(),[n,k]=C.useState({}),[h,x]=C.useState(null),[g,c]=C.useState(null),[b,A]=C.useState(null),f=Ge(),a=L(),w=C.useRef(null),j=`access-keys-${p}`,i=Ke(j),[m,S]=C.useState({searchText:i.searchText||"",pageSize:i.rowsPerPage||10,page:1}),l=He(async()=>await d.getAccessKeys({input:{teamDid:p,paging:{page:m.page,pageSize:m.pageSize}}}),[m.page,m.pageSize]),{loading:I,error:W}=l,B=C.useMemo(()=>{var o;return((o=l.value)==null?void 0:o.list)||[]},[(oe=l.value)==null?void 0:oe.list]),ge=C.useMemo(()=>[{label:t("common.name"),name:"remark",options:{customBodyRender:(o,{rowIndex:K})=>{const v=B[K];return e.jsx(y,{display:"flex",alignItems:"center",gap:2,children:e.jsx($,{children:v.remark||"N/A"})})}}},{label:"Access Key ID",name:"accessKeyId",options:{customBodyRender:o=>e.jsx(ve,{showDidLogo:!1,children:o})}},{label:t("common.role"),name:"passport",options:{customBodyRender:o=>{const K=a.find(T=>T.name===o),v=K?K.title:o;return e.jsx(y,{children:xe(v,o)})}}},{label:t("common.createdVia"),name:"createdVia",options:{customBodyRender:o=>e.jsx($,{children:o})}},{label:t("setting.accessKey.authType"),name:"authType",options:{customBodyRender:o=>e.jsx($,{children:t(`setting.accessKey.${o}`)})}},{label:t("common.createdAt"),name:"createdAt",options:{customBodyRender:o=>e.jsx(ce,{title:M(o,s),children:o?e.jsx(R,{value:o,locale:s}):"-"})}},{label:t("common.lastUsedAt"),name:"lastUsedAt",options:{customBodyRender:o=>e.jsx(ce,{title:M(o,s),children:o?e.jsx(R,{value:o,locale:s}):"-"})}},{label:t("common.expiredAt"),name:"expireAt",options:{customBodyRender:o=>o?e.jsx(Y,{value:o}):t("common.neverExpired")}},{label:t("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:o=>o?e.jsx(pe,{showDid:!0,did:o,cardType:me.Detailed,infoType:ue.Minimal,sx:{border:0,padding:0}}):"-"}},{label:t("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(o,{rowIndex:K})=>{const v=B[K];return e.jsx(Oe,{"data-cy":"access-key-actions",actions:[{icon:e.jsx(De,{}),text:t("common.edit"),onClick:T=>{T.stopPropagation(),A(v)}},{icon:e.jsx(Ae,{}),text:t("common.delete"),onClick:T=>{T.stopPropagation(),c(v)}}]})}}}],[B,s,t,a,c,A]),be=({page:o,rowsPerPage:K,searchText:v})=>{m.pageSize!==K?S(T=>({...T,searchText:"",pageSize:K,page:1})):m.page!==o+1?S(T=>({...T,searchText:"",page:o+1})):m.searchText!==v&&S(T=>({...T,searchText:v,page:1}))},ne=m.searchText?B.filter(o=>o.accessKeyId.toLowerCase().includes(m.searchText.toLowerCase())||(o.remark||"").toLowerCase().includes(m.searchText.toLowerCase())):B;return W?e.jsx(We,{severity:"error",children:Ie(W)}):e.jsxs(y,{ref:w,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[f?e.jsx(le,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}):null,e.jsx(we,{durable:j,durableKeys:["page","rowsPerPage"],data:ne,columns:ge,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:m.page-1,rowsPerPage:m.pageSize,count:((ae=l.value)==null?void 0:ae.count)||0,searchDebounceTime:600,onRowClick(o,{dataIndex:K},v){var T;if((T=w.current)!=null&&T.contains(v.target)){const je=ne[K];x(je)}}},loading:I,onChange:be,title:f?null:e.jsx(le,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}),customButtons:[e.jsx(Me,{permission:r?"":"mutate_accessKey",children:e.jsx(X,{onCreate:o=>{const{accessKeyId:K,accessKeySecret:v,authType:T}=o;k({show:!0,accessKeyId:K,accessKeySecret:v,authType:T})}})})],emptyNode:e.jsx(Se,{children:t("oauth.client.empty")})}),n.show&&e.jsx(Z,{hideSecret:n.authType==="signature",onConfirm:()=>{l.retry(),k({show:!1})},...n}),h&&e.jsx(se,{onCancel:()=>x(null),accessKey:h}),g&&e.jsx(ee,{accessKeyId:g.accessKeyId,time:g.lastUsedAt,remark:g.remark||"N/A",onDelete:l.retry,onClose:()=>c(null)}),b&&e.jsx(te,{...b,onUpdate:l.retry,onClose:()=>A(null)})]})}export{qt as default};