@abtnode/blocklet-services 1.16.45-beta-20250612-231219-481217be → 1.16.45-beta-20250618-073451-6e48fb62

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 (182) hide show
  1. package/api/index.js +11 -5
  2. package/api/libs/connect/session.js +6 -273
  3. package/api/libs/kyc.js +1 -1
  4. package/api/routes/blocklet.js +1 -1
  5. package/api/routes/csp-proxy.js +13 -14
  6. package/api/routes/oauth/client.js +2 -1
  7. package/api/routes/user.js +1 -2
  8. package/api/services/auth/connect/bind-wallet.js +2 -44
  9. package/api/services/auth/connect/gen-access-key.js +1 -1
  10. package/api/services/auth/connect/verify-destroy.js +6 -2
  11. package/api/services/auth/connect/verify-elevated.js +7 -2
  12. package/api/services/auth/passport.js +20 -7
  13. package/api/services/auth/session.js +2 -2
  14. package/api/services/oauth/client.js +1 -179
  15. package/api/util/federated.js +1 -12
  16. package/dist/assets/{AdapterDayjs-BzjU9O7t.js → AdapterDayjs-T0keO70D.js} +1 -1
  17. package/dist/assets/{ArrowDropDown-CrJjI_sT.js → ArrowDropDown-DKq28w-B.js} +1 -1
  18. package/dist/assets/{CheckCircle-BcPSvH2E.js → CheckCircle-DYKWpCjc.js} +1 -1
  19. package/dist/assets/{ChevronLeft-Ch9iK6fF.js → ChevronLeft-C5ZElVOZ.js} +1 -1
  20. package/dist/assets/{ChevronRight-DclARA5k.js → ChevronRight-BDtG7F9C.js} +1 -1
  21. package/dist/assets/{DeleteOutline-CnS2XiM1.js → DeleteOutline-CYuYysba.js} +1 -1
  22. package/dist/assets/{Done-C9LPqADS.js → Done-C4iTqhTW.js} +1 -1
  23. package/dist/assets/{Download-D9LfWoxF.js → Download-CkjiFBw2.js} +1 -1
  24. package/dist/assets/{Edit-rPlryssW.js → Edit-D-oqMZ6h.js} +1 -1
  25. package/dist/assets/{Error-q_AhSCeT.js → Error-Dt1QvSlR.js} +1 -1
  26. package/dist/assets/{ExpandLess-Da2Rv9Ox.js → ExpandLess-CRv5O8qM.js} +1 -1
  27. package/dist/assets/{Google-Buu8u6PW.js → Google-DboCD85r.js} +1 -1
  28. package/dist/assets/{Home-DkCBzKe9.js → Home-CROW9qUz.js} +1 -1
  29. package/dist/assets/{InfoOutlined-C8ZBPUhD.js → InfoOutlined-B5f3YRb4.js} +1 -1
  30. package/dist/assets/{Launch-Nu8TBDKk.js → Launch-Cy-UlooC.js} +1 -1
  31. package/dist/assets/{LaunchOutlined-DQZ7S23O.js → LaunchOutlined-Bcn_86ca.js} +1 -1
  32. package/dist/assets/{MoreHoriz-Ba9rYlyz.js → MoreHoriz-H_VQNQ9b.js} +1 -1
  33. package/dist/assets/{PlayArrow-RVSfCmrB.js → PlayArrow-DZsdEeq_.js} +1 -1
  34. package/dist/assets/{TuneOutlined-CwV20zYf.js → TuneOutlined-GyTVf3HU.js} +1 -1
  35. package/dist/assets/{ViewList-D1BI4ac9.js → ViewList-D0tVfaVX.js} +1 -1
  36. package/dist/assets/{access-control-C-kFaf9T.js → access-control-C9hWo6TU.js} +1 -1
  37. package/dist/assets/{actions-DYQW2ChM.js → actions-BgkGoToI.js} +1 -1
  38. package/dist/assets/add-component-core-CpBArNQj.js +768 -0
  39. package/dist/assets/{add-resource-BdL-oJxe.js → add-resource-YRx2pKzx.js} +1 -1
  40. package/dist/assets/{addon-DMedfvRj.js → addon-DZBLWIf7.js} +1 -1
  41. package/dist/assets/{advanced-BZZToP_j.js → advanced-C9eBqn30.js} +1 -1
  42. package/dist/assets/api-C1S8LUld.js +1 -0
  43. package/dist/assets/{appearance-CYop22yw.js → appearance-DzftIlmu.js} +1 -1
  44. package/dist/assets/{ar-D9QEDjY-.js → ar-DLXKKOGO.js} +1 -1
  45. package/dist/assets/{audit-logs-BtBk6uAY.js → audit-logs-Cljb9yLV.js} +2 -2
  46. package/dist/assets/{authorize-CQZkUNyV.js → authorize-BS4vDs5i.js} +1 -1
  47. package/dist/assets/{base-chart-C2FJuVG1.js → base-chart-CoApVzod.js} +1 -1
  48. package/dist/assets/{base32-DEjena1X.js → base32-Cbt7-U8e.js} +1 -1
  49. package/dist/assets/{branding-gXMozCeI.js → branding-BuuaXyqZ.js} +1 -1
  50. package/dist/assets/{branding-7ppDxFZf.js → branding-uCV5ZREf.js} +2 -2
  51. package/dist/assets/{bundle-avatar-B5-ypzmO.js → bundle-avatar-CH2OoDP-.js} +1 -1
  52. package/dist/assets/{button-YPMo8IwK.js → button-ogiWKbo_.js} +1 -1
  53. package/dist/assets/{click-to-copy-BMX2P5UB.js → click-to-copy-D0HginOX.js} +1 -1
  54. package/dist/assets/{cloneDeep-Jl_OPbSo.js → cloneDeep-CDl5kZTY.js} +1 -1
  55. package/dist/assets/{collapse-9taxUXec.js → collapse-D4xd-ptF.js} +1 -1
  56. package/dist/assets/{complete-C8T0HN-B.js → complete-D2In_TeH.js} +1 -1
  57. package/dist/assets/{component-D6hOmRzO.js → component-DN1QsNYm.js} +72 -72
  58. package/dist/assets/{config-Sq1CUTiJ.js → config-DEbtcbH9.js} +1 -1
  59. package/dist/assets/{config-DcwlSddI.js → config-DS_kGhWk.js} +1 -1
  60. package/dist/assets/{config-navigation-IR_yUgmM.js → config-navigation-BB2LlxWl.js} +6 -6
  61. package/dist/assets/{config-space-C3fS58cn.js → config-space-DlQnLPiY.js} +1 -1
  62. package/dist/assets/{confirm-DApmnpvm.js → confirm-Bbp7EOHO.js} +1 -1
  63. package/dist/assets/{connect-BF4GoRL-.js → connect-CtbQgg8c.js} +1 -1
  64. package/dist/assets/connect-hUOpYByL.js +5 -0
  65. package/dist/assets/{connect-to-Bwfa2hMr.js → connect-to-EzXJLWP1.js} +1 -1
  66. package/dist/assets/{dashboard-B2X6c8E8.js → dashboard-CpxtvWAW.js} +3 -3
  67. package/dist/assets/{de-BOa43YBF.js → de-CnbmrteH.js} +1 -1
  68. package/dist/assets/{delete-confirm-BsEqJQRY.js → delete-confirm-BdthpUzC.js} +1 -1
  69. package/dist/assets/{did-address-L54dTMrT.js → did-address-DFiM35OM.js} +1 -1
  70. package/dist/assets/{domain-BGh0GDuZ.js → domain-C7iO-bfS.js} +1 -1
  71. package/dist/assets/{domain-action-card-DWqnvzry.js → domain-action-card-CqcqlPAn.js} +2 -2
  72. package/dist/assets/domains-z_Wu9ucc.js +1 -0
  73. package/dist/assets/{dot-iw3hN9HL.js → dot-4jhL56kz.js} +1 -1
  74. package/dist/assets/{email-By_nAv9m.js → email-CH6lvIGE.js} +1 -1
  75. package/dist/assets/{es-A3ma-OJp.js → es-C7oXJBWv.js} +1 -1
  76. package/dist/assets/{exchange-passport-BsgMfRJS.js → exchange-passport-F8-Xn3rX.js} +1 -1
  77. package/dist/assets/{fr-I3xKp6I5.js → fr-DzleTcLj.js} +1 -1
  78. package/dist/assets/{fuel-RMmgm9AQ.js → fuel-BRI4NZNF.js} +1 -1
  79. package/dist/assets/{gen-access-key-4teK8Dys.js → gen-access-key-CjcE_UoL.js} +1 -1
  80. package/dist/assets/{get-safe-url-B8xlSMyD.js → get-safe-url-BS4IIyYC.js} +1 -1
  81. package/dist/assets/{get-safe-url-t1C0E5Ux.js → get-safe-url-CuT70yLx.js} +1 -1
  82. package/dist/assets/{hi-DacRhM8A.js → hi-B24wH0bs.js} +1 -1
  83. package/dist/assets/{home-CmHUXg5q.js → home-B7IeN8M_.js} +1 -1
  84. package/dist/assets/{id-B7LQAHL7.js → id-BIjW1vW9.js} +1 -1
  85. package/dist/assets/{iframe-Dj9NLHp2.js → iframe-DYXqfKJj.js} +1 -1
  86. package/dist/assets/{index-BeE0KRva.js → index-0KJGv8YB.js} +1 -1
  87. package/dist/assets/{index-DXeoVV9Y.js → index-BAtw7eB6.js} +1 -1
  88. package/dist/assets/{index-DaM-GRtb.js → index-BEyvIdTp.js} +1 -1
  89. package/dist/assets/{index-CMYalRl2.js → index-BMCGWiyM.js} +52 -52
  90. package/dist/assets/{index-Inc_KF9k.js → index-BW2DapLf.js} +3 -3
  91. package/dist/assets/{index-BCtTVvHw.js → index-BxJZWVOT.js} +1 -1
  92. package/dist/assets/{index-Cs3-IS09.js → index-ClFIRXfV.js} +1 -1
  93. package/dist/assets/{index-DtZg53T9.js → index-CqrC0g0e.js} +1 -1
  94. package/dist/assets/{index-NnUiYa0L.js → index-D6ye_M7F.js} +1 -1
  95. package/dist/assets/{index-C8uNNoMb.js → index-D7U3pqVe.js} +5 -5
  96. package/dist/assets/{index-BzZuK-66.js → index-DDI23z2P.js} +1 -1
  97. package/dist/assets/{index-Mzv6hCex.js → index-DECQi8Vb.js} +1 -1
  98. package/dist/assets/{index-SX_KWrQh.js → index-DeekZg9t.js} +1 -1
  99. package/dist/assets/{index-Be8E3hiQ.js → index-DhXQuL-K.js} +4 -4
  100. package/dist/assets/{index-F85lIJcp.js → index-Dj3HMPh8.js} +1 -1
  101. package/dist/assets/{index-CJQbYw9E.js → index-Dl0q_c7r.js} +1 -1
  102. package/dist/assets/{index-CCOwwQoc.js → index-DyCrJT9-.js} +1 -1
  103. package/dist/assets/{index-Dgsq6V-N.js → index-WjR0qttM.js} +1 -1
  104. package/dist/assets/index-ZdwmM3LS.js +284 -0
  105. package/dist/assets/{index-Dfw2EDXA.js → index-mitJwLHE.js} +9 -9
  106. package/dist/assets/{index-CKY4HT0P.js → index-w4f-mlFt.js} +1 -1
  107. package/dist/assets/{invitation-Ck_kq3Tr.js → invitation-D7jOoJzU.js} +1 -1
  108. package/dist/assets/{invite-89aeW4Ho.js → invite-BiE9G1lr.js} +1 -1
  109. package/dist/assets/{issue-passport-4udVYVdq.js → issue-passport-BxmBoE32.js} +1 -1
  110. package/dist/assets/{item-D0U5vYXJ.js → item-BuWWRgL8.js} +1 -1
  111. package/dist/assets/{ja-DRQ4Eecl.js → ja-mu0bc5Fx.js} +1 -1
  112. package/dist/assets/{ko-CzL3UzwL.js → ko-CSWdQF8q.js} +1 -1
  113. package/dist/assets/{layout-CQb1lhEv.js → layout-Balq-c2F.js} +1 -1
  114. package/dist/assets/{list-KVxvPXZu.js → list-C4l_W2F_.js} +8 -8
  115. package/dist/assets/{list-BOdwWlS0.js → list-DBhbLnjZ.js} +2 -2
  116. package/dist/assets/localization-crkTHEvo.js +1 -0
  117. package/dist/assets/{log-DOIh9luu.js → log-CcBqhBEJ.js} +1 -1
  118. package/dist/assets/{logger-Dhaq1LDX.js → logger-tBhN561y.js} +1 -1
  119. package/dist/assets/{login-J6Bsrh3B.js → login-BF1AdZ-L.js} +1 -1
  120. package/dist/assets/{login-oauth-callback-BRmEibAb.js → login-oauth-callback-Cv5MlgIc.js} +1 -1
  121. package/dist/assets/{logo-uploader-Dzebv-rF.js → logo-uploader-C1N-bsM2.js} +3 -3
  122. package/dist/assets/lost-passport-C2Km75Ka.js +168 -0
  123. package/dist/assets/{omit-BlzmxIB5.js → omit-Cao4GLS7.js} +1 -1
  124. package/dist/assets/{open-window-Byi7CkW_.js → open-window-uY95lBbB.js} +1 -1
  125. package/dist/assets/{overview-ClOSCvvh.js → overview-BgK_P3ko.js} +1 -1
  126. package/dist/assets/{page-header-C_KAJILy.js → page-header-CiTTXRdM.js} +1 -1
  127. package/dist/assets/{passport-item-Du8-xENr.js → passport-item-fJ88Wv4t.js} +1 -1
  128. package/dist/assets/{permission-ClRym5FB.js → permission-CQWJVo4a.js} +1 -1
  129. package/dist/assets/{preferences-B6Y0XpLo.js → preferences-Uz2t9auQ.js} +1 -1
  130. package/dist/assets/{profile-embed-C_hd_hMh.js → profile-embed-C7ypVv2q.js} +1 -1
  131. package/dist/assets/{pt-CHKumXYv.js → pt-Odg8daEV.js} +1 -1
  132. package/dist/assets/publish-resource-DLqFuWGv.js +1 -0
  133. package/dist/assets/{react-beautiful-dnd.esm-CHsohizU.js → react-beautiful-dnd.esm-DMJVQVbv.js} +1 -1
  134. package/dist/assets/{ru-CvkEKhgU.js → ru-OkiNIvy3.js} +1 -1
  135. package/dist/assets/{runtime-D5P_2uNM.js → runtime-XL6C0WHV.js} +1 -1
  136. package/dist/assets/{sanitize-B18rcrOf.js → sanitize-e0A8A-yt.js} +1 -1
  137. package/dist/assets/sdk-D3QR4FNa.js +1 -0
  138. package/dist/assets/{security-CXewZHyS.js → security-C5-rO801.js} +1 -1
  139. package/dist/assets/{session-Bkvl2PSP.js → session-BDyIB4uh.js} +1 -1
  140. package/dist/assets/setup-Dpq6lpy4.js +30 -0
  141. package/dist/assets/{spaces-C1lh7et6.js → spaces-BR4I2U0t.js} +1 -1
  142. package/dist/assets/{start-BgSlMXsE.js → start-BTmB0MgK.js} +1 -1
  143. package/dist/assets/{starting-progress-BikYigPA.js → starting-progress-BsYL_5xB.js} +1 -1
  144. package/dist/assets/{status-DDvFiBxA.js → status-D8GKQyA3.js} +1 -1
  145. package/dist/assets/{step-actions-_23FIn8v.js → step-actions-njetG0Iy.js} +1 -1
  146. package/dist/assets/{studio-Db5oA_Tx.js → studio-DSEHQtAw.js} +1 -1
  147. package/dist/assets/{switch-control-BYqb8MZf.js → switch-control-BCB3_Ctk.js} +1 -1
  148. package/dist/assets/{table-tips-BW6G2sKO.js → table-tips-Cjv8HIcF.js} +1 -1
  149. package/dist/assets/{th-B2BUfjNJ.js → th-esLoaeiE.js} +1 -1
  150. package/dist/assets/{traffic-CUSLm0PX.js → traffic-DAzuj4ZR.js} +1 -1
  151. package/dist/assets/{transfer-CSsXAviu.js → transfer-NRpeYO3B.js} +1 -1
  152. package/dist/assets/{unsubscribe-BA46-fTa.js → unsubscribe-CBvTeTZf.js} +1 -1
  153. package/dist/assets/{use-blocklet-logo-CTCMbFiC.js → use-blocklet-logo-DwwmdicD.js} +1 -1
  154. package/dist/assets/use-server-logo-UTr-CyJD.js +1 -1
  155. package/dist/assets/{useAsync-DVHp96Uu.js → useAsync-C62uE2pS.js} +1 -1
  156. package/dist/assets/{useLocalStorage-DyVGBDlt.js → useLocalStorage-iQ2AmaOA.js} +1 -1
  157. package/dist/assets/{user-center-Cap4mg5H.js → user-center-CCOO4S3Y.js} +3 -3
  158. package/dist/assets/{util-DlS4tWs9.js → util-BK7oThoq.js} +1 -1
  159. package/dist/assets/{util-M3UFXQFT.js → util-paKPrRHx.js} +1 -1
  160. package/dist/assets/{vendor-arcblock-DiSm3oUX.js → vendor-arcblock-f1tICt1E.js} +59 -59
  161. package/dist/assets/{vendor-hooks-BFlOfe0M.js → vendor-hooks-DqdmWCmo.js} +1 -1
  162. package/dist/assets/{vendor-utils-BotmZdBm.js → vendor-utils-BfZ4tlod.js} +1 -1
  163. package/dist/assets/{vendor-ux-did-connect-DVX9lQ8a.js → vendor-ux-did-connect-BbCim3WZ.js} +89 -90
  164. package/dist/assets/{vi-BykmwIAT.js → vi-BF6u6-98.js} +1 -1
  165. package/dist/assets/wrap-locale-BLcZ6jMd.js +1 -0
  166. package/dist/assets/{zh-CbCaOuAd.js → zh-DJTjvgj8.js} +2 -2
  167. package/dist/assets/{zh-tw-C9JfiCVV.js → zh-tw-B7cFexwg.js} +1 -1
  168. package/dist/index.html +5 -5
  169. package/dist/service-worker.js +1 -1
  170. package/package.json +33 -33
  171. package/api/libs/auth/utils.js +0 -159
  172. package/dist/assets/add-component-core-UeQfX1b1.js +0 -768
  173. package/dist/assets/api-87p2GGd0.js +0 -1
  174. package/dist/assets/connect-Bf8y7fMm.js +0 -5
  175. package/dist/assets/domains-CdwErmIF.js +0 -1
  176. package/dist/assets/index-Bb7iSrGO.js +0 -284
  177. package/dist/assets/localization-OxVxEhoS.js +0 -1
  178. package/dist/assets/lost-passport-p5ZuXjnG.js +0 -168
  179. package/dist/assets/publish-resource-kHaYkbDE.js +0 -1
  180. package/dist/assets/sdk-CbugbTkF.js +0 -1
  181. package/dist/assets/setup-TPtYDnBB.js +0 -30
  182. package/dist/assets/wrap-locale-B8EvOR-l.js +0 -1
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lottie-react.esm-D2t-u0YU.js","assets/vendor-react-DEoibe3W.js"])))=>i.map(i=>d[i]);
2
- import{j as e,aa as n,as as g,T as z,O as U,bu as q,bs as W,bv as H,cG as N,y as O,ah as I,ai as B,ck as J,dy as X,dz as K,I as Y,dA as Q,e as Z,b$ as ee}from"./vendor-mui-core-Bq8gXTan.js";import{r as b}from"./vendor-react-DEoibe3W.js";import{H as te,a as E,f as re,i as ie,d as oe}from"./vendor-hooks-BFlOfe0M.js";import{T as ae,bF as se,_}from"./vendor-ux-did-connect-DVX9lQ8a.js";import{aP as ne}from"./vendor-utils-BotmZdBm.js";import{getAIKitComponent as le}from"./index-Inc_KF9k.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-DiSm3oUX.js";import"./index-BCtTVvHw.js";import"./index-CMYalRl2.js";import"./index-DVQCgvFb.js";const F=b.createContext({}),D=()=>b.useContext(F);function de({children:t,restrictions:c,i18n:s,theme:o}){const[l,f]=te({loading:!1}),x=a=>f(j=>({...j,loading:a})),m=b.useMemo(()=>({...l,onLoading:x,restrictions:c,i18n:s}),[l]);return e.jsx(ae,{theme:o,children:e.jsx(F.Provider,{value:m,children:t})})}const ce=["1024x1024","1024x1792","1792x1024"],xe=["256x256","512x512","1024x1024"],ue=[{label:"DALL·E 3",value:"dall-e-3"},{label:"DALL·E 2",value:"dall-e-2"}];function pe({onSubmit:t}){const{loading:c,i18n:s}=D(),o=E({model:"dall-e-3",prompt:"",size:"1024x1024",number:1}),l=()=>{const a=JSON.parse(JSON.stringify(o));Object.values(o).every(y=>!!y)&&t(a)},{run:f}=re(l,{wait:500}),x={width:"100%",pl:1,pr:1},m=o.model==="dall-e-2"?xe:ce;return e.jsxs(me,{onSubmit:a=>a.preventDefault(),children:[e.jsx(n,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",m:2,mb:0},children:e.jsxs(g,{container:!0,gap:2.5,children:[e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:s("aiImagePrompt")}),e.jsx(U,{sx:{width:1,mt:1},size:"small",type:"text",required:!0,placeholder:s("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:o.prompt??"",onChange:a=>{a.stopPropagation(),o.prompt=a.target.value},inputProps:{maxLength:1e3}})]}),e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageModel")}`}),e.jsx(q,{row:!0,sx:{".MuiFormControlLabel-label":{fontSize:"12px",color:"text.primary"}},value:o.model,onChange:a=>{o.number=1,o.size="1024x1024",o.model=a.target.value},children:ue.map(a=>e.jsx(W,{value:a.value,control:e.jsx(H,{size:"small"}),label:a.label},a.label))})]}),e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageSize")}: ${o.size}`}),e.jsx(g,{container:!0,sx:{gap:2.5,pt:1},children:e.jsx(n,{flex:1,children:e.jsx(n,{...x,children:e.jsx(N,{size:"small",min:0,max:m.length-1,step:1,value:m.findIndex(a=>a==o.size),onChange:(a,j)=>{o.size=m[j]}})})})})]}),o.model==="dall-e-2"&&e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageNumber")}: ${o.number}`}),e.jsx(n,{...x,children:e.jsx(N,{size:"small",defaultValue:1,valueLabelDisplay:"auto",step:1,min:1,max:10,value:o.number,onChange:(a,j)=>{a.stopPropagation(),o.number=Number(j)}})})]})]})}),e.jsx(O,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:f,disabled:c,children:s(c?"aiImageGenerating":"aiImageGenerate")},c?"loading-submit":"submit")]})}const me=I(n)`
2
+ import{j as e,aa as n,as as g,T as z,O as U,bu as q,bs as H,bv as W,cG as N,y as O,ah as I,ai as B,ck as J,dy as X,dz as K,I as Y,dA as Q,e as Z,b$ as ee}from"./vendor-mui-core-Bq8gXTan.js";import{r as b}from"./vendor-react-DEoibe3W.js";import{H as te,a as E,f as re,i as ie,d as oe}from"./vendor-hooks-DqdmWCmo.js";import{T as ae,bH as se,_}from"./vendor-ux-did-connect-BbCim3WZ.js";import{aP as ne}from"./vendor-utils-BfZ4tlod.js";import{getAIKitComponent as le}from"./index-BW2DapLf.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-f1tICt1E.js";import"./index-BxJZWVOT.js";import"./index-BMCGWiyM.js";import"./index-DVQCgvFb.js";const F=b.createContext({}),D=()=>b.useContext(F);function de({children:t,restrictions:c,i18n:s,theme:o}){const[l,f]=te({loading:!1}),x=a=>f(j=>({...j,loading:a})),m=b.useMemo(()=>({...l,onLoading:x,restrictions:c,i18n:s}),[l]);return e.jsx(ae,{theme:o,children:e.jsx(F.Provider,{value:m,children:t})})}const ce=["1024x1024","1024x1792","1792x1024"],xe=["256x256","512x512","1024x1024"],ue=[{label:"DALL·E 3",value:"dall-e-3"},{label:"DALL·E 2",value:"dall-e-2"}];function pe({onSubmit:t}){const{loading:c,i18n:s}=D(),o=E({model:"dall-e-3",prompt:"",size:"1024x1024",number:1}),l=()=>{const a=JSON.parse(JSON.stringify(o));Object.values(o).every(y=>!!y)&&t(a)},{run:f}=re(l,{wait:500}),x={width:"100%",pl:1,pr:1},m=o.model==="dall-e-2"?xe:ce;return e.jsxs(me,{onSubmit:a=>a.preventDefault(),children:[e.jsx(n,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",m:2,mb:0},children:e.jsxs(g,{container:!0,gap:2.5,children:[e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:s("aiImagePrompt")}),e.jsx(U,{sx:{width:1,mt:1},size:"small",type:"text",required:!0,placeholder:s("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:o.prompt??"",onChange:a=>{a.stopPropagation(),o.prompt=a.target.value},inputProps:{maxLength:1e3}})]}),e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageModel")}`}),e.jsx(q,{row:!0,sx:{".MuiFormControlLabel-label":{fontSize:"12px",color:"text.primary"}},value:o.model,onChange:a=>{o.number=1,o.size="1024x1024",o.model=a.target.value},children:ue.map(a=>e.jsx(H,{value:a.value,control:e.jsx(W,{size:"small"}),label:a.label},a.label))})]}),e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageSize")}: ${o.size}`}),e.jsx(g,{container:!0,sx:{gap:2.5,pt:1},children:e.jsx(n,{flex:1,children:e.jsx(n,{...x,children:e.jsx(N,{size:"small",min:0,max:m.length-1,step:1,value:m.findIndex(a=>a==o.size),onChange:(a,j)=>{o.size=m[j]}})})})})]}),o.model==="dall-e-2"&&e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageNumber")}: ${o.number}`}),e.jsx(n,{...x,children:e.jsx(N,{size:"small",defaultValue:1,valueLabelDisplay:"auto",step:1,min:1,max:10,value:o.number,onChange:(a,j)=>{a.stopPropagation(),o.number=Number(j)}})})]})]})}),e.jsx(O,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:f,disabled:c,children:s(c?"aiImageGenerating":"aiImageGenerate")},c?"loading-submit":"submit")]})}const me=I(n)`
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  height: 100%;
@@ -1 +1 @@
1
- import{j as t,ah as r}from"./vendor-mui-core-Bq8gXTan.js";import{r as s}from"./vendor-react-DEoibe3W.js";import{bb as a}from"./vendor-ux-did-connect-DVX9lQ8a.js";import{R as e}from"./vendor-arcblock-DiSm3oUX.js";import"./vendor-utils-BotmZdBm.js";import"./vendor-hooks-BFlOfe0M.js";import"./lottie-web-jYmAQWuC.js";function x(){const{t:o}=s.useContext(a);return t.jsx(n,{style:{paddingTop:"25vh"},children:t.jsx(e,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const n=r.main``;export{x as default};
1
+ import{j as t,ah as r}from"./vendor-mui-core-Bq8gXTan.js";import{r as s}from"./vendor-react-DEoibe3W.js";import{bb as a}from"./vendor-ux-did-connect-BbCim3WZ.js";import{R as e}from"./vendor-arcblock-f1tICt1E.js";import"./vendor-utils-BfZ4tlod.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";function x(){const{t:o}=s.useContext(a);return t.jsx(n,{style:{paddingTop:"25vh"},children:t.jsx(e,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const n=r.main``;export{x as default};
@@ -1,4 +1,4 @@
1
- import{r as k}from"./vendor-react-DEoibe3W.js";import{a as D,$ as R,k as L,B as z,bb as ke,ar as pe,bZ as M,a3 as Ke,aI as ce,br as me,bs as ue,bt as xe,bG as Te,ce as ve,bd as Ae,ac as we,a5 as Se}from"./vendor-ux-did-connect-DVX9lQ8a.js";import{d as De}from"./Edit-rPlryssW.js";import{f as Ie}from"./index-8eXqqyHQ.js";import{r as ye}from"./passport-item-Du8-xENr.js";import{D as _,n as F,aN as Re,G as $e,f as Be}from"./index-CMYalRl2.js";import{u as N}from"./dashboard-B2X6c8E8.js";import{j as e,H as u,bo as V,br as G,bn as X,q as Q,aa as y,al as Z,O,ab as _e,bs as Ne,bR as Ee,ah as E,T as B,ad as le,ak as Pe}from"./vendor-mui-core-Bq8gXTan.js";import{v as Le,K as We}from"./vendor-arcblock-DiSm3oUX.js";import{T as fe}from"./index-Dgsq6V-N.js";import{C as he}from"./confirm-DApmnpvm.js";import{a1 as qe}from"./vendor-utils-BotmZdBm.js";import{C as H}from"./click-to-copy-BMX2P5UB.js";import{D as Ue}from"./delete-confirm-BsEqJQRY.js";import{P as ze}from"./permission-ClRym5FB.js";import{B as Me}from"./bundle-avatar-B5-ypzmO.js";import{W as Fe}from"./did-address-L54dTMrT.js";import{A as Oe}from"./actions-DYQW2ChM.js";import{u as He}from"./use-mobile-DwzRjjku.js";import{T as de}from"./table-tips-BW6G2sKO.js";import{y as Ve}from"./vendor-hooks-BFlOfe0M.js";import"./lottie-web-jYmAQWuC.js";import"./util-M3UFXQFT.js";import"./base32-DEjena1X.js";import"./useLocalStorage-DyVGBDlt.js";import"./PlayArrow-RVSfCmrB.js";import"./get-safe-url-B8xlSMyD.js";import"./session-Bkvl2PSP.js";import"./use-blocklet-logo-CTCMbFiC.js";import"./InfoOutlined-C8ZBPUhD.js";import"./dot-iw3hN9HL.js";import"./useAsync-DVHp96Uu.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";import"./vendor-mui-x-1nqAyytV.js";import"./AdapterDayjs-BzjU9O7t.js";import"./MoreHoriz-Ba9rYlyz.js";function J({value:t}){const{t:s,locale:l}=D(),r=new Date;return new Date(t)<r?e.jsxs("span",{style:{color:"red"},children:[e.jsx(R,{value:t,locale:l}),`${s("setting.accessKey.expired",{time:""})}`]}):e.jsx(R,{value:t,locale:l,type:"all"})}J.propTypes={value:u.string.isRequired};function Y({value:t,onChange:s,...l}){const{t:r}=D(),d=k.useMemo(()=>[{value:"signature",title:r("setting.accessKey.signature"),description:r("setting.accessKey.signatureDesc")},{value:"simple",title:r("setting.accessKey.simple"),description:r("setting.accessKey.simpleDesc")}],[r]);return e.jsxs(V,{style:{width:"100%"},variant:"outlined",...l,children:[e.jsx(G,{children:r("setting.accessKey.authType")}),e.jsx(X,{value:t,onChange:s,fullWidth:!0,label:r("setting.accessKey.authType"),children:d.map(n=>e.jsx(Q,{value:n.value,children:e.jsxs(y,{children:[e.jsx("span",{children:n.title}),e.jsx(y,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:n.description})]})},n.value))})]})}Y.propTypes={value:u.string.isRequired,onChange:u.func.isRequired};const W=()=>{const t=L.RBAC_CONFIG.roles.filter(d=>d.passport),{inService:s}=_(),{roles:l}=N(),r=[...t,...s?l:[]];return qe(r,"name").filter(d=>d.name!==L.ROLES.OWNER)};function ee(t){const{remark:s,onCreate:l}=t,{api:r}=_(),{teamDid:d}=N(),{t:n}=D(),[K,j]=k.useState(!1),[x,C]=k.useState(null),p=W(),f=()=>{j(!1),C(null)},g=async i=>{const{remark:v,passport:h,authType:o}=i;j(!0);const m=await r.createAccessKey({input:{teamDid:d,remark:v.trim(),passport:h,expireAt:i.expireAt?new Date(i.expireAt).getTime():null,authType:o}}),{data:S}=m;l(S),C(null),j(!1)},b={title:`${n("common.create")} ${n("accessKey")}`,description:(i,v,h)=>e.jsxs(Z,{gap:3,children:[e.jsx(O,{label:n("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:i.remark,onChange:o=>{v({...i,remark:o.target.value,__disableConfirm:!i.passport||!o.target.value.trim()}),o.target.value.trim()?h(""):h(n("setting.accessKey.remarkInvalid"))}}),e.jsxs(V,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:n("setting.accessKey.passport")}),e.jsx(X,{"data-cy":"create-access-key-select-passport",value:i.passport,onChange:o=>{const m=o.target.value;h(null),v({...i,passport:m,__disableConfirm:!i.remark||!m})},fullWidth:!0,label:n("setting.accessKey.passport"),disabled:K,children:p.map(o=>e.jsx(Q,{value:o.name,"data-cy":`create-access-key-passport-option-${o.name}`,children:e.jsxs(y,{children:[e.jsx("span",{children:o.title||o.name}),e.jsx(y,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:o.description})]})},o.name))})]}),e.jsx(Y,{value:i.authType,onChange:o=>{v({...i,authType:o.target.value})}}),e.jsx(fe,{placeholder:n("setting.accessKey.expireTime"),value:i.expireAt,onChange:o=>{v({...i,expireAt:o,__disableConfirm:!i.passport||!i.remark||!o})}})]}),confirm:n("common.confirm"),cancel:n("common.cancel"),color:"primary",params:{remark:s,authType:"signature",__disableConfirm:!s.trim()},onConfirm:g,onCancel:f};return e.jsxs(e.Fragment,{children:[e.jsxs(z,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>C(b),className:"rule-action",children:[K?e.jsx(_e,{size:16}):e.jsx(Le,{style:{fontSize:16}}),n("common.create")]}),x&&e.jsx(he,{title:x.title,description:x.description,confirm:x.confirm,color:x.color,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}ee.propTypes={remark:u.string,onCreate:u.func};ee.defaultProps={onCreate:()=>{},remark:""};function te(t){const{onConfirm:s,accessKeyId:l,accessKeySecret:r,hideSecret:d}=t,{t:n}=k.useContext(ke),[K,j]=k.useState(!1),[x,C]=k.useState(()=>d),p=()=>{C(!x)},f=i=>{j(i.target.checked)},g=k.useMemo(()=>{var i,v,h,o;return d?`const Client = require('@abtnode/client');
1
+ import{r as k}from"./vendor-react-DEoibe3W.js";import{a as D,$ as R,k as L,B as z,bb as ke,ar as pe,b$ as M,a3 as Ke,aI as ce,br as me,bs as ue,bt as xe,bI as Te,cg as ve,bd as Ae,ac as we,a5 as Se}from"./vendor-ux-did-connect-BbCim3WZ.js";import{d as De}from"./Edit-D-oqMZ6h.js";import{f as Ie}from"./index-8eXqqyHQ.js";import{r as ye}from"./passport-item-fJ88Wv4t.js";import{D as _,n as F,aN as Re,G as $e,f as Be}from"./index-BMCGWiyM.js";import{u as N}from"./dashboard-CpxtvWAW.js";import{j as e,H as u,bo as V,br as G,bn as X,q as Q,aa as y,al as J,O,ab as _e,bs as Ne,bR as Ee,ah as E,T as B,ad as le,ak as Pe}from"./vendor-mui-core-Bq8gXTan.js";import{v as Le,K as We}from"./vendor-arcblock-f1tICt1E.js";import{T as fe}from"./index-WjR0qttM.js";import{C as he}from"./confirm-Bbp7EOHO.js";import{a1 as qe}from"./vendor-utils-BfZ4tlod.js";import{C as H}from"./click-to-copy-D0HginOX.js";import{D as Ue}from"./delete-confirm-BdthpUzC.js";import{P as ze}from"./permission-CQWJVo4a.js";import{B as Me}from"./bundle-avatar-CH2OoDP-.js";import{W as Fe}from"./did-address-DFiM35OM.js";import{A as Oe}from"./actions-BgkGoToI.js";import{u as He}from"./use-mobile-CtTQsfXN.js";import{T as de}from"./table-tips-Cjv8HIcF.js";import{y as Ve}from"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./util-paKPrRHx.js";import"./base32-Cbt7-U8e.js";import"./useLocalStorage-iQ2AmaOA.js";import"./PlayArrow-DZsdEeq_.js";import"./get-safe-url-CuT70yLx.js";import"./session-BDyIB4uh.js";import"./use-blocklet-logo-DwwmdicD.js";import"./InfoOutlined-B5f3YRb4.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DwzRjjku.js";import"./vendor-mui-x-1nqAyytV.js";import"./AdapterDayjs-T0keO70D.js";import"./MoreHoriz-H_VQNQ9b.js";function Y({value:t}){const{t:s,locale:l}=D(),r=new Date;return new Date(t)<r?e.jsxs("span",{style:{color:"red"},children:[e.jsx(R,{value:t,locale:l}),`${s("setting.accessKey.expired",{time:""})}`]}):e.jsx(R,{value:t,locale:l,type:"all"})}Y.propTypes={value:u.string.isRequired};function Z({value:t,onChange:s,...l}){const{t:r}=D(),d=k.useMemo(()=>[{value:"signature",title:r("setting.accessKey.signature"),description:r("setting.accessKey.signatureDesc")},{value:"simple",title:r("setting.accessKey.simple"),description:r("setting.accessKey.simpleDesc")}],[r]);return e.jsxs(V,{style:{width:"100%"},variant:"outlined",...l,children:[e.jsx(G,{children:r("setting.accessKey.authType")}),e.jsx(X,{value:t,onChange:s,fullWidth:!0,label:r("setting.accessKey.authType"),children:d.map(n=>e.jsx(Q,{value:n.value,children:e.jsxs(y,{children:[e.jsx("span",{children:n.title}),e.jsx(y,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:n.description})]})},n.value))})]})}Z.propTypes={value:u.string.isRequired,onChange:u.func.isRequired};const W=()=>{const t=L.RBAC_CONFIG.roles.filter(d=>d.passport),{inService:s}=_(),{roles:l}=N(),r=[...t,...s?l:[]];return qe(r,"name").filter(d=>d.name!==L.ROLES.OWNER)};function ee(t){const{remark:s,onCreate:l}=t,{api:r}=_(),{teamDid:d}=N(),{t:n}=D(),[K,j]=k.useState(!1),[x,C]=k.useState(null),p=W(),f=()=>{j(!1),C(null)},g=async i=>{const{remark:v,passport:h,authType:o}=i;j(!0);const m=await r.createAccessKey({input:{teamDid:d,remark:v.trim(),passport:h,expireAt:i.expireAt?new Date(i.expireAt).getTime():null,authType:o}}),{data:S}=m;l(S),C(null),j(!1)},b={title:`${n("common.create")} ${n("accessKey")}`,description:(i,v,h)=>e.jsxs(J,{gap:3,children:[e.jsx(O,{label:n("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:i.remark,onChange:o=>{v({...i,remark:o.target.value,__disableConfirm:!i.passport||!o.target.value.trim()}),o.target.value.trim()?h(""):h(n("setting.accessKey.remarkInvalid"))}}),e.jsxs(V,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:n("setting.accessKey.passport")}),e.jsx(X,{"data-cy":"create-access-key-select-passport",value:i.passport,onChange:o=>{const m=o.target.value;h(null),v({...i,passport:m,__disableConfirm:!i.remark||!m})},fullWidth:!0,label:n("setting.accessKey.passport"),disabled:K,children:p.map(o=>e.jsx(Q,{value:o.name,"data-cy":`create-access-key-passport-option-${o.name}`,children:e.jsxs(y,{children:[e.jsx("span",{children:o.title||o.name}),e.jsx(y,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:o.description})]})},o.name))})]}),e.jsx(Z,{value:i.authType,onChange:o=>{v({...i,authType:o.target.value})}}),e.jsx(fe,{placeholder:n("setting.accessKey.expireTime"),value:i.expireAt,onChange:o=>{v({...i,expireAt:o,__disableConfirm:!i.passport||!i.remark||!o})}})]}),confirm:n("common.confirm"),cancel:n("common.cancel"),color:"primary",params:{remark:s,authType:"signature",__disableConfirm:!s.trim()},onConfirm:g,onCancel:f};return e.jsxs(e.Fragment,{children:[e.jsxs(z,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>C(b),className:"rule-action",children:[K?e.jsx(_e,{size:16}):e.jsx(Le,{style:{fontSize:16}}),n("common.create")]}),x&&e.jsx(he,{title:x.title,description:x.description,confirm:x.confirm,color:x.color,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}ee.propTypes={remark:u.string,onCreate:u.func};ee.defaultProps={onCreate:()=>{},remark:""};function te(t){const{onConfirm:s,accessKeyId:l,accessKeySecret:r,hideSecret:d}=t,{t:n}=k.useContext(ke),[K,j]=k.useState(!1),[x,C]=k.useState(()=>d),p=()=>{C(!x)},f=i=>{j(i.target.checked)},g=k.useMemo(()=>{var i,v,h,o;return d?`const Client = require('@abtnode/client');
2
2
  const ensureServerEndpoint = require('@abtnode/util/lib/ensure-server-endpoint');
3
3
  const { joinURL } = require('ufo');
4
4
 
@@ -16,7 +16,7 @@ const result = await client.getBlocklet(
16
16
  { input: { did: rootDid, attachRuntimeInfo: false } },
17
17
  { headers: { 'x-access-blocklet': rootDid } }
18
18
  );
19
- `:`curl -H "Authorization: Bearer ${r}" "${(i=window.blocklet)==null?void 0:i.appUrl}${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/did/session"`},[d,l,r]),b=k.useMemo(()=>{var i;return d?`blocklet deploy --endpoint ${(i=window.blocklet)==null?void 0:i.appUrl} --access-key ${l} --access-secret ${r} {blockletPath}/.blocklet/bundle;`:null},[d,l,r]);return e.jsxs(pe,{title:n("common.createSuccess"),fullWidth:!0,open:!0,disableEscapeKeyDown:!0,onClose:s,showCloseButton:!1,actions:e.jsx("div",{children:e.jsx(z,{disabled:d?!K:!1,onClick:s,color:"primary",autoFocus:!0,variant:"contained","data-cy":"submit-confirm-dialog",children:n("common.confirm")})}),"aria-labelledby":"simple-dialog-title",children:[e.jsx("div",{children:e.jsx(Ge,{children:n(d?"setting.accessKey.saveSecretTip":"setting.accessKey.viewSecret")})}),e.jsx("div",{style:{marginTop:"20px"}}),e.jsxs(U,{children:[e.jsx(q,{children:n("setting.accessKey.accessKeyId")}),e.jsx(H,{children:l})]}),e.jsxs(U,{children:[e.jsx(q,{children:n("setting.accessKey.accessKeySecret")}),x?e.jsx(z,{"data-cy":"show-secret-btn",color:"primary",onClick:p,children:n("setting.accessKey.showSecret")}):e.jsx(H,{children:r})]}),!x&&e.jsxs(U,{children:[e.jsx(q,{children:`Access Key ${n("setting.accessKey.usage")}`}),e.jsx(M,{code:g,language:"javascript"}),b&&e.jsx(M,{code:b,language:"bash"})]}),d&&e.jsx("div",{children:e.jsx(Ne,{value:"end",disabled:x,control:e.jsx(Ee,{checked:K,onChange:f}),label:n("setting.accessKey.iKnow"),labelPlacement:"end"})})]})}te.propTypes={accessKeyId:u.string.isRequired,accessKeySecret:u.string.isRequired,onConfirm:u.func,hideSecret:u.bool};te.defaultProps={onConfirm:()=>{},hideSecret:!0};const q=E.div`
19
+ `:`curl -H "Authorization: Bearer ${r}" "${(i=window.blocklet)==null?void 0:i.appUrl}${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/did/session"`},[d,l,r]),b=k.useMemo(()=>{var i;return d?`blocklet deploy --endpoint ${(i=window.blocklet)==null?void 0:i.appUrl} --access-key ${l} --access-secret ${r} {blockletPath}/.blocklet/bundle;`:null},[d,l,r]);return e.jsxs(pe,{title:n("common.createSuccess"),fullWidth:!0,open:!0,disableEscapeKeyDown:!0,onClose:s,showCloseButton:!1,actions:e.jsx("div",{children:e.jsx(z,{disabled:d?!K:!1,onClick:s,color:"primary",autoFocus:!0,variant:"contained","data-cy":"submit-confirm-dialog",children:n("common.confirm")})}),"aria-labelledby":"simple-dialog-title",children:[e.jsx("div",{children:e.jsx(Ge,{children:n(d?"setting.accessKey.saveSecretTip":"setting.accessKey.viewSecret")})}),e.jsx("div",{style:{marginTop:"20px"}}),e.jsxs(U,{children:[e.jsx(q,{children:n("setting.accessKey.accessKeyId")}),e.jsx(H,{children:l})]}),e.jsxs(U,{children:[e.jsx(q,{children:n("setting.accessKey.accessKeySecret")}),x?e.jsx(z,{"data-cy":"show-secret-btn",color:"primary",onClick:p,children:n("setting.accessKey.showSecret")}):e.jsx(H,{children:r})]}),!x&&e.jsxs(U,{children:[e.jsx(q,{children:`Access Key ${n("setting.accessKey.usage")}`}),e.jsx(M,{code:g,language:"shell"}),b&&e.jsx(M,{code:b,language:"shell"})]}),d&&e.jsx("div",{children:e.jsx(Ne,{value:"end",disabled:x,control:e.jsx(Ee,{checked:K,onChange:f}),label:n("setting.accessKey.iKnow"),labelPlacement:"end"})})]})}te.propTypes={accessKeyId:u.string.isRequired,accessKeySecret:u.string.isRequired,onConfirm:u.func,hideSecret:u.bool};te.defaultProps={onConfirm:()=>{},hideSecret:!0};const q=E.div`
20
20
  display: flex;
21
21
  justify-content: space-between;
22
22
  align-items: center;
@@ -27,14 +27,14 @@ const result = await client.getBlocklet(
27
27
  `,Ge=E.div`
28
28
  font-size: 16px;
29
29
  font-weight: bold;
30
- `;function se(t){const{t:s,locale:l}=D(),{api:r}=_(),{teamDid:d}=N(),{accessKeyId:n,time:K,remark:j,onDelete:x=()=>{},onClose:C=()=>{}}=t,p=()=>{C()},f=async()=>{try{await r.deleteAccessKey({input:{teamDid:d,accessKeyId:n}}),x()}catch(i){Ke.error(i==null?void 0:i.message)}finally{p()}},g=i=>({key:`<b>${n}</b>`,name:`<b>${j}</b>`,time:F(i,l),timeAge:We(new Date(i),Re(l))}),b={keyName:j,title:s("setting.accessKey.title"),description:K?`${s("setting.accessKey.description",g(K))}`:`${s("setting.accessKey.descriptionNoTime",{key:`<b>${n}</b>`,name:`<b>${j}</b>`})}`,confirmPlaceholder:s("setting.accessKey.confirm_desc",{name:j}),confirm:s("common.delConfirm"),cancel:s("common.cancel"),onConfirm:f,onCancel:p};return e.jsx(Ue,{keyName:b.keyName,title:b.title,description:b.description,confirmPlaceholder:b.confirmPlaceholder,confirm:b.confirm,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})}se.propTypes={accessKeyId:u.string.isRequired,time:u.string.isRequired,remark:u.string.isRequired,onDelete:u.func,onClose:u.func};se.defaultProps={onDelete:()=>{},onClose:()=>{}};function ne(t){const{accessKeyId:s,remark:l,onUpdate:r,passport:d,expireAt:n,authType:K,onClose:j}=t,{api:x}=_(),{teamDid:C}=N(),{t:p}=D(),[f,g]=k.useState(!1),b=W(),i=()=>{g(!1),j()},v=async o=>{const{accessKeyId:m,remark:S="",passport:c,expireAt:I,authType:P}=o;g(!0),await x.updateAccessKey({input:{teamDid:C,accessKeyId:m,remark:S.trim(),passport:c,expireAt:I?new Date(I).getTime():null,authType:P}}),r(),i()},h={title:`${p("common.update")} ${p("accessKey")}`,description:(o,m,S)=>e.jsxs(Z,{gap:3,children:[e.jsx(O,{label:p("setting.accessKey.accessKeyId"),autoComplete:"off",variant:"outlined",name:"accessKeyId",fullWidth:!0,autoFocus:!0,margin:"dense",value:o.accessKeyId,disabled:!0}),e.jsx(O,{label:p("common.remark"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,value:o.remark,onChange:c=>{m({...o,remark:c.target.value,__disableConfirm:!c.target.value.trim()}),c.target.value.trim()?S(""):S(p("setting.accessKey.remarkInvalid"))}}),e.jsxs(V,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:p("setting.accessKey.passport")}),e.jsx(X,{"data-cy":"update-access-key-select-passport",value:o.passport,onChange:c=>{const I=c.target.value;S(null),m({...o,passport:I,__disableConfirm:!o.remark||!I})},fullWidth:!0,label:p("setting.accessKey.passport"),disabled:f,children:b.map(c=>e.jsx(Q,{value:c.name,"data-cy":`update-access-key-passport-option-${c.name}`,children:e.jsxs(y,{children:[e.jsx("span",{children:c.title||c.name}),e.jsx(y,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:c.description})]})},c.name))})]}),e.jsx(Y,{disabled:!0,value:o.authType,onChange:c=>{m({...o,authType:c.target.value})}}),e.jsx(fe,{placeholder:p("setting.accessKey.expireTime"),value:o.expireAt,onChange:c=>{m({...o,expireAt:c,__disableConfirm:!o.passport||!o.remark||!c})}})]}),confirm:p("common.confirm"),cancel:p("common.cancel"),color:"primary",params:{accessKeyId:s,remark:l,passport:d,expireAt:n,authType:K},onConfirm:v,onCancel:i};return e.jsx(he,{title:h.title,description:h.description,confirm:h.confirm,color:h.color,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})}ne.propTypes={accessKeyId:u.string.isRequired,remark:u.string,passport:u.string,expireAt:u.string,authType:u.string,onUpdate:u.func,onClose:u.func};ne.defaultProps={onUpdate:()=>{},remark:"",passport:"",expireAt:"",authType:"signature",onClose:()=>{}};function oe({accessKey:t,onCancel:s}){const{t:l}=D();return e.jsx(pe,{title:l("accessKey"),onClose:s,open:!0,PaperProps:{style:{maxWidth:800}},fullWidth:!0,children:e.jsx(Xe,{children:e.jsx(ge,{accessKey:t})})})}oe.propTypes={accessKey:u.object.isRequired,onCancel:u.func.isRequired};oe.defaultProps={};const Xe=E(y)`
30
+ `;function se(t){const{t:s,locale:l}=D(),{api:r}=_(),{teamDid:d}=N(),{accessKeyId:n,time:K,remark:j,onDelete:x=()=>{},onClose:C=()=>{}}=t,p=()=>{C()},f=async()=>{try{await r.deleteAccessKey({input:{teamDid:d,accessKeyId:n}}),x()}catch(i){Ke.error(i==null?void 0:i.message)}finally{p()}},g=i=>({key:`<b>${n}</b>`,name:`<b>${j}</b>`,time:F(i,l),timeAge:We(new Date(i),Re(l))}),b={keyName:j,title:s("setting.accessKey.title"),description:K?`${s("setting.accessKey.description",g(K))}`:`${s("setting.accessKey.descriptionNoTime",{key:`<b>${n}</b>`,name:`<b>${j}</b>`})}`,confirmPlaceholder:s("setting.accessKey.confirm_desc",{name:j}),confirm:s("common.delConfirm"),cancel:s("common.cancel"),onConfirm:f,onCancel:p};return e.jsx(Ue,{keyName:b.keyName,title:b.title,description:b.description,confirmPlaceholder:b.confirmPlaceholder,confirm:b.confirm,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})}se.propTypes={accessKeyId:u.string.isRequired,time:u.string.isRequired,remark:u.string.isRequired,onDelete:u.func,onClose:u.func};se.defaultProps={onDelete:()=>{},onClose:()=>{}};function ne(t){const{accessKeyId:s,remark:l,onUpdate:r,passport:d,expireAt:n,authType:K,onClose:j}=t,{api:x}=_(),{teamDid:C}=N(),{t:p}=D(),[f,g]=k.useState(!1),b=W(),i=()=>{g(!1),j()},v=async o=>{const{accessKeyId:m,remark:S="",passport:c,expireAt:I,authType:P}=o;g(!0),await x.updateAccessKey({input:{teamDid:C,accessKeyId:m,remark:S.trim(),passport:c,expireAt:I?new Date(I).getTime():null,authType:P}}),r(),i()},h={title:`${p("common.update")} ${p("accessKey")}`,description:(o,m,S)=>e.jsxs(J,{gap:3,children:[e.jsx(O,{label:p("setting.accessKey.accessKeyId"),autoComplete:"off",variant:"outlined",name:"accessKeyId",fullWidth:!0,autoFocus:!0,margin:"dense",value:o.accessKeyId,disabled:!0}),e.jsx(O,{label:p("common.remark"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,value:o.remark,onChange:c=>{m({...o,remark:c.target.value,__disableConfirm:!c.target.value.trim()}),c.target.value.trim()?S(""):S(p("setting.accessKey.remarkInvalid"))}}),e.jsxs(V,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:p("setting.accessKey.passport")}),e.jsx(X,{"data-cy":"update-access-key-select-passport",value:o.passport,onChange:c=>{const I=c.target.value;S(null),m({...o,passport:I,__disableConfirm:!o.remark||!I})},fullWidth:!0,label:p("setting.accessKey.passport"),disabled:f,children:b.map(c=>e.jsx(Q,{value:c.name,"data-cy":`update-access-key-passport-option-${c.name}`,children:e.jsxs(y,{children:[e.jsx("span",{children:c.title||c.name}),e.jsx(y,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:c.description})]})},c.name))})]}),e.jsx(Z,{disabled:!0,value:o.authType,onChange:c=>{m({...o,authType:c.target.value})}}),e.jsx(fe,{placeholder:p("setting.accessKey.expireTime"),value:o.expireAt,onChange:c=>{m({...o,expireAt:c,__disableConfirm:!o.passport||!o.remark||!c})}})]}),confirm:p("common.confirm"),cancel:p("common.cancel"),color:"primary",params:{accessKeyId:s,remark:l,passport:d,expireAt:n,authType:K},onConfirm:v,onCancel:i};return e.jsx(he,{title:h.title,description:h.description,confirm:h.confirm,color:h.color,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})}ne.propTypes={accessKeyId:u.string.isRequired,remark:u.string,passport:u.string,expireAt:u.string,authType:u.string,onUpdate:u.func,onClose:u.func};ne.defaultProps={onUpdate:()=>{},remark:"",passport:"",expireAt:"",authType:"signature",onClose:()=>{}};function oe({accessKey:t,onCancel:s}){const{t:l}=D();return e.jsx(pe,{title:l("accessKey"),onClose:s,open:!0,PaperProps:{style:{maxWidth:800}},fullWidth:!0,children:e.jsx(Xe,{children:e.jsx(ge,{accessKey:t})})})}oe.propTypes={accessKey:u.object.isRequired,onCancel:u.func.isRequired};oe.defaultProps={};const Xe=E(y)`
31
31
  margin-top: -16px;
32
32
 
33
33
  .tabs {
34
34
  margin-left: 0;
35
35
  margin-right: 0;
36
36
  }
37
- `;function ge({accessKey:t}){var C,p;const{t:s,locale:l}=D(),{blocklet:r}=$e(),d=W(),n=((r==null?void 0:r.children)||[]).find(f=>{var g;return((g=f==null?void 0:f.meta)==null?void 0:g.did)===t.componentDid}),K=d.find(f=>f.name===t.passport),j=K?K.title:t.passport,x=[{title:s("common.baseInfo"),items:[{label:s("setting.accessKey.accessKeyId"),content:e.jsx(Fe,{did:t.accessKeyId,showQrcode:!0})},...t.authType==="simple"?[{label:s("setting.accessKey.accessKeySecret"),content:e.jsx(H,{children:`blocklet-${ce.toBase58(t.accessKeyPublic)}`})}]:[],{label:s("common.role"),content:e.jsx(y,{children:ye(j,t.passport)})},{label:s("common.createdVia"),content:t.createdVia},{label:s("common.createdBy"),content:t.createdBy?e.jsx(me,{showDid:!0,did:t.createdBy,cardType:ue.Detailed,infoType:xe.Minimal,sx:{border:0,padding:0}}):"-"}]},{title:s("common.timeInfo"),items:[{label:s("common.createdAt"),content:t.createdAt?e.jsx(R,{value:t.createdAt,type:"all",locale:l}):"-"},{label:s("common.lastUsedAt"),content:t.lastUsedAt?e.jsx(R,{value:t.lastUsedAt,type:"all",locale:l}):"-"},{label:s("common.expiredAt"),content:t.expireAt?e.jsx(J,{value:t.expireAt}):s("common.neverExpired")}]},{title:s("common.otherInfo"),items:[{label:s("setting.accessKey.authType"),content:t.authType},{label:s("common.remark"),content:t.remark},...t.authType!=="signature"?[{label:s("setting.accessKey.resourceType"),content:t.resourceType||"-"},{label:s("setting.accessKey.resourceId"),content:t.resourceId||"-"}]:[],...n?[{label:s("setting.accessKey.component"),content:e.jsxs(y,{width:{xs:250,sm:400},display:"flex",alignItems:"center",children:[e.jsx(Me,{blocklet:n,ancestors:[r]}),e.jsx(y,{ml:"16px",sx:{minWidth:0},children:e.jsxs(y,{className:"component-header",children:[e.jsx(y,{className:"component-name",children:Be.getDisplayName(n,!0)}),e.jsx(y,{className:"component-version",children:(C=n==null?void 0:n.meta)==null?void 0:C.version})]})})]},n)}]:[],t.authType!=="signature"?{label:s("setting.accessKey.usage"),content:e.jsx(M,{code:`curl -H "Authorization: Bearer blocklet-${ce.toBase58(t.accessKeyPublic)}" "${(p=window.blocklet)==null?void 0:p.appUrl}${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/did/session"`,language:"javascript"})}:null].filter(Boolean)}];return e.jsx(Qe,{gap:3,children:e.jsx(y,{className:"info-area",children:x.map(f=>e.jsxs(y,{mb:3,children:[e.jsx(B,{variant:"h6",sx:{mb:1.5},children:f.title}),e.jsx(y,{className:"info-grid",children:f.items.map(g=>e.jsxs(y,{className:"info-item",children:[e.jsx(y,{className:"info-label",children:e.jsx(B,{variant:"subtitle2",color:"textSecondary",children:g.label})}),e.jsx(y,{sx:{flex:1,minWidth:0},children:g.content})]},g.label))})]},f.title))})})}ge.propTypes={accessKey:u.object.isRequired};const Qe=E(Z)`
37
+ `;function ge({accessKey:t}){var C,p;const{t:s,locale:l}=D(),{blocklet:r}=$e(),d=W(),n=((r==null?void 0:r.children)||[]).find(f=>{var g;return((g=f==null?void 0:f.meta)==null?void 0:g.did)===t.componentDid}),K=d.find(f=>f.name===t.passport),j=K?K.title:t.passport,x=[{title:s("common.baseInfo"),items:[{label:s("setting.accessKey.accessKeyId"),content:e.jsx(Fe,{did:t.accessKeyId,showQrcode:!0})},...t.authType==="simple"?[{label:s("setting.accessKey.accessKeySecret"),content:e.jsx(H,{children:`blocklet-${ce.toBase58(t.accessKeyPublic)}`})}]:[],{label:s("common.role"),content:e.jsx(y,{children:ye(j,t.passport)})},{label:s("common.createdVia"),content:t.createdVia},{label:s("common.createdBy"),content:t.createdBy?e.jsx(me,{showDid:!0,did:t.createdBy,cardType:ue.Detailed,infoType:xe.Minimal,sx:{border:0,padding:0}}):"-"}]},{title:s("common.timeInfo"),items:[{label:s("common.createdAt"),content:t.createdAt?e.jsx(R,{value:t.createdAt,type:"all",locale:l}):"-"},{label:s("common.lastUsedAt"),content:t.lastUsedAt?e.jsx(R,{value:t.lastUsedAt,type:"all",locale:l}):"-"},{label:s("common.expiredAt"),content:t.expireAt?e.jsx(Y,{value:t.expireAt}):s("common.neverExpired")}]},{title:s("common.otherInfo"),items:[{label:s("setting.accessKey.authType"),content:t.authType},{label:s("common.remark"),content:t.remark},...t.authType!=="signature"?[{label:s("setting.accessKey.resourceType"),content:t.resourceType||"-"},{label:s("setting.accessKey.resourceId"),content:t.resourceId||"-"}]:[],...n?[{label:s("setting.accessKey.component"),content:e.jsxs(y,{width:{xs:250,sm:400},display:"flex",alignItems:"center",children:[e.jsx(Me,{blocklet:n,ancestors:[r]}),e.jsx(y,{ml:"16px",sx:{minWidth:0},children:e.jsxs(y,{className:"component-header",children:[e.jsx(y,{className:"component-name",children:Be.getDisplayName(n,!0)}),e.jsx(y,{className:"component-version",children:(C=n==null?void 0:n.meta)==null?void 0:C.version})]})})]},n)}]:[],t.authType!=="signature"?{label:s("setting.accessKey.usage"),content:e.jsx(M,{code:`curl -H "Authorization: Bearer blocklet-${ce.toBase58(t.accessKeyPublic)}" "${(p=window.blocklet)==null?void 0:p.appUrl}${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/did/session"`,language:"shell"})}:null].filter(Boolean)}];return e.jsx(Qe,{gap:3,children:e.jsx(y,{className:"info-area",children:x.map(f=>e.jsxs(y,{mb:3,children:[e.jsx(B,{variant:"h6",sx:{mb:1.5},children:f.title}),e.jsx(y,{className:"info-grid",children:f.items.map(g=>e.jsxs(y,{className:"info-item",children:[e.jsx(y,{className:"info-label",children:e.jsx(B,{variant:"subtitle2",color:"textSecondary",children:g.label})}),e.jsx(y,{sx:{flex:1,minWidth:0},children:g.content})]},g.label))})]},f.title))})})}ge.propTypes={accessKey:u.object.isRequired};const Qe=E(J)`
38
38
  .info-card {
39
39
  margin-bottom: 24px;
40
40
  overflow: hidden;
@@ -107,4 +107,4 @@ const result = await client.getBlocklet(
107
107
  margin: 0;
108
108
  }
109
109
  }
110
- `;function _t(){var ie,re;const{t,locale:s}=D(),{api:l,inService:r}=_(),{teamDid:d}=N(),[n,K]=k.useState({}),[j,x]=k.useState(null),[C,p]=k.useState(null),[f,g]=k.useState(null),b=He(),i=W(),v=k.useRef(null),h=`access-keys-${d}`,o=Te(h),[m,S]=k.useState({searchText:o.searchText||"",pageSize:o.rowsPerPage||10,page:1}),c=Ve(async()=>await l.getAccessKeys({input:{teamDid:d,paging:{page:m.page,pageSize:m.pageSize}}}),[m.page,m.pageSize]),{loading:I,error:P}=c,$=k.useMemo(()=>{var a;return((a=c.value)==null?void 0:a.list)||[]},[(ie=c.value)==null?void 0:ie.list]),be=k.useMemo(()=>[{label:t("common.name"),name:"remark",options:{customBodyRender:(a,{rowIndex:A})=>{const w=$[A];return e.jsx(y,{display:"flex",alignItems:"center",gap:2,children:e.jsx(B,{children:w.remark||"N/A"})})}}},{label:"Access Key ID",name:"accessKeyId",options:{customBodyRender:a=>e.jsx(ve,{showDidLogo:!1,children:a})}},{label:t("common.role"),name:"passport",options:{customBodyRender:a=>{const A=i.find(T=>T.name===a),w=A?A.title:a;return e.jsx(y,{children:ye(w,a)})}}},{label:t("common.createdVia"),name:"createdVia",options:{customBodyRender:a=>e.jsx(B,{children:a})}},{label:t("setting.accessKey.authType"),name:"authType",options:{customBodyRender:a=>e.jsx(B,{children:t(`setting.accessKey.${a}`)})}},{label:t("common.createdAt"),name:"createdAt",options:{customBodyRender:a=>e.jsx(le,{title:F(a,s),children:a?e.jsx(R,{value:a,locale:s}):"-"})}},{label:t("common.lastUsedAt"),name:"lastUsedAt",options:{customBodyRender:a=>e.jsx(le,{title:F(a,s),children:a?e.jsx(R,{value:a,locale:s}):"-"})}},{label:t("common.expiredAt"),name:"expireAt",options:{customBodyRender:a=>a?e.jsx(J,{value:a}):t("common.neverExpired")}},{label:t("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:a=>a?e.jsx(me,{showDid:!0,did:a,cardType:ue.Detailed,infoType:xe.Minimal,sx:{border:0,padding:0}}):"-"}},{label:t("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(a,{rowIndex:A})=>{const w=$[A];return e.jsx(Oe,{"data-cy":"access-key-actions",actions:[{icon:e.jsx(De,{}),text:t("common.edit"),onClick:T=>{T.stopPropagation(),g(w)}},{icon:e.jsx(Ae,{}),text:t("common.delete"),onClick:T=>{T.stopPropagation(),p(w)}}]})}}}],[$,s,t,i,p,g]),je=({page:a,rowsPerPage:A,searchText:w})=>{m.pageSize!==A?S(T=>({...T,searchText:"",pageSize:A,page:1})):m.page!==a+1?S(T=>({...T,searchText:"",page:a+1})):m.searchText!==w&&S(T=>({...T,searchText:w,page:1}))},ae=m.searchText?$.filter(a=>a.accessKeyId.toLowerCase().includes(m.searchText.toLowerCase())||(a.remark||"").toLowerCase().includes(m.searchText.toLowerCase())):$;return P?e.jsx(Pe,{severity:"error",children:Ie(P)}):e.jsxs(y,{ref:v,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[b?e.jsx(de,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}):null,e.jsx(we,{durable:h,durableKeys:["page","rowsPerPage"],data:ae,columns:be,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:m.page-1,rowsPerPage:m.pageSize,count:((re=c.value)==null?void 0:re.count)||0,searchDebounceTime:600,onRowClick(a,{dataIndex:A},w){var T;if((T=v.current)!=null&&T.contains(w.target)){const Ce=ae[A];x(Ce)}}},loading:I,onChange:je,title:b?null:e.jsx(de,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}),customButtons:[e.jsx(ze,{permission:r?"":"mutate_accessKey",children:e.jsx(ee,{onCreate:a=>{const{accessKeyId:A,accessKeySecret:w,authType:T}=a;K({show:!0,accessKeyId:A,accessKeySecret:w,authType:T})}})})],emptyNode:e.jsx(Se,{children:t("oauth.client.empty")})}),n.show&&e.jsx(te,{hideSecret:n.authType==="signature",onConfirm:()=>{c.retry(),K({show:!1})},...n}),j&&e.jsx(oe,{onCancel:()=>x(null),accessKey:j}),C&&e.jsx(se,{accessKeyId:C.accessKeyId,time:C.lastUsedAt,remark:C.remark||"N/A",onDelete:c.retry,onClose:()=>p(null)}),f&&e.jsx(ne,{...f,onUpdate:c.retry,onClose:()=>g(null)})]})}export{_t as default};
110
+ `;function _t(){var ie,re;const{t,locale:s}=D(),{api:l,inService:r}=_(),{teamDid:d}=N(),[n,K]=k.useState({}),[j,x]=k.useState(null),[C,p]=k.useState(null),[f,g]=k.useState(null),b=He(),i=W(),v=k.useRef(null),h=`access-keys-${d}`,o=Te(h),[m,S]=k.useState({searchText:o.searchText||"",pageSize:o.rowsPerPage||10,page:1}),c=Ve(async()=>await l.getAccessKeys({input:{teamDid:d,paging:{page:m.page,pageSize:m.pageSize}}}),[m.page,m.pageSize]),{loading:I,error:P}=c,$=k.useMemo(()=>{var a;return((a=c.value)==null?void 0:a.list)||[]},[(ie=c.value)==null?void 0:ie.list]),be=k.useMemo(()=>[{label:t("common.name"),name:"remark",options:{customBodyRender:(a,{rowIndex:A})=>{const w=$[A];return e.jsx(y,{display:"flex",alignItems:"center",gap:2,children:e.jsx(B,{children:w.remark||"N/A"})})}}},{label:"Access Key ID",name:"accessKeyId",options:{customBodyRender:a=>e.jsx(ve,{showDidLogo:!1,children:a})}},{label:t("common.role"),name:"passport",options:{customBodyRender:a=>{const A=i.find(T=>T.name===a),w=A?A.title:a;return e.jsx(y,{children:ye(w,a)})}}},{label:t("common.createdVia"),name:"createdVia",options:{customBodyRender:a=>e.jsx(B,{children:a})}},{label:t("setting.accessKey.authType"),name:"authType",options:{customBodyRender:a=>e.jsx(B,{children:t(`setting.accessKey.${a}`)})}},{label:t("common.createdAt"),name:"createdAt",options:{customBodyRender:a=>e.jsx(le,{title:F(a,s),children:a?e.jsx(R,{value:a,locale:s}):"-"})}},{label:t("common.lastUsedAt"),name:"lastUsedAt",options:{customBodyRender:a=>e.jsx(le,{title:F(a,s),children:a?e.jsx(R,{value:a,locale:s}):"-"})}},{label:t("common.expiredAt"),name:"expireAt",options:{customBodyRender:a=>a?e.jsx(Y,{value:a}):t("common.neverExpired")}},{label:t("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:a=>a?e.jsx(me,{showDid:!0,did:a,cardType:ue.Detailed,infoType:xe.Minimal,sx:{border:0,padding:0}}):"-"}},{label:t("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(a,{rowIndex:A})=>{const w=$[A];return e.jsx(Oe,{"data-cy":"access-key-actions",actions:[{icon:e.jsx(De,{}),text:t("common.edit"),onClick:T=>{T.stopPropagation(),g(w)}},{icon:e.jsx(Ae,{}),text:t("common.delete"),onClick:T=>{T.stopPropagation(),p(w)}}]})}}}],[$,s,t,i,p,g]),je=({page:a,rowsPerPage:A,searchText:w})=>{m.pageSize!==A?S(T=>({...T,searchText:"",pageSize:A,page:1})):m.page!==a+1?S(T=>({...T,searchText:"",page:a+1})):m.searchText!==w&&S(T=>({...T,searchText:w,page:1}))},ae=m.searchText?$.filter(a=>a.accessKeyId.toLowerCase().includes(m.searchText.toLowerCase())||(a.remark||"").toLowerCase().includes(m.searchText.toLowerCase())):$;return P?e.jsx(Pe,{severity:"error",children:Ie(P)}):e.jsxs(y,{ref:v,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[b?e.jsx(de,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}):null,e.jsx(we,{durable:h,durableKeys:["page","rowsPerPage"],data:ae,columns:be,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:m.page-1,rowsPerPage:m.pageSize,count:((re=c.value)==null?void 0:re.count)||0,searchDebounceTime:600,onRowClick(a,{dataIndex:A},w){var T;if((T=v.current)!=null&&T.contains(w.target)){const Ce=ae[A];x(Ce)}}},loading:I,onChange:je,title:b?null:e.jsx(de,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}),customButtons:[e.jsx(ze,{permission:r?"":"mutate_accessKey",children:e.jsx(ee,{onCreate:a=>{const{accessKeyId:A,accessKeySecret:w,authType:T}=a;K({show:!0,accessKeyId:A,accessKeySecret:w,authType:T})}})})],emptyNode:e.jsx(Se,{children:t("oauth.client.empty")})}),n.show&&e.jsx(te,{hideSecret:n.authType==="signature",onConfirm:()=>{c.retry(),K({show:!1})},...n}),j&&e.jsx(oe,{onCancel:()=>x(null),accessKey:j}),C&&e.jsx(se,{accessKeyId:C.accessKeyId,time:C.lastUsedAt,remark:C.remark||"N/A",onDelete:c.retry,onClose:()=>p(null)}),f&&e.jsx(ne,{...f,onUpdate:c.retry,onClose:()=>g(null)})]})}export{_t as default};
@@ -1,4 +1,4 @@
1
- import{j as r,T as i}from"./vendor-mui-core-Bq8gXTan.js";import{a0 as p,an as x}from"./vendor-utils-BotmZdBm.js";import{s as c}from"./vendor-ux-did-connect-DVX9lQ8a.js";function h({name:t,nameFormatter:a=o=>typeof o=="string"?o.split(" ").map(f=>p(x(f))).join(" "):o,layout:n="horizontal",children:e,valueComponent:l="div",nameWidth:s=90,...m}){return r.jsxs(u,{layout:n,width:s,...m,children:[r.jsx(i,{color:"textSecondary",className:"info-row__name",children:a(t)}),e&&r.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:e})]})}const u=c("div")`
1
+ import{j as r,T as i}from"./vendor-mui-core-Bq8gXTan.js";import{a0 as p,an as x}from"./vendor-utils-BfZ4tlod.js";import{s as c}from"./vendor-ux-did-connect-BbCim3WZ.js";function h({name:t,nameFormatter:a=o=>typeof o=="string"?o.split(" ").map(f=>p(x(f))).join(" "):o,layout:n="horizontal",children:e,valueComponent:l="div",nameWidth:s=90,...m}){return r.jsxs(u,{layout:n,width:s,...m,children:[r.jsx(i,{color:"textSecondary",className:"info-row__name",children:a(t)}),e&&r.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:e})]})}const u=c("div")`
2
2
  display: flex;
3
3
  flex-direction: ${t=>t.layout==="vertical"?"column":"row"};
4
4
  justify-content: flex-start;
@@ -1,4 +1,4 @@
1
- import{v as de,B as Br}from"./vendor-utils-BotmZdBm.js";import{bK as De,bL as Dr,bM as Mr,bN as Pr,bO as Cr,bP as Lr,bQ as Vr,bR as Rr,bS as Fr,bT as ar,bU as $r,bV as Gr,bW as zr,bX as Yr,aR as Hr,bJ as Zr,aI as Wr}from"./vendor-ux-did-connect-DVX9lQ8a.js";var ze={exports:{}},Ye={},fr;function Ir(){if(fr)return Ye;fr=1;function r(p){"@babel/helpers - typeof";return r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},r(p)}function e(p,l,m){return Object.defineProperty(p,"prototype",{writable:!1}),p}function t(p,l){if(!(p instanceof l))throw new TypeError("Cannot call a class as a function")}function n(p,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function");p.prototype=Object.create(l&&l.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),Object.defineProperty(p,"prototype",{writable:!1}),l&&f(p,l)}function f(p,l){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(j,L){return j.__proto__=L,j},f(p,l)}function s(p){var l=q();return function(){var j=S(p),L;if(l){var P=S(this).constructor;L=Reflect.construct(j,arguments,P)}else L=j.apply(this,arguments);return d(this,L)}}function d(p,l){if(l&&(r(l)==="object"||typeof l=="function"))return l;if(l!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return x(p)}function x(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function q(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function S(p){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(m){return m.__proto__||Object.getPrototypeOf(m)},S(p)}var K={},C,T;function N(p,l,m){m||(m=Error);function j(P,te,$){return typeof l=="string"?l:l(P,te,$)}var L=function(P){n($,P);var te=s($);function $(ce,ue,k){var ne;return t(this,$),ne=te.call(this,j(ce,ue,k)),ne.code=p,ne}return e($)}(m);K[p]=L}function B(p,l){if(Array.isArray(p)){var m=p.length;return p=p.map(function(j){return String(j)}),m>2?"one of ".concat(l," ").concat(p.slice(0,m-1).join(", "),", or ")+p[m-1]:m===2?"one of ".concat(l," ").concat(p[0]," or ").concat(p[1]):"of ".concat(l," ").concat(p[0])}else return"of ".concat(l," ").concat(String(p))}function X(p,l,m){return p.substr(0,l.length)===l}function Y(p,l,m){return(m===void 0||m>p.length)&&(m=p.length),p.substring(m-l.length,m)===l}function D(p,l,m){return typeof m!="number"&&(m=0),m+l.length>p.length?!1:p.indexOf(l,m)!==-1}return N("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),N("ERR_INVALID_ARG_TYPE",function(p,l,m){C===void 0&&(C=ir()),C(typeof p=="string","'name' must be a string");var j;typeof l=="string"&&X(l,"not ")?(j="must not be",l=l.replace(/^not /,"")):j="must be";var L;if(Y(p," argument"))L="The ".concat(p," ").concat(j," ").concat(B(l,"type"));else{var P=D(p,".")?"property":"argument";L='The "'.concat(p,'" ').concat(P," ").concat(j," ").concat(B(l,"type"))}return L+=". Received type ".concat(r(m)),L},TypeError),N("ERR_INVALID_ARG_VALUE",function(p,l){var m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";T===void 0&&(T=De);var j=T.inspect(l);return j.length>128&&(j="".concat(j.slice(0,128),"...")),"The argument '".concat(p,"' ").concat(m,". Received ").concat(j)},TypeError),N("ERR_INVALID_RETURN_VALUE",function(p,l,m){var j;return m&&m.constructor&&m.constructor.name?j="instance of ".concat(m.constructor.name):j="type ".concat(r(m)),"Expected ".concat(p,' to be returned from the "').concat(l,'"')+" function but got ".concat(j,".")},TypeError),N("ERR_MISSING_ARGS",function(){for(var p=arguments.length,l=new Array(p),m=0;m<p;m++)l[m]=arguments[m];C===void 0&&(C=ir()),C(l.length>0,"At least one arg needs to be specified");var j="The ",L=l.length;switch(l=l.map(function(P){return'"'.concat(P,'"')}),L){case 1:j+="".concat(l[0]," argument");break;case 2:j+="".concat(l[0]," and ").concat(l[1]," arguments");break;default:j+=l.slice(0,L-1).join(", "),j+=", and ".concat(l[L-1]," arguments");break}return"".concat(j," must be specified")},TypeError),Ye.codes=K,Ye}var He,sr;function kr(){if(sr)return He;sr=1;function r(h,y){var A=Object.keys(h);if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(h);y&&(w=w.filter(function(_){return Object.getOwnPropertyDescriptor(h,_).enumerable})),A.push.apply(A,w)}return A}function e(h){for(var y=1;y<arguments.length;y++){var A=arguments[y]!=null?arguments[y]:{};y%2?r(Object(A),!0).forEach(function(w){t(h,w,A[w])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(A)):r(Object(A)).forEach(function(w){Object.defineProperty(h,w,Object.getOwnPropertyDescriptor(A,w))})}return h}function t(h,y,A){return y=d(y),y in h?Object.defineProperty(h,y,{value:A,enumerable:!0,configurable:!0,writable:!0}):h[y]=A,h}function n(h,y){if(!(h instanceof y))throw new TypeError("Cannot call a class as a function")}function f(h,y){for(var A=0;A<y.length;A++){var w=y[A];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(h,d(w.key),w)}}function s(h,y,A){return y&&f(h.prototype,y),Object.defineProperty(h,"prototype",{writable:!1}),h}function d(h){var y=x(h,"string");return p(y)==="symbol"?y:String(y)}function x(h,y){if(p(h)!=="object"||h===null)return h;var A=h[Symbol.toPrimitive];if(A!==void 0){var w=A.call(h,y||"default");if(p(w)!=="object")return w;throw new TypeError("@@toPrimitive must return a primitive value.")}return(y==="string"?String:Number)(h)}function q(h,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function");h.prototype=Object.create(y&&y.prototype,{constructor:{value:h,writable:!0,configurable:!0}}),Object.defineProperty(h,"prototype",{writable:!1}),y&&Y(h,y)}function S(h){var y=B();return function(){var w=D(h),_;if(y){var c=D(this).constructor;_=Reflect.construct(w,arguments,c)}else _=w.apply(this,arguments);return K(this,_)}}function K(h,y){if(y&&(p(y)==="object"||typeof y=="function"))return y;if(y!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return C(h)}function C(h){if(h===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h}function T(h){var y=typeof Map=="function"?new Map:void 0;return T=function(w){if(w===null||!X(w))return w;if(typeof w!="function")throw new TypeError("Super expression must either be null or a function");if(typeof y<"u"){if(y.has(w))return y.get(w);y.set(w,_)}function _(){return N(w,arguments,D(this).constructor)}return _.prototype=Object.create(w.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),Y(_,w)},T(h)}function N(h,y,A){return B()?N=Reflect.construct.bind():N=function(_,c,o){var u=[null];u.push.apply(u,c);var v=Function.bind.apply(_,u),b=new v;return o&&Y(b,o.prototype),b},N.apply(null,arguments)}function B(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function X(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function Y(h,y){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(w,_){return w.__proto__=_,w},Y(h,y)}function D(h){return D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},D(h)}function p(h){"@babel/helpers - typeof";return p=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(y){return typeof y}:function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},p(h)}var l=De,m=l.inspect,j=Ir(),L=j.codes.ERR_INVALID_ARG_TYPE;function P(h,y,A){return(A===void 0||A>h.length)&&(A=h.length),h.substring(A-y.length,A)===y}function te(h,y){if(y=Math.floor(y),h.length==0||y==0)return"";var A=h.length*y;for(y=Math.floor(Math.log(y)/Math.log(2));y;)h+=h,y--;return h+=h.substring(0,A-h.length),h}var $="",ce="",ue="",k="",ne={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},Ie=10;function je(h){var y=Object.keys(h),A=Object.create(Object.getPrototypeOf(h));return y.forEach(function(w){A[w]=h[w]}),Object.defineProperty(A,"message",{value:h.message}),A}function he(h){return m(h,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function xe(h,y,A){var w="",_="",c=0,o="",u=!1,v=he(h),b=v.split(`
1
+ import{v as de,B as Br}from"./vendor-utils-BfZ4tlod.js";import{bM as De,bN as Dr,bO as Mr,bP as Pr,bQ as Cr,bR as Lr,bS as Vr,bT as Rr,bU as Fr,bV as ar,bW as $r,bX as Gr,bY as zr,bZ as Yr,aR as Hr,bL as Zr,aI as Wr}from"./vendor-ux-did-connect-BbCim3WZ.js";var ze={exports:{}},Ye={},fr;function Ir(){if(fr)return Ye;fr=1;function r(p){"@babel/helpers - typeof";return r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},r(p)}function e(p,l,m){return Object.defineProperty(p,"prototype",{writable:!1}),p}function t(p,l){if(!(p instanceof l))throw new TypeError("Cannot call a class as a function")}function n(p,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function");p.prototype=Object.create(l&&l.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),Object.defineProperty(p,"prototype",{writable:!1}),l&&f(p,l)}function f(p,l){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(j,L){return j.__proto__=L,j},f(p,l)}function s(p){var l=q();return function(){var j=S(p),L;if(l){var P=S(this).constructor;L=Reflect.construct(j,arguments,P)}else L=j.apply(this,arguments);return d(this,L)}}function d(p,l){if(l&&(r(l)==="object"||typeof l=="function"))return l;if(l!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return x(p)}function x(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function q(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function S(p){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(m){return m.__proto__||Object.getPrototypeOf(m)},S(p)}var K={},C,T;function N(p,l,m){m||(m=Error);function j(P,te,$){return typeof l=="string"?l:l(P,te,$)}var L=function(P){n($,P);var te=s($);function $(ce,ue,k){var ne;return t(this,$),ne=te.call(this,j(ce,ue,k)),ne.code=p,ne}return e($)}(m);K[p]=L}function B(p,l){if(Array.isArray(p)){var m=p.length;return p=p.map(function(j){return String(j)}),m>2?"one of ".concat(l," ").concat(p.slice(0,m-1).join(", "),", or ")+p[m-1]:m===2?"one of ".concat(l," ").concat(p[0]," or ").concat(p[1]):"of ".concat(l," ").concat(p[0])}else return"of ".concat(l," ").concat(String(p))}function X(p,l,m){return p.substr(0,l.length)===l}function Y(p,l,m){return(m===void 0||m>p.length)&&(m=p.length),p.substring(m-l.length,m)===l}function D(p,l,m){return typeof m!="number"&&(m=0),m+l.length>p.length?!1:p.indexOf(l,m)!==-1}return N("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),N("ERR_INVALID_ARG_TYPE",function(p,l,m){C===void 0&&(C=ir()),C(typeof p=="string","'name' must be a string");var j;typeof l=="string"&&X(l,"not ")?(j="must not be",l=l.replace(/^not /,"")):j="must be";var L;if(Y(p," argument"))L="The ".concat(p," ").concat(j," ").concat(B(l,"type"));else{var P=D(p,".")?"property":"argument";L='The "'.concat(p,'" ').concat(P," ").concat(j," ").concat(B(l,"type"))}return L+=". Received type ".concat(r(m)),L},TypeError),N("ERR_INVALID_ARG_VALUE",function(p,l){var m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";T===void 0&&(T=De);var j=T.inspect(l);return j.length>128&&(j="".concat(j.slice(0,128),"...")),"The argument '".concat(p,"' ").concat(m,". Received ").concat(j)},TypeError),N("ERR_INVALID_RETURN_VALUE",function(p,l,m){var j;return m&&m.constructor&&m.constructor.name?j="instance of ".concat(m.constructor.name):j="type ".concat(r(m)),"Expected ".concat(p,' to be returned from the "').concat(l,'"')+" function but got ".concat(j,".")},TypeError),N("ERR_MISSING_ARGS",function(){for(var p=arguments.length,l=new Array(p),m=0;m<p;m++)l[m]=arguments[m];C===void 0&&(C=ir()),C(l.length>0,"At least one arg needs to be specified");var j="The ",L=l.length;switch(l=l.map(function(P){return'"'.concat(P,'"')}),L){case 1:j+="".concat(l[0]," argument");break;case 2:j+="".concat(l[0]," and ").concat(l[1]," arguments");break;default:j+=l.slice(0,L-1).join(", "),j+=", and ".concat(l[L-1]," arguments");break}return"".concat(j," must be specified")},TypeError),Ye.codes=K,Ye}var He,sr;function kr(){if(sr)return He;sr=1;function r(h,y){var A=Object.keys(h);if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(h);y&&(w=w.filter(function(_){return Object.getOwnPropertyDescriptor(h,_).enumerable})),A.push.apply(A,w)}return A}function e(h){for(var y=1;y<arguments.length;y++){var A=arguments[y]!=null?arguments[y]:{};y%2?r(Object(A),!0).forEach(function(w){t(h,w,A[w])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(A)):r(Object(A)).forEach(function(w){Object.defineProperty(h,w,Object.getOwnPropertyDescriptor(A,w))})}return h}function t(h,y,A){return y=d(y),y in h?Object.defineProperty(h,y,{value:A,enumerable:!0,configurable:!0,writable:!0}):h[y]=A,h}function n(h,y){if(!(h instanceof y))throw new TypeError("Cannot call a class as a function")}function f(h,y){for(var A=0;A<y.length;A++){var w=y[A];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(h,d(w.key),w)}}function s(h,y,A){return y&&f(h.prototype,y),Object.defineProperty(h,"prototype",{writable:!1}),h}function d(h){var y=x(h,"string");return p(y)==="symbol"?y:String(y)}function x(h,y){if(p(h)!=="object"||h===null)return h;var A=h[Symbol.toPrimitive];if(A!==void 0){var w=A.call(h,y||"default");if(p(w)!=="object")return w;throw new TypeError("@@toPrimitive must return a primitive value.")}return(y==="string"?String:Number)(h)}function q(h,y){if(typeof y!="function"&&y!==null)throw new TypeError("Super expression must either be null or a function");h.prototype=Object.create(y&&y.prototype,{constructor:{value:h,writable:!0,configurable:!0}}),Object.defineProperty(h,"prototype",{writable:!1}),y&&Y(h,y)}function S(h){var y=B();return function(){var w=D(h),_;if(y){var c=D(this).constructor;_=Reflect.construct(w,arguments,c)}else _=w.apply(this,arguments);return K(this,_)}}function K(h,y){if(y&&(p(y)==="object"||typeof y=="function"))return y;if(y!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return C(h)}function C(h){if(h===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h}function T(h){var y=typeof Map=="function"?new Map:void 0;return T=function(w){if(w===null||!X(w))return w;if(typeof w!="function")throw new TypeError("Super expression must either be null or a function");if(typeof y<"u"){if(y.has(w))return y.get(w);y.set(w,_)}function _(){return N(w,arguments,D(this).constructor)}return _.prototype=Object.create(w.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),Y(_,w)},T(h)}function N(h,y,A){return B()?N=Reflect.construct.bind():N=function(_,c,o){var u=[null];u.push.apply(u,c);var v=Function.bind.apply(_,u),b=new v;return o&&Y(b,o.prototype),b},N.apply(null,arguments)}function B(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function X(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function Y(h,y){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(w,_){return w.__proto__=_,w},Y(h,y)}function D(h){return D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},D(h)}function p(h){"@babel/helpers - typeof";return p=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(y){return typeof y}:function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},p(h)}var l=De,m=l.inspect,j=Ir(),L=j.codes.ERR_INVALID_ARG_TYPE;function P(h,y,A){return(A===void 0||A>h.length)&&(A=h.length),h.substring(A-y.length,A)===y}function te(h,y){if(y=Math.floor(y),h.length==0||y==0)return"";var A=h.length*y;for(y=Math.floor(Math.log(y)/Math.log(2));y;)h+=h,y--;return h+=h.substring(0,A-h.length),h}var $="",ce="",ue="",k="",ne={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},Ie=10;function je(h){var y=Object.keys(h),A=Object.create(Object.getPrototypeOf(h));return y.forEach(function(w){A[w]=h[w]}),Object.defineProperty(A,"message",{value:h.message}),A}function he(h){return m(h,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function xe(h,y,A){var w="",_="",c=0,o="",u=!1,v=he(h),b=v.split(`
2
2
  `),E=he(y).split(`
3
3
  `),R=0,H="";if(A==="strictEqual"&&p(h)==="object"&&p(y)==="object"&&h!==null&&y!==null&&(A="strictEqualObject"),b.length===1&&E.length===1&&b[0]!==E[0]){var J=b[0].length+E[0].length;if(J<=Ie){if((p(h)!=="object"||h===null)&&(p(y)!=="object"||y===null)&&(h!==0||y!==0))return"".concat(ne[A],`
4
4
 
@@ -1 +1 @@
1
- import{j as t,aa as s,H as i,T as a}from"./vendor-mui-core-Bq8gXTan.js";import{a as f}from"./vendor-ux-did-connect-DVX9lQ8a.js";import{L as g,r as k}from"./vendor-react-DEoibe3W.js";import"./index-CMYalRl2.js";import"./vendor-utils-BotmZdBm.js";import"./vendor-hooks-BFlOfe0M.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-DiSm3oUX.js";const p=(e,o)=>[e,...Array.isArray(o)?o:[o]],l=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function d({sx:e,...o}){const r=p({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}d.propTypes={sx:i.object};d.defaultProps={sx:{}};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function u({title:e,desc:o,extra:r,cover:c,icon:n,to:x,sx:h}){const m=p({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,n&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:n})})]}),t.jsx(a,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...l()},children:e}),o&&t.jsx(a,{variant:"body2",sx:{my:1,...l(),color:"text.secondary"},children:o}),r]})})})}u.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const j="/.well-known/service/static/assets/doc-board-bg-DWZHV9Ng.png";function b({board:e,sx:o,...r}){return t.jsx(u,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}b.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function I(){const{locale:e}=f(),o=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/blocklet-developer/${e}/getting-started`},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/createblocklet/${e}/quick-start`},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:`https://www.arcblock.io/docs/launcher/${e}/launcher-welcome`},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:`https://www.arcblock.io/docs/did-spaces/${e}/did-spaces-getting-started`},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:`https://www.arcblock.io/docs/did-wallet/${e}/get-started`},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:`https://www.arcblock.io/docs/did-domain/${e}/did-domain-faq`},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:`https://www.arcblock.io/docs/blockchain/${e}/blockchain-how-to-guides`},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:`https://www.arcblock.io/docs/did-connect/${e}/developer-guides`}];return t.jsx(d,{children:o.map(r=>t.jsx(b,{board:r},r.id))})}export{I as default};
1
+ import{j as t,aa as s,H as i,T as a}from"./vendor-mui-core-Bq8gXTan.js";import{a as f}from"./vendor-ux-did-connect-BbCim3WZ.js";import{L as g,r as k}from"./vendor-react-DEoibe3W.js";import"./index-BMCGWiyM.js";import"./vendor-utils-BfZ4tlod.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-f1tICt1E.js";const p=(e,o)=>[e,...Array.isArray(o)?o:[o]],l=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function d({sx:e,...o}){const r=p({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}d.propTypes={sx:i.object};d.defaultProps={sx:{}};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function u({title:e,desc:o,extra:r,cover:c,icon:n,to:x,sx:h}){const m=p({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,n&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:n})})]}),t.jsx(a,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...l()},children:e}),o&&t.jsx(a,{variant:"body2",sx:{my:1,...l(),color:"text.secondary"},children:o}),r]})})})}u.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const j="/.well-known/service/static/assets/doc-board-bg-DWZHV9Ng.png";function b({board:e,sx:o,...r}){return t.jsx(u,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}b.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function I(){const{locale:e}=f(),o=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/blocklet-developer/${e}/getting-started`},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/createblocklet/${e}/quick-start`},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:`https://www.arcblock.io/docs/launcher/${e}/launcher-welcome`},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:`https://www.arcblock.io/docs/did-spaces/${e}/did-spaces-getting-started`},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:`https://www.arcblock.io/docs/did-wallet/${e}/get-started`},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:`https://www.arcblock.io/docs/did-domain/${e}/did-domain-faq`},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:`https://www.arcblock.io/docs/blockchain/${e}/blockchain-how-to-guides`},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:`https://www.arcblock.io/docs/did-connect/${e}/developer-guides`}];return t.jsx(d,{children:o.map(r=>t.jsx(b,{board:r},r.id))})}export{I as default};
@@ -1,4 +1,4 @@
1
- import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,j as e,aa as T,O as te,bs as ge,bt as We,bo as G,ad as xt,H as x,a9 as Je,T as ae,E as Xe,bz as gt,bQ as Ke,bR as qe,y as Le,b6 as Me,ab as bt,bI as jt,Y as vt,cn as yt,m as Ht,as as dt,br as Vt,bn as Gt,q as ut,bX as Yt,I as Jt}from"./vendor-mui-core-Bq8gXTan.js";import{J as St,z as Xt,A as Qt,e as fe,aB as ye,C as Zt}from"./vendor-utils-BotmZdBm.js";import{y as es,a as re,ab as Ct,a3 as q,X as ke,b$ as ts,B as me,k as W,bb as ss,ax as wt,bg as ns,r as Qe,c0 as is,a2 as Tt,ac as Rt,bz as Oe,ar as Nt,$ as as,bG as rs}from"./vendor-ux-did-connect-DVX9lQ8a.js";import{D as Ze,G as Et,aC as It,aD as Q,y as se,n as os,K as pt}from"./index-CMYalRl2.js";import{a as Te,u as V,b as ce}from"./vendor-hooks-BFlOfe0M.js";import{a as et,b as ls}from"./dashboard-B2X6c8E8.js";import{f as $e,i as cs,d as ds}from"./use-blocklet-logo-CTCMbFiC.js";import{A as us,a as ps,d as fs,b as ms}from"./collapse-9taxUXec.js";import{S as ee}from"./section-BDMQAX_r.js";import{S as Re}from"./shorten-label-BQvbtscf.js";import{I as Ot}from"./index-BzZuK-66.js";import{R as At,A as hs,S as xs,a as gs,b as bs,B as js}from"./list-KVxvPXZu.js";import{W as vs}from"./did-address-L54dTMrT.js";import{p as Dt}from"./util-M3UFXQFT.js";import{D as ys,g as Ss}from"./traffic-CUSLm0PX.js";import{B as Lt}from"./bundle-avatar-B5-ypzmO.js";import{u as Cs}from"./use-mobile-DwzRjjku.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-DiSm3oUX.js";import"./useLocalStorage-DyVGBDlt.js";import"./index-8eXqqyHQ.js";import"./confirm-DApmnpvm.js";import"./PlayArrow-RVSfCmrB.js";import"./get-safe-url-B8xlSMyD.js";import"./session-Bkvl2PSP.js";import"./InfoOutlined-C8ZBPUhD.js";import"./dot-iw3hN9HL.js";import"./useAsync-DVHp96Uu.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";import"./index-DEZojGsm.js";import"./CheckCircle-BcPSvH2E.js";import"./base32-DEjena1X.js";import"./iframe-Dj9NLHp2.js";import"./LaunchOutlined-DQZ7S23O.js";import"./ChevronLeft-Ch9iK6fF.js";import"./ChevronRight-DclARA5k.js";import"./index-B2NkqENf.js";import"./base-chart-C2FJuVG1.js";import"./index-CKY4HT0P.js";import"./vendor-mui-x-1nqAyytV.js";import"./AdapterDayjs-BzjU9O7t.js";var Ue={exports:{}},He={exports:{}},Ve={exports:{}};(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;function s(r){return r==null}n.exports=t.default,n.exports.default=t.default})(Ve,Ve.exports);var ws=Ve.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var s=o(es),r=o(ws);function o(h){return h&&h.__esModule?h:{default:h}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,y=/^[-+]?[0-9]+$/;function p(h,i){(0,s.default)(h),i=i||{};var O=i.allow_leading_zeroes===!1?l:y,A=!i.hasOwnProperty("min")||(0,r.default)(i.min)||h>=i.min,R=!i.hasOwnProperty("max")||(0,r.default)(i.max)||h<=i.max,S=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||h<i.lt,D=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||h>i.gt;return O.test(h)&&A&&R&&S&&D}n.exports=t.default,n.exports.default=t.default})(He,He.exports);var Ts=He.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var s=r(Ts);function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,s.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=t.default,n.exports.default=t.default})(Ue,Ue.exports);var Rs=Ue.exports;const Ns=Ut(Rs),Fe={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Es(){var N,E,P;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(N=t==null?void 0:t.meta)==null?void 0:N.did,y=Object.assign({...Fe},((P=(E=t==null?void 0:t.settings)==null?void 0:E.notification)==null?void 0:P.email)||{}),{handleSubmit:p,control:h,formState:i,watch:O,reset:A}=It({defaultValues:St(y,Object.keys(Fe))}),R=Te({testReceiver:"",testReceiverError:""}),S=O("enabled"),D=V(async(a,m,$=!0)=>{var U,oe;try{const{blocklet:le}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),pe=Object.assign({...Fe},((oe=(U=le==null?void 0:le.settings)==null?void 0:U.notification)==null?void 0:oe.email)||{});A(pe),$&&q.success(s("oauth.saveSuccess"))}catch(le){if($)q.error(le.message||s("oauth.saveFailed"));else throw le}}),Y=V(async(a,m,$)=>{try{i.isDirty&&await D(a,m,!1),await n.sendEmail({input:{did:l,receiver:$,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),q.success(s("notification.email.testSuccess"))}catch(U){q.error(U.message||s("notification.email.testfailed"))}}),B=V((a,m)=>{R.testReceiver="",R.testReceiverError="",r.open({title:s("notification.email.testSendEmail"),content:()=>e.jsx(T,{sx:{width:"300px"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.email.inputTestReceiver"),value:R.testReceiver,onChange:$=>{R.testReceiver=$.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm($){var oe;const U=(oe=R.testReceiver)==null?void 0:oe.trim();if(!U){R.testReceiverError=s("notification.email.receiverRequired");return}if(!ke(U)){R.testReceiverError=s("notification.email.receiverInvalid");return}R.testReceiverError="",await Y(a,m,U),$()}})}),z=V(a=>{const m=a==null?void 0:a.trim();return m?ke(m)?!0:s("notification.email.fromInvalid"):s("notification.email.fromRequired")}),_=V(a=>{const m=a==null?void 0:a.trim();return m?$e(m,{require_host:!1,protocols:[]})?!0:s("notification.email.hostInvalid"):s("notification.email.hostRequired")}),M=V(a=>a?Ns(a)?!0:s("notification.email.portInvalid"):s("notification.email.portRequired")),J=V(a=>a!=null&&a.trim()?!0:s("notification.email.userRequired")),ie=V(a=>a!=null&&a.trim()?!0:s("notification.email.passwordRequired")),c=V(a=>a!=null&&a.trim()&&!$e(a,{protocols:["http","https"],require_protocol:!0})?s("notification.email.linkInvalid"):!0),g=V(a=>a!=null&&a.trim()&&!ke(a)?s("notification.email.emailInvalid"):!0),j=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Is,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.email.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:a})=>e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a})})})}),e.jsx(ee,{title:s("notification.email.from"),children:e.jsx(Q,{name:"from",control:h,rules:{validate:S?z:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,label:s("notification.email.from"),error:!!i.errors[a.name],helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.host"),children:e.jsx(Q,{name:"host",control:h,rules:{validate:S?_:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.host"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.port"),children:e.jsx(Q,{name:"port",control:h,rules:{validate:S?M:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:s("notification.email.port"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.user"),children:e.jsx(Q,{name:"user",control:h,rules:{validate:S?J:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.user"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.password"),children:e.jsx(Q,{name:"password",control:h,rules:{validate:S?ie:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:s("notification.email.password"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.secure"),children:e.jsx(Q,{name:"secure",control:h,rules:{validate:j},render:({field:a})=>e.jsx(G,{fullWidth:!0,children:e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a,disabled:!S})})})})}),e.jsxs(us,{children:[e.jsxs(ps,{expandIcon:e.jsx(fs,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[s("notification.email.signature"),e.jsx(xt,{title:s("notification.email.signatureTooltip"),children:e.jsx(ts,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ms,{children:[e.jsx(ee,{title:s("notification.email.companyName"),children:e.jsx(Q,{name:"companyName",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyName"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyLink"),children:e.jsx(Q,{name:"companyLink",control:h,rules:{validate:S?c:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyLink"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyAddress"),children:e.jsx(Q,{name:"companyAddress",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyAddress"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.supportEmail"),children:e.jsx(Q,{name:"supportEmail",control:h,rules:{validate:S?g:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:s("notification.email.supportEmail"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})})]})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(B),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Is=ue(ht)``,ze={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function Os(){var M,J,ie;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(M=t==null?void 0:t.meta)==null?void 0:M.did,y=Object.assign({...ze},((ie=(J=t==null?void 0:t.settings)==null?void 0:J.notification)==null?void 0:ie.pushKit)||{}),{handleSubmit:p,control:h,formState:i,watch:O,reset:A}=It({defaultValues:St(y,Object.keys(ze))}),R=Te({testReceiver:"",testReceiverError:""}),S=O("enabled"),D=V(async(c,g,j=!0)=>{var N,E;try{const{blocklet:P}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:c})}}),a=Object.assign({...ze},((E=(N=P==null?void 0:P.settings)==null?void 0:N.notification)==null?void 0:E.pushKit)||{});A(a),j&&q.success(s("oauth.saveSuccess"))}catch(P){if(j)q.error(P.message||s("oauth.saveFailed"));else throw P}}),Y=V(async(c,g)=>{var j,N,E;try{i.isDirty&&await D(c,g,!1);const P=(j=((t==null?void 0:t.configs)||[]).find($=>$.key==="BLOCKLET_APP_URL"))==null?void 0:j.value,a=Xt(Qt(P,W.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:(N=t==null?void 0:t.meta)==null?void 0:N.version,t:new Date((t==null?void 0:t.updatedAt)||0).getTime()}),m={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:t==null?void 0:t.appDid,fullName:(E=t==null?void 0:t.meta)==null?void 0:E.title,avatar:a}}}};await n.sendPush({input:{did:l,receiver:R.testReceiver,notification:JSON.stringify(m)}}),q.success(s("notification.pushKit.testSuccess"))}catch(P){q.error(P.message||s("notification.pushKit.testfailed"))}}),B=V((c,g)=>{R.testReceiverError="",r.open({title:s("notification.pushKit.testSend"),content:()=>e.jsx(T,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.pushKit.inputTestReceiver"),value:R.testReceiver,onChange:j=>{R.testReceiver=j.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(j){var E;if(!((E=R.testReceiver)==null?void 0:E.trim())){R.testReceiverError=s("notification.pushKit.receiverRequired");return}R.testReceiverError="",await Y(c,g),j()}})}),z=V(c=>{const g=c==null?void 0:c.trim();return g?$e(g)?!0:s("notification.pushKit.endpointInvalid"):s("notification.pushKit.endpointRequired")}),_=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(As,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.pushKit.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:c})=>e.jsx(ge,{control:e.jsx(We,{checked:c.value,...c})})})}),e.jsx(ee,{title:s("notification.pushKit.endpoint"),children:e.jsx(Q,{name:"endpoint",control:h,rules:{validate:S?z:_},render:({field:c})=>{var g;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",required:!0,label:s("notification.pushKit.endpoint"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})}),e.jsxs(ee,{title:s("notification.pushKit.customOptions"),children:[e.jsx(Q,{name:"did",control:h,render:({field:c})=>{var g;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.did"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}}),e.jsx(Q,{name:"pushPath",control:h,render:({field:c})=>{var g;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.pushPath"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(B),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const As=ue(ht)``,ft=[{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function Ds(){const[n,t]=C.useState(ft[0].value),{locale:s}=C.useContext(ss),r=ce(()=>({email:e.jsx(Es,{}),pushKit:e.jsx(Os,{})}),[s]),o=C.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(T,{children:[e.jsx(wt,{tabs:ft,current:n,onChange:t}),e.jsx(T,{style:o,children:r[n]})]})}const Pt=C.createContext({}),{Provider:Ls,Consumer:si}=Pt;function Ps({children:n,blocklet:t=""}){const{api:s,inService:r,ws:{useSubscription:o}}=Ze(),[l,y]=C.useState([]),[p,h]=C.useState({total:0,pageSize:20,pageCount:0,page:1}),i=ce(()=>{var c;return(c=t.meta)==null?void 0:c.did},[t]),[O,A]=C.useState([]),[R,S]=C.useState({}),D=ce(()=>l.length?new Set(l.map(c=>c.id)):new Set,[l]),Y=async({page:c=1,pageSize:g=20,...j}={})=>{if(!i)return[];try{const N={paging:{page:c,pageSize:g},...j,teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0},{dids:E,...P}=N;let a="";E&&E.includes("system")&&(a="system");const m=E?E.filter(oe=>oe!=="system"):[],$={...P,source:a,componentDids:m},U=await s.getNotificationSendLog({input:$});return S($),y(U.list),h(U.paging),U.list}catch(N){return q.error(N.message),[]}},B=async()=>{const c=await s.getNotificationComponents({input:{teamDid:i}});A(c.componentDids)},z=C.useCallback(c=>{const g=t.children.find(j=>{var N;return((N=j.meta)==null?void 0:N.did)===c});if(g)return g.ancestors=[t],g},[t]),_=async({notificationId:c,receivers:g,channels:j,...N})=>{await s.resendNotification({input:{teamDid:i,notificationId:c,receivers:g,channels:j.map(E=>E==="wallet"?W.NOTIFICATION_SEND_CHANNEL.WALLET:E==="pushKit"?W.NOTIFICATION_SEND_CHANNEL.PUSH:E),...N}})},M=C.useCallback(async c=>(await s.getUser({input:{teamDid:i,user:{did:c}}})).user,[s,i]),J=C.useCallback(async({page:c=1,pageSize:g=20,...j}={})=>{try{const N={paging:{page:c,pageSize:g},...j,userName:j.searchText||"",teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:N})}catch(N){throw q.error(N.message),N}},[s,i]);C.useEffect(()=>{i&&B()},[i]),o(W.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,c=>{D.has(c.notificationId)&&Y(R)},[D,R]),o(W.EVENTS.NOTIFICATION_BLOCKLET_CREATE,c=>{D.has(c.id)||Y(R)},[D,R]);const ie={fetch:Y,data:l,paging:p,blocklet:t,getComponent:z,resendNotification:_,getUser:M,componentDids:O,getReceivers:J,inService:r,teamDid:i};return e.jsx(Ls,{value:{notificationRecords:ie},children:n})}function tt(){const{notificationRecords:n}=C.useContext(Pt);return n}Ne.propTypes={severity:x.oneOf(Object.values(["info","success","error","warning"])).isRequired};const _s={info:"primary",success:"success",error:"error",warning:"warning"};function Ne({severity:n="info"}){return e.jsx(ns,{type:_s[n],children:n})}var st={},ks=Je;Object.defineProperty(st,"__esModule",{value:!0});var _t=st.default=void 0,Fs=ks(Qe()),zs=e;_t=st.default=(0,Fs.default)((0,zs.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var nt={},Bs=Je;Object.defineProperty(nt,"__esModule",{value:!0});var kt=nt.default=void 0,Ws=Bs(Qe()),Ks=e;kt=nt.default=(0,Ws.default)((0,Ks.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var it={},qs=Je;Object.defineProperty(it,"__esModule",{value:!0});var Ft=it.default=void 0,Ms=qs(Qe()),$s=e;Ft=it.default=(0,Ms.default)((0,$s.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Us=(n,t,s="")=>{if(!s||!t)return"";switch(s){case W.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return s}};function zt(n,t,s={}){const{status:r,updatedAt:o,reason:l="",channel:y="wallet"}=s,p=o?n("notification.sendStatus.sentTime",{date:os(o,t)}):"",h=Us(n,y,l);return r===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:p,reason:h}:r===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:p}:{status:"pending",title:n("notification.sendStatus.pending"),reason:h,sentTime:p}}const Ge={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ye=["wallet","pushKit","email"],mt=["info","success","error","warning"],Bt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.email)==null?void 0:r.enabled},Wt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.pushKit)==null?void 0:r.enabled},Hs=(n,t)=>{const s=fe(t,"extra.notifications.email",!0);return{available:Bt(n),enabled:s}},Vs=(n,t)=>{const s=fe(t,"extra.notifications.push",!0);return{available:Wt(n),enabled:s}},Gs=n=>({enabled:fe(n,"extra.notifications.wallet",!0)}),Ys=n=>({enabled:fe(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(t=>{setTimeout(()=>{t()},n*1e3)}),Js=(n,t)=>t==="wallet"||t==="webhook"?[{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:t==="pushKit"||t==="email"?[{channel:t,type:"available",pass:n("notification.sendStatus.reason.available",{channel:t}),fail:n("notification.sendStatus.reason.unavailable",{channel:t})},{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:[],Ie=(n=[])=>{const t=se().startOf("day");return n.filter(s=>se(s.sendAt).isSame(t,"day")).length},Xs=(n,t="")=>{if(t&&Ye.includes(t)){const l=`${t}SendRecord`,y=fe(n,l,[]);return Ie(y)}const s=fe(n,"webhook",{}),r=Object.keys(s??{})??[];if(t&&r.includes(t)){const l=s[t]??[];return Ie(l)}const o={};return Ye.forEach(l=>{const y=`${l}SendRecord`,p=fe(n,y,[]),h=Ie(p);o[l]=h}),r.length>0&&r.forEach(l=>{const y=s[l]??[],p=Ie(y);o[l]=p}),o},Ae=(n,t,s)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[s].splice(t,1),n},De=(n,t)=>{if(!Array.isArray(t))throw new Error("filters must be an array");return t.length?!t.includes(n):!1},Qs=n=>{switch(n){case W.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case W.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case W.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case W.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Kt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:t=!0,showTitle:s=!1,children:r}){const{status:o,title:l="",sentTime:y="",reason:p=""}=n,h=[l,p].filter(Boolean).join(", ");return e.jsx(xt,{title:t?e.jsxs(e.Fragment,{children:[e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:h}),e.jsx("span",{children:y})]}):null,arrow:!0,placement:"top",children:e.jsxs(T,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(T,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(T,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Ge[o],style:{opacity:.15}}),e.jsx(T,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Ge[o]})]}),e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:s?l:r})]})})}de.propTypes={config:x.object.isRequired,enableTooltip:x.bool,showTitle:x.bool,children:x.node};de.defaultProps={enableTooltip:!0,showTitle:!1,children:null};Se.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};Se.defaultProps={onDelete:()=>{}};function Se({list:n,label:t,onDelete:s}){const{t:r,locale:o}=re();return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(l=>{const y=zt(r,o,{status:l});return e.jsx(Xe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(de,{config:y,enableTooltip:!1,children:y.title})}),onDelete:p=>s(p,l)},l)})]})}at.propTypes={filterList:x.array.isRequired,onChange:x.func.isRequired,index:x.number.isRequired,column:x.object.isRequired,filterValues:x.array.isRequired,label:x.string.isRequired,renderLabel:x.func.isRequired};function at({filterList:n,onChange:t,index:s,column:r,filterValues:o,label:l,renderLabel:y}){return e.jsxs(G,{className:"filter-container",children:[e.jsx(gt,{component:"legend",children:l}),e.jsx(Ke,{row:!0,children:o.map(p=>e.jsx(ge,{control:e.jsx(qe,{checked:n[s].indexOf(p.value??p)>-1,onChange:h=>{const i=[...n];h.target.checked?i[s]=[...i[s],p.value??p]:i[s]=i[s].filter(O=>O!==(p.value??p)),t(i[s],s,r)},name:p.value??p}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:y(p)})},p.value??p))})]})}function Be(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(de,{enableTooltip:!1,config:{status:t.status},children:t.label})})}ve.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function ve({status:n,updatedAt:t,reason:s="",channel:r="wallet",onResend:o}){const{t:l,locale:y}=re(),p=zt(l,y,{status:n,updatedAt:t,reason:s,channel:r});return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(de,{config:p,showTitle:!0}),p.status!=="success"&&e.jsx(Le,{className:"resend-btn",size:"small",startIcon:e.jsx(et,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}rt.propTypes={value:x.array.isRequired,onChange:x.func};function rt({value:n,onChange:t}){const{locale:s}=re(),r=se().toDate(),[o,l]=C.useState(null),y=C.useCallback(i=>{l(o?null:i.currentTarget)},[o]),p=!!o,h=C.useCallback(i=>{if(!i.startDate||!i.endDate){q.error("Please select a date range");return}if(se(i.startDate).isAfter(i.endDate)||!se(i.startDate).isValid()||!se(i.endDate).isValid()){q.error("Invalid date range");return}t([i.startDate,i.endDate]),l(null)},[t]);return e.jsxs("div",{children:[e.jsx(ae,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Le,{onClick:y,variant:"outlined",size:"small",color:"inherit",children:[pt(n[0],s)," - ",pt(n[1],s)]})}),e.jsx(Me,{open:p,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(ys,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:y,definedRanges:Ss(r),onChange:h})})]})}ot.propTypes={itemComponent:x.elementType.isRequired};function ot({itemComponent:n,...t}){var o;const{t:s}=re();return!((o=t==null?void 0:t.filterList)!=null&&o.filter(l=>l.length).length)?null:e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(is.TableFilterList,{...t,ItemComponent:n})})]})}function Pe({label:n,onDelete:t,canDelete:s=()=>!0,...r}){const o=t&&typeof t=="function"?t:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:n,...r})),e.jsx(Xe,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}Pe.propTypes={label:x.string.isRequired,onDelete:x.func,canDelete:x.func};Pe.defaultProps={canDelete:()=>!0};const Zs=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];lt.propTypes={loading:x.bool,onCancel:x.func,onConfirm:x.func};lt.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function lt({loading:n=!1,onCancel:t,onConfirm:s}){const{t:r}=re(),[o,l]=C.useState(Zs),[y,p]=C.useState(!0),h=(O,A)=>{A.checked=O.target.checked;const R=o.map(S=>({...S,checked:S.value===A.value?A.checked:S.checked}));l(R)},i=O=>{O.stopPropagation(),s({channels:o.filter(A=>A.checked).map(A=>A.value),isResendFailedOnly:y})};return e.jsxs(T,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ae,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(T,{className:"choose-channel",children:e.jsxs(G,{component:"fieldset",variant:"standard",children:[e.jsx(gt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Ke,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(O=>e.jsx(ge,{control:e.jsx(qe,{checked:O.checked,onChange:A=>h(A,O),name:O.value}),label:O.label},O.value))})]})}),e.jsx(T,{className:"resend-config-footer",children:e.jsx(Ke,{children:e.jsx(ge,{control:e.jsx(qe,{checked:y,onChange:O=>p(O.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(T,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Le,{onClick:O=>{O.stopPropagation(),t()},color:"inherit",children:r("common.cancel")}),e.jsxs(Le,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(bt,{size:16}),r("common.confirm")]})]})]})}qt.propTypes={notificationId:x.string.isRequired,handleResend:x.func,resending:x.bool};function qt({notificationId:n,handleResend:t,resending:s=!1}){const{t:r,locale:o}=re(),l=jt(),y=C.useMemo(()=>vt(l,Kt()),[l]),{getReceivers:p,inService:h,teamDid:i,getUser:O,blocklet:A}=tt(),[R,S]=C.useState(!1),[D,Y]=C.useState([]),B=Te({anchorEl:null,position:null}),z=Te({anchorEl:null,position:null}),[_,M]=C.useState(null),[J,ie]=C.useState({total:0,pageSize:10,pageCount:0,page:1}),[c,g]=C.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),[j,N]=C.useState([]),E=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],P=async()=>{if(!R&&n)try{S(!0);const d=await p({notificationId:n,...c}),u=d.list.map(f=>({...f,receiverUser:{...f.receiverUser,avatar:Dt(f.receiverUser.avatar,i,h)}}));Y(u),ie(d.paging),S(!1)}catch(d){q.error(d.message),S(!1)}};C.useEffect(()=>{P()},[c]);const a=d=>{d.stopPropagation();const u=d.currentTarget;z.anchorEl=u;const f=u.getBoundingClientRect();z.position={top:f.top+window.scrollY,left:f.left+window.scrollX}},m=d=>d.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(me,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:r("notification.resend")})}):null,$={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:J.page-1,rowsPerPage:J.pageSize,count:J.total,searchText:c.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:j,onRowSelectionChange:(d,u)=>{N(u.map(f=>f.dataIndex))},customToolbarSelect:m},U=({page:d,rowsPerPage:u,searchText:f,filterList:L})=>{const[,K=[],Z=[],X=[]]=L;c.pageSize!==u?g(H=>({...H,pageSize:u,page:1})):c.page!==d+1?g(H=>({...H,page:d+1})):c.searchText!==f?g(H=>({...H,searchText:f,page:1})):ye(K,c.walletSendStatus)?ye(Z,c.pushKitSendStatus)?ye(X,c.emailSendStatus)||g(H=>({...H,emailSendStatus:X,page:1})):g(H=>({...H,pushKitSendStatus:Z,page:1})):g(H=>({...H,walletSendStatus:K,page:1}))},oe=C.useCallback(async(d,u)=>{if(!u)return!1;const f=await O(u);return f?d==="wallet"?Gs(f):d==="email"?Hs(A,f):d==="pushKit"?Vs(A,f):d==="webhook"?Ys(f):!0:!1},[O,A]),le=C.useCallback(d=>Js(r,d),[r]),pe=()=>{B.anchorEl=null,B.position=null,M(null)},be=()=>{z.anchorEl=null,z.position=null},je=async(d,u,f=!0,L="")=>{if(!(!u.length||!d.length))try{t(d,u,f,L),z.anchorEl||(await Ee(.5),pe())}catch(K){console.error("handleResend error",{error:K})}},v=async({channels:d,isResendFailedOnly:u})=>{const f=j.map(L=>D[L].receiver);await je(d,f,u),await Ee(.5),be(),N([])},b=async(d,u=[],f=!0)=>{try{await je(["webhook"],[d.receiver],f,u)}catch(L){q.error(L.response?L.response.statusText:L.message)}},w=async(d,u,f,L=[],K=!0)=>{if(d.stopPropagation(),Xs(u,f)>=4){q.warning(r("notification.resendLimit"));return}if(!Ye.includes(f)){await b(u,L,K);return}if(d){const X=d.currentTarget,H=X.getBoundingClientRect();B.anchorEl=X,B.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}M({channel:f});try{const X=await oe(f,u.receiver);await Ee(1),M({channel:f,result:X}),(typeof X=="boolean"&&X||Zt(X)&&Object.values(X).every(H=>!!H))&&(await t([f],[u.receiver],K),z.anchorEl||(await Ee(.5),pe()))}catch(X){q.error(X.message)}},I=d=>{g(u=>({...u,dateRange:d,page:1}))},k=(d,u,f,L)=>{d.stopPropagation();const K=f.filter(Z=>Z!==u);g(Z=>({...Z,[L]:K,page:1}))},F=ce(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:d=>{const{receiverUser:u,receiver:f}=D[d];return u?e.jsxs(T,{"data-cy":`member-name-${u.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(Tt,{src:`${u.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:f,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Re,{children:u.fullName})]},f):e.jsx(vs,{size:14,responsive:!1,compact:!0,copyable:!1,did:f})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:c.walletSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Wallet",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[1].options.filterList,"walletSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Wallet",filterList:d,onChange:u,index:f,column:L,filterValues:E})},customBodyRenderLite:d=>{const{walletSendStatus:u,walletSendAt:f,walletSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"wallet",onResend:K=>w(K,D[d],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{pushKitSendStatus:u,pushKitSendAt:f,pushKitSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"pushkit",onResend:K=>w(K,D[d],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:c.pushKitSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Push Kit",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[2].options.filterList,"pushKitSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Push Kit",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{emailSendStatus:u,emailSendAt:f,emailSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"email",onResend:K=>w(K,D[d],"email",[],!1)})},filter:!0,filterType:"custom",filterList:c.emailSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Email",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[3].options.filterList,"emailSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Email",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{webhook:u}=D[d];if(!u)return null;const f=Object.entries(u)[0];if(!f)return null;const[L,K]=f,Z=K[0];return e.jsx(T,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(T,{className:"webhook-item",fontSize:12,children:[e.jsx(Re,{maxLength:30,children:L},L),e.jsx(ve,{status:Z.status,updatedAt:Z.sendAt,reason:Z.failedReason,channel:"webhook",onResend:X=>w(X,D[d],"webhook",[L],!1)})]},L)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:d=>{const{createdAt:u}=D[d];return e.jsx(At,{value:u,locale:o,shouldUpdate:!0})}}}],[D,o,c,r]),ne=[e.jsx(rt,{value:c.dateRange,onChange:I},"date-picker"),e.jsx(me,{variant:"contained",size:"small",color:"primary",loading:R,startIcon:e.jsx(Ft,{}),onClick:()=>P(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(T,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(tn,{children:e.jsxs(yt,{theme:y,children:[e.jsx(Rt,{className:"receivers-table",locale:o,loading:R,columns:F,data:D,onChange:U,options:$,customButtons:ne,components:{TableFilterList:d=>e.jsx(ot,{...d,itemComponent:u=>e.jsx(Pe,{...u,canDelete:()=>!1})})}}),B.anchorEl&&e.jsx(Me,{open:!!B.anchorEl,anchorReference:"anchorPosition",anchorPosition:B.position,onClose:pe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(sn,{children:[e.jsxs(ae,{variant:"body1",component:"div",className:"check-title",children:[_==null?void 0:_.channel," Checking"]}),e.jsx(T,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:le(_==null?void 0:_.channel).map(d=>{var K,Z;const{type:u,pass:f,fail:L}=d;return!(_!=null&&_.result)||(K=_==null?void 0:_.result)!=null&&K[u]?e.jsxs(ae,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(Z=_==null?void 0:_.result)!=null&&Z[u]?Oe.success.main:"inherit"},children:[_!=null&&_.result?e.jsx(_t,{}):e.jsx(bt,{size:12,sx:{color:Oe.primary.main}}),e.jsx("span",{children:f})]},u):e.jsxs(ae,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Oe.error.main},children:[e.jsx(kt,{}),e.jsx("span",{children:L})]},u)})})]})}),z.anchorEl&&e.jsx(Me,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:be,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(lt,{loading:s,onCancel:be,onConfirm:v})})]})})})}const en=C.memo(qt),tn=ue.div`
1
+ import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,j as e,aa as T,O as te,bs as ge,bt as We,bo as G,ad as xt,H as x,a9 as Je,T as ae,E as Xe,bz as gt,bQ as Ke,bR as qe,y as Le,b6 as Me,ab as bt,bI as jt,Y as vt,cn as yt,m as Ht,as as dt,br as Vt,bn as Gt,q as ut,bX as Yt,I as Jt}from"./vendor-mui-core-Bq8gXTan.js";import{J as St,z as Xt,A as Qt,e as fe,aB as ye,C as Zt}from"./vendor-utils-BfZ4tlod.js";import{y as es,a as re,ab as Ct,a3 as q,X as ke,c1 as ts,B as me,k as W,bb as ss,ax as wt,bg as ns,r as Qe,c2 as is,a2 as Tt,ac as Rt,bB as Oe,ar as Nt,$ as as,bI as rs}from"./vendor-ux-did-connect-BbCim3WZ.js";import{D as Ze,G as Et,aC as It,aD as Q,y as se,n as os,K as pt}from"./index-BMCGWiyM.js";import{a as Te,u as V,b as ce}from"./vendor-hooks-DqdmWCmo.js";import{a as et,b as ls}from"./dashboard-CpxtvWAW.js";import{f as $e,i as cs,d as ds}from"./use-blocklet-logo-DwwmdicD.js";import{A as us,a as ps,d as fs,b as ms}from"./collapse-D4xd-ptF.js";import{S as ee}from"./section-BDMQAX_r.js";import{S as Re}from"./shorten-label-BQvbtscf.js";import{I as Ot}from"./index-DDI23z2P.js";import{R as At,A as hs,S as xs,a as gs,b as bs,B as js}from"./list-C4l_W2F_.js";import{W as vs}from"./did-address-DFiM35OM.js";import{p as Dt}from"./util-paKPrRHx.js";import{D as ys,g as Ss}from"./traffic-DAzuj4ZR.js";import{B as Lt}from"./bundle-avatar-CH2OoDP-.js";import{u as Cs}from"./use-mobile-CtTQsfXN.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-f1tICt1E.js";import"./useLocalStorage-iQ2AmaOA.js";import"./index-8eXqqyHQ.js";import"./confirm-Bbp7EOHO.js";import"./PlayArrow-DZsdEeq_.js";import"./get-safe-url-CuT70yLx.js";import"./session-BDyIB4uh.js";import"./InfoOutlined-B5f3YRb4.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DwzRjjku.js";import"./index-DEZojGsm.js";import"./CheckCircle-DYKWpCjc.js";import"./base32-Cbt7-U8e.js";import"./iframe-DYXqfKJj.js";import"./LaunchOutlined-Bcn_86ca.js";import"./ChevronLeft-C5ZElVOZ.js";import"./ChevronRight-BDtG7F9C.js";import"./index-B2NkqENf.js";import"./base-chart-CoApVzod.js";import"./index-w4f-mlFt.js";import"./vendor-mui-x-1nqAyytV.js";import"./AdapterDayjs-T0keO70D.js";var Ue={exports:{}},He={exports:{}},Ve={exports:{}};(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;function s(r){return r==null}n.exports=t.default,n.exports.default=t.default})(Ve,Ve.exports);var ws=Ve.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var s=o(es),r=o(ws);function o(h){return h&&h.__esModule?h:{default:h}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,y=/^[-+]?[0-9]+$/;function p(h,i){(0,s.default)(h),i=i||{};var O=i.allow_leading_zeroes===!1?l:y,A=!i.hasOwnProperty("min")||(0,r.default)(i.min)||h>=i.min,R=!i.hasOwnProperty("max")||(0,r.default)(i.max)||h<=i.max,S=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||h<i.lt,D=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||h>i.gt;return O.test(h)&&A&&R&&S&&D}n.exports=t.default,n.exports.default=t.default})(He,He.exports);var Ts=He.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var s=r(Ts);function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,s.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=t.default,n.exports.default=t.default})(Ue,Ue.exports);var Rs=Ue.exports;const Ns=Ut(Rs),Fe={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Es(){var N,E,P;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(N=t==null?void 0:t.meta)==null?void 0:N.did,y=Object.assign({...Fe},((P=(E=t==null?void 0:t.settings)==null?void 0:E.notification)==null?void 0:P.email)||{}),{handleSubmit:p,control:h,formState:i,watch:O,reset:A}=It({defaultValues:St(y,Object.keys(Fe))}),R=Te({testReceiver:"",testReceiverError:""}),S=O("enabled"),D=V(async(a,m,$=!0)=>{var U,oe;try{const{blocklet:le}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),pe=Object.assign({...Fe},((oe=(U=le==null?void 0:le.settings)==null?void 0:U.notification)==null?void 0:oe.email)||{});A(pe),$&&q.success(s("oauth.saveSuccess"))}catch(le){if($)q.error(le.message||s("oauth.saveFailed"));else throw le}}),Y=V(async(a,m,$)=>{try{i.isDirty&&await D(a,m,!1),await n.sendEmail({input:{did:l,receiver:$,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),q.success(s("notification.email.testSuccess"))}catch(U){q.error(U.message||s("notification.email.testfailed"))}}),z=V((a,m)=>{R.testReceiver="",R.testReceiverError="",r.open({title:s("notification.email.testSendEmail"),content:()=>e.jsx(T,{sx:{width:"300px"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.email.inputTestReceiver"),value:R.testReceiver,onChange:$=>{R.testReceiver=$.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm($){var oe;const U=(oe=R.testReceiver)==null?void 0:oe.trim();if(!U){R.testReceiverError=s("notification.email.receiverRequired");return}if(!ke(U)){R.testReceiverError=s("notification.email.receiverInvalid");return}R.testReceiverError="",await Y(a,m,U),$()}})}),B=V(a=>{const m=a==null?void 0:a.trim();return m?ke(m)?!0:s("notification.email.fromInvalid"):s("notification.email.fromRequired")}),_=V(a=>{const m=a==null?void 0:a.trim();return m?$e(m,{require_host:!1,protocols:[]})?!0:s("notification.email.hostInvalid"):s("notification.email.hostRequired")}),M=V(a=>a?Ns(a)?!0:s("notification.email.portInvalid"):s("notification.email.portRequired")),J=V(a=>a!=null&&a.trim()?!0:s("notification.email.userRequired")),ie=V(a=>a!=null&&a.trim()?!0:s("notification.email.passwordRequired")),c=V(a=>a!=null&&a.trim()&&!$e(a,{protocols:["http","https"],require_protocol:!0})?s("notification.email.linkInvalid"):!0),g=V(a=>a!=null&&a.trim()&&!ke(a)?s("notification.email.emailInvalid"):!0),j=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Is,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.email.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:a})=>e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a})})})}),e.jsx(ee,{title:s("notification.email.from"),children:e.jsx(Q,{name:"from",control:h,rules:{validate:S?B:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,label:s("notification.email.from"),error:!!i.errors[a.name],helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.host"),children:e.jsx(Q,{name:"host",control:h,rules:{validate:S?_:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.host"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.port"),children:e.jsx(Q,{name:"port",control:h,rules:{validate:S?M:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:s("notification.email.port"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.user"),children:e.jsx(Q,{name:"user",control:h,rules:{validate:S?J:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.user"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.password"),children:e.jsx(Q,{name:"password",control:h,rules:{validate:S?ie:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:s("notification.email.password"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.secure"),children:e.jsx(Q,{name:"secure",control:h,rules:{validate:j},render:({field:a})=>e.jsx(G,{fullWidth:!0,children:e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a,disabled:!S})})})})}),e.jsxs(us,{children:[e.jsxs(ps,{expandIcon:e.jsx(fs,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[s("notification.email.signature"),e.jsx(xt,{title:s("notification.email.signatureTooltip"),children:e.jsx(ts,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ms,{children:[e.jsx(ee,{title:s("notification.email.companyName"),children:e.jsx(Q,{name:"companyName",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyName"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyLink"),children:e.jsx(Q,{name:"companyLink",control:h,rules:{validate:S?c:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyLink"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyAddress"),children:e.jsx(Q,{name:"companyAddress",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyAddress"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.supportEmail"),children:e.jsx(Q,{name:"supportEmail",control:h,rules:{validate:S?g:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:s("notification.email.supportEmail"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})})]})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(z),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Is=ue(ht)``,Be={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function Os(){var M,J,ie;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(M=t==null?void 0:t.meta)==null?void 0:M.did,y=Object.assign({...Be},((ie=(J=t==null?void 0:t.settings)==null?void 0:J.notification)==null?void 0:ie.pushKit)||{}),{handleSubmit:p,control:h,formState:i,watch:O,reset:A}=It({defaultValues:St(y,Object.keys(Be))}),R=Te({testReceiver:"",testReceiverError:""}),S=O("enabled"),D=V(async(c,g,j=!0)=>{var N,E;try{const{blocklet:P}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:c})}}),a=Object.assign({...Be},((E=(N=P==null?void 0:P.settings)==null?void 0:N.notification)==null?void 0:E.pushKit)||{});A(a),j&&q.success(s("oauth.saveSuccess"))}catch(P){if(j)q.error(P.message||s("oauth.saveFailed"));else throw P}}),Y=V(async(c,g)=>{var j,N,E;try{i.isDirty&&await D(c,g,!1);const P=(j=((t==null?void 0:t.configs)||[]).find($=>$.key==="BLOCKLET_APP_URL"))==null?void 0:j.value,a=Xt(Qt(P,W.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:(N=t==null?void 0:t.meta)==null?void 0:N.version,t:new Date((t==null?void 0:t.updatedAt)||0).getTime()}),m={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:t==null?void 0:t.appDid,fullName:(E=t==null?void 0:t.meta)==null?void 0:E.title,avatar:a}}}};await n.sendPush({input:{did:l,receiver:R.testReceiver,notification:JSON.stringify(m)}}),q.success(s("notification.pushKit.testSuccess"))}catch(P){q.error(P.message||s("notification.pushKit.testfailed"))}}),z=V((c,g)=>{R.testReceiverError="",r.open({title:s("notification.pushKit.testSend"),content:()=>e.jsx(T,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.pushKit.inputTestReceiver"),value:R.testReceiver,onChange:j=>{R.testReceiver=j.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(j){var E;if(!((E=R.testReceiver)==null?void 0:E.trim())){R.testReceiverError=s("notification.pushKit.receiverRequired");return}R.testReceiverError="",await Y(c,g),j()}})}),B=V(c=>{const g=c==null?void 0:c.trim();return g?$e(g)?!0:s("notification.pushKit.endpointInvalid"):s("notification.pushKit.endpointRequired")}),_=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(As,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.pushKit.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:c})=>e.jsx(ge,{control:e.jsx(We,{checked:c.value,...c})})})}),e.jsx(ee,{title:s("notification.pushKit.endpoint"),children:e.jsx(Q,{name:"endpoint",control:h,rules:{validate:S?B:_},render:({field:c})=>{var g;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",required:!0,label:s("notification.pushKit.endpoint"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})}),e.jsxs(ee,{title:s("notification.pushKit.customOptions"),children:[e.jsx(Q,{name:"did",control:h,render:({field:c})=>{var g;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.did"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}}),e.jsx(Q,{name:"pushPath",control:h,render:({field:c})=>{var g;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.pushPath"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(z),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const As=ue(ht)``,ft=[{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function Ds(){const[n,t]=C.useState(ft[0].value),{locale:s}=C.useContext(ss),r=ce(()=>({email:e.jsx(Es,{}),pushKit:e.jsx(Os,{})}),[s]),o=C.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(T,{children:[e.jsx(wt,{tabs:ft,current:n,onChange:t}),e.jsx(T,{style:o,children:r[n]})]})}const Pt=C.createContext({}),{Provider:Ls,Consumer:si}=Pt;function Ps({children:n,blocklet:t=""}){const{api:s,inService:r,ws:{useSubscription:o}}=Ze(),[l,y]=C.useState([]),[p,h]=C.useState({total:0,pageSize:20,pageCount:0,page:1}),i=ce(()=>{var c;return(c=t.meta)==null?void 0:c.did},[t]),[O,A]=C.useState([]),[R,S]=C.useState({}),D=ce(()=>l.length?new Set(l.map(c=>c.id)):new Set,[l]),Y=async({page:c=1,pageSize:g=20,...j}={})=>{if(!i)return[];try{const N={paging:{page:c,pageSize:g},...j,teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0},{dids:E,...P}=N;let a="";E&&E.includes("system")&&(a="system");const m=E?E.filter(oe=>oe!=="system"):[],$={...P,source:a,componentDids:m},U=await s.getNotificationSendLog({input:$});return S($),y(U.list),h(U.paging),U.list}catch(N){return q.error(N.message),[]}},z=async()=>{const c=await s.getNotificationComponents({input:{teamDid:i}});A(c.componentDids)},B=C.useCallback(c=>{const g=t.children.find(j=>{var N;return((N=j.meta)==null?void 0:N.did)===c});if(g)return g.ancestors=[t],g},[t]),_=async({notificationId:c,receivers:g,channels:j,...N})=>{await s.resendNotification({input:{teamDid:i,notificationId:c,receivers:g,channels:j.map(E=>E==="wallet"?W.NOTIFICATION_SEND_CHANNEL.WALLET:E==="pushKit"?W.NOTIFICATION_SEND_CHANNEL.PUSH:E),...N}})},M=C.useCallback(async c=>(await s.getUser({input:{teamDid:i,user:{did:c}}})).user,[s,i]),J=C.useCallback(async({page:c=1,pageSize:g=20,...j}={})=>{try{const N={paging:{page:c,pageSize:g},...j,userName:j.searchText||"",teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:N})}catch(N){throw q.error(N.message),N}},[s,i]);C.useEffect(()=>{i&&z()},[i]),o(W.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,c=>{D.has(c.notificationId)&&Y(R)},[D,R]),o(W.EVENTS.NOTIFICATION_BLOCKLET_CREATE,c=>{D.has(c.id)||Y(R)},[D,R]);const ie={fetch:Y,data:l,paging:p,blocklet:t,getComponent:B,resendNotification:_,getUser:M,componentDids:O,getReceivers:J,inService:r,teamDid:i};return e.jsx(Ls,{value:{notificationRecords:ie},children:n})}function tt(){const{notificationRecords:n}=C.useContext(Pt);return n}Ne.propTypes={severity:x.oneOf(Object.values(["info","success","error","warning"])).isRequired};const _s={info:"primary",success:"success",error:"error",warning:"warning"};function Ne({severity:n="info"}){return e.jsx(ns,{type:_s[n],children:n})}var st={},ks=Je;Object.defineProperty(st,"__esModule",{value:!0});var _t=st.default=void 0,Fs=ks(Qe()),Bs=e;_t=st.default=(0,Fs.default)((0,Bs.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var nt={},zs=Je;Object.defineProperty(nt,"__esModule",{value:!0});var kt=nt.default=void 0,Ws=zs(Qe()),Ks=e;kt=nt.default=(0,Ws.default)((0,Ks.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var it={},qs=Je;Object.defineProperty(it,"__esModule",{value:!0});var Ft=it.default=void 0,Ms=qs(Qe()),$s=e;Ft=it.default=(0,Ms.default)((0,$s.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Us=(n,t,s="")=>{if(!s||!t)return"";switch(s){case W.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return s}};function Bt(n,t,s={}){const{status:r,updatedAt:o,reason:l="",channel:y="wallet"}=s,p=o?n("notification.sendStatus.sentTime",{date:os(o,t)}):"",h=Us(n,y,l);return r===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:p,reason:h}:r===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:p}:{status:"pending",title:n("notification.sendStatus.pending"),reason:h,sentTime:p}}const Ge={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ye=["wallet","pushKit","email"],mt=["info","success","error","warning"],zt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.email)==null?void 0:r.enabled},Wt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.pushKit)==null?void 0:r.enabled},Hs=(n,t)=>{const s=fe(t,"extra.notifications.email",!0);return{available:zt(n),enabled:s}},Vs=(n,t)=>{const s=fe(t,"extra.notifications.push",!0);return{available:Wt(n),enabled:s}},Gs=n=>({enabled:fe(n,"extra.notifications.wallet",!0)}),Ys=n=>({enabled:fe(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(t=>{setTimeout(()=>{t()},n*1e3)}),Js=(n,t)=>t==="wallet"||t==="webhook"?[{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:t==="pushKit"||t==="email"?[{channel:t,type:"available",pass:n("notification.sendStatus.reason.available",{channel:t}),fail:n("notification.sendStatus.reason.unavailable",{channel:t})},{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:[],Ie=(n=[])=>{const t=se().startOf("day");return n.filter(s=>se(s.sendAt).isSame(t,"day")).length},Xs=(n,t="")=>{if(t&&Ye.includes(t)){const l=`${t}SendRecord`,y=fe(n,l,[]);return Ie(y)}const s=fe(n,"webhook",{}),r=Object.keys(s??{})??[];if(t&&r.includes(t)){const l=s[t]??[];return Ie(l)}const o={};return Ye.forEach(l=>{const y=`${l}SendRecord`,p=fe(n,y,[]),h=Ie(p);o[l]=h}),r.length>0&&r.forEach(l=>{const y=s[l]??[],p=Ie(y);o[l]=p}),o},Ae=(n,t,s)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[s].splice(t,1),n},De=(n,t)=>{if(!Array.isArray(t))throw new Error("filters must be an array");return t.length?!t.includes(n):!1},Qs=n=>{switch(n){case W.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case W.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case W.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case W.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Kt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:t=!0,showTitle:s=!1,children:r}){const{status:o,title:l="",sentTime:y="",reason:p=""}=n,h=[l,p].filter(Boolean).join(", ");return e.jsx(xt,{title:t?e.jsxs(e.Fragment,{children:[e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:h}),e.jsx("span",{children:y})]}):null,arrow:!0,placement:"top",children:e.jsxs(T,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(T,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(T,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Ge[o],style:{opacity:.15}}),e.jsx(T,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Ge[o]})]}),e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:s?l:r})]})})}de.propTypes={config:x.object.isRequired,enableTooltip:x.bool,showTitle:x.bool,children:x.node};de.defaultProps={enableTooltip:!0,showTitle:!1,children:null};Se.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};Se.defaultProps={onDelete:()=>{}};function Se({list:n,label:t,onDelete:s}){const{t:r,locale:o}=re();return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(l=>{const y=Bt(r,o,{status:l});return e.jsx(Xe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(de,{config:y,enableTooltip:!1,children:y.title})}),onDelete:p=>s(p,l)},l)})]})}at.propTypes={filterList:x.array.isRequired,onChange:x.func.isRequired,index:x.number.isRequired,column:x.object.isRequired,filterValues:x.array.isRequired,label:x.string.isRequired,renderLabel:x.func.isRequired};function at({filterList:n,onChange:t,index:s,column:r,filterValues:o,label:l,renderLabel:y}){return e.jsxs(G,{className:"filter-container",children:[e.jsx(gt,{component:"legend",children:l}),e.jsx(Ke,{row:!0,children:o.map(p=>e.jsx(ge,{control:e.jsx(qe,{checked:n[s].indexOf(p.value??p)>-1,onChange:h=>{const i=[...n];h.target.checked?i[s]=[...i[s],p.value??p]:i[s]=i[s].filter(O=>O!==(p.value??p)),t(i[s],s,r)},name:p.value??p}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:y(p)})},p.value??p))})]})}function ze(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(de,{enableTooltip:!1,config:{status:t.status},children:t.label})})}ve.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function ve({status:n,updatedAt:t,reason:s="",channel:r="wallet",onResend:o}){const{t:l,locale:y}=re(),p=Bt(l,y,{status:n,updatedAt:t,reason:s,channel:r});return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(de,{config:p,showTitle:!0}),p.status!=="success"&&e.jsx(Le,{className:"resend-btn",size:"small",startIcon:e.jsx(et,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}rt.propTypes={value:x.array.isRequired,onChange:x.func};function rt({value:n,onChange:t}){const{locale:s}=re(),r=se().toDate(),[o,l]=C.useState(null),y=C.useCallback(i=>{l(o?null:i.currentTarget)},[o]),p=!!o,h=C.useCallback(i=>{if(!i.startDate||!i.endDate){q.error("Please select a date range");return}if(se(i.startDate).isAfter(i.endDate)||!se(i.startDate).isValid()||!se(i.endDate).isValid()){q.error("Invalid date range");return}t([i.startDate,i.endDate]),l(null)},[t]);return e.jsxs("div",{children:[e.jsx(ae,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Le,{onClick:y,variant:"outlined",size:"small",color:"inherit",children:[pt(n[0],s)," - ",pt(n[1],s)]})}),e.jsx(Me,{open:p,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(ys,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:y,definedRanges:Ss(r),onChange:h})})]})}ot.propTypes={itemComponent:x.elementType.isRequired};function ot({itemComponent:n,...t}){var o;const{t:s}=re();return!((o=t==null?void 0:t.filterList)!=null&&o.filter(l=>l.length).length)?null:e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(is.TableFilterList,{...t,ItemComponent:n})})]})}function Pe({label:n,onDelete:t,canDelete:s=()=>!0,...r}){const o=t&&typeof t=="function"?t:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:n,...r})),e.jsx(Xe,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}Pe.propTypes={label:x.string.isRequired,onDelete:x.func,canDelete:x.func};Pe.defaultProps={canDelete:()=>!0};const Zs=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];lt.propTypes={loading:x.bool,onCancel:x.func,onConfirm:x.func};lt.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function lt({loading:n=!1,onCancel:t,onConfirm:s}){const{t:r}=re(),[o,l]=C.useState(Zs),[y,p]=C.useState(!0),h=(O,A)=>{A.checked=O.target.checked;const R=o.map(S=>({...S,checked:S.value===A.value?A.checked:S.checked}));l(R)},i=O=>{O.stopPropagation(),s({channels:o.filter(A=>A.checked).map(A=>A.value),isResendFailedOnly:y})};return e.jsxs(T,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ae,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(T,{className:"choose-channel",children:e.jsxs(G,{component:"fieldset",variant:"standard",children:[e.jsx(gt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Ke,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(O=>e.jsx(ge,{control:e.jsx(qe,{checked:O.checked,onChange:A=>h(A,O),name:O.value}),label:O.label},O.value))})]})}),e.jsx(T,{className:"resend-config-footer",children:e.jsx(Ke,{children:e.jsx(ge,{control:e.jsx(qe,{checked:y,onChange:O=>p(O.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(T,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Le,{onClick:O=>{O.stopPropagation(),t()},color:"inherit",children:r("common.cancel")}),e.jsxs(Le,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(bt,{size:16}),r("common.confirm")]})]})]})}qt.propTypes={notificationId:x.string.isRequired,handleResend:x.func,resending:x.bool};function qt({notificationId:n,handleResend:t,resending:s=!1}){const{t:r,locale:o}=re(),l=jt(),y=C.useMemo(()=>vt(l,Kt()),[l]),{getReceivers:p,inService:h,teamDid:i,getUser:O,blocklet:A}=tt(),[R,S]=C.useState(!1),[D,Y]=C.useState([]),z=Te({anchorEl:null,position:null}),B=Te({anchorEl:null,position:null}),[_,M]=C.useState(null),[J,ie]=C.useState({total:0,pageSize:10,pageCount:0,page:1}),[c,g]=C.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),[j,N]=C.useState([]),E=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],P=async()=>{if(!R&&n)try{S(!0);const d=await p({notificationId:n,...c}),u=d.list.map(f=>({...f,receiverUser:{...f.receiverUser,avatar:Dt(f.receiverUser.avatar,i,h)}}));Y(u),ie(d.paging),S(!1)}catch(d){q.error(d.message),S(!1)}};C.useEffect(()=>{P()},[c]);const a=d=>{d.stopPropagation();const u=d.currentTarget;B.anchorEl=u;const f=u.getBoundingClientRect();B.position={top:f.top+window.scrollY,left:f.left+window.scrollX}},m=d=>d.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(me,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:r("notification.resend")})}):null,$={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:J.page-1,rowsPerPage:J.pageSize,count:J.total,searchText:c.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:j,onRowSelectionChange:(d,u)=>{N(u.map(f=>f.dataIndex))},customToolbarSelect:m},U=({page:d,rowsPerPage:u,searchText:f,filterList:L})=>{const[,K=[],Z=[],X=[]]=L;c.pageSize!==u?g(H=>({...H,pageSize:u,page:1})):c.page!==d+1?g(H=>({...H,page:d+1})):c.searchText!==f?g(H=>({...H,searchText:f,page:1})):ye(K,c.walletSendStatus)?ye(Z,c.pushKitSendStatus)?ye(X,c.emailSendStatus)||g(H=>({...H,emailSendStatus:X,page:1})):g(H=>({...H,pushKitSendStatus:Z,page:1})):g(H=>({...H,walletSendStatus:K,page:1}))},oe=C.useCallback(async(d,u)=>{if(!u)return!1;const f=await O(u);return f?d==="wallet"?Gs(f):d==="email"?Hs(A,f):d==="pushKit"?Vs(A,f):d==="webhook"?Ys(f):!0:!1},[O,A]),le=C.useCallback(d=>Js(r,d),[r]),pe=()=>{z.anchorEl=null,z.position=null,M(null)},be=()=>{B.anchorEl=null,B.position=null},je=async(d,u,f=!0,L="")=>{if(!(!u.length||!d.length))try{t(d,u,f,L),B.anchorEl||(await Ee(.5),pe())}catch(K){console.error("handleResend error",{error:K})}},v=async({channels:d,isResendFailedOnly:u})=>{const f=j.map(L=>D[L].receiver);await je(d,f,u),await Ee(.5),be(),N([])},b=async(d,u=[],f=!0)=>{try{await je(["webhook"],[d.receiver],f,u)}catch(L){q.error(L.response?L.response.statusText:L.message)}},w=async(d,u,f,L=[],K=!0)=>{if(d.stopPropagation(),Xs(u,f)>=4){q.warning(r("notification.resendLimit"));return}if(!Ye.includes(f)){await b(u,L,K);return}if(d){const X=d.currentTarget,H=X.getBoundingClientRect();z.anchorEl=X,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}M({channel:f});try{const X=await oe(f,u.receiver);await Ee(1),M({channel:f,result:X}),(typeof X=="boolean"&&X||Zt(X)&&Object.values(X).every(H=>!!H))&&(await t([f],[u.receiver],K),B.anchorEl||(await Ee(.5),pe()))}catch(X){q.error(X.message)}},I=d=>{g(u=>({...u,dateRange:d,page:1}))},k=(d,u,f,L)=>{d.stopPropagation();const K=f.filter(Z=>Z!==u);g(Z=>({...Z,[L]:K,page:1}))},F=ce(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:d=>{const{receiverUser:u,receiver:f}=D[d];return u?e.jsxs(T,{"data-cy":`member-name-${u.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(Tt,{src:`${u.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:f,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Re,{children:u.fullName})]},f):e.jsx(vs,{size:14,responsive:!1,compact:!0,copyable:!1,did:f})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:c.walletSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Wallet",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[1].options.filterList,"walletSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Wallet",filterList:d,onChange:u,index:f,column:L,filterValues:E})},customBodyRenderLite:d=>{const{walletSendStatus:u,walletSendAt:f,walletSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"wallet",onResend:K=>w(K,D[d],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{pushKitSendStatus:u,pushKitSendAt:f,pushKitSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"pushkit",onResend:K=>w(K,D[d],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:c.pushKitSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Push Kit",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[2].options.filterList,"pushKitSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Push Kit",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{emailSendStatus:u,emailSendAt:f,emailSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"email",onResend:K=>w(K,D[d],"email",[],!1)})},filter:!0,filterType:"custom",filterList:c.emailSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Email",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[3].options.filterList,"emailSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Email",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{webhook:u}=D[d];if(!u)return null;const f=Object.entries(u)[0];if(!f)return null;const[L,K]=f,Z=K[0];return e.jsx(T,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(T,{className:"webhook-item",fontSize:12,children:[e.jsx(Re,{maxLength:30,children:L},L),e.jsx(ve,{status:Z.status,updatedAt:Z.sendAt,reason:Z.failedReason,channel:"webhook",onResend:X=>w(X,D[d],"webhook",[L],!1)})]},L)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:d=>{const{createdAt:u}=D[d];return e.jsx(At,{value:u,locale:o,shouldUpdate:!0})}}}],[D,o,c,r]),ne=[e.jsx(rt,{value:c.dateRange,onChange:I},"date-picker"),e.jsx(me,{variant:"contained",size:"small",color:"primary",loading:R,startIcon:e.jsx(Ft,{}),onClick:()=>P(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(T,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(tn,{children:e.jsxs(yt,{theme:y,children:[e.jsx(Rt,{className:"receivers-table",locale:o,loading:R,columns:F,data:D,onChange:U,options:$,customButtons:ne,components:{TableFilterList:d=>e.jsx(ot,{...d,itemComponent:u=>e.jsx(Pe,{...u,canDelete:()=>!1})})}}),z.anchorEl&&e.jsx(Me,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:pe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(sn,{children:[e.jsxs(ae,{variant:"body1",component:"div",className:"check-title",children:[_==null?void 0:_.channel," Checking"]}),e.jsx(T,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:le(_==null?void 0:_.channel).map(d=>{var K,Z;const{type:u,pass:f,fail:L}=d;return!(_!=null&&_.result)||(K=_==null?void 0:_.result)!=null&&K[u]?e.jsxs(ae,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(Z=_==null?void 0:_.result)!=null&&Z[u]?Oe.success.main:"inherit"},children:[_!=null&&_.result?e.jsx(_t,{}):e.jsx(bt,{size:12,sx:{color:Oe.primary.main}}),e.jsx("span",{children:f})]},u):e.jsxs(ae,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Oe.error.main},children:[e.jsx(kt,{}),e.jsx("span",{children:L})]},u)})})]})}),B.anchorEl&&e.jsx(Me,{open:!!B.anchorEl,anchorReference:"anchorPosition",anchorPosition:B.position,onClose:be,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(lt,{loading:s,onCancel:be,onConfirm:v})})]})})})}const en=C.memo(qt),tn=ue.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }
@@ -27,7 +27,7 @@ import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,
27
27
  }
