@abtnode/blocklet-services 1.17.7-beta-20251230-041316-624cafaf → 1.17.7-beta-20260103-230139-51fc594d

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 (173) hide show
  1. package/api/libs/auth/adapters/apple.js +1 -1
  2. package/api/libs/auth/adapters/auth0.js +1 -1
  3. package/api/libs/auth/adapters/github.js +1 -1
  4. package/api/libs/auth/adapters/google.js +1 -1
  5. package/api/routes/csp-proxy.js +1 -1
  6. package/api/routes/oauth/client.js +13 -4
  7. package/api/routes/user.js +2 -2
  8. package/dist/assets/{AdapterDayjs-C98qzmYr.js → AdapterDayjs-CIz_EOtQ.js} +1 -1
  9. package/dist/assets/{Google-BS4rB0yL.js → Google-UUKF9aLU.js} +1 -1
  10. package/dist/assets/{access-control-Zb1P0A-c.js → access-control-BvVaKG93.js} +1 -1
  11. package/dist/assets/{add-component-core-rrD3IVuo.js → add-component-core-DuwLtUBl.js} +1 -1
  12. package/dist/assets/{add-resource-HYp41Mey.js → add-resource-DSF4-AYI.js} +1 -1
  13. package/dist/assets/{addon-RL_2cpli.js → addon-CAO5ZUVe.js} +2 -2
  14. package/dist/assets/{advanced-DnipDVXM.js → advanced-D-_qy4C4.js} +1 -1
  15. package/dist/assets/{aigne-B-BPMYqb.js → aigne-B-7qxD7r.js} +1 -1
  16. package/dist/assets/{appearance-DkPwHUmp.js → appearance-DpKwY0o1.js} +1 -1
  17. package/dist/assets/{ar-B4BSOV5G.js → ar-BukCw0OI.js} +1 -1
  18. package/dist/assets/{audit-logs-Qew52P05.js → audit-logs-BW1TvN0z.js} +1 -1
  19. package/dist/assets/{authorize-BlsrYBvj.js → authorize-BwNdnPft.js} +1 -1
  20. package/dist/assets/{base32-DYZff-KX.js → base32-CmNHdxL7.js} +1 -1
  21. package/dist/assets/{bind-account-Dhqzfttk.js → bind-account-DOG2XJ6s.js} +1 -1
  22. package/dist/assets/{branding-BNZPiOIW.js → branding-40UKivXV.js} +1 -1
  23. package/dist/assets/{branding-0WzFBgOW.js → branding-CUwzFTtf.js} +1 -1
  24. package/dist/assets/{branding-BuYkrJWP.js → branding-lvlhWE2R.js} +1 -1
  25. package/dist/assets/{bundle-avatar-0OtNVOJk.js → bundle-avatar-DJ_-4AO_.js} +1 -1
  26. package/dist/assets/{button-CDwRocVM.js → button-82FUWQ2H.js} +1 -1
  27. package/dist/assets/{click-to-copy-CoAdDvF3.js → click-to-copy-CBd8B_uk.js} +1 -1
  28. package/dist/assets/{complete-CJbh7iao.js → complete-DCZaPQL5.js} +1 -1
  29. package/dist/assets/{component-BXc-kqPT.js → component-CIlZ9gz_.js} +2 -2
  30. package/dist/assets/{config-CH0_ZbU7.js → config-BFSglxmm.js} +1 -1
  31. package/dist/assets/{config-D2U-Xwer.js → config-DCwReZ_J.js} +1 -1
  32. package/dist/assets/{config-BGjhG44Z.js → config-Dzr61Ovu.js} +1 -1
  33. package/dist/assets/{config-navigation-zHWUBjBW.js → config-navigation-D47x55_t.js} +2 -2
  34. package/dist/assets/{config-space-BR-bgToj.js → config-space-D2mAEqFL.js} +1 -1
  35. package/dist/assets/{confirm-CQcou-U0.js → confirm-DQlu79Sm.js} +1 -1
  36. package/dist/assets/{connect-DGgUqebM.js → connect-Dd7NRVCL.js} +1 -1
  37. package/dist/assets/{connect-DvKksfqN.js → connect-II0vWvpi.js} +1 -1
  38. package/dist/assets/{connect-to-BkcNrFMt.js → connect-to-B_iWUbwW.js} +1 -1
  39. package/dist/assets/{create-passport-svg-H8kuyoHI.js → create-passport-svg-BwkPTICE.js} +1 -1
  40. package/dist/assets/{createClass-BJjtkRso.js → createClass-DVDZaC6q.js} +1 -1
  41. package/dist/assets/{dashboard-ChfWklE6.js → dashboard-Bu3a5Px4.js} +2 -2
  42. package/dist/assets/{de-EFAP4yzZ.js → de-Br0tDZam.js} +1 -1
  43. package/dist/assets/{delete-confirm-ZZFKP_G2.js → delete-confirm-BIuv3oO4.js} +1 -1
  44. package/dist/assets/{did-address-Di02Kgvg.js → did-address-h4uLp20A.js} +1 -1
  45. package/dist/assets/{domain-C7ik5Hza.js → domain--lKnmb8L.js} +1 -1
  46. package/dist/assets/{domain-action-card-CPXf_2n9.js → domain-action-card-B5bWcTCx.js} +1 -1
  47. package/dist/assets/{domains-D1AXd2xb.js → domains-DTnBb4pb.js} +1 -1
  48. package/dist/assets/{email-C0H5jkk_.js → email-bOQg3Ln3.js} +2 -2
  49. package/dist/assets/engine-_hdQizRi.js +1 -0
  50. package/dist/assets/{es-BqFCfGn2.js → es-D_e0gGgp.js} +1 -1
  51. package/dist/assets/{exchange-passport-Bxf933u4.js → exchange-passport-B8J1z6zW.js} +1 -1
  52. package/dist/assets/{form-BCT1goOE.js → form-DcGl-E0U.js} +1 -1
  53. package/dist/assets/{form-text-input-DLbggucC.js → form-text-input-DNXpKwew.js} +1 -1
  54. package/dist/assets/{fr-CksqMtzK.js → fr-DXizOT4b.js} +1 -1
  55. package/dist/assets/{fuel-DW2SqoXv.js → fuel-tsazXQKp.js} +1 -1
  56. package/dist/assets/{gen-access-key-hcXr_3v-.js → gen-access-key-DrfFQLFL.js} +1 -1
  57. package/dist/assets/{gen-simple-access-key-D_UWgD88.js → gen-simple-access-key-CnP2yUd7.js} +1 -1
  58. package/dist/assets/get-safe-url-DaqBo3hv.js +1 -0
  59. package/dist/assets/{hi-Bztwk-sg.js → hi-D2FEb_Tx.js} +1 -1
  60. package/dist/assets/{home-ZleX7-XZ.js → home-BN59HeAP.js} +1 -1
  61. package/dist/assets/{id-C5p-l7lp.js → id-Dw9URVwP.js} +1 -1
  62. package/dist/assets/{iframe-CFsgaleC.js → iframe-CC7bnIjL.js} +1 -1
  63. package/dist/assets/{index-C9jYw-PP.js → index-55ZI5Xlz.js} +1 -1
  64. package/dist/assets/{index-LlFgIuCt.js → index-5n0QAOjO.js} +1 -1
  65. package/dist/assets/{index-BXRMGGxp.js → index-BDmLm9RE.js} +1 -1
  66. package/dist/assets/{index-BV9eY5c_.js → index-BJ6le4Td.js} +1 -1
  67. package/dist/assets/{index-ByoNLuaN.js → index-BORuOqqa.js} +1 -1
  68. package/dist/assets/{index-CFII0zqE.js → index-Bc7P9fwl.js} +1 -1
  69. package/dist/assets/{index-D9VLhdHJ.js → index-Bg5uZrWj.js} +1 -1
  70. package/dist/assets/{index-BukC8OVR.js → index-BmeJ3mXz.js} +1 -1
  71. package/dist/assets/{index-JzYmPAqa.js → index-ByEZTgqv.js} +1 -1
  72. package/dist/assets/index-ByMKy0IO.js +16 -0
  73. package/dist/assets/index-CH-EXqMX.js +1 -0
  74. package/dist/assets/{index-Bnog6DRk.js → index-CLao_b9r.js} +1 -1
  75. package/dist/assets/{index-BZaW_ZpY.js → index-CNUfol2K.js} +1 -1
  76. package/dist/assets/{index-CvxwAvNV.js → index-CXyo5mo3.js} +1 -1
  77. package/dist/assets/{index-CGG37rzL.js → index-CbjFdIdE.js} +1 -1
  78. package/dist/assets/{index-DQDt6ixh.js → index-CoWxyxJt.js} +1 -1
  79. package/dist/assets/{index-CgwRpRMk.js → index-D0cfNfgL.js} +1 -1
  80. package/dist/assets/{index-DEKD1iEz.js → index-D3AsXyHs.js} +1 -1
  81. package/dist/assets/{index-CjS1scdg.js → index-D4cbtlCM.js} +1 -1
  82. package/dist/assets/{index-FreeXNkk.js → index-DG0EDext.js} +124 -124
  83. package/dist/assets/{index-C5S7RLo3.js → index-DJEbIkF6.js} +4 -4
  84. package/dist/assets/{index-Co_qmPsj.js → index-DMjWlw40.js} +1 -1
  85. package/dist/assets/{index-DCKXgmNi.js → index-DPByvHrj.js} +1 -1
  86. package/dist/assets/{index-BuuPPt_7.js → index-DZyT0N9R.js} +1 -1
  87. package/dist/assets/index-DlTghgU6.js +1 -0
  88. package/dist/assets/{index-Crz9MitX.js → index-ETdrsXsn.js} +2 -2
  89. package/dist/assets/{index-34B-_i4U.js → index-H8MAN7us.js} +1 -1
  90. package/dist/assets/{index-DMZ5Sj4Z.js → index-JhIOETr8.js} +1 -1
  91. package/dist/assets/{index-CwAZTFm0.js → index-keEY0SLH.js} +1 -1
  92. package/dist/assets/{index-C8x3s3XH.js → index-mL2PjDd3.js} +3 -3
  93. package/dist/assets/{invitation-BHrproSe.js → invitation-0lU4EchQ.js} +1 -1
  94. package/dist/assets/{invitations-4w_OzLxr.js → invitations-CSnyD-Wp.js} +1 -1
  95. package/dist/assets/{invite-B-0DaSfe.js → invite-8i_Oru_O.js} +1 -1
  96. package/dist/assets/{isURL-Dsl0-5oi.js → isURL-D4WfF4w_.js} +1 -1
  97. package/dist/assets/{issue-passport-DRq-MGR0.js → issue-passport-Br15qs7n.js} +1 -1
  98. package/dist/assets/{item-B-fZE8cJ.js → item-CwiqvF0e.js} +1 -1
  99. package/dist/assets/{ja-2cGMwCig.js → ja-DBxpsmGJ.js} +1 -1
  100. package/dist/assets/{ko-DDVloIXx.js → ko-CCAdSyce.js} +1 -1
  101. package/dist/assets/{landing-page-ol2He6wT.js → landing-page-q4NMkyjD.js} +1 -1
  102. package/dist/assets/{layout-DP35nSHr.js → layout-CdGgFfY4.js} +1 -1
  103. package/dist/assets/{list-CXg6onZy.js → list-CVN6FKdL.js} +1 -1
  104. package/dist/assets/{list-CRS8_Mwn.js → list-NP-91JKf.js} +1 -1
  105. package/dist/assets/localization-DAE0Xt60.js +1 -0
  106. package/dist/assets/{log-Bdmpld3D.js → log-Cox3P5_L.js} +1 -1
  107. package/dist/assets/logger-BKK0qIc9.js +1 -0
  108. package/dist/assets/{login-4E4VdNcY.js → login-2zmJhcBe.js} +1 -1
  109. package/dist/assets/{login-oauth-callback-B31rNy6b.js → login-oauth-callback-zq4hRJXC.js} +1 -1
  110. package/dist/assets/{logo-uploader-B4RelqSZ.js → logo-uploader-6T6d75Q6.js} +1 -1
  111. package/dist/assets/{lost-passport-CehEmPuN.js → lost-passport-DviehTF2.js} +1 -1
  112. package/dist/assets/{open-window-CxHokgoD.js → open-window-_3kVydQ2.js} +1 -1
  113. package/dist/assets/{over-due-invoice-payment-DB7bedIv.js → over-due-invoice-payment-rAHkUVgY.js} +1 -1
  114. package/dist/assets/overview-DSB1dlE4.js +116 -0
  115. package/dist/assets/{passport-CgVIIIF1.js → passport-DzlmGAGE.js} +1 -1
  116. package/dist/assets/{passport-item-CvEGWX-Y.js → passport-item-DdvT-U5C.js} +1 -1
  117. package/dist/assets/{permission-BdJe7FC0.js → permission-CcdJMHov.js} +1 -1
  118. package/dist/assets/{preferences-Uxu-Ou4V.js → preferences-B3FTkTJx.js} +1 -1
  119. package/dist/assets/{profile-embed-BF_OFULi.js → profile-embed-Ds6zLGgv.js} +1 -1
  120. package/dist/assets/{pt-FIIPCfqU.js → pt-CrMGrBZ6.js} +1 -1
  121. package/dist/assets/{publish-resource-BmcTO-ir.js → publish-resource-CAbbkAX0.js} +1 -1
  122. package/dist/assets/{react-beautiful-dnd.esm-BCE-7CTE.js → react-beautiful-dnd.esm-DDZ1XDH7.js} +1 -1
  123. package/dist/assets/{ru-BjRgz8OF.js → ru-up3R57Pv.js} +1 -1
  124. package/dist/assets/{runtime-Bsl5i2jc.js → runtime-BKJMYAui.js} +1 -1
  125. package/dist/assets/sdk-DkjNLRKY.js +1 -0
  126. package/dist/assets/security-3Y4MabOo.js +22 -0
  127. package/dist/assets/{session-8btKYxMi.js → session-D-wwXXFW.js} +1 -1
  128. package/dist/assets/{setup-DhTuP-SU.js → setup-CgcKBlmf.js} +1 -1
  129. package/dist/assets/{simple-select-l9hMw78x.js → simple-select-qqtCC0US.js} +1 -1
  130. package/dist/assets/{spaces-C8s0ejS4.js → spaces-DGJd1uEt.js} +1 -1
  131. package/dist/assets/{start-D0YkmM3s.js → start-Cu_Xr7Yd.js} +1 -1
  132. package/dist/assets/{starting-progress-rr3ULMDk.js → starting-progress-DpUpXo1N.js} +1 -1
  133. package/dist/assets/{status-CVE6RA_S.js → status-qiMZo73y.js} +1 -1
  134. package/dist/assets/{step-actions-imyD5TuN.js → step-actions-BKMeYA5x.js} +1 -1
  135. package/dist/assets/{studio-Bwc5fhKe.js → studio-BzkFXY4W.js} +1 -1
  136. package/dist/assets/{switch-BK-cb99t.js → switch-CWBW7iKo.js} +1 -1
  137. package/dist/assets/{switch-control-CrDv-a96.js → switch-control-D9D8FbX3.js} +1 -1
  138. package/dist/assets/{table-tips-DLm4KjPB.js → table-tips-B9_goTLn.js} +1 -1
  139. package/dist/assets/{team-DB9e4nhx.js → team-DvyWlb8W.js} +1 -1
  140. package/dist/assets/{th-DKiwQ6t6.js → th-DdNj2Ao6.js} +1 -1
  141. package/dist/assets/{traffic-2gK2nM6D.js → traffic-DsUQQR3F.js} +1 -1
  142. package/dist/assets/{transfer-DLAlz7iv.js → transfer-BU2gLE9m.js} +1 -1
  143. package/dist/assets/{unsubscribe-BLr8bhvE.js → unsubscribe-DpfMHut2.js} +1 -1
  144. package/dist/assets/{use-app-logo-BYRQxVgh.js → use-app-logo-BKJ912HX.js} +1 -1
  145. package/dist/assets/{use-window-close-y1VFPaib.js → use-window-close-BVOSCf9h.js} +1 -1
  146. package/dist/assets/{useLocalStorage-BRElXNq3.js → useLocalStorage-BmGa-RG8.js} +1 -1
  147. package/dist/assets/{user-center-GNfNdqal.js → user-center-8NTN-2CY.js} +5 -5
  148. package/dist/assets/{user-follower-D5UmIVaZ.js → user-follower-C-xe6Fqb.js} +1 -1
  149. package/dist/assets/{util-D8-xR3Bv.js → util-CznlXimv.js} +1 -1
  150. package/dist/assets/{util-BbwZ5cox.js → util-DQmPydCJ.js} +1 -1
  151. package/dist/assets/{vendor-arcblock-hbumvS-z.js → vendor-arcblock-DyliHtVF.js} +1 -1
  152. package/dist/assets/{vendor-ux-B2x-0VyJ.js → vendor-ux-IiqHAjMq.js} +127 -127
  153. package/dist/assets/{vi-C4aNShnq.js → vi-HNh41Xxk.js} +1 -1
  154. package/dist/assets/{wait-connect-Bw-B6lbR.js → wait-connect-Co7Po2HJ.js} +1 -1
  155. package/dist/assets/{wizard-components-CsJ6IStV.js → wizard-components-qCiwxNk8.js} +1 -1
  156. package/dist/assets/{wizard-BrdF6Gnl.js → wizard-tGxr6THv.js} +1 -1
  157. package/dist/assets/wrap-locale-BdDblHwV.js +1 -0
  158. package/dist/assets/{zh-DuMFx3Ce.js → zh-DL3Su93_.js} +1 -1
  159. package/dist/assets/{zh-Cb0McG4r.js → zh-MM5bvwO_.js} +1 -1
  160. package/dist/assets/{zh-tw-PfYv9beR.js → zh-tw-Dr5DyPwA.js} +1 -1
  161. package/dist/index.html +1 -1
  162. package/package.json +32 -32
  163. package/dist/assets/engine-CTCpNUzB.js +0 -1
  164. package/dist/assets/get-safe-url-DxpqHRQ1.js +0 -1
  165. package/dist/assets/index-0SUQD3K4.js +0 -16
  166. package/dist/assets/index-B8zAb7Hc.js +0 -1
  167. package/dist/assets/index-Cy2nGhzX.js +0 -1
  168. package/dist/assets/localization-Bzyury17.js +0 -1
  169. package/dist/assets/logger-BGCPh37O.js +0 -1
  170. package/dist/assets/overview-C7rRlFBy.js +0 -116
  171. package/dist/assets/sdk-CHfXvAIT.js +0 -1
  172. package/dist/assets/security-Clz2lIto.js +0 -22
  173. package/dist/assets/wrap-locale-C87TTgDu.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as i}from"./vendor-react-CTtPmzVP.js";import{V as k,$ as E,aX as L,bb as M}from"./vendor-ux-IiqHAjMq.js";import{q as y}from"./vendor-hooks-qxhUUbW5.js";import{j as e,ak as s,a6 as S,aZ as w,b6 as P,y as W,x as _,bZ as B,M as D,T as z,bb as A,I as K,cC as N,Q as F,W as q}from"./vendor-mui-core-DnR6WYuU.js";import{c as T,Z as C}from"./index-DG0EDext.js";import{C as U}from"./vendor-utils-CxWN1dT3.js";import{a as V}from"./api-FQQlzPOP.js";import{T as Z}from"./table-tips-B9_goTLn.js";import{b as G}from"./team-DvyWlb8W.js";import{u as H}from"./session-D-wwXXFW.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DyliHtVF.js";import"./use-mobile-BINJTzMb.js";import"./isURL-D4WfF4w_.js";import"./use-app-logo-BKJ912HX.js";function R({endpoint:l}){const[t,a]=i.useState("mcp-link"),x=C(),{api:h}=C(),{teamDid:m}=G(),{t:c,locale:p}=k(),{session:r}=H(),{data:u,run:o,loading:b}=y(()=>{const f={owner:T.SERVER_ROLES.ADMIN}[r?.user?.role]||r?.user?.role;return h.createAccessKey({input:{teamDid:m,passport:f,authType:"simple",remark:"Generated by MCP Servers"}})},{manual:!0}),{imgPrefix:n}=x,j=i.useMemo(()=>[{icon:e.jsx(s,{sx:{width:20,height:20},children:"🔗"}),value:"mcp-link",label:"MCP Link"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/claude.webp`,alt:"Claude",sx:{width:20,height:20}}),value:"claude",label:"Claude"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/cursor.png`,alt:"Cursor",sx:{width:20,height:20}}),value:"cursor",label:"Cursor"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/cline.png`,alt:"Cline",sx:{width:20,height:20}}),value:"cline",label:"Cline"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/roocline.png`,alt:"Roo Cline",sx:{width:20,height:20}}),value:"roo-cline",label:"Roo Cline"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/windsurf.png`,alt:"Windsurf",sx:{width:20,height:20}}),value:"windsurf",label:"Windsurf"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/witsy.png`,alt:"Witsy",sx:{width:20,height:20}}),value:"witsy",label:"Witsy"}],[n]),v=j.find(d=>d.value===t),g=i.useMemo(()=>u?.data?.accessKeySecret,[u]),$=i.useMemo(()=>!g&&t!=="mcp-link",[g,t]),I=d=>{const f=`npx @blocklet/install-mcp@latest i ${l} --client ${d} --streamableHTTP --oauth2Bearer ${g}`;switch(d){case"cursor":case"claude":case"cline":case"roo-cline":case"windsurf":case"witsy":return f;case"mcp-link":default:return l}};return e.jsxs(s,{className:"mcp-servers-container",children:[e.jsx(L,{tabs:j,current:t,onChange:a,scrollButtons:"auto",iconPosition:"start"}),e.jsxs(s,{children:[e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(z,{component:"span",variant:"h6",sx:{fontWeight:"bold",my:2},children:t==="mcp-link"?v?.label:`${v?.label} ${c("installCommand")}`}),t!=="mcp-link"&&e.jsx(A,{href:`https://www.arcblock.io/docs/blocklet-developer/${p}/mcp-${t}`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(K,{size:"small",children:e.jsx(N,{fontSize:"small"})})})]}),e.jsxs(s,{className:"mcp-servers-codeblock",sx:{position:"relative","& pre":{borderRadius:1},"& .codeblock__inner":{overflow:"auto !important",borderRadius:1}},children:[e.jsx(M,{code:I(t),language:"shell",style:{margin:0},showDefaultText:!1}),$&&e.jsx(s,{sx:{position:"absolute",top:0,right:0,left:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"action.active",backdropFilter:"blur(3px)",WebkitBackdropFilter:"blur(3px)",zIndex:1},children:b?e.jsx(S,{}):e.jsx(F,{variant:"contained",color:"primary",onClick:o,size:"small",children:`${c("common.generate")} ${c("command")}`})})]})]})]})}R.propTypes={endpoint:q.string.isRequired};function de(){const[l,t]=i.useState(null),{t:a,locale:x}=k(),h=U(T.WELLKNOWN_SERVICE_PATH_PREFIX,"/mcp/servers"),{data:m,loading:c,error:p}=y(()=>Promise.all([V.get(h)])),r=i.useMemo(()=>m?.[0]?.data?.servers||[],[m]);i.useEffect(()=>{r?.length&&t(r.find(o=>o.did===window?.blocklet?.did)||r[0])},[r]);const u=o=>{const b=o.target.value;t(r.find(n=>n.did===b))};return c?e.jsx(s,{children:e.jsx(S,{})}):p?e.jsx(w,{color:"error",children:p?.message}):r?.length?e.jsxs(P,{sx:{gap:2,maxWidth:1200},children:[e.jsx(Z,{title:a("mcp.listTitle"),tooltipTitle:a("mcp.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${x}/mcp-server`}),e.jsxs(W,{fullWidth:!0,children:[e.jsx(_,{id:"server-select-label",children:a("mcp.available")}),e.jsx(B,{labelId:"server-select-label",value:l?.did||"",label:a("mcp.available"),onChange:u,children:r.map(o=>e.jsx(D,{value:o.did,children:e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(E,{variant:"rounded",shape:"square",did:o.did,src:o.logo,size:20}),e.jsx(s,{sx:{fontSize:14},children:o.name})]})},o.did))})]}),l&&e.jsx(R,{endpoint:l.endpoint})]}):e.jsx(w,{color:"warning",children:a("mcp.noServer")})}export{de as default};
@@ -1,4 +1,4 @@
1
- import{j as e,T as i}from"./vendor-mui-core-DnR6WYuU.js";import{aa as p,af as c}from"./vendor-utils-CxWN1dT3.js";import{l as x}from"./vendor-ux-B2x-0VyJ.js";function y({name:t,nameFormatter:r=o=>typeof o=="string"?o.split(" ").map(f=>p(c(f))).join(" "):o,layout:n="horizontal",children:a,valueComponent:l="div",nameWidth:m=90,...s}){return e.jsxs(d,{layout:n,width:m,...s,children:[e.jsx(i,{color:"textSecondary",className:"info-row__name",children:r(t)}),a&&e.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:a})]})}const d=x("div")`
1
+ import{j as e,T as i}from"./vendor-mui-core-DnR6WYuU.js";import{aa as p,af as c}from"./vendor-utils-CxWN1dT3.js";import{l as x}from"./vendor-ux-IiqHAjMq.js";function y({name:t,nameFormatter:r=o=>typeof o=="string"?o.split(" ").map(f=>p(c(f))).join(" "):o,layout:n="horizontal",children:a,valueComponent:l="div",nameWidth:m=90,...s}){return e.jsxs(d,{layout:n,width:m,...s,children:[e.jsx(i,{color:"textSecondary",className:"info-row__name",children:r(t)}),a&&e.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:a})]})}const d=x("div")`
2
2
  display: flex;
3
3
  flex-direction: ${t=>t.layout==="vertical"?"column":"row"};
4
4
  justify-content: flex-start;
@@ -1,4 +1,4 @@
1
- import{j as B,ak as z,T as pe,z as gt,y as ht,bZ as dt,M as Ct,Q as Me,at as ce,ar as lt,cu as xt,ee as Et,ef as Rt,I as yt,eg as mt,D as bt,b4 as le,aj as wt,a6 as vt}from"./vendor-mui-core-DnR6WYuU.js";import{r as oe,p as Ve,g as It}from"./vendor-react-CTtPmzVP.js";import{L as St,g as Ze,u as Lt,l as Bt,e as _t,q as Tt}from"./vendor-hooks-qxhUUbW5.js";import{k as Ht,bc as Ot,_ as he,bn as ct}from"./vendor-ux-B2x-0VyJ.js";import{aI as Nt}from"./vendor-utils-CxWN1dT3.js";import{mediaKitApi as Qt}from"./index-Crz9MitX.js";import{r as De}from"./index-_tncRnTu.js";import"./lottie-web-4koyQiv_.js";import"./index-FreeXNkk.js";import"./vendor-arcblock-hbumvS-z.js";import"./index-DRYJ0xIl.js";const ft=oe.createContext({}),pt=()=>oe.useContext(ft);function qt({children:h,restrictions:f,i18n:w,theme:R}){const[x,b]=St({loading:!1}),n=t=>b(a=>({...a,loading:t})),e=oe.useMemo(()=>({...x,onLoading:n,restrictions:f,i18n:w}),[x]);return B.jsx(Ht,{theme:R,children:B.jsx(ft.Provider,{value:e,children:h})})}const Wt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAskSURBVHgB7d3RcdTIGoZhcSJYMoAMIAIgAiACIALIwBCBIQIgA4jAkAEZQAYmAx+6iqnjM+vxjD3qX/qk56niYm92wYve6W790ty5+GMACPCfASCEYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQ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EEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWECM/wKc/Y0zpWLfuAAAAABJRU5ErkJggg==",Mt=""+window.__toCdnUrl("assets/bedrock-yFRPpe__.png"),Zt=""+window.__toCdnUrl("assets/deepseek-C3x42pq3.png"),Dt=""+window.__toCdnUrl("assets/doubao-yPqHSkLx.png"),Gt=""+window.__toCdnUrl("assets/gemini-DffKpc81.png"),jt=""+window.__toCdnUrl("assets/google-DT1VSJ0m.png"),Vt=""+window.__toCdnUrl("assets/ideogram-REIjy0Er.png"),Ft=""+window.__toCdnUrl("assets/ollama-C7MZn2d_.png"),kt=""+window.__toCdnUrl("assets/openai-DlpqJdrb.png"),Yt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0dSURBVHgB7d1Nb1XXucDxlahAogQUUi6VSG+iQCT7CmJyS0FB5WYQRreT209wP1w7yqhpB3QSKrUgEYWQFkIlLCW4aTASxrGRbRryIqX7OXBSILzY2Od4P2v9ftIRBKkDv5x/13r23us89V2nACTwdAFIQrCANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ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AsoQWEAZAgsoQ2ABZQgsoIz/AWP7oZ6cDDZCAAAAAElFTkSuQmCC",ge={anthropic:Wt,bedrock:Mt,deepseek:Zt,doubao:Dt,gemini:Gt,google:jt,ideogram:Vt,ollama:Ft,openai:kt,openrouter:Yt,poe:Pt,xai:Ut},Fe={width:16,height:16,borderRadius:"2px",objectFit:"contain",backgroundColor:"transparent"};function Kt({onSubmit:h,models:f}){const{loading:w,i18n:R}=pt(),x=Ze({model:"",prompt:"",number:1}),b=()=>{const t=JSON.parse(JSON.stringify(x));Object.values(x).every(E=>!!E)&&h(t)},{run:n}=Lt(b,{wait:500}),e=oe.useMemo(()=>{const t=JSON.parse(JSON.stringify(x));return Object.values(t).some(a=>!a)},[JSON.stringify(x)]);return B.jsxs(zt,{onSubmit:t=>t.preventDefault(),children:[B.jsxs(z,{sx:{flex:1,height:"100%",overflow:"hidden",flexDirection:"column",display:"flex",mt:2,gap:2},children:[B.jsxs(z,{sx:{mx:2,display:"flex",flexDirection:"column",gap:1},children:[B.jsx(pe,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:R("aiImagePrompt")}),B.jsx(gt,{sx:{width:1},size:"small",type:"text",required:!0,placeholder:R("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:x.prompt??"",onChange:t=>{t.stopPropagation(),x.prompt=t.target.value},slotProps:{htmlInput:{maxLength:1e3}}})]}),B.jsxs(z,{sx:{px:2,display:"flex",flexDirection:"column",gap:1},children:[B.jsx(pe,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:`${R("aiImageModel")}`}),B.jsx(ht,{fullWidth:!0,size:"small",children:B.jsx(dt,{sx:{width:1},value:x.model,onChange:t=>{x.number=1,x.model=t.target.value},MenuProps:{disablePortal:!0},renderValue:t=>{const a=f.find(i=>`${i.provider}/${i.model}`===t);return a?B.jsxs(z,{sx:{display:"flex",alignItems:"center",gap:1},children:[ge[a.provider]&&B.jsx(z,{component:"img",src:ge[a.provider],alt:a.provider,style:Fe}),B.jsx(pe,{variant:"body2",children:a.model})]}):t},children:f.map(t=>B.jsx(Ct,{value:`${t.provider}/${t.model}`,children:B.jsxs(z,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%"},children:[ge[t.provider]&&B.jsx(z,{component:"img",src:ge[t.provider],alt:t.provider,style:Fe}),B.jsx(pe,{variant:"body2",sx:{flex:1},children:t.model})]})},`${t.provider}/${t.model}`))})})]})]}),B.jsx(Me,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:n,disabled:w||e,children:R(w?"aiImageGenerating":"aiImageGenerate")},w?"loading-submit":"submit")]})}const zt=ce(z)`
1
+ import{j as B,ak as z,T as pe,z as gt,y as ht,bZ as dt,M as Ct,Q as Me,at as ce,ar as lt,cu as xt,ee as Et,ef as Rt,I as yt,eg as mt,D as bt,b4 as le,aj as wt,a6 as vt}from"./vendor-mui-core-DnR6WYuU.js";import{r as oe,p as Ve,g as It}from"./vendor-react-CTtPmzVP.js";import{L as St,g as Ze,u as Lt,l as Bt,e as _t,q as Tt}from"./vendor-hooks-qxhUUbW5.js";import{k as Ht,bc as Ot,_ as he,bn as ct}from"./vendor-ux-IiqHAjMq.js";import{aI as Nt}from"./vendor-utils-CxWN1dT3.js";import{mediaKitApi as Qt}from"./index-ETdrsXsn.js";import{r as De}from"./index-_tncRnTu.js";import"./lottie-web-4koyQiv_.js";import"./index-DG0EDext.js";import"./vendor-arcblock-DyliHtVF.js";import"./index-DRYJ0xIl.js";const ft=oe.createContext({}),pt=()=>oe.useContext(ft);function qt({children:h,restrictions:f,i18n:w,theme:R}){const[x,b]=St({loading:!1}),n=t=>b(a=>({...a,loading:t})),e=oe.useMemo(()=>({...x,onLoading:n,restrictions:f,i18n:w}),[x]);return B.jsx(Ht,{theme:R,children:B.jsx(ft.Provider,{value:e,children:h})})}const Wt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAX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VOXu1truD2yof1TGTtSyC9VfVp9jS38xwKDNZhzOT9T+CNdTOXlWdfcxd5aM6ZrKWQ7CG2k+wtd4d3Fb9qI6ZrGVYfbCq33u1pkdx9qncFprJWobVB6tyqb32w/ZtlfNMZrKWYfXB8maGaVWd6ZnJWgZfVQ/EcOgOxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWECM/wKc/Y0zpWLfuAAAAABJRU5ErkJggg==",Mt=""+window.__toCdnUrl("assets/bedrock-yFRPpe__.png"),Zt=""+window.__toCdnUrl("assets/deepseek-C3x42pq3.png"),Dt=""+window.__toCdnUrl("assets/doubao-yPqHSkLx.png"),Gt=""+window.__toCdnUrl("assets/gemini-DffKpc81.png"),jt=""+window.__toCdnUrl("assets/google-DT1VSJ0m.png"),Vt=""+window.__toCdnUrl("assets/ideogram-REIjy0Er.png"),Ft=""+window.__toCdnUrl("assets/ollama-C7MZn2d_.png"),kt=""+window.__toCdnUrl("assets/openai-DlpqJdrb.png"),Yt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0dSURBVHgB7d1Nb1XXucDxlahAogQUUi6VSG+iQCT7CmJyS0FB5WYQRreT209wP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DcEC0hAsIA3BAtIQLCANwQLSECwgDcEC0hAsIA3BAtIQLCANwQLSECwgDcEC0hAsIA3BAtIQLCANwQLSECwgDcEC0vgXkv5P8wQTb/sAAAAASUVORK5CYII=",Pt=""+window.__toCdnUrl("assets/poe-B588TgZu.png"),Ut="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA1dSURBVHgB7d3tbRXXFgbg8dX9T1wBoQPSQejAVBBTgXEFSSogqQBcgdMBdAAdkA6gg3O9kCwhX3POfO5Za+Z5JCdSZBIfO+f1Xnve2XN2uNMBFPCfDqAIgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGw2J1///23e/bsWXd2drb6x6tXrzr6Ozvc6WBHXrx40X348KFb288//9y9f//+29/pxwqLXfnzzz9ThFV48+aNsBrICovduB8FM7i6uur++uuvjmEEFrsRYRWhtbZYVX3+/LljOCMhuxCjYIawCrFvxTgCi82LPas//vijy+D333+3bzWBkZBNi1VVXBXMsLp6/vx59/Hjx47xrLDYtCyj4E8//dTd3t52TCOw2Kx37959+8hAhWEeRkI2KdMoeHl52b19+7ZjOoHFJmmzb5ORkM3J1GY/dVUwS9WiCissNqVam/3ly5c24wcQWGxKpjZ7VBji6uCP/P33393r1687b8H+jIRsRrY2+7Gwiq8zwophBBabUK3NHhcFGE5gUV6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NvvV1VWq5nmWryXL6pf5CKyRMrXZs5xkei/LaKgFvz0Ca4S9tNnHylR1mNKC10bPR2ANtLc2+1jZWvBGw20QWAPstc0+VqYWfJxNRn0Ca4C9ttnHynSDdLTgs5z+GlwlHOfscKcDKMAKCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoIz/AWP7oZ6cDDZCAAAAAElFTkSuQmCC",ge={anthropic:Wt,bedrock:Mt,deepseek:Zt,doubao:Dt,gemini:Gt,google:jt,ideogram:Vt,ollama:Ft,openai:kt,openrouter:Yt,poe:Pt,xai:Ut},Fe={width:16,height:16,borderRadius:"2px",objectFit:"contain",backgroundColor:"transparent"};function Kt({onSubmit:h,models:f}){const{loading:w,i18n:R}=pt(),x=Ze({model:"",prompt:"",number:1}),b=()=>{const t=JSON.parse(JSON.stringify(x));Object.values(x).every(E=>!!E)&&h(t)},{run:n}=Lt(b,{wait:500}),e=oe.useMemo(()=>{const t=JSON.parse(JSON.stringify(x));return Object.values(t).some(a=>!a)},[JSON.stringify(x)]);return B.jsxs(zt,{onSubmit:t=>t.preventDefault(),children:[B.jsxs(z,{sx:{flex:1,height:"100%",overflow:"hidden",flexDirection:"column",display:"flex",mt:2,gap:2},children:[B.jsxs(z,{sx:{mx:2,display:"flex",flexDirection:"column",gap:1},children:[B.jsx(pe,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:R("aiImagePrompt")}),B.jsx(gt,{sx:{width:1},size:"small",type:"text",required:!0,placeholder:R("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:x.prompt??"",onChange:t=>{t.stopPropagation(),x.prompt=t.target.value},slotProps:{htmlInput:{maxLength:1e3}}})]}),B.jsxs(z,{sx:{px:2,display:"flex",flexDirection:"column",gap:1},children:[B.jsx(pe,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:`${R("aiImageModel")}`}),B.jsx(ht,{fullWidth:!0,size:"small",children:B.jsx(dt,{sx:{width:1},value:x.model,onChange:t=>{x.number=1,x.model=t.target.value},MenuProps:{disablePortal:!0},renderValue:t=>{const a=f.find(i=>`${i.provider}/${i.model}`===t);return a?B.jsxs(z,{sx:{display:"flex",alignItems:"center",gap:1},children:[ge[a.provider]&&B.jsx(z,{component:"img",src:ge[a.provider],alt:a.provider,style:Fe}),B.jsx(pe,{variant:"body2",children:a.model})]}):t},children:f.map(t=>B.jsx(Ct,{value:`${t.provider}/${t.model}`,children:B.jsxs(z,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%"},children:[ge[t.provider]&&B.jsx(z,{component:"img",src:ge[t.provider],alt:t.provider,style:Fe}),B.jsx(pe,{variant:"body2",sx:{flex:1},children:t.model})]})},`${t.provider}/${t.model}`))})})]})]}),B.jsx(Me,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:n,disabled:w||e,children:R(w?"aiImageGenerating":"aiImageGenerate")},w?"loading-submit":"submit")]})}const zt=ce(z)`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  height: 100%;
@@ -1 +1 @@
1
- import{V as te,H as P,w as L,aU as de,aX as me}from"./vendor-ux-B2x-0VyJ.js";import{g as re,b as m,a as fe}from"./vendor-hooks-qxhUUbW5.js";import{g as he,r as A}from"./vendor-react-CTtPmzVP.js";import{j as e,ak as w,z as v,bX as J,bn as $,y as b,am as pe,e6 as xe,cZ as ve,at as ie,b6 as ne,T as Z}from"./vendor-mui-core-DnR6WYuU.js";import{A as ae,J as je,C as be}from"./vendor-utils-CxWN1dT3.js";import{u as se,C as p}from"./index.esm-Co8ZxFyk.js";import{aQ as ge,Z as oe,Y as le,aD as ce,aV as B,c as ye}from"./index-FreeXNkk.js";import{i as X}from"./isURL-Dsl0-5oi.js";import{S as x}from"./section-jXB9AxBb.js";import{A as we,a as Re,b as ke}from"./collapse-B7gUzFaX.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-hbumvS-z.js";import"./required-BQln5OcV.js";var W={exports:{}},z={exports:{}},N={exports:{}},Q;function Te(){return Q||(Q=1,function(d,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=t;function t(f){return f==null}d.exports=n.default,d.exports.default=n.default}(N,N.exports)),N.exports}var Y;function Ee(){return Y||(Y=1,function(d,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=_;var t=R(ge()),f=R(Te());function R(h){return h&&h.__esModule?h:{default:h}}var c=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,j=/^[-+]?[0-9]+$/;function _(h,l){(0,t.default)(h),l=l||{};var u=l.allow_leading_zeroes===!1?c:j,i=!l.hasOwnProperty("min")||(0,f.default)(l.min)||h>=l.min,q=!l.hasOwnProperty("max")||(0,f.default)(l.max)||h<=l.max,I=!l.hasOwnProperty("lt")||(0,f.default)(l.lt)||h<l.lt,o=!l.hasOwnProperty("gt")||(0,f.default)(l.gt)||h>l.gt;return u.test(h)&&i&&q&&I&&o}d.exports=n.default,d.exports.default=n.default}(z,z.exports)),z.exports}var G;function Se(){return G||(G=1,function(d,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=R;var t=f(Ee());function f(c){return c&&c.__esModule?c:{default:c}}function R(c){return(0,t.default)(c,{allow_leading_zeroes:!1,min:0,max:65535})}d.exports=n.default,d.exports.default=n.default}(W,W.exports)),W.exports}var Ce=Se();const Pe=he(Ce),V={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function _e(){const{api:d}=oe(),{blocklet:n}=le(),{t}=te(),{confirmApi:f,confirmHolder:R}=ce(),[c,j]=A.useState(!1),_=n?.meta?.did,h=Object.assign({...V},n?.settings?.notification?.email||{}),{handleSubmit:l,control:u,formState:i,watch:q,reset:I}=se({defaultValues:ae(h,Object.keys(V))}),o=re({testReceiver:"",testReceiverError:""}),a=q("enabled"),K=m(async(r,k,C=!0)=>{try{j(!0);const{blocklet:T}=await d.configNotification({input:{did:_,notification:JSON.stringify({email:r})}}),ue=Object.assign({...V},T?.settings?.notification?.email||{});I(ue),C&&P.success(t("common.saveSuccess"))}catch(T){if(C)P.error(T.message||t("common.saveFailed"));else throw T}finally{j(!1)}}),F=m(async(r,k,C)=>{try{j(!0),i.isDirty&&await K(r,k,!1),await d.sendEmail({input:{did:_,receiver:C,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification",attachments:[{type:"link",data:{url:"https://community.arcblock.io",title:"Community",image:"https://community.arcblock.io/.well-known/service/blocklet/logo-rect-dark",utm:{campaign:"test-campaign"}}}],utm:{content:"test-email-button"}})}}),P.success(t("notification.email.testSuccess"))}catch(T){P.error(T.message||t("notification.email.testfailed"))}finally{j(!1)}}),D=m((r,k)=>{o.testReceiver=localStorage.getItem("test-receiver")||"",o.testReceiverError="",f.open({title:t("notification.email.testSendEmail"),content:()=>e.jsx(w,{sx:{width:"300px"},children:e.jsx(v,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.email.inputTestReceiver"),value:o.testReceiver,onChange:C=>{o.testReceiver=C.target.value},error:!!o.testReceiverError,helperText:o.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(C){const T=o.testReceiver?.trim();if(!T){o.testReceiverError=t("notification.email.receiverRequired");return}if(!B(T)){o.testReceiverError=t("notification.email.receiverInvalid");return}o.testReceiverError="",await F(r,k,T),C()},onCancel:()=>{j(!1)}})}),U=m(r=>{const k=r?.trim();return k?B(k)?!0:t("notification.email.fromInvalid"):t("notification.email.fromRequired")}),M=m(r=>{const k=r?.trim();return k?X(k,{require_host:!1,protocols:[]})?!0:t("notification.email.hostInvalid"):t("notification.email.hostRequired")}),s=m(r=>r?Pe(r)?!0:t("notification.email.portInvalid"):t("notification.email.portRequired")),E=m(r=>r?.trim()?!0:t("notification.email.userRequired")),g=m(r=>r?.trim()?!0:t("notification.email.passwordRequired")),S=m(r=>r?.trim()&&!X(r,{protocols:["http","https"],require_protocol:!0})?t("notification.email.linkInvalid"):!0),O=m(r=>r?.trim()&&!B(r)?t("notification.email.emailInvalid"):!0),y=m(()=>!0);return e.jsxs(w,{children:[e.jsxs(qe,{component:"form",onSubmit:l(K),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(x,{title:t("notification.email.enable"),my:2.5,children:e.jsx(p,{name:"enabled",control:u,render:({field:r})=>e.jsx(J,{control:e.jsx($,{checked:r.value,...r})})})}),e.jsx(x,{title:t("notification.email.from"),children:e.jsx(p,{name:"from",control:u,rules:{validate:a?U:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",required:!0,label:t("notification.email.from"),error:!!i.errors[r.name],helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.host"),children:e.jsx(p,{name:"host",control:u,rules:{validate:a?M:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",required:!0,error:!!i.errors[r.name],label:t("notification.email.host"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.port"),children:e.jsx(p,{name:"port",control:u,rules:{validate:a?s:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",required:!0,type:"number",error:!!i.errors[r.name],label:t("notification.email.port"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.user"),children:e.jsx(p,{name:"user",control:u,rules:{validate:a?E:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",required:!0,error:!!i.errors[r.name],label:t("notification.email.user"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.password"),children:e.jsx(p,{name:"password",control:u,rules:{validate:a?g:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",required:!0,type:"password",error:!!i.errors[r.name],label:t("notification.email.password"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.secure"),children:e.jsx(p,{name:"secure",control:u,rules:{validate:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(J,{control:e.jsx($,{checked:r.value,...r,disabled:!a})})})})}),e.jsxs(we,{children:[e.jsxs(Re,{expandIcon:e.jsx(ve,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[t("notification.email.signature"),e.jsx(pe,{title:t("notification.email.signatureTooltip"),children:e.jsx(xe,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ke,{children:[e.jsx(x,{title:t("notification.email.companyName"),children:e.jsx(p,{name:"companyName",control:u,rules:{validate:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",error:!!i.errors[r.name],label:t("notification.email.companyName"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.companyLink"),children:e.jsx(p,{name:"companyLink",control:u,rules:{validate:a?S:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",error:!!i.errors[r.name],label:t("notification.email.companyLink"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.companyAddress"),children:e.jsx(p,{name:"companyAddress",control:u,rules:{validate:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",error:!!i.errors[r.name],label:t("notification.email.companyAddress"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.supportEmail"),children:e.jsx(p,{name:"supportEmail",control:u,rules:{validate:a?O:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",type:"email",error:!!i.errors[r.name],label:t("notification.email.supportEmail"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})})]})]}),e.jsxs(w,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(L,{variant:"outlined",loading:c,color:"warning",onClick:l(D),disabled:!a||c,children:t("common.runTest")}),e.jsx(L,{type:"submit",variant:"contained",loading:c,disabled:!i.isDirty||c,children:t("common.save")})]})]}),R]})}const qe=ie(ne)``,H={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function Ie(){const{api:d}=oe(),{blocklet:n}=le(),{t}=te(),{confirmApi:f,confirmHolder:R}=ce(),[c,j]=A.useState(!1),_=n?.meta?.did,h=Object.assign({...H},n?.settings?.notification?.pushKit||{}),{handleSubmit:l,control:u,formState:i,watch:q,reset:I}=se({defaultValues:ae(h,Object.keys(H))}),o=re({testReceiver:"",testReceiverError:""}),a=q("enabled"),K=m(async(s,E,g=!0)=>{try{j(!0);const{blocklet:S}=await d.configNotification({input:{did:_,notification:JSON.stringify({pushKit:s})}}),O=Object.assign({...H},S?.settings?.notification?.pushKit||{});I(O),g&&P.success(t("common.saveSuccess"))}catch(S){if(g)P.error(S.message||t("common.saveFailed"));else throw S}finally{j(!1)}}),F=m(async(s,E)=>{try{j(!0),i.isDirty&&await K(s,E,!1);const g=(n?.configs||[]).find(y=>y.key==="BLOCKLET_APP_URL")?.value,S=je(be(g,ye.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:n?.meta?.version,t:new Date(n?.updatedAt||0).getTime()}),O={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:n?.appDid,fullName:n?.meta?.title,avatar:S}}}};await d.sendPush({input:{did:_,receiver:o.testReceiver,notification:JSON.stringify(O)}}),P.success(t("notification.pushKit.testSuccess"))}catch(g){P.error(g.message||t("notification.pushKit.testfailed"))}finally{j(!1)}}),D=m((s,E)=>{o.testReceiverError="",f.open({title:t("notification.pushKit.testSend"),content:()=>e.jsx(w,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(v,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.pushKit.inputTestReceiver"),value:o.testReceiver,onChange:g=>{o.testReceiver=g.target.value},error:!!o.testReceiverError,helperText:o.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(g){if(!o.testReceiver?.trim()){o.testReceiverError=t("notification.pushKit.receiverRequired");return}o.testReceiverError="",await F(s,E),g()},onCancel:()=>{j(!1)}})}),U=m(s=>{const E=s?.trim();return E?X(E)?!0:t("notification.pushKit.endpointInvalid"):t("notification.pushKit.endpointRequired")}),M=m(()=>!0);return e.jsxs(w,{children:[e.jsxs(Ke,{component:"form",onSubmit:l(K),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(x,{title:t("notification.pushKit.enable"),my:2.5,children:e.jsx(p,{name:"enabled",control:u,render:({field:s})=>e.jsx(J,{control:e.jsx($,{checked:s.value,...s})})})}),e.jsx(x,{title:t("notification.pushKit.endpoint"),children:e.jsx(p,{name:"endpoint",control:u,rules:{validate:a?U:M},render:({field:s})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...s,size:"small",required:!0,label:t("notification.pushKit.endpoint"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!a})})})}),e.jsxs(x,{title:t("notification.pushKit.customOptions"),children:[e.jsx(p,{name:"did",control:u,render:({field:s})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...s,size:"small",label:t("notification.pushKit.did"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!a})})}),e.jsx(p,{name:"pushPath",control:u,render:({field:s})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...s,size:"small",label:t("notification.pushKit.pushPath"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!a})})})]}),e.jsxs(w,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(L,{variant:"outlined",loading:c,color:"warning",onClick:l(D),disabled:!a||c,children:t("common.runTest")}),e.jsx(L,{type:"submit",variant:"contained",loading:c,disabled:!i.isDirty||c,children:t("common.save")})]})]}),R]})}const Ke=ie(ne)``,ee=[{label:e.jsx(w,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(w,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"},{label:e.jsx(w,{sx:{textAlign:"center",width:"100%"},children:"Wallet"}),value:"wallet"},{label:e.jsx(w,{sx:{textAlign:"center",width:"100%"},children:"Webhooks"}),value:"webhooks"}];function Je(){const[d,n]=A.useState(ee[0].value),{t}=A.useContext(de),f=fe(()=>({email:e.jsx(_e,{}),pushKit:e.jsx(Ie,{}),wallet:e.jsx(Z,{variant:"body1",children:t("notification.wallet.description")}),webhooks:e.jsx(Z,{variant:"body1",children:t("notification.webhooks.description")})}),[t]),R=A.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(w,{children:[e.jsx(me,{variant:"card",tabs:ee,current:d,onChange:n}),e.jsx(w,{style:R,children:f[d]})]})}export{Je as default};
1
+ import{V as te,H as P,w as L,aU as de,aX as me}from"./vendor-ux-IiqHAjMq.js";import{g as re,b as m,a as fe}from"./vendor-hooks-qxhUUbW5.js";import{g as he,r as A}from"./vendor-react-CTtPmzVP.js";import{j as e,ak as w,z as v,bX as J,bn as $,y as b,am as pe,e6 as xe,cZ as ve,at as ie,b6 as ne,T as Z}from"./vendor-mui-core-DnR6WYuU.js";import{A as ae,J as je,C as be}from"./vendor-utils-CxWN1dT3.js";import{u as se,C as p}from"./index.esm-Co8ZxFyk.js";import{aQ as ge,Z as oe,Y as le,aD as ce,aV as B,c as ye}from"./index-DG0EDext.js";import{i as X}from"./isURL-D4WfF4w_.js";import{S as x}from"./section-jXB9AxBb.js";import{A as we,a as Re,b as ke}from"./collapse-B7gUzFaX.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DyliHtVF.js";import"./required-BQln5OcV.js";var W={exports:{}},z={exports:{}},N={exports:{}},Q;function Te(){return Q||(Q=1,function(d,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=t;function t(f){return f==null}d.exports=n.default,d.exports.default=n.default}(N,N.exports)),N.exports}var Y;function Ee(){return Y||(Y=1,function(d,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=_;var t=R(ge()),f=R(Te());function R(h){return h&&h.__esModule?h:{default:h}}var c=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,j=/^[-+]?[0-9]+$/;function _(h,l){(0,t.default)(h),l=l||{};var u=l.allow_leading_zeroes===!1?c:j,i=!l.hasOwnProperty("min")||(0,f.default)(l.min)||h>=l.min,q=!l.hasOwnProperty("max")||(0,f.default)(l.max)||h<=l.max,I=!l.hasOwnProperty("lt")||(0,f.default)(l.lt)||h<l.lt,o=!l.hasOwnProperty("gt")||(0,f.default)(l.gt)||h>l.gt;return u.test(h)&&i&&q&&I&&o}d.exports=n.default,d.exports.default=n.default}(z,z.exports)),z.exports}var G;function Se(){return G||(G=1,function(d,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=R;var t=f(Ee());function f(c){return c&&c.__esModule?c:{default:c}}function R(c){return(0,t.default)(c,{allow_leading_zeroes:!1,min:0,max:65535})}d.exports=n.default,d.exports.default=n.default}(W,W.exports)),W.exports}var Ce=Se();const Pe=he(Ce),V={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function _e(){const{api:d}=oe(),{blocklet:n}=le(),{t}=te(),{confirmApi:f,confirmHolder:R}=ce(),[c,j]=A.useState(!1),_=n?.meta?.did,h=Object.assign({...V},n?.settings?.notification?.email||{}),{handleSubmit:l,control:u,formState:i,watch:q,reset:I}=se({defaultValues:ae(h,Object.keys(V))}),o=re({testReceiver:"",testReceiverError:""}),a=q("enabled"),K=m(async(r,k,C=!0)=>{try{j(!0);const{blocklet:T}=await d.configNotification({input:{did:_,notification:JSON.stringify({email:r})}}),ue=Object.assign({...V},T?.settings?.notification?.email||{});I(ue),C&&P.success(t("common.saveSuccess"))}catch(T){if(C)P.error(T.message||t("common.saveFailed"));else throw T}finally{j(!1)}}),F=m(async(r,k,C)=>{try{j(!0),i.isDirty&&await K(r,k,!1),await d.sendEmail({input:{did:_,receiver:C,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification",attachments:[{type:"link",data:{url:"https://community.arcblock.io",title:"Community",image:"https://community.arcblock.io/.well-known/service/blocklet/logo-rect-dark",utm:{campaign:"test-campaign"}}}],utm:{content:"test-email-button"}})}}),P.success(t("notification.email.testSuccess"))}catch(T){P.error(T.message||t("notification.email.testfailed"))}finally{j(!1)}}),D=m((r,k)=>{o.testReceiver=localStorage.getItem("test-receiver")||"",o.testReceiverError="",f.open({title:t("notification.email.testSendEmail"),content:()=>e.jsx(w,{sx:{width:"300px"},children:e.jsx(v,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.email.inputTestReceiver"),value:o.testReceiver,onChange:C=>{o.testReceiver=C.target.value},error:!!o.testReceiverError,helperText:o.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(C){const T=o.testReceiver?.trim();if(!T){o.testReceiverError=t("notification.email.receiverRequired");return}if(!B(T)){o.testReceiverError=t("notification.email.receiverInvalid");return}o.testReceiverError="",await F(r,k,T),C()},onCancel:()=>{j(!1)}})}),U=m(r=>{const k=r?.trim();return k?B(k)?!0:t("notification.email.fromInvalid"):t("notification.email.fromRequired")}),M=m(r=>{const k=r?.trim();return k?X(k,{require_host:!1,protocols:[]})?!0:t("notification.email.hostInvalid"):t("notification.email.hostRequired")}),s=m(r=>r?Pe(r)?!0:t("notification.email.portInvalid"):t("notification.email.portRequired")),E=m(r=>r?.trim()?!0:t("notification.email.userRequired")),g=m(r=>r?.trim()?!0:t("notification.email.passwordRequired")),S=m(r=>r?.trim()&&!X(r,{protocols:["http","https"],require_protocol:!0})?t("notification.email.linkInvalid"):!0),O=m(r=>r?.trim()&&!B(r)?t("notification.email.emailInvalid"):!0),y=m(()=>!0);return e.jsxs(w,{children:[e.jsxs(qe,{component:"form",onSubmit:l(K),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(x,{title:t("notification.email.enable"),my:2.5,children:e.jsx(p,{name:"enabled",control:u,render:({field:r})=>e.jsx(J,{control:e.jsx($,{checked:r.value,...r})})})}),e.jsx(x,{title:t("notification.email.from"),children:e.jsx(p,{name:"from",control:u,rules:{validate:a?U:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",required:!0,label:t("notification.email.from"),error:!!i.errors[r.name],helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.host"),children:e.jsx(p,{name:"host",control:u,rules:{validate:a?M:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",required:!0,error:!!i.errors[r.name],label:t("notification.email.host"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.port"),children:e.jsx(p,{name:"port",control:u,rules:{validate:a?s:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",required:!0,type:"number",error:!!i.errors[r.name],label:t("notification.email.port"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.user"),children:e.jsx(p,{name:"user",control:u,rules:{validate:a?E:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",required:!0,error:!!i.errors[r.name],label:t("notification.email.user"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.password"),children:e.jsx(p,{name:"password",control:u,rules:{validate:a?g:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",required:!0,type:"password",error:!!i.errors[r.name],label:t("notification.email.password"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.secure"),children:e.jsx(p,{name:"secure",control:u,rules:{validate:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(J,{control:e.jsx($,{checked:r.value,...r,disabled:!a})})})})}),e.jsxs(we,{children:[e.jsxs(Re,{expandIcon:e.jsx(ve,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[t("notification.email.signature"),e.jsx(pe,{title:t("notification.email.signatureTooltip"),children:e.jsx(xe,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ke,{children:[e.jsx(x,{title:t("notification.email.companyName"),children:e.jsx(p,{name:"companyName",control:u,rules:{validate:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",error:!!i.errors[r.name],label:t("notification.email.companyName"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.companyLink"),children:e.jsx(p,{name:"companyLink",control:u,rules:{validate:a?S:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",error:!!i.errors[r.name],label:t("notification.email.companyLink"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.companyAddress"),children:e.jsx(p,{name:"companyAddress",control:u,rules:{validate:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",error:!!i.errors[r.name],label:t("notification.email.companyAddress"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(x,{title:t("notification.email.supportEmail"),children:e.jsx(p,{name:"supportEmail",control:u,rules:{validate:a?O:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...r,size:"small",type:"email",error:!!i.errors[r.name],label:t("notification.email.supportEmail"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})})]})]}),e.jsxs(w,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(L,{variant:"outlined",loading:c,color:"warning",onClick:l(D),disabled:!a||c,children:t("common.runTest")}),e.jsx(L,{type:"submit",variant:"contained",loading:c,disabled:!i.isDirty||c,children:t("common.save")})]})]}),R]})}const qe=ie(ne)``,H={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function Ie(){const{api:d}=oe(),{blocklet:n}=le(),{t}=te(),{confirmApi:f,confirmHolder:R}=ce(),[c,j]=A.useState(!1),_=n?.meta?.did,h=Object.assign({...H},n?.settings?.notification?.pushKit||{}),{handleSubmit:l,control:u,formState:i,watch:q,reset:I}=se({defaultValues:ae(h,Object.keys(H))}),o=re({testReceiver:"",testReceiverError:""}),a=q("enabled"),K=m(async(s,E,g=!0)=>{try{j(!0);const{blocklet:S}=await d.configNotification({input:{did:_,notification:JSON.stringify({pushKit:s})}}),O=Object.assign({...H},S?.settings?.notification?.pushKit||{});I(O),g&&P.success(t("common.saveSuccess"))}catch(S){if(g)P.error(S.message||t("common.saveFailed"));else throw S}finally{j(!1)}}),F=m(async(s,E)=>{try{j(!0),i.isDirty&&await K(s,E,!1);const g=(n?.configs||[]).find(y=>y.key==="BLOCKLET_APP_URL")?.value,S=je(be(g,ye.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:n?.meta?.version,t:new Date(n?.updatedAt||0).getTime()}),O={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:n?.appDid,fullName:n?.meta?.title,avatar:S}}}};await d.sendPush({input:{did:_,receiver:o.testReceiver,notification:JSON.stringify(O)}}),P.success(t("notification.pushKit.testSuccess"))}catch(g){P.error(g.message||t("notification.pushKit.testfailed"))}finally{j(!1)}}),D=m((s,E)=>{o.testReceiverError="",f.open({title:t("notification.pushKit.testSend"),content:()=>e.jsx(w,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(v,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.pushKit.inputTestReceiver"),value:o.testReceiver,onChange:g=>{o.testReceiver=g.target.value},error:!!o.testReceiverError,helperText:o.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(g){if(!o.testReceiver?.trim()){o.testReceiverError=t("notification.pushKit.receiverRequired");return}o.testReceiverError="",await F(s,E),g()},onCancel:()=>{j(!1)}})}),U=m(s=>{const E=s?.trim();return E?X(E)?!0:t("notification.pushKit.endpointInvalid"):t("notification.pushKit.endpointRequired")}),M=m(()=>!0);return e.jsxs(w,{children:[e.jsxs(Ke,{component:"form",onSubmit:l(K),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(x,{title:t("notification.pushKit.enable"),my:2.5,children:e.jsx(p,{name:"enabled",control:u,render:({field:s})=>e.jsx(J,{control:e.jsx($,{checked:s.value,...s})})})}),e.jsx(x,{title:t("notification.pushKit.endpoint"),children:e.jsx(p,{name:"endpoint",control:u,rules:{validate:a?U:M},render:({field:s})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...s,size:"small",required:!0,label:t("notification.pushKit.endpoint"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!a})})})}),e.jsxs(x,{title:t("notification.pushKit.customOptions"),children:[e.jsx(p,{name:"did",control:u,render:({field:s})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...s,size:"small",label:t("notification.pushKit.did"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!a})})}),e.jsx(p,{name:"pushPath",control:u,render:({field:s})=>e.jsx(b,{fullWidth:!0,children:e.jsx(v,{...s,size:"small",label:t("notification.pushKit.pushPath"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!a})})})]}),e.jsxs(w,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(L,{variant:"outlined",loading:c,color:"warning",onClick:l(D),disabled:!a||c,children:t("common.runTest")}),e.jsx(L,{type:"submit",variant:"contained",loading:c,disabled:!i.isDirty||c,children:t("common.save")})]})]}),R]})}const Ke=ie(ne)``,ee=[{label:e.jsx(w,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(w,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"},{label:e.jsx(w,{sx:{textAlign:"center",width:"100%"},children:"Wallet"}),value:"wallet"},{label:e.jsx(w,{sx:{textAlign:"center",width:"100%"},children:"Webhooks"}),value:"webhooks"}];function Je(){const[d,n]=A.useState(ee[0].value),{t}=A.useContext(de),f=fe(()=>({email:e.jsx(_e,{}),pushKit:e.jsx(Ie,{}),wallet:e.jsx(Z,{variant:"body1",children:t("notification.wallet.description")}),webhooks:e.jsx(Z,{variant:"body1",children:t("notification.webhooks.description")})}),[t]),R=A.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(w,{children:[e.jsx(me,{variant:"card",tabs:ee,current:d,onChange:n}),e.jsx(w,{style:R,children:f[d]})]})}export{Je as default};
@@ -1,4 +1,4 @@
1
- import{j as e,W as m,a6 as z,T as j,at as Ne,D as _e,e7 as V,ao as J,e8 as We,ak as h,b6 as F,bb as Fe,s as fe,e9 as be,br as Ke,am as ge,cF as Ge,M as G,aO as Y,bO as Ye,aP as $,Q as $e,a$ as qe,aR as He,ea as Qe,eb as Xe,ec as Ve,dF as Je,b4 as he}from"./vendor-mui-core-DnR6WYuU.js";import{q as Ze,l as ke,a as ue}from"./vendor-hooks-qxhUUbW5.js";import{r as b,j as et}from"./vendor-react-CTtPmzVP.js";import{Y as M,Z as N,Q as E,J as L,bI as tt,bX as st,al as nt,c as I,j as ot}from"./index-FreeXNkk.js";import{H as B,V as D,aU as at,aV as q,aP as rt,R as it,w as le,aX as ct}from"./vendor-ux-B2x-0VyJ.js";import{u as lt}from"./use-mobile-BINJTzMb.js";import{a as H,d as je,N as dt,c as pt,D as Ce,C as me}from"./vendor-utils-CxWN1dT3.js";import{o as we}from"./vendor-arcblock-hbumvS-z.js";import{a as ut,u as mt,c as xt,D as de,b as ft}from"./index-CjS1scdg.js";import"./index-0SUQD3K4.js";import"./index-BojVbZw0.js";import"./api-FQQlzPOP.js";import{u as Be,C as gt,D as ht,a as St}from"./connect-to-BkcNrFMt.js";import{c as yt,g as bt,d as kt,i as jt,e as xe,f as Ct,h as wt,j as Bt}from"./spaces-C8s0ejS4.js";import{f as Q}from"./index-DBs9Ljax.js";import{v as Dt}from"./index-Bnog6DRk.js";import{a as Et}from"./dashboard-ChfWklE6.js";import{E as Tt}from"./index-D1SIrheh.js";import{x as It}from"./index-DRYJ0xIl.js";import{g as Se}from"./get-safe-url-DxpqHRQ1.js";import{S as Rt}from"./switch-control-CrDv-a96.js";import{C as Pt,u as At}from"./config-space-BR-bgToj.js";import{L as ye}from"./list-header-Cl3jykCe.js";import"./lottie-web-4koyQiv_.js";import"./session-8btKYxMi.js";import"./team-DB9e4nhx.js";import"./isURL-Dsl0-5oi.js";import"./use-app-logo-BYRQxVgh.js";import"./useAsyncRetry-r8dEPb-x.js";import"./useAsync-Dotoxibi.js";import"./useSetState-L-f8mSga.js";import"./index-LlFgIuCt.js";import"./zh-DuMFx3Ce.js";import"./over-due-invoice-payment-DB7bedIv.js";import"./useLocalStorage-BRElXNq3.js";import"./confirm-CQcou-U0.js";import"./passport-CgVIIIF1.js";import"./create-passport-svg-H8kuyoHI.js";import"./index-D9VLhdHJ.js";async function vt({blockletDid:t,nodeApi:o,spaceGateways:a}){let s=!1;const r=await Promise.all(a.map(async n=>{let{name:c}=n;const i=await yt(n.endpoint);return!H(i)&&i!==c&&(c=i,s=!0),{...n,name:c}}));return s&&await Promise.all(r.filter(n=>n.did).map(n=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:n.did},spaceGateway:{...n}}}))),r}function zt({refresh:t}={}){const{blocklet:o}=M(),a=o?.meta?.did,{api:s}=N();return Ze(async()=>{if(!a)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:a}});return await vt({blockletDid:a,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[a,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(Q(r)))}})}function De({deps:t,setLoading:o,backupDate:a}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=M(),[r,n]=b.useState([]),{api:c}=N(),[i,d]=b.useMemo(()=>a?[E(a).startOf("day").toISOString(),E(a).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[a]),l=je(async()=>{try{if(o(!0),!s){n([]);return}const{backups:x}=await c.getBlockletBackups({input:{did:s.meta.did,startTime:i,endTime:d}});n(x??[])}catch(x){console.error(x),B.error(Q(x))}finally{o(!1)}},1e3);return ke(async()=>{l()},[s?.meta?.did].concat(t)),{backups:r}}function Ot({appDid:t}){const{backups:o}=De(),[a,s]=b.useState({message:"",progress:0,completed:!1}),r=N(),{ws:{useSubscription:n}}=r;return n(L.BlockletEvents.backupProgress,c=>{t===c?.appDid&&s(()=>({...c}))},[t]),b.useEffect(()=>{if(o?.length&&dt(o[0]?.status)){const[c]=o;s(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[o]),a}function Ut({deps:t=[],setLoading:o=()=>{}}={}){const{blocklet:a}=M(),[s,r]=b.useState([]),{api:n}=N(),c=b.useCallback(je(async()=>{if(!n||!a?.meta?.did){r([]);return}try{o(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await n.getBlockletBackupSummary({input:{did:a.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}}),x=Array.isArray(l)?l.map(p=>({...p,successCount:+p.successCount,errorCount:+p.errorCount})):[];r(x)}catch(i){console.error("Failed to fetch backup summary:",i),B.error(Q(i)),r([])}finally{o(!1)}},1e3),[]);return ke(async()=>(await c(),()=>{c.cancel()}),[a?.meta?.did].concat(t)),{backupSummary:s}}const Ee=b.createContext({}),{Provider:Lt,Consumer:Os}=Ee;function Te({children:t}){const{t:o}=D(),{api:a}=N(),{blocklet:s}=M(),[r,n]=b.useState(null),[c,i]=b.useState(!1),{data:d,loading:l,mutate:x}=zt({refresh:c}),p=pt(d),f=Ot({appDid:s?.appDid}),u=b.useMemo(()=>bt(s?.environments),[s?.environments]),[k,w]=b.useState(!1),[S,y]=b.useState(0),{backups:Z}=De({deps:[S,r],setLoading:w,backupDate:r}),[ee,te]=b.useState(0),{backupSummary:se}=Ut({deps:[ee]}),[_,U]=b.useState(d?.find(g=>g.endpoint===u)),T=s?.settings?.autoBackup,P=()=>{i(g=>!g)},ne=()=>{te(g=>g+1)},oe=()=>{y(g=>g+1)},K=async g=>{await a.updateAutoBackup({input:{did:s.meta.did,autoBackup:g}})},X=async()=>{await a.abortBlockletBackup({input:{appPid:s.meta.did}})},ae=async(g,v)=>{try{x(R=>{const A=[...R];return A.push({...g,loading:!0}),A}),await a.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:g}}),u!==v&&await a.configBlocklet({input:{did:[s.meta.did],configs:[{key:L.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:v}]}}),U(g),P(),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),x(A=>[...A].filter(W=>W.did!==g.did)),R}},re=async g=>{g&&(g.endpoint===u&&(await a.configBlocklet({input:{did:[s.meta.did],configs:[{key:L.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),T?.enabled&&await K({enabled:!1})),await a.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:g?.did}}),x(v=>{const R=[...v];return R.splice(R.indexOf(g),1),R}),U(g),P())},ie=async g=>{await Promise.all([a.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:g.did},spaceGateway:g}}),u!==g.endpoint&&a.configBlocklet({input:{did:[s.meta.did],configs:[{key:L.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),P()},C=g=>g?.endpoint===u;return e.jsx(Lt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ae,deleteSpaceGateway:re,updateSpaceGateway:ie,refreshSpaceGateways:P,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:p,spaceGatewayIsSelected:C,updateAutoBackup:K,abortBlockletBackup:X,backupEndpoint:u,backupProgress:f,backups:Z,backupSummary:se,refreshBackupSummary:ne,refreshBackups:oe,setBackupDate:n,backupsLoading:k,autoBackup:T},children:t})}Te.propTypes={children:m.any.isRequired};function O(){return b.useContext(Ee)}function Ie({...t}){const{blocklet:o}=M(),{info:a}=N(),{t:s}=D(),r=Be({blocklet:o}),n=tt(a),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:Ce.create({baseURL:me(window.location.origin,st())}).get,webWalletUrl:n,extraParams:{appPid:o.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:a.did}},l=async({endpoint:p,name:f,did:u})=>{const k=await kt(p);if(!await jt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(y=>y.endpoint===p)){B.error(s("storage.spaces.gateway.add.duplicate",{name:f}));return}await i({name:f,did:u,url:k,endpoint:p},p)},x=async({spaceGateway:p})=>{try{await l(p)}catch(f){console.error(f),B.error(Q(f))}};return e.jsx(ut,{...t,connectScope:"app",options:d,onSuccess:x})}function Re({...t}){const{t:o}=b.useContext(at),{blocklet:a,loading:s}=Et();if(a?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?nt(d):"empty"})]}),n=a.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:o("blocklet.diskInfo.appDir"),value:r(n.BLOCKLET_APP_DIR,a.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:r(n.BLOCKLET_DATA_DIR,a.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:r(n.BLOCKLET_LOG_DIR,a.diskInfo.log)},{key:"cacheDir",name:o("blocklet.diskInfo.cacheDir"),value:r(n.BLOCKLET_CACHE_DIR,a.diskInfo.cache)}];return e.jsx(Mt,{component:"div",...t,children:c.map(i=>e.jsx(Dt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return s?e.jsx(z,{}):e.jsx(j,{children:o("blocklet.diskInfo.empty")})}const Mt=Ne(j)``;function Pe(){const{t}=D(),{setBackupDate:o,backupSummary:a}=O(),s=mt({key:"lg"}),r=b.useRef(null),n=_e(),c=b.useCallback(l=>{o(l)},[o]),i=b.useMemo(()=>{const l=E().add(1,"day"),x=l.subtract(1,"year"),p=new Map(a.map(u=>[u.date,{date:u.date,successCount:u.successCount,errorCount:u.errorCount}])),f=[];for(let u=x.clone();E(u).isBefore(l);u=u.add(1,"day")){const k=u.format("YYYY-MM-DD");f.push(p.get(k)||{date:k,successCount:0,errorCount:0})}return f},[a]),d=b.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:S,errorCount:y}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${y}</div>`].join(`
1
+ import{j as e,W as m,a6 as z,T as j,at as Ne,D as _e,e7 as V,ao as J,e8 as We,ak as h,b6 as F,bb as Fe,s as fe,e9 as be,br as Ke,am as ge,cF as Ge,M as G,aO as Y,bO as Ye,aP as $,Q as $e,a$ as qe,aR as He,ea as Qe,eb as Xe,ec as Ve,dF as Je,b4 as he}from"./vendor-mui-core-DnR6WYuU.js";import{q as Ze,l as ke,a as ue}from"./vendor-hooks-qxhUUbW5.js";import{r as b,j as et}from"./vendor-react-CTtPmzVP.js";import{Y as M,Z as N,Q as E,J as L,bI as tt,bX as st,al as nt,c as I,l as ot}from"./index-DG0EDext.js";import{H as B,V as D,aU as at,aV as q,aP as rt,R as it,w as le,aX as ct}from"./vendor-ux-IiqHAjMq.js";import{u as lt}from"./use-mobile-BINJTzMb.js";import{a as H,d as je,N as dt,c as pt,D as Ce,C as me}from"./vendor-utils-CxWN1dT3.js";import{o as we}from"./vendor-arcblock-DyliHtVF.js";import{a as ut,u as mt,c as xt,D as de,b as ft}from"./index-D4cbtlCM.js";import"./index-ByMKy0IO.js";import"./index-BojVbZw0.js";import"./api-FQQlzPOP.js";import{u as Be,C as gt,D as ht,a as St}from"./connect-to-B_iWUbwW.js";import{c as yt,g as bt,d as kt,i as jt,e as xe,f as Ct,h as wt,j as Bt}from"./spaces-DGJd1uEt.js";import{f as Q}from"./index-DBs9Ljax.js";import{v as Dt}from"./index-CLao_b9r.js";import{a as Et}from"./dashboard-Bu3a5Px4.js";import{E as Tt}from"./index-D1SIrheh.js";import{x as It}from"./index-DRYJ0xIl.js";import{g as Se}from"./get-safe-url-DaqBo3hv.js";import{S as Rt}from"./switch-control-D9D8FbX3.js";import{C as Pt,u as At}from"./config-space-D2mAEqFL.js";import{L as ye}from"./list-header-Cl3jykCe.js";import"./lottie-web-4koyQiv_.js";import"./session-D-wwXXFW.js";import"./team-DvyWlb8W.js";import"./isURL-D4WfF4w_.js";import"./use-app-logo-BKJ912HX.js";import"./useAsyncRetry-r8dEPb-x.js";import"./useAsync-Dotoxibi.js";import"./useSetState-L-f8mSga.js";import"./index-5n0QAOjO.js";import"./zh-DL3Su93_.js";import"./over-due-invoice-payment-rAHkUVgY.js";import"./useLocalStorage-BmGa-RG8.js";import"./confirm-DQlu79Sm.js";import"./passport-DzlmGAGE.js";import"./create-passport-svg-BwkPTICE.js";import"./index-Bg5uZrWj.js";async function vt({blockletDid:t,nodeApi:o,spaceGateways:a}){let s=!1;const r=await Promise.all(a.map(async n=>{let{name:c}=n;const i=await yt(n.endpoint);return!H(i)&&i!==c&&(c=i,s=!0),{...n,name:c}}));return s&&await Promise.all(r.filter(n=>n.did).map(n=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:n.did},spaceGateway:{...n}}}))),r}function zt({refresh:t}={}){const{blocklet:o}=M(),a=o?.meta?.did,{api:s}=N();return Ze(async()=>{if(!a)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:a}});return await vt({blockletDid:a,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[a,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(Q(r)))}})}function De({deps:t,setLoading:o,backupDate:a}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=M(),[r,n]=b.useState([]),{api:c}=N(),[i,d]=b.useMemo(()=>a?[E(a).startOf("day").toISOString(),E(a).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[a]),l=je(async()=>{try{if(o(!0),!s){n([]);return}const{backups:x}=await c.getBlockletBackups({input:{did:s.meta.did,startTime:i,endTime:d}});n(x??[])}catch(x){console.error(x),B.error(Q(x))}finally{o(!1)}},1e3);return ke(async()=>{l()},[s?.meta?.did].concat(t)),{backups:r}}function Ot({appDid:t}){const{backups:o}=De(),[a,s]=b.useState({message:"",progress:0,completed:!1}),r=N(),{ws:{useSubscription:n}}=r;return n(L.BlockletEvents.backupProgress,c=>{t===c?.appDid&&s(()=>({...c}))},[t]),b.useEffect(()=>{if(o?.length&&dt(o[0]?.status)){const[c]=o;s(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[o]),a}function Ut({deps:t=[],setLoading:o=()=>{}}={}){const{blocklet:a}=M(),[s,r]=b.useState([]),{api:n}=N(),c=b.useCallback(je(async()=>{if(!n||!a?.meta?.did){r([]);return}try{o(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await n.getBlockletBackupSummary({input:{did:a.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}}),x=Array.isArray(l)?l.map(p=>({...p,successCount:+p.successCount,errorCount:+p.errorCount})):[];r(x)}catch(i){console.error("Failed to fetch backup summary:",i),B.error(Q(i)),r([])}finally{o(!1)}},1e3),[]);return ke(async()=>(await c(),()=>{c.cancel()}),[a?.meta?.did].concat(t)),{backupSummary:s}}const Ee=b.createContext({}),{Provider:Lt,Consumer:Os}=Ee;function Te({children:t}){const{t:o}=D(),{api:a}=N(),{blocklet:s}=M(),[r,n]=b.useState(null),[c,i]=b.useState(!1),{data:d,loading:l,mutate:x}=zt({refresh:c}),p=pt(d),f=Ot({appDid:s?.appDid}),u=b.useMemo(()=>bt(s?.environments),[s?.environments]),[k,w]=b.useState(!1),[S,y]=b.useState(0),{backups:Z}=De({deps:[S,r],setLoading:w,backupDate:r}),[ee,te]=b.useState(0),{backupSummary:se}=Ut({deps:[ee]}),[_,U]=b.useState(d?.find(g=>g.endpoint===u)),T=s?.settings?.autoBackup,P=()=>{i(g=>!g)},ne=()=>{te(g=>g+1)},oe=()=>{y(g=>g+1)},K=async g=>{await a.updateAutoBackup({input:{did:s.meta.did,autoBackup:g}})},X=async()=>{await a.abortBlockletBackup({input:{appPid:s.meta.did}})},ae=async(g,v)=>{try{x(R=>{const A=[...R];return A.push({...g,loading:!0}),A}),await a.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:g}}),u!==v&&await a.configBlocklet({input:{did:[s.meta.did],configs:[{key:L.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:v}]}}),U(g),P(),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),x(A=>[...A].filter(W=>W.did!==g.did)),R}},re=async g=>{g&&(g.endpoint===u&&(await a.configBlocklet({input:{did:[s.meta.did],configs:[{key:L.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),T?.enabled&&await K({enabled:!1})),await a.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:g?.did}}),x(v=>{const R=[...v];return R.splice(R.indexOf(g),1),R}),U(g),P())},ie=async g=>{await Promise.all([a.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:g.did},spaceGateway:g}}),u!==g.endpoint&&a.configBlocklet({input:{did:[s.meta.did],configs:[{key:L.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),P()},C=g=>g?.endpoint===u;return e.jsx(Lt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ae,deleteSpaceGateway:re,updateSpaceGateway:ie,refreshSpaceGateways:P,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:p,spaceGatewayIsSelected:C,updateAutoBackup:K,abortBlockletBackup:X,backupEndpoint:u,backupProgress:f,backups:Z,backupSummary:se,refreshBackupSummary:ne,refreshBackups:oe,setBackupDate:n,backupsLoading:k,autoBackup:T},children:t})}Te.propTypes={children:m.any.isRequired};function O(){return b.useContext(Ee)}function Ie({...t}){const{blocklet:o}=M(),{info:a}=N(),{t:s}=D(),r=Be({blocklet:o}),n=tt(a),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:Ce.create({baseURL:me(window.location.origin,st())}).get,webWalletUrl:n,extraParams:{appPid:o.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:a.did}},l=async({endpoint:p,name:f,did:u})=>{const k=await kt(p);if(!await jt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(y=>y.endpoint===p)){B.error(s("storage.spaces.gateway.add.duplicate",{name:f}));return}await i({name:f,did:u,url:k,endpoint:p},p)},x=async({spaceGateway:p})=>{try{await l(p)}catch(f){console.error(f),B.error(Q(f))}};return e.jsx(ut,{...t,connectScope:"app",options:d,onSuccess:x})}function Re({...t}){const{t:o}=b.useContext(at),{blocklet:a,loading:s}=Et();if(a?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?nt(d):"empty"})]}),n=a.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:o("blocklet.diskInfo.appDir"),value:r(n.BLOCKLET_APP_DIR,a.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:r(n.BLOCKLET_DATA_DIR,a.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:r(n.BLOCKLET_LOG_DIR,a.diskInfo.log)},{key:"cacheDir",name:o("blocklet.diskInfo.cacheDir"),value:r(n.BLOCKLET_CACHE_DIR,a.diskInfo.cache)}];return e.jsx(Mt,{component:"div",...t,children:c.map(i=>e.jsx(Dt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return s?e.jsx(z,{}):e.jsx(j,{children:o("blocklet.diskInfo.empty")})}const Mt=Ne(j)``;function Pe(){const{t}=D(),{setBackupDate:o,backupSummary:a}=O(),s=mt({key:"lg"}),r=b.useRef(null),n=_e(),c=b.useCallback(l=>{o(l)},[o]),i=b.useMemo(()=>{const l=E().add(1,"day"),x=l.subtract(1,"year"),p=new Map(a.map(u=>[u.date,{date:u.date,successCount:u.successCount,errorCount:u.errorCount}])),f=[];for(let u=x.clone();E(u).isBefore(l);u=u.add(1,"day")){const k=u.format("YYYY-MM-DD");f.push(p.get(k)||{date:k,successCount:0,errorCount:0})}return f},[a]),d=b.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:S,errorCount:y}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${y}</div>`].join(`
2
2
  `)},backgroundColor:n.palette.background.paper,borderColor:n.palette.divider,textStyle:{color:n.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${n.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:V[600]},{min:-9,max:-6,color:V[500]},{min:-6,max:-3,color:V[400]},{min:-3,max:-1,color:V[300]},{min:0,max:0,color:n.palette.grey[200]},{min:1,max:3,color:J[300]},{min:3,max:6,color:J[400]},{min:6,max:9,color:J[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:J[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:n.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,color:n.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:n.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:n.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:We[200],color:"inherit"}}}}),[i,t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(h,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(h,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Tt,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&c(l.data[0])}}})})}),e.jsx(h,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2},children:e.jsxs(F,{direction:s?"column":"row",spacing:s?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center"},children:[e.jsxs(F,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(F,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(F,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Nt=fe(({className:t,...o})=>e.jsx(ge,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ae({status:t,message:o="",createdAt:a}){const{t:s}=D(),r=t===I.BACKUPS.STATUS.PROGRESS&&E().diff(a,"hours")>=I.BACKUPS.TIMEOUT_HOURS,n=r&&s("common.timeoutError"),c=t===I.BACKUPS.STATUS.PROGRESS&&!r,i=t===I.BACKUPS.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):i?e.jsx(q,{type:"success",children:s("common.succeeded")}):e.jsxs(h,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"error",children:s("common.failed")}),e.jsx(ge,{style:{display:"flex",alignItems:"center",flexShrink:0},title:o||n,children:e.jsx(be,{children:e.jsx(Ge,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Ae.propTypes={status:m.string.isRequired,message:m.string,createdAt:m.string.isRequired};function ve({metadata:t={}}){const{t:o}=D();if(H(t))return e.jsx(q,{type:"success",children:o("common.succeeded")});const a=t.count||0,s=t.size||0,r=It(s,{iec:!0}),n=e.jsxs(h,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[o("common.fileCount"),": ",a]}),e.jsxs(j,{variant:"body2",children:[o("common.fileSize"),": ",r]})]});return e.jsxs(h,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"success",children:o("common.succeeded")}),e.jsx(Nt,{title:n,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(be,{children:e.jsx(Ke,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}ve.propTypes={metadata:m.object};function ze(){const{t,locale:o}=D(),{spaceGateways:a,backups:s,backupsLoading:r}=O(),n=b.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:x,createdAt:p}=s[i],f=x===I.BACKUPS.STATUS.PROGRESS&&E().diff(p,"hours")>=I.BACKUPS.TIMEOUT_HOURS,u=x===I.BACKUPS.STATUS.SUCCEEDED&&!f,k=l||a.find(w=>d?.includes(xe(w?.endpoint)))?.name||"Unknown DID Space";return u?e.jsx(Fe,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(q,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:i=>E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:i=>H(i)?"":E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:i=>{const d=s?.[i]??{},{status:l,message:x,createdAt:p,metadata:f}=d,u=l===I.BACKUPS.STATUS.PROGRESS&&E().diff(p,"hours")>=I.BACKUPS.TIMEOUT_HOURS,k=l===I.BACKUPS.STATUS.PROGRESS&&!u,w=l===I.BACKUPS.STATUS.SUCCEEDED&&!u;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(ve,{metadata:f}):e.jsx(Ae,{status:l,message:x,createdAt:p})}}}],[s,a,t]),c=b.useMemo(()=>!s?.length,[s]);return e.jsx(e.Fragment,{children:c?e.jsx(h,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(rt,{title:"",loading:r,data:s,columns:n,emptyNode:t("storage.spaces.record.emptyData",o),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function _t(){const{t}=D();return e.jsxs(h,{children:[e.jsxs(h,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(xt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(Ie,{})]}),e.jsxs(h,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(h,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(Pe,{})]})]}),e.jsx(ze,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Re,{})]})}function Oe({spaceGateway:t,onConfirm:o=()=>{},onCancel:a=()=>{}}){const{t:s}=D(),[r,n]=b.useState(!1),[c,i]=b.useState(!1),d=(p,f)=>{p?.preventDefault(),p?.stopPropagation(),n(f)},l=async p=>{try{p?.stopPropagation(),i(!0),await o?.(t),n(!1)}catch(f){console.error(f),B.error(`${s("storage.space.gateway.delete.failed")}: ${Q(f)}`)}finally{n(!1),i(!1)}},x=p=>{d(p,!1),a?.(p)};return e.jsxs(e.Fragment,{children:[e.jsxs(G,{color:"red",onClick:p=>d(p,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(Ye,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(it,{title:s("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:c}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:c}},onConfirm:l,onCancel:x,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Oe.propTypes={spaceGateway:m.shape({name:m.string.isRequired,url:m.string.isRequired,protected:m.bool}).isRequired,onConfirm:m.func,onCancel:m.func};function Ue({spaceGateway:t,selected:o,onDelete:a=()=>{},onConnect:s=()=>{},enableSwitchToSpace:r=!0,backupInProgress:n=!1,...c}){const{abortBlockletBackup:i}=O(),[d,l]=b.useState(null),{t:x}=D(),[p,f]=b.useState(!1),u=(S,y)=>{S.stopPropagation(),S.preventDefault(),l(y&&S.currentTarget)},k=async S=>{try{f(!0),u(S,!1),await s(t)}catch(y){console.error(y),B.error(y.message)}finally{f(!1)}},w=async S=>{try{f(!0),u(S,!1),await i()}catch(y){console.error(y),B.error(y.message)}finally{f(!1)}};return e.jsxs(e.Fragment,{children:[p||t?.loading?e.jsx(z,{sx:{ml:1},size:"24px"}):e.jsx($e,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>u(S,!0),...c,children:e.jsx(qe,{})}),e.jsxs(He,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:S=>u(S,!1),children:[e.jsxs(G,{onClick:S=>{u(S,!1),window.open(Se(t.endpoint?Ct(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Qe,{fontSize:"small"})}),e.jsx($,{children:x("common.open")})]}),e.jsxs(G,{onClick:S=>{u(S,!1),window.open(Se(wt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Xe,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.strategy.viewBackupFiles")})]}),!o&&r&&e.jsxs(G,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ve,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.connect.switchToSpace")})]}),n&&e.jsxs(G,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Je,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.connect.abortBlockletBackup")})]}),!n&&e.jsx(Oe,{spaceGateway:t,onConfirm:async()=>{l(null),await a?.(t)},onCancel:()=>l(null)})]})]})}Ue.propTypes={spaceGateway:m.shape({name:m.string.isRequired,url:m.string.isRequired,protected:m.bool,endpoint:m.string.isRequired,loading:m.bool}).isRequired,selected:m.bool.isRequired,enableSwitchToSpace:m.bool,onDelete:m.func,onConnect:m.func,backupInProgress:m.bool};const Wt=fe(({className:t,...o})=>e.jsx(ge,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Le({spaceGateway:t,spaceStatus:o,selected:a,onConnected:s=()=>{},onDeleted:r=()=>{},onBackedUp:n=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=M(),{api:l,info:{did:x}}=N(),{appDid:p,appName:f,appDescription:u,scopes:k,appUrl:w,referrer:S}=Be({blocklet:d}),{backupProgress:y,updateSpaceGateway:Z,deleteSpaceGateway:ee,refreshBackupSummary:te,refreshBackups:se}=O(),[_,U]=b.useState(!1),[T,P]=b.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:f},i),scan:c("storage.spaces.authorize.scan",{appName:f},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{P(C=>({...C,open:!1}))}}),ne=a&&!_&&o===de.DISCONNECTED,oe=a&&!_&&!t.loading&&o===de.CONNECTED,K=a&&_&&o===de.CONNECTED&&y?.progress>=0,X=async()=>{try{if(await Bt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:L.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s?.(null,t);return}}catch(C){console.error(C),s?.(C,t);return}P(C=>({...C,open:!0,prefix:me(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:Ce.create({baseURL:me(t.url,"space")}).get,extraParams:{appDid:p,appName:f,appDescription:u,scopes:k,appUrl:w,referrer:S,nodeDid:x,spaceDid:t.did}}))},ae=async(C,g)=>{const v=g(C.endpoint),R=xe(v),A=C.space?g(C.space):{};if(t.did&&R!==t.did){P(Me=>({...Me,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:A?.name?A.name:""});B.error(W),s?.(new Error(W),t);return}const ce={...t,name:A.name??"DID Space",did:A.did??xe(v),endpoint:v};await Z(ce),P(W=>({...W,open:!1})),s?.(null,ce)},re=async()=>{try{if(_)return;U(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),n?.(C,t)}finally{U(!0)}},ie=async()=>{try{await ee(t),B.success(c("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return b.useEffect(()=>{y?.completed?(a&&(y?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),n?.(null,t)):y.message&&n?.(new Error(y?.message),t),y.progress=0,y.message=""),U(!1),te(),se()):y.progress&&U(!0)},[y]),e.jsxs(e.Fragment,{children:[e.jsxs(h,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[oe&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:re,children:c("storage.spaces.strategy.backupNow")}),ne&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:X,children:c("storage.spaces.disconnected.reconnectNow")}),K&&e.jsx(Wt,{title:y?.message&&e.jsx(h,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:y.message})}),children:e.jsxs(le,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(z,{variant:"determinate",value:y?.progress,size:14,sx:{mr:1}}),y?.progress,"%"]})}),e.jsx(ot,{forceConnected:!1,saveConnect:!1,prefix:T.prefix,open:T.open,popup:!0,action:T.action,baseUrl:T.baseUrl,checkFn:T.checkFn,onSuccess:ae,onClose:T.onClose,checkTimeout:T.checkTimeout,extraParams:T.extraParams,messages:T.messages,locale:i},"get-endpoint")]}),e.jsx(Ue,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:a,onDelete:ie,onConnect:X,enableSwitchToSpace:y?.completed||H(y?.message),backupInProgress:K})]})}Le.propTypes={spaceGateway:m.shape({did:m.string.isRequired,name:m.string.isRequired,url:m.string.isRequired,endpoint:m.string.isRequired,protected:m.bool,loading:m.bool}).isRequired,spaceStatus:m.string.isRequired,selected:m.bool.isRequired,onConnected:m.func,onDeleted:m.func,onBackedUp:m.func};function Ft({...t}){const{t:o}=D();return e.jsxs(h,{...t,children:[e.jsx(h,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:o("storage.spaces.backup.records")})}),e.jsx(Pe,{}),e.jsx(ze,{})]})}function Kt({...t}){const{t:o}=D(),{autoBackup:a,updateAutoBackup:s}=O(),r=async()=>{try{const n=!a?.enabled;await s({enabled:n}),B.success(o(n?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(n){B.error(n.message)}};return e.jsx(Rt,{checked:!!a?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:o("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function Gt(){const{t}=D(),{spaceGateways:o,spaceGatewaysLoading:a,spaceGatewayIsSelected:s}=O(),r=a&&!o?.length,n=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(Le,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:x=>x&&l()});return e.jsxs(h,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(Kt,{}),e.jsx(Ie,{})]}),e.jsx(h,{sx:{mt:2},children:r?e.jsx(h,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(z,{})}):e.jsx(he,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:o.map(c=>e.jsx(he,{size:{xs:12,md:6},children:e.jsx(ft,{endpoint:c.endpoint,selected:s(c),action:n},c.endpoint)},c.endpoint))})})}),e.jsx(Ft,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Re,{})]})}function Yt(){const{spaceGatewaysFirstLoading:t,spaceGateways:o}=O();return t?e.jsx(we,{relative:"parent",children:e.jsx(z,{})}):H(o)?e.jsx(_t,{}):e.jsx(Gt,{})}function $t(){return e.jsx(Te,{children:e.jsx(Yt,{})})}function qt(){const{spaceGateway:t,settingStorageEndpoint:o,updateSpaceGateway:a,hasStorageEndpoint:s,loading:r,storageEndpoint:n}=At(),c=ue(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(we,{relative:"parent",children:e.jsx(z,{})}):e.jsxs(h,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(gt,{spaceGateway:t,settingStorageEndpoint:o}):e.jsx(ht,{}),e.jsx(h,{sx:c,children:e.jsx(St,{onConnect:a,storageEndpoint:n})})]})}function Ht(){const{t}=D();return e.jsxs(Pt,{children:[e.jsxs(F,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(qt,{})]})}function Qt({navOrientation:t="vertical",...o}){const{t:a,locale:s}=D(),{blocklet:r}=M(),n=lt({key:"md"}),[c,i]=et(),d=c.get("tab")||"backup",l=n?"horizontal":t,x=ue(()=>{const w=[{label:a("common.backup"),value:"backup"}],S=r?.capabilities?.didSpace;return(S===L.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===L.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:a("common.storage"),value:"storage"}),w},[s,l]),f=ue(()=>({backup:e.jsx($t,{}),storage:e.jsx(Ht,{})}))[d],u=w=>{i(S=>(w==="backup"?S.delete("tab"):S.set("tab",w),S))};if(x.length<=1)return e.jsx(pe,{children:f});const k=e.jsx(ct,{tabs:x,current:d,orientation:l,onChange:u,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(h,{...o,children:e.jsxs(F,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(h,{sx:{flexShrink:0},children:e.jsx(ye,{left:k})}),e.jsx(h,{sx:{flexGrow:1,minWidth:0},children:e.jsx(pe,{sx:{mt:1},children:f})})]})});if(l==="horizontal")return e.jsxs(h,{...o,children:[e.jsx(ye,{left:k}),e.jsx(pe,{sx:{mt:2},children:f})]})}Qt.propTypes={navOrientation:m.oneOf(["vertical","horizontal"])};const pe=fe(h)`
3
3
  position: relative;
4
4
  min-height: 66vh;
@@ -1,4 +1,4 @@
1
- import{j as t,a6 as f,ak as r,at as j,W as n}from"./vendor-mui-core-DnR6WYuU.js";import{r as h}from"./vendor-react-CTtPmzVP.js";import{aU as S,w as p}from"./vendor-ux-B2x-0VyJ.js";import{a as C}from"./page-header-CHAwrgX-.js";import{Y as g}from"./index-FreeXNkk.js";import{o as b}from"./vendor-arcblock-hbumvS-z.js";import{u as k}from"./config-space-BR-bgToj.js";import{C as y,D as w,a as v}from"./connect-to-BkcNrFMt.js";import{S as c}from"./step-actions-imyD5TuN.js";import{S as E}from"./layout-DP35nSHr.js";import"./vendor-utils-CxWN1dT3.js";import"./vendor-hooks-qxhUUbW5.js";import"./lottie-web-4koyQiv_.js";import"./spaces-C8s0ejS4.js";import"./api-FQQlzPOP.js";import"./index-CjS1scdg.js";import"./index-DRYJ0xIl.js";import"./index-BojVbZw0.js";import"./index-0SUQD3K4.js";import"./index-DBs9Ljax.js";import"./use-mobile-D5clNlrm.js";import"./content-layout-DmSBGGVm.js";function T({onNext:a=()=>{},onPrevious:d=()=>{}}){const{t:e}=h.useContext(S),{blocklet:o}=g(),{spaceGateway:m,settingStorageEndpoint:l,updateSpaceGateway:u,hasStorageEndpoint:x,loading:i,storageEndpoint:s}=k();return i?t.jsx(b,{relative:"parent",children:t.jsx(f,{})}):t.jsxs(B,{children:[t.jsx("div",{className:"header",children:t.jsx(C,{title:e("setup.didSpace.title"),subTitle:e("setup.didSpace.subTitle"),onClickBack:d})}),t.jsxs(r,{className:"form-container",sx:{width:"100%",maxWidth:"720px"},children:[x?t.jsx(y,{spaceGateway:m,settingStorageEndpoint:l}):t.jsx(w,{}),o?.capabilities?.didSpace&&t.jsx(r,{sx:{display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"24px"},children:t.jsx(v,{onConnect:u,storageEndpoint:s})})]}),o?.capabilities?.didSpace==="required"&&t.jsx(c,{mt:8,children:t.jsx(p,{loading:i,variant:"contained",disabled:i||!s,onClick:()=>a(),children:e("setup.continue")})}),o?.capabilities?.didSpace==="optional"&&t.jsx(c,{blocklet:o,onStartNow:()=>a("complete"),children:t.jsx(p,{className:"start-now",loading:i,variant:"contained",disabled:i,onClick:()=>a(),children:e(s?"setup.continue":"setup.skip")})})]})}T.propTypes={onNext:n.func,onPrevious:n.func};const B=j(E)`
1
+ import{j as t,a6 as f,ak as r,at as j,W as n}from"./vendor-mui-core-DnR6WYuU.js";import{r as h}from"./vendor-react-CTtPmzVP.js";import{aU as S,w as p}from"./vendor-ux-IiqHAjMq.js";import{a as C}from"./page-header-CHAwrgX-.js";import{Y as g}from"./index-DG0EDext.js";import{o as b}from"./vendor-arcblock-DyliHtVF.js";import{u as k}from"./config-space-D2mAEqFL.js";import{C as y,D as w,a as v}from"./connect-to-B_iWUbwW.js";import{S as c}from"./step-actions-BKMeYA5x.js";import{S as E}from"./layout-CdGgFfY4.js";import"./vendor-utils-CxWN1dT3.js";import"./vendor-hooks-qxhUUbW5.js";import"./lottie-web-4koyQiv_.js";import"./spaces-DGJd1uEt.js";import"./api-FQQlzPOP.js";import"./index-D4cbtlCM.js";import"./index-DRYJ0xIl.js";import"./index-BojVbZw0.js";import"./index-ByMKy0IO.js";import"./index-DBs9Ljax.js";import"./use-mobile-D5clNlrm.js";import"./content-layout-DmSBGGVm.js";function T({onNext:a=()=>{},onPrevious:d=()=>{}}){const{t:e}=h.useContext(S),{blocklet:o}=g(),{spaceGateway:m,settingStorageEndpoint:l,updateSpaceGateway:u,hasStorageEndpoint:x,loading:i,storageEndpoint:s}=k();return i?t.jsx(b,{relative:"parent",children:t.jsx(f,{})}):t.jsxs(B,{children:[t.jsx("div",{className:"header",children:t.jsx(C,{title:e("setup.didSpace.title"),subTitle:e("setup.didSpace.subTitle"),onClickBack:d})}),t.jsxs(r,{className:"form-container",sx:{width:"100%",maxWidth:"720px"},children:[x?t.jsx(y,{spaceGateway:m,settingStorageEndpoint:l}):t.jsx(w,{}),o?.capabilities?.didSpace&&t.jsx(r,{sx:{display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"24px"},children:t.jsx(v,{onConnect:u,storageEndpoint:s})})]}),o?.capabilities?.didSpace==="required"&&t.jsx(c,{mt:8,children:t.jsx(p,{loading:i,variant:"contained",disabled:i||!s,onClick:()=>a(),children:e("setup.continue")})}),o?.capabilities?.didSpace==="optional"&&t.jsx(c,{blocklet:o,onStartNow:()=>a("complete"),children:t.jsx(p,{className:"start-now",loading:i,variant:"contained",disabled:i,onClick:()=>a(),children:e(s?"setup.continue":"setup.skip")})})]})}T.propTypes={onNext:n.func,onPrevious:n.func};const B=j(E)`
2
2
  height: 100%;
3
3
  overflow-y: auto;
4
4
  `;export{T as default};