@abtnode/blocklet-services 1.16.43-beta-20250510-123357-65a2988c → 1.16.44-beta-20250512-155818-937e465d

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 (189) hide show
  1. package/api/emails/_components/activity.js +2 -1
  2. package/api/index.js +5 -1
  3. package/api/libs/email.js +1 -1
  4. package/dist/assets/{AdapterDayjs-BiPHzcUP.js → AdapterDayjs-BD9H1lZ-.js} +1 -1
  5. package/dist/assets/{ArrowDropDown-Dghek9CI.js → ArrowDropDown-BrO-zDlb.js} +1 -1
  6. package/dist/assets/{CheckCircle-Dvhgeo9j.js → CheckCircle-Ds4QI0ey.js} +1 -1
  7. package/dist/assets/{ChevronLeft-DE33N57i.js → ChevronLeft-CnQaQ-rc.js} +1 -1
  8. package/dist/assets/{ChevronRight-BfbPIE2b.js → ChevronRight-a_2_x6Ew.js} +1 -1
  9. package/dist/assets/{Community-2MKVAbIk.js → Community-DW6DJTIs.js} +1 -1
  10. package/dist/assets/{DeleteOutline-B6efX_Fy.js → DeleteOutline-CFN4r-OG.js} +1 -1
  11. package/dist/assets/{Done-Ct5slWpT.js → Done-DqSE6KPe.js} +1 -1
  12. package/dist/assets/{Download-DKQGRFHf.js → Download-C_LRKzbG.js} +1 -1
  13. package/dist/assets/{Edit-BLsIdIOp.js → Edit-CbR4eoK8.js} +1 -1
  14. package/dist/assets/{EditIcon-CwTCQzs9.js → EditIcon-DxUWMw59.js} +1 -1
  15. package/dist/assets/{Email-DOy8vL0N.js → Email-DWueGk7t.js} +1 -1
  16. package/dist/assets/{Error-wpqrAfUT.js → Error-jEHdDLNk.js} +1 -1
  17. package/dist/assets/{ExpandLess-CJXkgMMr.js → ExpandLess-CkoEHpgk.js} +1 -1
  18. package/dist/assets/{Google-BbAgcDQ_.js → Google-DHEolkW-.js} +1 -1
  19. package/dist/assets/{Holiday-DT-VjgQP.js → Holiday-Dwvo6QkZ.js} +1 -1
  20. package/dist/assets/{InfoOutlined-Dy7jTc7H.js → InfoOutlined-DkG0jjos.js} +1 -1
  21. package/dist/assets/{Launch-DBKe0gh0.js → Launch-B-2Jomi6.js} +1 -1
  22. package/dist/assets/{LaunchOutlined-BIq6YUU8.js → LaunchOutlined-CXNijfqX.js} +1 -1
  23. package/dist/assets/{Location-C__VfR4D.js → Location-DUEOr9J2.js} +1 -1
  24. package/dist/assets/{LockIcon-DIGiHKHl.js → LockIcon-Cjg8jV1E.js} +1 -1
  25. package/dist/assets/{Meeting-Cn2X2Ix7.js → Meeting-CJaI_cKm.js} +1 -1
  26. package/dist/assets/{MoreHoriz-BxJelL2A.js → MoreHoriz-B6KdR0Y8.js} +1 -1
  27. package/dist/assets/{OffSick-Cnicwu8x.js → OffSick-C9VqqjrN.js} +1 -1
  28. package/dist/assets/{Phone-CoX1qzAs.js → Phone-DcHUzCa-.js} +1 -1
  29. package/dist/assets/{PlayArrow-C9IFmc-j.js → PlayArrow-BToG9L6q.js} +1 -1
  30. package/dist/assets/{QuestionMarkCircle-DCM9zW3a.js → QuestionMarkCircle-BPVDAm8U.js} +1 -1
  31. package/dist/assets/{ServerLogo-CfbYjQbP.js → ServerLogo-s6cfhx92.js} +1 -1
  32. package/dist/assets/{Timezone-CCdgxxpv.js → Timezone-B-Ho_Uno.js} +1 -1
  33. package/dist/assets/{TuneOutlined-CB7t_nGq.js → TuneOutlined-BR2H7Mxj.js} +1 -1
  34. package/dist/assets/{ViewList-B4hmqizo.js → ViewList-D8vtMKQz.js} +1 -1
  35. package/dist/assets/{WorkingRemotely-DWT54kH1.js → WorkingRemotely-lJ6DUMCR.js} +1 -1
  36. package/dist/assets/{access-control-RJu7xYI3.js → access-control-CCSlKYYz.js} +1 -1
  37. package/dist/assets/{actions-BCWb2ez1.js → actions-BjTeIzgS.js} +1 -1
  38. package/dist/assets/{add-component-core-DRAzXCeg.js → add-component-core-C7-Epxoj.js} +15 -15
  39. package/dist/assets/{add-resource-BDJuVU8K.js → add-resource-CJHw7ea0.js} +1 -1
  40. package/dist/assets/{addon-ygDS7Fug.js → addon--u4EErgw.js} +1 -1
  41. package/dist/assets/{advanced-CFME3Vrl.js → advanced-tG5IRVhQ.js} +1 -1
  42. package/dist/assets/{appearance-BqJwEmtt.js → appearance-bRLsRDs2.js} +1 -1
  43. package/dist/assets/audit-logs-B3-Fo3nR.js +35 -0
  44. package/dist/assets/{authorize-WekjQ3_M.js → authorize-DNTNbUhI.js} +1 -1
  45. package/dist/assets/{base32-BbrXtXL6.js → base32-_zEVBJUg.js} +1 -1
  46. package/dist/assets/{branding-CS-f1gMT.js → branding-By8KDk5Q.js} +6 -6
  47. package/dist/assets/{branding-BTfb8_b4.js → branding-hDeNkLC2.js} +2 -2
  48. package/dist/assets/{bundle-avatar-Db5l8MQ4.js → bundle-avatar-DYTLzqlT.js} +1 -1
  49. package/dist/assets/button-D8hoY4xw.js +1 -0
  50. package/dist/assets/click-to-copy-CFiGx48J.js +1 -0
  51. package/dist/assets/{collapse-Bn_BDlF9.js → collapse-QV_2gdtM.js} +1 -1
  52. package/dist/assets/{complete-BRApuFsV.js → complete-6R-n_Ra9.js} +2 -2
  53. package/dist/assets/{component-C7g4FGFm.js → component-Blsql2u0.js} +2 -2
  54. package/dist/assets/{config-C8AXD1JH.js → config-D6r2ZAFY.js} +2 -2
  55. package/dist/assets/{config-qG8JCIJ_.js → config-LE_EJolF.js} +1 -1
  56. package/dist/assets/{config-navigation-B7r4dV5S.js → config-navigation-B0nu0al4.js} +4 -4
  57. package/dist/assets/{config-space-CSKkMgqX.js → config-space-d34Deg7R.js} +1 -1
  58. package/dist/assets/{confirm-BvUfAlkx.js → confirm-DjTZImyg.js} +1 -1
  59. package/dist/assets/{connect-B2HOOYzS.js → connect-Cu2Ssv5A.js} +1 -1
  60. package/dist/assets/connect-K4ZmMu4L.js +5 -0
  61. package/dist/assets/{connect-to-BBtnljQ-.js → connect-to-BG15Vnyg.js} +1 -1
  62. package/dist/assets/{content-layout-DzqMXifY.js → content-layout-BzF-fNQz.js} +1 -1
  63. package/dist/assets/dashboard-BIOpvfj3.js +239 -0
  64. package/dist/assets/{delete-confirm-BBaXcAXg.js → delete-confirm-BzuBR6TW.js} +1 -1
  65. package/dist/assets/{did-address-BKBBjFqv.js → did-address-DjwPl1uy.js} +1 -1
  66. package/dist/assets/{domain-action-card-D-WETV-f.js → domain-action-card-Bcs_GWxq.js} +1 -1
  67. package/dist/assets/domain-wh85yL2O.js +9 -0
  68. package/dist/assets/domains-bzKFbARj.js +1 -0
  69. package/dist/assets/dot-C4hULxc0.js +7 -0
  70. package/dist/assets/{email-Bc5KLu5Q.js → email-BZVu6WP-.js} +1 -1
  71. package/dist/assets/{empty-spinner-BZlBh4vA.js → empty-spinner-n0_Ehns5.js} +1 -1
  72. package/dist/assets/{exchange-passport-DbNEDTaa.js → exchange-passport-8jdiPDph.js} +1 -1
  73. package/dist/assets/{fuel-DzWcrU-I.js → fuel-Dx_cnsCl.js} +1 -1
  74. package/dist/assets/{gen-access-key-D-ftFU9F.js → gen-access-key-CqKmmKML.js} +1 -1
  75. package/dist/assets/get-safe-url-B5RJTMjC.js +1 -0
  76. package/dist/assets/get-safe-url-Bk6PlU7n.js +1 -0
  77. package/dist/assets/{home-DXj5oFeO.js → home-DzCwBE8F.js} +1 -1
  78. package/dist/assets/{iframe-CIVgAJuH.js → iframe-DW7zzzTG.js} +1 -1
  79. package/dist/assets/{index-BemEiFHE.js → index-8CHxrfFP.js} +1 -1
  80. package/dist/assets/{index-CKheO_aT.js → index-B8r-LrrM.js} +1 -1
  81. package/dist/assets/{index-BMPpz8ni.js → index-B9nvthxv.js} +1 -1
  82. package/dist/assets/{index-BMD-pSqT.js → index-BDYaw77z.js} +1 -1
  83. package/dist/assets/{index-Ce2NSVmU.js → index-BIPRCLBG.js} +1 -1
  84. package/dist/assets/{index-DjLLC6N3.js → index-BYCeMwoO.js} +1 -1
  85. package/dist/assets/{index-D09AfnR1.js → index-Bju4sfVL.js} +1 -1
  86. package/dist/assets/{index-BVU8_1Ed.js → index-Btl_rz0J.js} +3 -3
  87. package/dist/assets/index-C-A13dEh.js +141 -0
  88. package/dist/assets/{index-g0L_1foA.js → index-C5SsKJ2n.js} +11 -11
  89. package/dist/assets/{index-CHDiquXf.js → index-CPfvVvHv.js} +11 -11
  90. package/dist/assets/{index-CUfP1M2j.js → index-Cc-e6lxg.js} +1 -1
  91. package/dist/assets/{index-wXCx8TFU.js → index-DcUhenm6.js} +1 -1
  92. package/dist/assets/{index-u-w3iMC9.js → index-DefO2n6z.js} +4 -4
  93. package/dist/assets/{index--HbH1n1_.js → index-DjEDWgGs.js} +1 -1
  94. package/dist/assets/{index-DF3gHUuW.js → index-Du38Vjy4.js} +4 -4
  95. package/dist/assets/{index-D64RNKdt.js → index-Dyl-XQ73.js} +6 -6
  96. package/dist/assets/{index-BmWVfEGP.js → index-HU4yqI-9.js} +1 -1
  97. package/dist/assets/index-Jnk92KZC.js +284 -0
  98. package/dist/assets/{index-Bxd86KLJ.js → index-SzdSxpkq.js} +4 -4
  99. package/dist/assets/index-USO5zFMh.js +55 -0
  100. package/dist/assets/{index-C0SLCehH.js → index-enM9Y412.js} +1 -1
  101. package/dist/assets/index-ioZVVJtg.js +113 -0
  102. package/dist/assets/{invitation-CKfllvl5.js → invitation-1bsb30Yz.js} +1 -1
  103. package/dist/assets/{invite-CCCSmPiy.js → invite-CALl83Zc.js} +1 -1
  104. package/dist/assets/{issue-passport-C3zUptls.js → issue-passport-BcStTsbv.js} +1 -1
  105. package/dist/assets/{item-CkcpHBHM.js → item-Bk_1JLeG.js} +1 -1
  106. package/dist/assets/{landing-page-q-KgqE9Q.js → landing-page-Due4o1uF.js} +1 -1
  107. package/dist/assets/{launch-result-message-BaU6oEsi.js → launch-result-message-DIYoykBK.js} +1 -1
  108. package/dist/assets/{layout-CyCulQBn.js → layout-D93HKT6w.js} +1 -1
  109. package/dist/assets/list-D96_O-GY.js +2 -0
  110. package/dist/assets/{list-header-CU9W30JD.js → list-header-HqBQs1yn.js} +1 -1
  111. package/dist/assets/list-rt6nku1-.js +236 -0
  112. package/dist/assets/localization-BUDtnbyU.js +1 -0
  113. package/dist/assets/{log-DNpJdgp3.js → log--AX8zo75.js} +1 -1
  114. package/dist/assets/{logger-CQ50TnpL.js → logger-BLZgTs_U.js} +1 -1
  115. package/dist/assets/{login-BKaJnfFX.js → login-WRcteY7r.js} +1 -1
  116. package/dist/assets/{login-oauth-callback-LJsgXC8E.js → login-oauth-callback-DZaPZfnA.js} +1 -1
  117. package/dist/assets/{logo-uploader-BYnd80uu.js → logo-uploader-CQCy6MG3.js} +3 -3
  118. package/dist/assets/{lost-passport-Bk0k4I4s.js → lost-passport-kJX7pEJj.js} +1 -1
  119. package/dist/assets/{open-window-DV0D-Mov.js → open-window--2G6Qjbq.js} +1 -1
  120. package/dist/assets/overview-CpKMiGEK.js +85 -0
  121. package/dist/assets/{page-header-CpNMTtn_.js → page-header-xyZktwBS.js} +1 -1
  122. package/dist/assets/{passport-item-BxfGrDcE.js → passport-item-CIvCqz_R.js} +1 -1
  123. package/dist/assets/{permission-BkNXA8B5.js → permission-BH1TY_tz.js} +1 -1
  124. package/dist/assets/{preferences-_jTjKHvU.js → preferences-CfmnTXfl.js} +1 -1
  125. package/dist/assets/{profile-embed-8w4_vg5a.js → profile-embed-ZtzRYgXv.js} +1 -1
  126. package/dist/assets/publish-resource-CCa5xfwz.js +1 -0
  127. package/dist/assets/{react-beautiful-dnd.esm-Cq_dOQ2z.js → react-beautiful-dnd.esm-7PS2VwOi.js} +1 -1
  128. package/dist/assets/runtime-eXYlg9Cz.js +1 -0
  129. package/dist/assets/sdk-9eXJSWHG.js +1 -0
  130. package/dist/assets/section-Cv4udilp.js +41 -0
  131. package/dist/assets/{security-BQbSLSOe.js → security-DM8MeY05.js} +3 -3
  132. package/dist/assets/{session-6XaVDQaE.js → session-CHdTc1We.js} +1 -1
  133. package/dist/assets/setup-BEsU41BB.js +30 -0
  134. package/dist/assets/{shorten-label-Dq7bVuNa.js → shorten-label-Cng55547.js} +1 -1
  135. package/dist/assets/{simple-select-C-wGUGQR.js → simple-select-CP_Svi_D.js} +1 -1
  136. package/dist/assets/{slicedToArray-vWe02CJE.js → slicedToArray-C7EPqaHf.js} +1 -1
  137. package/dist/assets/{spaces-Cp7TgoZP.js → spaces-BVG-t3ND.js} +1 -1
  138. package/dist/assets/{start-CHmWCQE9.js → start-CIjuDAiX.js} +1 -1
  139. package/dist/assets/{starting-progress-CdpkXOrK.js → starting-progress-CiLZpNpg.js} +1 -1
  140. package/dist/assets/{status-46dMQnxA.js → status-CUMJd-nJ.js} +1 -1
  141. package/dist/assets/{step-actions-Bu3Q5M4V.js → step-actions-CeJCmiCS.js} +1 -1
  142. package/dist/assets/{studio-BbeHx14I.js → studio-DikseKRr.js} +1 -1
  143. package/dist/assets/{switch-control-D6CqAlDY.js → switch-control-C5i52ixk.js} +1 -1
  144. package/dist/assets/{traffic-CY9Vj6w7.js → traffic-B5x_6GvF.js} +2 -2
  145. package/dist/assets/{transfer-CSeo2FaW.js → transfer-CTEHVklh.js} +1 -1
  146. package/dist/assets/{unsubscribe-BLaMmgbM.js → unsubscribe-Bi2IV-2n.js} +1 -1
  147. package/dist/assets/{use-blocklet-logo-sEJnYyNL.js → use-blocklet-logo-BEy8Tnso.js} +2 -2
  148. package/dist/assets/{use-mobile-BAjFH6d8.js → use-mobile-Boa_xu9A.js} +1 -1
  149. package/dist/assets/{use-mobile-Bh8CHBbH.js → use-mobile-DyX6Fl8Z.js} +1 -1
  150. package/dist/assets/useAsync-C8ydfEEr.js +1 -0
  151. package/dist/assets/useAsync-CMWsznMW.js +1 -0
  152. package/dist/assets/{useLocalStorage-C6U1Aqya.js → useLocalStorage-DVnkpneF.js} +1 -1
  153. package/dist/assets/user-center-DcXdjtRX.js +76 -0
  154. package/dist/assets/{util-Bg0WSJ-t.js → util-CEAObyfj.js} +1 -1
  155. package/dist/assets/{util-RWes6RwK.js → util-MKllNgBs.js} +1 -1
  156. package/dist/assets/{vendor-arcblock-CN2B_oTr.js → vendor-arcblock-uz9DVywv.js} +45 -45
  157. package/dist/assets/{vendor-mui-core-UZpb7wT7.js → vendor-mui-core-D_bnq77o.js} +1 -1
  158. package/dist/assets/{vendor-mui-x-whuSO90H.js → vendor-mui-x-R-0SFz4c.js} +1 -1
  159. package/dist/assets/{vendor-ux-did-connect-TEE6cGq6.js → vendor-ux-did-connect-DHrruicZ.js} +136 -136
  160. package/dist/assets/{wrap-locale-DZ79GW_G.js → wrap-locale-B9TkXFQe.js} +1 -1
  161. package/dist/index.html +4 -4
  162. package/dist/service-worker.js +1 -1
  163. package/dist/share/shared-bridge.html +4 -4
  164. package/package.json +32 -32
  165. package/dist/assets/audit-logs-CtFZQHby.js +0 -35
  166. package/dist/assets/button-DotKXyjc.js +0 -1
  167. package/dist/assets/click-to-copy-BxhgzyYL.js +0 -1
  168. package/dist/assets/connect-DGPdKMcu.js +0 -5
  169. package/dist/assets/dashboard-C124DXmc.js +0 -279
  170. package/dist/assets/domain-DTrwCkop.js +0 -9
  171. package/dist/assets/domains-BxkmGeZE.js +0 -1
  172. package/dist/assets/dot-C05enzim.js +0 -7
  173. package/dist/assets/get-safe-url-2RcRY8gU.js +0 -1
  174. package/dist/assets/get-safe-url-CEvgWyL5.js +0 -1
  175. package/dist/assets/index-9ixwCOkw.js +0 -113
  176. package/dist/assets/index-B_fwtN9z.js +0 -55
  177. package/dist/assets/index-CyUXddLG.js +0 -284
  178. package/dist/assets/index-DsT9i24r.js +0 -141
  179. package/dist/assets/list-D1dIr8Je.js +0 -2
  180. package/dist/assets/list-TP-VNuzL.js +0 -236
  181. package/dist/assets/localization-BXLZxF1J.js +0 -1
  182. package/dist/assets/overview-UIMGVO1S.js +0 -85
  183. package/dist/assets/publish-resource-CcM3RwPR.js +0 -1
  184. package/dist/assets/relative-time-Cl7lOTkO.js +0 -1
  185. package/dist/assets/runtime-BVDdcpyT.js +0 -1
  186. package/dist/assets/sdk-7yPC_DtN.js +0 -1
  187. package/dist/assets/setup-CifjXQIf.js +0 -30
  188. package/dist/assets/useAsync-DV3NyLhI.js +0 -1
  189. package/dist/assets/user-center-BHyd-rRF.js +0 -76
