@abtnode/blocklet-services 1.16.49-beta-20250819-084933-3bcbd851 → 1.16.49-beta-20250822-070545-6d3344cc

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 (245) hide show
  1. package/api/libs/connect/session.js +4 -4
  2. package/api/routes/env.js +0 -1
  3. package/api/services/analytics/index.js +8 -5
  4. package/api/services/auth/connect/connect-to-did-spaces-for-user.js +5 -5
  5. package/api/services/auth/connect/migrate-app-to-struct-v2.js +1 -1
  6. package/api/state/profile.js +1 -1
  7. package/api/util/blocklet-utils.js +2 -2
  8. package/dist/assets/{AdapterDayjs-DQyL5DVQ.js → AdapterDayjs-VDBijwaM.js} +1 -1
  9. package/dist/assets/{Google-C3EYOLRU.js → Google-Sm1AunGv.js} +1 -1
  10. package/dist/assets/{access-control-CuUB1GoU.js → access-control-VF0jIUag.js} +1 -1
  11. package/dist/assets/{actions-DnpJX6lQ.js → actions-Bf4UKTeu.js} +1 -1
  12. package/dist/assets/{add-component-core-JXDWXmkX.js → add-component-core-DPxKUwJB.js} +7 -7
  13. package/dist/assets/add-resource-DuOqQFR-.js +1 -0
  14. package/dist/assets/{addon-D99FdIJX.js → addon-CosTdlat.js} +1 -1
  15. package/dist/assets/{advanced-CGlqr3Vl.js → advanced-B9TR0x_M.js} +2 -2
  16. package/dist/assets/{aigne-DceTN7Rt.js → aigne-C7JPp9u1.js} +1 -1
  17. package/dist/assets/api-IUmhrtIY.js +1 -0
  18. package/dist/assets/{appearance-fnwZybsp.js → appearance-Byekpih2.js} +1 -1
  19. package/dist/assets/{ar-B5ZCU4Ws.js → ar-fE5SSTrt.js} +1 -1
  20. package/dist/assets/{arrow-down.svg-BcoTeNyX.js → arrow-down.svg-lBR1lfm2.js} +1 -1
  21. package/dist/assets/{audit-logs-Dzq32Y_L.js → audit-logs-BTyQcfWp.js} +2 -2
  22. package/dist/assets/authorize-BbCQomqp.js +1 -0
  23. package/dist/assets/{base-chart-CBzZ3RX9.js → base-chart-DZz4r8-E.js} +1 -1
  24. package/dist/assets/base32-D7JDMggs.js +1 -0
  25. package/dist/assets/bind-account-B-fdpRuH.js +1 -0
  26. package/dist/assets/{branding-BgclUoWJ.js → branding-Bp4tsvug.js} +5 -5
  27. package/dist/assets/branding-CXO5C9Lb.js +1 -0
  28. package/dist/assets/{branding-g04aJopG.js → branding-DKOBu_eV.js} +2 -2
  29. package/dist/assets/{bundle-avatar-VT8FLC3N.js → bundle-avatar-FLzOZWlh.js} +1 -1
  30. package/dist/assets/button-DEDR-8Tu.js +1 -0
  31. package/dist/assets/{click-to-copy-LMYjlbUz.js → click-to-copy-CVpUD4ji.js} +1 -1
  32. package/dist/assets/{cloneDeep-KmDjD-jP.js → cloneDeep-DqaMBldf.js} +1 -1
  33. package/dist/assets/{collapse-XWrflTSv.js → collapse-C-BNkgS6.js} +1 -1
  34. package/dist/assets/{complete-BnL-RLHX.js → complete-CnjLDP7N.js} +2 -2
  35. package/dist/assets/{component-B20Ffd5t.js → component-Dogt0tzj.js} +3 -3
  36. package/dist/assets/{config-DRsQLuMp.js → config-B5Y8LOpp.js} +3 -3
  37. package/dist/assets/{config-BV0yp1Ym.js → config-BxiVjVAu.js} +1 -1
  38. package/dist/assets/{config-CJHA8pSh.js → config-gL555Qh4.js} +2 -2
  39. package/dist/assets/{config-navigation-CR3DV4xf.js → config-navigation-CveewaP3.js} +11 -11
  40. package/dist/assets/{config-space-BzTYceTE.js → config-space-h6V3UKMc.js} +1 -1
  41. package/dist/assets/confirm-C9tgdTJT.js +7 -0
  42. package/dist/assets/{connect-Dvl9nMFJ.js → connect-CYT-S8fi.js} +1 -1
  43. package/dist/assets/{connect-BaSUwW0G.js → connect-Cx2VNYgu.js} +1 -1
  44. package/dist/assets/connect-to-DiEQlFbF.js +1 -0
  45. package/dist/assets/{content-layout-yAb710pQ.js → content-layout-DoBqUAz1.js} +1 -1
  46. package/dist/assets/createClass-D9kGlylC.js +1 -0
  47. package/dist/assets/{dashboard-CuNuXf3l.js → dashboard-D1d9MQbs.js} +6 -6
  48. package/dist/assets/{de-Bt2QRaGQ.js → de-Byq6SyWJ.js} +1 -1
  49. package/dist/assets/{delete-confirm-DTjAa9xG.js → delete-confirm-XVeEePxy.js} +1 -1
  50. package/dist/assets/{did-address-CY4nLJqm.js → did-address-CcsL3-Qm.js} +1 -1
  51. package/dist/assets/{domain-C8-oT2Wp.js → domain-CV6OAKYE.js} +1 -1
  52. package/dist/assets/domain-action-card-BXYZu_pS.js +28 -0
  53. package/dist/assets/domains-DrF1lJas.js +1 -0
  54. package/dist/assets/{email-BXcDoVMA.js → email-CniDyVLQ.js} +3 -3
  55. package/dist/assets/{empty-spinner-CvzdEO93.js → empty-spinner-BMVhld2Z.js} +1 -1
  56. package/dist/assets/engine-hsJUTQxh.js +1 -0
  57. package/dist/assets/{es-RcHRYKIM.js → es-Q8J1CCMS.js} +1 -1
  58. package/dist/assets/{exchange-passport-BJ2cvp1M.js → exchange-passport-BnNDAYeY.js} +1 -1
  59. package/dist/assets/{form-Df41zlMi.js → form-BndJ7ZnS.js} +2 -2
  60. package/dist/assets/{form-text-input-DHhw6HI1.js → form-text-input-DJPCEDjA.js} +1 -1
  61. package/dist/assets/{form-wrapper-DihET07L.js → form-wrapper-CHYdE4By.js} +1 -1
  62. package/dist/assets/{fr-CQKeqjRX.js → fr-8njRrvuV.js} +1 -1
  63. package/dist/assets/{fuel-D_lR2dCI.js → fuel-BTh7B67H.js} +1 -1
  64. package/dist/assets/gen-access-key-CbaepD9-.js +1 -0
  65. package/dist/assets/gen-simple-access-key-mJK0zx1B.js +1 -0
  66. package/dist/assets/get-safe-url-Bpq2IOGY.js +1 -0
  67. package/dist/assets/hdkey-BpKJbkt5.js +62 -0
  68. package/dist/assets/hi-JUTdfcRr.js +5 -0
  69. package/dist/assets/{home-YcebrtVr.js → home-BwLLSjzW.js} +1 -1
  70. package/dist/assets/{id-B2v2gNB3.js → id-CrtgRPeX.js} +1 -1
  71. package/dist/assets/iframe-CbjzikLk.js +1 -0
  72. package/dist/assets/index-0VNYJQln.js +271 -0
  73. package/dist/assets/{index-COzISRvj.js → index-B5t6TkeL.js} +9 -9
  74. package/dist/assets/{index-Pzk7QDI_.js → index-B9sHaKla.js} +1 -1
  75. package/dist/assets/{index-I45i29I1.js → index-BFQdM_lT.js} +1 -1
  76. package/dist/assets/index-BH6jQqKY.js +55 -0
  77. package/dist/assets/{index-C2CNlq3a.js → index-BIfpX-Mq.js} +1 -1
  78. package/dist/assets/index-BKiTWpo1.js +6 -0
  79. package/dist/assets/{index-DtDUB9t6.js → index-BY2dcTa4.js} +1 -1
  80. package/dist/assets/{index-yRvJst1p.js → index-Bk02VaQE.js} +10 -10
  81. package/dist/assets/index-BtHQU9Nx.js +30 -0
  82. package/dist/assets/{index-BbOvyzfE.js → index-BtkFo6d6.js} +1 -1
  83. package/dist/assets/{index-BusluHY3.js → index-BxU3q403.js} +12 -12
  84. package/dist/assets/{index-CV12n3b0.js → index-Bzij4iIk.js} +1 -1
  85. package/dist/assets/{index-DYgvuymH.js → index-C-DpXzH8.js} +1 -1
  86. package/dist/assets/index-C4e0bu4c.js +124 -0
  87. package/dist/assets/{index-Bx4IaUHc.js → index-Ca4b_pCt.js} +6 -6
  88. package/dist/assets/{index-Bv7qQ-8a.js → index-Cd2DJL-w.js} +1 -1
  89. package/dist/assets/index-CjfYhb8W.js +1 -0
  90. package/dist/assets/index-CuQBOJqN.js +1022 -0
  91. package/dist/assets/index-DEu06Btv.js +1 -0
  92. package/dist/assets/index-DQmcrxe_.js +1 -0
  93. package/dist/assets/{index-DHaiY3PI.js → index-DT3k66ox.js} +1 -1
  94. package/dist/assets/{index-BNm1HXpF.js → index-DzSOofQf.js} +11 -11
  95. package/dist/assets/{index-CX5AEYFR.js → index-DzqNo2lD.js} +1 -1
  96. package/dist/assets/index-JixySlIT.js +7 -0
  97. package/dist/assets/{index-DeQPqRmy.js → index-SbRD4xbu.js} +2 -2
  98. package/dist/assets/{index-D4wH7CER.js → index-ew1if2W6.js} +6 -6
  99. package/dist/assets/index-hXRVhE3g.js +113 -0
  100. package/dist/assets/{index-DQ3_Wuxe.js → index-pAv7g5o_.js} +1 -1
  101. package/dist/assets/{index-Q_U4JZ73.js → index-yi4PlkyH.js} +1 -1
  102. package/dist/assets/{invitation-Cic0zA9s.js → invitation-CsvJMPo7.js} +3 -3
  103. package/dist/assets/{invite-EVcEzrIF.js → invite-DEEX5t_7.js} +1 -1
  104. package/dist/assets/{isURL-BZcSl4qG.js → isURL-Cuto2_sB.js} +2 -2
  105. package/dist/assets/{issue-passport-B3O3mNxG.js → issue-passport-BuT9-mlQ.js} +1 -1
  106. package/dist/assets/{item-BJ_EimT6.js → item-CEYjCEHD.js} +1 -1
  107. package/dist/assets/{ja-BweNHYYv.js → ja-BDFhRccP.js} +1 -1
  108. package/dist/assets/{ko-BrUV9qyv.js → ko-Dde62QRb.js} +1 -1
  109. package/dist/assets/landing-page-CbZO5p-X.js +1 -0
  110. package/dist/assets/{launch-result-message-CFuQ3Maq.js → launch-result-message-BhJWVXUs.js} +1 -1
  111. package/dist/assets/{layout-DTue3JyF.js → layout-BOMMbsdq.js} +1 -1
  112. package/dist/assets/list-CIIZmkmF.js +4 -0
  113. package/dist/assets/list-CcfeNfGu.js +103 -0
  114. package/dist/assets/{list-header-bAafK8zK.js → list-header-BQx81X9X.js} +1 -1
  115. package/dist/assets/localization-DNJagVoT.js +1 -0
  116. package/dist/assets/{log-DiR01oV7.js → log-CHaoSWXc.js} +1 -1
  117. package/dist/assets/logger-yrkSQn8c.js +1 -0
  118. package/dist/assets/login-C0FSm4ep.js +1 -0
  119. package/dist/assets/{login-oauth-callback-D2Bc3xAH.js → login-oauth-callback-DJxlMwXZ.js} +1 -1
  120. package/dist/assets/{logo-uploader-BayOewpo.js → logo-uploader-C0ihL7E6.js} +2 -2
  121. package/dist/assets/{lost-passport-flvvhlNS.js → lost-passport-BoAvHfI_.js} +2 -2
  122. package/dist/assets/{observability-DUV9CYIA.js → observability-F2NkCkza.js} +1 -1
  123. package/dist/assets/{omit-DdJriebF.js → omit-BM-5z5qE.js} +1 -1
  124. package/dist/assets/{open-window-Cj2XU2ZE.js → open-window-BNY_OfK6.js} +1 -1
  125. package/dist/assets/{over-due-invoice-payment-DveCusKe.js → over-due-invoice-payment-DXbfRbJ6.js} +1 -1
  126. package/dist/assets/{overview-BCygf-5_.js → overview-DpF1loGs.js} +2 -2
  127. package/dist/assets/{page-header-BtdOLX8d.js → page-header-CSMnIoYZ.js} +1 -1
  128. package/dist/assets/passport-item-VXkf3FVk.js +1 -0
  129. package/dist/assets/{permission-BPBzp1tm.js → permission-DeQz9qFD.js} +1 -1
  130. package/dist/assets/{playground-Doy13-fN.js → playground-CTvnZW2L.js} +1 -1
  131. package/dist/assets/preferences-C7TivEto.js +1 -0
  132. package/dist/assets/profile-embed-Dzt59MHT.js +1 -0
  133. package/dist/assets/pt-C4nfuExm.js +5 -0
  134. package/dist/assets/publish-resource-BSY6p0as.js +1 -0
  135. package/dist/assets/{react-beautiful-dnd.esm-DR1a-vn2.js → react-beautiful-dnd.esm-CYy644iX.js} +1 -1
  136. package/dist/assets/{react-stripe.esm-DJ2wjb7C.js → react-stripe.esm-CLg1-THR.js} +1 -1
  137. package/dist/assets/{required-2qxcR9JF.js → required-CobBjKC9.js} +1 -1
  138. package/dist/assets/ru-B4GtNlEa.js +5 -0
  139. package/dist/assets/runtime-B01d8fEk.js +1 -0
  140. package/dist/assets/{sanitize-t-NsAK4g.js → sanitize-NVxeYIWy.js} +1 -1
  141. package/dist/assets/sdk-ZTxfQBV1.js +1 -0
  142. package/dist/assets/{section-D4T7FV6C.js → section-Dq8SB7lh.js} +1 -1
  143. package/dist/assets/{security-BAcM8QUq.js → security-sVehajDA.js} +3 -3
  144. package/dist/assets/session-Bk6ebojT.js +1 -0
  145. package/dist/assets/{setup-Cs_D4O1K.js → setup-B9yaqoQM.js} +1 -1
  146. package/dist/assets/{shorten-label-BfHH-3ih.js → shorten-label-BHlFrl9P.js} +1 -1
  147. package/dist/assets/{simple-select-DIgPQFb4.js → simple-select-rm53gQ69.js} +1 -1
  148. package/dist/assets/{spaces-CU7Gi53i.js → spaces-HwfT17d7.js} +1 -1
  149. package/dist/assets/{start-Ds4Of13F.js → start-4J_Dh_zH.js} +1 -1
  150. package/dist/assets/{starting-progress-BTMrLOch.js → starting-progress-mgdXXqlr.js} +1 -1
  151. package/dist/assets/status-B1AV3yPH.js +1 -0
  152. package/dist/assets/{step-actions-DDyCXELh.js → step-actions-YjxSTbIE.js} +1 -1
  153. package/dist/assets/{studio-CYLOXolI.js → studio-Cx6j_6QU.js} +1 -1
  154. package/dist/assets/{switch-control-CAUrltdD.js → switch-control-BR8H_fdm.js} +1 -1
  155. package/dist/assets/{table-tips-BNjmTVFL.js → table-tips-BP283GGZ.js} +1 -1
  156. package/dist/assets/team-Dl23XmaY.js +146 -0
  157. package/dist/assets/th-BkShd6jD.js +5 -0
  158. package/dist/assets/traffic-O-wVx65-.js +1 -0
  159. package/dist/assets/{transfer-2ba_g--R.js → transfer-gEq9B27K.js} +1 -1
  160. package/dist/assets/{unsubscribe-B0KWDak0.js → unsubscribe-vpGsla5T.js} +1 -1
  161. package/dist/assets/{use-app-logo-pyV6ZPrc.js → use-app-logo-7cjs_pn8.js} +1 -1
  162. package/dist/assets/{use-mobile-BcHeqFSk.js → use-mobile-C_DcJ5SZ.js} +1 -1
  163. package/dist/assets/{use-mobile-BmKySh5X.js → use-mobile-DM4d_PLd.js} +1 -1
  164. package/dist/assets/{use-server-logo-CFQEMdB-.js → use-server-logo-Cxah39TH.js} +1 -1
  165. package/dist/assets/{use-window-close-PwuafSt8.js → use-window-close-DpgRKaaP.js} +1 -1
  166. package/dist/assets/{useAsync-BrjQTmBf.js → useAsync-BrMo9m7W.js} +1 -1
  167. package/dist/assets/{useAsync-C0iFIKqR.js → useAsync-CsYRBczg.js} +1 -1
  168. package/dist/assets/{useAsyncRetry-BmdG-NgH.js → useAsyncRetry-D4-sRZN-.js} +1 -1
  169. package/dist/assets/useLocalStorage-DqhgzGNT.js +1 -0
  170. package/dist/assets/user-center-DtJ32yjF.js +126 -0
  171. package/dist/assets/user-sessions-CFxn5EHL.js +1 -0
  172. package/dist/assets/{util-Dceeaiqy.js → util-Ca2jlZN4.js} +1 -1
  173. package/dist/assets/{util-BW0qhGTg.js → util-o8U4JIlX.js} +1 -1
  174. package/dist/assets/{vendor-arcblock-D_Dm09bZ.js → vendor-arcblock-B7AoUs4o.js} +139 -138
  175. package/dist/assets/{vendor-hooks-9cd36rYd.js → vendor-hooks-BRXKH6Nb.js} +1 -1
  176. package/dist/assets/{vendor-mui-core-DV92LEhm.js → vendor-mui-core-B7zoO8f5.js} +1 -1
  177. package/dist/assets/{vendor-mui-x-8McV6Pkb.js → vendor-mui-x-Qph0dQcg.js} +1 -1
  178. package/dist/assets/vendor-utils-DtY42AM-.js +213 -0
  179. package/dist/assets/{vendor-ux-C9Q7otQi.js → vendor-ux-B7q8W4Pg.js} +11 -11
  180. package/dist/assets/vi-C1PSP5SP.js +5 -0
  181. package/dist/assets/{wait-connect-CZLL86-A.js → wait-connect-DPAxcgcf.js} +1 -1
  182. package/dist/assets/{wizard-B45wL4-0.js → wizard-072KuoFQ.js} +1 -1
  183. package/dist/assets/{wizard-components-DtebwiYw.js → wizard-components-Dx5C9E35.js} +3 -3
  184. package/dist/assets/wrap-locale-BQM6_LkP.js +1 -0
  185. package/dist/assets/{zh-DBSThusI.js → zh-C_fDhC3R.js} +1 -1
  186. package/dist/assets/{zh-BaEjqGHy.js → zh-gAK37O_Y.js} +2 -2
  187. package/dist/assets/{zh-tw-xcyHbP3V.js → zh-tw-BGfyObps.js} +2 -2
  188. package/dist/index.html +6 -6
  189. package/dist/service-worker.js +1 -1
  190. package/package.json +33 -33
  191. package/dist/assets/add-resource-DfcJCfFx.js +0 -1
  192. package/dist/assets/api-ZbpPN5Q9.js +0 -1
  193. package/dist/assets/authorize-Cp-IEkvY.js +0 -1
  194. package/dist/assets/base32-rvunYmjt.js +0 -1
  195. package/dist/assets/bind-account-DWpWB9oY.js +0 -1
  196. package/dist/assets/branding-C1Ia1UuG.js +0 -1
  197. package/dist/assets/button-DTxgdpBB.js +0 -1
  198. package/dist/assets/confirm-DTV46cI2.js +0 -7
  199. package/dist/assets/connect-to-DqRnkSJR.js +0 -1
  200. package/dist/assets/createClass-BMZZ4tvt.js +0 -1
  201. package/dist/assets/domain-action-card-CEOtRquC.js +0 -28
  202. package/dist/assets/domains-UcvU4SNI.js +0 -1
  203. package/dist/assets/engine-D80vWtQO.js +0 -1
  204. package/dist/assets/gen-access-key-CceVm9CK.js +0 -1
  205. package/dist/assets/gen-simple-access-key-DBtfSm_M.js +0 -1
  206. package/dist/assets/get-safe-url-C-ga6boD.js +0 -1
  207. package/dist/assets/hi-C3FQ6j4Z.js +0 -5
  208. package/dist/assets/iframe-yWzH7Y70.js +0 -1
  209. package/dist/assets/index-9RuhtmiE.js +0 -7
  210. package/dist/assets/index-B8oq6zxb.js +0 -1
  211. package/dist/assets/index-BPLFlpyZ.js +0 -1
  212. package/dist/assets/index-Bpx_SHfH.js +0 -124
  213. package/dist/assets/index-BwWh6qt0.js +0 -113
  214. package/dist/assets/index-CBuBVmWe.js +0 -1020
  215. package/dist/assets/index-CJ69vsWG.js +0 -271
  216. package/dist/assets/index-DMpO3u1o.js +0 -29
  217. package/dist/assets/index-DTwsbX7O.js +0 -55
  218. package/dist/assets/index-Dib9OV0s.js +0 -6
  219. package/dist/assets/index-GUfN0pBe.js +0 -62
  220. package/dist/assets/index-OkiS9ggb.js +0 -1
  221. package/dist/assets/landing-page-CEwZuo6C.js +0 -1
  222. package/dist/assets/list-DFvUHI6u.js +0 -103
  223. package/dist/assets/list-DKV7bt8d.js +0 -2
  224. package/dist/assets/localization-BAcpaWtp.js +0 -1
  225. package/dist/assets/logger-__gJZTBC.js +0 -1
  226. package/dist/assets/login-DcV8dmSg.js +0 -1
  227. package/dist/assets/passport-item-Bej8KfmX.js +0 -1
  228. package/dist/assets/preferences-f1ltD9jG.js +0 -1
  229. package/dist/assets/profile-embed-DKKNp824.js +0 -1
  230. package/dist/assets/pt-DopXhOk4.js +0 -5
  231. package/dist/assets/publish-resource-Ce_uMtZk.js +0 -1
  232. package/dist/assets/ru-pXOMfITZ.js +0 -5
  233. package/dist/assets/runtime-EaR7CQWh.js +0 -1
  234. package/dist/assets/sdk-D0Pm334j.js +0 -1
  235. package/dist/assets/session-DW40g2df.js +0 -1
  236. package/dist/assets/status-D4MGFqcv.js +0 -1
  237. package/dist/assets/team-C8yfeoct.js +0 -146
  238. package/dist/assets/th-Dt7avnjd.js +0 -5
  239. package/dist/assets/traffic-BjVQYor-.js +0 -1
  240. package/dist/assets/useLocalStorage-BRaJWH_j.js +0 -1
  241. package/dist/assets/user-center-V4qQZYhM.js +0 -126
  242. package/dist/assets/user-sessions-DYh09QrL.js +0 -1
  243. package/dist/assets/vendor-utils-CddrUZ58.js +0 -213
  244. package/dist/assets/vi-BbB_zl6_.js +0 -5
  245. package/dist/assets/wrap-locale-FkxlVw29.js +0 -1
