@abtnode/webapp 1.16.53-beta-20251014-110009-8220e324 → 1.16.54-beta-20251016-050817-2fc632b8

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 (190) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/dist/assets/{AdapterDayjs-CT2knpDN.js → AdapterDayjs-NScUj50m.js} +1 -1
  4. package/dist/assets/{Add-B5kXVjlA.js → Add-D4EYSG3K.js} +1 -1
  5. package/dist/assets/ArrowDropDown-DonW35Zx.js +1 -0
  6. package/dist/assets/{Autocomplete-bHChBtVA.js → Autocomplete-Dy_zZ4Oc.js} +1 -1
  7. package/dist/assets/{Breadcrumbs-BpV5sgxT.js → Breadcrumbs-C8gaKT3g.js} +1 -1
  8. package/dist/assets/{ButtonGroup-CDUEw9SW.js → ButtonGroup-DcZ0ug1l.js} +1 -1
  9. package/dist/assets/{CSSTransition-oc_jqFQN.js → CSSTransition-V4R7ZcvS.js} +1 -1
  10. package/dist/assets/{CallMerge-BrtGjpke.js → CallMerge-KoAXFCaW.js} +1 -1
  11. package/dist/assets/{CardContent-DJkOCDLg.js → CardContent-W_hyQjAD.js} +1 -1
  12. package/dist/assets/{ChevronLeft-DH29Zimq.js → ChevronLeft-CKiAYw9j.js} +1 -1
  13. package/dist/assets/{ChevronRight-BRfOjT4T.js → ChevronRight-DZiek3NZ.js} +1 -1
  14. package/dist/assets/{Clear-DX2cXl5s.js → Clear---RPVeR7.js} +1 -1
  15. package/dist/assets/{DeleteOutline-rUX66WwM.js → DeleteOutline-GpuLmtYQ.js} +1 -1
  16. package/dist/assets/{Done-BChOhJAU.js → Done-DzMcAgjX.js} +1 -1
  17. package/dist/assets/{Edit-BgZAPfMS.js → Edit-DCJEwDTg.js} +1 -1
  18. package/dist/assets/{ErrorOutline-C0x4yDj7.js → ErrorOutline-B9LgxSpq.js} +1 -1
  19. package/dist/assets/{FilterList-CjNG8_Me.js → FilterList-CNYUVm5S.js} +1 -1
  20. package/dist/assets/{Google-BFNuxUqB.js → Google-DR320mb8.js} +1 -1
  21. package/dist/assets/{HelpOutline-JDUwTxNr.js → HelpOutline-USuznZgn.js} +1 -1
  22. package/dist/assets/{KeyboardArrowDown-B-1XGRf9.js → KeyboardArrowDown-rbx_AuZr.js} +1 -1
  23. package/dist/assets/{Launch-BM8tef6Y.js → Launch-DkmyUeYd.js} +1 -1
  24. package/dist/assets/{Link-B4nyHdoF.js → Link-CgW5geY5.js} +1 -1
  25. package/dist/assets/{ListItemButton-C-7jKIP8.js → ListItemButton-BhvWhm3n.js} +1 -1
  26. package/dist/assets/{ListSubheader-DuidDB0a.js → ListSubheader-BlgmemtO.js} +1 -1
  27. package/dist/assets/{LoadingButton-B4_fOUbX.js → LoadingButton-DpbZOfZH.js} +1 -1
  28. package/dist/assets/{MoreVert-zazLZzFB.js → MoreVert-wWXtgLji.js} +1 -1
  29. package/dist/assets/{OpenInNew-q2sIX9R4.js → OpenInNew-B8ApQgxt.js} +1 -1
  30. package/dist/assets/{Refresh-CPw_l8px.js → Refresh-nk8BSp_h.js} +1 -1
  31. package/dist/assets/{Search-DEPwrfa9.js → Search-DV5vJN1H.js} +1 -1
  32. package/dist/assets/{Stepper-8dFRVeqa.js → Stepper-Dm3PYaFi.js} +1 -1
  33. package/dist/assets/{Switch-BzWBU8yM.js → Switch-czLKbhPZ.js} +1 -1
  34. package/dist/assets/{TableSearch-DOm0JN54.js → TableSearch-CAf-ESr9.js} +1 -1
  35. package/dist/assets/{ToggleButtonGroup-CdulBJn7.js → ToggleButtonGroup-Csc72nBu.js} +1 -1
  36. package/dist/assets/{UnfoldMore-B4TAWJFj.js → UnfoldMore-BQzQy89p.js} +1 -1
  37. package/dist/assets/{Verified-BvVUNdGO.js → Verified-CF2yeqGT.js} +1 -1
  38. package/dist/assets/{VerifiedUser-wQPNfQVE.js → VerifiedUser-C1tgCpCB.js} +1 -1
  39. package/dist/assets/{ViewList-CY3VNyEW.js → ViewList-CE_c5qLh.js} +1 -1
  40. package/dist/assets/{_createAggregator-Db2ymfxv.js → _createAggregator-Bnob81wI.js} +1 -1
  41. package/dist/assets/{actions-C5JFmT-q.js → actions-Cpb8n0Yw.js} +1 -1
  42. package/dist/assets/{actions-CIeK6cUZ.js → actions-DtMFbSMo.js} +1 -1
  43. package/dist/assets/{agreement-De9vaSzJ.js → agreement-D_SlINnK.js} +1 -1
  44. package/dist/assets/api-OdGoHXe4.js +1 -0
  45. package/dist/assets/{appearance-gnEGUOf_.js → appearance-buyEW0Iv.js} +1 -1
  46. package/dist/assets/{audit-logs-BGqaeoE8.js → audit-logs-CLj12YBu.js} +1 -1
  47. package/dist/assets/{base-chart-Cdw1ktRm.js → base-chart-E6uEbiC0.js} +1 -1
  48. package/dist/assets/{blocklet-B_F88Tat.js → blocklet-BSWtuwnH.js} +1 -1
  49. package/dist/assets/{chain-_RfIu3NG.js → chain-Cxmkzj72.js} +1 -1
  50. package/dist/assets/{click-to-copy-DKJULX-E.js → click-to-copy-C5l1aVBQ.js} +1 -1
  51. package/dist/assets/client-BaEuKBw8.js +1 -0
  52. package/dist/assets/cloneDeep-CPQcx7Qa.js +1 -0
  53. package/dist/assets/{collapse-Bt-lrDsW.js → collapse-D-q9UEjV.js} +1 -1
  54. package/dist/assets/{config-navigation-Br1ikf7O.js → config-navigation-Ck-BfL0o.js} +3 -3
  55. package/dist/assets/{connect-to-B3WMO9NZ.js → connect-to-sME9XFIO.js} +1 -1
  56. package/dist/assets/{cssMode-BpIHUHBi.js → cssMode-CwQeOUoG.js} +1 -1
  57. package/dist/assets/{delete-confirm-CScy8CpF.js → delete-confirm-CiFwBlNG.js} +1 -1
  58. package/dist/assets/{depsEqual-DFUdc1h4.js → depsEqual-BHCVOuWA.js} +1 -1
  59. package/dist/assets/{detail-DAA4xW7d.js → detail-u9DgWb-d.js} +3 -3
  60. package/dist/assets/{domains-C1C2bhHb.js → domains-CuwWHtSp.js} +1 -1
  61. package/dist/assets/{download-CaTl4zbM.js → download-B1XuXwBn.js} +1 -1
  62. package/dist/assets/{edit.svg-DLR7W7oi.js → edit.svg-BT2rpJxW.js} +1 -1
  63. package/dist/assets/emotion-cache.browser.esm-CQ2-5c4_.js +1 -0
  64. package/dist/assets/engine-wH21TR28.js +1 -0
  65. package/dist/assets/{freemarker2-DmCzdcqq.js → freemarker2-B3dcQl4s.js} +1 -1
  66. package/dist/assets/{get-safe-url-CVsSFVM-.js → get-safe-url-DfDeYxPo.js} +1 -1
  67. package/dist/assets/getValidReactChildren-DECNQV_G.js +1 -0
  68. package/dist/assets/{graphqlMode-B-6J-hpV.js → graphqlMode-gWZ1xdel.js} +2 -2
  69. package/dist/assets/{handlebars-DhRG3N5u.js → handlebars-DLMgXH9N.js} +1 -1
  70. package/dist/assets/{html-DldfQGgR.js → html-DmYIunqS.js} +1 -1
  71. package/dist/assets/{html-title-qBMXCmRQ.js → html-title-B42L4vHs.js} +1 -1
  72. package/dist/assets/{htmlMode-DWrLa2pl.js → htmlMode-CyuA6nxS.js} +1 -1
  73. package/dist/assets/{iframe-CqEGsthJ.js → iframe-B-84ZVfc.js} +1 -1
  74. package/dist/assets/{index-B3TQ1m-7.js → index-B-KmoBb-.js} +1 -1
  75. package/dist/assets/{index-CVVvxise.js → index-B4IIU09Y.js} +3 -3
  76. package/dist/assets/{index-CHDvsFaj.js → index-B6fuqqYD.js} +1 -1
  77. package/dist/assets/{index-BXQIx4QF.js → index-BHuxYJ36.js} +1 -1
  78. package/dist/assets/{index-B0LbFKW2.js → index-BIGgo0dk.js} +1 -1
  79. package/dist/assets/{index-C8lDVHeG.js → index-BKJPtvsM.js} +1 -1
  80. package/dist/assets/{index-CqWq8VRJ.js → index-Bb-RBdu9.js} +1 -1
  81. package/dist/assets/{index-mvZejwma.js → index-BcBcDLRF.js} +1 -1
  82. package/dist/assets/{index-BFWeWgZE.js → index-BkFC8ho3.js} +3 -3
  83. package/dist/assets/{index-DAsOMNw3.js → index-CAMlpQ47.js} +2 -2
  84. package/dist/assets/{index-DBf7KJKt.js → index-CAUKXdVD.js} +1 -1
  85. package/dist/assets/{index-CpnPkVho.js → index-CGwvwEUr.js} +1 -1
  86. package/dist/assets/{index-DbNhkmSY.js → index-CHZXKvDD.js} +1 -1
  87. package/dist/assets/{index-Djq6JIxf.js → index-CQ3QiuQQ.js} +1 -1
  88. package/dist/assets/{index-BlBdJ3Dk.js → index-CT-cKo4l.js} +1 -1
  89. package/dist/assets/{index-BKmYsfzy.js → index-Ca41Albz.js} +1 -1
  90. package/dist/assets/{index-FeXmdOtc.js → index-CbD2HRHU.js} +1 -1
  91. package/dist/assets/{index-49j4RhKz.js → index-CdnTrItd.js} +1 -1
  92. package/dist/assets/{index-CpQNfVqB.js → index-CnMT0fo1.js} +1 -1
  93. package/dist/assets/{index-BIqudEdj.js → index-Cu6PRXBT.js} +1 -1
  94. package/dist/assets/{index-cp3IjJlj.js → index-D-dEXSR3.js} +1 -1
  95. package/dist/assets/{index-ClEU1mAO.js → index-D4PsRecd.js} +1 -1
  96. package/dist/assets/{index-Dkpt0vo4.js → index-D63ritT-.js} +1 -1
  97. package/dist/assets/{index-IVbfHYRI.js → index-DBd6awj_.js} +1 -1
  98. package/dist/assets/{index-DEF7IUDm.js → index-DM9vqLT9.js} +1 -1
  99. package/dist/assets/{index-BWojQAsD.js → index-DXF1RiG0.js} +1 -1
  100. package/dist/assets/{index-DM12nfnK.js → index-D_ED6Nk7.js} +1 -1
  101. package/dist/assets/{index-BDKSFZhr.js → index-DaNXTl0n.js} +1 -1
  102. package/dist/assets/{index-BACUdl7h.js → index-Dd5Oo0tk.js} +1 -1
  103. package/dist/assets/{index-5jFNQsBE.js → index-DfxHc659.js} +1 -1
  104. package/dist/assets/{index-D6H6q-gI.js → index-DgKqbN5Y.js} +1 -1
  105. package/dist/assets/index-DpTrAVde.js +1 -0
  106. package/dist/assets/{index-DczpUr5i.js → index-DuS26oUH.js} +1 -1
  107. package/dist/assets/{index-aiQ1yrAz.js → index-DwEuapzX.js} +1 -1
  108. package/dist/assets/{index-DARALMqN.js → index-DwfORIGZ.js} +1 -1
  109. package/dist/assets/{index-C3zBUSk-.js → index-DxZUfBpk.js} +1 -1
  110. package/dist/assets/{index-ClckV-lZ.js → index-E2RuVge2.js} +3 -3
  111. package/dist/assets/{index-DuooR0LN.js → index-F3HbHSYi.js} +4 -4
  112. package/dist/assets/{index-Bd9gw7el.js → index-M4yiF52E.js} +1 -1
  113. package/dist/assets/{index-BN3g2rHb.js → index-hPXA34zh.js} +1 -1
  114. package/dist/assets/{index-EFHwnc77.js → index-haFP5Loj.js} +1 -1
  115. package/dist/assets/{index-aenta2dO.js → index-jC9YQw2A.js} +1 -1
  116. package/dist/assets/{index-I6AwLQhY.js → index-km_8frCh.js} +1 -1
  117. package/dist/assets/{index-CmuSCkrM.js → index-m-5ZFaj3.js} +1 -1
  118. package/dist/assets/{index--Xk2fT3q.js → index-nUrxOkOM.js} +1 -1
  119. package/dist/assets/{index-Bqt6vJLU.js → index-tXfQSlPx.js} +3 -3
  120. package/dist/assets/{index-B_oLwhaj.js → index-u7lHFbWg.js} +9 -9
  121. package/dist/assets/{index.esm-1OWSDx-7.js → index.esm-CG55Fmct.js} +1 -1
  122. package/dist/assets/{install-from-url-Bl4ZdRJm.js → install-from-url-DL-3oQMI.js} +1 -1
  123. package/dist/assets/{invitation-DEX-Txxu.js → invitation-C464OqTr.js} +1 -1
  124. package/dist/assets/{is-path-prefix-equal-DFHDOfyr.js → is-path-prefix-equal-DCicTZ8d.js} +1 -1
  125. package/dist/assets/{item-CmlChjGU.js → item-DkbrJM2U.js} +1 -1
  126. package/dist/assets/{javascript-B0PU6JyI.js → javascript-B0hI_Eyo.js} +1 -1
  127. package/dist/assets/{jsonMode-Dg95Goj7.js → jsonMode--kCoJBFT.js} +1 -1
  128. package/dist/assets/{liquid-CCjXcq7a.js → liquid-BVzOkmM1.js} +1 -1
  129. package/dist/assets/{list-header-CdZzFX4v.js → list-header-CnD8v8jR.js} +1 -1
  130. package/dist/assets/{lock.svg-DOUWz34o.js → lock.svg-DWUrJ_5S.js} +1 -1
  131. package/dist/assets/{log-C2q7HLQH.js → log-CjBZbQrr.js} +1 -1
  132. package/dist/assets/{lottie-react.esm-Dut6kuXv.js → lottie-react.esm-CcRYYgsR.js} +1 -1
  133. package/dist/assets/{mdx-DNHN55DV.js → mdx-DOswkMzX.js} +1 -1
  134. package/dist/assets/{memory-DDoSOGz9.js → memory-BkrGYits.js} +1 -1
  135. package/dist/assets/{metric-CRIsGIyz.js → metric-CNxVptGa.js} +1 -1
  136. package/dist/assets/omit-B8xv_k3Z.js +1 -0
  137. package/dist/assets/{overview-BwTrhp7S.js → overview-BWjjo7YM.js} +1 -1
  138. package/dist/assets/{permission-DIfhBFCW.js → permission-caYaN7o4.js} +1 -1
  139. package/dist/assets/{preference-BCXp2b-m.js → preference-D-1nO1Na.js} +3 -3
  140. package/dist/assets/{python-C1zln9B8.js → python-BJ2CXy2e.js} +1 -1
  141. package/dist/assets/{raf-schd.esm-GoSbO00M.js → raf-schd.esm-BdLRNFZe.js} +1 -1
  142. package/dist/assets/{razor-D6elnqQ-.js → razor-DdMOGESa.js} +1 -1
  143. package/dist/assets/{rotate-session-key-BThPZ3Wm.js → rotate-session-key-D_YTGNN-.js} +1 -1
  144. package/dist/assets/{runtime-DPbGGaoK.js → runtime-B1ybPRbq.js} +1 -1
  145. package/dist/assets/schema-BKs0S9Ju.js +1 -0
  146. package/dist/assets/sdk-WWYom8eN.js +1 -0
  147. package/dist/assets/{service-DFDToM0Z.js → service-pByff5wa.js} +1 -1
  148. package/dist/assets/{shorten-label-CH7uGTcM.js → shorten-label-DxKgpegt.js} +1 -1
  149. package/dist/assets/{simple-select-De_Le4X6.js → simple-select-DFmJjQqW.js} +1 -1
  150. package/dist/assets/{spaces-Dg_AAhqT.js → spaces-DnqeOj51.js} +1 -1
  151. package/dist/assets/{status-Bb59y7tA.js → status-BGeIvK1l.js} +1 -1
  152. package/dist/assets/{status-BkEitHMi.js → status-iJzbVxRo.js} +1 -1
  153. package/dist/assets/{switch-control-b81fnoth.js → switch-control-B_J8lGBy.js} +1 -1
  154. package/dist/assets/{table-icons-CYoxU12m.js → table-icons-CoOahY2H.js} +1 -1
  155. package/dist/assets/{team-CzwXU7Sn.js → team-NpjMEHti.js} +1 -1
  156. package/dist/assets/{toLower-DfahDL1_.js → toLower-Dx_gZ85b.js} +1 -1
  157. package/dist/assets/toUpper-28qo31SR.js +1 -0
  158. package/dist/assets/{traffic-Ky3k8S6h.js → traffic-BiqnglqJ.js} +1 -1
  159. package/dist/assets/{tsMode-BbM-SqEc.js → tsMode-CNfoaBo0.js} +1 -1
  160. package/dist/assets/{typescript-W-5Qa8-8.js → typescript-CYiGFg4j.js} +1 -1
  161. package/dist/assets/{url-evaluation-B0gvZV9M.js → url-evaluation-Bm9OWnaf.js} +1 -1
  162. package/dist/assets/{url-join-CODnoVq3.js → url-join-B07GNSp-.js} +1 -1
  163. package/dist/assets/{use-mobile-CkAg9r-k.js → use-mobile-D5fNICVu.js} +1 -1
  164. package/dist/assets/{use-mobile-Do_xR908.js → use-mobile-Dm-drtZi.js} +1 -1
  165. package/dist/assets/{useAsync-CxZFXpVk.js → useAsync-2o_4QDVN.js} +1 -1
  166. package/dist/assets/{useAsyncRetry-BnBPOYFC.js → useAsyncRetry-CSZJdZ2s.js} +1 -1
  167. package/dist/assets/{useLocalStorage-De1OH_yW.js → useLocalStorage-xEKVgwM3.js} +1 -1
  168. package/dist/assets/{useThemeProps-BqWmszN-.js → useThemeProps-BhYWaPDm.js} +1 -1
  169. package/dist/assets/{util-CU18bpQA.js → util-DhYg_WLh.js} +1 -1
  170. package/dist/assets/{wait-container-D4mwrL_c.js → wait-container-HwFE2vqS.js} +1 -1
  171. package/dist/assets/{without-wallet-BLBIKWnm.js → without-wallet-Dbr3bl6I.js} +1 -1
  172. package/dist/assets/wrap-locale-BQVWlKMF.js +1 -0
  173. package/dist/assets/{xml-DGlCv6Dc.js → xml-C13TFHPP.js} +1 -1
  174. package/dist/assets/{yaml-BMetQvWS.js → yaml-TMDBP8Bi.js} +1 -1
  175. package/dist/index.html +1 -1
  176. package/dist/service-worker.js +1 -1
  177. package/package.json +1 -1
  178. package/dist/assets/ArrowDropDown-DhJvpC-G.js +0 -1
  179. package/dist/assets/api-C_G-DBUm.js +0 -1
  180. package/dist/assets/client-BgZeYJUj.js +0 -1
  181. package/dist/assets/cloneDeep-CqeCq042.js +0 -1
  182. package/dist/assets/emotion-cache.browser.esm-BNl3Ir2h.js +0 -1
  183. package/dist/assets/engine-5aTStcWQ.js +0 -1
  184. package/dist/assets/getValidReactChildren-CpsNar5s.js +0 -1
  185. package/dist/assets/index-Dowor1ij.js +0 -1
  186. package/dist/assets/omit-BZ4Zgv1L.js +0 -1
  187. package/dist/assets/schema-Q04tmboc.js +0 -1
  188. package/dist/assets/sdk-DMTCyfpQ.js +0 -1
  189. package/dist/assets/toUpper-CFEG__Ub.js +0 -1
  190. package/dist/assets/wrap-locale-CuYkSdRb.js +0 -1