@@ -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,bc as g,T as S,O as U,bv as q,bt as W,bw as H,cI as L,y as O,ah as I,ai as N,cn as J,dA as X,dB as K,I as Y,dC as Q,e as Z,c4 as ee}from"./vendor-mui-core-UZpb7wT7.js";import{r as b}from"./vendor-react-DEoibe3W.js";import{H as te,a as B,e as re,i as ie,b as oe}from"./vendor-hooks-rDgu5KV9.js";import{T as ae,bu as se}from"./vendor-ux-did-connect-TEE6cGq6.js";import{_}from"./vendor-arcblock-CN2B_oTr.js";import{aP as ne}from"./vendor-utils-rHXShPKm.js";import{getAIKitComponent as le}from"./index-BVU8_1Ed.js";import"./lottie-web-jYmAQWuC.js";import"./index-Bs1kxR8_.js";import"./index-u-w3iMC9.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})),p=b.useMemo(()=>({...l,onLoading:x,restrictions:c,i18n:s}),[l]);return e.jsx(ae,{theme:o,children:e.jsx(F.Provider,{value:p,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 me({onSubmit:t}){const{loading:c,i18n:s}=D(),o=B({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},p=o.model==="dall-e-2"?xe:ce;return e.jsxs(pe,{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(S,{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(S,{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(S,{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(L,{size:"small",min:0,max:p.length-1,step:1,value:p.findIndex(a=>a==o.size),onChange:(a,j)=>{o.size=p[j]}})})})})]}),o.model==="dall-e-2"&&e.jsxs(g,{item:!0,xs:12,children:[e.jsx(S,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageNumber")}: ${o.number}`}),e.jsx(n,{...x,children:e.jsx(L,{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 pe=I(n)`
2
+ import{j as e,aa as n,bc as g,T as S,O as U,bv as q,bt as W,bw as H,cI as L,y as O,ah as I,ai as N,cn as J,dA as X,dB as K,I as Y,dC as Q,e as Z,c1 as ee}from"./vendor-mui-core-D_bnq77o.js";import{r as b}from"./vendor-react-DEoibe3W.js";import{H as te,a as B,e as re,i as ie,b as oe}from"./vendor-hooks-rDgu5KV9.js";import{T as ae,bt as se}from"./vendor-ux-did-connect-DHrruicZ.js";import{_}from"./vendor-arcblock-uz9DVywv.js";import{aP as ne}from"./vendor-utils-rHXShPKm.js";import{getAIKitComponent as le}from"./index-Btl_rz0J.js";import"./lottie-web-jYmAQWuC.js";import"./index-Bs1kxR8_.js";import"./index-DefO2n6z.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})),u=b.useMemo(()=>({...l,onLoading:x,restrictions:c,i18n:s}),[l]);return e.jsx(ae,{theme:o,children:e.jsx(F.Provider,{value:u,children:t})})}const ce=["1024x1024","1024x1792","1792x1024"],xe=["256x256","512x512","1024x1024"],me=[{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=B({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},u=o.model==="dall-e-2"?xe:ce;return e.jsxs(ue,{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(S,{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(S,{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:me.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(S,{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(L,{size:"small",min:0,max:u.length-1,step:1,value:u.findIndex(a=>a==o.size),onChange:(a,j)=>{o.size=u[j]}})})})})]}),o.model==="dall-e-2"&&e.jsxs(g,{item:!0,xs:12,children:[e.jsx(S,{gutterBottom:!0,className:"title label",color:"text.primary",children:`${s("aiImageNumber")}: ${o.number}`}),e.jsx(n,{...x,children:e.jsx(L,{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 ue=I(n)`
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  height: 100%;
@@ -55,7 +55,7 @@ import{j as e,aa as n,bc as g,T as S,O as U,bv as q,bt as W,bw as H,cI as L,y as
55
55
  &:hover fieldset {
56
56
  }
57
57
  }
58
- `,he=({onDelete:t,selected:c,onLoad:s,src:o,alt:l,...f})=>{const x=B({loading:!0});return e.jsxs("div",{style:{position:"relative"},children:[e.jsx(n,{className:"lazy-image-wrapper",sx:{visibility:x.loading?"hidden":"visible",bgcolor:"background.paper",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("img",{alt:l,src:o,...f,onLoad:()=>{x.loading=!1;try{s==null||s()}catch(p){console.error("image onLoad error: ",p)}},loading:"eager"})}),x.loading&&e.jsx(N,{className:"lazy-image-skeleton",animation:"wave",variant:"rectangular",style:{position:"absolute",top:0}}),e.jsx(ge,{onClick:()=>t(o),sx:{position:"absolute",left:10,bottom:10},children:e.jsx(J,{sx:{fontSize:20}})}),l&&e.jsxs(fe,{unstyled:!0,tip:l,sx:{position:"absolute",right:10,bottom:10,fontSize:14,width:"calc(100% - 20px - 10px - 36px)",display:"flex",alignItems:"center"},arrow:!0,tipPlacement:"top",PopperProps:{disablePortal:!0},children:[e.jsx(X,{sx:{fontSize:20,mr:.5}}),e.jsx(S,{sx:{fontSize:14,overflowX:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l})]}),e.jsx(n,{sx:{position:"absolute",right:8,top:8},onClick:f==null?void 0:f.onClick,children:c?e.jsx(be,{sx:{fontSize:30}}):e.jsx(K,{sx:{fontSize:30,color:"#fff"}})})]})},fe=I(se)`
58
+ `,he=({onDelete:t,selected:c,onLoad:s,src:o,alt:l,...f})=>{const x=B({loading:!0});return e.jsxs("div",{style:{position:"relative"},children:[e.jsx(n,{className:"lazy-image-wrapper",sx:{visibility:x.loading?"hidden":"visible",bgcolor:"background.paper",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("img",{alt:l,src:o,...f,onLoad:()=>{x.loading=!1;try{s==null||s()}catch(u){console.error("image onLoad error: ",u)}},loading:"eager"})}),x.loading&&e.jsx(N,{className:"lazy-image-skeleton",animation:"wave",variant:"rectangular",style:{position:"absolute",top:0}}),e.jsx(ge,{onClick:()=>t(o),sx:{position:"absolute",left:10,bottom:10},children:e.jsx(J,{sx:{fontSize:20}})}),l&&e.jsxs(fe,{unstyled:!0,tip:l,sx:{position:"absolute",right:10,bottom:10,fontSize:14,width:"calc(100% - 20px - 10px - 36px)",display:"flex",alignItems:"center"},arrow:!0,tipPlacement:"top",PopperProps:{disablePortal:!0},children:[e.jsx(X,{sx:{fontSize:20,mr:.5}}),e.jsx(S,{sx:{fontSize:14,overflowX:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l})]}),e.jsx(n,{sx:{position:"absolute",right:8,top:8},onClick:f==null?void 0:f.onClick,children:c?e.jsx(be,{sx:{fontSize:30}}):e.jsx(K,{sx:{fontSize:30,color:"#fff"}})})]})},fe=I(se)`
59
59
  height: 36px;
60
60
  padding: 8px;
61
61
  background: rgba(0, 0, 0, 0.42);
@@ -93,7 +93,7 @@ import{j as e,aa as n,bc as g,T as S,O as U,bv as q,bt as W,bw as H,cI as L,y as
93
93
  & path:last-child {
94
94
  fill: white;
95
95
  }
96
- `,je=b.lazy(()=>_(()=>import("./lottie-react.esm-D2t-u0YU.js"),__vite__mapDeps([0,1])).then(t=>({default:t.Player})));function T({src:t}){return e.jsx(je,{src:t,loop:!0,autoplay:!0})}function ye({options:t,handleApi:c,onSelect:s,onFinish:o,onClose:l,isMobile:f}){const{loading:x,onLoading:p,restrictions:a,i18n:j}=D(),[d,y]=b.useState([]),[u,k]=b.useState(),P=Z(),z=a==null?void 0:a.maxNumberOfFiles,[m,A]=b.useState({}),h=B({}),R=Object.keys(h).filter(r=>h[r]),E={xs:6,sm:6};b.useEffect(()=>{u&&!m.error&&_(()=>import("./lottie-error-CMOXHtBH.js"),[]).then(r=>{A(i=>({...i,error:r.default}))}),t&&!d.length&&!m.loading&&_(()=>import("./lottie-loading-o-GBrhM9.js"),[]).then(r=>{A(i=>({...i,loading:r.default}))}),!t&&!m.welcome&&_(()=>import("./lottie-welcome-C9B95FIi.js"),[]).then(r=>{A(i=>({...i,welcome:r.default}))})},[u,t,d.length,m]),ie(async()=>{var r;if(t){k(void 0),p(!0);try{const i=await c({...t,responseFormat:"b64_json"});if(i.data){const w=(i.data||[]).map(C=>({src:`data:image/png;base64,${C.b64Json||C.b64_json}`,width:t.size?Number((t.size||"").split("x")[0]):1024,alt:t.prompt}));y(d?[...w,...d]:w)}else k(i)}catch(i){console.error("AIImage generate error: ",i),k(((r=i==null?void 0:i.response)==null?void 0:r.data)||i)}finally{p(!1),o()}}},[t==null?void 0:t.number,t==null?void 0:t.prompt,t==null?void 0:t.size]);const $=r=>{const i=Object.keys(h).filter(w=>h[w]);if(z?i.length<z:!0)h[r]?h[r]=!1:h[r]=!0;else{const w=i.pop();w!==r&&(h[w]=!1),h[r]=!h[r]}},M=r=>{if(d){const i=d.findIndex(v=>v.src===r);i>-1&&(h[r]=!1,d.splice(i,1),y([...d]))}},V=()=>{var i,v;const r={width:((i=document.querySelector(".photo-item img"))==null?void 0:i.offsetWidth)||0,height:((v=document.querySelector(".photo-item img"))==null?void 0:v.offsetHeight)||0};return e.jsx(e.Fragment,{children:Array.from({length:(t==null?void 0:t.number)||1}).map((w,C)=>b.createElement(g,{item:!0,...E,key:C},e.jsx(N,{className:"lazy-image-skeleton",animation:"wave",variant:"rectangular",style:{borderRadius:"12px",...r}})))})},G=()=>u?e.jsxs(n,{width:300,height:300,m:"auto",children:[m.error&&e.jsx(T,{src:m.error},"error"),e.jsx(n,{sx:{textAlign:"center",color:"#25292F",wordBreak:"break-all"},children:u==null?void 0:u.message})]}):d&&Array.isArray(d)&&d.length>0?e.jsxs(e.Fragment,{children:[e.jsx(n,{flexGrow:1,sx:{height:0,overflowX:"hidden",overflowY:"auto"},children:e.jsx(ve,{sx:f?{p:0,border:"none !important"}:{p:2},children:e.jsxs(g,{spacing:2,container:!0,className:"photo-wrapper",children:[x&&e.jsx(V,{}),d.map((r,i)=>b.createElement(g,{item:!0,...E,key:r.src,className:"photo-item"},e.jsx(he,{...r,selected:h[r.src],style:{objectFit:"cover",cursor:"pointer",transition:"all 0.3s",border:h[r.src]?`2px solid ${P.palette.primary.main}`:"2px solid transparent",WebkitUserDrag:"none",width:"100%",height:"100%"},onClick:()=>{$(r.src)},onDelete:()=>{M(r.src)}})))]})})}),e.jsxs(n,{sx:{mt:2,display:"flex",justifyContent:l?"space-between":"flex-end",button:{borderRadius:"30px",height:40,textTransform:"none"}},children:[l&&typeof l=="function"&&e.jsx(O,{color:"primary",variant:"outlined",onClick:l,children:e.jsx(ee,{})}),e.jsx(O,{color:"primary",variant:"contained",disabled:!R.length||x,onClick:()=>{const r=ne(d,"src");s(R.map(i=>r[i]))},children:R.length?j("aiImageSelectedUse"):j("aiImageSelectedTip")})]})]}):t?e.jsx(n,{width:220,height:220,m:"auto",children:m.loading&&e.jsx(T,{src:m.loading},"loading")}):e.jsx(n,{width:300,height:300,m:"auto",children:m.welcome&&e.jsx(T,{src:m.welcome},"welcome")});return e.jsx(we,{children:G()})}const we=I(n)`
96
+ `,je=b.lazy(()=>_(()=>import("./lottie-react.esm-D2t-u0YU.js"),__vite__mapDeps([0,1])).then(t=>({default:t.Player})));function T({src:t}){return e.jsx(je,{src:t,loop:!0,autoplay:!0})}function ye({options:t,handleApi:c,onSelect:s,onFinish:o,onClose:l,isMobile:f}){const{loading:x,onLoading:u,restrictions:a,i18n:j}=D(),[d,y]=b.useState([]),[m,k]=b.useState(),P=Z(),z=a==null?void 0:a.maxNumberOfFiles,[p,A]=b.useState({}),h=B({}),R=Object.keys(h).filter(r=>h[r]),E={xs:6,sm:6};b.useEffect(()=>{m&&!p.error&&_(()=>import("./lottie-error-CMOXHtBH.js"),[]).then(r=>{A(i=>({...i,error:r.default}))}),t&&!d.length&&!p.loading&&_(()=>import("./lottie-loading-o-GBrhM9.js"),[]).then(r=>{A(i=>({...i,loading:r.default}))}),!t&&!p.welcome&&_(()=>import("./lottie-welcome-C9B95FIi.js"),[]).then(r=>{A(i=>({...i,welcome:r.default}))})},[m,t,d.length,p]),ie(async()=>{var r;if(t){k(void 0),u(!0);try{const i=await c({...t,responseFormat:"b64_json"});if(i.data){const w=(i.data||[]).map(C=>({src:`data:image/png;base64,${C.b64Json||C.b64_json}`,width:t.size?Number((t.size||"").split("x")[0]):1024,alt:t.prompt}));y(d?[...w,...d]:w)}else k(i)}catch(i){console.error("AIImage generate error: ",i),k(((r=i==null?void 0:i.response)==null?void 0:r.data)||i)}finally{u(!1),o()}}},[t==null?void 0:t.number,t==null?void 0:t.prompt,t==null?void 0:t.size]);const $=r=>{const i=Object.keys(h).filter(w=>h[w]);if(z?i.length<z:!0)h[r]?h[r]=!1:h[r]=!0;else{const w=i.pop();w!==r&&(h[w]=!1),h[r]=!h[r]}},M=r=>{if(d){const i=d.findIndex(v=>v.src===r);i>-1&&(h[r]=!1,d.splice(i,1),y([...d]))}},V=()=>{var i,v;const r={width:((i=document.querySelector(".photo-item img"))==null?void 0:i.offsetWidth)||0,height:((v=document.querySelector(".photo-item img"))==null?void 0:v.offsetHeight)||0};return e.jsx(e.Fragment,{children:Array.from({length:(t==null?void 0:t.number)||1}).map((w,C)=>b.createElement(g,{item:!0,...E,key:C},e.jsx(N,{className:"lazy-image-skeleton",animation:"wave",variant:"rectangular",style:{borderRadius:"12px",...r}})))})},G=()=>m?e.jsxs(n,{width:300,height:300,m:"auto",children:[p.error&&e.jsx(T,{src:p.error},"error"),e.jsx(n,{sx:{textAlign:"center",color:"#25292F",wordBreak:"break-all"},children:m==null?void 0:m.message})]}):d&&Array.isArray(d)&&d.length>0?e.jsxs(e.Fragment,{children:[e.jsx(n,{flexGrow:1,sx:{height:0,overflowX:"hidden",overflowY:"auto"},children:e.jsx(ve,{sx:f?{p:0,border:"none !important"}:{p:2},children:e.jsxs(g,{spacing:2,container:!0,className:"photo-wrapper",children:[x&&e.jsx(V,{}),d.map((r,i)=>b.createElement(g,{item:!0,...E,key:r.src,className:"photo-item"},e.jsx(he,{...r,selected:h[r.src],style:{objectFit:"cover",cursor:"pointer",transition:"all 0.3s",border:h[r.src]?`2px solid ${P.palette.primary.main}`:"2px solid transparent",WebkitUserDrag:"none",width:"100%",height:"100%"},onClick:()=>{$(r.src)},onDelete:()=>{M(r.src)}})))]})})}),e.jsxs(n,{sx:{mt:2,display:"flex",justifyContent:l?"space-between":"flex-end",button:{borderRadius:"30px",height:40,textTransform:"none"}},children:[l&&typeof l=="function"&&e.jsx(O,{color:"primary",variant:"outlined",onClick:l,children:e.jsx(ee,{})}),e.jsx(O,{color:"primary",variant:"contained",disabled:!R.length||x,onClick:()=>{const r=ne(d,"src");s(R.map(i=>r[i]))},children:R.length?j("aiImageSelectedUse"):j("aiImageSelectedTip")})]})]}):t?e.jsx(n,{width:220,height:220,m:"auto",children:p.loading&&e.jsx(T,{src:p.loading},"loading")}):e.jsx(n,{width:300,height:300,m:"auto",children:p.welcome&&e.jsx(T,{src:p.welcome},"welcome")});return e.jsx(we,{children:G()})}const we=I(n)`
97
97
  min-height: 100%;
98
98
  display: flex;
99
99
  flex-direction: column;
@@ -158,4 +158,4 @@ import{j as e,aa as n,bc as g,T as S,O as U,bv as q,bt as W,bw as H,cI as L,y as
158
158
  color: #9397a1;
159
159
  }
160
160
  }