28
28
  font-size: 12px;
29
29
  }
30
- `,Ce=n=>n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:n;function nn(n){const{wallet:t,push:s,email:r,webhook:o}=n;return[{name:"Wallet",value:e.jsx(he,{item:t})},{name:"Push",value:e.jsx(he,{item:s})},{name:"Email",value:e.jsx(he,{item:r})},...o.total>0?[{name:"Webhook",value:e.jsx(he,{item:o,isWebhook:!0})}]:[]]}function an(n,t,s){const{wallet:r,push:o,email:l,webhook:y}=n;return[{name:"Wallet",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:t})},{name:"Push",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:t})},{name:"Email",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.EMAIL,item:l,onResend:t})},...y.total>0?[{name:"Webhook",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:y,isWebhook:!0,onResend:t})}]:[]]}_e.propTypes={statistics:x.object.isRequired,onResend:x.func,mode:x.oneOf(["simple","detail"]),resending:x.bool};_e.defaultProps={mode:"simple",onResend:()=>{},resending:!1};he.propTypes={item:x.object.isRequired,isWebhook:x.bool};he.defaultProps={isWebhook:!1};function he({item:n,isWebhook:t=!1}){const{t:s}=re(),r=t?n.success.length:n.success,o=n.total,l=r===o?"success":"failed";return e.jsx(T,{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2,children:e.jsx(T,{display:"flex",alignItems:"center",gap:1,children:e.jsxs(de,{config:{status:l},enableTooltip:!1,children:[Ce(r)," / ",Ce(o)," ",s("notification.sendStatus.success")]})})})}xe.propTypes={item:x.object.isRequired,isWebhook:x.bool,channel:x.string,onResend:x.func,loading:x.bool};xe.defaultProps={isWebhook:!1,channel:W.NOTIFICATION_SEND_CHANNEL.WALLET,onResend:()=>{},loading:!1};function xe({channel:n,item:t,isWebhook:s=!1,onResend:r,loading:o}){const{t:l}=re(),{success:y,failed:p,pending:h}=t,i=Qs(n),O=s?y.length:y,A=s?p.length:p,R=s?h.length:h,S=async z=>{z.stopPropagation();const _=s?[...new Set([...y,...p].map(M=>M))]:[];await r([n],[],!0,_)},D=O+A,Y=D>0?O/D*100:0,B=D>0?A/D*100:0;return e.jsxs(rn,{successRatio:Y,failedRatio:B,children:[e.jsxs(ae,{variant:"h6",children:[i," (",t.total,")"]}),e.jsxs(ae,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:Ge.success,fontWeight:600,fontSize:24},children:Ce(O)}),e.jsx("small",{style:{paddingLeft:4},children:l("notification.sendStatus.success")})]}),e.jsxs(T,{className:"unsent-area",children:[e.jsxs(T,{children:[e.jsxs(de,{config:{status:"failed"},enableTooltip:!1,children:[Ce(A)," ",l("notification.sendStatus.failed")]}),e.jsxs(de,{config:{status:"pending"},enableTooltip:!1,children:[Ce(R)," ",l("notification.sendStatus.pending")]})]}),A>0&&e.jsx(T,{className:"resend-btn",children:e.jsx(me,{size:"small",color:"primary",loading:o,variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:S,children:l("notification.resend")})})]})]})}function _e({statistics:n,mode:t="simple",onResend:s,resending:r}){const o=ce(()=>t==="simple"?nn(n):an(n,s,r),[n,t]);return t==="simple"?e.jsx("div",{children:o.map(l=>e.jsx(Ot,{style:{alignItems:"flex-start",marginBottom:t==="simple"?0:16},valueComponent:"div",nameWidth:100,name:l.name,children:l.value},l.name))}):e.jsx(dt,{container:!0,spacing:2,children:o.map(l=>e.jsx(dt,{item:!0,md:4,sm:6,xs:12,children:l.value},l.name))})}const rn=ue(T)`
30
+ `,Ce=n=>n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:n;function nn(n){const{wallet:t,push:s,email:r,webhook:o}=n;return[{name:"Wallet",value:e.jsx(he,{item:t})},{name:"Push",value:e.jsx(he,{item:s})},{name:"Email",value:e.jsx(he,{item:r})},...o.total>0?[{name:"Webhook",value:e.jsx(he,{item:o,isWebhook:!0})}]:[]]}function an(n,t,s){const{wallet:r,push:o,email:l,webhook:y}=n;return[{name:"Wallet",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:t})},{name:"Push",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:t})},{name:"Email",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.EMAIL,item:l,onResend:t})},...y.total>0?[{name:"Webhook",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:y,isWebhook:!0,onResend:t})}]:[]]}_e.propTypes={statistics:x.object.isRequired,onResend:x.func,mode:x.oneOf(["simple","detail"]),resending:x.bool};_e.defaultProps={mode:"simple",onResend:()=>{},resending:!1};he.propTypes={item:x.object.isRequired,isWebhook:x.bool};he.defaultProps={isWebhook:!1};function he({item:n,isWebhook:t=!1}){const{t:s}=re(),r=t?n.success.length:n.success,o=n.total,l=r===o?"success":"failed";return e.jsx(T,{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2,children:e.jsx(T,{display:"flex",alignItems:"center",gap:1,children:e.jsxs(de,{config:{status:l},enableTooltip:!1,children:[Ce(r)," / ",Ce(o)," ",s("notification.sendStatus.success")]})})})}xe.propTypes={item:x.object.isRequired,isWebhook:x.bool,channel:x.string,onResend:x.func,loading:x.bool};xe.defaultProps={isWebhook:!1,channel:W.NOTIFICATION_SEND_CHANNEL.WALLET,onResend:()=>{},loading:!1};function xe({channel:n,item:t,isWebhook:s=!1,onResend:r,loading:o}){const{t:l}=re(),{success:y,failed:p,pending:h}=t,i=Qs(n),O=s?y.length:y,A=s?p.length:p,R=s?h.length:h,S=async B=>{B.stopPropagation();const _=s?[...new Set([...y,...p].map(M=>M))]:[];await r([n],[],!0,_)},D=O+A,Y=D>0?O/D*100:0,z=D>0?A/D*100:0;return e.jsxs(rn,{successRatio:Y,failedRatio:z,children:[e.jsxs(ae,{variant:"h6",children:[i," (",t.total,")"]}),e.jsxs(ae,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:Ge.success,fontWeight:600,fontSize:24},children:Ce(O)}),e.jsx("small",{style:{paddingLeft:4},children:l("notification.sendStatus.success")})]}),e.jsxs(T,{className:"unsent-area",children:[e.jsxs(T,{children:[e.jsxs(de,{config:{status:"failed"},enableTooltip:!1,children:[Ce(A)," ",l("notification.sendStatus.failed")]}),e.jsxs(de,{config:{status:"pending"},enableTooltip:!1,children:[Ce(R)," ",l("notification.sendStatus.pending")]})]}),A>0&&e.jsx(T,{className:"resend-btn",children:e.jsx(me,{size:"small",color:"primary",loading:o,variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:S,children:l("notification.resend")})})]})]})}function _e({statistics:n,mode:t="simple",onResend:s,resending:r}){const o=ce(()=>t==="simple"?nn(n):an(n,s,r),[n,t]);return t==="simple"?e.jsx("div",{children:o.map(l=>e.jsx(Ot,{style:{alignItems:"flex-start",marginBottom:t==="simple"?0:16},valueComponent:"div",nameWidth:100,name:l.name,children:l.value},l.name))}):e.jsx(dt,{container:!0,spacing:2,children:o.map(l=>e.jsx(dt,{item:!0,md:4,sm:6,xs:12,children:l.value},l.name))})}const rn=ue(T)`
31
31
  display: flex;