@@ -1 +1 @@
1
- import{j as e,cC as j,K as v,A as P,r as a,p as S,ax as w,u as k,x as K,f as b,aP as E,dg as W,cs as i,b7 as _,w as U,Y as N,C as R,dh as z,di as A}from"./index-DuooR0LN.js";import{p as c}from"./index-BWojQAsD.js";function o({children:r,...s}){return e.jsx(j,{...s,did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(v,{sx:{maxWidth:"100%",height:"100%"},children:r})})}function L(){const r=P(),{t:s,locale:d}=a.useContext(S),{api:l}=w(),{info:u}=k(),p=K(u),f=b(),n=E({ready:!1,success:!1,error:null,invalidSession:!1}),h=W(),x=()=>{try{const t=new URL(window.location.href);if(t.hash.includes("invalid")){n.invalidSession=!0;return}const g=t.searchParams.get("__connect_url__"),y=z(g);if(!A(y))throw new Error;n.ready=!0}catch{n.invalidSession=!0,r("#invalid",{replace:!0})}};a.useLayoutEffect(()=>x(),[]);const m=i(t=>{n.error=t.message,r("#invalid",{replace:!0})}),C=i(()=>{n.success=!0});if(n.invalidSession)return e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.invalidSession"),description:s("didConnect.common.invalidSessionDesc")})});if(n.error){const t=n.error;return e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.connectionError"),description:t})})}return n.success?e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(_,{style:{color:f.palette.success.main,fontSize:72}}),title:s("didConnect.genKeyPair.success"),description:s("didConnect.genKeyPair.successDesc")})}):n.ready?e.jsx(o,{children:e.jsx(U,{className:"connect",action:"gen-key-pair",checkFn:l.get,checkTimeout:10*60*1e3,extraParams:{sourceAppPid:h?.appPid,forceSwitch:!0},saveConnect:!1,forceConnected:!1,webWalletUrl:p,onSuccess:C,onError:m,locale:d,messages:{title:s("didConnect.genKeyPair.title"),scan:s("didConnect.genKeyPair.scan"),confirm:s("auth.confirm"),success:s("didConnect.genKeyPair.success")},popup:!0,open:!0,hideCloseButton:!0})},"ready"):e.jsx(N,{children:e.jsx(R,{})})}export{L as default};
1
+ import{j as e,cC as j,K as v,A as P,r as a,p as S,ax as w,u as k,x as K,f as b,aP as E,dg as W,cs as i,b7 as _,w as U,Y as N,C as R,dh as z,di as A}from"./index-F3HbHSYi.js";import{p as c}from"./index-DXF1RiG0.js";function o({children:r,...s}){return e.jsx(j,{...s,did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(v,{sx:{maxWidth:"100%",height:"100%"},children:r})})}function L(){const r=P(),{t:s,locale:d}=a.useContext(S),{api:l}=w(),{info:u}=k(),p=K(u),f=b(),n=E({ready:!1,success:!1,error:null,invalidSession:!1}),h=W(),x=()=>{try{const t=new URL(window.location.href);if(t.hash.includes("invalid")){n.invalidSession=!0;return}const g=t.searchParams.get("__connect_url__"),y=z(g);if(!A(y))throw new Error;n.ready=!0}catch{n.invalidSession=!0,r("#invalid",{replace:!0})}};a.useLayoutEffect(()=>x(),[]);const m=i(t=>{n.error=t.message,r("#invalid",{replace:!0})}),C=i(()=>{n.success=!0});if(n.invalidSession)return e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.invalidSession"),description:s("didConnect.common.invalidSessionDesc")})});if(n.error){const t=n.error;return e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.connectionError"),description:t})})}return n.success?e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(_,{style:{color:f.palette.success.main,fontSize:72}}),title:s("didConnect.genKeyPair.success"),description:s("didConnect.genKeyPair.successDesc")})}):n.ready?e.jsx(o,{children:e.jsx(U,{className:"connect",action:"gen-key-pair",checkFn:l.get,checkTimeout:10*60*1e3,extraParams:{sourceAppPid:h?.appPid,forceSwitch:!0},saveConnect:!1,forceConnected:!1,webWalletUrl:p,onSuccess:C,onError:m,locale:d,messages:{title:s("didConnect.genKeyPair.title"),scan:s("didConnect.genKeyPair.scan"),confirm:s("auth.confirm"),success:s("didConnect.genKeyPair.success")},popup:!0,open:!0,hideCloseButton:!0})},"ready"):e.jsx(N,{children:e.jsx(R,{})})}export{L as default};
@@ -1,4 +1,4 @@
1
- import{aj as ee,A as T,r as f,a as te,b as se,V as j,u as S,x as re,av as A,i as F,j as t,w as q,aw as oe,T as C,y as k,$,o as m,ax as ne,ay as ae,v as _,C as N,az as ie,H as W,X as M,aA as le,aB as ce,K as E,aC as ue,L as de,aD as pe,a9 as he,s as O,a6 as fe,a7 as me,aE as ge,a8 as xe}from"./index-DuooR0LN.js";import{u as L}from"./useLocalStorage-De1OH_yW.js";import{C as be,c as ke,e as ye,_ as je,a as Se,d as we,s as ve,S as V,b as Pe,A as Ce}from"./item-CmlChjGU.js";import{e as D}from"./engine-5aTStcWQ.js";import{g as U}from"./get-safe-url-CVsSFVM-.js";import{P as z}from"./permission-DIfhBFCW.js";import{A as Re}from"./ArrowDropDown-DhJvpC-G.js";import{B as Le}from"./Breadcrumbs-BpV5sgxT.js";import"./index-BDKSFZhr.js";import"./KeyboardArrowDown-B-1XGRf9.js";import"./ChevronLeft-DH29Zimq.js";import"./ChevronRight-BRfOjT4T.js";import"./Search-DEPwrfa9.js";import"./index-aenta2dO.js";import"./blocklet-B_F88Tat.js";import"./Autocomplete-bHChBtVA.js";import"./ListSubheader-DuidDB0a.js";import"./Verified-BvVUNdGO.js";import"./VerifiedUser-wQPNfQVE.js";import"./Add-B5kXVjlA.js";import"./Launch-BM8tef6Y.js";import"./Done-BChOhJAU.js";import"./DeleteOutline-rUX66WwM.js";import"./delete-confirm-CScy8CpF.js";import"./click-to-copy-DKJULX-E.js";import"./MoreVert-zazLZzFB.js";import"./ButtonGroup-CDUEw9SW.js";import"./getValidReactChildren-CpsNar5s.js";function Be(e){const r=ee(),c=T(),[s,o]=L(`sid:blocklet:purchase:${e}`),[l,u]=f.useState(!1),[d,a]=f.useState(null),p=()=>{const{pathname:n,searchParams:b}=new URL(window.location.href),g=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";b.get("sid")&&(o(""),c(n.replace(g,"/"),{replace:!0}))},i=!!(r.get("assetDid")&&s&&r.get("sid")===s);return te(se.BlockletEvents.purchaseChange,n=>{n.did===e&&(a(n.session),["declined","confirmed","error"].includes(n.session.status)&&(u(!0),setTimeout(p,2e3)))}),f.useEffect(()=>{d&&d.id!==s&&o(d.id)},[d]),{hasCompleted:l,hasPurchased:i,session:d,setSession:a,doRedirect:p}}function De(e){setTimeout(()=>{window.location.href=U(e,{allowDomains:null})},1e3)}function K({meta:e,onCancel:r,handlePaySuccess:c=De,storeUrl:s}){const{t:o}=j(),{info:l}=S(),[u,d]=f.useState("both"),[a,p]=f.useState(1),i=re(l),n=A(e,l,s),b=P=>{P!==u&&d(P)},g=()=>{u&&(p(2),u==="verify"&&(window.location.href=U(n)))},w=(P,B)=>{B!=="backdropClick"&&r()},x=()=>{c(n)},h=F.getDisplayName({meta:e});if(u==="purchase"&&a===2)return t.jsx(q,{open:!0,popup:!0,baseUrl:s,action:"acquire-asset",checkFn:oe.create({baseURL:k(s,"/store")}).get,onSuccess:x,onClose:r,checkTimeout:60*5e3,extraParams:{factory:e.nftFactory},webWalletUrl:i,disableClose:!0,saveConnect:!1,showDownload:!1,messages:{title:o("store.purchase.auth.title",{name:h}),scan:o("store.purchase.auth.scan"),confirm:o("store.purchase.auth.confirm"),success:t.jsxs(t.Fragment,{children:[t.jsx(C,{gutterBottom:!0,children:o("store.purchase.auth.success")}),t.jsxs(C,{variant:"subtitle2",children:[" ",o("store.purchase.autoLaunch",{name:h})]})]})}});const v=$;return t.jsx(v,{title:o("store.purchase.title",{name:h}),disableEscapeKeyDown:!0,open:!0,fullWidth:!0,onClose:w,children:t.jsx("div",{style:{marginBottom:16},children:t.jsx(be,{action:u,onNext:g,onSelect:b})})})}K.propTypes={...ke,storeUrl:m.string.isRequired,handlePaySuccess:m.func};function H({meta:e,buttonText:r,storeUrl:c,isResource:s=!1}){const{t:o}=j(),l=T(),{info:u}=S(),{api:d}=ne(),a=F.isFreeBlocklet(e)===!1,[p,i]=f.useState(!1),{hasPurchased:n}=Be(e.did),[b,g]=f.useState(!1),[w]=L("instant-blocklet-install",!1),[x,h]=f.useState(!1),v=f.useMemo(()=>p?o(a?"blocklet.status.purchasing":"blocklet.status.waiting"):"",[p,o,a]),P=f.useMemo(()=>s?o("blocklet.status.resource"):a?r.purchase:r.launch,[a,r,s]),B=y=>{y.preventDefault(),y.stopPropagation();try{if(i(!0),a){g(!0);return}if(w){h(!0);return}if(!a){const R=A(e,u,c);window.location.href=U(R)}}catch(R){W.error(M(R),{autoHideDuration:5e3}),console.error("Blocklet installed failed",R)}finally{i(!1)}},Y=()=>{i(!1),g(!1)},J=y=>{i(!1),h(!1),l(`/blocklets/${y.appDid}/components`)},Z=()=>{i(!1),h(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(ye,{children:t.jsx(z,{permission:"mutate_blocklets",children:y=>t.jsx(ae,{title:s?o("launchBlocklet.error.resourceBlocklet"):"",children:t.jsx(_,{onClick:B,size:"small",sx:{cursor:s?"not-allowed":"pointer",overflow:"hidden"},disabled:!!(v||!y),variant:"outlined",color:"primary","data-cy":"install-blocklet",children:v?t.jsxs(t.Fragment,{children:[t.jsx(N,{size:16,style:{marginRight:3}}),v]}):P},e.did)})})}),(n||b)&&t.jsx(K,{method:"launch",meta:e,mode:"both",onCancel:Y,storeUrl:c}),x&&t.jsx(q,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:d.get,checkTimeout:5*60*1e3,onSuccess:J,extraParams:{title:e.title,blockletMetaUrl:decodeURIComponent(ie(c,e.did).trim())},messages:{title:o("setup.keyPair.title"),scan:o("setup.keyPair.scan"),confirm:o("setup.keyPair.confirm"),success:o("setup.keyPair.success")},onClose:Z})]})}H.propTypes={isResource:m.bool,meta:m.object.isRequired,buttonText:m.shape({purchase:m.string.isRequired,launch:m.string.isRequired}).isRequired,storeUrl:m.string.isRequired};const Ee=(e,r,c)=>{const s=he(r);return k(c,`/blocklets/${e.did}/?server-url=${s}`)},I=({meta:e,attribute:r,value:c})=>e._formatted?e._formatted[r]:c,Ue=(e,r)=>{if(!e||!r)return"";try{return k(r,e)}catch(c){return console.warn("Failed to construct avatar URL:",c),""}};function G({blocklet:e,endpoint:r="",serverVersion:c=""}){const{t:s}=j(),o=S();let l=k(o.imgPrefix,"blocklet.png");const u=r;if(u.startsWith("http")&&e.logo)l=k(u,ue(e.did,e.logo,e.version));else{let n=(window.env.apiPrefix||"/").replace(/^\/+/,"").replace(/\/+$/,"");n&&(n=`/${n}`),l=k(n,`/blocklet/logo/${e.did}`)}try{const i=new URL(l);i.searchParams.set("v",e.version||+new Date),l=i.href}catch{}const d=i=>i.currentTarget.contains(i.target)?!0:(i.preventDefault(),!1),a={meta:e,buttonText:{purchase:s("common.purchase"),launch:s("common.launch")},storeUrl:u},p=t.jsx("div",{style:{display:"flex",alignItems:"center"},children:t.jsx(Se,{serverVersion:c,requirementVersion:e.requirements?.server,size:"small",children:t.jsx(H,{isResource:!(D.hasStartEngine(e)||D.isGatewayBlocklet(e)||D.isPackBlocklet(e)),...a})})});return t.jsx(de,{href:Ee(e,o.info,r),style:{color:"initial",textDecoration:"none"},onClick:d,target:"_blank",children:t.jsx(Ie,{title:I({meta:e,attribute:"title",value:e.title||e.name}),did:e.did,description:I({meta:e,attribute:"description",value:e.description}),cover:e.logo?l:"",version:e.version,onButtonClick:null,icons:e.docker?.image?[{key:"docker",icon:t.jsx(E,{sx:{display:"flex",color:"primary.main"},children:t.jsx(pe,{icon:we})}),title:s("blocklet.dockerImage")}]:[],official:e.isOfficial?{tooltip:s("blocklet.component.isOfficial")}:void 0,author:e.owner.fullName,avatar:Ue(e.owner.avatar,r),download:e.stats.downloads,button:p})})}G.propTypes={blocklet:m.object.isRequired,serverVersion:m.string,endpoint:m.string};function Q({storeUrl:e,handleSearchSelect:r=null,extraFilter:c=void 0,...s}){const{locale:o}=j(),l=S(),[u,d]=f.useState({}),a=n=>{d(n)},p=e,i=l?.info?.version;return f.useEffect(()=>{d({})},[p]),t.jsx(le,{FallbackComponent:ce,resetKeys:[p],children:t.jsx(E,{...s,sx:{"& .title-bar":{pt:0},".blocklet-list":{mt:0},"& h2":{display:"none"}},children:t.jsx(je,{layout:{showExplore:!1,showTitle:!0},blockletRender:n=>t.jsx(G,{...n,endpoint:p}),baseSearch:!0,endpoint:p,locale:o,onFilterChange:a,onSearchSelect:r,filters:u,extraFilter:c,serverVersion:i})})})}Q.propTypes={storeUrl:m.string.isRequired,handleSearchSelect:m.func,extraFilter:m.func};const Ie=O(ve)`
1
+ import{aj as ee,A as T,r as f,a as te,b as se,V as j,u as S,x as re,av as A,i as F,j as t,w as q,aw as oe,T as C,y as k,$,o as m,ax as ne,ay as ae,v as _,C as N,az as ie,H as W,X as M,aA as le,aB as ce,K as E,aC as ue,L as de,aD as pe,a9 as he,s as O,a6 as fe,a7 as me,aE as ge,a8 as xe}from"./index-F3HbHSYi.js";import{u as L}from"./useLocalStorage-xEKVgwM3.js";import{C as be,c as ke,e as ye,_ as je,a as Se,d as we,s as ve,S as V,b as Pe,A as Ce}from"./item-DkbrJM2U.js";import{e as D}from"./engine-wH21TR28.js";import{g as U}from"./get-safe-url-DfDeYxPo.js";import{P as z}from"./permission-caYaN7o4.js";import{A as Re}from"./ArrowDropDown-DonW35Zx.js";import{B as Le}from"./Breadcrumbs-C8gaKT3g.js";import"./index-DaNXTl0n.js";import"./KeyboardArrowDown-rbx_AuZr.js";import"./ChevronLeft-CKiAYw9j.js";import"./ChevronRight-DZiek3NZ.js";import"./Search-DV5vJN1H.js";import"./index-jC9YQw2A.js";import"./blocklet-BSWtuwnH.js";import"./Autocomplete-Dy_zZ4Oc.js";import"./ListSubheader-BlgmemtO.js";import"./Verified-CF2yeqGT.js";import"./VerifiedUser-C1tgCpCB.js";import"./Add-D4EYSG3K.js";import"./Launch-DkmyUeYd.js";import"./Done-DzMcAgjX.js";import"./DeleteOutline-GpuLmtYQ.js";import"./delete-confirm-CiFwBlNG.js";import"./click-to-copy-C5l1aVBQ.js";import"./MoreVert-wWXtgLji.js";import"./ButtonGroup-DcZ0ug1l.js";import"./getValidReactChildren-DECNQV_G.js";function Be(e){const r=ee(),c=T(),[s,o]=L(`sid:blocklet:purchase:${e}`),[l,u]=f.useState(!1),[d,a]=f.useState(null),p=()=>{const{pathname:n,searchParams:b}=new URL(window.location.href),g=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";b.get("sid")&&(o(""),c(n.replace(g,"/"),{replace:!0}))},i=!!(r.get("assetDid")&&s&&r.get("sid")===s);return te(se.BlockletEvents.purchaseChange,n=>{n.did===e&&(a(n.session),["declined","confirmed","error"].includes(n.session.status)&&(u(!0),setTimeout(p,2e3)))}),f.useEffect(()=>{d&&d.id!==s&&o(d.id)},[d]),{hasCompleted:l,hasPurchased:i,session:d,setSession:a,doRedirect:p}}function De(e){setTimeout(()=>{window.location.href=U(e,{allowDomains:null})},1e3)}function K({meta:e,onCancel:r,handlePaySuccess:c=De,storeUrl:s}){const{t:o}=j(),{info:l}=S(),[u,d]=f.useState("both"),[a,p]=f.useState(1),i=re(l),n=A(e,l,s),b=P=>{P!==u&&d(P)},g=()=>{u&&(p(2),u==="verify"&&(window.location.href=U(n)))},w=(P,B)=>{B!=="backdropClick"&&r()},x=()=>{c(n)},h=F.getDisplayName({meta:e});if(u==="purchase"&&a===2)return t.jsx(q,{open:!0,popup:!0,baseUrl:s,action:"acquire-asset",checkFn:oe.create({baseURL:k(s,"/store")}).get,onSuccess:x,onClose:r,checkTimeout:60*5e3,extraParams:{factory:e.nftFactory},webWalletUrl:i,disableClose:!0,saveConnect:!1,showDownload:!1,messages:{title:o("store.purchase.auth.title",{name:h}),scan:o("store.purchase.auth.scan"),confirm:o("store.purchase.auth.confirm"),success:t.jsxs(t.Fragment,{children:[t.jsx(C,{gutterBottom:!0,children:o("store.purchase.auth.success")}),t.jsxs(C,{variant:"subtitle2",children:[" ",o("store.purchase.autoLaunch",{name:h})]})]})}});const v=$;return t.jsx(v,{title:o("store.purchase.title",{name:h}),disableEscapeKeyDown:!0,open:!0,fullWidth:!0,onClose:w,children:t.jsx("div",{style:{marginBottom:16},children:t.jsx(be,{action:u,onNext:g,onSelect:b})})})}K.propTypes={...ke,storeUrl:m.string.isRequired,handlePaySuccess:m.func};function H({meta:e,buttonText:r,storeUrl:c,isResource:s=!1}){const{t:o}=j(),l=T(),{info:u}=S(),{api:d}=ne(),a=F.isFreeBlocklet(e)===!1,[p,i]=f.useState(!1),{hasPurchased:n}=Be(e.did),[b,g]=f.useState(!1),[w]=L("instant-blocklet-install",!1),[x,h]=f.useState(!1),v=f.useMemo(()=>p?o(a?"blocklet.status.purchasing":"blocklet.status.waiting"):"",[p,o,a]),P=f.useMemo(()=>s?o("blocklet.status.resource"):a?r.purchase:r.launch,[a,r,s]),B=y=>{y.preventDefault(),y.stopPropagation();try{if(i(!0),a){g(!0);return}if(w){h(!0);return}if(!a){const R=A(e,u,c);window.location.href=U(R)}}catch(R){W.error(M(R),{autoHideDuration:5e3}),console.error("Blocklet installed failed",R)}finally{i(!1)}},Y=()=>{i(!1),g(!1)},J=y=>{i(!1),h(!1),l(`/blocklets/${y.appDid}/components`)},Z=()=>{i(!1),h(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(ye,{children:t.jsx(z,{permission:"mutate_blocklets",children:y=>t.jsx(ae,{title:s?o("launchBlocklet.error.resourceBlocklet"):"",children:t.jsx(_,{onClick:B,size:"small",sx:{cursor:s?"not-allowed":"pointer",overflow:"hidden"},disabled:!!(v||!y),variant:"outlined",color:"primary","data-cy":"install-blocklet",children:v?t.jsxs(t.Fragment,{children:[t.jsx(N,{size:16,style:{marginRight:3}}),v]}):P},e.did)})})}),(n||b)&&t.jsx(K,{method:"launch",meta:e,mode:"both",onCancel:Y,storeUrl:c}),x&&t.jsx(q,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:"launch-free-blocklet-by-session",checkFn:d.get,checkTimeout:5*60*1e3,onSuccess:J,extraParams:{title:e.title,blockletMetaUrl:decodeURIComponent(ie(c,e.did).trim())},messages:{title:o("setup.keyPair.title"),scan:o("setup.keyPair.scan"),confirm:o("setup.keyPair.confirm"),success:o("setup.keyPair.success")},onClose:Z})]})}H.propTypes={isResource:m.bool,meta:m.object.isRequired,buttonText:m.shape({purchase:m.string.isRequired,launch:m.string.isRequired}).isRequired,storeUrl:m.string.isRequired};const Ee=(e,r,c)=>{const s=he(r);return k(c,`/blocklets/${e.did}/?server-url=${s}`)},I=({meta:e,attribute:r,value:c})=>e._formatted?e._formatted[r]:c,Ue=(e,r)=>{if(!e||!r)return"";try{return k(r,e)}catch(c){return console.warn("Failed to construct avatar URL:",c),""}};function G({blocklet:e,endpoint:r="",serverVersion:c=""}){const{t:s}=j(),o=S();let l=k(o.imgPrefix,"blocklet.png");const u=r;if(u.startsWith("http")&&e.logo)l=k(u,ue(e.did,e.logo,e.version));else{let n=(window.env.apiPrefix||"/").replace(/^\/+/,"").replace(/\/+$/,"");n&&(n=`/${n}`),l=k(n,`/blocklet/logo/${e.did}`)}try{const i=new URL(l);i.searchParams.set("v",e.version||+new Date),l=i.href}catch{}const d=i=>i.currentTarget.contains(i.target)?!0:(i.preventDefault(),!1),a={meta:e,buttonText:{purchase:s("common.purchase"),launch:s("common.launch")},storeUrl:u},p=t.jsx("div",{style:{display:"flex",alignItems:"center"},children:t.jsx(Se,{serverVersion:c,requirementVersion:e.requirements?.server,size:"small",children:t.jsx(H,{isResource:!(D.hasStartEngine(e)||D.isGatewayBlocklet(e)||D.isPackBlocklet(e)),...a})})});return t.jsx(de,{href:Ee(e,o.info,r),style:{color:"initial",textDecoration:"none"},onClick:d,target:"_blank",children:t.jsx(Ie,{title:I({meta:e,attribute:"title",value:e.title||e.name}),did:e.did,description:I({meta:e,attribute:"description",value:e.description}),cover:e.logo?l:"",version:e.version,onButtonClick:null,icons:e.docker?.image?[{key:"docker",icon:t.jsx(E,{sx:{display:"flex",color:"primary.main"},children:t.jsx(pe,{icon:we})}),title:s("blocklet.dockerImage")}]:[],official:e.isOfficial?{tooltip:s("blocklet.component.isOfficial")}:void 0,author:e.owner.fullName,avatar:Ue(e.owner.avatar,r),download:e.stats.downloads,button:p})})}G.propTypes={blocklet:m.object.isRequired,serverVersion:m.string,endpoint:m.string};function Q({storeUrl:e,handleSearchSelect:r=null,extraFilter:c=void 0,...s}){const{locale:o}=j(),l=S(),[u,d]=f.useState({}),a=n=>{d(n)},p=e,i=l?.info?.version;return f.useEffect(()=>{d({})},[p]),t.jsx(le,{FallbackComponent:ce,resetKeys:[p],children:t.jsx(E,{...s,sx:{"& .title-bar":{pt:0},".blocklet-list":{mt:0},"& h2":{display:"none"}},children:t.jsx(je,{layout:{showExplore:!1,showTitle:!0},blockletRender:n=>t.jsx(G,{...n,endpoint:p}),baseSearch:!0,endpoint:p,locale:o,onFilterChange:a,onSearchSelect:r,filters:u,extraFilter:c,serverVersion:i})})})}Q.propTypes={storeUrl:m.string.isRequired,handleSearchSelect:m.func,extraFilter:m.func};const Ie=O(ve)`
2
2
  .ms-highlight {
3
3
  color: ${e=>e.theme.palette.primary.main};
4
4
  }
@@ -1,4 +1,4 @@
1
- import{aF as je,j as e,u as Q,r as h,e as Oe,aG as Ur,aH as k,aI as zr,aJ as an,aK as Gn,aL as sn,aM as et,V as z,ac as le,s as ne,aN as ln,o as p,aO as Br,aP as cn,aQ as Mr,H as re,M as dn,T as A,t as q,ay as fe,aR as Pe,C as K,U as be,v as Y,aS as Kn,X as pe,K as W,p as Mt,N as tt,aT as Wr,d as Wt,aU as Ie,aV as me,a9 as qr,aW as Hr,aX as Gr,y as Kr,A as Vn,W as un,g as mn,h as te,aY as qt,a as Et,Q as X,b as ct,aZ as Yn,a_ as Xn,R as Qn,a3 as _t,a$ as Vr,b0 as Yr,b1 as Xr,b2 as Qr,b3 as nt,i as fn,b4 as Zr,aE as Ge,b5 as Jr,a8 as jt,a5 as wt,b6 as ei,a6 as Pt,L as Ht,I as ti,b7 as ni,b8 as Zn,a7 as ri,b9 as Jn,ba as De,bb as ke,bc as ii,bd as Gt,be as oi,$ as er,D as At,f as tr,bf as ai,bg as pn,aj as si,bh as li,bi as ee,bj as ci,S as gn,l as hn,m as xn,bk as di,bl as ui,bm as mi}from"./index-DuooR0LN.js";import{u as fi,T as pi}from"./html-title-qBMXCmRQ.js";import{A as gi}from"./ArrowDropDown-DhJvpC-G.js";import{u as Kt,C as B,a as yn}from"./index.esm-1OWSDx-7.js";import{S as ae}from"./switch-control-b81fnoth.js";import{P as ie}from"./permission-DIfhBFCW.js";import{H as nr,g as hi}from"./index-CpnPkVho.js";import{A as rr}from"./Link-B4nyHdoF.js";import{D as ve,R as ir,a as It,b as xi}from"./url-evaluation-B0gvZV9M.js";import{D as dt}from"./delete-confirm-CScy8CpF.js";import{v as rt}from"./index-Bd9gw7el.js";import{s as yi}from"./logo-BKA11TRi.js";import{u as bi}from"./useLocalStorage-De1OH_yW.js";import{R as vi}from"./Refresh-CPw_l8px.js";import{L as ji}from"./LoadingButton-B4_fOUbX.js";import{C as wi,R as Ci,P as or,S as Si}from"./rotate-session-key-BThPZ3Wm.js";import{A as Le}from"./Add-B5kXVjlA.js";import{B as ar,D as bn,W as Ke}from"./status-Bb59y7tA.js";import{i as Di}from"./is-path-prefix-equal-DFHDOfyr.js";import{N as ki}from"./ChevronRight-BRfOjT4T.js";import{I as Ri}from"./MoreVert-zazLZzFB.js";import{E as sr}from"./Edit-BgZAPfMS.js";import{A as Ti}from"./CallMerge-BrtGjpke.js";import{C as Ei}from"./CardContent-DJkOCDLg.js";import"./Switch-BzWBU8yM.js";import"./FilterList-CjNG8_Me.js";import"./CSSTransition-oc_jqFQN.js";import"./emotion-cache.browser.esm-BNl3Ir2h.js";import"./index-B0LbFKW2.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-DFUdc1h4.js";import"./index-aenta2dO.js";import"./TableSearch-DOm0JN54.js";import"./Search-DEPwrfa9.js";import"./Clear-DX2cXl5s.js";import"./click-to-copy-DKJULX-E.js";import"./visuallyHidden-Dan1xhjv.js";const _i=je(e.jsx("path",{d:"m7 14 5-5 5 5z"})),Pi=je(e.jsx("path",{d:"M12 3 2 21h20zm1 5.92L18.6 19H13zm-2 0V19H5.4z"})),Ai=je(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"})),lr=je(e.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"})),Ii=je(e.jsx("path",{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"})),Li=je(e.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"})),Fi=je(e.jsx("path",{d:"m19 15-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9z"})),ye="Dashboard",cr=h.createContext({}),{Provider:Oi,Consumer:as}=cr,vn=[ye,k.DOMAIN_FOR_IP_SITE,k.DOMAIN_FOR_IP_SITE_REGEXP],Ni=(t,r)=>{if(t.name===k.DOMAIN_FOR_DEFAULT_SITE)return-1;if(r.name===k.DOMAIN_FOR_DEFAULT_SITE)return 1;const n=vn.includes(t.name),i=vn.includes(r.name);return n&&i?sn(t.name,r.name):n?-1:i?1:sn(t.name,r.name)},$i=({sites:t,nodePort:r})=>{const n=window.location.hostname,a=(t||[]).map(o=>{const{id:s,rules:u=[],corsAllowedOrigins:m=[]}=o;let{domain:d,domainAliases:c}=o;c=c||[],[k.DOMAIN_FOR_IP_SITE,k.DOMAIN_FOR_IP_SITE_REGEXP].includes(d)&&(d=ye,c.find(y=>y.value===n)||c.unshift({protected:!1,value:n}));const w={id:s,name:d,type:"domain",items:[],domainAliases:c,isProtected:o.isProtected,corsAllowedOrigins:m};return(u||[]).forEach(y=>{const{id:C,isProtected:E,from:{pathPrefix:j},to:D}=y;if(D.type===k.ROUTING_RULE_TYPES.BLOCKLET){let S="";Number.parseInt(D.port,10)===Number.parseInt(r,10)?(S="Blocklet Server Dashboard",D.type=k.ROUTING_RULE_TYPES.DAEMON):S=D.did,w.items.push({id:C,name:an(j||"/"),title:S,type:"rule",isProtected:E,pathPrefix:j,to:D})}else w.items.push({id:C,pathPrefix:j,name:an(j||"/"),title:"Blocklet Server Dashboard",type:"rule",isProtected:E,to:D})}),w.items=Gn(w.items,y=>y.name),w}).sort(Ni),l=a.reduce((o,s)=>{let{name:u}=s;return u.endsWith(k.BLOCKLET_SITE_GROUP_SUFFIX)&&([u]=u.split(".")),o[u]={...s,rules:s.items},o},{});return{sites:a,siteMap:l}},Ui=({did:t,domain:r,mountPoint:n,siteMap:i,params:a}={})=>{if(!i)return null;const l=i[t];if(!l)return null;const o=r||(l.domainAliases||[])[0];if(!o)return null;let s=n;if(!s){const u=l.rules.filter(m=>!m.name.startsWith(k.WELLKNOWN_PATH_PREFIX))[0];s=u?u.name:"/"}return et(o.value,s,a)},zi=({did:t,mountPoint:r,siteMap:n,params:i}={})=>{if(!n)return[];const a=n[t];if(!a)return[];const l=a.domainAliases||[];if(!l.length)return[];let o=r;if(!o){const s=a.rules.filter(u=>!u.name.startsWith(k.WELLKNOWN_PATH_PREFIX))[0];o=s?s.name:"/"}return l.map(s=>et(s.value,o,i))},Bi=t=>{const r=t.map(i=>i.domain).filter(i=>![k.DOMAIN_FOR_IP_SITE_REGEXP,k.DOMAIN_FOR_DEFAULT_SITE].includes(i));let n=[];return t.forEach(i=>n.push(...i.domainAliases||[])),n=n.map(i=>typeof i=="string"?{value:i,isProtected:!1}:i),{domains:r,domainsAliases:n}};function jn({children:t}){const{api:r,info:n}=Q(),[i,a]=h.useState([]),[l,o]=h.useState([]),[s,u]=h.useState([]),m=Oe(async()=>{const{sites:_}=await r.getRoutingSites({input:{snapshotHash:""}}),v=_||[];await Promise.all(v.map(async g=>(g.domainAliases=await Ur(g.domainAliases,{getIP:zr}),g)));const f=Bi(v);a(v),o(f.domains),u([window.location.hostname,...f.domains,...f.domainsAliases.map(g=>g.value)])},[n]),d=(_,v)=>{a(f=>f.map(g=>g.id===_?v.domain?v:{...v,domain:g.domain}:g))},c=_=>r.takeRoutingSnapshot({input:{dryRun:!1,message:encodeURIComponent(_)}}),w=async _=>{const v=await r.addRoutingSite({input:_});a(i.concat(v.site))},y=async(_,v)=>{const f=await r.updateRoutingSite({input:{id:_,...v}});if(f.site&&f.site.id){const g=i.findIndex(R=>R.id===f.site.id);g!==-1&&(i.splice(g,1,f.site),a([].concat(i)))}},C=async _=>{await r.deleteRoutingSite({input:{id:_}}),a(i.filter(v=>v.id!==_))},E=async(_,v,f)=>{const g=await r.addDomainAlias({input:{id:_,domainAlias:v,force:f}});d(_,g.site)},j=async(_,v)=>{const f=await r.deleteDomainAlias({input:{id:_,domainAlias:v}});d(_,f.site)},D=async(_,v)=>{const{site:f}=await r.addRoutingRule({input:{id:_,rule:v}});d(_,f)},S=async(_,v)=>{const{site:f}=await r.updateRoutingRule({input:{id:_,rule:v}});d(_,f)},b=async(_,v)=>{const{site:f}=await r.deleteRoutingRule({input:{id:_,ruleId:v}});d(_,f)},x={loading:m.loading,error:m.error,refresh:m.retry,api:r,actions:{addSite:w,updateSite:y,deleteSite:C,addDomainAlias:E,deleteDomainAlias:j,takeSnapshot:c,addRule:D,updateRule:S,deleteRule:b}},{sites:L,siteMap:F}=$i({sites:i,nodePort:n.port});return x.sites=L,x.siteMap=F,x.domains=l,x.allDomains=s,x.getBlockletUrl=({did:_,domain:v,mountPoint:f,params:g})=>Ui({did:_,domain:v,mountPoint:f,siteMap:x.siteMap,params:g}),x.getBlockletUrls=({did:_,mountPoint:v,params:f})=>zi({did:_,mountPoint:v,siteMap:x.siteMap,params:f}),e.jsx(Oi,{value:{routing:x},children:t})}function de(){const{routing:t}=h.useContext(cr);return t}function Vt(t){const r=[k.DOMAIN_FOR_IP_SITE_REGEXP,k.DOMAIN_FOR_DEFAULT_SITE,k.DOMAIN_FOR_IP_SITE];return typeof window<"u"&&typeof window.location<"u"&&r.push(window.location.hostname),r.includes(t)}function Mi(){return null}function dr({confirm:t=null}){const[r,n]=h.useState(null),{t:i}=z(),a=()=>{n(null)},l=async s=>{if(s){let u=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";u==="/"?ln.push(`${s.pathname}`):(u.endsWith("/")&&(u=u.substring(0,u.length-1)),ln.push(`${u}${s.pathname}`)),window.location.reload()}},o=(s,...u)=>{let m=typeof t=="function"?t(s,...u):t;return m?(typeof m=="string"&&(m={description:m}),n({title:i("common.noticeTitle"),description:i("common.leavePageTip"),confirm:i("common.confirm"),cancel:i("common.cancel"),onConfirm:()=>l(s),onCancel:()=>a(),...m}),!1):!0};return e.jsxs(Wi,{children:[e.jsx(Mi,{message:o}),r&&e.jsx(le,{title:r.title,description:r.description,confirm:r.confirm,cancel:r.cancel,params:r.params,onConfirm:r.onConfirm,onCancel:r.onCancel})]})}dr.propTypes={confirm:p.oneOfType([p.object,p.string,p.func])};const Wi=ne.div`
1
+ import{aF as je,j as e,u as Q,r as h,e as Oe,aG as Ur,aH as k,aI as zr,aJ as an,aK as Gn,aL as sn,aM as et,V as z,ac as le,s as ne,aN as ln,o as p,aO as Br,aP as cn,aQ as Mr,H as re,M as dn,T as A,t as q,ay as fe,aR as Pe,C as K,U as be,v as Y,aS as Kn,X as pe,K as W,p as Mt,N as tt,aT as Wr,d as Wt,aU as Ie,aV as me,a9 as qr,aW as Hr,aX as Gr,y as Kr,A as Vn,W as un,g as mn,h as te,aY as qt,a as Et,Q as X,b as ct,aZ as Yn,a_ as Xn,R as Qn,a3 as _t,a$ as Vr,b0 as Yr,b1 as Xr,b2 as Qr,b3 as nt,i as fn,b4 as Zr,aE as Ge,b5 as Jr,a8 as jt,a5 as wt,b6 as ei,a6 as Pt,L as Ht,I as ti,b7 as ni,b8 as Zn,a7 as ri,b9 as Jn,ba as De,bb as ke,bc as ii,bd as Gt,be as oi,$ as er,D as At,f as tr,bf as ai,bg as pn,aj as si,bh as li,bi as ee,bj as ci,S as gn,l as hn,m as xn,bk as di,bl as ui,bm as mi}from"./index-F3HbHSYi.js";import{u as fi,T as pi}from"./html-title-B42L4vHs.js";import{A as gi}from"./ArrowDropDown-DonW35Zx.js";import{u as Kt,C as B,a as yn}from"./index.esm-CG55Fmct.js";import{S as ae}from"./switch-control-B_J8lGBy.js";import{P as ie}from"./permission-caYaN7o4.js";import{H as nr,g as hi}from"./index-CGwvwEUr.js";import{A as rr}from"./Link-CgW5geY5.js";import{D as ve,R as ir,a as It,b as xi}from"./url-evaluation-Bm9OWnaf.js";import{D as dt}from"./delete-confirm-CiFwBlNG.js";import{v as rt}from"./index-M4yiF52E.js";import{s as yi}from"./logo-BKA11TRi.js";import{u as bi}from"./useLocalStorage-xEKVgwM3.js";import{R as vi}from"./Refresh-nk8BSp_h.js";import{L as ji}from"./LoadingButton-DpbZOfZH.js";import{C as wi,R as Ci,P as or,S as Si}from"./rotate-session-key-D_YTGNN-.js";import{A as Le}from"./Add-D4EYSG3K.js";import{B as ar,D as bn,W as Ke}from"./status-BGeIvK1l.js";import{i as Di}from"./is-path-prefix-equal-DCicTZ8d.js";import{N as ki}from"./ChevronRight-DZiek3NZ.js";import{I as Ri}from"./MoreVert-wWXtgLji.js";import{E as sr}from"./Edit-DCJEwDTg.js";import{A as Ti}from"./CallMerge-KoAXFCaW.js";import{C as Ei}from"./CardContent-W_hyQjAD.js";import"./Switch-czLKbhPZ.js";import"./FilterList-CNYUVm5S.js";import"./CSSTransition-V4R7ZcvS.js";import"./emotion-cache.browser.esm-CQ2-5c4_.js";import"./index-BIGgo0dk.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-BHCVOuWA.js";import"./index-jC9YQw2A.js";import"./TableSearch-CAf-ESr9.js";import"./Search-DV5vJN1H.js";import"./Clear---RPVeR7.js";import"./click-to-copy-C5l1aVBQ.js";import"./visuallyHidden-Dan1xhjv.js";const _i=je(e.jsx("path",{d:"m7 14 5-5 5 5z"})),Pi=je(e.jsx("path",{d:"M12 3 2 21h20zm1 5.92L18.6 19H13zm-2 0V19H5.4z"})),Ai=je(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"})),lr=je(e.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"})),Ii=je(e.jsx("path",{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"})),Li=je(e.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"})),Fi=je(e.jsx("path",{d:"m19 15-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9z"})),ye="Dashboard",cr=h.createContext({}),{Provider:Oi,Consumer:as}=cr,vn=[ye,k.DOMAIN_FOR_IP_SITE,k.DOMAIN_FOR_IP_SITE_REGEXP],Ni=(t,r)=>{if(t.name===k.DOMAIN_FOR_DEFAULT_SITE)return-1;if(r.name===k.DOMAIN_FOR_DEFAULT_SITE)return 1;const n=vn.includes(t.name),i=vn.includes(r.name);return n&&i?sn(t.name,r.name):n?-1:i?1:sn(t.name,r.name)},$i=({sites:t,nodePort:r})=>{const n=window.location.hostname,a=(t||[]).map(o=>{const{id:s,rules:u=[],corsAllowedOrigins:m=[]}=o;let{domain:d,domainAliases:c}=o;c=c||[],[k.DOMAIN_FOR_IP_SITE,k.DOMAIN_FOR_IP_SITE_REGEXP].includes(d)&&(d=ye,c.find(y=>y.value===n)||c.unshift({protected:!1,value:n}));const w={id:s,name:d,type:"domain",items:[],domainAliases:c,isProtected:o.isProtected,corsAllowedOrigins:m};return(u||[]).forEach(y=>{const{id:C,isProtected:E,from:{pathPrefix:j},to:D}=y;if(D.type===k.ROUTING_RULE_TYPES.BLOCKLET){let S="";Number.parseInt(D.port,10)===Number.parseInt(r,10)?(S="Blocklet Server Dashboard",D.type=k.ROUTING_RULE_TYPES.DAEMON):S=D.did,w.items.push({id:C,name:an(j||"/"),title:S,type:"rule",isProtected:E,pathPrefix:j,to:D})}else w.items.push({id:C,pathPrefix:j,name:an(j||"/"),title:"Blocklet Server Dashboard",type:"rule",isProtected:E,to:D})}),w.items=Gn(w.items,y=>y.name),w}).sort(Ni),l=a.reduce((o,s)=>{let{name:u}=s;return u.endsWith(k.BLOCKLET_SITE_GROUP_SUFFIX)&&([u]=u.split(".")),o[u]={...s,rules:s.items},o},{});return{sites:a,siteMap:l}},Ui=({did:t,domain:r,mountPoint:n,siteMap:i,params:a}={})=>{if(!i)return null;const l=i[t];if(!l)return null;const o=r||(l.domainAliases||[])[0];if(!o)return null;let s=n;if(!s){const u=l.rules.filter(m=>!m.name.startsWith(k.WELLKNOWN_PATH_PREFIX))[0];s=u?u.name:"/"}return et(o.value,s,a)},zi=({did:t,mountPoint:r,siteMap:n,params:i}={})=>{if(!n)return[];const a=n[t];if(!a)return[];const l=a.domainAliases||[];if(!l.length)return[];let o=r;if(!o){const s=a.rules.filter(u=>!u.name.startsWith(k.WELLKNOWN_PATH_PREFIX))[0];o=s?s.name:"/"}return l.map(s=>et(s.value,o,i))},Bi=t=>{const r=t.map(i=>i.domain).filter(i=>![k.DOMAIN_FOR_IP_SITE_REGEXP,k.DOMAIN_FOR_DEFAULT_SITE].includes(i));let n=[];return t.forEach(i=>n.push(...i.domainAliases||[])),n=n.map(i=>typeof i=="string"?{value:i,isProtected:!1}:i),{domains:r,domainsAliases:n}};function jn({children:t}){const{api:r,info:n}=Q(),[i,a]=h.useState([]),[l,o]=h.useState([]),[s,u]=h.useState([]),m=Oe(async()=>{const{sites:_}=await r.getRoutingSites({input:{snapshotHash:""}}),v=_||[];await Promise.all(v.map(async g=>(g.domainAliases=await Ur(g.domainAliases,{getIP:zr}),g)));const f=Bi(v);a(v),o(f.domains),u([window.location.hostname,...f.domains,...f.domainsAliases.map(g=>g.value)])},[n]),d=(_,v)=>{a(f=>f.map(g=>g.id===_?v.domain?v:{...v,domain:g.domain}:g))},c=_=>r.takeRoutingSnapshot({input:{dryRun:!1,message:encodeURIComponent(_)}}),w=async _=>{const v=await r.addRoutingSite({input:_});a(i.concat(v.site))},y=async(_,v)=>{const f=await r.updateRoutingSite({input:{id:_,...v}});if(f.site&&f.site.id){const g=i.findIndex(R=>R.id===f.site.id);g!==-1&&(i.splice(g,1,f.site),a([].concat(i)))}},C=async _=>{await r.deleteRoutingSite({input:{id:_}}),a(i.filter(v=>v.id!==_))},E=async(_,v,f)=>{const g=await r.addDomainAlias({input:{id:_,domainAlias:v,force:f}});d(_,g.site)},j=async(_,v)=>{const f=await r.deleteDomainAlias({input:{id:_,domainAlias:v}});d(_,f.site)},D=async(_,v)=>{const{site:f}=await r.addRoutingRule({input:{id:_,rule:v}});d(_,f)},S=async(_,v)=>{const{site:f}=await r.updateRoutingRule({input:{id:_,rule:v}});d(_,f)},b=async(_,v)=>{const{site:f}=await r.deleteRoutingRule({input:{id:_,ruleId:v}});d(_,f)},x={loading:m.loading,error:m.error,refresh:m.retry,api:r,actions:{addSite:w,updateSite:y,deleteSite:C,addDomainAlias:E,deleteDomainAlias:j,takeSnapshot:c,addRule:D,updateRule:S,deleteRule:b}},{sites:L,siteMap:F}=$i({sites:i,nodePort:n.port});return x.sites=L,x.siteMap=F,x.domains=l,x.allDomains=s,x.getBlockletUrl=({did:_,domain:v,mountPoint:f,params:g})=>Ui({did:_,domain:v,mountPoint:f,siteMap:x.siteMap,params:g}),x.getBlockletUrls=({did:_,mountPoint:v,params:f})=>zi({did:_,mountPoint:v,siteMap:x.siteMap,params:f}),e.jsx(Oi,{value:{routing:x},children:t})}function de(){const{routing:t}=h.useContext(cr);return t}function Vt(t){const r=[k.DOMAIN_FOR_IP_SITE_REGEXP,k.DOMAIN_FOR_DEFAULT_SITE,k.DOMAIN_FOR_IP_SITE];return typeof window<"u"&&typeof window.location<"u"&&r.push(window.location.hostname),r.includes(t)}function Mi(){return null}function dr({confirm:t=null}){const[r,n]=h.useState(null),{t:i}=z(),a=()=>{n(null)},l=async s=>{if(s){let u=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";u==="/"?ln.push(`${s.pathname}`):(u.endsWith("/")&&(u=u.substring(0,u.length-1)),ln.push(`${u}${s.pathname}`)),window.location.reload()}},o=(s,...u)=>{let m=typeof t=="function"?t(s,...u):t;return m?(typeof m=="string"&&(m={description:m}),n({title:i("common.noticeTitle"),description:i("common.leavePageTip"),confirm:i("common.confirm"),cancel:i("common.cancel"),onConfirm:()=>l(s),onCancel:()=>a(),...m}),!1):!0};return e.jsxs(Wi,{children:[e.jsx(Mi,{message:o}),r&&e.jsx(le,{title:r.title,description:r.description,confirm:r.confirm,cancel:r.cancel,params:r.params,onConfirm:r.onConfirm,onCancel:r.onCancel})]})}dr.propTypes={confirm:p.oneOfType([p.object,p.string,p.func])};const Wi=ne.div`
2
2
  margin-bottom: 24px;
3
3
  .top-btns-alert {
4
4
  @media (max-width: ${t=>t.theme.breakpoints.values.sm}px) {
@@ -1,4 +1,4 @@
1
- import{aH as L,bn as I,bo as Ke,V as S,j as e,N as B,r as h,O as X,P as G,S as Q,Q as J,K as p,bp as ce,o as x,n as Re,v as U,C as Se,ac as le,aV as Y,t as H,p as De,y as _,$ as de,aU as Ie,R as $e,s as P,at as Be,H as Pe,m as Ne,bq as W,W as Ee,br as pe,bs as me,bt as ue,bu as _e,i as ze,T as $,bv as Le,ay as ie,a3 as ae,aR as re,bk as We,bw as Me,U as qe,X as Ue,A as He,u as Fe,bm as Oe,d as Ve,bx as Xe}from"./index-DuooR0LN.js";import{u as Ge,T as Qe}from"./html-title-qBMXCmRQ.js";import Je from"./audit-logs-BGqaeoE8.js";import{T as xe,M as Ye}from"./index-BN3g2rHb.js";import{r as he,P as Ze}from"./index-aiQ1yrAz.js";import{u as z,T as et}from"./team-CzwXU7Sn.js";import{g as tt,H as st}from"./index-CpnPkVho.js";import{D as nt}from"./url-evaluation-B0gvZV9M.js";import{E as ot}from"./Edit-BgZAPfMS.js";import{y as it}from"./index-aenta2dO.js";import{A as at}from"./Add-B5kXVjlA.js";import{l as F}from"./index-C8lDVHeG.js";import{C as O}from"./click-to-copy-DKJULX-E.js";import{f as rt}from"./index-BojVbZw0.js";import{D as ct}from"./delete-confirm-CScy8CpF.js";import{P as lt}from"./permission-DIfhBFCW.js";import{u as dt}from"./blocklet-B_F88Tat.js";import{u as Z}from"./use-mobile-CkAg9r-k.js";import{A as pt}from"./actions-CIeK6cUZ.js";import{u as mt}from"./useAsyncRetry-BnBPOYFC.js";import"./TableSearch-DOm0JN54.js";import"./Search-DEPwrfa9.js";import"./Clear-DX2cXl5s.js";import"./useLocalStorage-De1OH_yW.js";import"./index-FeXmdOtc.js";import"./decode-DPztD6kB.js";import"./UnfoldMore-B4TAWJFj.js";import"./shorten-label-CH7uGTcM.js";import"./ViewList-CY3VNyEW.js";import"./use-mobile-Do_xR908.js";import"./client-BgZeYJUj.js";import"./index-ClEU1mAO.js";import"./ButtonGroup-CDUEw9SW.js";import"./getValidReactChildren-CpsNar5s.js";import"./index.esm-1OWSDx-7.js";import"./Google-BFNuxUqB.js";import"./cloneDeep-CqeCq042.js";import"./Autocomplete-bHChBtVA.js";import"./ListSubheader-DuidDB0a.js";import"./AdapterDayjs-CT2knpDN.js";import"./useThemeProps-BqWmszN-.js";import"./CSSTransition-oc_jqFQN.js";import"./visuallyHidden-Dan1xhjv.js";import"./index-Bd9gw7el.js";import"./Verified-BvVUNdGO.js";import"./DeleteOutline-rUX66WwM.js";import"./ErrorOutline-C0x4yDj7.js";import"./index-BlBdJ3Dk.js";import"./emotion-cache.browser.esm-BNl3Ir2h.js";import"./sdk-DMTCyfpQ.js";import"./index-BDKSFZhr.js";import"./edit.svg-DLR7W7oi.js";import"./list-header-CdZzFX4v.js";import"./chain-_RfIu3NG.js";import"./ToggleButtonGroup-CdulBJn7.js";import"./lock.svg-DOUWz34o.js";import"./FilterList-CjNG8_Me.js";import"./index-B0LbFKW2.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-DFUdc1h4.js";import"./MoreVert-zazLZzFB.js";import"./useAsync-CxZFXpVk.js";function ee({value:s}){const{t,locale:n}=S(),i=new Date;return new Date(s)<i?e.jsxs("span",{style:{color:"red"},children:[e.jsx(B,{value:s,locale:n}),`${t("setting.accessKey.expired",{time:""})}`]}):e.jsx(B,{mode:"daysLeft",value:s,locale:n,type:"all"})}ee.propTypes={value:x.string.isRequired};function te({value:s,onChange:t,...n}){const{t:i}=S(),a=h.useMemo(()=>[{value:"signature",title:i("setting.accessKey.signature"),description:i("setting.accessKey.signatureDesc")},{value:"simple",title:i("setting.accessKey.simple"),description:i("setting.accessKey.simpleDesc")}],[i]);return e.jsxs(X,{style:{width:"100%"},variant:"outlined",...n,children:[e.jsx(G,{children:i("setting.accessKey.authType")}),e.jsx(Q,{value:s,onChange:t,fullWidth:!0,label:i("setting.accessKey.authType"),IconComponent:r=>e.jsx(ce,{...r,width:20,height:20}),children:a.map(r=>e.jsx(J,{value:r.value,children:e.jsxs(p,{children:[e.jsx("span",{children:r.title}),e.jsx(p,{sx:{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal"},children:r.description})]})},r.value))})]})}te.propTypes={value:x.string.isRequired,onChange:x.func.isRequired};const se=()=>{const s=L.RBAC_CONFIG.roles.filter(a=>a.passport),{inService:t}=I(),{roles:n}=z(),i=[...s,...t?n:[]];return Ke(i,"name").filter(a=>a.name!==L.ROLES.OWNER)};function fe(){const{session:s}=Re(),t=se();return h.useMemo(()=>{if(!s?.user?.role)return[];if(["owner","admin"].includes(s.user.role))return t;const i=t.filter(r=>r.name==="guest");return[...t.filter(r=>r.name!=="guest").filter(r=>s.user.passports.find(f=>f.role===r.name)),...i]},[t,s?.user?.passports,s?.user?.role])}function ge({onCreate:s=()=>{},remark:t=""}){const{api:n}=I(),{teamDid:i}=z(),{t:a}=S(),[r,f]=h.useState(!1),[m,b]=h.useState(null),u=fe(),T=()=>{f(!1),b(null)},v=async l=>{const{remark:k,passport:g,authType:o}=l;f(!0);const j=await n.createAccessKey({input:{teamDid:i,remark:k.trim(),passport:g,expireAt:l.expireAt?new Date(l.expireAt).getTime():null,authType:o}}),{data:A}=j;s(A),b(null),f(!1)},c={title:`${a("common.create")} ${a("accessKey")}`,description:(l,k,g)=>e.jsxs(Y,{sx:{gap:3},children:[e.jsx(H,{label:a("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,margin:"dense",value:l.remark,onChange:o=>{k({...l,remark:o.target.value,__disableConfirm:!l.passport||!o.target.value.trim()}),o.target.value.trim()?g(""):g(a("setting.accessKey.remarkInvalid"))},slotProps:{htmlInput:{"data-cy":"remark-input"}}}),e.jsxs(X,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{sx:{width:"calc(100% - 46px)"},children:a("setting.accessKey.passport")}),e.jsx(Q,{"data-cy":"create-access-key-select-passport",value:l.passport,onChange:o=>{const j=o.target.value;g(null),k({...l,passport:j,__disableConfirm:!l.remark||!j})},fullWidth:!0,label:a("setting.accessKey.passport"),disabled:r,IconComponent:o=>e.jsx(ce,{...o,width:20,height:20}),children:u.map(o=>e.jsx(J,{value:o.name,"data-cy":`create-access-key-passport-option-${o.name}`,children:e.jsxs(p,{children:[e.jsx("span",{children:o.title||o.name}),e.jsx(p,{sx:{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify"},children:o.description})]})},o.name))})]}),e.jsx(te,{value:l.authType,onChange:o=>{k({...l,authType:o.target.value})}}),e.jsx(xe,{placeholder:a("setting.accessKey.expireTime"),value:l.expireAt,onChange:o=>{k({...l,expireAt:o,__disableConfirm:!l.passport||!l.remark||!o})}})]}),confirm:a("common.confirm"),cancel:a("common.cancel"),color:"primary",params:{remark:t,authType:"signature",__disableConfirm:!t.trim()},onConfirm:v,onCancel:T};return e.jsxs(e.Fragment,{children:[e.jsxs(U,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>b(c),className:"rule-action",children:[r?e.jsx(Se,{size:16}):e.jsx(at,{style:{fontSize:16}}),a("common.create")]}),m&&e.jsx(le,{title:m.title,description:m.description,confirm:m.confirm,color:m.color,cancel:m.cancel,params:m.params,onConfirm:m.onConfirm,onCancel:m.onCancel})]})}ge.propTypes={remark:x.string,onCreate:x.func};function ye({onConfirm:s=()=>{},accessKeyId:t,accessKeySecret:n,hideSecret:i=!0}){const{t:a}=h.useContext(De),[r,f]=h.useState(!1),[m,b]=h.useState(()=>i),u=I(),T=()=>{b(!m)},v=g=>{f(g.target.checked)},c=_(window.location.origin,u?.info?.routing?.adminPath),l=h.useMemo(()=>i?`const Client = require('@blocklet/server-js');
1
+ import{aH as L,bn as I,bo as Ke,V as S,j as e,N as B,r as h,O as X,P as G,S as Q,Q as J,K as p,bp as ce,o as x,n as Re,v as U,C as Se,ac as le,aV as Y,t as H,p as De,y as _,$ as de,aU as Ie,R as $e,s as P,at as Be,H as Pe,m as Ne,bq as W,W as Ee,br as pe,bs as me,bt as ue,bu as _e,i as ze,T as $,bv as Le,ay as ie,a3 as ae,aR as re,bk as We,bw as Me,U as qe,X as Ue,A as He,u as Fe,bm as Oe,d as Ve,bx as Xe}from"./index-F3HbHSYi.js";import{u as Ge,T as Qe}from"./html-title-B42L4vHs.js";import Je from"./audit-logs-CLj12YBu.js";import{T as xe,M as Ye}from"./index-hPXA34zh.js";import{r as he,P as Ze}from"./index-DwEuapzX.js";import{u as z,T as et}from"./team-NpjMEHti.js";import{g as tt,H as st}from"./index-CGwvwEUr.js";import{D as nt}from"./url-evaluation-Bm9OWnaf.js";import{E as ot}from"./Edit-DCJEwDTg.js";import{y as it}from"./index-jC9YQw2A.js";import{A as at}from"./Add-D4EYSG3K.js";import{l as F}from"./index-BKJPtvsM.js";import{C as O}from"./click-to-copy-C5l1aVBQ.js";import{f as rt}from"./index-BojVbZw0.js";import{D as ct}from"./delete-confirm-CiFwBlNG.js";import{P as lt}from"./permission-caYaN7o4.js";import{u as dt}from"./blocklet-BSWtuwnH.js";import{u as Z}from"./use-mobile-D5fNICVu.js";import{A as pt}from"./actions-DtMFbSMo.js";import{u as mt}from"./useAsyncRetry-CSZJdZ2s.js";import"./TableSearch-CAf-ESr9.js";import"./Search-DV5vJN1H.js";import"./Clear---RPVeR7.js";import"./useLocalStorage-xEKVgwM3.js";import"./index-CbD2HRHU.js";import"./decode-DPztD6kB.js";import"./UnfoldMore-BQzQy89p.js";import"./shorten-label-DxKgpegt.js";import"./ViewList-CE_c5qLh.js";import"./use-mobile-Dm-drtZi.js";import"./client-BaEuKBw8.js";import"./index-D4PsRecd.js";import"./ButtonGroup-DcZ0ug1l.js";import"./getValidReactChildren-DECNQV_G.js";import"./index.esm-CG55Fmct.js";import"./Google-DR320mb8.js";import"./cloneDeep-CPQcx7Qa.js";import"./Autocomplete-Dy_zZ4Oc.js";import"./ListSubheader-BlgmemtO.js";import"./AdapterDayjs-NScUj50m.js";import"./useThemeProps-BhYWaPDm.js";import"./CSSTransition-V4R7ZcvS.js";import"./visuallyHidden-Dan1xhjv.js";import"./index-M4yiF52E.js";import"./Verified-CF2yeqGT.js";import"./DeleteOutline-GpuLmtYQ.js";import"./ErrorOutline-B9LgxSpq.js";import"./index-CT-cKo4l.js";import"./emotion-cache.browser.esm-CQ2-5c4_.js";import"./sdk-WWYom8eN.js";import"./index-DaNXTl0n.js";import"./edit.svg-BT2rpJxW.js";import"./list-header-CnD8v8jR.js";import"./chain-Cxmkzj72.js";import"./ToggleButtonGroup-Csc72nBu.js";import"./lock.svg-DWUrJ_5S.js";import"./FilterList-CNYUVm5S.js";import"./index-BIGgo0dk.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-BHCVOuWA.js";import"./MoreVert-wWXtgLji.js";import"./useAsync-2o_4QDVN.js";function ee({value:s}){const{t,locale:n}=S(),i=new Date;return new Date(s)<i?e.jsxs("span",{style:{color:"red"},children:[e.jsx(B,{value:s,locale:n}),`${t("setting.accessKey.expired",{time:""})}`]}):e.jsx(B,{mode:"daysLeft",value:s,locale:n,type:"all"})}ee.propTypes={value:x.string.isRequired};function te({value:s,onChange:t,...n}){const{t:i}=S(),a=h.useMemo(()=>[{value:"signature",title:i("setting.accessKey.signature"),description:i("setting.accessKey.signatureDesc")},{value:"simple",title:i("setting.accessKey.simple"),description:i("setting.accessKey.simpleDesc")}],[i]);return e.jsxs(X,{style:{width:"100%"},variant:"outlined",...n,children:[e.jsx(G,{children:i("setting.accessKey.authType")}),e.jsx(Q,{value:s,onChange:t,fullWidth:!0,label:i("setting.accessKey.authType"),IconComponent:r=>e.jsx(ce,{...r,width:20,height:20}),children:a.map(r=>e.jsx(J,{value:r.value,children:e.jsxs(p,{children:[e.jsx("span",{children:r.title}),e.jsx(p,{sx:{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal"},children:r.description})]})},r.value))})]})}te.propTypes={value:x.string.isRequired,onChange:x.func.isRequired};const se=()=>{const s=L.RBAC_CONFIG.roles.filter(a=>a.passport),{inService:t}=I(),{roles:n}=z(),i=[...s,...t?n:[]];return Ke(i,"name").filter(a=>a.name!==L.ROLES.OWNER)};function fe(){const{session:s}=Re(),t=se();return h.useMemo(()=>{if(!s?.user?.role)return[];if(["owner","admin"].includes(s.user.role))return t;const i=t.filter(r=>r.name==="guest");return[...t.filter(r=>r.name!=="guest").filter(r=>s.user.passports.find(f=>f.role===r.name)),...i]},[t,s?.user?.passports,s?.user?.role])}function ge({onCreate:s=()=>{},remark:t=""}){const{api:n}=I(),{teamDid:i}=z(),{t:a}=S(),[r,f]=h.useState(!1),[m,b]=h.useState(null),u=fe(),T=()=>{f(!1),b(null)},v=async l=>{const{remark:k,passport:g,authType:o}=l;f(!0);const j=await n.createAccessKey({input:{teamDid:i,remark:k.trim(),passport:g,expireAt:l.expireAt?new Date(l.expireAt).getTime():null,authType:o}}),{data:A}=j;s(A),b(null),f(!1)},c={title:`${a("common.create")} ${a("accessKey")}`,description:(l,k,g)=>e.jsxs(Y,{sx:{gap:3},children:[e.jsx(H,{label:a("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,margin:"dense",value:l.remark,onChange:o=>{k({...l,remark:o.target.value,__disableConfirm:!l.passport||!o.target.value.trim()}),o.target.value.trim()?g(""):g(a("setting.accessKey.remarkInvalid"))},slotProps:{htmlInput:{"data-cy":"remark-input"}}}),e.jsxs(X,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{sx:{width:"calc(100% - 46px)"},children:a("setting.accessKey.passport")}),e.jsx(Q,{"data-cy":"create-access-key-select-passport",value:l.passport,onChange:o=>{const j=o.target.value;g(null),k({...l,passport:j,__disableConfirm:!l.remark||!j})},fullWidth:!0,label:a("setting.accessKey.passport"),disabled:r,IconComponent:o=>e.jsx(ce,{...o,width:20,height:20}),children:u.map(o=>e.jsx(J,{value:o.name,"data-cy":`create-access-key-passport-option-${o.name}`,children:e.jsxs(p,{children:[e.jsx("span",{children:o.title||o.name}),e.jsx(p,{sx:{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify"},children:o.description})]})},o.name))})]}),e.jsx(te,{value:l.authType,onChange:o=>{k({...l,authType:o.target.value})}}),e.jsx(xe,{placeholder:a("setting.accessKey.expireTime"),value:l.expireAt,onChange:o=>{k({...l,expireAt:o,__disableConfirm:!l.passport||!l.remark||!o})}})]}),confirm:a("common.confirm"),cancel:a("common.cancel"),color:"primary",params:{remark:t,authType:"signature",__disableConfirm:!t.trim()},onConfirm:v,onCancel:T};return e.jsxs(e.Fragment,{children:[e.jsxs(U,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>b(c),className:"rule-action",children:[r?e.jsx(Se,{size:16}):e.jsx(at,{style:{fontSize:16}}),a("common.create")]}),m&&e.jsx(le,{title:m.title,description:m.description,confirm:m.confirm,color:m.color,cancel:m.cancel,params:m.params,onConfirm:m.onConfirm,onCancel:m.onCancel})]})}ge.propTypes={remark:x.string,onCreate:x.func};function ye({onConfirm:s=()=>{},accessKeyId:t,accessKeySecret:n,hideSecret:i=!0}){const{t:a}=h.useContext(De),[r,f]=h.useState(!1),[m,b]=h.useState(()=>i),u=I(),T=()=>{b(!m)},v=g=>{f(g.target.checked)},c=_(window.location.origin,u?.info?.routing?.adminPath),l=h.useMemo(()=>i?`const Client = require('@blocklet/server-js');
2
2
  const ensureServerEndpoint = require('@abtnode/util/lib/ensure-server-endpoint');
3
3
  const { joinURL } = require('ufo');
4
4
 
@@ -1,4 +1,4 @@
1
- import{dF as C,r as o,Q as d,j as e,dG as c,b5 as b,dH as I,bv as E,dI as v,dc as u,dJ as z}from"./index-DuooR0LN.js";import{B as A}from"./ButtonGroup-CDUEw9SW.js";function L({...r}){const{size:p="medium",color:i="primary",menu:a=[],children:s=null,variant:m="contained",onClick:x=C,menuButtonProps:f={},...h}=r,[j,l]=o.useState(!1),n=o.useRef(null),g=Array.isArray(a)?a.map((t,B)=>o.isValidElement(t)?t:o.createElement(d,{...t,key:B})):a,y=()=>{l(t=>!t)},k=t=>{n.current&&n.current.contains(t.target)||l(!1)},M=t=>{t.target.closest(".MuiMenuItem-root")&&l(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(P,{variant:m,size:p,color:i,ref:n,...h,children:[typeof s=="function"?s():e.jsx(c,{onClick:x,color:i,children:s}),e.jsx(c,{onClick:y,color:i,...f,"aria-label":"more functions",children:e.jsx(b,{})})]}),e.jsx(w,{open:j,anchorEl:n.current,placement:"bottom-end",disablePortal:!1,children:e.jsx(I,{children:e.jsx(E,{onClickAway:k,children:e.jsx(v,{onClick:M,children:g})})})})]})}L.Item=d;const P=u(A)`
1
+ import{dF as C,r as o,Q as d,j as e,dG as c,b5 as b,dH as I,bv as E,dI as v,dc as u,dJ as z}from"./index-F3HbHSYi.js";import{B as A}from"./ButtonGroup-DcZ0ug1l.js";function L({...r}){const{size:p="medium",color:i="primary",menu:a=[],children:s=null,variant:m="contained",onClick:x=C,menuButtonProps:f={},...h}=r,[j,l]=o.useState(!1),n=o.useRef(null),g=Array.isArray(a)?a.map((t,B)=>o.isValidElement(t)?t:o.createElement(d,{...t,key:B})):a,y=()=>{l(t=>!t)},k=t=>{n.current&&n.current.contains(t.target)||l(!1)},M=t=>{t.target.closest(".MuiMenuItem-root")&&l(!1)};return e.jsxs(e.Fragment,{children:[e.jsxs(P,{variant:m,size:p,color:i,ref:n,...h,children:[typeof s=="function"?s():e.jsx(c,{onClick:x,color:i,children:s}),e.jsx(c,{onClick:y,color:i,...f,"aria-label":"more functions",children:e.jsx(b,{})})]}),e.jsx(w,{open:j,anchorEl:n.current,placement:"bottom-end",disablePortal:!1,children:e.jsx(I,{children:e.jsx(E,{onClickAway:k,children:e.jsx(v,{onClick:M,children:g})})})})]})}L.Item=d;const P=u(A)`
2
2
  > .MuiButtonBase-root:last-of-type {
3
3
  min-width: 2em;
4
4
  padding-left: 0;
@@ -1 +1 @@
1
- import{co as x,r as n,p as g,cp as r,B as u,j as s,K as m,cq as d}from"./index-DuooR0LN.js";function P(){const i=x(),{blocklets:c,refresh:p}=i,{t:l}=n.useContext(g),y=r.generateKey(),[a]=u();return n.useEffect(()=>{const o=r.getNotificationQueryParams(y)??{},t=a.get("entityId"),e=a.get("severity"),f={...o,...e?{severity:e==="all"?[]:e.split(","),paging:{...o.paging,page:1}}:{},...t?{entityId:t==="all"?[]:t.split(",")}:{},componentDid:[]};p(f)},[]),s.jsxs(m,{children:[s.jsx("h1",{children:l("notification.title")}),s.jsx(d,{tabType:"line",blocklets:c,context:i,filterType:"entity",type:"server"})]})}export{P as default};
1
+ import{co as x,r as n,p as g,cp as r,B as u,j as s,K as m,cq as d}from"./index-F3HbHSYi.js";function P(){const i=x(),{blocklets:c,refresh:p}=i,{t:l}=n.useContext(g),y=r.generateKey(),[a]=u();return n.useEffect(()=>{const o=r.getNotificationQueryParams(y)??{},t=a.get("entityId"),e=a.get("severity"),f={...o,...e?{severity:e==="all"?[]:e.split(","),paging:{...o.paging,page:1}}:{},...t?{entityId:t==="all"?[]:t.split(",")}:{},componentDid:[]};p(f)},[]),s.jsxs(m,{children:[s.jsx("h1",{children:l("notification.title")}),s.jsx(d,{tabType:"line",blocklets:c,context:i,filterType:"entity",type:"server"})]})}export{P as default};
@@ -1 +1 @@
1
- import{r as P,V as E,A as C,j as e,Y as W,C as j,cC as I,K as T,w as k,H as u,aH as S,u as U,x as v,aq as N,ae as R}from"./index-DuooR0LN.js";import{w as b}from"./wrap-locale-CuYkSdRb.js";import{g as L}from"./get-safe-url-CVsSFVM-.js";import"./index-DBf7KJKt.js";function H({SessionContext:n,webWalletUrl:a,onSuccess:r}){const{api:o,session:t}=P.useContext(n),{t:s,locale:g}=E(),h=C(),{searchParams:l}=new URL(window.location.href),p=l.get("redirect"),m=async(c,w)=>{r(c,w),await t.refresh(),u.success(s("exchangePassport.success")),setTimeout(()=>{if(p){const i=decodeURIComponent(p);i.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?h(i,{replace:!0}):window.location.href=L(i)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},f=c=>{u.error(c.message)},d={},x=l.get("componentId");return x&&(d.componentId=x),t.loading?e.jsx(W,{children:e.jsx(j,{})}):e.jsx(I,{did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(T,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(k,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:o.get,checkTimeout:10*60*1e3,webWalletUrl:a,onSuccess:m,onError:f,locale:g,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:d,extraContent:null,hideCloseButton:!0})})})}const K=b(H);function V(){const{info:n}=U(),a=v(n),r=(o,t)=>{o.sessionToken&&R(t(o.sessionToken))};return e.jsx(K,{SessionContext:N,webWalletUrl:a,onSuccess:r})}export{V as default};
1
+ import{r as P,V as E,A as C,j as e,Y as W,C as j,cC as I,K as T,w as k,H as u,aH as S,u as U,x as v,aq as N,ae as R}from"./index-F3HbHSYi.js";import{w as b}from"./wrap-locale-BQVWlKMF.js";import{g as L}from"./get-safe-url-DfDeYxPo.js";import"./index-CAUKXdVD.js";function H({SessionContext:n,webWalletUrl:a,onSuccess:r}){const{api:o,session:t}=P.useContext(n),{t:s,locale:g}=E(),h=C(),{searchParams:l}=new URL(window.location.href),p=l.get("redirect"),m=async(c,w)=>{r(c,w),await t.refresh(),u.success(s("exchangePassport.success")),setTimeout(()=>{if(p){const i=decodeURIComponent(p);i.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?h(i,{replace:!0}):window.location.href=L(i)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},f=c=>{u.error(c.message)},d={},x=l.get("componentId");return x&&(d.componentId=x),t.loading?e.jsx(W,{children:e.jsx(j,{})}):e.jsx(I,{did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(T,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(k,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:o.get,checkTimeout:10*60*1e3,webWalletUrl:a,onSuccess:m,onError:f,locale:g,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:d,extraContent:null,hideCloseButton:!0})})})}const K=b(H);function V(){const{info:n}=U(),a=v(n),r=(o,t)=>{o.sessionToken&&R(t(o.sessionToken))};return e.jsx(K,{SessionContext:N,webWalletUrl:a,onSuccess:r})}export{V as default};
@@ -1 +1 @@
1
- import{u as f,j as s,C as d,A as w,ax as v,cr as C,cs as u,ae as j,aH as I,K as P,bx as S}from"./index-DuooR0LN.js";import{I as E}from"./invitation-DEX-Txxu.js";import{g as R}from"./get-safe-url-CVsSFVM-.js";import"./index-BWojQAsD.js";import"./index-BlBdJ3Dk.js";import"./emotion-cache.browser.esm-BNl3Ir2h.js";import"./sdk-DMTCyfpQ.js";import"./wrap-locale-CuYkSdRb.js";import"./index-DBf7KJKt.js";function T(n){const{searchParams:a}=new URL(window.location.href),g=w(),{api:i,session:r}=v(),{info:l}=f(),c=a.get("redirect"),p=a.get("id"),o=C(async()=>{if(!p)return null;const{data:t}=await i.get("/api/invitation",{params:{inviteId:p,mode:"issue-passport"}});return t}),m=u(()=>{if(o.error)throw o.error;return o?.data}),x=u(async(t,h=e=>e)=>{t&&(t.sessionToken&&j(h(t.sessionToken)),await r.refresh()),setTimeout(()=>{if(c){const e=decodeURIComponent(c);e.startsWith(I.WELLKNOWN_SERVICE_PATH_PREFIX)?g(e,{replace:!0}):window.location.href=R(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return o.loading?s.jsx(d,{}):s.jsx(P,{className:"page-invite",sx:{width:"100vw",height:"100%",minHeight:"100vh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"#f6f8fa",overflow:"auto",padding:"20px"},children:s.jsx(E,{...n,action:"issue-passport",getDataFn:m,createPassportSvg:t=>S(t,l),checkFn:i.get,onLoginSuccess:x,passportColor:"default",onLogin:r.login})})}function b(){return f().loading?s.jsx(d,{}):s.jsx(T,{})}export{b as default};
1
+ import{u as f,j as s,C as d,A as w,ax as v,cr as C,cs as u,ae as j,aH as I,K as P,bx as S}from"./index-F3HbHSYi.js";import{I as E}from"./invitation-C464OqTr.js";import{g as R}from"./get-safe-url-DfDeYxPo.js";import"./index-DXF1RiG0.js";import"./index-CT-cKo4l.js";import"./emotion-cache.browser.esm-CQ2-5c4_.js";import"./sdk-WWYom8eN.js";import"./wrap-locale-BQVWlKMF.js";import"./index-CAUKXdVD.js";function T(n){const{searchParams:a}=new URL(window.location.href),g=w(),{api:i,session:r}=v(),{info:l}=f(),c=a.get("redirect"),p=a.get("id"),o=C(async()=>{if(!p)return null;const{data:t}=await i.get("/api/invitation",{params:{inviteId:p,mode:"issue-passport"}});return t}),m=u(()=>{if(o.error)throw o.error;return o?.data}),x=u(async(t,h=e=>e)=>{t&&(t.sessionToken&&j(h(t.sessionToken)),await r.refresh()),setTimeout(()=>{if(c){const e=decodeURIComponent(c);e.startsWith(I.WELLKNOWN_SERVICE_PATH_PREFIX)?g(e,{replace:!0}):window.location.href=R(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return o.loading?s.jsx(d,{}):s.jsx(P,{className:"page-invite",sx:{width:"100vw",height:"100%",minHeight:"100vh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"#f6f8fa",overflow:"auto",padding:"20px"},children:s.jsx(E,{...n,action:"issue-passport",getDataFn:m,createPassportSvg:t=>S(t,l),checkFn:i.get,onLoginSuccess:x,passportColor:"default",onLogin:r.login})})}function b(){return f().loading?s.jsx(d,{}):s.jsx(T,{})}export{b as default};
@@ -1,4 +1,4 @@
1
- import{aF as v,j as n,K as a,dc as w,V as z,f as p,dj as F}from"./index-DuooR0LN.js";const k=v(n.jsx("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m4.3 14.3c-.39.39-1.02.39-1.41 0L12 13.41 9.11 16.3c-.39.39-1.02.39-1.41 0a.996.996 0 0 1 0-1.41L10.59 12 7.7 9.11a.996.996 0 0 1 0-1.41c.39-.39 1.02-.39 1.41 0L12 10.59l2.89-2.89c.39-.39 1.02-.39 1.41 0s.39 1.02 0 1.41L13.41 12l2.89 2.89c.38.38.38 1.02 0 1.41"}));function r({icon:e=null,title:t="",description:o="",extra:y=null,...b}){return n.jsxs(E,{...b,children:[e,typeof t=="string"?n.jsx(a,{sx:{mt:3,fontSize:22,fontWeight:400,color:"text.primary",textAlign:"center"},children:t}):t,typeof o=="string"?n.jsx(a,{sx:{mt:1,fontSize:14,color:"text.secondary",textAlign:"center"},children:o}):o,n.jsx(a,{sx:{mt:3},children:y})]})}const E=w("div")`
1
+ import{aF as v,j as n,K as a,dc as w,V as z,f as p,dj as F}from"./index-F3HbHSYi.js";const k=v(n.jsx("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m4.3 14.3c-.39.39-1.02.39-1.41 0L12 13.41 9.11 16.3c-.39.39-1.02.39-1.41 0a.996.996 0 0 1 0-1.41L10.59 12 7.7 9.11a.996.996 0 0 1 0-1.41c.39-.39 1.02-.39 1.41 0L12 10.59l2.89-2.89c.39-.39 1.02-.39 1.41 0s.39 1.02 0 1.41L13.41 12l2.89 2.89c.38.38.38 1.02 0 1.41"}));function r({icon:e=null,title:t="",description:o="",extra:y=null,...b}){return n.jsxs(E,{...b,children:[e,typeof t=="string"?n.jsx(a,{sx:{mt:3,fontSize:22,fontWeight:400,color:"text.primary",textAlign:"center"},children:t}):t,typeof o=="string"?n.jsx(a,{sx:{mt:1,fontSize:14,color:"text.secondary",textAlign:"center"},children:o}):o,n.jsx(a,{sx:{mt:3},children:y})]})}const E=w("div")`
2
2
  box-sizing: border-box;
3
3
  display: flex;
4
4
  flex-direction: column;
@@ -1,4 +1,4 @@
1
- import{aF as createSvgIcon,j as jsxRuntimeExports,r as reactExports$1,o,bd as getDefaultExportFromCjs,E as useMediaQuery,s as styled,dm as Skeleton,cQ as M$1,Z as CheckIcon,ay as Tooltip,dG as Button,T as Typography,K as Box,C as CircularProgress,f as useTheme,dA as isObject,e_ as mergeThemeOptions,e$ as StyledEngineProvider,f0 as ThemeProvider,f1 as ThemeProvider$1,f2 as s,Y as o$1,b8 as styled$1,f3 as CloseIcon,cF as Buffer,be as U,bF as __vitePreload,dF as noop,dc as l$2}from"./index-DuooR0LN.js";import{j as joinUrl}from"./url-join-CODnoVq3.js";const l$1=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M11.67 3.87 9.9 2.1 0 12l9.9 9.9 1.77-1.77L3.54 12z"})),d$2=createSvgIcon([jsxRuntimeExports.jsx("circle",{cx:"12",cy:"19",r:"2"},"0"),jsxRuntimeExports.jsx("path",{d:"M10 3h4v12h-4z"},"1")]),k$2=reactExports$1.createContext(),{Provider:w$3}=k$2,d$1=(C,F,V=window.location.pathname.replace(/\/$/,"/"))=>C?F?C===V:new RegExp(C).test(V):!1;function P({children:C,steps:F,mode:V="history"}){const[D,B]=reactExports$1.useState("");!D&&F.length&&B(F[0].key);const O=F.map(X=>X.children?[{key:X.key,hasChild:!0},X.children.map(at=>({parentKey:X.key,key:at.key}))]:{key:X.key}).flat(1/0),j=O.filter(X=>!X.hasChild),H=X=>{let at;const rt=O.findIndex(ft=>ft.key===D?(at=ft.parentKey,!0):!1);if(at===X)return"current";const tt=O.findIndex(ft=>ft.key===X);if(tt!==-1){if(tt===rt)return"current";if(tt<rt)return"before"}return"after"};function G(X){B(X)}function K(X){if(typeof X=="function"){const at=X(j.findIndex(rt=>rt.key===D));B(j[at].key)}else B(j[X].key)}const it=j.findIndex(X=>X.key===D);reactExports$1.useEffect(()=>{if(V==="history"){let X="";F.some(at=>at.children&&at.children.length?at.children.some(rt=>d$1(rt.path,rt.exact)?(X=rt.key,!0):!1):d$1(at.path,at.exact)?(X=at.key,!0):!1),X&&B(X)}return()=>{}},[F,V]);const ot={steps:F,totalStepsCount:j.length,getStepStatus:H,setActiveStepByKey:G,setActiveStepByIndex:K,activeStep:it,canBackToStep:X=>V==="memory"&&it!==0&&X<it};return jsxRuntimeExports.jsx(w$3,{value:ot,children:C})}function T$1(){return reactExports$1.use(k$2)}P.propTypes={children:o.any.isRequired,steps:o.array.isRequired,mode:o.string};var lib,hasRequiredLib;function requireLib(){if(hasRequiredLib)return lib;hasRequiredLib=1;var C=Object.prototype.hasOwnProperty,F=Object.prototype.toString;function V(D){if(D==null)return!0;if(typeof D=="boolean")return!1;if(typeof D=="number")return D===0;if(typeof D=="string"||typeof D=="function"||Array.isArray(D))return D.length===0;if(D instanceof Error)return D.message==="";if(D.toString==F)switch(D.toString()){case"[object File]":case"[object Map]":case"[object Set]":return D.size===0;case"[object Object]":{for(var B in D)if(C.call(D,B))return!1;return!0}}return!1}return lib=V,lib}var libExports=requireLib();const k$1=getDefaultExportFromCjs(libExports),S=""+new URL("blocklet-default-logo-Bspnu_ws.png",import.meta.url).href,t$1={en:{optional:"Optional",defaultNavSubTitle:"Launching"},zh:{optional:"可选",defaultNavSubTitle:"启动"}},a$1=C=>t$1[C]?t$1[C]:t$1.en,i=C=>C==="zh"?"启动":"Launching",g$2=C=>C?.title||C?.name||"";function T({blockletMeta:C={},subTitle:F="",logoUrl:V="",locale:D="",navLogo:B="",loading:O=!1}){const j=useMediaQuery(ot=>ot.breakpoints.down("md")),H=j?18:48,G=reactExports$1.useRef(null),[K,it]=reactExports$1.useState("");return reactExports$1.useEffect(()=>{G.current&&G.current.offsetHeight>34&&(K===""?it("middle"):K==="middle"&&it("small"))},[K]),jsxRuntimeExports.jsxs(R,{className:K==="small"?"center-mode":"",children:[j?jsxRuntimeExports.jsx("div",{className:"app-icon",children:B}):jsxRuntimeExports.jsxs("div",{className:"app-icon",children:[O&&jsxRuntimeExports.jsx(I,{blockletSize:H,isMobile:j}),!O&&jsxRuntimeExports.jsx(u$1,{blockletSize:H,logoUrl:V})]}),jsxRuntimeExports.jsxs("div",{className:"header-title",children:[j&&F&&jsxRuntimeExports.jsx("div",{className:"header-title-sub",children:F}),jsxRuntimeExports.jsxs("div",{className:"app-name-content",children:[!j&&jsxRuntimeExports.jsx("div",{className:"launching-context",children:F||i(D)}),jsxRuntimeExports.jsx("div",{className:`header-title-name ${K==="middle"||K==="small"?"middle-size":""}`,ref:G,children:jsxRuntimeExports.jsx(w$2,{logoUrl:V,isMobile:j,blockletMeta:C,blockletSize:H,loading:O})})]})]})]})}T.propTypes={blockletMeta:o.object,subTitle:o.any,logoUrl:o.string,locale:o.string,navLogo:o.any,loading:o.bool};function I({blockletSize:C,isMobile:F}){return F?jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",width:100,height:16,alt:"icon",style:{marginTop:4}}):jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",width:C,height:C})}function u$1({logoUrl:C,blockletSize:F}){return jsxRuntimeExports.jsx(M$1,{width:F,height:F,src:C,alt:"blocklet icon",fallback:S,style:{verticalAlign:"text-bottom"}},`layout-app-icon-${C}`)}function w$2({isMobile:C,logoUrl:F,blockletMeta:V={},blockletSize:D,loading:B}){const O=g$2(V);return B?jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",width:100,height:16,alt:"icon",style:{marginTop:4}}):k$1(V)?jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",animation:!1,width:100,height:16,alt:"icon",style:{marginTop:4}}):C?jsxRuntimeExports.jsxs(L$1,{children:[jsxRuntimeExports.jsx(u$1,{blockletSize:D,logoUrl:F}),jsxRuntimeExports.jsx("span",{className:"ellipsis-title",children:g$2(V)})]}):jsxRuntimeExports.jsx(E,{className:"app-link",target:"_blank",href:joinUrl(V?.registryUrl||"",`/blocklets/${V?.did}`),title:O,children:O})}const L$1=styled.div`
1
+ import{aF as createSvgIcon,j as jsxRuntimeExports,r as reactExports$1,o,bd as getDefaultExportFromCjs,E as useMediaQuery,s as styled,dm as Skeleton,cQ as M$1,Z as CheckIcon,ay as Tooltip,dG as Button,T as Typography,K as Box,C as CircularProgress,f as useTheme,dA as isObject,e_ as mergeThemeOptions,e$ as StyledEngineProvider,f0 as ThemeProvider,f1 as ThemeProvider$1,f2 as s,Y as o$1,b8 as styled$1,f3 as CloseIcon,cF as Buffer,be as U,bF as __vitePreload,dF as noop,dc as l$2}from"./index-F3HbHSYi.js";import{j as joinUrl}from"./url-join-B07GNSp-.js";const l$1=createSvgIcon(jsxRuntimeExports.jsx("path",{d:"M11.67 3.87 9.9 2.1 0 12l9.9 9.9 1.77-1.77L3.54 12z"})),d$2=createSvgIcon([jsxRuntimeExports.jsx("circle",{cx:"12",cy:"19",r:"2"},"0"),jsxRuntimeExports.jsx("path",{d:"M10 3h4v12h-4z"},"1")]),k$2=reactExports$1.createContext(),{Provider:w$3}=k$2,d$1=(C,F,V=window.location.pathname.replace(/\/$/,"/"))=>C?F?C===V:new RegExp(C).test(V):!1;function P({children:C,steps:F,mode:V="history"}){const[D,B]=reactExports$1.useState("");!D&&F.length&&B(F[0].key);const O=F.map(X=>X.children?[{key:X.key,hasChild:!0},X.children.map(at=>({parentKey:X.key,key:at.key}))]:{key:X.key}).flat(1/0),j=O.filter(X=>!X.hasChild),H=X=>{let at;const rt=O.findIndex(ft=>ft.key===D?(at=ft.parentKey,!0):!1);if(at===X)return"current";const tt=O.findIndex(ft=>ft.key===X);if(tt!==-1){if(tt===rt)return"current";if(tt<rt)return"before"}return"after"};function G(X){B(X)}function K(X){if(typeof X=="function"){const at=X(j.findIndex(rt=>rt.key===D));B(j[at].key)}else B(j[X].key)}const it=j.findIndex(X=>X.key===D);reactExports$1.useEffect(()=>{if(V==="history"){let X="";F.some(at=>at.children&&at.children.length?at.children.some(rt=>d$1(rt.path,rt.exact)?(X=rt.key,!0):!1):d$1(at.path,at.exact)?(X=at.key,!0):!1),X&&B(X)}return()=>{}},[F,V]);const ot={steps:F,totalStepsCount:j.length,getStepStatus:H,setActiveStepByKey:G,setActiveStepByIndex:K,activeStep:it,canBackToStep:X=>V==="memory"&&it!==0&&X<it};return jsxRuntimeExports.jsx(w$3,{value:ot,children:C})}function T$1(){return reactExports$1.use(k$2)}P.propTypes={children:o.any.isRequired,steps:o.array.isRequired,mode:o.string};var lib,hasRequiredLib;function requireLib(){if(hasRequiredLib)return lib;hasRequiredLib=1;var C=Object.prototype.hasOwnProperty,F=Object.prototype.toString;function V(D){if(D==null)return!0;if(typeof D=="boolean")return!1;if(typeof D=="number")return D===0;if(typeof D=="string"||typeof D=="function"||Array.isArray(D))return D.length===0;if(D instanceof Error)return D.message==="";if(D.toString==F)switch(D.toString()){case"[object File]":case"[object Map]":case"[object Set]":return D.size===0;case"[object Object]":{for(var B in D)if(C.call(D,B))return!1;return!0}}return!1}return lib=V,lib}var libExports=requireLib();const k$1=getDefaultExportFromCjs(libExports),S=""+new URL("blocklet-default-logo-Bspnu_ws.png",import.meta.url).href,t$1={en:{optional:"Optional",defaultNavSubTitle:"Launching"},zh:{optional:"可选",defaultNavSubTitle:"启动"}},a$1=C=>t$1[C]?t$1[C]:t$1.en,i=C=>C==="zh"?"启动":"Launching",g$2=C=>C?.title||C?.name||"";function T({blockletMeta:C={},subTitle:F="",logoUrl:V="",locale:D="",navLogo:B="",loading:O=!1}){const j=useMediaQuery(ot=>ot.breakpoints.down("md")),H=j?18:48,G=reactExports$1.useRef(null),[K,it]=reactExports$1.useState("");return reactExports$1.useEffect(()=>{G.current&&G.current.offsetHeight>34&&(K===""?it("middle"):K==="middle"&&it("small"))},[K]),jsxRuntimeExports.jsxs(R,{className:K==="small"?"center-mode":"",children:[j?jsxRuntimeExports.jsx("div",{className:"app-icon",children:B}):jsxRuntimeExports.jsxs("div",{className:"app-icon",children:[O&&jsxRuntimeExports.jsx(I,{blockletSize:H,isMobile:j}),!O&&jsxRuntimeExports.jsx(u$1,{blockletSize:H,logoUrl:V})]}),jsxRuntimeExports.jsxs("div",{className:"header-title",children:[j&&F&&jsxRuntimeExports.jsx("div",{className:"header-title-sub",children:F}),jsxRuntimeExports.jsxs("div",{className:"app-name-content",children:[!j&&jsxRuntimeExports.jsx("div",{className:"launching-context",children:F||i(D)}),jsxRuntimeExports.jsx("div",{className:`header-title-name ${K==="middle"||K==="small"?"middle-size":""}`,ref:G,children:jsxRuntimeExports.jsx(w$2,{logoUrl:V,isMobile:j,blockletMeta:C,blockletSize:H,loading:O})})]})]})]})}T.propTypes={blockletMeta:o.object,subTitle:o.any,logoUrl:o.string,locale:o.string,navLogo:o.any,loading:o.bool};function I({blockletSize:C,isMobile:F}){return F?jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",width:100,height:16,alt:"icon",style:{marginTop:4}}):jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",width:C,height:C})}function u$1({logoUrl:C,blockletSize:F}){return jsxRuntimeExports.jsx(M$1,{width:F,height:F,src:C,alt:"blocklet icon",fallback:S,style:{verticalAlign:"text-bottom"}},`layout-app-icon-${C}`)}function w$2({isMobile:C,logoUrl:F,blockletMeta:V={},blockletSize:D,loading:B}){const O=g$2(V);return B?jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",width:100,height:16,alt:"icon",style:{marginTop:4}}):k$1(V)?jsxRuntimeExports.jsx(Skeleton,{variant:"rectangular",animation:!1,width:100,height:16,alt:"icon",style:{marginTop:4}}):C?jsxRuntimeExports.jsxs(L$1,{children:[jsxRuntimeExports.jsx(u$1,{blockletSize:D,logoUrl:F}),jsxRuntimeExports.jsx("span",{className:"ellipsis-title",children:g$2(V)})]}):jsxRuntimeExports.jsx(E,{className:"app-link",target:"_blank",href:joinUrl(V?.registryUrl||"",`/blocklets/${V?.did}`),title:O,children:O})}const L$1=styled.div`
2
2
  .ellipsis-title {
3
3
  flex: 1;
4
4
  position: absolute;
@@ -1 +1 @@
1
- import{c1 as a,r as f,cr as V,ba as W,bb as X,cS as v,fp as u,cs as m,fq as Z,fr as $,fs as I}from"./index-DuooR0LN.js";var ee=function(t){return t===document||t===document.documentElement||t===document.body?Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop):t.scrollTop},O=function(t){return t.scrollHeight||Math.max(document.documentElement.scrollHeight,document.body.scrollHeight)},re=function(t){return t.clientHeight||Math.max(document.documentElement.clientHeight,document.body.clientHeight)},oe=function(t,o){o===void 0&&(o={});var g=o.target,x=o.isNoMore,F=o.threshold,w=F===void 0?100:F,B=o.direction,P=B===void 0?"bottom":B,R=o.reloadDeps,Y=R===void 0?[]:R,k=o.manual,h=o.onBefore,_=o.onSuccess,M=o.onError,y=o.onFinally,q=a(f.useState(),2),c=q[0],E=q[1],D=a(f.useState(!1),2),b=D[0],i=D[1],S=P==="top",T=f.useRef(void 0),L=f.useRef(0),H=f.useMemo(function(){return x?x(c):!1},[c]),s=V(function(r){return W(void 0,void 0,void 0,function(){var e,n,l,d;return X(this,function(C){switch(C.label){case 0:return[4,t(r)];case 1:return e=C.sent(),E(r?v(v({},e),{list:S?u(u([],a(e.list),!1),a((l=r.list)!==null&&l!==void 0?l:[]),!1):u(u([],a((d=r.list)!==null&&d!==void 0?d:[]),!1),a(e.list),!1)}):v(v({},e),{list:u([],a((n=e.list)!==null&&n!==void 0?n:[]),!1)})),[2,e]}})})},{manual:k,onFinally:function(r,e,n){i(!1),y?.(e,n)},onBefore:function(){return h?.()},onSuccess:function(r){setTimeout(function(){if(S){var e=I(g);if(e=e===document?document.documentElement:e,e){var n=O(e);e.scrollTo(0,n-L.current)}}else z()}),_?.(r)},onError:function(r){return M?.(r)}}),N=s.loading,G=s.error,A=s.run,j=s.runAsync,J=s.cancel,p=m(function(){H||(i(!0),A(c))}),K=m(function(){return H?Promise.reject():(i(!0),j(c))}),Q=function(){return i(!1),A()},U=function(){return i(!1),j()},z=function(){var r=I(g);if(r){var e=r===document?document.documentElement:r,n=ee(e),l=O(e),d=re(e);S?(T.current!==void 0&&T.current>n&&n<=w&&p(),T.current=n,L.current=l-n):l-n<=d+w&&p()}};return Z("scroll",function(){N||b||z()},{target:g}),$(function(){A()},u([],a(Y),!1)),{data:c,loading:!b&&N,error:G,loadingMore:b,noMore:H,loadMore:p,loadMoreAsync:K,reload:m(Q),reloadAsync:m(U),mutate:E,cancel:J}};export{oe as u};
1
+ import{c1 as a,r as f,cr as V,ba as W,bb as X,cS as v,fp as u,cs as m,fq as Z,fr as $,fs as I}from"./index-F3HbHSYi.js";var ee=function(t){return t===document||t===document.documentElement||t===document.body?Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop):t.scrollTop},O=function(t){return t.scrollHeight||Math.max(document.documentElement.scrollHeight,document.body.scrollHeight)},re=function(t){return t.clientHeight||Math.max(document.documentElement.clientHeight,document.body.clientHeight)},oe=function(t,o){o===void 0&&(o={});var g=o.target,x=o.isNoMore,F=o.threshold,w=F===void 0?100:F,B=o.direction,P=B===void 0?"bottom":B,R=o.reloadDeps,Y=R===void 0?[]:R,k=o.manual,h=o.onBefore,_=o.onSuccess,M=o.onError,y=o.onFinally,q=a(f.useState(),2),c=q[0],E=q[1],D=a(f.useState(!1),2),b=D[0],i=D[1],S=P==="top",T=f.useRef(void 0),L=f.useRef(0),H=f.useMemo(function(){return x?x(c):!1},[c]),s=V(function(r){return W(void 0,void 0,void 0,function(){var e,n,l,d;return X(this,function(C){switch(C.label){case 0:return[4,t(r)];case 1:return e=C.sent(),E(r?v(v({},e),{list:S?u(u([],a(e.list),!1),a((l=r.list)!==null&&l!==void 0?l:[]),!1):u(u([],a((d=r.list)!==null&&d!==void 0?d:[]),!1),a(e.list),!1)}):v(v({},e),{list:u([],a((n=e.list)!==null&&n!==void 0?n:[]),!1)})),[2,e]}})})},{manual:k,onFinally:function(r,e,n){i(!1),y?.(e,n)},onBefore:function(){return h?.()},onSuccess:function(r){setTimeout(function(){if(S){var e=I(g);if(e=e===document?document.documentElement:e,e){var n=O(e);e.scrollTo(0,n-L.current)}}else z()}),_?.(r)},onError:function(r){return M?.(r)}}),N=s.loading,G=s.error,A=s.run,j=s.runAsync,J=s.cancel,p=m(function(){H||(i(!0),A(c))}),K=m(function(){return H?Promise.reject():(i(!0),j(c))}),Q=function(){return i(!1),A()},U=function(){return i(!1),j()},z=function(){var r=I(g);if(r){var e=r===document?document.documentElement:r,n=ee(e),l=O(e),d=re(e);S?(T.current!==void 0&&T.current>n&&n<=w&&p(),T.current=n,L.current=l-n):l-n<=d+w&&p()}};return Z("scroll",function(){N||b||z()},{target:g}),$(function(){A()},u([],a(Y),!1)),{data:c,loading:!b&&N,error:G,loadingMore:b,noMore:H,loadMore:p,loadMoreAsync:K,reload:m(Q),reloadAsync:m(U),mutate:E,cancel:J}};export{oe as u};
@@ -1,4 +1,4 @@
1
- import{c as H,u as W,r as i,a as R,b as $,j as e,o as y,d as Q,e as Y,p as F,f as X,W as D,L as J,g as j,h as K,i as z,k,T as h,G as v,l as Z,m as B,s as q,C as ee}from"./index-DuooR0LN.js";import{f as ne}from"./index-BojVbZw0.js";import{v as U}from"./index-Bd9gw7el.js";import{M as V}from"./metric-CRIsGIyz.js";import{C as M}from"./click-to-copy-DKJULX-E.js";var se=H(function(a,d,r){return a+(r?" ":"")+d.toLowerCase()});const L=i.createContext({}),{Provider:ae,Consumer:he}=L;function te({children:a}){const{api:d,info:r}=W(),[u,l]=i.useState(null),[c,t]=i.useState(!1),[s,p]=i.useState([]),_=4,f=async({silent:o=!0,retries:m=_}={})=>{o||t(!0);try{l(null);const{users:x}=await d.getUsers({input:{teamDid:r.did,paging:{pageSize:100}}});t(!1),p(x)}catch(x){m>0?setTimeout(()=>f({silent:o,retries:m-1}),1e3):(t(!1),l(x))}};i.useEffect(()=>{f({silent:!1})},[]),R($.TeamEvents.userAdded,({teamDid:o})=>{o===r.did&&f()}),R($.TeamEvents.userRemoved,({teamDid:o,user:{did:m}})=>{o===r.did&&p(x=>x.filter(N=>N.did!==m))}),R($.TeamEvents.userUpdated,({teamDid:o})=>{o===r.did&&f()});const b={loading:c,error:u,users:s,refresh:f};return e.jsx(ae,{value:{users:b},children:a})}function re(){const{users:a}=i.useContext(L);return a}const g={oneSecond:1,oneMin:1*60,oneHour:1*60*60,oneDay:24*60*60},oe=(a,d)=>{const[r,u]=i.useState(0),l=s=>s>=g.oneDay?g.oneDay:s>=g.oneHour?g.oneHour:s>=g.oneMin?g.oneMin:g.oneSecond,[c,t]=i.useState(l(a/1e3));return i.useEffect(()=>{const s=setInterval(()=>{u(r+c);const p=l(a/1e3+r+c);c!==p&&t(p)},c*1e3);return()=>clearInterval(s)},[c,r]),i.useEffect(()=>{u(0),t(l(a/1e3))},[a]),d(a+r*1e3)};y.number.isRequired,y.func;const ie=async a=>{const d=await a.getNodeEnv();return Object.assign({},d.info||{})};y.number.isRequired;y.string.isRequired,y.string.isRequired,y.string.isRequired;function le(){const{info:a,api:d,loading:r}=W(),{data:u,externalData:l}=Q(),{users:c}=re(),t=Y(()=>ie(d)),{t:s,locale:p}=i.useContext(F),_=X(),f=oe(+new Date-a.startAt,o=>{const m={compact:!0,verbose:!0,locale:B(p)};return Z(o,m)});let b=null;if(r)b=e.jsx(ee,{});else{const o=[{name:s("dashboard.nodeDid"),value:e.jsx(D,{did:a.did,showQrcode:!0})}];a.nodeOwner&&o.push({name:s("dashboard.ownerDid"),value:e.jsx(D,{did:a.nodeOwner.did,showQrcode:!0})});let m=[];a.launcher&&(m=[{name:s("common.did"),value:e.jsx(D,{did:a.launcher.did,showQrcode:!0})},{name:s("common.type"),value:a.launcher.type},{name:s("launcher.provider"),value:a.launcher.provider},{name:s("launcher.adminUrl"),value:e.jsx(J,{target:"_blank",href:a.launcher.url,underline:"hover",children:a.launcher.url})}]);const x=(n,w)=>!n&&!w?"-":n==="-"?n:!w||w==="-"?e.jsxs(h,{className:"ip-item",children:[e.jsx(j,{children:"IPV4"}),e.jsx(M,{children:n})]}):e.jsxs(h,{component:"ul",children:[e.jsxs("li",{className:"ip-item",children:[e.jsx(j,{children:"IPV4"}),e.jsx(M,{children:n})]}),e.jsxs("li",{className:"ip-item",children:[e.jsx(j,{children:"IPV6"}),e.jsx(M,{children:w})]})]}),N=()=>{const n=[{name:`${s("common.internalIp")}`,value:x(t.value.ip.internalV4,t.value.ip.internalV6)},{name:`${s("common.externalIp")}`,value:x(t.value.ip.externalV4,t.value.ip.externalV6)}];return t.value.docker?[]:n},T=t.value?[{name:`${s("common.version")}`,value:a.version},...N(),{name:`${s("common.os")}`,value:t.value.os},t.value.docker?{name:`${s("common.docker")}`,value:e.jsx(j,{type:"success",children:"Yes"})}:null,t.value.gitpod?{name:`${s("common.gitpod")}`,value:e.jsx(j,{type:"success",children:"Yes"})}:null].filter(Boolean):[];Array.isArray(K(t,"value.blockletEngines",null))&&t.value.blockletEngines.filter(n=>n.visible&&n.available).forEach(n=>{T.push({name:n.displayName,value:e.jsx(j,{type:"success",children:`${n.version}`||"N/A"})})});const G=c.length,A=c.filter(n=>n.approved).length;let P=G;A&&(P+=`<small><strong>${se(s("common.approved"))} ${A}</strong></small>`);let S=0,C=0;u&&(S=u.length,C=u.filter(n=>z.isBlockletRunning(n)).length),Array.isArray(l)&&(S+=l.length,C+=l.filter(n=>z.isBlockletRunning(n)).length);let I=S;C&&(I+=`<small>${s("common.running")} ${C}</small>`);const O=[{name:s("common.blocklets"),value:I},{name:s("common.members"),value:P},{name:s("common.uptime"),value:f},{name:s("common.created"),value:ne(new Date(a.createdAt).getTime(),B(p))}];let E=[];t.value&&t.value.disk&&Object.values(t.value.disk).some(n=>n>0)&&(E=[{name:s("common.blockletsStorage"),value:k(t.value.disk.blocklets||0).toUpperCase()},{name:s("common.dataStorage"),value:k(t.value.disk.data||0).toUpperCase()},{name:s("common.logStorage"),value:k(t.value.disk.log||0).toUpperCase()},{name:s("common.cacheStorage"),value:k(t.value.disk.cache||0).toUpperCase()},{name:s("common.coreStorage"),value:k(t.value.disk.app||0).toUpperCase()}]),b=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"section",children:[e.jsx(h,{className:"section__header",component:"h2",variant:"h4",color:"textPrimary",children:s("common.overview")}),e.jsx(v,{className:"page-metrics",container:!0,spacing:{xs:2,sm:3,md:4,lg:5},children:O.map(n=>e.jsx(v,{size:{xl:2,lg:3,md:4,sm:6,xs:6},children:e.jsx(V,{...n})},n.name))})]}),E.length>0&&e.jsxs("div",{className:"section",children:[e.jsx(h,{className:"section__header",component:"h2",variant:"h4",color:"textPrimary",children:s("common.storage")}),e.jsx(v,{className:"page-metrics",container:!0,spacing:{xs:2,sm:3,md:4,lg:5},children:E.map(n=>e.jsx(v,{size:{xl:2,lg:3,md:4,sm:6,xs:6},children:e.jsx(V,{...n})},n.name))})]}),e.jsxs("div",{className:"section",children:[e.jsx(h,{className:"section__header",component:"h2",variant:"h4",color:"textPrimary",children:s("common.meta")}),e.jsxs(v,{className:"page-metrics",container:!0,spacing:{xs:2,sm:3,md:4,lg:5},children:[e.jsxs(v,{size:{lg:6,md:12,sm:12,xs:12},children:[e.jsx(h,{className:"section__header",component:"h3",variant:"h5",color:"textPrimary",children:s("common.dAddress")}),o.map(n=>e.jsx(U,{nameWidth:150,name:n.name,children:n.value},n.name)),m.length>0&&e.jsxs("div",{style:{marginTop:_.spacing(8)},children:[e.jsx(h,{className:"section__header",component:"h3",variant:"h5",color:"textPrimary",children:s("common.launcher")}),m.map(n=>e.jsx(U,{nameWidth:150,name:n.name,children:n.value},n.name))]})]},"address"),e.jsxs(v,{size:{lg:6,md:12,sm:12,xs:12},children:[e.jsx(h,{className:"section__header",component:"h3",variant:"h5",color:"textPrimary",children:s("common.env")}),T.map(n=>e.jsx(U,{valueComponent:"div",nameWidth:150,name:n.name,children:n.value},n.name))]},"environment")]})]})]})}return e.jsx(ce,{children:b})}const ce=q.main`
1
+ import{c as H,u as W,r as i,a as R,b as $,j as e,o as y,d as Q,e as Y,p as F,f as X,W as D,L as J,g as j,h as K,i as z,k,T as h,G as v,l as Z,m as B,s as q,C as ee}from"./index-F3HbHSYi.js";import{f as ne}from"./index-BojVbZw0.js";import{v as U}from"./index-M4yiF52E.js";import{M as V}from"./metric-CNxVptGa.js";import{C as M}from"./click-to-copy-C5l1aVBQ.js";var se=H(function(a,d,r){return a+(r?" ":"")+d.toLowerCase()});const L=i.createContext({}),{Provider:ae,Consumer:he}=L;function te({children:a}){const{api:d,info:r}=W(),[u,l]=i.useState(null),[c,t]=i.useState(!1),[s,p]=i.useState([]),_=4,f=async({silent:o=!0,retries:m=_}={})=>{o||t(!0);try{l(null);const{users:x}=await d.getUsers({input:{teamDid:r.did,paging:{pageSize:100}}});t(!1),p(x)}catch(x){m>0?setTimeout(()=>f({silent:o,retries:m-1}),1e3):(t(!1),l(x))}};i.useEffect(()=>{f({silent:!1})},[]),R($.TeamEvents.userAdded,({teamDid:o})=>{o===r.did&&f()}),R($.TeamEvents.userRemoved,({teamDid:o,user:{did:m}})=>{o===r.did&&p(x=>x.filter(N=>N.did!==m))}),R($.TeamEvents.userUpdated,({teamDid:o})=>{o===r.did&&f()});const b={loading:c,error:u,users:s,refresh:f};return e.jsx(ae,{value:{users:b},children:a})}function re(){const{users:a}=i.useContext(L);return a}const g={oneSecond:1,oneMin:1*60,oneHour:1*60*60,oneDay:24*60*60},oe=(a,d)=>{const[r,u]=i.useState(0),l=s=>s>=g.oneDay?g.oneDay:s>=g.oneHour?g.oneHour:s>=g.oneMin?g.oneMin:g.oneSecond,[c,t]=i.useState(l(a/1e3));return i.useEffect(()=>{const s=setInterval(()=>{u(r+c);const p=l(a/1e3+r+c);c!==p&&t(p)},c*1e3);return()=>clearInterval(s)},[c,r]),i.useEffect(()=>{u(0),t(l(a/1e3))},[a]),d(a+r*1e3)};y.number.isRequired,y.func;const ie=async a=>{const d=await a.getNodeEnv();return Object.assign({},d.info||{})};y.number.isRequired;y.string.isRequired,y.string.isRequired,y.string.isRequired;function le(){const{info:a,api:d,loading:r}=W(),{data:u,externalData:l}=Q(),{users:c}=re(),t=Y(()=>ie(d)),{t:s,locale:p}=i.useContext(F),_=X(),f=oe(+new Date-a.startAt,o=>{const m={compact:!0,verbose:!0,locale:B(p)};return Z(o,m)});let b=null;if(r)b=e.jsx(ee,{});else{const o=[{name:s("dashboard.nodeDid"),value:e.jsx(D,{did:a.did,showQrcode:!0})}];a.nodeOwner&&o.push({name:s("dashboard.ownerDid"),value:e.jsx(D,{did:a.nodeOwner.did,showQrcode:!0})});let m=[];a.launcher&&(m=[{name:s("common.did"),value:e.jsx(D,{did:a.launcher.did,showQrcode:!0})},{name:s("common.type"),value:a.launcher.type},{name:s("launcher.provider"),value:a.launcher.provider},{name:s("launcher.adminUrl"),value:e.jsx(J,{target:"_blank",href:a.launcher.url,underline:"hover",children:a.launcher.url})}]);const x=(n,w)=>!n&&!w?"-":n==="-"?n:!w||w==="-"?e.jsxs(h,{className:"ip-item",children:[e.jsx(j,{children:"IPV4"}),e.jsx(M,{children:n})]}):e.jsxs(h,{component:"ul",children:[e.jsxs("li",{className:"ip-item",children:[e.jsx(j,{children:"IPV4"}),e.jsx(M,{children:n})]}),e.jsxs("li",{className:"ip-item",children:[e.jsx(j,{children:"IPV6"}),e.jsx(M,{children:w})]})]}),N=()=>{const n=[{name:`${s("common.internalIp")}`,value:x(t.value.ip.internalV4,t.value.ip.internalV6)},{name:`${s("common.externalIp")}`,value:x(t.value.ip.externalV4,t.value.ip.externalV6)}];return t.value.docker?[]:n},T=t.value?[{name:`${s("common.version")}`,value:a.version},...N(),{name:`${s("common.os")}`,value:t.value.os},t.value.docker?{name:`${s("common.docker")}`,value:e.jsx(j,{type:"success",children:"Yes"})}:null,t.value.gitpod?{name:`${s("common.gitpod")}`,value:e.jsx(j,{type:"success",children:"Yes"})}:null].filter(Boolean):[];Array.isArray(K(t,"value.blockletEngines",null))&&t.value.blockletEngines.filter(n=>n.visible&&n.available).forEach(n=>{T.push({name:n.displayName,value:e.jsx(j,{type:"success",children:`${n.version}`||"N/A"})})});const G=c.length,A=c.filter(n=>n.approved).length;let P=G;A&&(P+=`<small><strong>${se(s("common.approved"))} ${A}</strong></small>`);let S=0,C=0;u&&(S=u.length,C=u.filter(n=>z.isBlockletRunning(n)).length),Array.isArray(l)&&(S+=l.length,C+=l.filter(n=>z.isBlockletRunning(n)).length);let I=S;C&&(I+=`<small>${s("common.running")} ${C}</small>`);const O=[{name:s("common.blocklets"),value:I},{name:s("common.members"),value:P},{name:s("common.uptime"),value:f},{name:s("common.created"),value:ne(new Date(a.createdAt).getTime(),B(p))}];let E=[];t.value&&t.value.disk&&Object.values(t.value.disk).some(n=>n>0)&&(E=[{name:s("common.blockletsStorage"),value:k(t.value.disk.blocklets||0).toUpperCase()},{name:s("common.dataStorage"),value:k(t.value.disk.data||0).toUpperCase()},{name:s("common.logStorage"),value:k(t.value.disk.log||0).toUpperCase()},{name:s("common.cacheStorage"),value:k(t.value.disk.cache||0).toUpperCase()},{name:s("common.coreStorage"),value:k(t.value.disk.app||0).toUpperCase()}]),b=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"section",children:[e.jsx(h,{className:"section__header",component:"h2",variant:"h4",color:"textPrimary",children:s("common.overview")}),e.jsx(v,{className:"page-metrics",container:!0,spacing:{xs:2,sm:3,md:4,lg:5},children:O.map(n=>e.jsx(v,{size:{xl:2,lg:3,md:4,sm:6,xs:6},children:e.jsx(V,{...n})},n.name))})]}),E.length>0&&e.jsxs("div",{className:"section",children:[e.jsx(h,{className:"section__header",component:"h2",variant:"h4",color:"textPrimary",children:s("common.storage")}),e.jsx(v,{className:"page-metrics",container:!0,spacing:{xs:2,sm:3,md:4,lg:5},children:E.map(n=>e.jsx(v,{size:{xl:2,lg:3,md:4,sm:6,xs:6},children:e.jsx(V,{...n})},n.name))})]}),e.jsxs("div",{className:"section",children:[e.jsx(h,{className:"section__header",component:"h2",variant:"h4",color:"textPrimary",children:s("common.meta")}),e.jsxs(v,{className:"page-metrics",container:!0,spacing:{xs:2,sm:3,md:4,lg:5},children:[e.jsxs(v,{size:{lg:6,md:12,sm:12,xs:12},children:[e.jsx(h,{className:"section__header",component:"h3",variant:"h5",color:"textPrimary",children:s("common.dAddress")}),o.map(n=>e.jsx(U,{nameWidth:150,name:n.name,children:n.value},n.name)),m.length>0&&e.jsxs("div",{style:{marginTop:_.spacing(8)},children:[e.jsx(h,{className:"section__header",component:"h3",variant:"h5",color:"textPrimary",children:s("common.launcher")}),m.map(n=>e.jsx(U,{nameWidth:150,name:n.name,children:n.value},n.name))]})]},"address"),e.jsxs(v,{size:{lg:6,md:12,sm:12,xs:12},children:[e.jsx(h,{className:"section__header",component:"h3",variant:"h5",color:"textPrimary",children:s("common.env")}),T.map(n=>e.jsx(U,{valueComponent:"div",nameWidth:150,name:n.name,children:n.value},n.name))]},"environment")]})]})]})}return e.jsx(ce,{children:b})}const ce=q.main`
2
2
  .page-header {
3
3
  display: flex;
4
4
  justify-content: space-between;
@@ -1,4 +1,4 @@
1
- import{bY as Fe,bX as Ge,r as h,bZ as Ke,j as e,b8 as ee,b$ as $e,cc as J,c0 as Ye,bV as He,ce as qe,aF as he,M as q,bn as A,cr as Ce,H as B,X as V,bf as E,fB as we,aQ as Be,b as N,iY as Ve,V as D,gF as Qe,o as m,x as Xe,aw as De,y as fe,ak as Ze,p as Je,C as L,T as j,k as et,s as tt,f as ot,iZ as X,h$ as Z,i_ as st,K as S,aV as F,aH as T,L as nt,g as H,dj as at,ay as Se,Q as K,aE as $,a8 as Y,a4 as rt,dG as it,gv as ct,a$ as lt,v as pe,w as dt,G as be,Y as Ee,bz as xe,B as pt}from"./index-DuooR0LN.js";import{T as ut}from"./html-title-qBMXCmRQ.js";import{u as U}from"./blocklet-B_F88Tat.js";import{u as mt}from"./use-mobile-CkAg9r-k.js";import{c as Ie,d as ft,e as xt,f as gt,g as ue,h as ht,b as St,u as yt,C as bt,D as kt,a as jt}from"./connect-to-B3WMO9NZ.js";import"./index-ClEU1mAO.js";import"./index-BojVbZw0.js";import"./api-C_G-DBUm.js";import{d as Ct,a as wt,g as Bt,i as Dt,e as ge,f as Et,h as It,j as Tt}from"./spaces-Dg_AAhqT.js";import{v as Rt}from"./index-Bd9gw7el.js";import{E as zt}from"./index--Xk2fT3q.js";import{H as vt}from"./HelpOutline-JDUwTxNr.js";import{H as Pt}from"./index-CpnPkVho.js";import{x as At}from"./index-DRYJ0xIl.js";import{c as Lt}from"./actions-C5JFmT-q.js";import{D as Ut}from"./DeleteOutline-rUX66WwM.js";import{g as ke}from"./get-safe-url-CVsSFVM-.js";import{S as Ot}from"./switch-control-b81fnoth.js";import{L as je}from"./list-header-CdZzFX4v.js";import"./OpenInNew-q2sIX9R4.js";import"./ButtonGroup-CDUEw9SW.js";import"./getValidReactChildren-CpsNar5s.js";import"./FilterList-CjNG8_Me.js";import"./CSSTransition-oc_jqFQN.js";import"./emotion-cache.browser.esm-BNl3Ir2h.js";import"./index-B0LbFKW2.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-DFUdc1h4.js";import"./index-aenta2dO.js";import"./TableSearch-DOm0JN54.js";import"./Search-DEPwrfa9.js";import"./Clear-DX2cXl5s.js";import"./MoreVert-zazLZzFB.js";import"./useLocalStorage-De1OH_yW.js";import"./url-evaluation-B0gvZV9M.js";import"./permission-DIfhBFCW.js";import"./Switch-BzWBU8yM.js";function Mt(t){return Fe("MuiIcon",t)}Ge("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:o,fontSize:n,classes:s}=t,r={root:["root",o!=="inherit"&&`color${J(o)}`,`fontSize${J(n)}`]};return Ye(r,Mt,s)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:n}=t;return[o.root,n.color!=="inherit"&&o[`color${J(n.color)}`],o[`fontSize${J(n.fontSize)}`]]}})(He(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(qe()).map(([o])=>({props:{color:o},style:{color:(t.vars||t).palette[o].main}}))]}))),ye=h.forwardRef(function(o,n){const s=Ke({props:o,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=s,p={...s,baseClassName:r,color:c,component:i,fontSize:d},f=Nt(p);return e.jsx(_t,{as:i,className:$e(r,"notranslate",f.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Ft=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Gt=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Kt({blockletDid:t,nodeApi:o,spaceGateways:n}){let s=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await Ct(a.endpoint);return!q(i)&&i!==c&&(c=i,s=!0),{...a,name:c}}));return s&&await Promise.all(r.filter(a=>a.did).map(a=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function $t({refresh:t}={}){const{blocklet:o}=U(),n=o?.meta?.did,{api:s}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:n}});return await Kt({blockletDid:n,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:o,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=U(),[r,a]=h.useState([]),{api:c}=A(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(o(!0),!s){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:s.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{o(!1)}},1e3);return Be(async()=>{l()},[s?.meta?.did].concat(t)),{backups:r}}function Yt({appDid:t}){const{backups:o}=Te(),[n,s]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&s(()=>({...c}))},[t]),h.useEffect(()=>{if(o?.length&&Ve(o[0]?.status)){const[c]=o;s(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[o]),n}function Ht({deps:t=[],setLoading:o=()=>{}}={}){const{blocklet:n}=U(),[s,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{o(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}});r(Array.isArray(l)?l:[])}catch(i){console.error("Failed to fetch backup summary:",i),B.error(V(i)),r([])}finally{o(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:s}}const Re=h.createContext({}),{Provider:qt,Consumer:Ho}=Re;function ze({children:t}){const{t:o}=D(),{api:n}=A(),{blocklet:s}=U(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=$t({refresh:c}),f=Qe(d),x=Yt({appDid:s?.appDid}),u=h.useMemo(()=>wt(s?.environments),[s?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[oe,se]=h.useState(0),{backupSummary:ne}=Ht({deps:[oe]}),[_,M]=h.useState(d?.find(g=>g.endpoint===u)),I=s?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{se(g=>g+1)},re=()=>{b(g=>g+1)},G=async g=>{await n.updateAutoBackup({input:{did:s.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:s.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:g}}),u!==P&&await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===u&&(await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await G({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:g.did},spaceGateway:g}}),u!==g.endpoint&&n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===u;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:f,spaceGatewayIsSelected:C,updateAutoBackup:G,abortBlockletBackup:Q,backupEndpoint:u,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:m.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:o}=U(),{info:n}=A(),{t:s}=D(),r=Ie({blocklet:o}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Ze())}).get,webWalletUrl:a,extraParams:{appPid:o.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:f,name:x,did:u})=>{const k=await Bt(f);if(!await Dt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===f)){B.error(s("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:u,url:k,endpoint:f},f)},p=async({spaceGateway:f})=>{try{await l(f)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=A(),{blocklet:o}=U(),{data:n,loading:s}=Ce(()=>t.getBlocklet({input:{did:o?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!o?.meta?.did,refreshDeps:[o?.meta?.did]});return{blocklet:n?.blocklet??null,loading:s}}function Pe({...t}){const{t:o}=h.useContext(Je),{blocklet:n,loading:s}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:o("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:o("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(Rt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return s?e.jsx(L,{}):e.jsx(j,{children:o("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:o,backupSummary:n}=O(),s=xt({key:"lg"}),r=h.useRef(null),a=ot(),c=h.useCallback(l=>{o(l)},[o]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),f=new Map(n.map(u=>[u.date,{date:u.date,successCount:u.successCount,errorCount:u.errorCount}])),x=[];for(let u=p.clone();E(u).isBefore(l);u=u.add(1,"day")){const k=u.format("YYYY-MM-DD");x.push(f.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
1
+ import{bY as Fe,bX as Ge,r as h,bZ as Ke,j as e,b8 as ee,b$ as $e,cc as J,c0 as Ye,bV as He,ce as qe,aF as he,M as q,bn as A,cr as Ce,H as B,X as V,bf as E,fB as we,aQ as Be,b as N,iY as Ve,V as D,gF as Qe,o as m,x as Xe,aw as De,y as fe,ak as Ze,p as Je,C as L,T as j,k as et,s as tt,f as ot,iZ as X,h$ as Z,i_ as st,K as S,aV as F,aH as T,L as nt,g as H,dj as at,ay as Se,Q as K,aE as $,a8 as Y,a4 as rt,dG as it,gv as ct,a$ as lt,v as pe,w as dt,G as be,Y as Ee,bz as xe,B as pt}from"./index-F3HbHSYi.js";import{T as ut}from"./html-title-B42L4vHs.js";import{u as U}from"./blocklet-BSWtuwnH.js";import{u as mt}from"./use-mobile-D5fNICVu.js";import{c as Ie,d as ft,e as xt,f as gt,g as ue,h as ht,b as St,u as yt,C as bt,D as kt,a as jt}from"./connect-to-sME9XFIO.js";import"./index-D4PsRecd.js";import"./index-BojVbZw0.js";import"./api-OdGoHXe4.js";import{d as Ct,a as wt,g as Bt,i as Dt,e as ge,f as Et,h as It,j as Tt}from"./spaces-DnqeOj51.js";import{v as Rt}from"./index-M4yiF52E.js";import{E as zt}from"./index-nUrxOkOM.js";import{H as vt}from"./HelpOutline-USuznZgn.js";import{H as Pt}from"./index-CGwvwEUr.js";import{x as At}from"./index-DRYJ0xIl.js";import{c as Lt}from"./actions-Cpb8n0Yw.js";import{D as Ut}from"./DeleteOutline-GpuLmtYQ.js";import{g as ke}from"./get-safe-url-DfDeYxPo.js";import{S as Ot}from"./switch-control-B_J8lGBy.js";import{L as je}from"./list-header-CnD8v8jR.js";import"./OpenInNew-B8ApQgxt.js";import"./ButtonGroup-DcZ0ug1l.js";import"./getValidReactChildren-DECNQV_G.js";import"./FilterList-CNYUVm5S.js";import"./CSSTransition-V4R7ZcvS.js";import"./emotion-cache.browser.esm-CQ2-5c4_.js";import"./index-BIGgo0dk.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-BHCVOuWA.js";import"./index-jC9YQw2A.js";import"./TableSearch-CAf-ESr9.js";import"./Search-DV5vJN1H.js";import"./Clear---RPVeR7.js";import"./MoreVert-wWXtgLji.js";import"./useLocalStorage-xEKVgwM3.js";import"./url-evaluation-Bm9OWnaf.js";import"./permission-caYaN7o4.js";import"./Switch-czLKbhPZ.js";function Mt(t){return Fe("MuiIcon",t)}Ge("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:o,fontSize:n,classes:s}=t,r={root:["root",o!=="inherit"&&`color${J(o)}`,`fontSize${J(n)}`]};return Ye(r,Mt,s)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:n}=t;return[o.root,n.color!=="inherit"&&o[`color${J(n.color)}`],o[`fontSize${J(n.fontSize)}`]]}})(He(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(qe()).map(([o])=>({props:{color:o},style:{color:(t.vars||t).palette[o].main}}))]}))),ye=h.forwardRef(function(o,n){const s=Ke({props:o,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=s,p={...s,baseClassName:r,color:c,component:i,fontSize:d},f=Nt(p);return e.jsx(_t,{as:i,className:$e(r,"notranslate",f.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Ft=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Gt=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Kt({blockletDid:t,nodeApi:o,spaceGateways:n}){let s=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await Ct(a.endpoint);return!q(i)&&i!==c&&(c=i,s=!0),{...a,name:c}}));return s&&await Promise.all(r.filter(a=>a.did).map(a=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function $t({refresh:t}={}){const{blocklet:o}=U(),n=o?.meta?.did,{api:s}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:n}});return await Kt({blockletDid:n,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:o,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=U(),[r,a]=h.useState([]),{api:c}=A(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(o(!0),!s){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:s.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{o(!1)}},1e3);return Be(async()=>{l()},[s?.meta?.did].concat(t)),{backups:r}}function Yt({appDid:t}){const{backups:o}=Te(),[n,s]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&s(()=>({...c}))},[t]),h.useEffect(()=>{if(o?.length&&Ve(o[0]?.status)){const[c]=o;s(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[o]),n}function Ht({deps:t=[],setLoading:o=()=>{}}={}){const{blocklet:n}=U(),[s,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{o(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}});r(Array.isArray(l)?l:[])}catch(i){console.error("Failed to fetch backup summary:",i),B.error(V(i)),r([])}finally{o(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:s}}const Re=h.createContext({}),{Provider:qt,Consumer:Ho}=Re;function ze({children:t}){const{t:o}=D(),{api:n}=A(),{blocklet:s}=U(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=$t({refresh:c}),f=Qe(d),x=Yt({appDid:s?.appDid}),u=h.useMemo(()=>wt(s?.environments),[s?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[oe,se]=h.useState(0),{backupSummary:ne}=Ht({deps:[oe]}),[_,M]=h.useState(d?.find(g=>g.endpoint===u)),I=s?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{se(g=>g+1)},re=()=>{b(g=>g+1)},G=async g=>{await n.updateAutoBackup({input:{did:s.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:s.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:g}}),u!==P&&await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===u&&(await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await G({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:g.did},spaceGateway:g}}),u!==g.endpoint&&n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===u;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:f,spaceGatewayIsSelected:C,updateAutoBackup:G,abortBlockletBackup:Q,backupEndpoint:u,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:m.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:o}=U(),{info:n}=A(),{t:s}=D(),r=Ie({blocklet:o}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Ze())}).get,webWalletUrl:a,extraParams:{appPid:o.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:f,name:x,did:u})=>{const k=await Bt(f);if(!await Dt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===f)){B.error(s("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:u,url:k,endpoint:f},f)},p=async({spaceGateway:f})=>{try{await l(f)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=A(),{blocklet:o}=U(),{data:n,loading:s}=Ce(()=>t.getBlocklet({input:{did:o?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!o?.meta?.did,refreshDeps:[o?.meta?.did]});return{blocklet:n?.blocklet??null,loading:s}}function Pe({...t}){const{t:o}=h.useContext(Je),{blocklet:n,loading:s}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:o("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:o("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(Rt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return s?e.jsx(L,{}):e.jsx(j,{children:o("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:o,backupSummary:n}=O(),s=xt({key:"lg"}),r=h.useRef(null),a=ot(),c=h.useCallback(l=>{o(l)},[o]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),f=new Map(n.map(u=>[u.date,{date:u.date,successCount:u.successCount,errorCount:u.errorCount}])),x=[];for(let u=p.clone();E(u).isBefore(l);u=u.add(1,"day")){const k=u.format("YYYY-MM-DD");x.push(f.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
2
2
  `)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:X[600]},{min:-9,max:-6,color:X[500]},{min:-6,max:-3,color:X[400]},{min:-3,max:-1,color:X[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:Z[300]},{min:3,max:6,color:Z[400]},{min:6,max:9,color:Z[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:Z[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:st[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(S,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(zt,{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(S,{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(S,{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(S,{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(S,{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 Xt=ee(({className:t,...o})=>e.jsx(Se,{...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({status:t,message:o="",createdAt:n}){const{t:s}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(n,"hours")>=T.BACKUPS.TIMEOUT_HOURS,a=r&&s("common.timeoutError"),c=t===T.BACKUPS.STATUS.PROGRESS&&!r,i=t===T.BACKUPS.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(L,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):i?e.jsx(H,{type:"success",children:s("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"error",children:s("common.failed")}),e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:o||a,children:e.jsx(ye,{children:e.jsx(vt,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Le.propTypes={status:m.string.isRequired,message:m.string,createdAt:m.string.isRequired};function Ue({metadata:t={}}){const{t:o}=D();if(q(t))return e.jsx(H,{type:"success",children:o("common.succeeded")});const n=t.count||0,s=t.size||0,r=At(s,{iec:!0}),a=e.jsxs(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[o("common.fileCount"),": ",n]}),e.jsxs(j,{variant:"body2",children:[o("common.fileSize"),": ",r]})]});return e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"success",children:o("common.succeeded")}),e.jsx(Xt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ye,{children:e.jsx(at,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Ue.propTypes={metadata:m.object};function Oe(){const{t,locale:o}=D(),{spaceGateways:n,backups:s,backupsLoading:r}=O(),a=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:p,createdAt:f}=s[i],x=p===T.BACKUPS.STATUS.PROGRESS&&E().diff(f,"hours")>=T.BACKUPS.TIMEOUT_HOURS,u=p===T.BACKUPS.STATUS.SUCCEEDED&&!x,k=l||n.find(w=>d?.includes(ge(w?.endpoint)))?.name||"Unknown DID Space";return u?e.jsx(nt,{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(H,{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=>q(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:p,createdAt:f,metadata:x}=d,u=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(f,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!u,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!u;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(L,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(Ue,{metadata:x}):e.jsx(Le,{status:l,message:p,createdAt:f})}}}],[s,n,t]),c=h.useMemo(()=>!s?.length,[s]);return e.jsx(e.Fragment,{children:c?e.jsx(S,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(Pt,{title:"",loading:r,data:s,columns:a,emptyNode:t("storage.spaces.record.emptyData",o),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Zt(){const{t}=D();return e.jsxs(S,{children:[e.jsxs(S,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(gt,{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(ve,{})]}),e.jsxs(S,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(S,{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(Ae,{})]})]}),e.jsx(Oe,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Me({spaceGateway:t,onConfirm:o=()=>{},onCancel:n=()=>{}}){const{t:s}=D(),[r,a]=h.useState(!1),[c,i]=h.useState(!1),d=(f,x)=>{f?.preventDefault(),f?.stopPropagation(),a(x)},l=async f=>{try{f?.stopPropagation(),i(!0),await o?.(t),a(!1)}catch(x){console.error(x),B.error(`${s("storage.space.gateway.delete.failed")}: ${V(x)}`)}finally{a(!1),i(!1)}},p=f=>{d(f,!1),n?.(f)};return e.jsxs(e.Fragment,{children:[e.jsxs(K,{color:"red",onClick:f=>d(f,!0),children:[e.jsx($,{style:{minWidth:24,color:"red"},children:e.jsx(Ut,{fontSize:"small"})}),e.jsx(Y,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(rt,{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:p,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Me.propTypes={spaceGateway:m.shape({name:m.string.isRequired,url:m.string.isRequired,protected:m.bool}).isRequired,onConfirm:m.func,onCancel:m.func};function Ne({spaceGateway:t,selected:o,onDelete:n=()=>{},onConnect:s=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=O(),[d,l]=h.useState(null),{t:p}=D(),[f,x]=h.useState(!1),u=(y,b)=>{y.stopPropagation(),y.preventDefault(),l(b&&y.currentTarget)},k=async y=>{try{x(!0),u(y,!1),await s(t)}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}},w=async y=>{try{x(!0),u(y,!1),await i()}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[f||t?.loading?e.jsx(L,{sx:{ml:1},size:"24px"}):e.jsx(it,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>u(y,!0),...c,children:e.jsx(ct,{})}),e.jsxs(lt,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>u(y,!1),children:[e.jsxs(K,{onClick:y=>{u(y,!1),window.open(ke(t.endpoint?Et(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Wt,{fontSize:"small"})}),e.jsx(Y,{children:p("common.open")})]}),e.jsxs(K,{onClick:y=>{u(y,!1),window.open(ke(It(t.endpoint),{allowDomains:null}))},children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Gt,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.strategy.viewBackupFiles")})]}),!o&&r&&e.jsxs(K,{onClick:k,children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Ft,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(K,{onClick:w,children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Lt,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Me,{spaceGateway:t,onConfirm:async()=>{l(null),await n?.(t)},onCancel:()=>l(null)})]})]})}Ne.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 Jt=ee(({className:t,...o})=>e.jsx(Se,{...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 _e({spaceGateway:t,spaceStatus:o,selected:n,onConnected:s=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=U(),{api:l,info:{did:p}}=A(),{appDid:f,appName:x,appDescription:u,scopes:k,appUrl:w,referrer:y}=Ie({blocklet:d}),{backupProgress:b,updateSpaceGateway:te,deleteSpaceGateway:oe,refreshBackupSummary:se,refreshBackups:ne}=O(),[_,M]=h.useState(!1),[I,z]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:x},i),scan:c("storage.spaces.authorize.scan",{appName:x},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{z(C=>({...C,open:!1}))}}),ae=n&&!_&&o===ue.DISCONNECTED,re=n&&!_&&!t.loading&&o===ue.CONNECTED,G=n&&_&&o===ue.CONNECTED&&b?.progress>=0,Q=async()=>{try{if(await Tt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s?.(null,t);return}}catch(C){console.error(C),s?.(C,t);return}z(C=>({...C,open:!0,prefix:fe(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:De.create({baseURL:fe(t.url,"space")}).get,extraParams:{appDid:f,appName:x,appDescription:u,scopes:k,appUrl:w,referrer:y,nodeDid:p,spaceDid:t.did}}))},ie=async(C,g)=>{const P=g(C.endpoint),R=ge(P),v=C.space?g(C.space):{};if(t.did&&R!==t.did){z(We=>({...We,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),s?.(new Error(W),t);return}const de={...t,name:v.name??"DID Space",did:v.did??ge(P),endpoint:P};await te(de),z(W=>({...W,open:!1})),s?.(null,de)},ce=async()=>{try{if(_)return;M(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{M(!0)}},le=async()=>{try{await oe(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 h.useEffect(()=>{b?.completed?(n&&(b?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):b.message&&a?.(new Error(b?.message),t),b.progress=0,b.message=""),M(!1),se(),ne()):b.progress&&M(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:c("storage.spaces.strategy.backupNow")}),ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:Q,children:c("storage.spaces.disconnected.reconnectNow")}),G&&e.jsx(Jt,{title:b?.message&&e.jsx(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:b.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(L,{variant:"determinate",value:b?.progress,size:14,sx:{mr:1}}),b?.progress,"%"]})}),e.jsx(dt,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ne,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:le,onConnect:Q,enableSwitchToSpace:b?.completed||q(b?.message),backupInProgress:G})]})}_e.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 eo({...t}){const{t:o}=D();return e.jsxs(S,{...t,children:[e.jsx(S,{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(Ae,{}),e.jsx(Oe,{})]})}function to({...t}){const{t:o}=D(),{autoBackup:n,updateAutoBackup:s}=O(),r=async()=>{try{const a=!n?.enabled;await s({enabled:a}),B.success(o(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Ot,{checked:!!n?.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 oo(){const{t}=D(),{spaceGateways:o,spaceGatewaysLoading:n,spaceGatewayIsSelected:s}=O(),r=n&&!o?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(_e,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:p=>p&&l()});return e.jsxs(S,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(S,{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(to,{}),e.jsx(ve,{})]}),e.jsx(S,{sx:{mt:2},children:r?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(L,{})}):e.jsx(be,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:o.map(c=>e.jsx(be,{size:{xs:12,md:6},children:e.jsx(ht,{endpoint:c.endpoint,selected:s(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(eo,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function so(){const{spaceGatewaysFirstLoading:t,spaceGateways:o}=O();return t?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):q(o)?e.jsx(Zt,{}):e.jsx(oo,{})}function no(){return e.jsx(ze,{children:e.jsx(so,{})})}function ao(){const{spaceGateway:t,settingStorageEndpoint:o,updateSpaceGateway:n,hasStorageEndpoint:s,loading:r,storageEndpoint:a}=yt(),c=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(bt,{spaceGateway:t,settingStorageEndpoint:o}):e.jsx(kt,{}),e.jsx(S,{sx:c,children:e.jsx(jt,{onConnect:n,storageEndpoint:a})})]})}function ro(){const{t}=D();return e.jsxs(St,{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(ao,{})]})}function io({navOrientation:t="vertical",...o}){const{t:n,locale:s}=D(),{blocklet:r}=U(),a=mt({key:"md"}),[c,i]=pt(),d=c.get("tab")||"backup",l=a?"horizontal":t,p=xe(()=>{const w=[{label:n("common.backup"),value:"backup"}],y=r?.capabilities?.didSpace;return(y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:n("common.storage"),value:"storage"}),w},[s,l]),x=xe(()=>({backup:e.jsx(no,{}),storage:e.jsx(ro,{})}))[d],u=w=>{i(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(p.length<=1)return e.jsx(me,{children:x});const k=e.jsx(ut,{tabs:p,current:d,orientation:l,onChange:u,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(S,{...o,children:e.jsxs(F,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(je,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:x})})]})});if(l==="horizontal")return e.jsxs(S,{...o,children:[e.jsx(je,{left:k}),e.jsx(me,{sx:{mt:2},children:x})]})}io.propTypes={navOrientation:m.oneOf(["vertical","horizontal"])};const me=ee(S)`
3
3
  position: relative;
4
4
  min-height: 66vh;