161
- `;function Be({onSelect:t,api:c,restrictions:s,i18n:o,theme:l}){const[f,x]=b.useState(),[p,a]=b.useState(!1),j=()=>x(void 0),d=()=>a(!1),y=oe(document.body);let u=!!(y&&y.width<768);if(!le())return e.jsx(n,{width:1,height:1,display:"flex",justifyContent:"center",alignItems:"center",children:o("aiKitRequired")});const k=!u||u&&!p,P=!u||u&&p,z=u?d:!1;return e.jsx(de,{restrictions:s,i18n:o,theme:l,children:e.jsx(n,{sx:{display:"flex",width:"100%",height:"100%",bgcolor:"background.default"},children:e.jsxs(g,{container:!0,sx:{flexGrow:1,height:"100%"},children:[e.jsx(g,{item:!0,xs:12,sm:4,sx:{borderRight:u?"none":m=>`1px solid ${m.palette.divider}`,display:k?"unset":"none"},children:e.jsx(n,{sx:{height:"100%",display:"flex",flexDirection:"column"},children:e.jsx(me,{onSubmit:(...m)=>{a(!0),x(...m)}})})}),e.jsx(g,{item:!0,xs:12,sm:8,sx:{height:"100%",overflow:"hidden",p:2,display:P?"unset":"none"},children:e.jsx(ye,{isMobile:u,options:f,handleApi:c,onSelect:t,onFinish:j,onClose:z})})]})})})}export{Be as default};
161
+ `;function Be({onSelect:t,api:c,restrictions:s,i18n:o,theme:l}){const[f,x]=b.useState(),[u,a]=b.useState(!1),j=()=>x(void 0),d=()=>a(!1),y=oe(document.body);let m=!!(y&&y.width<768);if(!le())return e.jsx(n,{width:1,height:1,display:"flex",justifyContent:"center",alignItems:"center",children:o("aiKitRequired")});const k=!m||m&&!u,P=!m||m&&u,z=m?d:!1;return e.jsx(de,{restrictions:s,i18n:o,theme:l,children:e.jsx(n,{sx:{display:"flex",width:"100%",height:"100%",bgcolor:"background.default"},children:e.jsxs(g,{container:!0,sx:{flexGrow:1,height:"100%"},children:[e.jsx(g,{item:!0,xs:12,sm:4,sx:{borderRight:m?"none":p=>`1px solid ${p.palette.divider}`,display:k?"unset":"none"},children:e.jsx(n,{sx:{height:"100%",display:"flex",flexDirection:"column"},children:e.jsx(pe,{onSubmit:(...p)=>{a(!0),x(...p)}})})}),e.jsx(g,{item:!0,xs:12,sm:8,sx:{height:"100%",overflow:"hidden",p:2,display:P?"unset":"none"},children:e.jsx(ye,{isMobile:m,options:f,handleApi:c,onSelect:t,onFinish:j,onClose:z})})]})})})}export{Be as default};
@@ -0,0 +1,55 @@
1
+ import{u as ne,_ as U,c0 as ze,c1 as Ee,I as K,b_ as Ue,b$ as We,ad as Me,ac as _e,c2 as Ve,b4 as Ie,j as pe,r as $e,b2 as X,c3 as he,am as ge,B as z,bN as Ne,a6 as Je,c4 as He,a7 as Ke,a3 as Ge,a0 as Ze,as as De}from"./vendor-ux-did-connect-DHrruicZ.js";import{u as p,a as se,f as te,c as Ye}from"./vendor-hooks-rDgu5KV9.js";import{r as R}from"./vendor-react-DEoibe3W.js";import{j as e,aa as m,bt as W,bp as E,O,y as V,H as N,T as xe,I as oe,X as re,ah as Pe,al as H,cI as Xe,a9 as Qe,e as je,ab as fe,a6 as Re,ad as et}from"./vendor-mui-core-D_bnq77o.js";import{a7 as tt,M as Ce,T as nt,c as st}from"./vendor-arcblock-uz9DVywv.js";import{J as Y,a8 as at,c as qe,D as ot,n as Z,aJ as rt,A as it,b as lt}from"./vendor-utils-rHXShPKm.js";import{z as J,C as $,au as ae,av as I,aD as Fe}from"./index-DefO2n6z.js";import{S as ie}from"./switch-control-C5i52ixk.js";import{S as D}from"./section-Cv4udilp.js";import{K as ct}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as dt}from"./index-enM9Y412.js";import{b as ut}from"./base32-_zEVBJUg.js";import{u as mt}from"./use-mobile-Boa_xu9A.js";import"./lottie-web-jYmAQWuC.js";const le={enabled:!1,domain:"",clientId:"",clientSecret:""};function pt(){var b,y,i;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(b=r==null?void 0:r.meta)==null?void 0:b.did,w=Object.assign({...le},((i=(y=r==null?void 0:r.settings)==null?void 0:y.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=ae({defaultValues:Y(w,Object.keys(le))}),d=h("enabled"),k=p(async o=>{var T,a;try{const{blocklet:j}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:o})}}),u=Object.assign({...le},((a=(T=j==null?void 0:j.settings)==null?void 0:T.oauth)==null?void 0:a.auth0)||{});l(u),U.success(n("oauth.saveSuccess"))}catch(j){U.error(j.message||n("oauth.saveFailed"))}}),L=p(o=>o!=null&&o.trim()?!0:n("oauth.auth0.domainDescription")),x=p(o=>o!=null&&o.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(o=>o!=null&&o.trim()?!0:n("oauth.auth0.clientSecretDescription")),v=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:o})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:o.value,...o})})})}),e.jsx(D,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?L:v},render:({field:o})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[o.name],helperText:((T=c.errors[o.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:v},render:({field:o})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[o.name],helperText:((T=c.errors[o.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:v},render:({field:o})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[o.name],helperText:((T=c.errors[o.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ce={enabled:!1,clientId:"",clientSecret:""};function ht(){var v,b,y;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...ce},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=ae({defaultValues:Y(w,Object.keys(ce))}),d=h("enabled"),k=p(async i=>{var o,T;try{const{blocklet:a}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),j=Object.assign({...ce},((T=(o=a==null?void 0:a.settings)==null?void 0:o.oauth)==null?void 0:T.github)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var o;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((o=c.errors[i.name])==null?void 0:o.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var o;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((o=c.errors[i.name])==null?void 0:o.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const de={enabled:!1,clientId:"",clientSecret:""};function xt(){var v,b,y;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...de},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=ae({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async i=>{var o,T;try{const{blocklet:a}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),j=Object.assign({...de},((T=(o=a==null?void 0:a.settings)==null?void 0:o.oauth)==null?void 0:T.google)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var o;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((o=c.errors[i.name])==null?void 0:o.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var o;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((o=c.errors[i.name])==null?void 0:o.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ft(){var i,o,T;const{api:S}=J(),{blocklet:r}=$(),{t:n}=ne(),s=(i=r==null?void 0:r.meta)==null?void 0:i.did,w=Object.assign({...ue},((T=(o=r==null?void 0:r.settings)==null?void 0:o.oauth)==null?void 0:T.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=ae({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async a=>{var j,u;try{const{blocklet:P}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),A=Object.assign({...ue},((u=(j=P==null?void 0:P.settings)==null?void 0:j.oauth)==null?void 0:u.apple)||{});l(A),U.success(n("oauth.saveSuccess"))}catch(P){U.error(P.message||n("oauth.saveFailed"))}}),L=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),b=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.bundleIdDescription")),y=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(D,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?L:y},render:({field:a})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:f,rules:{validate:d?b:y},render:({field:a})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:f,rules:{validate:d?x:y},render:({field:a})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.keyId"),children:e.jsx(I,{name:"keyId",control:f,rules:{validate:d?g:y},render:({field:a})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((j=c.errors[a.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.authKey"),children:e.jsx(I,{name:"authKey",control:f,rules:{validate:d?v:y},render:({field:a})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((j=c.errors[a.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const gt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function be({title:S,id:r,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=R.useState(t),l=R.useRef(null),d=R.useRef(null),[{handlerId:k},L]=ze({accept:"dragItem",collect(y){return{handlerId:y.getHandlerId()}},hover(y,i){var _,Q;if(!l.current)return;const o=y.index,T=s;if(o===T)return;const a=(_=l.current)==null?void 0:_.getBoundingClientRect(),j=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),u=(j.bottom-j.top)/2,A=i.getClientOffset().y-a.top;o<T&&A<u||o>T&&A>u||(w(o,T),y.index=T)}}),[{isDragging:x},g]=Ee({item:{index:s,type:"dragItem"},collect:y=>({isDragging:y.isDragging()}),end:f});g(d),L(l);const v=x?.5:1,b=p(y=>{y.preventDefault(),y.stopPropagation(),h(!c)});return e.jsxs(m,{ref:l,children:[e.jsxs(m,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(m,{sx:{py:2,px:1,opacity:v,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:b,children:[e.jsx(m,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:gt})}),e.jsx(xe,{sx:{flex:1},children:S}),e.jsx(oe,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:ct,style:{transform:"scale(1.5)"}})})]}),e.jsx(re,{})]}),e.jsx(m,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:N.string.isRequired,id:N.string.isRequired,children:N.node.isRequired,index:N.number.isRequired,onMove:N.func.isRequired,onEnd:N.func.isRequired,defaultExpand:N.bool};be.defaultProps={defaultExpand:!1};const jt=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:tt}),component:e.jsx(ht,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:Me}),component:e.jsx(xt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:_e}),component:e.jsx(ft,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ve}),component:e.jsx(pt,{})}],bt=["github","google","apple","auth0"];function vt(){var k,L;const{api:S}=J(),{blocklet:r}=$(),n=(k=r==null?void 0:r.meta)==null?void 0:k.did,s=((L=r==null?void 0:r.settings)==null?void 0:L.oauth)||{},w=Object.keys(s).sort((x,g)=>{var v,b,y;return((v=s[x])==null?void 0:v.order)!==void 0&&((b=s[g])==null?void 0:b.order)!==void 0?s[x].order-s[g].order:((y=s[x])==null?void 0:y.order)!==void 0?-1:1});for(const x of bt)w.includes(x)||w.push(x);const t=se(w.reduce((x,g,v)=>Object.assign(x,{[g]:v}),{})),f=te(()=>{const x=[...jt];return x.sort((g,v)=>t[g.name]-t[v.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(v=>{g[v]={order:x[v]}}),await S.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const v=f[x],b=f[g];t[v.name]=g,t[b.name]=x}),d=p(async()=>{await h(t)});return e.jsx(m,{sx:{".section-left":{width:"160px"}},children:e.jsx(Ue,{backend:We,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const G={ttl:pe.SESSION_TTL,cacheTtl:pe.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function M(S){return e.jsx(nt,{...S,sx:{transform:"scale(0.75)"}})}function me(S,r=!1){const n=r?S.ttl*86400:S.ttl/86400;return{...S,ttl:n}}function yt(){var a,j;const{api:S}=J(),{blocklet:r}=$(),n=(a=r==null?void 0:r.meta)==null?void 0:a.did,s=at({},G,((j=r==null?void 0:r.settings)==null?void 0:j.session)||{});qe(s.ttl)&&(s.ttl=G.ttl),qe(s.cacheTtl)&&(s.cacheTtl=G.cacheTtl),s.phone||(s.phone=G.phone),s.email||(s.email=G.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=ae({defaultValues:Y(me(s),["ttl","cacheTtl","email","phone"])}),{t:l}=ne(),d=h("email.enabled"),k=h("phone.enabled"),L=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:v,remove:b}=Fe({control:t,name:"email.domainBlackList"}),{fields:y,append:i,remove:o}=Fe({control:t,name:"email.domainWhiteList"}),T=p(async u=>{var P;try{const{blocklet:A}=await S.updateAppSessionConfig({input:{did:n,config:ot(me(u,!0),["phone"])}}),_=Object.assign({},G,Y(((P=A==null?void 0:A.settings)==null?void 0:P.session)||{},["ttl","cacheTtl","email","phone"]));c(me(_)),U.success(l("common.configSuccess"))}catch(A){U.error(A.message)}});return e.jsx(St,{onSubmit:w(T),children:e.jsxs(H,{direction:"column",gap:6,children:[e.jsxs(m,{children:[e.jsxs(m,{children:[e.jsx(xe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(m,{component:re,my:3})]}),e.jsxs(H,{gap:2,children:[e.jsx(D,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:u})=>e.jsx(M,{...u,checked:u.value})})})}),d&&e.jsxs(H,{direction:"column",ml:2,children:[e.jsx(D,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),L&&e.jsxs(m,{children:[g.map((u,P)=>e.jsxs(H,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${P}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>b(P),children:e.jsx(Ie,{})})]},u.id)),e.jsx(V,{startIcon:e.jsx(Ce,{}),onClick:()=>v(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(D,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),x&&e.jsxs(m,{children:[y.map((u,P)=>e.jsxs(H,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${P}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>o(P),children:e.jsx(Ie,{})})]},u.id)),e.jsx(V,{startIcon:e.jsx(Ce,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(m,{sx:{display:"none"},children:[e.jsx(D,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),k&&e.jsxs(H,{direction:"column",ml:2,mt:1,children:[e.jsx(D,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})})]})]})]})]}),e.jsxs(m,{children:[e.jsx(xe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(m,{component:re,my:3}),e.jsx(H,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:u})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(D,{title:l("blocklet.config.session.ttl",{day:u.value}),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{maxWidth:500,ml:1},children:e.jsx(Xe,{...u,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(m,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const St=Pe.form`
2
+ max-width: 1536px;
3
+
4
+ .advanced-config {
5
+ border: 0;
6
+ padding: 0;
7
+ }
8
+
9
+ .config-form {
10
+ flex-grow: 1;
11
+ overflow-y: auto;
12
+ will-change: transform;
13
+
14
+ &:first-child {
15
+ margin: 0;
16
+ }
17
+
18
+ ${S=>S.theme.breakpoints.down("md")} {
19
+ width: 100%;
20
+ flex-shrink: 0;
21
+ padding: 0 24px;
22
+ transform: translate(0, 0);
23
+ }
24
+ }
25
+
26
+ .config-item {
27
+ display: flex;
28
+ align-items: center;
29
+ justify-content: space-between;
30
+ }
31
+
32
+ .config-desc {
33
+ font-weight: normal;
34
+ font-size: 12px;
35
+ color: #666;
36
+ }
37
+
38
+ .form-item {
39
+ margin-top: 0;
40
+ }
41
+ `;var ve={},wt=Qe;Object.defineProperty(ve,"__esModule",{value:!0});var ye=ve.default=void 0,kt=wt($e()),Tt=e;ye=ve.default=(0,kt.default)((0,Tt.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23z"}),"Stars");const Lt={width:24,height:24,body:'<path fill="currentColor" d="M6 12.05q0 1.125.425 2.188T7.75 16.2l.25.25V15q0-.425.288-.713T9 14q.425 0 .713.288T10 15v4q0 .425-.288.713T9 20H5q-.425 0-.713-.288T4 19q0-.425.288-.713T5 18h1.75l-.4-.35q-1.3-1.15-1.825-2.625T4 12.05Q4 9.7 5.2 7.787T8.425 4.85q.35-.2.738-.025t.512.575q.125.375-.013.75t-.487.575q-1.45.8-2.313 2.213T6 12.05Zm12-.1q0-1.125-.425-2.187T16.25 7.8L16 7.55V9q0 .425-.288.713T15 10q-.425 0-.713-.288T14 9V5q0-.425.288-.713T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6h-1.75l.4.35q1.225 1.225 1.788 2.663T20 11.95q0 2.35-1.2 4.263t-3.225 2.937q-.35.2-.737.025t-.513-.575q-.125-.375.013-.75t.487-.575q1.45-.8 2.313-2.212T18 11.95Z"/>'},{DEFAULT_IP_DOMAIN_SUFFIX:It,SLOT_FOR_IP_DNS_SITE:Dt,DEFAULT_DID_DOMAIN:Ct}=pe,{encode:Ae}=ut,qt=S=>`${Ae(S.meta.did)}-${Dt}.${It}`,Ft=({did:S,didDomain:r=Ct})=>`${Ae(S)}.${r}`;var Pt={getIpDnsDomainForBlocklet:qt,getDidDomainForBlocklet:Ft};const Rt=R.forwardRef((S,r)=>{var b,y;const{t:n}=R.useContext(X),{blocklet:s}=$(),{api:w}=J(),t=se({loadingReject:!1,loadingApprove:!1,mode:"view",show:!1,data:{},callback:Z}),f=je(),c=((y=(b=f==null?void 0:f.transitions)==null?void 0:b.duration)==null?void 0:y.leavingScreen)||300,h=p(()=>{t.mode="view",t.data={},t.callback=Z}),l=p(()=>{t.show=!1,setTimeout(()=>{h()},c)}),d=p(i=>{t.mode="view",t.show=!0,t.data=i}),k=p((i,o=Z)=>{t.mode="approve",t.show=!0,t.data=i,t.callback=o});R.useImperativeHandle(r,()=>({open:d,close:l,approve:k}),[d,l,k]);const L=te(()=>{if(!t.show)return[];t.data.migratedFrom=[t.data.appId,t.data.appPid];const i=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return t.data.isMaster!==!1&&rt(i,"appliedAt","status"),i.map(o=>{const T=n(`federated.info.${o}`);let a=t.data[o];if(o==="appName"&&t.data.isMaster&&(a=e.jsxs(m,{children:[e.jsx(Re,{component:ye}),a]})),["appId","appPid","serverId"].includes(o)&&(a=e.jsx(he,{children:a})),["appUrl"].includes(o)&&(a=e.jsx(m,{component:"a",href:a,target:"_blank",children:a})),["appLogo"].includes(o)){const j=it(`https://${Pt.getDidDomainForBlocklet({did:t.data.appPid})}`,"/.well-known/service/blocklet/logo");try{const u=new URL(j);u.searchParams.set("imageFilter","resize"),u.searchParams.set("w","80"),u.searchParams.set("h","80"),a=e.jsx("img",{src:u.href,width:"60",height:"60",alt:t.data.appName})}catch{a=e.jsx("img",{src:j,width:"60",height:"60",alt:t.data.appName})}}return o==="status"&&(a=a&&n(`federated.status.${a}`)),o==="migratedFrom"&&(a=(t.data.migratedFrom||[]).filter(P=>![t.data.appId,t.data.appPid].includes(P)).map(P=>e.jsx(he,{children:P}))),lt(a)&&(a="-"),{name:T,value:a}})},[t.data]),x=t.mode==="approve",g=p(async()=>{try{t.loadingReject=!0,await w.auditFederatedLogin({input:{memberPid:t.data.appPid,did:s.appPid,status:"rejected"}}),l(),t==null||t.callback(!1)}finally{t.loadingReject=!1}}),v=p(async()=>{try{t.loadingApprove=!0,await w.auditFederatedLogin({input:{memberPid:t.data.appPid,did:s.appPid,status:"approved"}}),l(),t==null||t.callback(!0)}finally{t.loadingApprove=!1}});return e.jsx(ge,{open:t.show,title:n(x?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:l,actions:x?e.jsxs(e.Fragment,{children:[e.jsxs(V,{color:"error",variant:"contained",onClick:g,disabled:t.loadingReject,children:[t.loadingReject?e.jsx(fe,{size:16,color:"grey"}):null,n("common.reject")]}),e.jsxs(V,{variant:"contained",onClick:v,disabled:t.loadingApprove,children:[t.loadingApprove?e.jsx(fe,{size:16,color:"grey"}):null,n("common.approve")]})]}):e.jsx(V,{variant:"outlined",onClick:l,children:n("common.close")}),children:L.map(i=>e.jsx(dt,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:i.name,children:i.value},i.name))})}),Oe=R.forwardRef((S,r)=>{var d,k;const n=je(),s=((k=(d=n==null?void 0:n.transitions)==null?void 0:d.duration)==null?void 0:k.leavingScreen)||300,{t:w}=R.useContext(X),t=se({show:!1,data:{link:""}}),f=p(()=>{t.data.link=""}),c=p(()=>{t.show=!1,setTimeout(()=>{f()},s)}),h=p(({link:L})=>{t.show=!0,t.data.link=L});R.useImperativeHandle(r,()=>({open:h,close:c}),[h,c]);const l=p(()=>{Ye(t.data.link),c()});return e.jsxs(ge,{open:t.show,title:w("federated.joinFederatedLogin"),onClose:c,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:l,children:w("common.copyAndClose")}),children:[e.jsx(m,{mb:1,children:w("federated.inviteJoinFederatedLoginDescription")}),e.jsx(m,{sx:{"& .copy-button":{display:"none !important"}},children:e.jsx(Ne,{language:"shell",style:{marginBottom:0},children:t.data.link})})]})});function Se({mode:S}){var Q,we,ke,Te,Le;const r=R.useRef(null),n=R.useRef(null),{t:s,locale:w}=R.useContext(X),{blocklet:t,actions:{refreshBlocklet:f}}=$(),{confirmApi:c,confirmHolder:h}=Je(),{api:l}=J(),d=((Q=t.settings.federated)==null?void 0:Q.sites)||[],k=((we=t.settings.federated)==null?void 0:we.config)||{},L=k.isMaster!==!1,x=d.find(C=>C.appPid===t.appPid),g=se({loadingSync:!1}),v=p(C=>{var q;(q=n.current)==null||q.open(C)}),b=p(C=>{var q;(q=n.current)==null||q.approve(C,f)}),y=p(C=>{c.open({title:s("federated.removeFederatedLogin"),content:s("federated.removeFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(q){await l.quitFederatedLogin({input:{did:t.appPid,targetDid:C.appPid}}),q()}})}),i=p(C=>{c.open({title:s("federated.disableFederatedLogin"),content:s("federated.disableFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(q){await l.auditFederatedLogin({input:{memberPid:C.appPid,did:t.appPid,status:"revoked"}}),q()}})}),o=p(C=>{c.open({title:s("federated.enableFederatedLogin"),content:s("federated.enableFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(q){await l.auditFederatedLogin({input:{memberPid:C.appPid,did:t.appPid,status:"approved"}}),q()}})}),T=te(()=>{const C=[{label:s("common.name"),name:"appName",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(m,{display:"inline-block",children:e.jsxs(m,{component:"a",display:"flex",alignItems:"center",href:F.appUrl,target:"_blank",onClick:B=>{B.stopPropagation()},children:[ee&&e.jsx(Re,{component:ye,style:{marginRight:"4px"}}),F.appName]})})}}},{label:s("common.did"),name:"appId",options:{customBodyRenderLite:q=>{const F=d[q];return e.jsx(he,{children:F.appId})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(m,{children:ee?"-":s(`federated.status.${F.status}`)})}}}];return L&&C.push({label:s("common.actions"),name:"actions",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(m,{display:"flex",gap:1,children:ee?e.jsxs(e.Fragment,{children:[F.status==="rejected"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:B=>{B.stopPropagation()},children:s("federated.status.rejected")}),F.status==="revoked"&&e.jsx(z,{variant:"contained",color:"secondary",size:"small",onClick:B=>{B.stopPropagation()},children:s("federated.status.revoked")})]}):e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:B=>{B.stopPropagation(),y(F)},children:s("federated.quitMember")},"quiteSite"),F.status==="pending"&&e.jsx(z,{variant:"contained",color:"primary",size:"small",onClick:B=>{B.stopPropagation(),b(F)},children:s("federated.status.pending")},"auditSite"),F.status==="approved"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:B=>{B.stopPropagation(),i(F)},style:{whiteSpace:"nowrap"},children:s("federated.revoke")},"revokeSite"),F.status==="revoked"&&e.jsx(z,{variant:"contained",color:"warning",size:"small",onClick:B=>{B.stopPropagation(),o(F)},style:{whiteSpace:"nowrap"},children:s("federated.approve")},"approveSite")]})})}}}),C},[k.appId,d,L,s]),a=te(()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(C,{dataIndex:q}){const F=d[q];v(F)}}),[]),j=p(()=>{var q;const C=t.environments.find(F=>F.key===st.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);C!=null&&C.value?(q=r.current)==null||q.open({link:C.value}):U.error(s("federated.failedToGetFederatedLoginLink"))},[(Le=(Te=(ke=t.site)==null?void 0:ke.domainAliases)==null?void 0:Te[0])==null?void 0:Le.href]),u=p(()=>{c.open({title:s("federated.quitFederatedLogin"),content:s("federated.quitFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await l.quitFederatedLogin({input:{did:t.appPid}}),C()}})}),P=p(()=>{c.open({title:s("federated.disbandFederatedLogin"),content:s("federated.disbandFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await l.disbandFederatedLogin({input:{did:t.appPid}}),C()}})}),A=p(async()=>{try{g.loadingSync=!0,await Promise.all([await l.syncFederatedConfig({input:{did:t.appPid}}),He(500)]),U.success(s("common.succeeded"))}finally{g.loadingSync=!1}}),_=[];return x.status!=="pending"&&_.push(e.jsx(et,{title:s("federated.syncConfig"),children:e.jsx(oe,{size:"small",onClick:A,disabled:g.loadingSync,sx:[{"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}},g.loadingSync?{animation:"spin 1s linear infinite"}:{}],children:e.jsx(K,{icon:Lt,style:{fontSize:24}})},"syncConfig")})),S==="master"?(_.push(e.jsx(z,{size:"small",variant:"contained",onClick:j,sx:{ml:1},children:s("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),_.push(e.jsx(z,{color:"error",size:"small",variant:"contained",onClick:P,sx:{ml:1},children:s("federated.disbandFederatedLogin")},"disbandFederatedLogin"))):_.push(e.jsx(z,{size:"small",variant:"contained",color:"error",onClick:u,sx:{ml:1},children:s("federated.quitFederatedLogin")},"quitFederatedLogin")),e.jsxs(e.Fragment,{children:[e.jsx(Ke,{className:"main-table",locale:w,data:d,columns:T,customButtons:_,title:e.jsx(m,{className:"table-toolbar-left",children:s("oauth.federated")}),options:a}),h,e.jsx(Oe,{ref:r}),e.jsx(Rt,{ref:n})]})}Se.propTypes={mode:N.oneOf(["member","master"])};Se.defaultProps={mode:"member"};const At=R.forwardRef((S,r)=>{var g,v;const{t:n}=R.useContext(X),{api:s}=J(),{blocklet:w}=$(),t=w==null?void 0:w.appPid,f=je(),c=((v=(g=f==null?void 0:f.transitions)==null?void 0:g.duration)==null?void 0:v.leavingScreen)||300,h=se({loading:!1,show:!1,appUrl:"",appUrlError:"",callback:Z}),l=p(()=>{h.appUrl="",h.appUrlError="",h.callback=Z}),d=p(()=>{h.show=!1,setTimeout(()=>{l()},c)}),k=p((b=Z)=>{h.show=!0,h.callback=b});R.useImperativeHandle(r,()=>({open:k,close:d}),[k,d]);const L=p(b=>{if(!b)throw new Error(n("federated.federatedJoinAppUrlRequired"));if(!Ge(b))throw new Error(n("federated.federatedJoinAppUrlInvalid"))}),x=p(async()=>{try{L(h.appUrl),h.loading=!0;const b=await s.joinFederatedLogin({input:{did:t,appUrl:h.appUrl}});h.show=!1,d(),h==null||h.callback(b)}catch(b){h.appUrlError=b.message}finally{h.loading=!1}});return e.jsxs(ge,{open:h.show,title:n("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:e.jsxs(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:x,disabled:h.loading,children:[h.loading?e.jsx(fe,{size:16,sx:{mr:1},color:"grey"}):null,n("common.confirm")]}),children:[e.jsx(m,{mb:1,children:n("federated.joinFederatedLoginDescription")}),e.jsx(O,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:n("federated.federatedJoinAppUrl"),label:n("federated.federatedJoinAppUrl"),value:h.appUrl,error:!!h.appUrlError,helperText:h.appUrlError||"eg: https://www.arcblock.io",onChange:b=>{h.appUrl=b.target.value}})]})});function Ot(){var c,h,l,d,k;const S=R.useRef(null),r=R.useRef(null),{t:n}=R.useContext(X),{blocklet:s,actions:{refreshBlocklet:w}}=$(),t=p(()=>{var x,g,v,b;const L=(v=(g=(x=s.site)==null?void 0:x.domainAliases)==null?void 0:g[0])==null?void 0:v.href;if(L)try{const y=new URL(L);(b=S.current)==null||b.open({link:y.origin})}catch{U.error(n("federated.failedToGetFederatedLoginLink"))}},[(l=(h=(c=s.site)==null?void 0:c.domainAliases)==null?void 0:h[0])==null?void 0:l.href]),f=p(()=>{var L;(L=r.current)==null||L.open(()=>{w()})});if(((d=s.settings.federated)==null?void 0:d.sites.length)>0){const L=((k=s.settings.federated)==null?void 0:k.config.isMaster)!==!1;return e.jsx(Se,{mode:L?"master":"member"})}return e.jsxs(e.Fragment,{children:[e.jsxs(m,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[e.jsx(z,{variant:"contained",onClick:t,children:n("federated.inviteJoinFederatedLogin")}),e.jsx(re,{sx:{width:"150px",color:"text.primary"},children:"OR"}),e.jsx(z,{variant:"outlined",onClick:f,children:n("federated.joinFederatedLogin")})]}),e.jsx(Oe,{ref:S}),e.jsx(At,{ref:r})]})}function Be({orientation:S="horizontal"}){const{t:r}=R.useContext(X),n=mt({key:"lg"}),s=[{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.commonSettings")}),value:"settings"},{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.federated")}),value:"federated"},{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.oauth")}),value:"oauth"},{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.moreLogin")}),value:"more"}],[w,t]=R.useState(s[0].value),f=te(()=>({oauth:e.jsx(vt,{}),federated:e.jsx(Ot,{}),more:e.jsx(Ze,{children:r("oauth.comingSoon")}),settings:e.jsx(yt,{})}),[r]);return S==="vertical"?e.jsx(Bt,{children:e.jsxs(H,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(m,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(De,{tabs:s,current:w,orientation:n?"horizontal":"vertical",onChange:t,sx:{borderRight:n?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(m,{sx:{flexGrow:1,minWidth:0},children:e.jsx(m,{maxWidth:"1200px",children:f[w]})})]})}):e.jsxs(m,{children:[e.jsx(De,{tabs:s,current:w,onChange:t}),e.jsx(m,{marginTop:"10px",children:f[w]})]})}Be.propTypes={orientation:N.oneOf(["horizontal","vertical"])};Be.defaultProps={orientation:"horizontal"};const Bt=Pe.div`
42
+ .MuiTab-root {
43
+ text-align: left;
44
+ align-items: flex-start;
45
+ font-weight: normal;
46
+
47
+ div {
48
+ text-align: left;
49
+ }
50
+ }
51
+
52
+ .Mui-selected {
53
+ font-weight: bold;
54
+ }
55
+ `;export{Be as default};
@@ -1,4 +1,4 @@
1
- import{j as r,T as i}from"./vendor-mui-core-UZpb7wT7.js";import{$ as p,an as x}from"./vendor-utils-rHXShPKm.js";import{s as c}from"./vendor-ux-did-connect-TEE6cGq6.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-D_bnq77o.js";import{$ as p,an as x}from"./vendor-utils-rHXShPKm.js";import{s as c}from"./vendor-ux-did-connect-DHrruicZ.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;
@@ -0,0 +1,113 @@
1
+ import{g as qt,r as T}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ft,j as e,aa as R,O as se,bt as ge,bu as ze,bp as Y,ad as mt,H as x,a9 as Ge,T as oe,E as Je,bA as ht,bR as Be,bS as We,y as Oe,b4 as qe,ab as xt,a1 as gt,m as Kt,bc as lt,bs as Mt,bo as $t,q as ct,bZ as Ut,I as Ht}from"./vendor-mui-core-D_bnq77o.js";import{J as bt,z as Vt,A as Gt,e as fe,aB as je,C as Jt}from"./vendor-utils-rHXShPKm.js";import{u as le,a6 as jt,_ as M,bQ as Yt,B as me,b2 as Xt,as as vt,j as W,b7 as Zt,r as Ye,A as Qt,bR as es,Z as yt,a7 as St,bn as Ee,am as Ct,X as ts,bu as ss}from"./vendor-ux-did-connect-DHrruicZ.js";import{z as Xe,C as wt,au as Rt,av as Z,t as ne,l as ns,G as dt}from"./index-DefO2n6z.js";import{a as Ce,u as J,f as ce}from"./vendor-hooks-rDgu5KV9.js";import{a as Ze,b as is}from"./dashboard-BIOpvfj3.js";import{l as as,v as Pe}from"./vendor-arcblock-uz9DVywv.js";import{f as Ke,i as rs,d as os}from"./use-blocklet-logo-BEy8Tnso.js";import{A as ls,a as cs,d as ds,b as us}from"./collapse-QV_2gdtM.js";import{S as te}from"./section-Cv4udilp.js";import{S as we}from"./shorten-label-Cng55547.js";import{I as Tt}from"./index-enM9Y412.js";import{R as Nt,A as ps,S as fs,a as ms,b as hs,B as xs}from"./list-rt6nku1-.js";import{W as gs}from"./did-address-DjwPl1uy.js";import{p as Et}from"./util-CEAObyfj.js";import{D as bs,g as js}from"./traffic-B5x_6GvF.js";import{B as It}from"./bundle-avatar-DYTLzqlT.js";import{u as vs}from"./use-mobile-Boa_xu9A.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-DVnkpneF.js";import"./confirm-DjTZImyg.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-BToG9L6q.js";import"./get-safe-url-Bk6PlU7n.js";import"./session-CHdTc1We.js";import"./InfoOutlined-DkG0jjos.js";import"./dot-C4hULxc0.js";import"./useAsync-CMWsznMW.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DyX6Fl8Z.js";import"./index-BYCeMwoO.js";import"./CheckCircle-Ds4QI0ey.js";import"./index-BIPRCLBG.js";import"./Phone-DcHUzCa-.js";import"./Location-DUEOr9J2.js";import"./Email-DWueGk7t.js";import"./Timezone-B-Ho_Uno.js";import"./base32-_zEVBJUg.js";import"./iframe-DW7zzzTG.js";import"./LaunchOutlined-CXNijfqX.js";import"./ChevronLeft-CnQaQ-rc.js";import"./ChevronRight-a_2_x6Ew.js";import"./index-DcUhenm6.js";import"./vendor-mui-x-R-0SFz4c.js";import"./AdapterDayjs-BD9H1lZ-.js";var Me={exports:{}},$e={exports:{}},Ue={exports:{}};(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;function s(o){return o==null}n.exports=t.default,n.exports.default=t.default})(Ue,Ue.exports);var ys=Ue.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var s=l(as),o=l(ys);function l(m){return m&&m.__esModule?m:{default:m}}var r=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,S=/^[-+]?[0-9]+$/;function p(m,a){(0,s.default)(m),a=a||{};var E=a.allow_leading_zeroes===!1?r:S,I=!a.hasOwnProperty("min")||(0,o.default)(a.min)||m>=a.min,j=!a.hasOwnProperty("max")||(0,o.default)(a.max)||m<=a.max,C=!a.hasOwnProperty("lt")||(0,o.default)(a.lt)||m<a.lt,O=!a.hasOwnProperty("gt")||(0,o.default)(a.gt)||m>a.gt;return E.test(m)&&I&&j&&C&&O}n.exports=t.default,n.exports.default=t.default})($e,$e.exports);var Ss=$e.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var s=o(Ss);function o(r){return r&&r.__esModule?r:{default:r}}function l(r){return(0,s.default)(r,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=t.default,n.exports.default=t.default})(Me,Me.exports);var Cs=Me.exports;const ws=qt(Cs),_e={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Rs(){var D,F,_;const{api:n}=Xe(),{blocklet:t}=wt(),{t:s}=le(),{confirmApi:o,confirmHolder:l}=jt(),r=(D=t==null?void 0:t.meta)==null?void 0:D.did,S=Object.assign({..._e},((_=(F=t==null?void 0:t.settings)==null?void 0:F.notification)==null?void 0:_.email)||{}),{handleSubmit:p,control:m,formState:a,watch:E,reset:I}=Rt({defaultValues:bt(S,Object.keys(_e))}),j=Ce({testReceiver:"",testReceiverError:""}),C=E("enabled"),O=J(async(i,h,H=!0)=>{var V,ie;try{const{blocklet:re}=await n.configNotification({input:{did:r,notification:JSON.stringify({email:i})}}),pe=Object.assign({..._e},((ie=(V=re==null?void 0:re.settings)==null?void 0:V.notification)==null?void 0:ie.email)||{});I(pe),H&&M.success(s("oauth.saveSuccess"))}catch(re){if(H)M.error(re.message||s("oauth.saveFailed"));else throw re}}),z=J(async(i,h,H)=>{try{a.isDirty&&await O(i,h,!1),await n.sendEmail({input:{did:r,receiver:H,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),M.success(s("notification.email.testSuccess"))}catch(V){M.error(V.message||s("notification.email.testfailed"))}}),L=J((i,h)=>{j.testReceiver="",j.testReceiverError="",o.open({title:s("notification.email.testSendEmail"),content:()=>e.jsx(R,{sx:{width:"300px"},children:e.jsx(se,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.email.inputTestReceiver"),value:j.testReceiver,onChange:H=>{j.testReceiver=H.target.value},error:!!j.testReceiverError,helperText:j.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(H){var ie;const V=(ie=j.testReceiver)==null?void 0:ie.trim();if(!V){j.testReceiverError=s("notification.email.receiverRequired");return}if(!Pe(V)){j.testReceiverError=s("notification.email.receiverInvalid");return}j.testReceiverError="",await z(i,h,V),H()}})}),U=J(i=>{const h=i==null?void 0:i.trim();return h?Pe(h)?!0:s("notification.email.fromInvalid"):s("notification.email.fromRequired")}),$=J(i=>{const h=i==null?void 0:i.trim();return h?Ke(h,{require_host:!1,protocols:[]})?!0:s("notification.email.hostInvalid"):s("notification.email.hostRequired")}),Q=J(i=>i?ws(i)?!0:s("notification.email.portInvalid"):s("notification.email.portRequired")),B=J(i=>i!=null&&i.trim()?!0:s("notification.email.userRequired")),q=J(i=>i!=null&&i.trim()?!0:s("notification.email.passwordRequired")),d=J(i=>i!=null&&i.trim()&&!Ke(i,{protocols:["http","https"],require_protocol:!0})?s("notification.email.linkInvalid"):!0),g=J(i=>i!=null&&i.trim()&&!Pe(i)?s("notification.email.emailInvalid"):!0),b=J(()=>!0);return e.jsxs(R,{children:[e.jsxs(Ts,{component:"form",onSubmit:p(O),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(te,{title:s("notification.email.enable"),my:2.5,children:e.jsx(Z,{name:"enabled",control:m,render:({field:i})=>e.jsx(ge,{control:e.jsx(ze,{checked:i.value,...i})})})}),e.jsx(te,{title:s("notification.email.from"),children:e.jsx(Z,{name:"from",control:m,rules:{validate:C?U:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",required:!0,label:s("notification.email.from"),error:!!a.errors[i.name],helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.host"),children:e.jsx(Z,{name:"host",control:m,rules:{validate:C?$:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",required:!0,error:!!a.errors[i.name],label:s("notification.email.host"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.port"),children:e.jsx(Z,{name:"port",control:m,rules:{validate:C?Q:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",required:!0,type:"number",error:!!a.errors[i.name],label:s("notification.email.port"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.user"),children:e.jsx(Z,{name:"user",control:m,rules:{validate:C?B:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",required:!0,error:!!a.errors[i.name],label:s("notification.email.user"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.password"),children:e.jsx(Z,{name:"password",control:m,rules:{validate:C?q:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",required:!0,type:"password",error:!!a.errors[i.name],label:s("notification.email.password"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.secure"),children:e.jsx(Z,{name:"secure",control:m,rules:{validate:b},render:({field:i})=>e.jsx(Y,{fullWidth:!0,children:e.jsx(ge,{control:e.jsx(ze,{checked:i.value,...i,disabled:!C})})})})}),e.jsxs(ls,{children:[e.jsxs(cs,{expandIcon:e.jsx(ds,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[s("notification.email.signature"),e.jsx(mt,{title:s("notification.email.signatureTooltip"),children:e.jsx(Yt,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(us,{children:[e.jsx(te,{title:s("notification.email.companyName"),children:e.jsx(Z,{name:"companyName",control:m,rules:{validate:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",error:!!a.errors[i.name],label:s("notification.email.companyName"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.companyLink"),children:e.jsx(Z,{name:"companyLink",control:m,rules:{validate:C?d:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",error:!!a.errors[i.name],label:s("notification.email.companyLink"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.companyAddress"),children:e.jsx(Z,{name:"companyAddress",control:m,rules:{validate:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",error:!!a.errors[i.name],label:s("notification.email.companyAddress"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})}),e.jsx(te,{title:s("notification.email.supportEmail"),children:e.jsx(Z,{name:"supportEmail",control:m,rules:{validate:C?g:b},render:({field:i})=>{var h;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...i,size:"small",type:"email",error:!!a.errors[i.name],label:s("notification.email.supportEmail"),helperText:((h=a.errors[i.name])==null?void 0:h.message)||" ",disabled:!C})})}})})]})]}),e.jsxs(R,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(L),disabled:!C,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!a.isDirty,children:s("oauth.save")})]})]}),l]})}const Ts=ue(ft)``,ke={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function Ns(){var Q,B,q;const{api:n}=Xe(),{blocklet:t}=wt(),{t:s}=le(),{confirmApi:o,confirmHolder:l}=jt(),r=(Q=t==null?void 0:t.meta)==null?void 0:Q.did,S=Object.assign({...ke},((q=(B=t==null?void 0:t.settings)==null?void 0:B.notification)==null?void 0:q.pushKit)||{}),{handleSubmit:p,control:m,formState:a,watch:E,reset:I}=Rt({defaultValues:bt(S,Object.keys(ke))}),j=Ce({testReceiver:"",testReceiverError:""}),C=E("enabled"),O=J(async(d,g,b=!0)=>{var D,F;try{const{blocklet:_}=await n.configNotification({input:{did:r,notification:JSON.stringify({pushKit:d})}}),i=Object.assign({...ke},((F=(D=_==null?void 0:_.settings)==null?void 0:D.notification)==null?void 0:F.pushKit)||{});I(i),b&&M.success(s("oauth.saveSuccess"))}catch(_){if(b)M.error(_.message||s("oauth.saveFailed"));else throw _}}),z=J(async(d,g)=>{var b,D,F;try{a.isDirty&&await O(d,g,!1);const _=(b=((t==null?void 0:t.configs)||[]).find(H=>H.key==="BLOCKLET_APP_URL"))==null?void 0:b.value,i=Vt(Gt(_,"/.well-known/service/blocklet/logo"),{v:(D=t==null?void 0:t.meta)==null?void 0:D.version,t:new Date((t==null?void 0:t.updatedAt)||0).getTime()}),h={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:(F=t==null?void 0:t.meta)==null?void 0:F.title,avatar:i}}}};await n.sendPush({input:{did:r,receiver:j.testReceiver,notification:JSON.stringify(h)}}),M.success(s("notification.pushKit.testSuccess"))}catch(_){M.error(_.message||s("notification.pushKit.testfailed"))}}),L=J((d,g)=>{j.testReceiverError="",o.open({title:s("notification.pushKit.testSend"),content:()=>e.jsx(R,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(se,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.pushKit.inputTestReceiver"),value:j.testReceiver,onChange:b=>{j.testReceiver=b.target.value},error:!!j.testReceiverError,helperText:j.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(b){var F;if(!((F=j.testReceiver)==null?void 0:F.trim())){j.testReceiverError=s("notification.pushKit.receiverRequired");return}j.testReceiverError="",await z(d,g),b()}})}),U=J(d=>{const g=d==null?void 0:d.trim();return g?Ke(g)?!0:s("notification.pushKit.endpointInvalid"):s("notification.pushKit.endpointRequired")}),$=J(()=>!0);return e.jsxs(R,{children:[e.jsxs(Es,{component:"form",onSubmit:p(O),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(te,{title:s("notification.pushKit.enable"),my:2.5,children:e.jsx(Z,{name:"enabled",control:m,render:({field:d})=>e.jsx(ge,{control:e.jsx(ze,{checked:d.value,...d})})})}),e.jsx(te,{title:s("notification.pushKit.endpoint"),children:e.jsx(Z,{name:"endpoint",control:m,rules:{validate:C?U:$},render:({field:d})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...d,size:"small",required:!0,label:s("notification.pushKit.endpoint"),error:!!a.errors[d.name],helperText:((g=a.errors[d.name])==null?void 0:g.message)||" ",disabled:!C})})}})}),e.jsxs(te,{title:s("notification.pushKit.customOptions"),children:[e.jsx(Z,{name:"did",control:m,render:({field:d})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...d,size:"small",label:s("notification.pushKit.did"),error:!!a.errors[d.name],helperText:((g=a.errors[d.name])==null?void 0:g.message)||" ",disabled:!C})})}}),e.jsx(Z,{name:"pushPath",control:m,render:({field:d})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(se,{...d,size:"small",label:s("notification.pushKit.pushPath"),error:!!a.errors[d.name],helperText:((g=a.errors[d.name])==null?void 0:g.message)||" ",disabled:!C})})}})]}),e.jsxs(R,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(L),disabled:!C,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!a.isDirty,children:s("oauth.save")})]})]}),l]})}const Es=ue(ft)``,ut=[{label:e.jsx(R,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(R,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function Is(){const[n,t]=T.useState(ut[0].value),{locale:s}=T.useContext(Xt),o=ce(()=>({email:e.jsx(Rs,{}),pushKit:e.jsx(Ns,{})}),[s]),l=T.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(R,{children:[e.jsx(vt,{tabs:ut,current:n,onChange:t}),e.jsx(R,{style:l,children:o[n]})]})}const At=T.createContext({}),{Provider:As,Consumer:si}=At;function Os({children:n,blocklet:t=""}){const{api:s,inService:o,ws:{useSubscription:l}}=Xe(),[r,S]=T.useState([]),[p,m]=T.useState({total:0,pageSize:20,pageCount:0,page:1}),a=ce(()=>{var d;return(d=t.meta)==null?void 0:d.did},[t]),[E,I]=T.useState([]),[j,C]=T.useState({}),O=ce(()=>r.length?new Set(r.map(d=>d.id)):new Set,[r]),z=async({page:d=1,pageSize:g=20,...b}={})=>{if(!a)return[];try{const D={paging:{page:d,pageSize:g},...b,teamDid:a,dateRange:b.dateRange?[ne(b.dateRange[0]).toISOString(),ne(b.dateRange[1]).toISOString()]:void 0},{dids:F,..._}=D;let i="";F&&F.includes("system")&&(i="system");const h=F?F.filter(ie=>ie!=="system"):[],H={..._,source:i,componentDids:h},V=await s.getNotificationSendLog({input:H});return C(H),S(V.list),m(V.paging),V.list}catch(D){return M.error(D.message),[]}},L=async()=>{const d=await s.getNotificationComponents({input:{teamDid:a}});I(d.componentDids)},U=T.useCallback(d=>{const g=t.children.find(b=>{var D;return((D=b.meta)==null?void 0:D.did)===d});if(g)return g.ancestors=[t],g},[t]),$=async({notificationId:d,receivers:g,channels:b,...D})=>{await s.resendNotification({input:{teamDid:a,notificationId:d,receivers:g,channels:b.map(F=>F==="wallet"?W.NOTIFICATION_SEND_CHANNEL.WALLET:F==="pushKit"?W.NOTIFICATION_SEND_CHANNEL.PUSH:F),...D}})},Q=T.useCallback(async d=>(await s.getUser({input:{teamDid:a,user:{did:d}}})).user,[s,a]),B=T.useCallback(async({page:d=1,pageSize:g=20,...b}={})=>{try{const D={paging:{page:d,pageSize:g},...b,userName:b.searchText||"",teamDid:a,dateRange:b.dateRange?[ne(b.dateRange[0]).toISOString(),ne(b.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:D})}catch(D){throw M.error(D.message),D}},[s,a]);T.useEffect(()=>{a&&L()},[a]),l(W.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,d=>{O.has(d.notificationId)&&z(j)},[O,j]),l(W.EVENTS.NOTIFICATION_BLOCKLET_CREATE,d=>{O.has(d.id)||z(j)},[O,j]);const q={fetch:z,data:r,paging:p,blocklet:t,getComponent:U,resendNotification:$,getUser:Q,componentDids:E,getReceivers:B,inService:o,teamDid:a};return e.jsx(As,{value:{notificationRecords:q},children:n})}function Qe(){const{notificationRecords:n}=T.useContext(At);return n}Re.propTypes={severity:x.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ds={info:"primary",success:"success",error:"error",warning:"warning"};function Re({severity:n="info"}){return e.jsx(Zt,{type:Ds[n],children:n})}var et={},Ls=Ge;Object.defineProperty(et,"__esModule",{value:!0});var Ot=et.default=void 0,Ps=Ls(Ye()),_s=e;Ot=et.default=(0,Ps.default)((0,_s.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 tt={},ks=Ge;Object.defineProperty(tt,"__esModule",{value:!0});var Dt=tt.default=void 0,Fs=ks(Ye()),zs=e;Dt=tt.default=(0,Fs.default)((0,zs.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 st={},Bs=Ge;Object.defineProperty(st,"__esModule",{value:!0});var Lt=st.default=void 0,Ws=Bs(Ye()),qs=e;Lt=st.default=(0,Ws.default)((0,qs.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 Ks=(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 Pt(n,t,s={}){const{status:o,updatedAt:l,reason:r="",channel:S="wallet"}=s,p=l?n("notification.sendStatus.sentTime",{date:ns(l,t)}):"",m=Ks(n,S,r);return o===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:p,reason:m}:o===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:p}:{status:"pending",title:n("notification.sendStatus.pending"),reason:m,sentTime:p}}const He={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ve=["wallet","pushKit","email"],pt=["info","success","error","warning"],_t=n=>{var s,o;const{settings:t}=n;return(o=(s=t==null?void 0:t.notification)==null?void 0:s.email)==null?void 0:o.enabled},kt=n=>{var s,o;const{settings:t}=n;return(o=(s=t==null?void 0:t.notification)==null?void 0:s.pushKit)==null?void 0:o.enabled},Ms=(n,t)=>{const s=fe(t,"extra.notifications.email",!0);return{available:_t(n),enabled:s}},$s=(n,t)=>{const s=fe(t,"extra.notifications.push",!0);return{available:kt(n),enabled:s}},Us=n=>({enabled:fe(n,"extra.notifications.wallet",!0)}),Hs=n=>({enabled:fe(n,"extra.webhooks",[]).length>0}),Te=(n=3)=>new Promise(t=>{setTimeout(()=>{t()},n*1e3)}),Vs=(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})}]:[],Ne=(n=[])=>{const t=ne().startOf("day");return n.filter(s=>ne(s.sendAt).isSame(t,"day")).length},Gs=(n,t="")=>{if(t&&Ve.includes(t)){const r=`${t}SendRecord`,S=fe(n,r,[]);return Ne(S)}const s=fe(n,"webhook",{}),o=Object.keys(s??{})??[];if(t&&o.includes(t)){const r=s[t]??[];return Ne(r)}const l={};return Ve.forEach(r=>{const S=`${r}SendRecord`,p=fe(n,S,[]),m=Ne(p);l[r]=m}),o.length>0&&o.forEach(r=>{const S=s[r]??[],p=Ne(S);l[r]=p}),l},Ie=(n,t,s)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[s].splice(t,1),n},Ae=(n,t)=>{if(!Array.isArray(t))throw new Error("filters must be an array");return t.length?!t.includes(n):!1},Js=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""}},Ft=()=>Qt({typography:{fontSize:14,button:{textTransform:"none"}},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:o}){const{status:l,title:r="",sentTime:S="",reason:p=""}=n,m=[r,p].filter(Boolean).join(", ");return e.jsx(mt,{title:t?e.jsxs(e.Fragment,{children:[e.jsx(oe,{color:"inherit",sx:{fontSize:12},children:m}),e.jsx("span",{children:S})]}):null,arrow:!0,placement:"top",children:e.jsxs(R,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(R,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(R,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:He[l],style:{opacity:.15}}),e.jsx(R,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:He[l]})]}),e.jsx(oe,{color:"inherit",sx:{fontSize:12},children:s?r:o})]})})}de.propTypes={config:x.object.isRequired,enableTooltip:x.bool,showTitle:x.bool,children:x.node};de.defaultProps={enableTooltip:!0,showTitle:!1,children:null};ve.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};ve.defaultProps={onDelete:()=>{}};function ve({list:n,label:t,onDelete:s}){const{t:o,locale:l}=le();return e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(oe,{children:[t,": "]}),n.map(r=>{const S=Pt(o,l,{status:r});return e.jsx(Je,{size:"small",label:e.jsx(R,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(de,{config:S,enableTooltip:!1,children:S.title})}),onDelete:p=>s(p,r)},r)})]})}nt.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 nt({filterList:n,onChange:t,index:s,column:o,filterValues:l,label:r,renderLabel:S}){return e.jsxs(Y,{className:"filter-container",children:[e.jsx(ht,{component:"legend",children:r}),e.jsx(Be,{row:!0,children:l.map(p=>e.jsx(ge,{control:e.jsx(We,{checked:n[s].indexOf(p.value??p)>-1,onChange:m=>{const a=[...n];m.target.checked?a[s]=[...a[s],p.value??p]:a[s]=a[s].filter(E=>E!==(p.value??p)),t(a[s],s,o)},name:p.value??p}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:S(p)})},p.value??p))})]})}function Fe(n){return e.jsx(nt,{...n,renderLabel:t=>e.jsx(de,{enableTooltip:!1,config:{status:t.status},children:t.label})})}be.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function be({status:n,updatedAt:t,reason:s="",channel:o="wallet",onResend:l}){const{t:r,locale:S}=le(),p=Pt(r,S,{status:n,updatedAt:t,reason:s,channel:o});return e.jsxs(R,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(de,{config:p,showTitle:!0}),p.status!=="success"&&e.jsx(Oe,{className:"resend-btn",size:"small",startIcon:e.jsx(Ze,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:l,children:r("notification.resend")})]})}it.propTypes={value:x.array.isRequired,onChange:x.func};function it({value:n,onChange:t}){const{locale:s}=le(),o=ne().toDate(),[l,r]=T.useState(null),S=T.useCallback(a=>{r(l?null:a.currentTarget)},[l]),p=!!l,m=T.useCallback(a=>{if(!a.startDate||!a.endDate){M.error("Please select a date range");return}if(ne(a.startDate).isAfter(a.endDate)||!ne(a.startDate).isValid()||!ne(a.endDate).isValid()){M.error("Invalid date range");return}t([a.startDate,a.endDate]),r(null)},[t]);return e.jsxs("div",{children:[e.jsx(oe,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Oe,{onClick:S,variant:"outlined",size:"small",color:"inherit",children:[dt(n[0],s)," - ",dt(n[1],s)]})}),e.jsx(qe,{open:p,anchorEl:l,onClose:()=>{r(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(bs,{open:!0,maxDate:o,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:S,definedRanges:js(o),onChange:m})})]})}at.propTypes={itemComponent:x.elementType.isRequired};function at({itemComponent:n,...t}){var l;const{t:s}=le();return!((l=t==null?void 0:t.filterList)!=null&&l.filter(r=>r.length).length)?null:e.jsxs(R,{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(es.TableFilterList,{...t,ItemComponent:n})})]})}function De({label:n,onDelete:t,canDelete:s=()=>!0,...o}){const l=t&&typeof t=="function"?t:void 0;let r=!0;return s&&typeof s=="function"&&(r=s({label:n,...o})),e.jsx(Je,{label:n,variant:"outlined",...l&&r?{onDelete:l}:{}})}De.propTypes={label:x.string.isRequired,onDelete:x.func,canDelete:x.func};De.defaultProps={canDelete:()=>!0};const Ys=[{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}];rt.propTypes={loading:x.bool,onCancel:x.func,onConfirm:x.func};rt.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function rt({loading:n=!1,onCancel:t,onConfirm:s}){const{t:o}=le(),[l,r]=T.useState(Ys),[S,p]=T.useState(!0),m=(E,I)=>{I.checked=E.target.checked;const j=l.map(C=>({...C,checked:C.value===I.value?I.checked:C.checked}));r(j)},a=E=>{E.stopPropagation(),s({channels:l.filter(I=>I.checked).map(I=>I.value),isResendFailedOnly:S})};return e.jsxs(R,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(oe,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:o("notification.config")}),e.jsx(R,{className:"choose-channel",children:e.jsxs(Y,{component:"fieldset",variant:"standard",children:[e.jsx(ht,{component:"legend",children:o("notification.selectChannels")}),e.jsx(Be,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:l.map(E=>e.jsx(ge,{control:e.jsx(We,{checked:E.checked,onChange:I=>m(I,E),name:E.value}),label:E.label},E.value))})]})}),e.jsx(R,{className:"resend-config-footer",children:e.jsx(Be,{children:e.jsx(ge,{control:e.jsx(We,{checked:S,onChange:E=>p(E.target.checked)}),label:o("notification.resendFailedOnly")})})}),e.jsxs(R,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Oe,{onClick:E=>{E.stopPropagation(),t()},color:"inherit",children:o("common.cancel")}),e.jsxs(Oe,{onClick:a,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(xt,{size:16}),o("common.confirm")]})]})]})}zt.propTypes={notificationId:x.string.isRequired,handleResend:x.func,resending:x.bool};function zt({notificationId:n,handleResend:t,resending:s=!1}){const{t:o,locale:l}=le(),{getReceivers:r,inService:S,teamDid:p,getUser:m,blocklet:a}=Qe(),[E,I]=T.useState(!1),[j,C]=T.useState([]),O=Ce({anchorEl:null,position:null}),z=Ce({anchorEl:null,position:null}),[L,U]=T.useState(null),[$,Q]=T.useState({total:0,pageSize:10,pageCount:0,page:1}),[B,q]=T.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[ne().subtract(1,"month").startOf("day").toDate(),ne().endOf("day").toDate()]}),[d,g]=T.useState([]),b=[{label:o("notification.sendStatus.pending"),value:0,status:"pending"},{label:o("notification.sendStatus.success"),value:1,status:"success"},{label:o("notification.sendStatus.failed"),value:2,status:"failed"}],D=async()=>{if(!E&&n)try{I(!0);const c=await r({notificationId:n,...B}),u=c.list.map(f=>({...f,receiverUser:{...f.receiverUser,avatar:Et(f.receiverUser.avatar,p,S)}}));C(u),Q(c.paging),I(!1)}catch(c){M.error(c.message),I(!1)}};T.useEffect(()=>{D()},[B]);const F=c=>{c.stopPropagation();const u=c.currentTarget;z.anchorEl=u;const f=u.getBoundingClientRect();z.position={top:f.top+window.scrollY,left:f.left+window.scrollX}},_=c=>c.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(Ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:F,children:o("notification.resend")})}):null,i={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:o("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:$.page-1,rowsPerPage:$.pageSize,count:$.total,searchText:B.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:d,onRowSelectionChange:(c,u)=>{g(u.map(f=>f.dataIndex))},customToolbarSelect:_},h=({page:c,rowsPerPage:u,searchText:f,filterList:A})=>{const[,K=[],ee=[],X=[]]=A;B.pageSize!==u?q(G=>({...G,pageSize:u,page:1})):B.page!==c+1?q(G=>({...G,page:c+1})):B.searchText!==f?q(G=>({...G,searchText:f,page:1})):je(K,B.walletSendStatus)?je(ee,B.pushKitSendStatus)?je(X,B.emailSendStatus)||q(G=>({...G,emailSendStatus:X,page:1})):q(G=>({...G,pushKitSendStatus:ee,page:1})):q(G=>({...G,walletSendStatus:K,page:1}))},H=T.useCallback(async(c,u)=>{if(!u)return!1;const f=await m(u);return f?c==="wallet"?Us(f):c==="email"?Ms(a,f):c==="pushKit"?$s(a,f):c==="webhook"?Hs(f):!0:!1},[m,a]),V=T.useCallback(c=>Vs(o,c),[o]),ie=()=>{O.anchorEl=null,O.position=null,U(null)},re=()=>{z.anchorEl=null,z.position=null},pe=async(c,u,f=!0,A="")=>{if(!(!u.length||!c.length))try{t(c,u,f,A),z.anchorEl||(await Te(.5),ie())}catch(K){console.error("handleResend error",{error:K})}},y=async({channels:c,isResendFailedOnly:u})=>{const f=d.map(A=>j[A].receiver);await pe(c,f,u),await Te(.5),re(),g([])},v=async(c,u=[],f=!0)=>{try{await pe(["webhook"],[c.receiver],f,u)}catch(A){M.error(A.response?A.response.statusText:A.message)}},w=async(c,u,f,A=[],K=!0)=>{if(c.stopPropagation(),Gs(u,f)>=4){M.warning(o("notification.resendLimit"));return}if(!Ve.includes(f)){await v(u,A,K);return}if(c){const X=c.currentTarget,G=X.getBoundingClientRect();O.anchorEl=X,O.position={top:G.top+window.scrollY,left:G.left+window.scrollX}}U({channel:f});try{const X=await H(f,u.receiver);await Te(1),U({channel:f,result:X}),(typeof X=="boolean"&&X||Jt(X)&&Object.values(X).every(G=>!!G))&&(await t([f],[u.receiver],K),z.anchorEl||(await Te(.5),ie()))}catch(X){M.error(X.message)}},N=c=>{q(u=>({...u,dateRange:c,page:1}))},P=(c,u,f,A)=>{c.stopPropagation();const K=f.filter(ee=>ee!==u);q(ee=>({...ee,[A]:K,page:1}))},k=ce(()=>[{label:o("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:c=>{const{receiverUser:u,receiver:f}=j[c];return u?e.jsxs(R,{"data-cy":`member-name-${u.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(yt,{src:`${u.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:f,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(we,{children:u.fullName})]},f):e.jsx(gs,{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:B.walletSendStatus??[],customFilterListOptions:{render:c=>e.jsx(ve,{list:c,label:"Wallet",onDelete:(u,f)=>{u.stopPropagation(),P(u,f,k[1].options.filterList,"walletSendStatus")}}),update:Ie},filterOptions:{names:b,fullWidth:!0,logic:Ae,display:(c,u,f,A)=>e.jsx(Fe,{label:"Wallet",filterList:c,onChange:u,index:f,column:A,filterValues:b})},customBodyRenderLite:c=>{const{walletSendStatus:u,walletSendAt:f,walletSendFailedReason:A}=j[c];return e.jsx(be,{status:u,updatedAt:f,reason:A,channel:"wallet",onResend:K=>w(K,j[c],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{pushKitSendStatus:u,pushKitSendAt:f,pushKitSendFailedReason:A}=j[c];return e.jsx(be,{status:u,updatedAt:f,reason:A,channel:"pushkit",onResend:K=>w(K,j[c],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:B.pushKitSendStatus??[],customFilterListOptions:{render:c=>e.jsx(ve,{list:c,label:"Push Kit",onDelete:(u,f)=>{u.stopPropagation(),P(u,f,k[2].options.filterList,"pushKitSendStatus")}}),update:Ie},filterOptions:{names:b,fullWidth:!0,logic:Ae,display:(c,u,f,A)=>e.jsx(Fe,{label:"Push Kit",filterList:c,onChange:u,index:f,column:A,filterValues:b})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:u,emailSendAt:f,emailSendFailedReason:A}=j[c];return e.jsx(be,{status:u,updatedAt:f,reason:A,channel:"email",onResend:K=>w(K,j[c],"email",[],!1)})},filter:!0,filterType:"custom",filterList:B.emailSendStatus??[],customFilterListOptions:{render:c=>e.jsx(ve,{list:c,label:"Email",onDelete:(u,f)=>{u.stopPropagation(),P(u,f,k[3].options.filterList,"emailSendStatus")}}),update:Ie},filterOptions:{names:b,fullWidth:!0,logic:Ae,display:(c,u,f,A)=>e.jsx(Fe,{label:"Email",filterList:c,onChange:u,index:f,column:A,filterValues:b})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{webhook:u}=j[c];if(!u)return null;const f=Object.entries(u)[0];if(!f)return null;const[A,K]=f,ee=K[0];return e.jsx(R,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(R,{className:"webhook-item",fontSize:12,children:[e.jsx(we,{maxLength:30,children:A},A),e.jsx(be,{status:ee.status,updatedAt:ee.sendAt,reason:ee.failedReason,channel:"webhook",onResend:X=>w(X,j[c],"webhook",[A],!1)})]},A)})}}},{label:o("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:c=>{const{createdAt:u}=j[c];return e.jsx(Nt,{value:u,locale:l,shouldUpdate:!0})}}}],[j,l,B,o]),ae=[e.jsx(it,{value:B.dateRange,onChange:N},"date-picker"),e.jsx(me,{variant:"contained",size:"small",color:"primary",loading:E,startIcon:e.jsx(Lt,{}),onClick:()=>D(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:o("common.refresh")},"refresh")];return e.jsx(R,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(Zs,{children:e.jsxs(gt,{theme:Ft(),children:[e.jsx(St,{className:"receivers-table",locale:l,loading:E,columns:k,data:j,onChange:h,options:i,customButtons:ae,components:{TableFilterList:c=>e.jsx(at,{...c,itemComponent:u=>e.jsx(De,{...u,canDelete:()=>!1})})}}),O.anchorEl&&e.jsx(qe,{open:!!O.anchorEl,anchorReference:"anchorPosition",anchorPosition:O.position,onClose:ie,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(Qs,{children:[e.jsxs(oe,{variant:"body1",component:"div",className:"check-title",children:[L==null?void 0:L.channel," Checking"]}),e.jsx(R,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:V(L==null?void 0:L.channel).map(c=>{var K,ee;const{type:u,pass:f,fail:A}=c;return!(L!=null&&L.result)||(K=L==null?void 0:L.result)!=null&&K[u]?e.jsxs(oe,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(ee=L==null?void 0:L.result)!=null&&ee[u]?Ee.success.main:"inherit"},children:[L!=null&&L.result?e.jsx(Ot,{}):e.jsx(xt,{size:12,sx:{color:Ee.primary.main}}),e.jsx("span",{children:f})]},u):e.jsxs(oe,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Ee.error.main},children:[e.jsx(Dt,{}),e.jsx("span",{children:A})]},u)})})]})}),z.anchorEl&&e.jsx(qe,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:re,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(rt,{loading:s,onCancel:re,onConfirm:y})})]})})})}const Xs=T.memo(zt),Zs=ue.div`
2
+ td.MuiTableCell-footer {
3
+ border: none !important;
4
+ }
5
+ .sent-status-cell {
6
+ .resend-btn {
7
+ display: none;
8
+ }
9
+ &:hover {
10
+ .resend-btn {
11
+ display: flex;
12
+ }
13
+ }
14
+ }
15
+ `,Qs=ue.div`
16
+ padding: 8px 16px;
17
+ .check-title {
18
+ font-weight: 500;
19
+ margin-bottom: 8px;
20
+ &::first-letter {
21
+ text-transform: uppercase;
22
+ }
23
+ }
24
+ .check-item {
25
+ svg {
26
+ font-size: 16px;
27
+ }
28
+ font-size: 12px;
29
+ }
30
+ `,ye=n=>n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:n;function en(n){const{wallet:t,push:s,email:o,webhook:l}=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:o})},...l.total>0?[{name:"Webhook",value:e.jsx(he,{item:l,isWebhook:!0})}]:[]]}function tn(n,t,s){const{wallet:o,push:l,email:r,webhook:S}=n;return[{name:"Wallet",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.WALLET,item:o,onResend:t})},{name:"Push",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.PUSH,item:l,onResend:t})},{name:"Email",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.EMAIL,item:r,onResend:t})},...S.total>0?[{name:"Webhook",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:S,isWebhook:!0,onResend:t})}]:[]]}Le.propTypes={statistics:x.object.isRequired,onResend:x.func,mode:x.oneOf(["simple","detail"]),resending:x.bool};Le.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}=le(),o=t?n.success.length:n.success,l=n.total,r=o===l?"success":"failed";return e.jsx(R,{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2,children:e.jsx(R,{display:"flex",alignItems:"center",gap:1,children:e.jsxs(de,{config:{status:r},enableTooltip:!1,children:[ye(o)," / ",ye(l)," ",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:o,loading:l}){const{t:r}=le(),{success:S,failed:p,pending:m}=t,a=Js(n),E=s?S.length:S,I=s?p.length:p,j=s?m.length:m,C=async U=>{U.stopPropagation();const $=s?[...new Set([...S,...p].map(Q=>Q))]:[];await o([n],[],!0,$)},O=E+I,z=O>0?E/O*100:0,L=O>0?I/O*100:0;return e.jsxs(sn,{successRatio:z,failedRatio:L,children:[e.jsxs(oe,{variant:"h6",children:[a," (",t.total,")"]}),e.jsxs(oe,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:He.success,fontWeight:600,fontSize:24},children:ye(E)}),e.jsx("small",{style:{paddingLeft:4},children:r("notification.sendStatus.success")})]}),e.jsxs(R,{className:"unsent-area",children:[e.jsxs(R,{children:[e.jsxs(de,{config:{status:"failed"},enableTooltip:!1,children:[ye(I)," ",r("notification.sendStatus.failed")]}),e.jsxs(de,{config:{status:"pending"},enableTooltip:!1,children:[ye(j)," ",r("notification.sendStatus.pending")]})]}),I>0&&e.jsx(R,{className:"resend-btn",children:e.jsx(me,{size:"small",color:"primary",loading:l,variant:"contained",startIcon:e.jsx(Ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:C,children:r("notification.resend")})})]})]})}function Le({statistics:n,mode:t="simple",onResend:s,resending:o}){const l=ce(()=>t==="simple"?en(n):tn(n,s,o),[n,t]);return t==="simple"?e.jsx("div",{children:l.map(r=>e.jsx(Tt,{style:{alignItems:"flex-start",marginBottom:t==="simple"?0:16},valueComponent:"div",nameWidth:100,name:r.name,children:r.value},r.name))}):e.jsx(lt,{container:!0,spacing:2,children:l.map(r=>e.jsx(lt,{item:!0,md:4,sm:6,xs:12,children:r.value},r.name))})}const sn=ue(R)`
31
+ display: flex;
32
+ flex-direction: column;
33
+ align-items: flex-start;
34
+ padding: 16px;
35
+ border-radius: 8px;
36
+ background: ${({successRatio:n,failedRatio:t,theme:s})=>n===0&&t===0?s.palette.grey[300]:`linear-gradient(to right, ${Kt(s.palette.success.light,.4)} ${n}%, ${s.palette.grey[100]} ${n}%)`};
37
+ transition: 'background 0.5s ease';
38
+ cursor: pointer;
39
+ .unsent-area {
40
+ width: 100%;
41
+ position: relative;
42
+ .resend-btn {
43
+ position: absolute;
44
+ right: 0;
45
+ bottom: 0;
46
+ }
47
+ }
48
+ `;Bt.propTypes={notification:x.object.isRequired,onCancel:x.func,blocklet:x.object.isRequired,tab:x.string};function Bt({notification:n,onCancel:t=()=>{},blocklet:s,tab:o="info"}){const{t:l,locale:r}=le(),{getComponent:S,resendNotification:p}=Qe(),[m,a]=T.useState(!1),E=ce(()=>S(n.componentDid)||s,[s,n.componentDid]),I=Ce({tab:o||"info"}),j=T.useCallback(async(d,g,b=!0,D=[])=>{var i;if(!d.length||!n.id)return;const F=g.length>0?g:(i=n==null?void 0:n.receivers)==null?void 0:i.map(h=>h.receiver);if(!F.length)return;let _=[...d];if(_.includes(W.NOTIFICATION_SEND_CHANNEL.PUSH)&&!kt(s)&&(M.warning(l("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),_=_.filter(h=>h!==W.NOTIFICATION_SEND_CHANNEL.PUSH)),_.includes(W.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!_t(s)&&(M.warning(l("notification.sendStatus.reason.unavailable",{channel:"Email"})),_=_.filter(h=>h!==W.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!_.length)try{a(!0),await p({notificationId:n.id,receivers:F,channels:_,resendFailedOnly:b,..._.includes("webhook")&&D.length?{webhookUrls:D}:{}}),M.success("Message has been sent!")}catch(h){console.error("handleResend error",{error:h}),M.error(h.response?h.response.statusText:h.message)}finally{a(!1)}},[s,n.id,n==null?void 0:n.receivers,p,l]),C=ce(()=>rs(n),[n]),O=ce(()=>os(n),[n]),z=ce(()=>C?n==null?void 0:n.actorInfo:[],[n]),L=ce(()=>{var d;return(s==null?void 0:s.did)||((d=s==null?void 0:s.meta)==null?void 0:d.did)||""},[s]);function U(){return[{name:l("notification.from"),value:C&&O?e.jsx(ps,{actors:z,teamDid:L,size:32,showName:!0}):e.jsx(fs,{size:32,blocklet:E,showName:!0,hideDot:!0})},{name:l("notification.notificationTitle"),value:e.jsx(we,{maxLength:50,children:n.title})},{name:l("notification.body"),value:C?e.jsx(ms,{notification:n,blocklet:s}):e.jsx(hs,{notification:n,rows:0})},{name:l("notification.severity"),value:e.jsx(Re,{severity:n.severity})},{name:l("notification.createdAt"),value:e.jsx(ts,{value:n.createdAt,locale:r,shouldUpdate:!0,type:"all"})}].map(g=>e.jsx(Tt,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:g.name,children:g.value},g.name))}const $={info:{label:l("common.basicInfo"),value:"info",component:U},receivers:{label:l("notification.receiver"),value:"receivers"},statistics:{label:l("notification.statistics"),value:"statistics"}},Q=Object.values($).map(({label:d,value:g})=>({label:d,value:g})),B=$[I.tab]||$.info,q=d=>{I.tab=d};return e.jsx(Ct,{title:l("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{I.tab="info",t()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(an,{children:[e.jsx(R,{mx:3,className:"tabs",children:e.jsx(vt,{tabs:Q,current:I.tab,onChange:q,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[I.tab==="receivers"&&e.jsx(Xs,{notificationId:n.id,resending:m,handleResend:j}),I.tab==="statistics"&&e.jsx(Le,{statistics:n.statistics,mode:"detail",resending:m,onResend:j}),I.tab==="info"&&e.jsx(B.component,{})]})]})})}const nn=T.memo(Bt),an=ue.div`
49
+ & > .notification-row {
50
+ padding: 0;
51
+ }
52
+
53
+ .tabs {
54
+ margin: 0;
55
+ }
56
+ .body {
57
+ margin-top: 16px;
58
+ }
59
+
60
+ .channel-item {
61
+ display: flex;
62
+ padding: 4px;
63
+ justify-content: flex-start;
64
+ align-items: center;
65
+ gap: 8px;
66
+ > p {
67
+ font-size: 15px;
68
+ }
69
+ .resend-btn {
70
+ svg {
71
+ font-size: 16px;
72
+ }
73
+ display: flex;
74
+ align-items: center;
75
+ font-size: 12px;
76
+ cursor: pointer;
77
+ &.disabled {
78
+ cursor: not-allowed;
79
+ color: ${Ee.text.disabled};
80
+ }
81
+ }
82
+ }
83
+ `;Se.propTypes={blocklet:x.object,label:x.string};Se.defaultProps={blocklet:null,label:""};const rn=ue.div`
84
+ display: flex;
85
+ justify-items: flex-start;
86
+ align-items: center;
87
+ gap: 8px;
88
+ .name {
89
+ display: block;
90
+ max-width: 260px;
91
+ white-space: nowrap;
92
+ overflow: hidden;
93
+ text-overflow: ellipsis;
94
+ }
95
+ `;function Se({blocklet:n,label:t}){var s;return e.jsx(rn,{children:n?e.jsxs(e.Fragment,{children:[e.jsx(It,{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})})}ot.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};ot.defaultProps={onDelete:()=>{}};function ot({list:n,label:t,onDelete:s}){return e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(oe,{children:[t,": "]}),n.map(o=>e.jsx(Je,{size:"small",label:e.jsx(R,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(Re,{severity:o})}),onDelete:l=>s(l,o)},o))]})}function on(n){return e.jsx(nt,{...n,renderLabel:t=>e.jsx(Re,{severity:t})})}function ln({customTableButtons:n}){var pe;const{t,locale:s}=le(),[o,l]=T.useState(!1),{data:r,paging:S,blocklet:p,fetch:m,getComponent:a,componentDids:E,inService:I,teamDid:j}=Qe(),C=T.useRef(null),[O,z]=T.useState(null),[L,U]=T.useState("info"),$=vs(),[Q,B]=T.useState(!1),q=`notification-records-${(pe=p.meta)==null?void 0:pe.did}`,d=ss(q),[g,b]=T.useState({pageSize:d.rowsPerPage||10,page:d.page?d.page+1:1,dids:d.dids||[],dateRange:d.dateRange||[ne().subtract(1,"month").startOf("day").toDate(),ne().endOf("day").toDate()]}),D=ce(()=>{if(!p.children||!p.children.length)return[];const y=[];return p.children.forEach(v=>{var N;const w=v.did||((N=v.meta)==null?void 0:N.did);E.includes(w)&&(v.ancestors=[p],y.push(v))}),y},[E,p]),F=async y=>{try{l(!0),await m(y),l(!1)}finally{l(!1)}};T.useEffect(()=>{F(g)},[g]),T.useEffect(()=>{const y=r.find(v=>v.id===(O==null?void 0:O.id));O&&y&&z({...y})},[r]);const _=(y,v,w,N)=>{y.stopPropagation();const P=w.filter(k=>k!==v);b(k=>({...k,[N]:P,page:1}))},i=({page:y,rowsPerPage:v,filterList:w})=>{const[N=[],,,,P=[]]=w;g.pageSize!==v?b(k=>({...k,pageSize:v,page:1})):g.page!==y+1?b(k=>({...k,page:y+1})):je(g.dids,N)?je(g.severities,P)||b(k=>({...k,severities:P,page:1})):b(k=>({...k,dids:N,page:1}))},h=T.useCallback(()=>{z(null),U("info")},[]),H=T.useCallback(()=>{m(g)},[m,g]),V=[{label:t("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:y=>y.map((v,w)=>{var P;if(v==="system")return e.jsx("span",{children:t("notification.system")},`system-${w}`);const N=D.find(k=>{var c;return(k.did||((c=k.meta)==null?void 0:c.did))===v});return e.jsx(Se,{blocklet:N,label:(N==null?void 0:N.title)||((P=N==null?void 0:N.meta)==null?void 0:P.title)},v)}),update:(y,v,w)=>(y[w].splice(v,1),y)},filterOptions:{names:D,logic:(y,v)=>v.length?!v.includes(y):!1,display:(y,v,w,N)=>e.jsxs(Y,{style:{width:"380px"},children:[e.jsx(Mt,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs($t,{multiple:!0,value:y[w],renderValue:P=>e.jsx(R,{display:"flex",gap:1,alignItems:"center",style:{overflow:"hidden",textOverflow:"ellipsis"},children:P.map(k=>{var c;if(k==="system")return e.jsx("span",{children:t("notification.system")},k);const ae=D.find(u=>{var A;return(u.did||((A=u.meta)==null?void 0:A.did))===k});return e.jsx(Se,{blocklet:ae,label:(ae==null?void 0:ae.title)||((c=ae==null?void 0:ae.meta)==null?void 0:c.title)},k)})}),onChange:P=>{y[w]=P.target.value,v(y[w],w,N)},children:[e.jsx(ct,{value:"system",children:t("notification.system")}),D.map(P=>{var ae,c;const k=P.did||((ae=P.meta)==null?void 0:ae.did);return e.jsx(ct,{value:k,children:e.jsx(Se,{blocklet:P,label:P.title||((c=P.meta)==null?void 0:c.title)})},k)})]})]})},customBodyRenderLite:y=>{var N,P;const v=r[y],w=a(v.componentDid);return e.jsxs(R,{display:"flex",alignItems:"center",gap:1,children:[w?e.jsx(It,{size:32,blocklet:w,ancestors:w.ancestors??[]}):e.jsx(xs,{blocklet:p,size:32}),e.jsx(we,{maxLength:50,children:((N=w==null?void 0:w.meta)==null?void 0:N.title)||((P=p==null?void 0:p.meta)==null?void 0:P.title)})]})}}},{label:t("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:y=>{const v=r[y],{receivers:w}=v;return e.jsx(Ut,{total:w.length,renderSurplus:N=>N<100?e.jsxs("span",{children:["+",N]}):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:N=>{N.stopPropagation(),z(v),U("receivers")},children:w.map(N=>{const{receiverUser:P}=N,k=Et(P.avatar,j,I);return e.jsx(yt,{alt:P.fullName,src:`${k}?imageFilter=resize&w=48&h=48`,size:32,did:N.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},N.receiver)})})}}},{label:t("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:y=>{const v=r[y];return e.jsx(R,{onClick:w=>{w.stopPropagation(),z(v),U("statistics")},children:e.jsx(Le,{statistics:v.statistics})})}}},{label:t("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:y=>{const v=r[y];return e.jsx(we,{maxLength:50,children:v.title})}}},{label:t("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:y=>{const v=r[y];return e.jsx(Re,{severity:v.severity})},filter:!0,filterType:"custom",filterList:g.severities??[],customFilterListOptions:{render:y=>e.jsx(ot,{list:y,label:t("notification.severity"),onDelete:(v,w)=>{v.stopPropagation(),_(v,w,V[4].options.filterList,"severities")}}),update:Ie},filterOptions:{names:pt,fullWidth:!0,logic:Ae,display:(y,v,w,N)=>e.jsx(on,{label:t("notification.severity"),filterList:y,onChange:v,index:w,column:N,filterValues:pt})}}},{label:t("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:y=>{const{createdAt:v}=r[y];return e.jsx(Nt,{value:v,locale:s,shouldUpdate:!0})}}}],ie=y=>{b(v=>({...v,dateRange:y,page:1}))},re=[e.jsxs(R,{display:"flex",alignItems:"center",gap:1.5,children:[e.jsx(Ht,{onClick:()=>B(!0),sx:{p:$?0:void 0},children:e.jsx(is,{})},"settings"),$?e.jsx(oe,{children:t("common.setting")}):null]}),...n||[]];return e.jsxs(R,{ref:C,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(cn,{children:e.jsx(gt,{theme:Ft(),children:e.jsx(St,{className:"main-table",verticalKeyWidth:100,loading:o,locale:s,columns:V,data:r,durable:q,onChange:i,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:S.page-1,rowsPerPage:S.pageSize,count:S.total,...d,onRowClick:(y,{dataIndex:v})=>{z(r[v])}},customPreButtons:[e.jsx(it,{value:g.dateRange,onChange:ie})],customButtons:re,components:{TableFilterList:y=>e.jsx(at,{...y,itemComponent:v=>e.jsx(De,{...v,canDelete:w=>{var P;const N=(P=w==null?void 0:w.columnNames)==null?void 0:P[(w==null?void 0:w.index)||0];return(N==null?void 0:N.name)==="sender"}})})}})})}),O&&e.jsx(nn,{refresh:H,onCancel:h,notification:O,blocklet:p,tab:L}),e.jsx(Ct,{title:`${t("common.notification")} ${t("common.setting")}`,fullWidth:!0,maxWidth:"md",open:Q,onClose:()=>B(!1),PaperProps:{style:{minHeight:"500px"}},children:e.jsx(R,{sx:{mt:"-16px",overflowY:"hidden"},children:e.jsx(Is,{})})})]})}const cn=ue.div`
96
+ td.MuiTableCell-footer {
97
+ border: none !important;
98
+ }
99
+ .sent-status-cell {
100
+ .resend-btn {
101
+ display: none;
102
+ }
103
+ &:hover {
104
+ .resend-btn {
105
+ display: flex;
106
+ }
107
+ }
108
+ }
109
+
110
+ .custom-toobar-btns {
111
+ gap: 4px;
112
+ }
113
+ `;Wt.propTypes={blocklet:x.object.isRequired,customTableButtons:x.array};Wt.defaultProps={customTableButtons:[]};function Wt({blocklet:n={},customTableButtons:t}){return e.jsx(Os,{blocklet:n,children:e.jsx(ln,{customTableButtons:t})})}export{Wt as default};
@@ -1,4 +1,4 @@
1
- import{H as i,ah as v,j as s,bI as A,aa as N,ab as D,s as E}from"./vendor-mui-core-UZpb7wT7.js";import{a as $,l as M,u as b,m as q}from"./vendor-hooks-rDgu5KV9.js";import{a as F,R as H}from"./vendor-arcblock-CN2B_oTr.js";import{r as m}from"./vendor-react-DEoibe3W.js";import{b2 as U,am as B,u as j,aR as O,j as Y,b3 as S,Z as W}from"./vendor-ux-did-connect-TEE6cGq6.js";import{t as V,v as X,w as L,x as z}from"./index-u-w3iMC9.js";import{A as J}from"./vendor-utils-rHXShPKm.js";import{u as K}from"./use-passport-id-B-b-_oYF.js";import{u as Z}from"./session-6XaVDQaE.js";import{b as G}from"./sdk-7yPC_DtN.js";import{d as Q}from"./CheckCircle-Dvhgeo9j.js";import{w as ee}from"./wrap-locale-DZ79GW_G.js";function P({invitation:e,createPassportSvg:a,passportColor:c}){const[p,n]=m.useState(!1),{t}=m.useContext(U),l=m.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),u=m.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c,extra:e.passportExpireTime?{key:"Exp",value:V(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,l]),x=m.useCallback(()=>{n(!0)},[]),r=m.useCallback(()=>{n(!1)},[]);return s.jsxs(s.Fragment,{children:[s.jsx(se,{children:s.jsxs("div",{className:"invite-passport__card",onClick:x,children:[!!e.display&&s.jsx(F,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&s.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:u}})]})}),s.jsx(B,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:r,children:e.role.permissions&&e.role.permissions.length>0?s.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(o=>s.jsx("li",{style:{listStyle:"circle"},children:o.description},o.name))}):s.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[s.jsx(A,{style:{width:"30px",height:"30px"}}),s.jsx("div",{children:t("invite.emptyPermission")})]})})]})}P.propTypes={invitation:i.object.isRequired,createPassportSvg:i.func.isRequired,passportColor:i.string};P.defaultProps={passportColor:"auto"};const se=v.div`
1
+ import{H as i,ah as v,j as s,bI as A,aa as N,ab as D,s as E}from"./vendor-mui-core-D_bnq77o.js";import{a as $,l as M,u as b,m as q}from"./vendor-hooks-rDgu5KV9.js";import{a as F,R as H}from"./vendor-arcblock-uz9DVywv.js";import{r as m}from"./vendor-react-DEoibe3W.js";import{b2 as U,am as B,u as j,aR as O,j as Y,b3 as S,Z as W}from"./vendor-ux-did-connect-DHrruicZ.js";import{t as V,v as X,w as L,x as z}from"./index-DefO2n6z.js";import{A as J}from"./vendor-utils-rHXShPKm.js";import{u as K}from"./use-passport-id-B-b-_oYF.js";import{u as Z}from"./session-CHdTc1We.js";import{b as G}from"./sdk-9eXJSWHG.js";import{d as Q}from"./CheckCircle-Ds4QI0ey.js";import{w as ee}from"./wrap-locale-B9TkXFQe.js";function P({invitation:e,createPassportSvg:a,passportColor:c}){const[p,n]=m.useState(!1),{t}=m.useContext(U),l=m.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),u=m.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c,extra:e.passportExpireTime?{key:"Exp",value:V(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,l]),x=m.useCallback(()=>{n(!0)},[]),r=m.useCallback(()=>{n(!1)},[]);return s.jsxs(s.Fragment,{children:[s.jsx(se,{children:s.jsxs("div",{className:"invite-passport__card",onClick:x,children:[!!e.display&&s.jsx(F,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&s.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:u}})]})}),s.jsx(B,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:r,children:e.role.permissions&&e.role.permissions.length>0?s.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(o=>s.jsx("li",{style:{listStyle:"circle"},children:o.description},o.name))}):s.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[s.jsx(A,{style:{width:"30px",height:"30px"}}),s.jsx("div",{children:t("invite.emptyPermission")})]})})]})}P.propTypes={invitation:i.object.isRequired,createPassportSvg:i.func.isRequired,passportColor:i.string};P.defaultProps={passportColor:"auto"};const se=v.div`
2
2
  display: flex;
3
3
  max-width: 350px;
4
4
  margin: 30px auto;
@@ -1 +1 @@
1
- import{j as i,aa as g}from"./vendor-mui-core-UZpb7wT7.js";import{f as x,r as u}from"./vendor-react-DEoibe3W.js";import{u as v}from"./vendor-hooks-rDgu5KV9.js";import{I as w}from"./invitation-CKfllvl5.js";import{L as I}from"./landing-page-q-KgqE9Q.js";import{u as S,aT as T,j}from"./vendor-ux-did-connect-TEE6cGq6.js";import{H as P}from"./vendor-arcblock-CN2B_oTr.js";import{g as k}from"./get-safe-url-2RcRY8gU.js";import{u as E,d as L,c as R,s as W,a as C}from"./index-u-w3iMC9.js";import"./vendor-utils-rHXShPKm.js";import"./use-passport-id-B-b-_oYF.js";import"./session-6XaVDQaE.js";import"./sdk-7yPC_DtN.js";import"./CheckCircle-Dvhgeo9j.js";import"./wrap-locale-DZ79GW_G.js";import"./lottie-web-jYmAQWuC.js";function y(c){var r;const m=x(),{searchParams:s}=new URL(window.location.href),{api:p,session:d}=E(),{t:f}=S(),a=s.get("inviteId"),n=s.get("redirect"),h=u.useCallback(async()=>{const{data:t}=await L.get("invitation",{params:{inviteId:a}});return t},[a]),l=v(async(t,o=e=>e)=>{t&&(W(o(t.sessionToken)),C(o(t.refreshToken)),t.visitorId&&T(o(t.visitorId))),await d.refresh(),setTimeout(()=>{if(n){const e=decodeURIComponent(n);e.startsWith(j.WELLKNOWN_SERVICE_PATH_PREFIX)?m(e,{replace:!0}):window.location.href=k(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(I,{did:(r=window.blocklet)==null?void 0:r.appPid,children:[i.jsx(P,{children:i.jsx("title",{children:f("pageTitle.invite")})}),i.jsx(g,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...c,getDataFn:h,checkFn:p.get,createPassportSvg:t=>R({...t}),onLoginSuccess:l,inService:!0})})]})}export{y as default};
1
+ import{j as i,aa as g}from"./vendor-mui-core-D_bnq77o.js";import{f as x,r as u}from"./vendor-react-DEoibe3W.js";import{u as v}from"./vendor-hooks-rDgu5KV9.js";import{I as w}from"./invitation-1bsb30Yz.js";import{L as I}from"./landing-page-Due4o1uF.js";import{u as S,aT as T,j}from"./vendor-ux-did-connect-DHrruicZ.js";import{H as P}from"./vendor-arcblock-uz9DVywv.js";import{g as k}from"./get-safe-url-B5RJTMjC.js";import{u as E,d as L,c as R,s as W,a as C}from"./index-DefO2n6z.js";import"./vendor-utils-rHXShPKm.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CHdTc1We.js";import"./sdk-9eXJSWHG.js";import"./CheckCircle-Ds4QI0ey.js";import"./wrap-locale-B9TkXFQe.js";import"./lottie-web-jYmAQWuC.js";function y(c){var r;const m=x(),{searchParams:s}=new URL(window.location.href),{api:p,session:d}=E(),{t:f}=S(),a=s.get("inviteId"),n=s.get("redirect"),h=u.useCallback(async()=>{const{data:t}=await L.get("invitation",{params:{inviteId:a}});return t},[a]),l=v(async(t,o=e=>e)=>{t&&(W(o(t.sessionToken)),C(o(t.refreshToken)),t.visitorId&&T(o(t.visitorId))),await d.refresh(),setTimeout(()=>{if(n){const e=decodeURIComponent(n);e.startsWith(j.WELLKNOWN_SERVICE_PATH_PREFIX)?m(e,{replace:!0}):window.location.href=k(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(I,{did:(r=window.blocklet)==null?void 0:r.appPid,children:[i.jsx(P,{children:i.jsx("title",{children:f("pageTitle.invite")})}),i.jsx(g,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...c,getDataFn:h,checkFn:p.get,createPassportSvg:t=>R({...t}),onLoginSuccess:l,inService:!0})})]})}export{y as default};
@@ -1 +1 @@
1
- import{j as e,ab as w,aa as v}from"./vendor-mui-core-UZpb7wT7.js";import{a as T,m as I,u as p}from"./vendor-hooks-rDgu5KV9.js";import{I as P}from"./invitation-CKfllvl5.js";import{L as j}from"./landing-page-q-KgqE9Q.js";import{u as k,aT as R,j as S}from"./vendor-ux-did-connect-TEE6cGq6.js";import{H as L}from"./vendor-arcblock-CN2B_oTr.js";import{g as E}from"./get-safe-url-2RcRY8gU.js";import{u as C,c as W,s as F,a as N}from"./index-u-w3iMC9.js";import{f as H}from"./vendor-react-DEoibe3W.js";import"./vendor-utils-rHXShPKm.js";import"./use-passport-id-B-b-_oYF.js";import"./session-6XaVDQaE.js";import"./sdk-7yPC_DtN.js";import"./CheckCircle-Dvhgeo9j.js";import"./wrap-locale-DZ79GW_G.js";import"./lottie-web-jYmAQWuC.js";function Q(f){var m;const{searchParams:a}=new URL(window.location.href),{api:r,session:d}=C(),u=H(),{t:h}=k(),n=a.get("id"),c=a.get("redirect"),g=T({state:""}),s=I(async()=>{if(!n)return null;const{data:t}=await r.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),l=p(()=>{if(s.error)throw s.error;return s==null?void 0:s.data}),x=p(async(t,i=o=>o)=>{t&&(t.sessionToken&&F(i(t.sessionToken)),t.refreshToken&&N(i(t.refreshToken)),t.visitorId&&R(i(t.visitorId)),await d.refresh()),setTimeout(()=>{if(c){const o=decodeURIComponent(c);o.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?u(o,{replace:!0}):window.location.href=E(o)}else window.location.href=window.env.pathPrefix||"/"},50)});return s.loading?e.jsx(w,{}):e.jsxs(j,{did:(m=window.blocklet)==null?void 0:m.appPid,children:[e.jsx(L,{children:e.jsx("title",{children:h("pageTitle.issuePassport")})}),e.jsx(v,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(P,{...f,action:"issue-passport",getDataFn:l,checkFn:r.get,createPassportSvg:W,onLoginSuccess:x,inService:!0,status:g.state})})]})}export{Q as default};
1
+ import{j as e,ab as w,aa as v}from"./vendor-mui-core-D_bnq77o.js";import{a as T,m as I,u as p}from"./vendor-hooks-rDgu5KV9.js";import{I as P}from"./invitation-1bsb30Yz.js";import{L as j}from"./landing-page-Due4o1uF.js";import{u as k,aT as R,j as S}from"./vendor-ux-did-connect-DHrruicZ.js";import{H as L}from"./vendor-arcblock-uz9DVywv.js";import{g as E}from"./get-safe-url-B5RJTMjC.js";import{u as C,c as W,s as F,a as N}from"./index-DefO2n6z.js";import{f as H}from"./vendor-react-DEoibe3W.js";import"./vendor-utils-rHXShPKm.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CHdTc1We.js";import"./sdk-9eXJSWHG.js";import"./CheckCircle-Ds4QI0ey.js";import"./wrap-locale-B9TkXFQe.js";import"./lottie-web-jYmAQWuC.js";function Q(f){var m;const{searchParams:a}=new URL(window.location.href),{api:r,session:d}=C(),u=H(),{t:h}=k(),n=a.get("id"),c=a.get("redirect"),g=T({state:""}),s=I(async()=>{if(!n)return null;const{data:t}=await r.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),l=p(()=>{if(s.error)throw s.error;return s==null?void 0:s.data}),x=p(async(t,i=o=>o)=>{t&&(t.sessionToken&&F(i(t.sessionToken)),t.refreshToken&&N(i(t.refreshToken)),t.visitorId&&R(i(t.visitorId)),await d.refresh()),setTimeout(()=>{if(c){const o=decodeURIComponent(c);o.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?u(o,{replace:!0}):window.location.href=E(o)}else window.location.href=window.env.pathPrefix||"/"},50)});return s.loading?e.jsx(w,{}):e.jsxs(j,{did:(m=window.blocklet)==null?void 0:m.appPid,children:[e.jsx(L,{children:e.jsx("title",{children:h("pageTitle.issuePassport")})}),e.jsx(v,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(P,{...f,action:"issue-passport",getDataFn:l,checkFn:r.get,createPassportSvg:W,onLoginSuccess:x,inService:!0,status:g.state})})]})}export{Q as default};