32
32
  flex-direction: column;
33
33
  align-items: flex-start;
@@ -45,7 +45,7 @@ import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,
45
45
  bottom: 0;
46
46
  }
47
47
  }
48
- `;Mt.propTypes={notification:x.object.isRequired,onCancel:x.func,blocklet:x.object.isRequired,tab:x.string};function Mt({notification:n,onCancel:t=()=>{},blocklet:s,tab:r="info"}){const{t:o,locale:l}=re(),{getComponent:y,resendNotification:p}=tt(),[h,i]=C.useState(!1),O=ce(()=>y(n.componentDid)||s,[s,n.componentDid]),A=Te({tab:r||"info"}),R=C.useCallback(async(c,g,j=!0,N=[])=>{var a;if(!c.length||!n.id)return;const E=g.length>0?g:(a=n==null?void 0:n.receivers)==null?void 0:a.map(m=>m.receiver);if(!E.length)return;let P=[...c];if(P.includes(W.NOTIFICATION_SEND_CHANNEL.PUSH)&&!Wt(s)&&(q.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),P=P.filter(m=>m!==W.NOTIFICATION_SEND_CHANNEL.PUSH)),P.includes(W.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!Bt(s)&&(q.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),P=P.filter(m=>m!==W.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!P.length)try{i(!0),await p({notificationId:n.id,receivers:E,channels:P,resendFailedOnly:j,...P.includes("webhook")&&N.length?{webhookUrls:N}:{}}),q.success("Message has been sent!")}catch(m){console.error("handleResend error",{error:m}),q.error(m.response?m.response.statusText:m.message)}finally{i(!1)}},[s,n.id,n==null?void 0:n.receivers,p,o]),S=ce(()=>cs(n),[n]),D=ce(()=>ds(n),[n]),Y=ce(()=>S?n==null?void 0:n.actorInfo:[],[n]),B=ce(()=>{var c;return(s==null?void 0:s.did)||((c=s==null?void 0:s.meta)==null?void 0:c.did)||""},[s]);function z(){return[{name:o("notification.from"),value:S&&D?e.jsx(hs,{actors:Y,teamDid:B,size:32,showName:!0}):e.jsx(xs,{size:32,blocklet:O,showName:!0,hideDot:!0})},{name:o("notification.notificationTitle"),value:e.jsx(Re,{maxLength:50,children:n.title})},{name:o("notification.body"),value:S?e.jsx(gs,{notification:n,blocklet:s}):e.jsx(bs,{notification:n,rows:0})},{name:o("notification.severity"),value:e.jsx(Ne,{severity:n.severity})},{name:o("notification.createdAt"),value:e.jsx(as,{value:n.createdAt,locale:l,shouldUpdate:!0,type:"all"})}].map(g=>e.jsx(Ot,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:g.name,children:g.value},g.name))}const _={info:{label:o("common.basicInfo"),value:"info",component:z},receivers:{label:o("notification.receiver"),value:"receivers"},statistics:{label:o("notification.statistics"),value:"statistics"}},M=Object.values(_).map(({label:c,value:g})=>({label:c,value:g})),J=_[A.tab]||_.info,ie=c=>{A.tab=c};return e.jsx(Nt,{title:o("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{A.tab="info",t()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(ln,{children:[e.jsx(T,{mx:3,className:"tabs",children:e.jsx(wt,{tabs:M,current:A.tab,onChange:ie,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[A.tab==="receivers"&&e.jsx(en,{notificationId:n.id,resending:h,handleResend:R}),A.tab==="statistics"&&e.jsx(_e,{statistics:n.statistics,mode:"detail",resending:h,onResend:R}),A.tab==="info"&&e.jsx(J.component,{})]})]})})}const on=C.memo(Mt),ln=ue.div`
48
+ `;Mt.propTypes={notification:x.object.isRequired,onCancel:x.func,blocklet:x.object.isRequired,tab:x.string};function Mt({notification:n,onCancel:t=()=>{},blocklet:s,tab:r="info"}){const{t:o,locale:l}=re(),{getComponent:y,resendNotification:p}=tt(),[h,i]=C.useState(!1),O=ce(()=>y(n.componentDid)||s,[s,n.componentDid]),A=Te({tab:r||"info"}),R=C.useCallback(async(c,g,j=!0,N=[])=>{var a;if(!c.length||!n.id)return;const E=g.length>0?g:(a=n==null?void 0:n.receivers)==null?void 0:a.map(m=>m.receiver);if(!E.length)return;let P=[...c];if(P.includes(W.NOTIFICATION_SEND_CHANNEL.PUSH)&&!Wt(s)&&(q.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),P=P.filter(m=>m!==W.NOTIFICATION_SEND_CHANNEL.PUSH)),P.includes(W.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!zt(s)&&(q.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),P=P.filter(m=>m!==W.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!P.length)try{i(!0),await p({notificationId:n.id,receivers:E,channels:P,resendFailedOnly:j,...P.includes("webhook")&&N.length?{webhookUrls:N}:{}}),q.success("Message has been sent!")}catch(m){console.error("handleResend error",{error:m}),q.error(m.response?m.response.statusText:m.message)}finally{i(!1)}},[s,n.id,n==null?void 0:n.receivers,p,o]),S=ce(()=>cs(n),[n]),D=ce(()=>ds(n),[n]),Y=ce(()=>S?n==null?void 0:n.actorInfo:[],[n]),z=ce(()=>{var c;return(s==null?void 0:s.did)||((c=s==null?void 0:s.meta)==null?void 0:c.did)||""},[s]);function B(){return[{name:o("notification.from"),value:S&&D?e.jsx(hs,{actors:Y,teamDid:z,size:32,showName:!0}):e.jsx(xs,{size:32,blocklet:O,showName:!0,hideDot:!0})},{name:o("notification.notificationTitle"),value:e.jsx(Re,{maxLength:50,children:n.title})},{name:o("notification.body"),value:S?e.jsx(gs,{notification:n,blocklet:s}):e.jsx(bs,{notification:n,rows:0})},{name:o("notification.severity"),value:e.jsx(Ne,{severity:n.severity})},{name:o("notification.createdAt"),value:e.jsx(as,{value:n.createdAt,locale:l,shouldUpdate:!0,type:"all"})}].map(g=>e.jsx(Ot,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:g.name,children:g.value},g.name))}const _={info:{label:o("common.basicInfo"),value:"info",component:B},receivers:{label:o("notification.receiver"),value:"receivers"},statistics:{label:o("notification.statistics"),value:"statistics"}},M=Object.values(_).map(({label:c,value:g})=>({label:c,value:g})),J=_[A.tab]||_.info,ie=c=>{A.tab=c};return e.jsx(Nt,{title:o("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{A.tab="info",t()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(ln,{children:[e.jsx(T,{mx:3,className:"tabs",children:e.jsx(wt,{tabs:M,current:A.tab,onChange:ie,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[A.tab==="receivers"&&e.jsx(en,{notificationId:n.id,resending:h,handleResend:R}),A.tab==="statistics"&&e.jsx(_e,{statistics:n.statistics,mode:"detail",resending:h,onResend:R}),A.tab==="info"&&e.jsx(J.component,{})]})]})})}const on=C.memo(Mt),ln=ue.div`
49
49
  & > .notification-row {
50
50
  padding: 0;
51
51
  }