@@ -0,0 +1,55 @@
1
+ import{T as ee,H as O,aa as X,an as Ee,ao as Ue,ap as We,aq as Ve,G as K,ai as je,F as ke,N as Me,D as z,ar as _e,ab as Ne,a9 as $e,L as Ie}from"./vendor-ux-B7q8W4Pg.js";import{b as u,a as H,g as ae,c as He}from"./vendor-hooks-BRXKH6Nb.js";import{r as D}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as i,b6 as R,am as ce,y as B,z as F,Q as V,T as Y,I as le,a3 as oe,W as E,b1 as W,c9 as qe,ck as Le,c8 as Je,at as Fe,D as ye,ah as Be,cD as Oe,a6 as be,cE as Ze,a$ as Ke}from"./vendor-mui-core-B7zoO8f5.js";import{Z as N,a8 as M,X as G,bh as se,c as ve,b9 as Ge,aU as Ye,Y as Qe}from"./index-CuQBOJqN.js";import{A as Z,Q as Xe,b as de,Z as et,n as Q,$ as tt,C as nt,a as st}from"./vendor-utils-DtY42AM-.js";import{u as te,C as k,a as De}from"./index.esm-JPZAjt0x.js";import{S as ie}from"./switch-control-BR8H_fdm.js";import{S as y}from"./section-Dq8SB7lh.js";import{d as ot}from"./keyboard-arrow-down-rounded-8U0_i9QO.js";import{u as at}from"./index-BtkFo6d6.js";import{v as it}from"./index-Bzij4iIk.js";import{r as rt}from"./base32-D7JDMggs.js";import{u as lt}from"./use-mobile-C_DcJ5SZ.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-B7AoUs4o.js";import"./required-CobBjKC9.js";const we={width:24,height:24,body:'<path fill="currentColor" d="M5 4v16V4v5v-5Zm3 10h2.675q.275-.575.638-1.075t.812-.925H8q-.425 0-.713.288T7 13q0 .425.288.713T8 14Zm0 4h2.075Q10 17.5 10 17t.075-1H8q-.425 0-.713.288T7 17q0 .425.288.713T8 18Zm-3 4q-.825 0-1.413-.588T3 20V4q0-.825.588-1.413T5 2h7.175q.4 0 .763.15t.637.425l4.85 4.85q.275.275.425.638t.15.762V10.3q-.475-.15-.975-.225T17 10V9h-4q-.425 0-.713-.288T12 8V4H5v16h5.675q.275.575.638 1.075t.812.925H5Zm12-10q2.075 0 3.538 1.463T22 17q0 2.075-1.463 3.538T17 22q-2.075 0-3.538-1.463T12 17q0-2.075 1.463-3.538T17 12Zm0 8q.275 0 .463-.188t.187-.462q0-.275-.187-.463T17 18.7q-.275 0-.463.188t-.187.462q0 .275.188.463T17 20Zm0-6q-.475 0-.875.238t-.65.637q-.1.15-.025.313t.25.237q.15.075.3 0t.275-.2q.125-.175.313-.275t.412-.1q.325 0 .563.213t.237.537q0 .275-.15.463t-.35.387q-.15.15-.313.3t-.287.35q-.075.15-.113.313t-.037.337q0 .225.125.413t.325.187q.2 0 .325-.15t.125-.35q0-.275.15-.488t.35-.412q.3-.275.525-.613t.225-.737q0-.675-.5-1.138T17 14Z"/>'},ue={enabled:!1,domain:"",clientId:"",clientSecret:""};function ct(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...ue},c?.settings?.oauth?.auth0||{}),{handleSubmit:x,control:a,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(ue))}),l=d("enabled"),j=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({auth0:s})}}),L=Object.assign({...ue},I?.settings?.oauth?.auth0||{});f(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),v=u(s=>s?.trim()?!0:t("oauth.auth0.domainDescription")),S=u(s=>s?.trim()?!0:t("oauth.auth0.clientIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.auth0.clientSecretDescription")),w=u(()=>!0),h=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[n]);return e.jsx(i,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.auth0.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(i,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:h,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:a,render:({field:s})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.auth0.domain"),children:e.jsx(k,{name:"domain",control:a,rules:{validate:l?v:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.domain"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientId"),children:e.jsx(k,{name:"clientId",control:a,rules:{validate:l?S:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.clientId"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:a,rules:{validate:l?g:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.auth0.clientSecret"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const he={enabled:!1,clientId:"",clientSecret:""};function dt(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...he},c?.settings?.oauth?.github||{}),{handleSubmit:x,control:a,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(he))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({github:h})}}),I=Object.assign({...he},s?.settings?.oauth?.github||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.github.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.github.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[n]);return e.jsx(i,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.github.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(i,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:a,sx:{alignItems:"center"},render:({field:h})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},size:"small",checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.github.clientId"),children:e.jsx(k,{name:"clientId",control:a,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.github.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.github.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:a,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.github.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function ut(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...me},c?.settings?.oauth?.google||{}),{handleSubmit:x,control:a,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(me))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({google:h})}}),I=Object.assign({...me},s?.settings?.oauth?.google||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.google.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.google.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[n]);return e.jsx(i,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.google.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(i,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:a,render:({field:h})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.google.clientId"),children:e.jsx(k,{name:"clientId",control:a,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.google.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.google.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:a,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.google.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ht(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...pe},c?.settings?.oauth?.apple||{}),{handleSubmit:r,control:x,formState:a,watch:p,reset:d}=te({defaultValues:Z(o,Object.keys(pe))}),f=p("enabled"),l=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({apple:s})}}),L=Object.assign({...pe},I?.settings?.oauth?.apple||{});d(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),j=u(s=>s?.trim()?!0:t("oauth.apple.teamIdDescription")),v=u(s=>s?.trim()?!0:t("oauth.apple.serviceIdDescription")),S=u(s=>s?.trim()?!0:t("oauth.apple.keyIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.apple.authKeyDescription")),w=u(s=>s?.trim()?!0:t("oauth.apple.bundleIdDescription")),h=u(()=>!0);return e.jsx(i,{children:e.jsxs("form",{onSubmit:r(l),disabled:!0,children:[e.jsx(y,{title:t("oauth.apple.enable"),mb:2.5,children:e.jsx(k,{name:"enabled",control:x,render:({field:s})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.apple.teamId"),children:e.jsx(k,{name:"teamId",control:x,rules:{validate:f?j:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.teamId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.bundleId"),children:e.jsx(k,{name:"bundleId",control:x,rules:{validate:f?w:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.bundleId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.serviceId"),children:e.jsx(k,{name:"serviceId",control:x,rules:{validate:f?v:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.serviceId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.keyId"),children:e.jsx(k,{name:"keyId",control:x,rules:{validate:f?S:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.keyId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.authKey"),children:e.jsx(k,{name:"authKey",control:x,rules:{validate:f?g:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.apple.authKey"),multiline:!0,rows:4,error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:r(l),disabled:!a.isDirty,children:t("oauth.save")})]})})}const xe={enabled:!1,clientId:"",clientSecret:""};function mt(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...xe},c?.settings?.oauth?.twitter||{}),{handleSubmit:r,control:x,formState:a,watch:p,reset:d}=te({defaultValues:Z(o,Object.keys(xe))}),f=p("enabled"),l=u(async g=>{try{const{blocklet:w}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({twitter:g})}}),h=Object.assign({...xe},w?.settings?.oauth?.twitter||{});d(h),O.success(t("oauth.saveSuccess"))}catch(w){O.error(w.message||t("oauth.saveFailed"))}}),j=u(g=>g?.trim()?!0:t("oauth.twitter.clientIdDescription")),v=u(g=>g?.trim()?!0:t("oauth.twitter.clientSecretDescription")),S=u(()=>!0);return e.jsx(i,{children:e.jsxs("form",{onSubmit:r(l),disabled:!0,children:[e.jsx(y,{title:e.jsx(i,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:t("oauth.twitter.enable")})}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:x,sx:{alignItems:"center"},render:({field:g})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},size:"small",checked:g.value,...g})})})}),e.jsx(y,{title:t("oauth.twitter.clientId"),children:e.jsx(k,{name:"clientId",control:x,rules:{validate:f?j:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",label:t("oauth.twitter.clientId"),error:!!a.errors[g.name],helperText:a.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.twitter.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:x,rules:{validate:f?v:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",type:"password",label:t("oauth.twitter.clientSecret"),error:!!a.errors[g.name],helperText:a.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:r(l),disabled:!a.isDirty,children:t("oauth.save")})]})})}const pt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function Re({id:b,title:c,children:t,index:n,onMove:o,defaultExpand:r=!1,onEnd:x,icon:a=null}){const[p,d]=D.useState(r),f=D.useRef(null),l=D.useRef(null),[{handlerId:j},v]=Ee({accept:"dragItem",collect(s){return{handlerId:s.getHandlerId()}},hover(s,I){if(!f.current)return;const L=s.index,m=n;if(L===m)return;const A=f.current?.getBoundingClientRect(),_=l.current?.getBoundingClientRect(),re=(_.bottom-_.top)/2,$=I.getClientOffset().y-A.top;L<m&&$<re||L>m&&$>re||(o(L,m),s.index=m)}}),[{isDragging:S},g]=Ue({item:{index:n,type:"dragItem"},collect:s=>({isDragging:s.isDragging()}),end:x});g(l),v(f);const w=S?.5:1,h=u(s=>{s.preventDefault(),s.stopPropagation(),d(!p)});return e.jsxs(i,{ref:f,children:[e.jsxs(i,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:l,"data-handler-id":j,children:[e.jsxs(i,{sx:{py:2,px:1,opacity:w,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:h,children:[e.jsx(i,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(X,{fontSize:20,icon:pt})}),e.jsx(i,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:a}),e.jsx(Y,{sx:{flex:1},children:c}),e.jsx(le,{size:"small",sx:{pointerEvents:"auto",transform:p?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(X,{icon:ot,style:{transform:"scale(1.5)"}})})]}),e.jsx(oe,{})]}),e.jsx(i,{sx:{pl:4,py:2.5,display:p?"block":"none"},children:t})]})}Re.propTypes={title:E.string.isRequired,id:E.string.isRequired,children:E.node.isRequired,index:E.number.isRequired,onMove:E.func.isRequired,onEnd:E.func.isRequired,defaultExpand:E.bool,icon:E.any};const xt=[{name:"github",title:G.PROVIDER_NAME.github,icon:e.jsx(se,{provider:"github",sx:{width:20,height:20}}),component:e.jsx(dt,{})},{name:"google",title:G.PROVIDER_NAME.google,icon:e.jsx(se,{provider:"google",sx:{width:20,height:20}}),component:e.jsx(ut,{})},{name:"apple",title:G.PROVIDER_NAME.apple,icon:e.jsx(se,{provider:"apple",sx:{width:20,height:20}}),component:e.jsx(ht,{})},{name:"twitter",title:G.PROVIDER_NAME.twitter,icon:e.jsx(se,{provider:"twitter",sx:{width:20,height:20}}),component:e.jsx(mt,{})},{name:"auth0",title:G.PROVIDER_NAME.auth0,icon:e.jsx(se,{provider:"auth0",sx:{width:20,height:20}}),component:e.jsx(ct,{})}],ft=["github","google","apple","twitter","auth0"];function gt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=c?.settings?.oauth||{},o=Object.keys(n).sort((l,j)=>n[l]?.order!==void 0&&n[j]?.order!==void 0?n[l].order-n[j].order:n[l]?.order!==void 0?-1:1);for(const l of ft)o.includes(l)||o.push(l);const r=ae(o.reduce((l,j,v)=>Object.assign(l,{[j]:v}),{})),x=H(()=>{const l=[...xt];return l.sort((j,v)=>r[j.name]-r[v.name]),l.map(j=>({...j,enabled:n[j.name]?.enabled??!1}))},[r.auth0,r.github,r.google]),a={};typeof window<"u"&&(a.context=window);const p=u(async l=>{const j={};Object.keys(l).forEach(v=>{j[v]={order:l[v]}}),await b.configOAuth({input:{did:t,oauth:JSON.stringify(j)}})}),d=u((l,j)=>{const v=x[l],S=x[j];r[v.name]=j,r[S.name]=l}),f=u(async()=>{await p(r)});return e.jsx(i,{sx:{".section-left":{width:"180px"}},children:e.jsx(We,{backend:Ve,...a,children:x.map((l,j)=>e.jsx(Re,{index:j,id:l.name,title:l.title,icon:l.icon,onMove:d,onEnd:f,defaultExpand:l.enabled,children:l.component},l.name))})})}const J={ttl:ve.SESSION_TTL,cacheTtl:ve.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]},enableBlacklist:!1};function U(b){return e.jsx(at,{...b,sx:{transform:"scale(0.75)"}})}function fe(b,c=!1){const t=c?b.ttl*86400:b.ttl/86400;return{...b,ttl:t}}function jt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=Xe({},J,c?.settings?.session||{});de(n.ttl)&&(n.ttl=J.ttl),de(n.cacheTtl)&&(n.cacheTtl=J.cacheTtl),n.phone||(n.phone=J.phone),n.email||(n.email=J.email),de(n.enableBlacklist)&&(n.enableBlacklist=J.enableBlacklist);const{handleSubmit:o,control:r,formState:x,reset:a,watch:p}=te({defaultValues:Z(fe(n),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:d}=ee(),f=p("email.enabled"),l=p("phone.enabled"),j=p("email.enableDomainBlackList"),v=p("email.enableDomainWhiteList"),{fields:S,append:g,remove:w}=De({control:r,name:"email.domainBlackList"}),{fields:h,append:s,remove:I}=De({control:r,name:"email.domainWhiteList"}),L=u(async m=>{try{const{blocklet:A}=await b.updateAppSessionConfig({input:{did:t,config:et(fe(m,!0),["phone"])}}),_=Object.assign({},J,Z(A?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));a(fe(_)),O.success(d("common.configSuccess"))}catch(A){O.error(A.message)}});return e.jsx(bt,{onSubmit:o(L),children:e.jsxs(W,{direction:"column",sx:{gap:6},children:[e.jsxs(i,{children:[e.jsxs(i,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.profile")}),e.jsx(i,{component:oe,sx:{my:3}})]}),e.jsxs(W,{sx:{gap:2},children:[e.jsx(y,{title:d("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enabled",control:r,render:({field:m})=>e.jsx(U,{...m,checked:m.value})})})}),f&&e.jsxs(W,{direction:"column",sx:{ml:2,gap:.5},children:[e.jsx(y,{title:d("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireVerified",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireUnique",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.trustOauthProviders",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainBlackList",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),j&&e.jsxs(i,{children:[S.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainBlackList.${A}`,control:r,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>w(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>g(""),children:d("blocklet.config.session.addDomain")})]}),e.jsx(y,{title:d("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainWhiteList",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),v&&e.jsxs(i,{children:[h.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainWhiteList.${A}`,control:r,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>I(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>s(""),children:d("blocklet.config.session.addDomain")})]})]}),e.jsxs(i,{sx:{display:"none"},children:[e.jsx(y,{title:d("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.enabled",control:r,disabled:!0,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),l&&e.jsxs(W,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(y,{title:d("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireVerified",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireUnique",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(i,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.period")}),e.jsx(i,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(k,{name:"ttl",control:r,rules:{min:1,max:30},render:({field:m})=>e.jsx(B,{fullWidth:!0,sx:{mb:2},children:e.jsx(y,{title:d("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{width:"100%",maxWidth:500,px:2},children:e.jsx(Je,{...m,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(i,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.experimentalSettings")}),e.jsx(i,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(y,{title:d("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"enableBlacklist",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})})]}),e.jsx(i,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!x.isDirty,children:d("oauth.save")})})]})})}const bt=Fe.form`
2
+ max-width: 1536px;
3
+
4
+ .advanced-config {
5
+ border: 0;
6
+ padding: 0;
7
+ }
8
+
9
+ .config-form {
10
+ flex-grow: 1;
11
+ overflow-y: auto;
12
+ will-change: transform;
13
+
14
+ &:first-child {
15
+ margin: 0;
16
+ }
17
+
18
+ ${b=>b.theme.breakpoints.down("md")} {
19
+ width: 100%;
20
+ flex-shrink: 0;
21
+ padding: 0 24px;
22
+ transform: translate(0, 0);
23
+ }
24
+ }
25
+
26
+ .config-item {
27
+ display: flex;
28
+ align-items: center;
29
+ justify-content: space-between;
30
+ }
31
+
32
+ .config-desc {
33
+ font-weight: normal;
34
+ font-size: 12px;
35
+ color: #666;
36
+ }
37
+
38
+ .form-item {
39
+ margin-top: 0;
40
+ }
41
+ `,vt={width:24,height:24,body:'<path fill="currentColor" d="M6 12.05q0 1.125.425 2.188T7.75 16.2l.25.25V15q0-.425.288-.713T9 14q.425 0 .713.288T10 15v4q0 .425-.288.713T9 20H5q-.425 0-.713-.288T4 19q0-.425.288-.713T5 18h1.75l-.4-.35q-1.3-1.15-1.825-2.625T4 12.05Q4 9.7 5.2 7.787T8.425 4.85q.35-.2.738-.025t.512.575q.125.375-.013.75t-.487.575q-1.45.8-2.313 2.213T6 12.05Zm12-.1q0-1.125-.425-2.187T16.25 7.8L16 7.55V9q0 .425-.288.713T15 10q-.425 0-.713-.288T14 9V5q0-.425.288-.713T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6h-1.75l.4.35q1.225 1.225 1.788 2.663T20 11.95q0 2.35-1.2 4.263t-3.225 2.937q-.35.2-.737.025t-.513-.575q-.125-.375.013-.75t.487-.575q1.45-.8 2.313-2.212T18 11.95Z"/>'};var ge,Ce;function kt(){if(Ce)return ge;Ce=1;const{DEFAULT_IP_DOMAIN_SUFFIX:b,SLOT_FOR_IP_DNS_SITE:c,DEFAULT_DID_DOMAIN:t}=Ge(),{encode:n}=rt();return ge={getIpDnsDomainForBlocklet:x=>`${n(x.meta.did)}-${c}.${b}`,getDidDomainForBlocklet:({did:x,didDomain:a=t})=>`${n(x)}.${a}`},ge}var yt=kt();function Ae({ref:b=null}){const{t:c}=D.useContext(K),{blocklet:t}=M(),{api:n}=N(),o=ae({loadingReject:!1,loadingApprove:!1,mode:"view",show:!1,data:{},callback:Q}),x=ye()?.transitions?.duration?.leavingScreen||300,a=u(()=>{o.mode="view",o.data={},o.callback=Q}),p=u(()=>{o.show=!1,setTimeout(()=>{a()},x)}),d=u(g=>{o.mode="view",o.show=!0,o.data=g}),f=u((g,w=Q)=>{o.mode="approve",o.show=!0,o.data=g,o.callback=w});D.useImperativeHandle(b,()=>({open:d,close:p,approve:f}),[d,p,f]);const l=H(()=>{if(!o.show)return[];o.data.migratedFrom=[o.data.appId,o.data.appPid];const g=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return o.data.isMaster!==!1&&tt(g,"appliedAt","status"),g.map(w=>{const h=c(`federated.info.${w}`);let s=o.data[w];if(w==="appName"&&o.data.isMaster&&(s=e.jsxs(i,{children:[e.jsx(Be,{component:Oe}),s]})),["appId","appPid","serverId"].includes(w)&&(s=e.jsx(je,{children:s})),["appUrl"].includes(w)&&(s=e.jsx(i,{component:"a",href:s,target:"_blank",children:s})),["appLogo"].includes(w)){const I=nt(`https://${yt.getDidDomainForBlocklet({did:o.data.appPid})}`,ve.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo");try{const L=new URL(I);L.searchParams.set("imageFilter","resize"),L.searchParams.set("w","80"),L.searchParams.set("h","80"),s=e.jsx("img",{src:L.href,width:"60",height:"60",alt:o.data.appName})}catch{s=e.jsx("img",{src:I,width:"60",height:"60",alt:o.data.appName})}}return w==="status"&&(s=s&&c(`federated.status.${s}`)),w==="migratedFrom"&&(s=(o.data.migratedFrom||[]).filter(m=>![o.data.appId,o.data.appPid].includes(m)).map(m=>e.jsx(je,{children:m}))),st(s)&&(s="-"),{name:h,value:s}})},[o.data]),j=o.mode==="approve",v=u(async()=>{try{o.loadingReject=!0,await n.auditFederatedLogin({input:{memberPid:o.data.appPid,did:t.appPid,status:"rejected"}}),p(),o?.callback(!1)}finally{o.loadingReject=!1}}),S=u(async()=>{try{o.loadingApprove=!0,await n.auditFederatedLogin({input:{memberPid:o.data.appPid,did:t.appPid,status:"approved"}}),p(),o?.callback(!0)}finally{o.loadingApprove=!1}});return e.jsx(ke,{open:o.show,title:c(j?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:p,actions:j?e.jsxs(e.Fragment,{children:[e.jsxs(V,{color:"error",variant:"contained",onClick:v,disabled:o.loadingReject,children:[o.loadingReject?e.jsx(be,{size:16,color:"grey"}):null,c("common.reject")]}),e.jsxs(V,{variant:"contained",onClick:S,disabled:o.loadingApprove,children:[o.loadingApprove?e.jsx(be,{size:16,color:"grey"}):null,c("common.approve")]})]}):e.jsx(V,{variant:"outlined",onClick:p,children:c("common.close")}),children:l.map(g=>e.jsx(it,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:g.name,children:g.value},g.name))})}Ae.propTypes={ref:E.any};function Se({ref:b=null}){const t=ye()?.transitions?.duration?.leavingScreen||300,{t:n}=D.useContext(K),o=ae({show:!1,data:{link:""}}),r=u(()=>{o.data.link=""}),x=u(()=>{o.show=!1,setTimeout(()=>{r()},t)}),a=u(({link:d})=>{o.show=!0,o.data.link=d});D.useImperativeHandle(b,()=>({open:a,close:x}),[a,x]);const p=u(()=>{He(o.data.link),x()});return e.jsxs(ke,{open:o.show,title:n("federated.joinFederatedLogin"),onClose:x,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:p,children:n("common.copyAndClose")}),children:[e.jsx(i,{sx:{mb:1},children:n("federated.inviteJoinFederatedLoginDescription")}),e.jsx(i,{sx:{"& .copy-button":{display:"none !important"}},children:e.jsx(Me,{language:"shell",style:{marginBottom:0},children:o.data.link})})]})}Se.propTypes={ref:E.any};function Pe({mode:b="member"}){const c=D.useRef(null),t=D.useRef(null),{t:n,locale:o}=D.useContext(K),{blocklet:r,actions:{refreshBlocklet:x}}=M(),{confirmApi:a,confirmHolder:p}=Ye(),{api:d}=N(),f=r.settings.federated?.sites||[],l=r.settings.federated?.config||{},j=l.isMaster!==!1,v=f.find(T=>T.appPid===r.appPid),S=ae({loadingSync:!1}),g=u(T=>{t.current?.open(T)}),w=u(T=>{t.current?.approve(T,x)}),h=u(T=>{a.open({title:n("federated.removeFederatedLogin"),content:n("federated.removeFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await d.quitFederatedLogin({input:{did:r.appPid,targetDid:T.appPid}}),C()}})}),s=u(T=>{a.open({title:n("federated.disableFederatedLogin"),content:n("federated.disableFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await d.auditFederatedLogin({input:{memberPid:T.appPid,did:r.appPid,status:"revoked"}}),C()}})}),I=u(T=>{a.open({title:n("federated.enableFederatedLogin"),content:n("federated.enableFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),async onConfirm(C){await d.auditFederatedLogin({input:{memberPid:T.appPid,did:r.appPid,status:"approved"}}),C()}})}),L=H(()=>{const T=[{label:n("common.name"),name:"appName",options:{customBodyRenderLite:C=>{const q=f[C],ne=q.isMaster!==!1;return e.jsx(i,{sx:{display:"inline-block"},children:e.jsxs(i,{component:"a",href:q.appUrl,target:"_blank",onClick:P=>{P.stopPropagation()},sx:{display:"flex",alignItems:"center"},children:[ne&&e.jsx(Be,{component:Oe,style:{marginRight:"4px"}}),q.appName]})})}}},{label:n("common.did"),name:"appId",options:{customBodyRenderLite:C=>{const q=f[C];return e.jsx(je,{children:q.appId})}}},{label:n("common.status"),name:"status",options:{customBodyRenderLite:C=>{const q=f[C],ne=q.isMaster!==!1;return e.jsx(i,{children:ne?"-":n(`federated.status.${q.status}`)})}}}];return j&&T.push({label:n("common.actions"),name:"actions",options:{customBodyRenderLite:C=>{const q=f[C],ne=q.isMaster!==!1;return e.jsx(i,{sx:{display:"flex",gap:1},children:ne?e.jsxs(e.Fragment,{children:[q.status==="rejected"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:P=>{P.stopPropagation()},children:n("federated.status.rejected")}),q.status==="revoked"&&e.jsx(z,{variant:"contained",color:"secondary",size:"small",onClick:P=>{P.stopPropagation()},children:n("federated.status.revoked")})]}):e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:P=>{P.stopPropagation(),h(q)},children:n("federated.quitMember")},"quiteSite"),q.status==="pending"&&e.jsx(z,{variant:"contained",color:"primary",size:"small",onClick:P=>{P.stopPropagation(),w(q)},children:n("federated.status.pending")},"auditSite"),q.status==="approved"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:P=>{P.stopPropagation(),s(q)},style:{whiteSpace:"nowrap"},children:n("federated.revoke")},"revokeSite"),q.status==="revoked"&&e.jsx(z,{variant:"contained",color:"warning",size:"small",onClick:P=>{P.stopPropagation(),I(q)},style:{whiteSpace:"nowrap"},children:n("federated.approve")},"approveSite")]})})}}}),T},[l.appId,f,j,n]),m=H(()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(T,{dataIndex:C}){const q=f[C];g(q)}}),[]),A=u(()=>{const T=r.environments.find(C=>C.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);T?.value?c.current?.open({link:T.value}):O.error(n("federated.failedToGetFederatedLoginLink"))},[r.site?.domainAliases?.[0]?.href]),_=u(()=>{a.open({title:n("federated.quitFederatedLogin"),content:n("federated.quitFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(T){await d.quitFederatedLogin({input:{did:r.appPid}}),T()}})}),re=u(()=>{a.open({title:n("federated.disbandFederatedLogin"),content:n("federated.disbandFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(T){await d.disbandFederatedLogin({input:{did:r.appPid}}),T()}})}),Te=u(async()=>{try{S.loadingSync=!0,await Promise.all([await d.syncFederatedConfig({input:{did:r.appPid}}),_e(500)]),O.success(n("common.succeeded"))}finally{S.loadingSync=!1}}),$=[];return v.status!=="pending"&&$.push(e.jsx(ce,{title:n("federated.syncConfig"),children:e.jsx(le,{size:"small",onClick:Te,disabled:S.loadingSync,sx:[{"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}},S.loadingSync?{animation:"spin 1s linear infinite"}:{}],children:e.jsx(X,{icon:vt,style:{fontSize:24}})},"syncConfig")})),b==="master"?($.push(e.jsx(z,{size:"small",variant:"contained",onClick:A,sx:{ml:1},children:n("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),$.push(e.jsx(z,{color:"error",size:"small",variant:"contained",onClick:re,sx:{ml:1},children:n("federated.disbandFederatedLogin")},"disbandFederatedLogin"))):$.push(e.jsx(z,{size:"small",variant:"contained",color:"error",onClick:_,sx:{ml:1},children:n("federated.quitFederatedLogin")},"quitFederatedLogin")),e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"main-table",locale:o,data:f,columns:L,customButtons:$,title:e.jsx(i,{className:"table-toolbar-left",children:n("oauth.federated")}),options:m}),p,e.jsx(Se,{ref:c}),e.jsx(Ae,{ref:t})]})}Pe.propTypes={mode:E.oneOf(["member","master"])};function ze({ref:b=null}){const{t:c}=D.useContext(K),{api:t}=N(),{blocklet:n}=M(),o=n?.appPid,x=ye()?.transitions?.duration?.leavingScreen||300,a=ae({loading:!1,show:!1,appUrl:"",appUrlError:"",callback:Q}),p=u(()=>{a.appUrl="",a.appUrlError="",a.callback=Q}),d=u(()=>{a.show=!1,setTimeout(()=>{p()},x)}),f=u((v=Q)=>{a.show=!0,a.callback=v});D.useImperativeHandle(b,()=>({open:f,close:d}),[f,d]);const l=u(v=>{if(!v)throw new Error(c("federated.federatedJoinAppUrlRequired"));if(!Qe(v))throw new Error(c("federated.federatedJoinAppUrlInvalid"))}),j=u(async()=>{try{l(a.appUrl),a.loading=!0;const v=await t.joinFederatedLogin({input:{did:o,appUrl:a.appUrl}});a.show=!1,d(),a?.callback(v)}catch(v){a.appUrlError=v.message}finally{a.loading=!1}});return e.jsxs(ke,{open:a.show,title:c("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:e.jsxs(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:j,disabled:a.loading,children:[a.loading?e.jsx(be,{size:16,sx:{mr:1},color:"grey"}):null,c("common.confirm")]}),children:[e.jsx(i,{sx:{mb:1},children:c("federated.joinFederatedLoginDescription")}),e.jsx(F,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:c("federated.federatedJoinAppUrl"),label:c("federated.federatedJoinAppUrl"),value:a.appUrl,error:!!a.appUrlError,helperText:a.appUrlError||"eg: https://www.arcblock.io",onChange:v=>{a.appUrl=v.target.value}})]})}ze.propTypes={ref:E.any};function wt(){const{t:b}=D.useContext(K);return e.jsxs(W,{direction:"row",spacing:2,sx:{alignItems:"flex-start",p:2},children:[e.jsx(Ze,{fontSize:"large",color:"primary"}),e.jsxs(i,{children:[e.jsx(Y,{variant:"h6",gutterBottom:!0,children:b("federated.title")}),e.jsx(Y,{variant:"body2",sx:{color:"text.secondary"},children:b("federated.description")}),e.jsx(Ke,{href:"https://www.arcblock.io/blog/zh/did-connect-federated-login-support",underline:"hover",variant:"body2",color:"primary",target:"_blank",sx:{display:"inline-flex",alignItems:"center",mt:1},children:b("federated.link")})]})]})}function St(){const b=D.useRef(null),c=D.useRef(null),{t}=D.useContext(K),{blocklet:n,actions:{refreshBlocklet:o}}=M(),r=u(()=>{const a=n.site?.domainAliases?.[0]?.href;if(a)try{const p=new URL(a);b.current?.open({link:p.origin})}catch{O.error(t("federated.failedToGetFederatedLoginLink"))}},[n.site?.domainAliases?.[0]?.href]),x=u(()=>{c.current?.open(()=>{o()})});if(n.settings.federated?.sites.length>0){const a=n.settings.federated?.config.isMaster!==!1;return e.jsx(Pe,{mode:a?"master":"member"})}return e.jsxs(e.Fragment,{children:[e.jsx(i,{sx:{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px"},children:e.jsxs(i,{sx:{maxWidth:400,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(wt,{}),e.jsx(oe,{sx:{width:1}}),e.jsxs(W,{sx:{width:1,p:2,gap:1.5},children:[e.jsx(z,{variant:"contained",onClick:r,sx:{width:1},children:t("federated.inviteJoinFederatedLogin")}),e.jsx(z,{variant:"outlined",onClick:x,sx:{width:1},children:t("federated.joinFederatedLogin")})]})]})}),e.jsx(Se,{ref:b}),e.jsx(ze,{ref:c})]})}function Tt({orientation:b="horizontal"}){const{t:c}=D.useContext(K),t=lt({key:"lg"}),n=[{label:e.jsx(i,{sx:{textAlign:"center",width:"100%"},children:c("oauth.commonSettings")}),value:"settings"},{label:e.jsx(i,{sx:{textAlign:"center",width:"100%"},children:c("oauth.federated")}),value:"federated"},{label:e.jsx(i,{sx:{textAlign:"center",width:"100%"},children:c("oauth.oauth")}),value:"oauth"},{label:e.jsx(i,{sx:{textAlign:"center",width:"100%"},children:c("oauth.moreLogin")}),value:"more"}],[o,r]=D.useState(n[0].value),x=H(()=>({oauth:e.jsx(gt,{}),federated:e.jsx(St,{}),more:e.jsx($e,{children:c("oauth.comingSoon")}),settings:e.jsx(jt,{})}),[c]);return b==="vertical"?e.jsx(It,{children:e.jsxs(W,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(i,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(Ie,{tabs:n,current:o,orientation:t?"horizontal":"vertical",onChange:r,sx:{borderRight:t?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(i,{sx:{flexGrow:1,minWidth:0},children:e.jsx(i,{sx:{maxWidth:"1200px"},children:x[o]})})]})}):e.jsxs(i,{children:[e.jsx(Ie,{tabs:n,current:o,onChange:r}),e.jsx(i,{sx:{marginTop:"10px"},children:x[o]})]})}Tt.propTypes={orientation:E.oneOf(["horizontal","vertical"])};const It=Fe.div`
42
+ .MuiTab-root {
43
+ text-align: left;
44
+ align-items: flex-start;
45
+ font-weight: normal;
46
+
47
+ div {
48
+ text-align: left;
49
+ }
50
+ }
51
+
52
+ .Mui-selected {
53
+ font-weight: bold;
54
+ }
55
+ `;export{Tt as default};
@@ -1 +1 @@
1
- import{c as A,v as R,p as w,s as p}from"./index-I45i29I1.js";const O=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,x=/^[a-zA-Z]:\\/;function N(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return x.test(e)?!1:O.test(e)}const _=["http","https"],z=["nofollow"],L={};function T(e){const r=e||L,g=r.protocols||_,u=A(r.test);return function(h){R(h,"element",function(t,y,E){if(t.tagName==="a"&&typeof t.properties.href=="string"&&u(t,y,E)){const o=t.properties.href;if(N(o)?g.includes(o.slice(0,o.indexOf(":"))):o.startsWith("//")){const n=s(r.content,t),c=n&&!Array.isArray(n)?[n]:n,i=s(r.rel,t)||z,a=typeof i=="string"?w(i):i,f=s(r.target,t),l=s(r.properties,t);if(l&&Object.assign(t.properties,p(l)),a.length>0&&(t.properties.rel=[...a]),f&&(t.properties.target=f),c){const m=s(r.contentProperties,t)||{};t.children.push({type:"element",tagName:"span",properties:p(m),children:p(c)})}}}})}}function s(e,r){return typeof e=="function"?e(r):e}export{T as r};
1
+ import{c as A,v as R,p as w,s as p}from"./index-BFQdM_lT.js";const O=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,x=/^[a-zA-Z]:\\/;function N(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return x.test(e)?!1:O.test(e)}const _=["http","https"],z=["nofollow"],L={};function T(e){const r=e||L,g=r.protocols||_,u=A(r.test);return function(h){R(h,"element",function(t,y,E){if(t.tagName==="a"&&typeof t.properties.href=="string"&&u(t,y,E)){const o=t.properties.href;if(N(o)?g.includes(o.slice(0,o.indexOf(":"))):o.startsWith("//")){const n=s(r.content,t),c=n&&!Array.isArray(n)?[n]:n,i=s(r.rel,t)||z,a=typeof i=="string"?w(i):i,f=s(r.target,t),l=s(r.properties,t);if(l&&Object.assign(t.properties,p(l)),a.length>0&&(t.properties.rel=[...a]),f&&(t.properties.target=f),c){const m=s(r.contentProperties,t)||{};t.children.push({type:"element",tagName:"span",properties:p(m),children:p(c)})}}}})}}function s(e,r){return typeof e=="function"?e(r):e}export{T as r};
@@ -0,0 +1,6 @@
1
+ import{j as e,W as u,a6 as z,T as j,at as _e,D as We,cG as J,ao as V,cH as Ge,ak as h,b1 as G,a$ as Ke,s as fe,cI as be,cw as Fe,am as ge,cs as Ye,M as F,aO as Y,bW as $e,aP as $,Q as qe,bh as He,aR as Qe,cJ as Xe,cK as Je,cL as Ve,cM as Ze,c1 as he}from"./vendor-mui-core-B7zoO8f5.js";import{k as ke,j as je,a as ue}from"./vendor-hooks-BRXKH6Nb.js";import{r as b,u as et}from"./vendor-react-Dvs43sk9.js";import{a8 as O,Z as L,ao as E,X as N,aM as tt,aN as st,aD as nt,c as I,v as ot}from"./index-CuQBOJqN.js";import{H as B,T as D,G as at,ak as q,ab as rt,ac as it,D as le,L as ct}from"./vendor-ux-B7q8W4Pg.js";import{u as lt}from"./use-mobile-C_DcJ5SZ.js";import{a as H,d as Ce,a1 as dt,c as pt,D as we,C as me}from"./vendor-utils-DtY42AM-.js";import{o as Be}from"./vendor-arcblock-B7AoUs4o.js";import{b as ut,u as mt,D as xt,c as de,a as ft}from"./index-BtHQU9Nx.js";import"./index-C-DpXzH8.js";import"./index-BojVbZw0.js";import"./api-IUmhrtIY.js";import{u as De,C as gt,D as ht,a as St}from"./connect-to-DiEQlFbF.js";import{b as yt,c as bt,d as kt,i as jt,e as xe,f as Ct,h as wt,j as Bt}from"./spaces-HwfT17d7.js";import{f as Q}from"./index-DBs9Ljax.js";import{v as Dt}from"./index-Bzij4iIk.js";import{E as Et}from"./index-DT3k66ox.js";import{x as Tt}from"./index-DRYJ0xIl.js";import{g as Se}from"./get-safe-url-Bpq2IOGY.js";import{S as It}from"./switch-control-BR8H_fdm.js";import{C as Rt,u as Pt}from"./config-space-h6V3UKMc.js";import{L as ye}from"./list-header-BQx81X9X.js";import"./lottie-web-4koyQiv_.js";import"./index-BtkFo6d6.js";async function vt({blockletDid:t,nodeApi:n,spaceGateways:o}){let s=!1;const r=await Promise.all(o.map(async a=>{let{name:c}=a;const i=await yt(a.endpoint);return!H(i)&&i!==c&&(c=i,s=!0),{...a,name:c}}));return s&&await Promise.all(r.filter(a=>a.did).map(a=>n.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function At({refresh:t}={}){const{blocklet:n}=O(),o=n?.meta?.did,{api:s}=L();return ke(async()=>{if(!o)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:o}});return await vt({blockletDid:o,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[o,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(Q(r)))}})}function Ee({deps:t,setLoading:n,backupDate:o}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=O(),[r,a]=b.useState([]),{api:c}=L(),[i,d]=b.useMemo(()=>o?[E(o).startOf("day").toISOString(),E(o).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[o]),l=Ce(async()=>{try{if(n(!0),!s){a([]);return}const{backups:x}=await c.getBlockletBackups({input:{did:s.meta.did,startTime:i,endTime:d}});a(x??[])}catch(x){console.error(x),B.error(Q(x))}finally{n(!1)}},1e3);return je(async()=>{l()},[s?.meta?.did].concat(t)),{backups:r}}function zt({appDid:t}){const{backups:n}=Ee(),[o,s]=b.useState({message:"",progress:0,completed:!1}),r=L(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&s(()=>({...c}))},[t]),b.useEffect(()=>{if(n?.length&&dt(n[0]?.status)){const[c]=n;s(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[n]),o}function Ot({deps:t=[],setLoading:n=()=>{}}={}){const{blocklet:o}=O(),[s,r]=b.useState([]),{api:a}=L(),c=b.useCallback(Ce(async()=>{if(!a||!o?.meta?.did){r([]);return}try{n(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:o.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}});r(Array.isArray(l)?l:[])}catch(i){console.error("Failed to fetch backup summary:",i),B.error(Q(i)),r([])}finally{n(!1)}},1e3),[]);return je(async()=>(await c(),()=>{c.cancel()}),[o?.meta?.did].concat(t)),{backupSummary:s}}const Te=b.createContext({}),{Provider:Lt,Consumer:bs}=Te;function Ie({children:t}){const{t:n}=D(),{api:o}=L(),{blocklet:s}=O(),[r,a]=b.useState(null),[c,i]=b.useState(!1),{data:d,loading:l,mutate:x}=At({refresh:c}),g=pt(d),m=zt({appDid:s?.appDid}),p=b.useMemo(()=>bt(s?.environments),[s?.environments]),[k,w]=b.useState(!1),[S,y]=b.useState(0),{backups:Z}=Ee({deps:[S,r],setLoading:w,backupDate:r}),[ee,te]=b.useState(0),{backupSummary:se}=Ot({deps:[ee]}),[_,M]=b.useState(d?.find(f=>f.endpoint===p)),T=s?.settings?.autoBackup,P=()=>{i(f=>!f)},ne=()=>{te(f=>f+1)},oe=()=>{y(f=>f+1)},K=async f=>{await o.updateAutoBackup({input:{did:s.meta.did,autoBackup:f}})},X=async()=>{await o.abortBlockletBackup({input:{appPid:s.meta.did}})},ae=async(f,A)=>{try{x(R=>{const v=[...R];return v.push({...f,loading:!0}),v}),await o.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:f}}),p!==A&&await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:A}]}}),M(f),P(),B.success(n("storage.spaces.connectedWithName",{name:f?.name??"DID Spaces"}))}catch(R){throw console.error(R),x(v=>[...v].filter(W=>W.did!==f.did)),R}},re=async f=>{f&&(f.endpoint===p&&(await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),T?.enabled&&await K({enabled:!1})),await o.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:f?.did}}),x(A=>{const R=[...A];return R.splice(R.indexOf(f),1),R}),M(f),P())},ie=async f=>{await Promise.all([o.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:f.did},spaceGateway:f}}),p!==f.endpoint&&o.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:f.endpoint}]}})]),B.success(n("storage.spaces.connectedWithName",{name:f?.name??"DID Spaces"})),P()},C=f=>f?.endpoint===p;return e.jsx(Lt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ae,deleteSpaceGateway:re,updateSpaceGateway:ie,refreshSpaceGateways:P,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:g,spaceGatewayIsSelected:C,updateAutoBackup:K,abortBlockletBackup:X,backupEndpoint:p,backupProgress:m,backups:Z,backupSummary:se,refreshBackupSummary:ne,refreshBackups:oe,setBackupDate:a,backupsLoading:k,autoBackup:T},children:t})}Ie.propTypes={children:u.any.isRequired};function U(){return b.useContext(Te)}function Re({...t}){const{blocklet:n}=O(),{info:o}=L(),{t:s}=D(),r=De({blocklet:n}),a=tt(o),{spaceGateways:c,addSpaceGateway:i}=U(),d={checkFn:we.create({baseURL:me(window.location.origin,st())}).get,webWalletUrl:a,extraParams:{appPid:n.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:o.did}},l=async({endpoint:g,name:m,did:p})=>{const k=await kt(g);if(!await jt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(y=>y.endpoint===g)){B.error(s("storage.spaces.gateway.add.duplicate",{name:m}));return}await i({name:m,did:p,url:k,endpoint:g},g)},x=async({spaceGateway:g})=>{try{await l(g)}catch(m){console.error(m),B.error(Q(m))}};return e.jsx(ut,{...t,connectScope:"app",options:d,onSuccess:x})}function Ut(){const{api:t}=L(),{blocklet:n}=O(),{data:o,loading:s}=ke(()=>t.getBlocklet({input:{did:n?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!n?.meta?.did,refreshDeps:[n?.meta?.did]});return{blocklet:o?.blocklet??null,loading:s}}function Pe({...t}){const{t:n}=b.useContext(at),{blocklet:o,loading:s}=Ut();if(o?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?nt(d):"empty"})]}),a=o.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:n("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,o.diskInfo.app)},{key:"dataDir",name:n("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,o.diskInfo.data)},{key:"logDir",name:n("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,o.diskInfo.log)},{key:"cacheDir",name:n("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,o.diskInfo.cache)}];return e.jsx(Mt,{component:"div",...t,children:c.map(i=>e.jsx(Dt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return s?e.jsx(z,{}):e.jsx(j,{children:n("blocklet.diskInfo.empty")})}const Mt=_e(j)``;function ve(){const{t}=D(),{setBackupDate:n,backupSummary:o}=U(),s=mt({key:"lg"}),r=b.useRef(null),a=We(),c=b.useCallback(l=>{n(l)},[n]),i=b.useMemo(()=>{const l=E().add(1,"day"),x=l.subtract(1,"year"),g=new Map(o.map(p=>[p.date,{date:p.date,successCount:p.successCount,errorCount:p.errorCount}])),m=[];for(let p=x.clone();E(p).isBefore(l);p=p.add(1,"day")){const k=p.format("YYYY-MM-DD");m.push(g.get(k)||{date:k,successCount:0,errorCount:0})}return m},[o]),d=b.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:S,errorCount:y}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${y}</div>`].join(`
2
+ `)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:J[600]},{min:-9,max:-6,color:J[500]},{min:-6,max:-3,color:J[400]},{min:-3,max:-1,color:J[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:V[300]},{min:3,max:6,color:V[400]},{min:6,max:9,color:V[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:V[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:Ge[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(h,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(h,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Et,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&c(l.data[0])}}})})}),e.jsx(h,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2},children:e.jsxs(G,{direction:s?"column":"row",spacing:s?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center"},children:[e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Nt=fe(({className:t,...n})=>e.jsx(ge,{...n,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ae({status:t,message:n="",createdAt:o}){const{t:s}=D(),r=t===I.BACKUPS.STATUS.PROGRESS&&E().diff(o,"hours")>=I.BACKUPS.TIMEOUT_HOURS,a=r&&s("common.timeoutError"),c=t===I.BACKUPS.STATUS.PROGRESS&&!r,i=t===I.BACKUPS.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):i?e.jsx(q,{type:"success",children:s("common.succeeded")}):e.jsxs(h,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"error",children:s("common.failed")}),e.jsx(ge,{style:{display:"flex",alignItems:"center",flexShrink:0},title:n||a,children:e.jsx(be,{children:e.jsx(Ye,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Ae.propTypes={status:u.string.isRequired,message:u.string,createdAt:u.string.isRequired};function ze({metadata:t={}}){const{t:n}=D();if(H(t))return e.jsx(q,{type:"success",children:n("common.succeeded")});const o=t.count||0,s=t.size||0,r=Tt(s,{iec:!0}),a=e.jsxs(h,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[n("common.fileCount"),": ",o]}),e.jsxs(j,{variant:"body2",children:[n("common.fileSize"),": ",r]})]});return e.jsxs(h,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"success",children:n("common.succeeded")}),e.jsx(Nt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(be,{children:e.jsx(Fe,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}ze.propTypes={metadata:u.object};function Oe(){const{t,locale:n}=D(),{spaceGateways:o,backups:s,backupsLoading:r}=U(),a=b.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:x,createdAt:g}=s[i],m=x===I.BACKUPS.STATUS.PROGRESS&&E().diff(g,"hours")>=I.BACKUPS.TIMEOUT_HOURS,p=x===I.BACKUPS.STATUS.SUCCEEDED&&!m,k=l||o.find(w=>d?.includes(xe(w?.endpoint)))?.name||"Unknown DID Space";return p?e.jsx(Ke,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(q,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:i=>E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:i=>H(i)?"":E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:i=>{const d=s?.[i]??{},{status:l,message:x,createdAt:g,metadata:m}=d,p=l===I.BACKUPS.STATUS.PROGRESS&&E().diff(g,"hours")>=I.BACKUPS.TIMEOUT_HOURS,k=l===I.BACKUPS.STATUS.PROGRESS&&!p,w=l===I.BACKUPS.STATUS.SUCCEEDED&&!p;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(ze,{metadata:m}):e.jsx(Ae,{status:l,message:x,createdAt:g})}}}],[s,o,t]),c=b.useMemo(()=>!s?.length,[s]);return e.jsx(e.Fragment,{children:c?e.jsx(h,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(rt,{title:"",loading:r,data:s,columns:a,emptyNode:t("storage.spaces.record.emptyData",n),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function _t(){const{t}=D();return e.jsxs(h,{children:[e.jsxs(h,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(xt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(Re,{})]}),e.jsxs(h,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(h,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(ve,{})]})]}),e.jsx(Oe,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Le({spaceGateway:t,onConfirm:n=()=>{},onCancel:o=()=>{}}){const{t:s}=D(),[r,a]=b.useState(!1),[c,i]=b.useState(!1),d=(g,m)=>{g?.preventDefault(),g?.stopPropagation(),a(m)},l=async g=>{try{g?.stopPropagation(),i(!0),await n?.(t),a(!1)}catch(m){console.error(m),B.error(`${s("storage.space.gateway.delete.failed")}: ${Q(m)}`)}finally{a(!1),i(!1)}},x=g=>{d(g,!1),o?.(g)};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{color:"red",onClick:g=>d(g,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx($e,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(it,{title:s("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:c}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:c}},onConfirm:l,onCancel:x,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Le.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool}).isRequired,onConfirm:u.func,onCancel:u.func};function Ue({spaceGateway:t,selected:n,onDelete:o=()=>{},onConnect:s=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=U(),[d,l]=b.useState(null),{t:x}=D(),[g,m]=b.useState(!1),p=(S,y)=>{S.stopPropagation(),S.preventDefault(),l(y&&S.currentTarget)},k=async S=>{try{m(!0),p(S,!1),await s(t)}catch(y){console.error(y),B.error(y.message)}finally{m(!1)}},w=async S=>{try{m(!0),p(S,!1),await i()}catch(y){console.error(y),B.error(y.message)}finally{m(!1)}};return e.jsxs(e.Fragment,{children:[g||t?.loading?e.jsx(z,{sx:{ml:1},size:"24px"}):e.jsx(qe,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>p(S,!0),...c,children:e.jsx(He,{})}),e.jsxs(Qe,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:S=>p(S,!1),children:[e.jsxs(F,{onClick:S=>{p(S,!1),window.open(Se(t.endpoint?Ct(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Xe,{fontSize:"small"})}),e.jsx($,{children:x("common.open")})]}),e.jsxs(F,{onClick:S=>{p(S,!1),window.open(Se(wt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Je,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.strategy.viewBackupFiles")})]}),!n&&r&&e.jsxs(F,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ve,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(F,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ze,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Le,{spaceGateway:t,onConfirm:async()=>{l(null),await o?.(t)},onCancel:()=>l(null)})]})]})}Ue.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool,endpoint:u.string.isRequired,loading:u.bool}).isRequired,selected:u.bool.isRequired,enableSwitchToSpace:u.bool,onDelete:u.func,onConnect:u.func,backupInProgress:u.bool};const Wt=fe(({className:t,...n})=>e.jsx(ge,{...n,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Me({spaceGateway:t,spaceStatus:n,selected:o,onConnected:s=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=O(),{api:l,info:{did:x}}=L(),{appDid:g,appName:m,appDescription:p,scopes:k,appUrl:w,referrer:S}=De({blocklet:d}),{backupProgress:y,updateSpaceGateway:Z,deleteSpaceGateway:ee,refreshBackupSummary:te,refreshBackups:se}=U(),[_,M]=b.useState(!1),[T,P]=b.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:m},i),scan:c("storage.spaces.authorize.scan",{appName:m},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{P(C=>({...C,open:!1}))}}),ne=o&&!_&&n===de.DISCONNECTED,oe=o&&!_&&!t.loading&&n===de.CONNECTED,K=o&&_&&n===de.CONNECTED&&y?.progress>=0,X=async()=>{try{if(await Bt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s?.(null,t);return}}catch(C){console.error(C),s?.(C,t);return}P(C=>({...C,open:!0,prefix:me(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:we.create({baseURL:me(t.url,"space")}).get,extraParams:{appDid:g,appName:m,appDescription:p,scopes:k,appUrl:w,referrer:S,nodeDid:x,spaceDid:t.did}}))},ae=async(C,f)=>{const A=f(C.endpoint),R=xe(A),v=C.space?f(C.space):{};if(t.did&&R!==t.did){P(Ne=>({...Ne,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),s?.(new Error(W),t);return}const ce={...t,name:v.name??"DID Space",did:v.did??xe(A),endpoint:A};await Z(ce),P(W=>({...W,open:!1})),s?.(null,ce)},re=async()=>{try{if(_)return;M(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{M(!0)}},ie=async()=>{try{await ee(t),B.success(c("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return b.useEffect(()=>{y?.completed?(o&&(y?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):y.message&&a?.(new Error(y?.message),t),y.progress=0,y.message=""),M(!1),te(),se()):y.progress&&M(!0)},[y]),e.jsxs(e.Fragment,{children:[e.jsxs(h,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[oe&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:re,children:c("storage.spaces.strategy.backupNow")}),ne&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:X,children:c("storage.spaces.disconnected.reconnectNow")}),K&&e.jsx(Wt,{title:y?.message&&e.jsx(h,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:y.message})}),children:e.jsxs(le,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(z,{variant:"determinate",value:y?.progress,size:14,sx:{mr:1}}),y?.progress,"%"]})}),e.jsx(ot,{forceConnected:!1,saveConnect:!1,prefix:T.prefix,open:T.open,popup:!0,action:T.action,baseUrl:T.baseUrl,checkFn:T.checkFn,onSuccess:ae,onClose:T.onClose,checkTimeout:T.checkTimeout,extraParams:T.extraParams,messages:T.messages,locale:i},"get-endpoint")]}),e.jsx(Ue,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:o,onDelete:ie,onConnect:X,enableSwitchToSpace:y?.completed||H(y?.message),backupInProgress:K})]})}Me.propTypes={spaceGateway:u.shape({did:u.string.isRequired,name:u.string.isRequired,url:u.string.isRequired,endpoint:u.string.isRequired,protected:u.bool,loading:u.bool}).isRequired,spaceStatus:u.string.isRequired,selected:u.bool.isRequired,onConnected:u.func,onDeleted:u.func,onBackedUp:u.func};function Gt({...t}){const{t:n}=D();return e.jsxs(h,{...t,children:[e.jsx(h,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:n("storage.spaces.backup.records")})}),e.jsx(ve,{}),e.jsx(Oe,{})]})}function Kt({...t}){const{t:n}=D(),{autoBackup:o,updateAutoBackup:s}=U(),r=async()=>{try{const a=!o?.enabled;await s({enabled:a}),B.success(n(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(It,{checked:!!o?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:n("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function Ft(){const{t}=D(),{spaceGateways:n,spaceGatewaysLoading:o,spaceGatewayIsSelected:s}=U(),r=o&&!n?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(Me,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:x=>x&&l()});return e.jsxs(h,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(Kt,{}),e.jsx(Re,{})]}),e.jsx(h,{sx:{mt:2},children:r?e.jsx(h,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(z,{})}):e.jsx(he,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:n.map(c=>e.jsx(he,{size:{xs:12,md:6},children:e.jsx(ft,{endpoint:c.endpoint,selected:s(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(Gt,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Yt(){const{spaceGatewaysFirstLoading:t,spaceGateways:n}=U();return t?e.jsx(Be,{relative:"parent",children:e.jsx(z,{})}):H(n)?e.jsx(_t,{}):e.jsx(Ft,{})}function $t(){return e.jsx(Ie,{children:e.jsx(Yt,{})})}function qt(){const{spaceGateway:t,settingStorageEndpoint:n,updateSpaceGateway:o,hasStorageEndpoint:s,loading:r,storageEndpoint:a}=Pt(),c=ue(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Be,{relative:"parent",children:e.jsx(z,{})}):e.jsxs(h,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(gt,{spaceGateway:t,settingStorageEndpoint:n}):e.jsx(ht,{}),e.jsx(h,{sx:c,children:e.jsx(St,{onConnect:o,storageEndpoint:a})})]})}function Ht(){const{t}=D();return e.jsxs(Rt,{children:[e.jsxs(G,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(qt,{})]})}function Qt({navOrientation:t="vertical",...n}){const{t:o,locale:s}=D(),{blocklet:r}=O(),a=lt({key:"md"}),[c,i]=et(),d=c.get("tab")||"backup",l=a?"horizontal":t,x=ue(()=>{const w=[{label:o("common.backup"),value:"backup"}],S=r?.capabilities?.didSpace;return(S===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:o("common.storage"),value:"storage"}),w},[s,l]),m=ue(()=>({backup:e.jsx($t,{}),storage:e.jsx(Ht,{})}))[d],p=w=>{i(S=>(w==="backup"?S.delete("tab"):S.set("tab",w),S))};if(x.length<=1)return e.jsx(pe,{children:m});const k=e.jsx(ct,{tabs:x,current:d,orientation:l,onChange:p,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(h,{...n,children:e.jsxs(G,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(h,{sx:{flexShrink:0},children:e.jsx(ye,{left:k})}),e.jsx(h,{sx:{flexGrow:1,minWidth:0},children:e.jsx(pe,{sx:{mt:1},children:m})})]})});if(l==="horizontal")return e.jsxs(h,{...n,children:[e.jsx(ye,{left:k}),e.jsx(pe,{sx:{mt:2},children:m})]})}Qt.propTypes={navOrientation:u.oneOf(["vertical","horizontal"])};const pe=fe(h)`
3
+ position: relative;
4
+ min-height: 66vh;
5
+ overflow: hidden;
6
+ `;export{Qt as default};
@@ -1,4 +1,4 @@
1
- import{r as u}from"./vendor-react-Dvs43sk9.js";import{W as o,j as e,ak as j,aN as L,z as A,at as K,bm as B,I as P,a6 as W,bE as M,aj as X,bF as H}from"./vendor-mui-core-DV92LEhm.js";import{C as G}from"./Google-C3EYOLRU.js";import{c as U}from"./vendor-ux-C9Q7otQi.js";import{aH as Y,f as $}from"./index-CBuBVmWe.js";import{A as J}from"./vendor-arcblock-D_Dm09bZ.js";import{R as Q}from"./required-2qxcR9JF.js";import{F as Z}from"./form-wrapper-DihET07L.js";import{L as v}from"./logo-uploader-BayOewpo.js";import{A as ee,a as ne,b as te}from"./collapse-XWrflTSv.js";const S={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function T({editing:n,value:s,onChange:l}){const[i,c]=u.useState(!1),m=u.useRef(),f=u.useRef(s);u.useEffect(()=>{let a=null;return n&&(a=setTimeout(()=>{c(!0)},50)),()=>{clearTimeout(a)}},[n]);const h=a=>{f.current=a,l(a)},b=()=>{c(!1),l(f.current)},y=e.jsx(j,{className:"form-item-input slot",sx:{px:1},children:e.jsxs(j,{sx:{display:"flex",alignItems:"center"},children:[s,s!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:s,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),p=e.jsxs(j,{onKeyDown:b,sx:{display:"flex",flexGrow:1,alignItems:"center",height:"40px"},children:[e.jsx(j,{onClick:()=>c(!0),sx:{display:"flex",alignItems:"center"},children:e.jsx("div",{ref:m,style:{flexShrink:0,marginLeft:"8px",backgroundColor:s,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:s==="auto"?"default":"pointer"}})}),e.jsx(L,{open:i,anchorEl:m.current,onClose:()=>c(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(G,{color:s,onChange:a=>h(a.hex)})})]});return n?p:y}T.propTypes=S;function D({editing:n,description:s,value:l,onChange:i,componentProps:c={},...m}){const{placeholder:f}=c,h=u.useRef(l),{t:b}=u.useContext(U),y=a=>{a.key==="Enter"&&i(h.current,"confirm")},p=a=>{h.current=a,i(a)};return n?e.jsx(A,{style:{flex:1},fullWidth:!0,value:l,onChange:a=>{a.persist(),p(a.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:s||f,onKeyDown:y,...m}):e.jsx(j,{className:"form-item-input slot",sx:{px:1},children:l||e.jsx("span",{className:"placeholder",children:b("common.requiredInputPlaceholder",{name:s||f})})})}D.propTypes=S;function O({editing:n,value:s,onChange:l,componentProps:i,...c}){const{blocklet:m}=i,f=s==="auto"?J(m.appDid):s;return e.jsxs(j,{sx:{display:"flex",alignItems:"center"},children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:Y({title:"Owner",issuer:$.getDisplayName(m),issuerDid:m.appDid,ownerName:"Your Name",ownerDid:m.appDid,preferredColor:s||"auto"})}}),e.jsx(T,{...c,editing:n,value:n?f:s,onChange:l,componentProps:i})]})}O.propTypes={...S,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};const re=H`
1
+ import{r as u}from"./vendor-react-Dvs43sk9.js";import{W as o,j as e,ak as j,aN as L,z as A,at as K,bm as B,I as P,a6 as W,bE as M,aj as X,bF as G}from"./vendor-mui-core-B7zoO8f5.js";import{C as H}from"./Google-Sm1AunGv.js";import{G as U}from"./vendor-ux-B7q8W4Pg.js";import{aK as Y,f as $}from"./index-CuQBOJqN.js";import{A as J}from"./vendor-arcblock-B7AoUs4o.js";import{R as Q}from"./required-CobBjKC9.js";import{F as Z}from"./form-wrapper-CHYdE4By.js";import{L as v}from"./logo-uploader-C0ihL7E6.js";import{A as ee,a as ne,b as te}from"./collapse-C-BNkgS6.js";const S={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function T({editing:n,value:s,onChange:l}){const[i,c]=u.useState(!1),m=u.useRef(),f=u.useRef(s);u.useEffect(()=>{let a=null;return n&&(a=setTimeout(()=>{c(!0)},50)),()=>{clearTimeout(a)}},[n]);const h=a=>{f.current=a,l(a)},b=()=>{c(!1),l(f.current)},y=e.jsx(j,{className:"form-item-input slot",sx:{px:1},children:e.jsxs(j,{sx:{display:"flex",alignItems:"center"},children:[s,s!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:s,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),p=e.jsxs(j,{onKeyDown:b,sx:{display:"flex",flexGrow:1,alignItems:"center",height:"40px"},children:[e.jsx(j,{onClick:()=>c(!0),sx:{display:"flex",alignItems:"center"},children:e.jsx("div",{ref:m,style:{flexShrink:0,marginLeft:"8px",backgroundColor:s,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:s==="auto"?"default":"pointer"}})}),e.jsx(L,{open:i,anchorEl:m.current,onClose:()=>c(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(H,{color:s,onChange:a=>h(a.hex)})})]});return n?p:y}T.propTypes=S;function D({editing:n,description:s,value:l,onChange:i,componentProps:c={},...m}){const{placeholder:f}=c,h=u.useRef(l),{t:b}=u.useContext(U),y=a=>{a.key==="Enter"&&i(h.current,"confirm")},p=a=>{h.current=a,i(a)};return n?e.jsx(A,{style:{flex:1},fullWidth:!0,value:l,onChange:a=>{a.persist(),p(a.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:s||f,onKeyDown:y,...m}):e.jsx(j,{className:"form-item-input slot",sx:{px:1},children:l||e.jsx("span",{className:"placeholder",children:b("common.requiredInputPlaceholder",{name:s||f})})})}D.propTypes=S;function O({editing:n,value:s,onChange:l,componentProps:i,...c}){const{blocklet:m}=i,f=s==="auto"?J(m.appDid):s;return e.jsxs(j,{sx:{display:"flex",alignItems:"center"},children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:Y({title:"Owner",issuer:$.getDisplayName(m),issuerDid:m.appDid,ownerName:"Your Name",ownerDid:m.appDid,preferredColor:s||"auto"})}}),e.jsx(T,{...c,editing:n,value:n?f:s,onChange:l,componentProps:i})]})}O.propTypes={...S,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};const re=G`
2
2
  0%, 100% {
3
3
  transform: scale(1) translateX(0);
4
4
  }
@@ -1,4 +1,4 @@
1
- import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k as re}from"./vendor-hooks-9cd36rYd.js";import{j as e,ak as g,at as q,b1 as ee,a6 as M,aX as _e,am as K,cw as ft,U as xt,T as E,a3 as ht,W as w,z as $,M as ae,I as W,cF as $e,cf as me,A as gt,x as Oe,c2 as We,c3 as X,bv as qe,F as He,bC as yt,b6 as jt,a5 as vt,J as Ct,Q as bt,bb as St,s as wt}from"./vendor-mui-core-DV92LEhm.js";import{T as F,b as H,j as Tt,L as fe,C as le,H as R,n as L,I as xe,G as Ue,v as Ge,a2 as It,E as De,S as Dt,Z as Pt}from"./vendor-ux-C9Q7otQi.js";import{Y as k,p as Rt,an as Ve,c as U,B as J,a7 as kt,aH as At,f as Ft,W as Nt,ap as se,ba as Lt,bd as Ye}from"./index-CBuBVmWe.js";import{W as he}from"./did-address-CY4nLJqm.js";import{u as _}from"./team-C8yfeoct.js";import{a as ge,r as ye,b as je,c as Ke,d as ne,e as Bt,u as zt,f as Et}from"./passport-item-Bej8KfmX.js";import{p as Ze}from"./util-Dceeaiqy.js";import{u as Mt}from"./use-mobile-BcHeqFSk.js";import{v as Q}from"./index-DYgvuymH.js";import{w as G,P as Je}from"./permission-BPBzp1tm.js";import{C as _t}from"./Google-C3EYOLRU.js";import{A as $t}from"./vendor-arcblock-D_Dm09bZ.js";import{G as Z,a0 as Ot,H as Wt}from"./vendor-utils-CddrUZ58.js";import{e as oe}from"./edit.svg-DycWG9v3.js";import{C as ve}from"./confirm-DTV46cI2.js";import{L as Qe}from"./list-header-bAafK8zK.js";import{f as te}from"./index-DBs9Ljax.js";import{u as qt}from"./useSetState-DFuQZPPV.js";import{C as Ht}from"./lock.svg-COUP8tyO.js";import"./lottie-web-4koyQiv_.js";import"./session-DW40g2df.js";import"./isURL-BZcSl4qG.js";import"./use-app-logo-pyV6ZPrc.js";import"./index-CX5AEYFR.js";import"./base32-rvunYmjt.js";import"./cloneDeep-KmDjD-jP.js";const ie=u=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...u},C.createElement("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})),Pe="info";function Xe({createPassportSvg:u,passport:o,onCancel:i,onSwitchPassport:p=()=>{}}){const{t:m}=F(),l=mt({tab:Pe}),h={info:{label:m("common.basicInfo"),value:Pe,component:()=>e.jsx(et,{passport:o,createPassportSvg:u})},logs:{label:m("common.logs"),value:"logs",component:()=>e.jsx(rt,{passport:o})},related:{label:m("team.passport.related"),value:"related",component:()=>e.jsx(at,{passport:o,onSwitchPassport:p})}},a=Object.values(h).map(({label:r,value:t})=>({label:r,value:t})).filter(r=>r.value==="related"?o.parentDid:!0),f=h[l.tab]||h.info,s=r=>{l.tab=r};return e.jsx(H,{title:m("common.passport"),onClose:i,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ut,{children:[e.jsx(g,{className:"tabs",children:e.jsx(Tt,{tabs:a,current:l.tab,onChange:s,scrollButtons:"auto"})}),e.jsx(g,{className:"body",children:e.jsx(f.component,{})})]})})}Xe.propTypes={createPassportSvg:w.func.isRequired,passport:w.object.isRequired,onCancel:w.func.isRequired,onSwitchPassport:w.func};const Ut=q(g)`
1
+ import{r as b,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k as re}from"./vendor-hooks-BRXKH6Nb.js";import{j as e,ak as g,at as W,b1 as ee,a6 as M,aX as _e,am as Y,cw as ft,U as xt,T as E,a3 as ht,W as w,z as $,M as ae,I as q,cF as $e,ck as me,A as gt,x as Oe,c2 as qe,c3 as X,bv as We,F as He,bC as yt,b6 as jt,a5 as vt,J as bt,Q as Ct,bb as St,s as wt}from"./vendor-mui-core-B7zoO8f5.js";import{T as F,F as H,L as Tt,ab as fe,a5 as le,H as R,D as L,a9 as xe,a8 as Ue,ak as Dt,E as Ie,a7 as It,ah as Pt}from"./vendor-ux-B7q8W4Pg.js";import{Z as k,p as Rt,ao as Ge,c as U,B as J,a8 as kt,aK as At,f as Ft,X as Nt,aq as se,be as Ve,bf as Lt,bi as Ke}from"./index-CuQBOJqN.js";import{W as he}from"./did-address-CcsL3-Qm.js";import{u as _}from"./team-Dl23XmaY.js";import{r as ge,a as ye,b as je,c as Ye,d as ne,e as Bt,u as zt,f as Et}from"./passport-item-VXkf3FVk.js";import{p as Ze}from"./util-Ca2jlZN4.js";import{u as Mt}from"./use-mobile-C_DcJ5SZ.js";import{v as Q}from"./index-C-DpXzH8.js";import{w as G,P as Je}from"./permission-DeQz9qFD.js";import{C as _t}from"./Google-Sm1AunGv.js";import{A as $t}from"./vendor-arcblock-B7AoUs4o.js";import{G as Z,a0 as Ot,H as qt}from"./vendor-utils-DtY42AM-.js";import{e as oe}from"./edit.svg-DycWG9v3.js";import{C as ve}from"./confirm-C9tgdTJT.js";import{L as Qe}from"./list-header-BQx81X9X.js";import{f as te}from"./index-DBs9Ljax.js";import{u as Wt}from"./useSetState-DFuQZPPV.js";import{C as Ht}from"./lock.svg-COUP8tyO.js";import"./lottie-web-4koyQiv_.js";import"./session-Bk6ebojT.js";import"./isURL-Cuto2_sB.js";import"./use-app-logo-7cjs_pn8.js";import"./index-DzqNo2lD.js";import"./base32-D7JDMggs.js";import"./cloneDeep-DqaMBldf.js";const ie=u=>b.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...u},b.createElement("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})),Pe="info";function Xe({createPassportSvg:u,passport:o,onCancel:i,onSwitchPassport:p=()=>{}}){const{t:m}=F(),l=mt({tab:Pe}),h={info:{label:m("common.basicInfo"),value:Pe,component:()=>e.jsx(et,{passport:o,createPassportSvg:u})},logs:{label:m("common.logs"),value:"logs",component:()=>e.jsx(rt,{passport:o})},related:{label:m("team.passport.related"),value:"related",component:()=>e.jsx(at,{passport:o,onSwitchPassport:p})}},a=Object.values(h).map(({label:r,value:t})=>({label:r,value:t})).filter(r=>r.value==="related"?o.parentDid:!0),f=h[l.tab]||h.info,s=r=>{l.tab=r};return e.jsx(H,{title:m("common.passport"),onClose:i,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ut,{children:[e.jsx(g,{className:"tabs",children:e.jsx(Tt,{tabs:a,current:l.tab,onChange:s,scrollButtons:"auto"})}),e.jsx(g,{className:"body",children:e.jsx(f.component,{})})]})})}Xe.propTypes={createPassportSvg:w.func.isRequired,passport:w.object.isRequired,onCancel:w.func.isRequired,onSwitchPassport:w.func};const Ut=W(g)`
2
2
  margin-top: -16px;
3
3
 
4
4
  .tabs {
@@ -9,7 +9,7 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
9
9
  .body {
10
10
  margin-top: 24px;
11
11
  }
12
- `;function et({createPassportSvg:u,passport:o}){const{t:i,locale:p}=F(),{teamDid:m}=_(),{inService:l}=k(),h=Mt(),a=[{items:[{label:i("common.role"),content:ge(o.title)},{label:i("common.did"),content:e.jsx(he,{did:o.id})},{label:i("team.passport.status"),content:je(o.status)},{label:i("common.type"),content:e.jsx(g,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:(o.type||[]).map(s=>e.jsx(xt,{label:s,variant:"outlined",size:"small",sx:{borderRadius:1}},s))})}]}],f=[{title:i("team.passport.owner"),items:[{label:i("team.passport.owner"),content:e.jsx(g,{children:ye(o.user,l)})}]},{title:i("common.timeInfo"),items:[{label:i("team.passport.issuanceTime"),content:o.issuanceDate?e.jsx(le,{value:o.issuanceDate,type:"all",locale:p}):"-"},{label:i("team.member.lastLogin"),content:o.lastLoginAt?e.jsx(le,{value:o.lastLoginAt,type:"all",locale:p}):"-"},{label:i("common.expires"),content:o.expirationDate?e.jsx(le,{value:o.expirationDate,type:"all",locale:p}):"-"}]},{title:i("blocklet.overview.source"),items:[{label:i("blocklet.overview.source"),content:ne(o.source)}]}];return e.jsxs(Gt,{gap:3,children:[e.jsxs(g,{sx:{display:"flex",flexDirection:h?"column":"row",alignItems:h?"flex-start":"center",justifyContent:h?"center":"flex-start",width:"100%",overflow:"hidden",gap:h?2:4},children:[e.jsx(g,{sx:{display:"flex",width:"180px"},className:"passport-image",dangerouslySetInnerHTML:{__html:u({scope:o.scope,role:o.role,title:o.scope==="kyc"?o.name:o.title,issuer:o.issuer&&o.issuer.name,issuerDid:o.issuer&&o.issuer.id,ownerName:o.user?.fullName,ownerDid:o.user?.did,ownerAvatarUrl:o.user?.avatar?Ze(o.user?.avatar,m,l):"",revoked:o.revoked,extra:o?.expirationDate?{key:"Exp",value:Ve(o.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}}),e.jsx(g,{className:"info-area",children:a.map(s=>e.jsxs(g,{children:[s.title&&e.jsx(E,{variant:"h6",sx:{mb:2},children:s.title}),e.jsx(g,{className:"info-grid",sx:{gap:"12px !important"},children:s.items.map(r=>e.jsxs(g,{className:"info-item",children:[e.jsx(g,{className:"info-label",sx:{maxWidth:40},children:e.jsx(E,{variant:"subtitle2",color:"textSecondary",children:r.label})}),e.jsx(g,{sx:{display:"flex",flexWrap:"wrap",gap:.5,minWidth:0},children:r.content})]},r.label))})]},s.title))})]}),e.jsx(ht,{}),e.jsx(g,{className:"info-area",children:f.map(s=>e.jsxs(g,{children:[e.jsx(E,{variant:"h5",sx:{mb:1.5},children:s.title}),e.jsx(g,{className:"info-grid",children:s.items.map(r=>e.jsxs(g,{className:"info-item",children:[e.jsx(g,{className:"info-label",children:e.jsx(E,{variant:"subtitle2",color:"textSecondary",children:r.label})}),e.jsx(g,{sx:{minWidth:500},children:r.content})]},r.label))})]},s.title))})]})}et.propTypes={passport:w.object.isRequired,createPassportSvg:w.func.isRequired};const Gt=q(ee)`
12
+ `;function et({createPassportSvg:u,passport:o}){const{t:i,locale:p}=F(),{teamDid:m}=_(),{inService:l}=k(),h=Mt(),a=[{items:[{label:i("common.role"),content:ge(o.title)},{label:i("common.did"),content:e.jsx(he,{did:o.id})},{label:i("team.passport.status"),content:je(o.status)},{label:i("common.type"),content:e.jsx(g,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:(o.type||[]).map(s=>e.jsx(xt,{label:s,variant:"outlined",size:"small",sx:{borderRadius:1}},s))})}]}],f=[{title:i("team.passport.owner"),items:[{label:i("team.passport.owner"),content:e.jsx(g,{children:ye(o.user,l)})}]},{title:i("common.timeInfo"),items:[{label:i("team.passport.issuanceTime"),content:o.issuanceDate?e.jsx(le,{value:o.issuanceDate,type:"all",locale:p}):"-"},{label:i("team.member.lastLogin"),content:o.lastLoginAt?e.jsx(le,{value:o.lastLoginAt,type:"all",locale:p}):"-"},{label:i("common.expires"),content:o.expirationDate?e.jsx(le,{value:o.expirationDate,type:"all",locale:p}):"-"}]},{title:i("blocklet.overview.source"),items:[{label:i("blocklet.overview.source"),content:ne(o.source)}]}];return e.jsxs(Gt,{gap:3,children:[e.jsxs(g,{sx:{display:"flex",flexDirection:h?"column":"row",alignItems:h?"flex-start":"center",justifyContent:h?"center":"flex-start",width:"100%",overflow:"hidden",gap:h?2:4},children:[e.jsx(g,{sx:{display:"flex",width:"180px"},className:"passport-image",dangerouslySetInnerHTML:{__html:u({scope:o.scope,role:o.role,title:o.scope==="kyc"?o.name:o.title,issuer:o.issuer&&o.issuer.name,issuerDid:o.issuer&&o.issuer.id,ownerName:o.user?.fullName,ownerDid:o.user?.did,ownerAvatarUrl:o.user?.avatar?Ze(o.user?.avatar,m,l):"",revoked:o.revoked,extra:o?.expirationDate?{key:"Exp",value:Ge(o.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}}),e.jsx(g,{className:"info-area",children:a.map(s=>e.jsxs(g,{children:[s.title&&e.jsx(E,{variant:"h6",sx:{mb:2},children:s.title}),e.jsx(g,{className:"info-grid",sx:{gap:"12px !important"},children:s.items.map(r=>e.jsxs(g,{className:"info-item",children:[e.jsx(g,{className:"info-label",sx:{maxWidth:40},children:e.jsx(E,{variant:"subtitle2",color:"textSecondary",children:r.label})}),e.jsx(g,{sx:{display:"flex",flexWrap:"wrap",gap:.5,minWidth:0},children:r.content})]},r.label))})]},s.title))})]}),e.jsx(ht,{}),e.jsx(g,{className:"info-area",children:f.map(s=>e.jsxs(g,{children:[e.jsx(E,{variant:"h5",sx:{mb:1.5},children:s.title}),e.jsx(g,{className:"info-grid",children:s.items.map(r=>e.jsxs(g,{className:"info-item",children:[e.jsx(g,{className:"info-label",children:e.jsx(E,{variant:"subtitle2",color:"textSecondary",children:r.label})}),e.jsx(g,{sx:{minWidth:500},children:r.content})]},r.label))})]},s.title))})]})}et.propTypes={passport:w.object.isRequired,createPassportSvg:w.func.isRequired};const Gt=W(ee)`
13
13
  .info-card {
14
14
  margin-bottom: 24px;
15
15
  overflow: hidden;
@@ -87,7 +87,7 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
87
87
  margin: 0;
88
88
  }
89
89
  }
90
- `,tt=10,st=1;function rt({passport:u}){const{api:o}=k(),{teamDid:i}=_(),{t:p,locale:m}=F(),[l,h]=C.useState({pageSize:tt,page:st}),{data:a,loading:f}=re(async()=>{const y={teamDid:i,query:{passportId:u.id},paging:{page:l.page,pageSize:l.pageSize}},x=await o.getPassportLogs({input:y});return{logs:x.passportLogs||[],total:x.paging.total}},{refreshDeps:[l.page,l.pageSize],onError:y=>R.error(y.message)}),s=C.useMemo(()=>a?.logs||[],[a?.logs]),r=y=>y.action===U.PASSPORT_LOG_ACTION.APPROVE||y.action===U.PASSPORT_LOG_ACTION.REVOKE?y?.metadata?.operator?.fullName?`${p("common.operator")}: ${y?.metadata?.operator?.fullName}`:null:y.action===U.PASSPORT_LOG_ACTION.ISSUE&&y.metadata?.action===U.PASSPORT_ISSUE_ACTION.ISSUE_ON_INVITE?y?.metadata?.inviter?.fullName?`${p("common.inviter")}: ${y?.metadata?.inviter?.fullName}`:null:`passportId: ${y.passportId}`,t=C.useMemo(()=>[{label:p("common.action"),name:"action",options:{customBodyRender:(y,{rowIndex:x})=>{const d=s[x];return e.jsx(K,{title:r(d),children:`${y} ${d.metadata?.action?`(${d.metadata.action})`:""}`})}}},{label:"IP",name:"operatorIp",options:{customBodyRender:y=>e.jsx(g,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:y||"-"})})}},{label:"UA",width:250,name:"operatorUa",options:{customBodyRender:(y,{rowIndex:x})=>{const d=s[x];return e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[d.operatorUa&&e.jsx(g,{children:Bt(d.operatorUa)}),d.operatorUa&&e.jsx(K,{title:d.operatorUa,children:e.jsx(ft,{fontSize:"small",color:"action",sx:{fontSize:16,cursor:"pointer"}})})]})}}},{label:p("common.createdAt"),name:"createdAt",options:{customBodyRender:y=>Rt(y,m)}}],[p,m,s]),n=({page:y,rowsPerPage:x})=>{l.pageSize!==x?h(d=>({...d,pageSize:x,page:1})):l.page!==y+1&&h(d=>({...d,page:y+1}))},c={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:l.page-1,rowsPerPage:l.pageSize,count:a?.total||0};return f?e.jsx(g,{sx:{py:2},children:e.jsx(ee,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsx(g,{children:e.jsx(fe,{className:"logs-table",verticalKeyWidth:100,locale:m,data:s,columns:t,options:c,loading:f,onChange:n})})}rt.propTypes={passport:w.object.isRequired};function at({passport:u,onSwitchPassport:o}){const{api:i}=k(),{teamDid:p}=_(),{t:m,locale:l}=F(),[h,a]=C.useState({pageSize:tt,page:st}),{data:f,loading:s}=re(async()=>{const x={teamDid:p,passportId:u.parentDid,paging:{page:h.page,pageSize:h.pageSize}},d=await i.getRelatedPassports({input:x});return{passports:d.passports||[],total:d.paging.total}},{refreshDeps:[h.page,h.pageSize],onError:x=>R.error(x.message)}),r=C.useMemo(()=>f?.passports||[],[f?.passports]),t=C.useMemo(()=>[{label:m("team.passport.role"),name:"role",options:{customBodyRender:ge}},{label:m("team.passport.owner"),name:"user",options:{customBodyRender:ye}},{label:m("team.passport.status"),name:"status",options:{customBodyRender:je}},{label:m("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:x=>Ke(x,l)}},{label:m("blocklet.overview.source"),name:"source",options:{customBodyRender:ne}}],[m,l]),n=({page:x,rowsPerPage:d})=>{h.pageSize!==d?a(j=>({...j,pageSize:d,page:1})):h.page!==x+1&&a(j=>({...j,page:x+1}))},c=C.useRef(null),y={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:h.page-1,rowsPerPage:h.pageSize,count:f?.total||0,onRowClick(x,{dataIndex:d},j){if(c.current?.contains(j.target)){const S=r[d];o(S)}}};return s?e.jsx(g,{sx:{py:2},children:e.jsx(ee,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsxs(ee,{spacing:1,children:[e.jsx(_e,{severity:"warning",children:m("team.passport.relatedDescription")}),e.jsx(g,{ref:c,sx:{".MuiTableRow-root":{cursor:"pointer"}},children:e.jsx(fe,{className:"related-table",verticalKeyWidth:100,locale:l,data:r.filter(x=>x.id!==u.id),columns:t,options:y,loading:s,onChange:n})})]})}at.propTypes={passport:w.object.isRequired,onSwitchPassport:w.func.isRequired};function Ce({onCancel:u,onSuccess:o}){const{api:i}=k(),{blocklet:p}=kt(),{t:m}=F(),[l,h]=C.useState(!1),a=(p.environments.find(n=>n.key==="BLOCKLET_PASSPORT_COLOR")||{}).value||"auto",f=a==="auto"?$t(p.appDid):a,[s,r]=C.useState(f),t=async()=>{const n=[{key:Nt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR,value:s}];try{h(!0),await i.configBlocklet({input:{did:p.meta.did,configs:n}}),o()}catch(c){R.error(c.message)}finally{h(!1)}};return e.jsx(H,{title:m("team.passport.color"),onClose:u,open:!0,fullWidth:!0,actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:m("common.cancel")}),e.jsxs(L,{onClick:t,color:"primary",disabled:l,variant:"contained",autoFocus:!0,"data-cy":"color-btn-confirm",children:[l&&e.jsx(M,{size:16}),m("common.save")]})]}),children:e.jsxs(g,{className:"dialog-content",sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:[e.jsx(_t,{disableAlpha:!0,color:s,onChange:n=>r(n.hex)}),e.jsx("div",{style:{width:220,marginLeft:24},dangerouslySetInnerHTML:{__html:At({scope:"passport",role:"owner",title:"Owner",issuer:Ft.getDisplayName(p),issuerDid:p.appDid,ownerName:"Your Name",ownerDid:p.appDid,preferredColor:s})}})]})})}const Vt=G(Ce,"mutate_team"),Yt=G(Ce,"",J);function Kt(u){const{inService:o}=k();return o?e.jsx(Yt,{...u}):e.jsx(Vt,{...u})}Ce.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired};var nt=function(o){return e.jsx("svg",{...o,children:e.jsx("path",{d:"M64.707 8.707a1 1 0 0 0 0-1.414L58.343.929a1 1 0 1 0-1.414 1.414L62.586 8l-5.657 5.657a1 1 0 0 0 1.414 1.414l6.364-6.364ZM0 9h64V7H0v2Z",fill:"#666"})})};nt.defaultProps={width:"65",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};const Zt=(u,o)=>u?!o.some(i=>!i.from.passport||!i.to.role):!1;function ot({onCancel:u,onSuccess:o,data:i={},trustedPassports:p=[]}){const{api:m}=k(),{roles:l,teamDid:h}=_(),{t:a}=F(),[f,s]=C.useState(!1),[r,t]=C.useState(i.issuerDid||""),[n,c]=C.useState(i.remark||""),[y,x]=C.useState(Z(i.mappings)||[]),d=p.findIndex(S=>S.issuerDid===i.issuerDid),j=async()=>{if(f)return;const S={issuerDid:r,remark:n,mappings:y.map(b=>({...b,to:{...b.to,ttl:b.to.ttl||0}}))},T=[...p];d===-1?T.unshift(S):T[d]=S;try{s(!0),await m.configTrustedPassports({input:{teamDid:h,trustedPassports:T}}),await se(800),s(!1),R.success(a("common.saveSuccess")),o()}catch(b){s(!1),R.error(te(b))}};return e.jsx(H,{title:a("team.passport.trustedIssuers"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(W,{onClick:u,"data-cy":"trusted-issuer-close",size:"large",children:e.jsx($e,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:a("common.cancel")}),e.jsxs(L,{onClick:()=>j(),color:"primary",disabled:!Zt(r,y)||!n||f,variant:"contained",autoFocus:!0,"data-cy":"save-mapping",children:[f&&e.jsx(M,{size:16}),a("common.save")]})]}),children:e.jsx(Jt,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx($,{fullWidth:!0,"data-cy":"input-issuer-did",placeholder:a("team.passport.issuerDid"),value:r,onChange:S=>{t(S.target.value)}}),e.jsx($,{style:{marginTop:16},fullWidth:!0,"data-cy":"input-issuer-remark",placeholder:a("common.remark"),value:n,onChange:S=>{c(S.target.value)}}),e.jsxs(g,{sx:{mt:"30px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(g,{className:"dialog-h1",children:a("team.passport.mappingRule")}),e.jsx(g,{children:e.jsx(L,{variant:"outlined",color:"primary","data-cy":"add-mapping",onClick:()=>{x(S=>{const T=[...S];return T.unshift({from:{passport:""},to:{role:U.ROLES.GUEST}}),T})},children:a("team.add")})})]}),e.jsxs(g,{className:"list",sx:{mt:-.5},children:[y.map((S,T)=>e.jsxs(g,{className:"mapping-item",sx:{display:"flex",alignItems:"center",justifyContent:"space-between",my:1},children:[e.jsxs(g,{sx:{display:"flex",alignItems:"center",flexGrow:1},children:[e.jsx(g,{sx:{flexGrow:1,flexBasis:1},children:e.jsx($,{fullWidth:!0,size:"small","data-cy":`input-${T}-from`,placeholder:"Issuer’s Passport Name/ID *",value:S.from.passport,onChange:b=>{const{value:P}=b.target;x(I=>{const B=[...I];return B[T].from.passport=P,B})},sx:{"& .MuiInputBase-input::placeholder":{fontSize:14},"& .Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"primary.main"}}})}),e.jsx(g,{sx:{flexShrink:0,mx:1,width:65,height:16},children:e.jsx(nt,{})}),e.jsx(g,{sx:{flexGrow:1,flexBasis:1},children:e.jsx($,{fullWidth:!0,size:"small",select:!0,value:S.to.role,onChange:b=>{x(P=>{const I=[...P];return I[T].to.role=b.target.value,I})},variant:"outlined",children:l.filter(b=>b.name!=="owner").map(b=>e.jsx(ae,{value:b.name,"data-cy":`passport-mapping-select-option-${b.name}`,children:e.jsx("span",{children:b.title||b.name})},b.name))})})]}),e.jsx(g,{sx:{flexShrink:0},children:e.jsx(W,{onClick:()=>{x(b=>{const P=[...b];return P.splice(T,1),P})},size:"large",children:e.jsx(ie,{})})})]},`mapping-${T}`)),!y.length&&e.jsx(g,{sx:{my:2,color:"text.secondary",fontSize:"16px"},children:e.jsx(xe,{children:a("common.empty")})})]})]})})})}ot.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired,trustedPassports:w.array,data:w.object};const Jt=q.div`
90
+ `,tt=10,st=1;function rt({passport:u}){const{api:o}=k(),{teamDid:i}=_(),{t:p,locale:m}=F(),[l,h]=b.useState({pageSize:tt,page:st}),{data:a,loading:f}=re(async()=>{const y={teamDid:i,query:{passportId:u.id},paging:{page:l.page,pageSize:l.pageSize}},x=await o.getPassportLogs({input:y});return{logs:x.passportLogs||[],total:x.paging.total}},{refreshDeps:[l.page,l.pageSize],onError:y=>R.error(y.message)}),s=b.useMemo(()=>a?.logs||[],[a?.logs]),r=y=>y.action===U.PASSPORT_LOG_ACTION.APPROVE||y.action===U.PASSPORT_LOG_ACTION.REVOKE?y?.metadata?.operator?.fullName?`${p("common.operator")}: ${y?.metadata?.operator?.fullName}`:null:y.action===U.PASSPORT_LOG_ACTION.ISSUE&&y.metadata?.action===U.PASSPORT_ISSUE_ACTION.ISSUE_ON_INVITE?y?.metadata?.inviter?.fullName?`${p("common.inviter")}: ${y?.metadata?.inviter?.fullName}`:null:`passportId: ${y.passportId}`,t=b.useMemo(()=>[{label:p("common.action"),name:"action",options:{customBodyRender:(y,{rowIndex:x})=>{const d=s[x];return e.jsx(Y,{title:r(d),children:`${y} ${d.metadata?.action?`(${d.metadata.action})`:""}`})}}},{label:"IP",name:"operatorIp",options:{customBodyRender:y=>e.jsx(g,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:y||"-"})})}},{label:"UA",width:250,name:"operatorUa",options:{customBodyRender:(y,{rowIndex:x})=>{const d=s[x];return e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[d.operatorUa&&e.jsx(g,{children:Bt(d.operatorUa)}),d.operatorUa&&e.jsx(Y,{title:d.operatorUa,children:e.jsx(ft,{fontSize:"small",color:"action",sx:{fontSize:16,cursor:"pointer"}})})]})}}},{label:p("common.createdAt"),name:"createdAt",options:{customBodyRender:y=>Rt(y,m)}}],[p,m,s]),n=({page:y,rowsPerPage:x})=>{l.pageSize!==x?h(d=>({...d,pageSize:x,page:1})):l.page!==y+1&&h(d=>({...d,page:y+1}))},c={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:l.page-1,rowsPerPage:l.pageSize,count:a?.total||0};return f?e.jsx(g,{sx:{py:2},children:e.jsx(ee,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsx(g,{children:e.jsx(fe,{className:"logs-table",verticalKeyWidth:100,locale:m,data:s,columns:t,options:c,loading:f,onChange:n})})}rt.propTypes={passport:w.object.isRequired};function at({passport:u,onSwitchPassport:o}){const{api:i}=k(),{teamDid:p}=_(),{t:m,locale:l}=F(),[h,a]=b.useState({pageSize:tt,page:st}),{data:f,loading:s}=re(async()=>{const x={teamDid:p,passportId:u.parentDid,paging:{page:h.page,pageSize:h.pageSize}},d=await i.getRelatedPassports({input:x});return{passports:d.passports||[],total:d.paging.total}},{refreshDeps:[h.page,h.pageSize],onError:x=>R.error(x.message)}),r=b.useMemo(()=>f?.passports||[],[f?.passports]),t=b.useMemo(()=>[{label:m("team.passport.role"),name:"role",options:{customBodyRender:ge}},{label:m("team.passport.owner"),name:"user",options:{customBodyRender:ye}},{label:m("team.passport.status"),name:"status",options:{customBodyRender:je}},{label:m("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:x=>Ye(x,l)}},{label:m("blocklet.overview.source"),name:"source",options:{customBodyRender:ne}}],[m,l]),n=({page:x,rowsPerPage:d})=>{h.pageSize!==d?a(j=>({...j,pageSize:d,page:1})):h.page!==x+1&&a(j=>({...j,page:x+1}))},c=b.useRef(null),y={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:h.page-1,rowsPerPage:h.pageSize,count:f?.total||0,onRowClick(x,{dataIndex:d},j){if(c.current?.contains(j.target)){const S=r[d];o(S)}}};return s?e.jsx(g,{sx:{py:2},children:e.jsx(ee,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsxs(ee,{spacing:1,children:[e.jsx(_e,{severity:"warning",children:m("team.passport.relatedDescription")}),e.jsx(g,{ref:c,sx:{".MuiTableRow-root":{cursor:"pointer"}},children:e.jsx(fe,{className:"related-table",verticalKeyWidth:100,locale:l,data:r.filter(x=>x.id!==u.id),columns:t,options:y,loading:s,onChange:n})})]})}at.propTypes={passport:w.object.isRequired,onSwitchPassport:w.func.isRequired};function be({onCancel:u,onSuccess:o}){const{api:i}=k(),{blocklet:p}=kt(),{t:m}=F(),[l,h]=b.useState(!1),a=(p.environments.find(n=>n.key==="BLOCKLET_PASSPORT_COLOR")||{}).value||"auto",f=a==="auto"?$t(p.appDid):a,[s,r]=b.useState(f),t=async()=>{const n=[{key:Nt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR,value:s}];try{h(!0),await i.configBlocklet({input:{did:p.meta.did,configs:n}}),o()}catch(c){R.error(c.message)}finally{h(!1)}};return e.jsx(H,{title:m("team.passport.color"),onClose:u,open:!0,fullWidth:!0,actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:m("common.cancel")}),e.jsxs(L,{onClick:t,color:"primary",disabled:l,variant:"contained",autoFocus:!0,"data-cy":"color-btn-confirm",children:[l&&e.jsx(M,{size:16}),m("common.save")]})]}),children:e.jsxs(g,{className:"dialog-content",sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:[e.jsx(_t,{disableAlpha:!0,color:s,onChange:n=>r(n.hex)}),e.jsx("div",{style:{width:220,marginLeft:24},dangerouslySetInnerHTML:{__html:At({scope:"passport",role:"owner",title:"Owner",issuer:Ft.getDisplayName(p),issuerDid:p.appDid,ownerName:"Your Name",ownerDid:p.appDid,preferredColor:s})}})]})})}const Vt=G(be,"mutate_team"),Kt=G(be,"",J);function Yt(u){const{inService:o}=k();return o?e.jsx(Kt,{...u}):e.jsx(Vt,{...u})}be.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired};var nt=function(o){return e.jsx("svg",{...o,children:e.jsx("path",{d:"M64.707 8.707a1 1 0 0 0 0-1.414L58.343.929a1 1 0 1 0-1.414 1.414L62.586 8l-5.657 5.657a1 1 0 0 0 1.414 1.414l6.364-6.364ZM0 9h64V7H0v2Z",fill:"#666"})})};nt.defaultProps={width:"65",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};const Zt=(u,o)=>u?!o.some(i=>!i.from.passport||!i.to.role):!1;function ot({onCancel:u,onSuccess:o,data:i={},trustedPassports:p=[]}){const{api:m}=k(),{roles:l,teamDid:h}=_(),{t:a}=F(),[f,s]=b.useState(!1),[r,t]=b.useState(i.issuerDid||""),[n,c]=b.useState(i.remark||""),[y,x]=b.useState(Z(i.mappings)||[]),d=p.findIndex(S=>S.issuerDid===i.issuerDid),j=async()=>{if(f)return;const S={issuerDid:r,remark:n,mappings:y.map(C=>({...C,to:{...C.to,ttl:C.to.ttl||0}}))},T=[...p];d===-1?T.unshift(S):T[d]=S;try{s(!0),await m.configTrustedPassports({input:{teamDid:h,trustedPassports:T}}),await se(800),s(!1),R.success(a("common.saveSuccess")),o()}catch(C){s(!1),R.error(te(C))}};return e.jsx(H,{title:a("team.passport.trustedIssuers"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(q,{onClick:u,"data-cy":"trusted-issuer-close",size:"large",children:e.jsx($e,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:a("common.cancel")}),e.jsxs(L,{onClick:()=>j(),color:"primary",disabled:!Zt(r,y)||!n||f,variant:"contained",autoFocus:!0,"data-cy":"save-mapping",children:[f&&e.jsx(M,{size:16}),a("common.save")]})]}),children:e.jsx(Jt,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx($,{fullWidth:!0,"data-cy":"input-issuer-did",placeholder:a("team.passport.issuerDid"),value:r,onChange:S=>{t(S.target.value)}}),e.jsx($,{style:{marginTop:16},fullWidth:!0,"data-cy":"input-issuer-remark",placeholder:a("common.remark"),value:n,onChange:S=>{c(S.target.value)}}),e.jsxs(g,{sx:{mt:"30px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(g,{className:"dialog-h1",children:a("team.passport.mappingRule")}),e.jsx(g,{children:e.jsx(L,{variant:"outlined",color:"primary","data-cy":"add-mapping",onClick:()=>{x(S=>{const T=[...S];return T.unshift({from:{passport:""},to:{role:U.ROLES.GUEST}}),T})},children:a("team.add")})})]}),e.jsxs(g,{className:"list",sx:{mt:-.5},children:[y.map((S,T)=>e.jsxs(g,{className:"mapping-item",sx:{display:"flex",alignItems:"center",justifyContent:"space-between",my:1},children:[e.jsxs(g,{sx:{display:"flex",alignItems:"center",flexGrow:1},children:[e.jsx(g,{sx:{flexGrow:1,flexBasis:1},children:e.jsx($,{fullWidth:!0,size:"small","data-cy":`input-${T}-from`,placeholder:"Issuer’s Passport Name/ID *",value:S.from.passport,onChange:C=>{const{value:P}=C.target;x(D=>{const B=[...D];return B[T].from.passport=P,B})},sx:{"& .MuiInputBase-input::placeholder":{fontSize:14},"& .Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"primary.main"}}})}),e.jsx(g,{sx:{flexShrink:0,mx:1,width:65,height:16},children:e.jsx(nt,{})}),e.jsx(g,{sx:{flexGrow:1,flexBasis:1},children:e.jsx($,{fullWidth:!0,size:"small",select:!0,value:S.to.role,onChange:C=>{x(P=>{const D=[...P];return D[T].to.role=C.target.value,D})},variant:"outlined",children:l.filter(C=>C.name!=="owner").map(C=>e.jsx(ae,{value:C.name,"data-cy":`passport-mapping-select-option-${C.name}`,children:e.jsx("span",{children:C.title||C.name})},C.name))})})]}),e.jsx(g,{sx:{flexShrink:0},children:e.jsx(q,{onClick:()=>{x(C=>{const P=[...C];return P.splice(T,1),P})},size:"large",children:e.jsx(ie,{})})})]},`mapping-${T}`)),!y.length&&e.jsx(g,{sx:{my:2,color:"text.secondary",fontSize:"16px"},children:e.jsx(xe,{children:a("common.empty")})})]})]})})})}ot.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired,trustedPassports:w.array,data:w.object};const Jt=W.div`
91
91
  .dialog-h1 {
92
92
  font-size: 18px;
93
93
  }
@@ -99,7 +99,7 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
99
99
  }
100
100
  }
101
101
  }
102
- `;function be({onCancel:u,hasPermission:o=!1}){const{api:i}=k(),{teamDid:p,trustedPassports:m}=_(),{t:l}=F(),[h,a]=C.useState(null),[f,s]=C.useState(!1),[r,t]=C.useState(!1),[n,c]=C.useState(""),y=async d=>{if(f)return;const j=m.findIndex(T=>T.issuerDid===d);j===-1&&R.error("Cannot find passports");const S=[...m];S.splice(j,1);try{s(!0),await i.configTrustedPassports({input:{teamDid:p,trustedPassports:S}}),await se(800),s(!1),R.success(l("common.saveSuccess")),a(!1)}catch(T){s(!1),R.error(T.message)}},x=m.filter(d=>!n||d.issuerDid.toLowerCase().includes(n.toLowerCase()));return e.jsxs(H,{title:l("team.passport.trustedIssuers"),open:!0,onClose:u,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(ts,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:l("team.passport.trustedPassportIssuers")}),e.jsx(Qe,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(Ue,{options:{searchPlaceholder:l("team.passport.searchIssuerDid"),searchDebounceTime:600},search:n,searchText:n,searchTextUpdate:c,searchClose:()=>c(""),onSearchOpen:()=>{}}),o&&e.jsxs(L,{variant:"contained",color:"primary","data-cy":"add-trusted-issuer",onClick:()=>t({mode:"add"}),children:[e.jsx(me,{style:{fontSize:16,marginRight:4}}),l("team.add")]})]})}),e.jsxs("div",{className:"list",children:[x.map(d=>e.jsxs(g,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px"},children:[e.jsxs(g,{sx:{flexShrink:0},children:[e.jsx(he,{copyable:!1,size:16,did:Ge.toAddress(d.issuerDid),showDidLogo:!1}),!!d.remark&&e.jsx(g,{sx:{fontSize:12,maxWidth:"300px"},children:d.remark})]}),e.jsx(g,{sx:{color:"gray",ml:"28px",flexGrow:1},children:d.mappings&&d.mappings.length?`${d.mappings.length} ${l("team.passport.mappingRule")}`:l("team.passport.defaultRule")}),e.jsxs(g,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:[e.jsx(W,{onClick:()=>t({mode:"update",data:Z(d)}),"data-cy":"edit-mapping-rule",size:"large",children:e.jsx(oe,{})}),e.jsx(W,{"data-cy":"delete-mapping-rule",onClick:()=>a({title:l("common.delete"),description:l("common.delConfirmDescription",{data:d.issuerDid}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:()=>y(d.issuerDid),onCancel:()=>{s(!1),a(null)}}),size:"large",children:e.jsx(ie,{})})]})]},d.issuerDid)),!m.length&&e.jsx(xe,{children:l("common.empty")})]})]})}),r&&e.jsx(ot,{mode:r.mode,data:r.data,trustedPassports:Z(m),onCancel:()=>t(null),onSuccess:()=>{t(null)}}),h&&e.jsx(ve,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}be.propTypes={onCancel:w.func.isRequired,hasPermission:w.bool};const Qt=G(be,"mutate_team"),Xt=G(be,"",J);function es(u){const{inService:o}=k();return o?e.jsx(Xt,{...u}):e.jsx(Qt,{...u})}const ts=q.div`
102
+ `;function Ce({onCancel:u,hasPermission:o=!1}){const{api:i}=k(),{teamDid:p,trustedPassports:m}=_(),{t:l}=F(),[h,a]=b.useState(null),[f,s]=b.useState(!1),[r,t]=b.useState(!1),[n,c]=b.useState(""),y=async d=>{if(f)return;const j=m.findIndex(T=>T.issuerDid===d);j===-1&&R.error("Cannot find passports");const S=[...m];S.splice(j,1);try{s(!0),await i.configTrustedPassports({input:{teamDid:p,trustedPassports:S}}),await se(800),s(!1),R.success(l("common.saveSuccess")),a(!1)}catch(T){s(!1),R.error(T.message)}},x=m.filter(d=>!n||d.issuerDid.toLowerCase().includes(n.toLowerCase()));return e.jsxs(H,{title:l("team.passport.trustedIssuers"),open:!0,onClose:u,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(ts,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:l("team.passport.trustedPassportIssuers")}),e.jsx(Qe,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(Ue,{options:{searchPlaceholder:l("team.passport.searchIssuerDid"),searchDebounceTime:600},search:n,searchText:n,searchTextUpdate:c,searchClose:()=>c(""),onSearchOpen:()=>{}}),o&&e.jsxs(L,{variant:"contained",color:"primary","data-cy":"add-trusted-issuer",onClick:()=>t({mode:"add"}),children:[e.jsx(me,{style:{fontSize:16,marginRight:4}}),l("team.add")]})]})}),e.jsxs("div",{className:"list",children:[x.map(d=>e.jsxs(g,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px"},children:[e.jsxs(g,{sx:{flexShrink:0},children:[e.jsx(he,{copyable:!1,size:16,did:Ve.toAddress(d.issuerDid),showDidLogo:!1}),!!d.remark&&e.jsx(g,{sx:{fontSize:12,maxWidth:"300px"},children:d.remark})]}),e.jsx(g,{sx:{color:"gray",ml:"28px",flexGrow:1},children:d.mappings&&d.mappings.length?`${d.mappings.length} ${l("team.passport.mappingRule")}`:l("team.passport.defaultRule")}),e.jsxs(g,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:[e.jsx(q,{onClick:()=>t({mode:"update",data:Z(d)}),"data-cy":"edit-mapping-rule",size:"large",children:e.jsx(oe,{})}),e.jsx(q,{"data-cy":"delete-mapping-rule",onClick:()=>a({title:l("common.delete"),description:l("common.delConfirmDescription",{data:d.issuerDid}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:()=>y(d.issuerDid),onCancel:()=>{s(!1),a(null)}}),size:"large",children:e.jsx(ie,{})})]})]},d.issuerDid)),!m.length&&e.jsx(xe,{children:l("common.empty")})]})]})}),r&&e.jsx(ot,{mode:r.mode,data:r.data,trustedPassports:Z(m),onCancel:()=>t(null),onSuccess:()=>{t(null)}}),h&&e.jsx(ve,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}Ce.propTypes={onCancel:w.func.isRequired,hasPermission:w.bool};const Qt=G(Ce,"mutate_team"),Xt=G(Ce,"",J);function es(u){const{inService:o}=k();return o?e.jsx(Xt,{...u}):e.jsx(Qt,{...u})}const ts=W.div`
103
103
  .list {
104
104
  .MuiIconButton-root {
105
105
  svg {
@@ -107,7 +107,7 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
107
107
  }
108
108
  }
109
109
  }
110
- `;var ss=Ot();const Re=Me(ss);function it({onCancel:u,onSuccess:o,data:i={},trustedFactories:p=[]}){const{api:m}=k(),{roles:l,teamDid:h}=_(),{t:a}=F(),[f,s]=qt({loading:!1,fetching:!1,fetched:[],errored:[],factoryAddress:i.factoryAddress||"",remark:i.remark||"",role:i.passport?.role||"member",ttlPolicy:i.passport?.ttlPolicy||"never",ttl:Re(+i.passport?.ttl||365*24*60*60*1e3),error:""}),r=p.findIndex(x=>x.factoryAddress===i.factoryAddress),t=async()=>{if(f.loading)return;const{factoryAddress:x,remark:d,role:j,ttlPolicy:S,ttl:T}=f,b={factoryAddress:x,remark:d,passport:{role:j,ttlPolicy:S,ttl:S==="never"?0:Re(T)}},P=[...p];r===-1?P.unshift(b):P[r]=b;try{s({loading:!0}),await m.configTrustedFactories({input:{teamDid:h,trustedFactories:P}}),await se(800),R.success(a("common.saveSuccess")),o()}catch(I){console.error(I),R.error(te(I))}finally{s({loading:!1})}};C.useEffect(()=>{const x=f.fetched.find(j=>j.address===f.factoryAddress),d=f.errored.find(j=>j.address===f.factoryAddress);Ge.isValid(f.factoryAddress)&&!f.fetching&&!x&&!d&&(s({fetching:!0}),Lt(U.MAIN_CHAIN_ENDPOINT).getFactoryState({address:f.factoryAddress}).then(S=>{S.state?s({fetching:!1,fetched:[...f.fetched.filter(T=>T.address!==f.factoryAddress),S.state],remark:S.state.name}):s({fetching:!1,errored:[...f.errored.filter(T=>T.address!==f.factoryAddress),{address:f.factoryAddress}],error:a("team.passport.factory404",f)})}).catch(S=>{console.error(S),s({fetching:!1,error:te(S)})}))},[f.factoryAddress,f.fetching]);let n=f.error;const c=f.factoryAddress?f.errored.find(x=>x.address===f.factoryAddress):null;!n&&c&&(n=a("team.passport.factory404",f));const y=f.factoryAddress?f.fetched.find(x=>x.address===f.factoryAddress):null;return!n&&y&&(n=y.description),n||(n=a("team.passport.factoryAddressTip")),e.jsx(H,{title:a("team.passport.trustedFactories"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(W,{onClick:u,"data-cy":"close-trusted-factory",size:"large",children:e.jsx($e,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:a("common.cancel")}),e.jsxs(L,{onClick:()=>t(),color:"primary",disabled:!f.factoryAddress||!f.remark||!f.role||f.loading||f.error||c,variant:"contained",autoFocus:!0,"data-cy":"save-trusted-factory",children:[f.loading&&e.jsx(M,{size:16}),a("common.save")]})]}),children:e.jsx(rs,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx($,{fullWidth:!0,error:!!f.error||!!c,"data-cy":"input-factory-address",label:a("team.passport.factoryAddress"),helperText:n,value:f.factoryAddress,onChange:x=>{s({factoryAddress:x.target.value,error:""})},slotProps:{input:{endAdornment:f.fetching?e.jsx(gt,{position:"end",children:e.jsx(M,{size:16})}):null}}}),e.jsx($,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-factory-remark",label:a("common.remark"),value:f.remark,onChange:x=>{s({remark:x.target.value})}}),e.jsx($,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-passport-role",label:a("team.passport.role"),select:!0,value:f.role,onChange:x=>{s({role:x.target.value})},variant:"outlined",children:l.filter(x=>x.name!=="owner").map(x=>e.jsx(ae,{value:x.name,"data-cy":`passport-role-select-option-${x.name}`,children:e.jsx("span",{children:x.title||x.name})},x.name))}),e.jsxs("div",{style:{marginTop:32},children:[e.jsx(Oe,{children:a("team.passport.ttl")}),e.jsxs(We,{color:"primary",size:"small",value:f.ttlPolicy,exclusive:!0,style:{marginTop:16},onChange:(x,d)=>s({ttlPolicy:d}),"data-cy":"input-passport-ttl-since","aria-label":"Expire Policy",children:[e.jsx(X,{value:"never","data-cy":"input-passport-ttl-never",children:e.jsx(K,{title:a("team.passport.ttlNeverTip"),children:e.jsx(E,{children:a("team.passport.ttlNever")})})}),e.jsx(X,{value:"mint","data-cy":"input-passport-ttl-mint",children:e.jsx(K,{title:a("team.passport.ttlMintTip"),children:e.jsx(E,{children:a("team.passport.ttlMint")})})}),e.jsx(X,{value:"exchange","data-cy":"input-passport-ttl-exchange",children:e.jsx(K,{title:a("team.passport.ttlExchangeTip"),children:e.jsx(E,{children:a("team.passport.ttlExchange")})})})]}),f.ttlPolicy!=="never"&&e.jsxs(e.Fragment,{children:[e.jsx(qe,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-passport-ttl",value:f.ttl,onChange:x=>{s({ttl:x.target.value})}}),e.jsx(He,{children:a("team.passport.ttlTip")})]})]})]})})})}it.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired,trustedFactories:w.array,data:w.object};const rs=q.div`
110
+ `;var ss=Ot();const Re=Me(ss);function it({onCancel:u,onSuccess:o,data:i={},trustedFactories:p=[]}){const{api:m}=k(),{roles:l,teamDid:h}=_(),{t:a}=F(),[f,s]=Wt({loading:!1,fetching:!1,fetched:[],errored:[],factoryAddress:i.factoryAddress||"",remark:i.remark||"",role:i.passport?.role||"member",ttlPolicy:i.passport?.ttlPolicy||"never",ttl:Re(+i.passport?.ttl||365*24*60*60*1e3),error:""}),r=p.findIndex(x=>x.factoryAddress===i.factoryAddress),t=async()=>{if(f.loading)return;const{factoryAddress:x,remark:d,role:j,ttlPolicy:S,ttl:T}=f,C={factoryAddress:x,remark:d,passport:{role:j,ttlPolicy:S,ttl:S==="never"?0:Re(T)}},P=[...p];r===-1?P.unshift(C):P[r]=C;try{s({loading:!0}),await m.configTrustedFactories({input:{teamDid:h,trustedFactories:P}}),await se(800),R.success(a("common.saveSuccess")),o()}catch(D){console.error(D),R.error(te(D))}finally{s({loading:!1})}};b.useEffect(()=>{const x=f.fetched.find(j=>j.address===f.factoryAddress),d=f.errored.find(j=>j.address===f.factoryAddress);Ve.isValid(f.factoryAddress)&&!f.fetching&&!x&&!d&&(s({fetching:!0}),Lt(U.MAIN_CHAIN_ENDPOINT).getFactoryState({address:f.factoryAddress}).then(S=>{S.state?s({fetching:!1,fetched:[...f.fetched.filter(T=>T.address!==f.factoryAddress),S.state],remark:S.state.name}):s({fetching:!1,errored:[...f.errored.filter(T=>T.address!==f.factoryAddress),{address:f.factoryAddress}],error:a("team.passport.factory404",f)})}).catch(S=>{console.error(S),s({fetching:!1,error:te(S)})}))},[f.factoryAddress,f.fetching]);let n=f.error;const c=f.factoryAddress?f.errored.find(x=>x.address===f.factoryAddress):null;!n&&c&&(n=a("team.passport.factory404",f));const y=f.factoryAddress?f.fetched.find(x=>x.address===f.factoryAddress):null;return!n&&y&&(n=y.description),n||(n=a("team.passport.factoryAddressTip")),e.jsx(H,{title:a("team.passport.trustedFactories"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(q,{onClick:u,"data-cy":"close-trusted-factory",size:"large",children:e.jsx($e,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:a("common.cancel")}),e.jsxs(L,{onClick:()=>t(),color:"primary",disabled:!f.factoryAddress||!f.remark||!f.role||f.loading||f.error||c,variant:"contained",autoFocus:!0,"data-cy":"save-trusted-factory",children:[f.loading&&e.jsx(M,{size:16}),a("common.save")]})]}),children:e.jsx(rs,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx($,{fullWidth:!0,error:!!f.error||!!c,"data-cy":"input-factory-address",label:a("team.passport.factoryAddress"),helperText:n,value:f.factoryAddress,onChange:x=>{s({factoryAddress:x.target.value,error:""})},slotProps:{input:{endAdornment:f.fetching?e.jsx(gt,{position:"end",children:e.jsx(M,{size:16})}):null}}}),e.jsx($,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-factory-remark",label:a("common.remark"),value:f.remark,onChange:x=>{s({remark:x.target.value})}}),e.jsx($,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-passport-role",label:a("team.passport.role"),select:!0,value:f.role,onChange:x=>{s({role:x.target.value})},variant:"outlined",children:l.filter(x=>x.name!=="owner").map(x=>e.jsx(ae,{value:x.name,"data-cy":`passport-role-select-option-${x.name}`,children:e.jsx("span",{children:x.title||x.name})},x.name))}),e.jsxs("div",{style:{marginTop:32},children:[e.jsx(Oe,{children:a("team.passport.ttl")}),e.jsxs(qe,{color:"primary",size:"small",value:f.ttlPolicy,exclusive:!0,style:{marginTop:16},onChange:(x,d)=>s({ttlPolicy:d}),"data-cy":"input-passport-ttl-since","aria-label":"Expire Policy",children:[e.jsx(X,{value:"never","data-cy":"input-passport-ttl-never",children:e.jsx(Y,{title:a("team.passport.ttlNeverTip"),children:e.jsx(E,{children:a("team.passport.ttlNever")})})}),e.jsx(X,{value:"mint","data-cy":"input-passport-ttl-mint",children:e.jsx(Y,{title:a("team.passport.ttlMintTip"),children:e.jsx(E,{children:a("team.passport.ttlMint")})})}),e.jsx(X,{value:"exchange","data-cy":"input-passport-ttl-exchange",children:e.jsx(Y,{title:a("team.passport.ttlExchangeTip"),children:e.jsx(E,{children:a("team.passport.ttlExchange")})})})]}),f.ttlPolicy!=="never"&&e.jsxs(e.Fragment,{children:[e.jsx(We,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-passport-ttl",value:f.ttl,onChange:x=>{s({ttl:x.target.value})}}),e.jsx(He,{children:a("team.passport.ttlTip")})]})]})]})})})}it.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired,trustedFactories:w.array,data:w.object};const rs=W.div`
111
111
  .dialog-h1 {
112
112
  font-size: 18px;
113
113
  }
@@ -119,7 +119,7 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
119
119
  }
120
120
  }
121
121
  }
122
- `;function Se({onCancel:u,hasPermission:o=!1}){const{api:i}=k(),{teamDid:p,trustedFactories:m}=_(),{t:l}=F(),[h,a]=C.useState(null),[f,s]=C.useState(!1),[r,t]=C.useState(null),[n,c]=C.useState(""),y=async d=>{if(!f)try{s(!0),await i.configTrustedFactories({input:{teamDid:p,trustedFactories:m.filter(j=>j.factoryAddress!==d)}}),await se(800),s(!1),R.success(l("common.saveSuccess")),a(null)}catch(j){s(!1),R.error(j.message)}},x=m.filter(d=>!n||d.factoryAddress.toLowerCase().includes(n.toLowerCase()));return e.jsxs(H,{title:l("team.passport.trustedFactories"),open:!0,onClose:u,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(is,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:l("team.passport.trustedFactoriesTip")}),e.jsx(Qe,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(Ue,{options:{searchPlaceholder:l("team.passport.searchFactoryAddress"),searchDebounceTime:600},search:n,searchText:n,searchTextUpdate:c,searchClose:()=>c(""),onSearchOpen:()=>{}}),o&&e.jsxs(L,{variant:"contained",color:"primary",size:"small","data-cy":"add-trusted-factory",onClick:()=>t({mode:"add"}),children:[e.jsx(me,{style:{fontSize:16,marginRight:4}}),l("team.add")]})]})}),e.jsxs("div",{className:"list",children:[x.map(d=>e.jsxs(g,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px"},children:[e.jsxs(g,{sx:{flexGrow:1},children:[e.jsx(he,{copyable:!1,did:d.factoryAddress,size:16,showDidLogo:!1}),!!d.remark&&e.jsx(g,{sx:{fontSize:12,maxWidth:"300px"},children:d.remark})]}),e.jsx(g,{sx:{color:"gray",mr:"24px"},children:e.jsx(It,{type:"success",children:d.passport.role})}),e.jsxs(g,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:[e.jsx(W,{onClick:()=>t({mode:"update",data:Z(d)}),"data-cy":"edit-trusted-factory",size:"large",children:e.jsx(oe,{})}),e.jsx(W,{"data-cy":"delete-trusted-factory",onClick:()=>a({title:l("common.delete"),description:l("common.delConfirmDescription",{data:d.factoryAddress}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:()=>y(d.factoryAddress),onCancel:()=>{s(!1),a(null)}}),size:"large",children:e.jsx(ie,{})})]})]},d.factoryAddress)),!m.length&&e.jsx(xe,{children:l("common.empty")})]})]})}),r&&e.jsx(it,{data:r.data,trustedFactories:Z(m),onCancel:()=>t(null),onSuccess:()=>{t(null)}}),h&&e.jsx(ve,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}Se.propTypes={onCancel:w.func.isRequired,hasPermission:w.bool};const as=G(Se,"mutate_team"),ns=G(Se,"",J);function os(u){const{inService:o}=k();return o?e.jsx(ns,{...u}):e.jsx(as,{...u})}const is=q.div`
122
+ `;function Se({onCancel:u,hasPermission:o=!1}){const{api:i}=k(),{teamDid:p,trustedFactories:m}=_(),{t:l}=F(),[h,a]=b.useState(null),[f,s]=b.useState(!1),[r,t]=b.useState(null),[n,c]=b.useState(""),y=async d=>{if(!f)try{s(!0),await i.configTrustedFactories({input:{teamDid:p,trustedFactories:m.filter(j=>j.factoryAddress!==d)}}),await se(800),s(!1),R.success(l("common.saveSuccess")),a(null)}catch(j){s(!1),R.error(j.message)}},x=m.filter(d=>!n||d.factoryAddress.toLowerCase().includes(n.toLowerCase()));return e.jsxs(H,{title:l("team.passport.trustedFactories"),open:!0,onClose:u,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(is,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:l("team.passport.trustedFactoriesTip")}),e.jsx(Qe,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(Ue,{options:{searchPlaceholder:l("team.passport.searchFactoryAddress"),searchDebounceTime:600},search:n,searchText:n,searchTextUpdate:c,searchClose:()=>c(""),onSearchOpen:()=>{}}),o&&e.jsxs(L,{variant:"contained",color:"primary",size:"small","data-cy":"add-trusted-factory",onClick:()=>t({mode:"add"}),children:[e.jsx(me,{style:{fontSize:16,marginRight:4}}),l("team.add")]})]})}),e.jsxs("div",{className:"list",children:[x.map(d=>e.jsxs(g,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px"},children:[e.jsxs(g,{sx:{flexGrow:1},children:[e.jsx(he,{copyable:!1,did:d.factoryAddress,size:16,showDidLogo:!1}),!!d.remark&&e.jsx(g,{sx:{fontSize:12,maxWidth:"300px"},children:d.remark})]}),e.jsx(g,{sx:{color:"gray",mr:"24px"},children:e.jsx(Dt,{type:"success",children:d.passport.role})}),e.jsxs(g,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:[e.jsx(q,{onClick:()=>t({mode:"update",data:Z(d)}),"data-cy":"edit-trusted-factory",size:"large",children:e.jsx(oe,{})}),e.jsx(q,{"data-cy":"delete-trusted-factory",onClick:()=>a({title:l("common.delete"),description:l("common.delConfirmDescription",{data:d.factoryAddress}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:()=>y(d.factoryAddress),onCancel:()=>{s(!1),a(null)}}),size:"large",children:e.jsx(ie,{})})]})]},d.factoryAddress)),!m.length&&e.jsx(xe,{children:l("common.empty")})]})]})}),r&&e.jsx(it,{data:r.data,trustedFactories:Z(m),onCancel:()=>t(null),onSuccess:()=>{t(null)}}),h&&e.jsx(ve,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}Se.propTypes={onCancel:w.func.isRequired,hasPermission:w.bool};const as=G(Se,"mutate_team"),ns=G(Se,"",J);function os(u){const{inService:o}=k();return o?e.jsx(ns,{...u}):e.jsx(as,{...u})}const is=W.div`
123
123
  .list {
124
124
  .MuiIconButton-root {
125
125
  svg {
@@ -132,7 +132,7 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
132
132
  *
133
133
  * @author Feross Aboukhadijeh <https://feross.org>
134
134
  * @license MIT
135
- */var ue,Ne;function cs(){if(Ne)return ue;Ne=1,ue=function(i){return i!=null&&(u(i)||o(i)||!!i._isBuffer)};function u(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function o(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&u(i.slice(0,0))}return ue}var Le;function ds(){return Le||(Le=1,function(){var u=ls(),o=Fe().utf8,i=cs(),p=Fe().bin,m=function(l,h){l.constructor==String?h&&h.encoding==="binary"?l=p.stringToBytes(l):l=o.stringToBytes(l):i(l)?l=Array.prototype.slice.call(l,0):!Array.isArray(l)&&l.constructor!==Uint8Array&&(l=l.toString());for(var a=u.bytesToWords(l),f=l.length*8,s=1732584193,r=-271733879,t=-1732584194,n=271733878,c=0;c<a.length;c++)a[c]=(a[c]<<8|a[c]>>>24)&16711935|(a[c]<<24|a[c]>>>8)&4278255360;a[f>>>5]|=128<<f%32,a[(f+64>>>9<<4)+14]=f;for(var y=m._ff,x=m._gg,d=m._hh,j=m._ii,c=0;c<a.length;c+=16){var S=s,T=r,b=t,P=n;s=y(s,r,t,n,a[c+0],7,-680876936),n=y(n,s,r,t,a[c+1],12,-389564586),t=y(t,n,s,r,a[c+2],17,606105819),r=y(r,t,n,s,a[c+3],22,-1044525330),s=y(s,r,t,n,a[c+4],7,-176418897),n=y(n,s,r,t,a[c+5],12,1200080426),t=y(t,n,s,r,a[c+6],17,-1473231341),r=y(r,t,n,s,a[c+7],22,-45705983),s=y(s,r,t,n,a[c+8],7,1770035416),n=y(n,s,r,t,a[c+9],12,-1958414417),t=y(t,n,s,r,a[c+10],17,-42063),r=y(r,t,n,s,a[c+11],22,-1990404162),s=y(s,r,t,n,a[c+12],7,1804603682),n=y(n,s,r,t,a[c+13],12,-40341101),t=y(t,n,s,r,a[c+14],17,-1502002290),r=y(r,t,n,s,a[c+15],22,1236535329),s=x(s,r,t,n,a[c+1],5,-165796510),n=x(n,s,r,t,a[c+6],9,-1069501632),t=x(t,n,s,r,a[c+11],14,643717713),r=x(r,t,n,s,a[c+0],20,-373897302),s=x(s,r,t,n,a[c+5],5,-701558691),n=x(n,s,r,t,a[c+10],9,38016083),t=x(t,n,s,r,a[c+15],14,-660478335),r=x(r,t,n,s,a[c+4],20,-405537848),s=x(s,r,t,n,a[c+9],5,568446438),n=x(n,s,r,t,a[c+14],9,-1019803690),t=x(t,n,s,r,a[c+3],14,-187363961),r=x(r,t,n,s,a[c+8],20,1163531501),s=x(s,r,t,n,a[c+13],5,-1444681467),n=x(n,s,r,t,a[c+2],9,-51403784),t=x(t,n,s,r,a[c+7],14,1735328473),r=x(r,t,n,s,a[c+12],20,-1926607734),s=d(s,r,t,n,a[c+5],4,-378558),n=d(n,s,r,t,a[c+8],11,-2022574463),t=d(t,n,s,r,a[c+11],16,1839030562),r=d(r,t,n,s,a[c+14],23,-35309556),s=d(s,r,t,n,a[c+1],4,-1530992060),n=d(n,s,r,t,a[c+4],11,1272893353),t=d(t,n,s,r,a[c+7],16,-155497632),r=d(r,t,n,s,a[c+10],23,-1094730640),s=d(s,r,t,n,a[c+13],4,681279174),n=d(n,s,r,t,a[c+0],11,-358537222),t=d(t,n,s,r,a[c+3],16,-722521979),r=d(r,t,n,s,a[c+6],23,76029189),s=d(s,r,t,n,a[c+9],4,-640364487),n=d(n,s,r,t,a[c+12],11,-421815835),t=d(t,n,s,r,a[c+15],16,530742520),r=d(r,t,n,s,a[c+2],23,-995338651),s=j(s,r,t,n,a[c+0],6,-198630844),n=j(n,s,r,t,a[c+7],10,1126891415),t=j(t,n,s,r,a[c+14],15,-1416354905),r=j(r,t,n,s,a[c+5],21,-57434055),s=j(s,r,t,n,a[c+12],6,1700485571),n=j(n,s,r,t,a[c+3],10,-1894986606),t=j(t,n,s,r,a[c+10],15,-1051523),r=j(r,t,n,s,a[c+1],21,-2054922799),s=j(s,r,t,n,a[c+8],6,1873313359),n=j(n,s,r,t,a[c+15],10,-30611744),t=j(t,n,s,r,a[c+6],15,-1560198380),r=j(r,t,n,s,a[c+13],21,1309151649),s=j(s,r,t,n,a[c+4],6,-145523070),n=j(n,s,r,t,a[c+11],10,-1120210379),t=j(t,n,s,r,a[c+2],15,718787259),r=j(r,t,n,s,a[c+9],21,-343485551),s=s+S>>>0,r=r+T>>>0,t=t+b>>>0,n=n+P>>>0}return u.endian([s,r,t,n])};m._ff=function(l,h,a,f,s,r,t){var n=l+(h&a|~h&f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._gg=function(l,h,a,f,s,r,t){var n=l+(h&f|a&~f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._hh=function(l,h,a,f,s,r,t){var n=l+(h^a^f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._ii=function(l,h,a,f,s,r,t){var n=l+(a^(h|~f))+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._blocksize=16,m._digestsize=16,ce.exports=function(l,h){if(l==null)throw new Error("Illegal argument "+l);var a=u.wordsToBytes(m(l,h));return h&&h.asBytes?a:h&&h.asString?p.bytesToString(a):u.bytesToHex(a)}}()),ce.exports}var ps=ds();const us=Me(ps);function we({teamDid:u,onCancel:o,onSuccess:i,onError:p=()=>{},mode:m="create",item:l={}}){const{api:h}=k(),[a,f]=C.useState(!1),[s,r]=C.useState(""),{t}=F(),[n,c]=C.useState(l.title||""),[y,x]=C.useState(l.description||""),[d,j]=C.useState(l?.extra?.display||"builtin"),[S,T]=C.useState(l?.extra?.types?l.extra.types.join(","):""),b=async()=>{const I=n.trim();if(!I){r(t("team.passport.error.titleEmpty"));return}if(I.length>64){r(t("team.passport.error.titleTooLong",{length:64}));return}const B=y.replace(/\n/g," ");if(!B){r(t("team.passport.error.descriptionEmpty"));return}const V=m==="create"?us(I):l.name;r(null),f(!0);try{if(m==="create"){const z={teamDid:u,name:V,title:I,description:B};d==="custom"&&(z.extra=JSON.stringify({display:"custom",types:S.split(",")})),await h.createRole({input:z})}else{const z={teamDid:u,role:{name:V,title:I,description:B}};await h.updateRole({input:z})}i()}catch(z){const Y=te(z);r(Y),p(z)}finally{f(!1)}},P=e.jsxs("div",{children:[m==="update"&&e.jsx(E,{component:"div",style:{paddingTop:16},children:e.jsx($,{label:"ID",autoComplete:"off",variant:"outlined",name:"url","data-cy":"mutate-role-input-name",fullWidth:!0,autoFocus:!0,value:l.name,disabled:!0})}),e.jsx(E,{component:"div",style:{marginTop:16},children:e.jsx($,{label:t("common.title"),autoComplete:"off",variant:"outlined",name:"title","data-cy":"mutate-role-input-title",fullWidth:!0,autoFocus:!0,value:n,onChange:I=>{r(null),c(I.target.value)},disabled:m==="update"||a,helperText:t("team.passport.create.titleTip")})}),e.jsx(E,{component:"div",style:{marginTop:16,marginBottom:16},children:e.jsx($,{label:t("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-role-input-description",fullWidth:!0,autoFocus:!0,value:y,onChange:I=>{r(null),x(I.target.value)},disabled:a,multiline:!0,rows:3})}),m==="create"&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx(Oe,{children:t("common.display")}),e.jsxs(We,{color:"primary",size:"small",value:d,exclusive:!0,style:{marginTop:16},disabled:a,onChange:(I,B)=>j(B),"data-cy":"input-role-display",children:[e.jsx(X,{value:"builtin","data-cy":"input-role-display-builtin",children:e.jsx(E,{children:t("team.passport.displayBuiltin")})}),e.jsx(X,{value:"custom","data-cy":"input-role-display-custom",children:e.jsx(E,{children:t("team.passport.displayCustom")})})]}),d==="custom"&&e.jsxs(e.Fragment,{children:[e.jsx(qe,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-role-types",value:S,disabled:a,onChange:I=>{T(I.target.value)}}),e.jsx(He,{children:t("team.passport.typesTip")})]})]})]});return e.jsxs(H,{title:m==="create"?t("team.passport.create.title"):"",fullWidth:!0,open:!0,onClose:o,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:o,color:"inherit",children:t("common.cancel")}),e.jsxs(L,{"data-cy":"mutate-role-confirm",onClick:b,color:"primary",disabled:a,variant:"contained",autoFocus:!0,children:[a&&e.jsx(M,{size:16}),t(m==="create"?"common.create":"common.update")]})]}),children:[e.jsx(yt,{component:"div",children:P}),!!s&&e.jsx(_e,{severity:"error",style:{width:"100%",margin:0},children:s})]})}we.propTypes={teamDid:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onError:w.func,mode:w.oneOf(["create","update"]),item:w.object};function Te({onCancel:u,onSuccess:o,onDelete:i,roleName:p,hasPermission:m=!1}){const{api:l}=k(),{roles:h,permissions:a,teamDid:f,refresh:s,isNodeTeam:r}=_(),{t}=F(),[n,c]=C.useState([]),[y,x]=C.useState(!1),[d,j]=C.useState(null),[S,T]=C.useState(!1),b=Z(h.find(A=>A.name===p)),P=Ye(p),I=async A=>{if(!S)try{T(!0),await l.deleteRole({input:{teamDid:f,name:A}}),i()}catch(v){R.error(v.message)}finally{T(!1),j(null)}},B=async(A,v)=>{const N=(await l.getPermissionsByRole({input:{teamDid:A,role:{name:v}}})).permissions||[],O=a.map(Ie=>({...Ie,bind:N.some(pt=>pt.name===Ie.name)}));c(O)},V=async()=>{T(!0);const A=n.filter(v=>v.bind).map(v=>v.name);try{await l.updatePermissionsForRole({input:{teamDid:f,roleName:b.name,grantNames:A}}),R.success(t("common.saveSuccess")),o()}catch(v){R.error(te(v))}finally{T(!1)}};C.useEffect(()=>{f&&p&&B(f,p)},[f,p]);const z=r||!m;let Y=null;return r&&(Y=e.jsxs("div",{className:"bind",children:[e.jsx("div",{className:"title",children:t("common.permission")}),e.jsx("div",{className:"list",children:n.filter(A=>z?A.bind:!0).map(A=>e.jsx("div",{className:"item",children:e.jsx(jt,{control:e.jsx(vt,{disabled:z,checked:A.bind,onChange:()=>{c(v=>v.map(D=>(D.name===A.name&&(D.bind=!D.bind),D)))},name:A.name}),label:A.description})}))})]})),e.jsxs(H,{title:t("common.passport"),onClose:u,open:!0,fullWidth:!0,toolbar:m&&!P&&e.jsxs(e.Fragment,{children:[e.jsx(W,{onClick:()=>x(b),"data-cy":`edit-passport-${b.name}`,size:"large",children:e.jsx(oe,{fill:"#bfbfbf"})}),e.jsx(W,{onClick:()=>j({title:t("team.passport.delete.title"),description:t("team.passport.delete.description",{name:b.title}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:()=>{I(b.name)},onCancel:()=>{T(!1),j(null)}}),"data-cy":`delete-passport-${b.name}`,size:"large",children:e.jsx(ie,{"data-cy":"close-passport-dialog",fill:"#bfbfbf"})})]}),actions:r&&!z&&e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:t("common.cancel")}),e.jsxs(L,{onClick:V,color:"primary",disabled:S||!b,variant:"contained",autoFocus:!0,"data-cy":"bind-permission-btn-confirm",children:[S&&e.jsx(M,{size:16}),t("common.save")]})]}),children:[e.jsxs(hs,{children:[!b&&e.jsx(gs,{children:e.jsx(M,{})}),b&&e.jsxs("div",{className:"dialog-content",children:[e.jsxs("div",{className:"header",children:[e.jsx("div",{className:"title",children:b.title}),e.jsx("div",{className:"description",style:{marginTop:r?16:48},children:b.description})]}),Y]})]}),y&&e.jsx(we,{teamDid:f,onCancel:()=>x(null),onSuccess:()=>{x(null),s()},mode:"update",roleName:y.name,item:y}),d&&e.jsx(ve,{title:d.title,description:d.description,confirm:d.confirm,cancel:d.cancel,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel})]})}const ms=G(Te,"mutate_team"),fs=G(Te,"",J);function xs(u){const{inService:o}=k();return o?e.jsx(fs,{...u}):e.jsx(ms,{...u})}Te.propTypes={roleName:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onDelete:w.func.isRequired,hasPermission:w.bool};const hs=q.div`
135
+ */var ue,Ne;function cs(){if(Ne)return ue;Ne=1,ue=function(i){return i!=null&&(u(i)||o(i)||!!i._isBuffer)};function u(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function o(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&u(i.slice(0,0))}return ue}var Le;function ds(){return Le||(Le=1,function(){var u=ls(),o=Fe().utf8,i=cs(),p=Fe().bin,m=function(l,h){l.constructor==String?h&&h.encoding==="binary"?l=p.stringToBytes(l):l=o.stringToBytes(l):i(l)?l=Array.prototype.slice.call(l,0):!Array.isArray(l)&&l.constructor!==Uint8Array&&(l=l.toString());for(var a=u.bytesToWords(l),f=l.length*8,s=1732584193,r=-271733879,t=-1732584194,n=271733878,c=0;c<a.length;c++)a[c]=(a[c]<<8|a[c]>>>24)&16711935|(a[c]<<24|a[c]>>>8)&4278255360;a[f>>>5]|=128<<f%32,a[(f+64>>>9<<4)+14]=f;for(var y=m._ff,x=m._gg,d=m._hh,j=m._ii,c=0;c<a.length;c+=16){var S=s,T=r,C=t,P=n;s=y(s,r,t,n,a[c+0],7,-680876936),n=y(n,s,r,t,a[c+1],12,-389564586),t=y(t,n,s,r,a[c+2],17,606105819),r=y(r,t,n,s,a[c+3],22,-1044525330),s=y(s,r,t,n,a[c+4],7,-176418897),n=y(n,s,r,t,a[c+5],12,1200080426),t=y(t,n,s,r,a[c+6],17,-1473231341),r=y(r,t,n,s,a[c+7],22,-45705983),s=y(s,r,t,n,a[c+8],7,1770035416),n=y(n,s,r,t,a[c+9],12,-1958414417),t=y(t,n,s,r,a[c+10],17,-42063),r=y(r,t,n,s,a[c+11],22,-1990404162),s=y(s,r,t,n,a[c+12],7,1804603682),n=y(n,s,r,t,a[c+13],12,-40341101),t=y(t,n,s,r,a[c+14],17,-1502002290),r=y(r,t,n,s,a[c+15],22,1236535329),s=x(s,r,t,n,a[c+1],5,-165796510),n=x(n,s,r,t,a[c+6],9,-1069501632),t=x(t,n,s,r,a[c+11],14,643717713),r=x(r,t,n,s,a[c+0],20,-373897302),s=x(s,r,t,n,a[c+5],5,-701558691),n=x(n,s,r,t,a[c+10],9,38016083),t=x(t,n,s,r,a[c+15],14,-660478335),r=x(r,t,n,s,a[c+4],20,-405537848),s=x(s,r,t,n,a[c+9],5,568446438),n=x(n,s,r,t,a[c+14],9,-1019803690),t=x(t,n,s,r,a[c+3],14,-187363961),r=x(r,t,n,s,a[c+8],20,1163531501),s=x(s,r,t,n,a[c+13],5,-1444681467),n=x(n,s,r,t,a[c+2],9,-51403784),t=x(t,n,s,r,a[c+7],14,1735328473),r=x(r,t,n,s,a[c+12],20,-1926607734),s=d(s,r,t,n,a[c+5],4,-378558),n=d(n,s,r,t,a[c+8],11,-2022574463),t=d(t,n,s,r,a[c+11],16,1839030562),r=d(r,t,n,s,a[c+14],23,-35309556),s=d(s,r,t,n,a[c+1],4,-1530992060),n=d(n,s,r,t,a[c+4],11,1272893353),t=d(t,n,s,r,a[c+7],16,-155497632),r=d(r,t,n,s,a[c+10],23,-1094730640),s=d(s,r,t,n,a[c+13],4,681279174),n=d(n,s,r,t,a[c+0],11,-358537222),t=d(t,n,s,r,a[c+3],16,-722521979),r=d(r,t,n,s,a[c+6],23,76029189),s=d(s,r,t,n,a[c+9],4,-640364487),n=d(n,s,r,t,a[c+12],11,-421815835),t=d(t,n,s,r,a[c+15],16,530742520),r=d(r,t,n,s,a[c+2],23,-995338651),s=j(s,r,t,n,a[c+0],6,-198630844),n=j(n,s,r,t,a[c+7],10,1126891415),t=j(t,n,s,r,a[c+14],15,-1416354905),r=j(r,t,n,s,a[c+5],21,-57434055),s=j(s,r,t,n,a[c+12],6,1700485571),n=j(n,s,r,t,a[c+3],10,-1894986606),t=j(t,n,s,r,a[c+10],15,-1051523),r=j(r,t,n,s,a[c+1],21,-2054922799),s=j(s,r,t,n,a[c+8],6,1873313359),n=j(n,s,r,t,a[c+15],10,-30611744),t=j(t,n,s,r,a[c+6],15,-1560198380),r=j(r,t,n,s,a[c+13],21,1309151649),s=j(s,r,t,n,a[c+4],6,-145523070),n=j(n,s,r,t,a[c+11],10,-1120210379),t=j(t,n,s,r,a[c+2],15,718787259),r=j(r,t,n,s,a[c+9],21,-343485551),s=s+S>>>0,r=r+T>>>0,t=t+C>>>0,n=n+P>>>0}return u.endian([s,r,t,n])};m._ff=function(l,h,a,f,s,r,t){var n=l+(h&a|~h&f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._gg=function(l,h,a,f,s,r,t){var n=l+(h&f|a&~f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._hh=function(l,h,a,f,s,r,t){var n=l+(h^a^f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._ii=function(l,h,a,f,s,r,t){var n=l+(a^(h|~f))+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._blocksize=16,m._digestsize=16,ce.exports=function(l,h){if(l==null)throw new Error("Illegal argument "+l);var a=u.wordsToBytes(m(l,h));return h&&h.asBytes?a:h&&h.asString?p.bytesToString(a):u.bytesToHex(a)}}()),ce.exports}var ps=ds();const us=Me(ps);function we({teamDid:u,onCancel:o,onSuccess:i,onError:p=()=>{},mode:m="create",item:l={}}){const{api:h}=k(),[a,f]=b.useState(!1),[s,r]=b.useState(""),{t}=F(),[n,c]=b.useState(l.title||""),[y,x]=b.useState(l.description||""),[d,j]=b.useState(l?.extra?.display||"builtin"),[S,T]=b.useState(l?.extra?.types?l.extra.types.join(","):""),C=async()=>{const D=n.trim();if(!D){r(t("team.passport.error.titleEmpty"));return}if(D.length>64){r(t("team.passport.error.titleTooLong",{length:64}));return}const B=y.replace(/\n/g," ");if(!B){r(t("team.passport.error.descriptionEmpty"));return}const V=m==="create"?us(D):l.name;r(null),f(!0);try{if(m==="create"){const z={teamDid:u,name:V,title:D,description:B};d==="custom"&&(z.extra=JSON.stringify({display:"custom",types:S.split(",")})),await h.createRole({input:z})}else{const z={teamDid:u,role:{name:V,title:D,description:B}};await h.updateRole({input:z})}i()}catch(z){const K=te(z);r(K),p(z)}finally{f(!1)}},P=e.jsxs("div",{children:[m==="update"&&e.jsx(E,{component:"div",style:{paddingTop:16},children:e.jsx($,{label:"ID",autoComplete:"off",variant:"outlined",name:"url","data-cy":"mutate-role-input-name",fullWidth:!0,autoFocus:!0,value:l.name,disabled:!0})}),e.jsx(E,{component:"div",style:{marginTop:16},children:e.jsx($,{label:t("common.title"),autoComplete:"off",variant:"outlined",name:"title","data-cy":"mutate-role-input-title",fullWidth:!0,autoFocus:!0,value:n,onChange:D=>{r(null),c(D.target.value)},disabled:m==="update"||a,helperText:t("team.passport.create.titleTip")})}),e.jsx(E,{component:"div",style:{marginTop:16,marginBottom:16},children:e.jsx($,{label:t("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-role-input-description",fullWidth:!0,autoFocus:!0,value:y,onChange:D=>{r(null),x(D.target.value)},disabled:a,multiline:!0,rows:3})}),m==="create"&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx(Oe,{children:t("common.display")}),e.jsxs(qe,{color:"primary",size:"small",value:d,exclusive:!0,style:{marginTop:16},disabled:a,onChange:(D,B)=>j(B),"data-cy":"input-role-display",children:[e.jsx(X,{value:"builtin","data-cy":"input-role-display-builtin",children:e.jsx(E,{children:t("team.passport.displayBuiltin")})}),e.jsx(X,{value:"custom","data-cy":"input-role-display-custom",children:e.jsx(E,{children:t("team.passport.displayCustom")})})]}),d==="custom"&&e.jsxs(e.Fragment,{children:[e.jsx(We,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-role-types",value:S,disabled:a,onChange:D=>{T(D.target.value)}}),e.jsx(He,{children:t("team.passport.typesTip")})]})]})]});return e.jsxs(H,{title:m==="create"?t("team.passport.create.title"):"",fullWidth:!0,open:!0,onClose:o,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:o,color:"inherit",children:t("common.cancel")}),e.jsxs(L,{"data-cy":"mutate-role-confirm",onClick:C,color:"primary",disabled:a,variant:"contained",autoFocus:!0,children:[a&&e.jsx(M,{size:16}),t(m==="create"?"common.create":"common.update")]})]}),children:[e.jsx(yt,{component:"div",children:P}),!!s&&e.jsx(_e,{severity:"error",style:{width:"100%",margin:0},children:s})]})}we.propTypes={teamDid:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onError:w.func,mode:w.oneOf(["create","update"]),item:w.object};function Te({onCancel:u,onSuccess:o,onDelete:i,roleName:p,hasPermission:m=!1}){const{api:l}=k(),{roles:h,permissions:a,teamDid:f,refresh:s,isNodeTeam:r}=_(),{t}=F(),[n,c]=b.useState([]),[y,x]=b.useState(!1),[d,j]=b.useState(null),[S,T]=b.useState(!1),C=Z(h.find(A=>A.name===p)),P=Ke(p),D=async A=>{if(!S)try{T(!0),await l.deleteRole({input:{teamDid:f,name:A}}),i()}catch(v){R.error(v.message)}finally{T(!1),j(null)}},B=async(A,v)=>{const N=(await l.getPermissionsByRole({input:{teamDid:A,role:{name:v}}})).permissions||[],O=a.map(De=>({...De,bind:N.some(pt=>pt.name===De.name)}));c(O)},V=async()=>{T(!0);const A=n.filter(v=>v.bind).map(v=>v.name);try{await l.updatePermissionsForRole({input:{teamDid:f,roleName:C.name,grantNames:A}}),R.success(t("common.saveSuccess")),o()}catch(v){R.error(te(v))}finally{T(!1)}};b.useEffect(()=>{f&&p&&B(f,p)},[f,p]);const z=r||!m;let K=null;return r&&(K=e.jsxs("div",{className:"bind",children:[e.jsx("div",{className:"title",children:t("common.permission")}),e.jsx("div",{className:"list",children:n.filter(A=>z?A.bind:!0).map(A=>e.jsx("div",{className:"item",children:e.jsx(jt,{control:e.jsx(vt,{disabled:z,checked:A.bind,onChange:()=>{c(v=>v.map(I=>(I.name===A.name&&(I.bind=!I.bind),I)))},name:A.name}),label:A.description})}))})]})),e.jsxs(H,{title:t("common.passport"),onClose:u,open:!0,fullWidth:!0,toolbar:m&&!P&&e.jsxs(e.Fragment,{children:[e.jsx(q,{onClick:()=>x(C),"data-cy":`edit-passport-${C.name}`,size:"large",children:e.jsx(oe,{fill:"#bfbfbf"})}),e.jsx(q,{onClick:()=>j({title:t("team.passport.delete.title"),description:t("team.passport.delete.description",{name:C.title}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:()=>{D(C.name)},onCancel:()=>{T(!1),j(null)}}),"data-cy":`delete-passport-${C.name}`,size:"large",children:e.jsx(ie,{"data-cy":"close-passport-dialog",fill:"#bfbfbf"})})]}),actions:r&&!z&&e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:t("common.cancel")}),e.jsxs(L,{onClick:V,color:"primary",disabled:S||!C,variant:"contained",autoFocus:!0,"data-cy":"bind-permission-btn-confirm",children:[S&&e.jsx(M,{size:16}),t("common.save")]})]}),children:[e.jsxs(hs,{children:[!C&&e.jsx(gs,{children:e.jsx(M,{})}),C&&e.jsxs("div",{className:"dialog-content",children:[e.jsxs("div",{className:"header",children:[e.jsx("div",{className:"title",children:C.title}),e.jsx("div",{className:"description",style:{marginTop:r?16:48},children:C.description})]}),K]})]}),y&&e.jsx(we,{teamDid:f,onCancel:()=>x(null),onSuccess:()=>{x(null),s()},mode:"update",roleName:y.name,item:y}),d&&e.jsx(ve,{title:d.title,description:d.description,confirm:d.confirm,cancel:d.cancel,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel})]})}const ms=G(Te,"mutate_team"),fs=G(Te,"",J);function xs(u){const{inService:o}=k();return o?e.jsx(fs,{...u}):e.jsx(ms,{...u})}Te.propTypes={roleName:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onDelete:w.func.isRequired,hasPermission:w.bool};const hs=W.div`
136
136
  .header {
137
137
  .title {
138
138
  font-weight: 400;
@@ -175,13 +175,13 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
175
175
  padding-right: 12px;
176
176
  }
177
177
  }
178
- `,gs=q.div`
178
+ `,gs=W.div`
179
179
  flex: 1;
180
180
  display: flex;
181
181
  justify-content: center;
182
182
  align-items: center;
183
183
  height: 200px;
184
- `,Be=C.memo(({field:u,value:o,copyable:i})=>{const{local:p}=F();return o?e.jsxs(g,{onClick:m=>m.stopPropagation(),sx:{display:"flex",alignItems:"center",gap:1},children:[u?e.jsxs(De,{variant:"subtitle1",color:"textSecondary",sx:{width:50,textAlign:"right"},children:[u,":"]}):null,e.jsx(De,{variant:"body1",children:e.jsxs(g,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(K,{title:o,children:e.jsx("span",{className:"value-ellipsis",children:o})}),i?e.jsx(Dt,{content:Wt(o),locale:p,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}):null]})})]}):null});function lt({createPassportSvg:u}){const{inService:o}=k(),{roles:i,teamIssuerDid:p,teamName:m,refresh:l,passportColor:h,teamDid:a,isNodeTeam:f}=_(),{t:s}=F(),[r,t]=C.useState(!1),[n,c]=C.useState(!1),y=Ct(d=>d.breakpoints.down("md")),x=C.useCallback(d=>d&&!U.ROLES[d.toUpperCase()],[]);return e.jsxs(ys,{sx:{mt:0},children:[e.jsx(g,{sx:{display:"flex",justifyContent:"flex-end"},children:!f&&e.jsxs(bt,{variant:"contained",edge:"end",color:"primary","data-cy":"create-role",onClick:()=>t(!0),children:[e.jsx(me,{style:{fontSize:16,marginRight:4}}),s("team.passport.create.title")]})}),e.jsx(g,{className:"list",children:i.map(d=>e.jsxs(g,{"data-cy":`passport-${d.name}`,className:"item",onClick:()=>c(d),sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(g,{sx:{display:"flex",alignItems:"center"},children:[e.jsx("div",{style:{width:150},dangerouslySetInnerHTML:{__html:u({title:d.title,issuer:m,issuerDid:p,ownerName:"Your Name",ownerDid:p,preferredColor:h,width:"150px"})}}),e.jsxs(g,{className:"title",sx:{ml:3},children:[e.jsx(Be,{value:d.title}),x(d.name)?e.jsx(Be,{value:d.name,copyable:!0}):null]})]}),!y&&e.jsx(g,{className:"description",children:d.description}),e.jsx(Je,{permission:o?"":"mutate_team",role:o?J:[],children:e.jsx("div",{className:"action",children:Ye(d.name)?e.jsx(Ht,{}):e.jsx(oe,{})})})]},d.name))}),n&&e.jsx(xs,{onCancel:()=>c(!1),onSuccess:()=>{c(!1),l()},onDelete:()=>{c(!1),l()},mode:"update",roleName:n.name,item:n}),r&&e.jsx(we,{teamDid:a,onCancel:()=>t(!1),onSuccess:()=>{t(!1),l()}})]})}const ys=q(g)`
184
+ `,Be=b.memo(({field:u,value:o,copyable:i})=>{const{local:p}=F();return o?e.jsxs(g,{onClick:m=>m.stopPropagation(),sx:{display:"flex",alignItems:"center",gap:1},children:[u?e.jsxs(Ie,{variant:"subtitle1",color:"textSecondary",sx:{width:50,textAlign:"right"},children:[u,":"]}):null,e.jsx(Ie,{variant:"body1",children:e.jsxs(g,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(Y,{title:o,children:e.jsx("span",{className:"value-ellipsis",children:o})}),i?e.jsx(It,{content:qt(o),locale:p,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}):null]})})]}):null});function lt({createPassportSvg:u}){const{inService:o}=k(),{roles:i,teamIssuerDid:p,teamName:m,refresh:l,passportColor:h,teamDid:a,isNodeTeam:f}=_(),{t:s}=F(),[r,t]=b.useState(!1),[n,c]=b.useState(!1),y=bt(d=>d.breakpoints.down("md")),x=b.useCallback(d=>d&&!U.ROLES[d.toUpperCase()],[]);return e.jsxs(ys,{sx:{mt:0},children:[e.jsx(g,{sx:{display:"flex",justifyContent:"flex-end"},children:!f&&e.jsxs(Ct,{variant:"contained",edge:"end",color:"primary","data-cy":"create-role",onClick:()=>t(!0),children:[e.jsx(me,{style:{fontSize:16,marginRight:4}}),s("team.passport.create.title")]})}),e.jsx(g,{className:"list",children:i.map(d=>e.jsxs(g,{"data-cy":`passport-${d.name}`,className:"item",onClick:()=>c(d),sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(g,{sx:{display:"flex",alignItems:"center"},children:[e.jsx("div",{style:{width:150},dangerouslySetInnerHTML:{__html:u({title:d.title,issuer:m,issuerDid:p,ownerName:"Your Name",ownerDid:p,preferredColor:h,width:"150px"})}}),e.jsxs(g,{className:"title",sx:{ml:3},children:[e.jsx(Be,{value:d.title}),x(d.name)?e.jsx(Be,{value:d.name,copyable:!0}):null]})]}),!y&&e.jsx(g,{className:"description",children:d.description}),e.jsx(Je,{permission:o?"":"mutate_team",role:o?J:[],children:e.jsx("div",{className:"action",children:Ke(d.name)?e.jsx(Ht,{}):e.jsx(oe,{})})})]},d.name))}),n&&e.jsx(xs,{onCancel:()=>c(!1),onSuccess:()=>{c(!1),l()},onDelete:()=>{c(!1),l()},mode:"update",roleName:n.name,item:n}),r&&e.jsx(we,{teamDid:a,onCancel:()=>t(!1),onSuccess:()=>{t(!1),l()}})]})}const ys=W(g)`
185
185
  .list {
186
186
  .item {
187
187
  padding: 12px;
@@ -219,7 +219,7 @@ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
219
219
  fill: ${({theme:u})=>u.palette.text.secondary};
220
220
  }
221
221
  }
222
- `;lt.propTypes={createPassportSvg:w.func.isRequired};function ct({createPassportSvg:u}){const{t:o}=F(),{api:i,inService:p}=k(),{teamDid:m,refresh:l,enablePassportIssuance:h,isNodeTeam:a}=_(),[f,s]=C.useState(!1),[r,t]=C.useState(!1),[n,c]=C.useState(!1),[y,x]=C.useState(!1),[d,j]=C.useState(!1),S=async T=>{if(T.stopPropagation(),!y){x(!0);try{await i.configPassportIssuance({input:{teamDid:m,enable:!h}}),l(),await se(800),R.success(o("common.configSuccess"))}catch(b){R.error(b.message)}finally{x(!1)}}};return e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1,ml:1},children:[e.jsx(Je,{permission:p?"":"mutate_team",role:p?J:[],children:e.jsx(Q,{variant:"outlined",menuButtonProps:{"data-cy":"trusted-issuers-more"},menu:e.jsxs(e.Fragment,{children:[e.jsx(Q.Item,{onClick:()=>t(!0),"data-cy":"config-trusted-issuers",children:e.jsxs(g,{children:[o("team.passport.trustedPassportIssuers"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o("team.passport.trustedPassportIssuersTip")})]})}),e.jsx(Q.Item,{onClick:()=>c(!0),"data-cy":"config-show-trusted-factories",children:e.jsxs(g,{children:[o("team.passport.configFactories"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o("team.passport.configFactoriesTip")})]})}),e.jsx(Q.Item,{"data-cy":"config-show-issue-passport",onClick:S,children:e.jsxs(g,{sx:{display:"flex",alignItems:"center"},children:[y&&e.jsx(M,{size:16,style:{marginRight:8}}),e.jsxs(g,{children:[o(h?"team.passport.disableIssuance":"team.passport.enableIssuance"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o(h?"team.passport.disableIssuanceTip":"team.passport.enableIssuanceTip")})]})]})}),!a&&e.jsx(Q.Item,{onClick:()=>s(!0),"data-cy":"config-passport-color",children:e.jsxs(g,{children:[o("team.passport.configColor"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o("team.passport.configColorTip")})]})})]}),children:()=>e.jsx(L,{variant:"outlined",onClick:()=>{j(!0)},children:o("team.passport.view")})})}),r&&e.jsx(es,{onCancel:()=>t(!1)}),n&&e.jsx(os,{onCancel:()=>c(!1)}),f&&e.jsx(Kt,{onCancel:()=>s(!1),onSuccess:()=>s(!1)}),d&&e.jsx(H,{open:!0,maxWidth:"lg",onClose:()=>j(!1),onBackdropClick:()=>j(!1),onEscapeKeyDown:()=>j(!1),title:o("team.passport.view"),children:e.jsx(lt,{createPassportSvg:u,onCancel:()=>j(!1)})})]})}ct.propTypes={createPassportSvg:w.func.isRequired};const ze="$all",Ee="",dt=ut.memo(({createPassportSvg:u,passport:o,teamDid:i,inService:p})=>e.jsx(g,{sx:{display:"flex"},dangerouslySetInnerHTML:{__html:u({scope:o.scope,role:o.role,title:o.scope==="kyc"?o.name:o.title,issuer:o.issuer&&o.issuer.name,issuerDid:o.issuer&&o.issuer.id,ownerName:o.user?.fullName,ownerDid:o.user?.did,ownerAvatarUrl:o.user?.avatar?Ze(o.user?.avatar,i,p):"",revoked:o.revoked,width:"36px",extra:o?.expirationDate?{key:"Exp",value:Ve(o.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}}));dt.propTypes={passport:w.object.isRequired,createPassportSvg:w.func.isRequired,teamDid:w.string.isRequired,inService:w.bool.isRequired};function js({createPassportSvg:u}){const{api:o}=k(),{teamDid:i}=_(),{t:p,locale:m}=F(),{SYSTEM_ROLES:l}=zt(),{inService:h}=k(),[a,f]=C.useState(!1),s=`passports-${i}`,r=Pt(s),[t,n]=C.useState({role:ze,status:Ee,searchText:r.searchText||"",pageSize:r.rowsPerPage||10,page:r.page?r.page+1:1}),{data:c,loading:y}=re(async()=>(await o.getPassportRoleCounts({input:{teamDid:i}})).counts||[],{refreshDeps:[i]}),{data:x,loading:d}=re(async()=>{const v={};t.role!==ze&&(v.role=t.role),t.status&&(v.status=t.status);const D=await o.getPassportsByRole({input:{teamDid:i,query:v,paging:{page:t.page,pageSize:t.pageSize}}});return{passports:D.passports||[],total:D.paging.total}},{refreshDeps:[t.role,t.status,t.page,t.pageSize],onError:v=>R.error(v.message)}),j=v=>c?.find(N=>N.key===v)?.value||0,S=C.useMemo(()=>Object.keys(l).map(v=>({name:v,title:l[v],num:j(v)})),[c,j]),T=C.useMemo(()=>[{label:p("team.passport.role"),name:"role",options:{customBodyRender:(v,{rowIndex:D})=>{const N=x?.passports[D];return e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(dt,{createPassportSvg:u,passport:N,teamDid:i}),e.jsx(g,{children:ge(N.title)})]})}}},{label:p("team.passport.owner"),name:"user",options:{customBodyRender:v=>ye(v,h)}},{label:p("team.passport.status"),name:"status",options:{customBodyRender:je}},{label:p("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:v=>Ke(v,m)}},{label:p("common.address"),name:"id",options:{customBodyRender:Et}},{label:p("blocklet.overview.source"),name:"source",options:{customBodyRender:(v,{rowIndex:D})=>{const N=x?.passports[D];return N.parentDid?ne("recover"):ne(N.source)}}}],[p,m,x?.passports,i,u,h]),b=v=>{n(D=>({...D,role:v,page:1}))},P=({page:v,rowsPerPage:D,searchText:N})=>{t.pageSize!==D?n(O=>({...O,searchText:"",pageSize:D,page:1})):t.page!==v+1?n(O=>({...O,searchText:"",page:v+1})):t.searchText!==N&&n(O=>({...O,searchText:N,page:1}))},I=C.useRef(null),B=x?.passports||[],V=t.searchText?B.filter(v=>v.id.includes(t.searchText)||(v?.user?.fullName||"").includes(t.searchText)):B,z={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,onRowClick(v,{dataIndex:D},N){if(I.current?.contains(N.target)){const O=x?.passports[D];f(O)}},page:t.page-1,rowsPerPage:t.pageSize,count:x?.total||0,searchDebounceTime:600},Y=v=>{n(D=>({...D,status:v.target.value,page:1}))},A=e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsxs(g,{sx:{fontSize:16,fontWeight:400},children:[p("team.passport.status"),":"]}),e.jsxs(St,{size:"small",value:t.status,onChange:Y,displayEmpty:!0,sx:{minWidth:120,height:36,".MuiSelect-select":{py:.5,px:1.5}},children:[e.jsx(ae,{value:Ee,children:p("common.all")}),Object.values(U.PASSPORT_STATUS).map(v=>e.jsx(ae,{value:v,sx:{py:1},children:p(`team.passport.statusMap.${v}`)},v))]})]});return y?e.jsx(g,{sx:{py:2},children:e.jsx(ee,{direction:"row",spacing:1,sx:{justifyContent:"center",alignItems:"center",position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsxs(vs,{children:[e.jsxs(g,{className:"main",sx:{display:"flex",mt:0,gap:3},children:[e.jsx(g,{className:"left",children:e.jsx(g,{className:"tabs",children:S.map(v=>e.jsxs(g,{className:`tab ${t.role===v.name?"active":""}`,onClick:()=>b(v.name),children:[e.jsx("span",{className:"text",children:v.title}),e.jsx(g,{sx:{color:"text.secondary"},children:v.num})]},v.name))})}),e.jsx(g,{ref:I,className:"right",children:e.jsx(fe,{className:"main-table",verticalKeyWidth:100,locale:m,durable:s,durableKeys:["page","rowsPerPage"],data:V,columns:T,options:z,loading:d,onChange:P,customButtons:[e.jsx(ct,{createPassportSvg:u})],title:A})})]}),a&&e.jsx(Xe,{createPassportSvg:u,onCancel:()=>f(null),passport:a,onSwitchPassport:f})]})}js.propTypes={createPassportSvg:w.func.isRequired};const vs=wt(g)`
222
+ `;lt.propTypes={createPassportSvg:w.func.isRequired};function ct({createPassportSvg:u}){const{t:o}=F(),{api:i,inService:p}=k(),{teamDid:m,refresh:l,enablePassportIssuance:h,isNodeTeam:a}=_(),[f,s]=b.useState(!1),[r,t]=b.useState(!1),[n,c]=b.useState(!1),[y,x]=b.useState(!1),[d,j]=b.useState(!1),S=async T=>{if(T.stopPropagation(),!y){x(!0);try{await i.configPassportIssuance({input:{teamDid:m,enable:!h}}),l(),await se(800),R.success(o("common.configSuccess"))}catch(C){R.error(C.message)}finally{x(!1)}}};return e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1,ml:1},children:[e.jsx(Je,{permission:p?"":"mutate_team",role:p?J:[],children:e.jsx(Q,{variant:"outlined",menuButtonProps:{"data-cy":"trusted-issuers-more"},menu:e.jsxs(e.Fragment,{children:[e.jsx(Q.Item,{onClick:()=>t(!0),"data-cy":"config-trusted-issuers",children:e.jsxs(g,{children:[o("team.passport.trustedPassportIssuers"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o("team.passport.trustedPassportIssuersTip")})]})}),e.jsx(Q.Item,{onClick:()=>c(!0),"data-cy":"config-show-trusted-factories",children:e.jsxs(g,{children:[o("team.passport.configFactories"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o("team.passport.configFactoriesTip")})]})}),e.jsx(Q.Item,{"data-cy":"config-show-issue-passport",onClick:S,children:e.jsxs(g,{sx:{display:"flex",alignItems:"center"},children:[y&&e.jsx(M,{size:16,style:{marginRight:8}}),e.jsxs(g,{children:[o(h?"team.passport.disableIssuance":"team.passport.enableIssuance"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o(h?"team.passport.disableIssuanceTip":"team.passport.enableIssuanceTip")})]})]})}),!a&&e.jsx(Q.Item,{onClick:()=>s(!0),"data-cy":"config-passport-color",children:e.jsxs(g,{children:[o("team.passport.configColor"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o("team.passport.configColorTip")})]})})]}),children:()=>e.jsx(L,{variant:"outlined",onClick:()=>{j(!0)},children:o("team.passport.view")})})}),r&&e.jsx(es,{onCancel:()=>t(!1)}),n&&e.jsx(os,{onCancel:()=>c(!1)}),f&&e.jsx(Yt,{onCancel:()=>s(!1),onSuccess:()=>s(!1)}),d&&e.jsx(H,{open:!0,maxWidth:"lg",onClose:()=>j(!1),onBackdropClick:()=>j(!1),onEscapeKeyDown:()=>j(!1),title:o("team.passport.view"),children:e.jsx(lt,{createPassportSvg:u,onCancel:()=>j(!1)})})]})}ct.propTypes={createPassportSvg:w.func.isRequired};const ze="$all",Ee="",dt=ut.memo(({createPassportSvg:u,passport:o,teamDid:i,inService:p})=>e.jsx(g,{sx:{display:"flex"},dangerouslySetInnerHTML:{__html:u({scope:o.scope,role:o.role,title:o.scope==="kyc"?o.name:o.title,issuer:o.issuer&&o.issuer.name,issuerDid:o.issuer&&o.issuer.id,ownerName:o.user?.fullName,ownerDid:o.user?.did,ownerAvatarUrl:o.user?.avatar?Ze(o.user?.avatar,i,p):"",revoked:o.revoked,width:"36px",extra:o?.expirationDate?{key:"Exp",value:Ge(o.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}}));dt.propTypes={passport:w.object.isRequired,createPassportSvg:w.func.isRequired,teamDid:w.string.isRequired,inService:w.bool.isRequired};function js({createPassportSvg:u}){const{api:o}=k(),{teamDid:i}=_(),{t:p,locale:m}=F(),{SYSTEM_ROLES:l}=zt(),{inService:h}=k(),[a,f]=b.useState(!1),s=`passports-${i}`,r=Pt(s),[t,n]=b.useState({role:ze,status:Ee,searchText:r.searchText||"",pageSize:r.rowsPerPage||10,page:r.page?r.page+1:1}),{data:c,loading:y}=re(async()=>(await o.getPassportRoleCounts({input:{teamDid:i}})).counts||[],{refreshDeps:[i]}),{data:x,loading:d}=re(async()=>{const v={};t.role!==ze&&(v.role=t.role),t.status&&(v.status=t.status);const I=await o.getPassportsByRole({input:{teamDid:i,query:v,paging:{page:t.page,pageSize:t.pageSize}}});return{passports:I.passports||[],total:I.paging.total}},{refreshDeps:[t.role,t.status,t.page,t.pageSize],onError:v=>R.error(v.message)}),j=v=>c?.find(N=>N.key===v)?.value||0,S=b.useMemo(()=>Object.keys(l).map(v=>({name:v,title:l[v],num:j(v)})),[c,j]),T=b.useMemo(()=>[{label:p("team.passport.role"),name:"role",options:{customBodyRender:(v,{rowIndex:I})=>{const N=x?.passports[I];return e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(dt,{createPassportSvg:u,passport:N,teamDid:i}),e.jsx(g,{children:ge(N.title)})]})}}},{label:p("team.passport.owner"),name:"user",options:{customBodyRender:v=>ye(v,h)}},{label:p("team.passport.status"),name:"status",options:{customBodyRender:je}},{label:p("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:v=>Ye(v,m)}},{label:p("common.address"),name:"id",options:{customBodyRender:Et}},{label:p("blocklet.overview.source"),name:"source",options:{customBodyRender:(v,{rowIndex:I})=>{const N=x?.passports[I];return N.parentDid?ne("recover"):ne(N.source)}}}],[p,m,x?.passports,i,u,h]),C=v=>{n(I=>({...I,role:v,page:1}))},P=({page:v,rowsPerPage:I,searchText:N})=>{t.pageSize!==I?n(O=>({...O,searchText:"",pageSize:I,page:1})):t.page!==v+1?n(O=>({...O,searchText:"",page:v+1})):t.searchText!==N&&n(O=>({...O,searchText:N,page:1}))},D=b.useRef(null),B=x?.passports||[],V=t.searchText?B.filter(v=>v.id.includes(t.searchText)||(v?.user?.fullName||"").includes(t.searchText)):B,z={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,onRowClick(v,{dataIndex:I},N){if(D.current?.contains(N.target)){const O=x?.passports[I];f(O)}},page:t.page-1,rowsPerPage:t.pageSize,count:x?.total||0,searchDebounceTime:600},K=v=>{n(I=>({...I,status:v.target.value,page:1}))},A=e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsxs(g,{sx:{fontSize:16,fontWeight:400},children:[p("team.passport.status"),":"]}),e.jsxs(St,{size:"small",value:t.status,onChange:K,displayEmpty:!0,sx:{minWidth:120,height:36,".MuiSelect-select":{py:.5,px:1.5}},children:[e.jsx(ae,{value:Ee,children:p("common.all")}),Object.values(U.PASSPORT_STATUS).map(v=>e.jsx(ae,{value:v,sx:{py:1},children:p(`team.passport.statusMap.${v}`)},v))]})]});return y?e.jsx(g,{sx:{py:2},children:e.jsx(ee,{direction:"row",spacing:1,sx:{justifyContent:"center",alignItems:"center",position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsxs(vs,{children:[e.jsxs(g,{className:"main",sx:{display:"flex",mt:0,gap:3},children:[e.jsx(g,{className:"left",children:e.jsx(g,{className:"tabs",children:S.map(v=>e.jsxs(g,{className:`tab ${t.role===v.name?"active":""}`,onClick:()=>C(v.name),children:[e.jsx("span",{className:"text",children:v.title}),e.jsx(g,{sx:{color:"text.secondary"},children:v.num})]},v.name))})}),e.jsx(g,{ref:D,className:"right",children:e.jsx(fe,{className:"main-table",verticalKeyWidth:100,locale:m,durable:s,durableKeys:["page","rowsPerPage"],data:V,columns:T,options:z,loading:d,onChange:P,customButtons:[e.jsx(ct,{createPassportSvg:u})],title:A})})]}),a&&e.jsx(Xe,{createPassportSvg:u,onCancel:()=>f(null),passport:a,onSwitchPassport:f})]})}js.propTypes={createPassportSvg:w.func.isRequired};const vs=wt(g)`
223
223
  .main {
224
224
  .left {
225
225
  width: 256px;