@@ -92,7 +92,7 @@ import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,
92
92
  overflow: hidden;
93
93
  text-overflow: ellipsis;
94
94
  }
95
- `;function we({blocklet:n,label:t}){var s;return e.jsx(cn,{children:n?e.jsxs(e.Fragment,{children:[e.jsx(Lt,{size:24,blocklet:n,ancestors:n.ancestors}),e.jsx("span",{className:"name",children:n.title||((s=n.meta)==null?void 0:s.title)})]}):e.jsx("span",{className:"name",children:t})})}ct.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};ct.defaultProps={onDelete:()=>{}};function ct({list:n,label:t,onDelete:s}){return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(r=>e.jsx(Xe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(Ne,{severity:r})}),onDelete:o=>s(o,r)},r))]})}function dn(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(Ne,{severity:t})})}function un({customTableButtons:n}){var je;const{t,locale:s}=re(),r=jt(),o=C.useMemo(()=>vt(r,Kt()),[r]),[l,y]=C.useState(!1),{data:p,paging:h,blocklet:i,fetch:O,getComponent:A,componentDids:R,inService:S,teamDid:D}=tt(),Y=C.useRef(null),[B,z]=C.useState(null),[_,M]=C.useState("info"),J=Cs(),[ie,c]=C.useState(!1),g=`notification-records-${(je=i.meta)==null?void 0:je.did}`,j=rs(g),[N,E]=C.useState({pageSize:j.rowsPerPage||10,page:j.page?j.page+1:1,dids:j.dids||[],dateRange:j.dateRange||[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),P=ce(()=>{if(!i.children||!i.children.length)return[];const v=[];return i.children.forEach(b=>{var I;const w=b.did||((I=b.meta)==null?void 0:I.did);R.includes(w)&&(b.ancestors=[i],v.push(b))}),v},[R,i]),a=async v=>{try{y(!0),await O(v),y(!1)}finally{y(!1)}};C.useEffect(()=>{a(N)},[N]),C.useEffect(()=>{const v=p.find(b=>b.id===(B==null?void 0:B.id));B&&v&&z({...v})},[p]);const m=(v,b,w,I)=>{v.stopPropagation();const k=w.filter(F=>F!==b);E(F=>({...F,[I]:k,page:1}))},$=({page:v,rowsPerPage:b,filterList:w})=>{const[I=[],,,,k=[]]=w;N.pageSize!==b?E(F=>({...F,pageSize:b,page:1})):N.page!==v+1?E(F=>({...F,page:v+1})):ye(N.dids,I)?ye(N.severities,k)||E(F=>({...F,severities:k,page:1})):E(F=>({...F,dids:I,page:1}))},U=C.useCallback(()=>{z(null),M("info")},[]),oe=C.useCallback(()=>{O(N)},[O,N]),le=[{label:t("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:v=>v.map((b,w)=>{var k;if(b==="system")return e.jsx("span",{children:t("notification.system")},`system-${w}`);const I=P.find(F=>{var d;return(F.did||((d=F.meta)==null?void 0:d.did))===b});return e.jsx(we,{blocklet:I,label:(I==null?void 0:I.title)||((k=I==null?void 0:I.meta)==null?void 0:k.title)},b)}),update:(v,b,w)=>(v[w].splice(b,1),v)},filterOptions:{names:P,logic:(v,b)=>b.length?!b.includes(v):!1,display:(v,b,w,I)=>e.jsxs(G,{style:{width:"380px"},children:[e.jsx(Vt,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(Gt,{multiple:!0,value:v[w],renderValue:k=>e.jsx(T,{display:"flex",gap:1,alignItems:"center",style:{overflow:"hidden",textOverflow:"ellipsis"},children:k.map(F=>{var d;if(F==="system")return e.jsx("span",{children:t("notification.system")},F);const ne=P.find(u=>{var L;return(u.did||((L=u.meta)==null?void 0:L.did))===F});return e.jsx(we,{blocklet:ne,label:(ne==null?void 0:ne.title)||((d=ne==null?void 0:ne.meta)==null?void 0:d.title)},F)})}),onChange:k=>{v[w]=k.target.value,b(v[w],w,I)},children:[e.jsx(ut,{value:"system",children:t("notification.system")}),P.map(k=>{var ne,d;const F=k.did||((ne=k.meta)==null?void 0:ne.did);return e.jsx(ut,{value:F,children:e.jsx(we,{blocklet:k,label:k.title||((d=k.meta)==null?void 0:d.title)})},F)})]})]})},customBodyRenderLite:v=>{var I,k;const b=p[v],w=A(b.componentDid);return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[w?e.jsx(Lt,{size:32,blocklet:w,ancestors:w.ancestors??[]}):e.jsx(js,{blocklet:i,size:32}),e.jsx(Re,{maxLength:50,children:((I=w==null?void 0:w.meta)==null?void 0:I.title)||((k=i==null?void 0:i.meta)==null?void 0:k.title)})]})}}},{label:t("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:v=>{const b=p[v],{receivers:w}=b;return e.jsx(Yt,{total:w.length,renderSurplus:I=>I<100?e.jsxs("span",{children:["+",I]}):e.jsx("span",{children:"99+"}),max:3,sx:{justifyContent:"flex-end",height:"32px",".MuiAvatar-root":{width:"32px",height:"32px",fontSize:"12px",border:0,zIndex:2}},onClick:I=>{I.stopPropagation(),z(b),M("receivers")},children:w.map(I=>{const{receiverUser:k}=I,F=Dt(k.avatar,D,S);return e.jsx(Tt,{alt:k.fullName,src:`${F}?imageFilter=resize&w=48&h=48`,size:32,did:I.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},I.receiver)})})}}},{label:t("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:v=>{const b=p[v];return e.jsx(T,{onClick:w=>{w.stopPropagation(),z(b),M("statistics")},children:e.jsx(_e,{statistics:b.statistics})})}}},{label:t("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:v=>{const b=p[v];return e.jsx(Re,{maxLength:50,children:b.title})}}},{label:t("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:v=>{const b=p[v];return e.jsx(Ne,{severity:b.severity})},filter:!0,filterType:"custom",filterList:N.severities??[],customFilterListOptions:{render:v=>e.jsx(ct,{list:v,label:t("notification.severity"),onDelete:(b,w)=>{b.stopPropagation(),m(b,w,le[4].options.filterList,"severities")}}),update:Ae},filterOptions:{names:mt,fullWidth:!0,logic:De,display:(v,b,w,I)=>e.jsx(dn,{label:t("notification.severity"),filterList:v,onChange:b,index:w,column:I,filterValues:mt})}}},{label:t("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:v=>{const{createdAt:b}=p[v];return e.jsx(At,{value:b,locale:s,shouldUpdate:!0})}}}],pe=v=>{E(b=>({...b,dateRange:v,page:1}))},be=[e.jsxs(T,{display:"flex",alignItems:"center",gap:1.5,children:[e.jsx(Jt,{onClick:()=>c(!0),sx:{p:J?0:void 0},children:e.jsx(ls,{})},"settings"),J?e.jsx(ae,{children:t("common.setting")}):null]}),...n||[]];return e.jsxs(T,{ref:Y,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(pn,{children:e.jsx(yt,{theme:o,children:e.jsx(Rt,{className:"main-table",verticalKeyWidth:100,loading:l,locale:s,columns:le,data:p,durable:g,onChange:$,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:h.page-1,rowsPerPage:h.pageSize,count:h.total,...j,onRowClick:(v,{dataIndex:b})=>{z(p[b])}},customPreButtons:[e.jsx(rt,{value:N.dateRange,onChange:pe})],customButtons:be,components:{TableFilterList:v=>e.jsx(ot,{...v,itemComponent:b=>e.jsx(Pe,{...b,canDelete:w=>{var k;const I=(k=w==null?void 0:w.columnNames)==null?void 0:k[(w==null?void 0:w.index)||0];return(I==null?void 0:I.name)==="sender"}})})}})})}),B&&e.jsx(on,{refresh:oe,onCancel:U,notification:B,blocklet:i,tab:_}),e.jsx(Nt,{title:`${t("common.notification")} ${t("common.setting")}`,fullWidth:!0,maxWidth:"md",open:ie,onClose:()=>c(!1),PaperProps:{style:{minHeight:"500px"}},children:e.jsx(T,{sx:{mt:"-16px",overflowY:"hidden"},children:e.jsx(Ds,{})})})]})}const pn=ue.div`
95
+ `;function we({blocklet:n,label:t}){var s;return e.jsx(cn,{children:n?e.jsxs(e.Fragment,{children:[e.jsx(Lt,{size:24,blocklet:n,ancestors:n.ancestors}),e.jsx("span",{className:"name",children:n.title||((s=n.meta)==null?void 0:s.title)})]}):e.jsx("span",{className:"name",children:t})})}ct.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};ct.defaultProps={onDelete:()=>{}};function ct({list:n,label:t,onDelete:s}){return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(r=>e.jsx(Xe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(Ne,{severity:r})}),onDelete:o=>s(o,r)},r))]})}function dn(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(Ne,{severity:t})})}function un({customTableButtons:n}){var je;const{t,locale:s}=re(),r=jt(),o=C.useMemo(()=>vt(r,Kt()),[r]),[l,y]=C.useState(!1),{data:p,paging:h,blocklet:i,fetch:O,getComponent:A,componentDids:R,inService:S,teamDid:D}=tt(),Y=C.useRef(null),[z,B]=C.useState(null),[_,M]=C.useState("info"),J=Cs(),[ie,c]=C.useState(!1),g=`notification-records-${(je=i.meta)==null?void 0:je.did}`,j=rs(g),[N,E]=C.useState({pageSize:j.rowsPerPage||10,page:j.page?j.page+1:1,dids:j.dids||[],dateRange:j.dateRange||[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),P=ce(()=>{if(!i.children||!i.children.length)return[];const v=[];return i.children.forEach(b=>{var I;const w=b.did||((I=b.meta)==null?void 0:I.did);R.includes(w)&&(b.ancestors=[i],v.push(b))}),v},[R,i]),a=async v=>{try{y(!0),await O(v),y(!1)}finally{y(!1)}};C.useEffect(()=>{a(N)},[N]),C.useEffect(()=>{const v=p.find(b=>b.id===(z==null?void 0:z.id));z&&v&&B({...v})},[p]);const m=(v,b,w,I)=>{v.stopPropagation();const k=w.filter(F=>F!==b);E(F=>({...F,[I]:k,page:1}))},$=({page:v,rowsPerPage:b,filterList:w})=>{const[I=[],,,,k=[]]=w;N.pageSize!==b?E(F=>({...F,pageSize:b,page:1})):N.page!==v+1?E(F=>({...F,page:v+1})):ye(N.dids,I)?ye(N.severities,k)||E(F=>({...F,severities:k,page:1})):E(F=>({...F,dids:I,page:1}))},U=C.useCallback(()=>{B(null),M("info")},[]),oe=C.useCallback(()=>{O(N)},[O,N]),le=[{label:t("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:v=>v.map((b,w)=>{var k;if(b==="system")return e.jsx("span",{children:t("notification.system")},`system-${w}`);const I=P.find(F=>{var d;return(F.did||((d=F.meta)==null?void 0:d.did))===b});return e.jsx(we,{blocklet:I,label:(I==null?void 0:I.title)||((k=I==null?void 0:I.meta)==null?void 0:k.title)},b)}),update:(v,b,w)=>(v[w].splice(b,1),v)},filterOptions:{names:P,logic:(v,b)=>b.length?!b.includes(v):!1,display:(v,b,w,I)=>e.jsxs(G,{style:{width:"380px"},children:[e.jsx(Vt,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(Gt,{multiple:!0,value:v[w],renderValue:k=>e.jsx(T,{display:"flex",gap:1,alignItems:"center",style:{overflow:"hidden",textOverflow:"ellipsis"},children:k.map(F=>{var d;if(F==="system")return e.jsx("span",{children:t("notification.system")},F);const ne=P.find(u=>{var L;return(u.did||((L=u.meta)==null?void 0:L.did))===F});return e.jsx(we,{blocklet:ne,label:(ne==null?void 0:ne.title)||((d=ne==null?void 0:ne.meta)==null?void 0:d.title)},F)})}),onChange:k=>{v[w]=k.target.value,b(v[w],w,I)},children:[e.jsx(ut,{value:"system",children:t("notification.system")}),P.map(k=>{var ne,d;const F=k.did||((ne=k.meta)==null?void 0:ne.did);return e.jsx(ut,{value:F,children:e.jsx(we,{blocklet:k,label:k.title||((d=k.meta)==null?void 0:d.title)})},F)})]})]})},customBodyRenderLite:v=>{var I,k;const b=p[v],w=A(b.componentDid);return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[w?e.jsx(Lt,{size:32,blocklet:w,ancestors:w.ancestors??[]}):e.jsx(js,{blocklet:i,size:32}),e.jsx(Re,{maxLength:50,children:((I=w==null?void 0:w.meta)==null?void 0:I.title)||((k=i==null?void 0:i.meta)==null?void 0:k.title)})]})}}},{label:t("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:v=>{const b=p[v],{receivers:w}=b;return e.jsx(Yt,{total:w.length,renderSurplus:I=>I<100?e.jsxs("span",{children:["+",I]}):e.jsx("span",{children:"99+"}),max:3,sx:{justifyContent:"flex-end",height:"32px",".MuiAvatar-root":{width:"32px",height:"32px",fontSize:"12px",border:0,zIndex:2}},onClick:I=>{I.stopPropagation(),B(b),M("receivers")},children:w.map(I=>{const{receiverUser:k}=I,F=Dt(k.avatar,D,S);return e.jsx(Tt,{alt:k.fullName,src:`${F}?imageFilter=resize&w=48&h=48`,size:32,did:I.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},I.receiver)})})}}},{label:t("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:v=>{const b=p[v];return e.jsx(T,{onClick:w=>{w.stopPropagation(),B(b),M("statistics")},children:e.jsx(_e,{statistics:b.statistics})})}}},{label:t("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:v=>{const b=p[v];return e.jsx(Re,{maxLength:50,children:b.title})}}},{label:t("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:v=>{const b=p[v];return e.jsx(Ne,{severity:b.severity})},filter:!0,filterType:"custom",filterList:N.severities??[],customFilterListOptions:{render:v=>e.jsx(ct,{list:v,label:t("notification.severity"),onDelete:(b,w)=>{b.stopPropagation(),m(b,w,le[4].options.filterList,"severities")}}),update:Ae},filterOptions:{names:mt,fullWidth:!0,logic:De,display:(v,b,w,I)=>e.jsx(dn,{label:t("notification.severity"),filterList:v,onChange:b,index:w,column:I,filterValues:mt})}}},{label:t("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:v=>{const{createdAt:b}=p[v];return e.jsx(At,{value:b,locale:s,shouldUpdate:!0})}}}],pe=v=>{E(b=>({...b,dateRange:v,page:1}))},be=[e.jsxs(T,{display:"flex",alignItems:"center",gap:1.5,children:[e.jsx(Jt,{onClick:()=>c(!0),sx:{p:J?0:void 0},children:e.jsx(ls,{})},"settings"),J?e.jsx(ae,{children:t("common.setting")}):null]}),...n||[]];return e.jsxs(T,{ref:Y,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(pn,{children:e.jsx(yt,{theme:o,children:e.jsx(Rt,{className:"main-table",verticalKeyWidth:100,loading:l,locale:s,columns:le,data:p,durable:g,onChange:$,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:h.page-1,rowsPerPage:h.pageSize,count:h.total,...j,onRowClick:(v,{dataIndex:b})=>{B(p[b])}},customPreButtons:[e.jsx(rt,{value:N.dateRange,onChange:pe})],customButtons:be,components:{TableFilterList:v=>e.jsx(ot,{...v,itemComponent:b=>e.jsx(Pe,{...b,canDelete:w=>{var k;const I=(k=w==null?void 0:w.columnNames)==null?void 0:k[(w==null?void 0:w.index)||0];return(I==null?void 0:I.name)==="sender"}})})}})})}),z&&e.jsx(on,{refresh:oe,onCancel:U,notification:z,blocklet:i,tab:_}),e.jsx(Nt,{title:`${t("common.notification")} ${t("common.setting")}`,fullWidth:!0,maxWidth:"md",open:ie,onClose:()=>c(!1),PaperProps:{style:{minHeight:"500px"}},children:e.jsx(T,{sx:{mt:"-16px",overflowY:"hidden"},children:e.jsx(Ds,{})})})]})}const pn=ue.div`
96
96
  td.MuiTableCell-footer {
97
97
  border: none !important;
98
98
  }
@@ -1,4 +1,4 @@
1
- import{j as t,ab as S,aa as c,H as d,ah as g}from"./vendor-mui-core-Bq8gXTan.js";import{r as y}from"./vendor-react-DEoibe3W.js";import{bb as v,F as w,B as m}from"./vendor-ux-did-connect-DVX9lQ8a.js";import{P}from"./page-header-C_KAJILy.js";import{G as T}from"./index-CMYalRl2.js";import{u as b}from"./config-space-C3fS58cn.js";import{C as B,D as E,a as D}from"./connect-to-Bwfa2hMr.js";import{S as u}from"./step-actions-_23FIn8v.js";import{S as G}from"./layout-CQb1lhEv.js";import"./vendor-utils-BotmZdBm.js";import"./vendor-hooks-BFlOfe0M.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-DiSm3oUX.js";import"./spaces-C1lh7et6.js";import"./api-87p2GGd0.js";import"./index-8eXqqyHQ.js";import"./DeleteOutline-CnS2XiM1.js";import"./use-mobile-CtTQsfXN.js";import"./content-layout-BC2QkTYi.js";function l({onNext:a,onPrevious:x}){var n,r,p;const{t:i}=y.useContext(v),{blocklet:e}=T(),{spaceGateway:f,settingStorageEndpoint:j,updateSpaceGateway:C,hasStorageEndpoint:h,loading:o,storageEndpoint:s}=b();return o?t.jsx(w,{relative:"parent",children:t.jsx(S,{})}):t.jsxs(N,{children:[t.jsx("div",{className:"header",children:t.jsx(P,{title:i("setup.didSpace.title"),subTitle:i("setup.didSpace.subTitle"),onClickBack:x})}),t.jsx(c,{sx:{width:"100%",maxWidth:"720px"},children:h?t.jsx(B,{spaceGateway:f,settingStorageEndpoint:j}):t.jsx(E,{})}),((n=e==null?void 0:e.capabilities)==null?void 0:n.didSpace)&&t.jsx(c,{display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"24px",children:t.jsx(D,{onConnect:C,storageEndpoint:s})}),((r=e==null?void 0:e.capabilities)==null?void 0:r.didSpace)==="required"&&t.jsx(u,{mt:8,children:t.jsx(m,{loading:o,variant:"contained",disabled:o||!s,onClick:()=>a(),children:i("setup.continue")})}),((p=e==null?void 0:e.capabilities)==null?void 0:p.didSpace)==="optional"&&t.jsx(u,{blocklet:e,onStartNow:()=>a("complete"),children:t.jsx(m,{className:"start-now",loading:o,variant:"contained",disabled:o,onClick:()=>a(),children:i(s?"setup.continue":"setup.skip")})})]})}l.propTypes={onNext:d.func,onPrevious:d.func};l.defaultProps={onNext:()=>{},onPrevious:()=>{}};const N=g(G)`
1
+ import{j as t,ab as S,aa as c,H as d,ah as g}from"./vendor-mui-core-Bq8gXTan.js";import{r as y}from"./vendor-react-DEoibe3W.js";import{bb as v,F as w,B as m}from"./vendor-ux-did-connect-BbCim3WZ.js";import{P}from"./page-header-CiTTXRdM.js";import{G as T}from"./index-BMCGWiyM.js";import{u as b}from"./config-space-DlQnLPiY.js";import{C as B,D as E,a as D}from"./connect-to-EzXJLWP1.js";import{S as u}from"./step-actions-njetG0Iy.js";import{S as G}from"./layout-Balq-c2F.js";import"./vendor-utils-BfZ4tlod.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-f1tICt1E.js";import"./spaces-BR4I2U0t.js";import"./api-C1S8LUld.js";import"./index-8eXqqyHQ.js";import"./DeleteOutline-CYuYysba.js";import"./use-mobile-DwzRjjku.js";import"./content-layout-BC2QkTYi.js";function l({onNext:a,onPrevious:x}){var n,r,p;const{t:i}=y.useContext(v),{blocklet:e}=T(),{spaceGateway:f,settingStorageEndpoint:j,updateSpaceGateway:C,hasStorageEndpoint:h,loading:o,storageEndpoint:s}=b();return o?t.jsx(w,{relative:"parent",children:t.jsx(S,{})}):t.jsxs(N,{children:[t.jsx("div",{className:"header",children:t.jsx(P,{title:i("setup.didSpace.title"),subTitle:i("setup.didSpace.subTitle"),onClickBack:x})}),t.jsx(c,{sx:{width:"100%",maxWidth:"720px"},children:h?t.jsx(B,{spaceGateway:f,settingStorageEndpoint:j}):t.jsx(E,{})}),((n=e==null?void 0:e.capabilities)==null?void 0:n.didSpace)&&t.jsx(c,{display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"24px",children:t.jsx(D,{onConnect:C,storageEndpoint:s})}),((r=e==null?void 0:e.capabilities)==null?void 0:r.didSpace)==="required"&&t.jsx(u,{mt:8,children:t.jsx(m,{loading:o,variant:"contained",disabled:o||!s,onClick:()=>a(),children:i("setup.continue")})}),((p=e==null?void 0:e.capabilities)==null?void 0:p.didSpace)==="optional"&&t.jsx(u,{blocklet:e,onStartNow:()=>a("complete"),children:t.jsx(m,{className:"start-now",loading:o,variant:"contained",disabled:o,onClick:()=>a(),children:i(s?"setup.continue":"setup.skip")})})]})}l.propTypes={onNext:d.func,onPrevious:d.func};l.defaultProps={onNext:()=>{},onPrevious:()=>{}};const N=g(G)`
2
2
  height: 100%;
3
3
  overflow-y: auto;
4
4
  `;export{l as default};