@abtnode/blocklet-services 1.16.46-beta-20250706-075512-de1b046b → 1.16.46-beta-20250708-074453-e1748586

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 (164) hide show
  1. package/api/libs/image.js +10 -2
  2. package/api/routes/user.js +1 -2
  3. package/dist/assets/{AdapterDayjs-XSKQGIOn.js → AdapterDayjs-X0hNNolb.js} +1 -1
  4. package/dist/assets/{Google-DEJzh5qu.js → Google-Bo2ohqwo.js} +3 -3
  5. package/dist/assets/{access-control-BCwE1yaW.js → access-control-90k3s4Tc.js} +1 -1
  6. package/dist/assets/{actions-C2acYZqU.js → actions-DK8uxYzD.js} +1 -1
  7. package/dist/assets/{add-component-core-BFbARhO9.js → add-component-core-fR1K_s-b.js} +1 -1
  8. package/dist/assets/add-resource-C4L5iiYR.js +1 -0
  9. package/dist/assets/{addon-DTMrz0XJ.js → addon-B_9u8Uap.js} +1 -1
  10. package/dist/assets/{advanced-C6q3rX82.js → advanced-B8Og-q_8.js} +1 -1
  11. package/dist/assets/{appearance-Cb9WLLnL.js → appearance-CzutBxVy.js} +1 -1
  12. package/dist/assets/{arrow-down.svg-ChoF_uzO.js → arrow-down.svg-ERMGqkAp.js} +1 -1
  13. package/dist/assets/{audit-logs-tRP7Ir6c.js → audit-logs-CeCLVKmc.js} +1 -1
  14. package/dist/assets/{authorize-CKa1qwqR.js → authorize-DZ53nGXa.js} +1 -1
  15. package/dist/assets/{base-chart-DN6icVvl.js → base-chart-DfvV1Wek.js} +1 -1
  16. package/dist/assets/{base32-BCg8oKIC.js → base32-D5SW9slW.js} +1 -1
  17. package/dist/assets/{branding-Cr2G9cD7.js → branding-DqrEqckw.js} +6 -6
  18. package/dist/assets/branding-k1UuAgbL.js +40 -0
  19. package/dist/assets/{bundle-avatar-Xp52QSf2.js → bundle-avatar-DoaTu2bf.js} +1 -1
  20. package/dist/assets/button-Cq26ea05.js +1 -0
  21. package/dist/assets/{click-to-copy-CT3GMLFE.js → click-to-copy-53HtxuZ-.js} +1 -1
  22. package/dist/assets/{collapse-cchwlIcj.js → collapse-BWjaTK3Y.js} +1 -1
  23. package/dist/assets/{complete-R8Z3eD81.js → complete-CTL412MW.js} +1 -1
  24. package/dist/assets/{component-CMmOvKYP.js → component-Cr9ErCQn.js} +3 -3
  25. package/dist/assets/{config-BV6XReOP.js → config-1BozCK2T.js} +1 -1
  26. package/dist/assets/{config-Drzui8W3.js → config-CNQujUIY.js} +1 -1
  27. package/dist/assets/{config-navigation-lVp-1ugd.js → config-navigation-DS3ENbD4.js} +3 -3
  28. package/dist/assets/{config-space-D9QgW6OB.js → config-space-BJHf-Cd6.js} +1 -1
  29. package/dist/assets/{confirm-CDf7UR9D.js → confirm-Cap-op6n.js} +1 -1
  30. package/dist/assets/{connect-Dy-g9TU9.js → connect--oxHn2U3.js} +1 -1
  31. package/dist/assets/{connect-Bnz0r5Wi.js → connect-Du7jX0Sh.js} +1 -1
  32. package/dist/assets/{connect-to-sTkrNSP4.js → connect-to-DFUayzYa.js} +1 -1
  33. package/dist/assets/{content-layout-C0J5I0TX.js → content-layout-U_bmDcVP.js} +1 -1
  34. package/dist/assets/{createClass-CBJCc0i0.js → createClass-0H_KUZSg.js} +1 -1
  35. package/dist/assets/{dashboard-D2WUGp4d.js → dashboard-D5VBBuOs.js} +3 -3
  36. package/dist/assets/{delete-confirm-Db5_a_ND.js → delete-confirm-C0sSftJX.js} +1 -1
  37. package/dist/assets/{did-address-6ebqvNNq.js → did-address-BbLERCPO.js} +1 -1
  38. package/dist/assets/{domain-action-card-XBKx5ZEq.js → domain-action-card-YTqBPBWZ.js} +2 -2
  39. package/dist/assets/{domain-D3NSNHzA.js → domain-tDz9aJ1p.js} +1 -1
  40. package/dist/assets/domains-B-tnChYf.js +1 -0
  41. package/dist/assets/{dot-DfSvSTo2.js → dot-CSvzbUXF.js} +1 -1
  42. package/dist/assets/{email-D9yKsyjd.js → email-CG37x_qj.js} +1 -1
  43. package/dist/assets/{empty-spinner-DlvM3tDM.js → empty-spinner-Bi1Cb9b7.js} +1 -1
  44. package/dist/assets/engine-BgdxJwhd.js +1 -0
  45. package/dist/assets/{exchange-passport-Bi7Za8uz.js → exchange-passport-DKVItvkK.js} +1 -1
  46. package/dist/assets/{form-Cv425yYf.js → form-CGJGxKNL.js} +1 -1
  47. package/dist/assets/{fuel-B8dyWYCs.js → fuel-DVQ9RgQl.js} +1 -1
  48. package/dist/assets/{gen-access-key-CGYvJ1k7.js → gen-access-key-CVqGSMOn.js} +1 -1
  49. package/dist/assets/get-safe-url-DeteK1Tn.js +1 -0
  50. package/dist/assets/{home-DxujM2Op.js → home-CjcckRlZ.js} +1 -1
  51. package/dist/assets/{iframe-BxB-nDw4.js → iframe-CjdjlDtS.js} +1 -1
  52. package/dist/assets/{index-f_f4wJSK.js → index-1MoOycfF.js} +1 -1
  53. package/dist/assets/{index-C35qnTxV.js → index-B2GXn548.js} +1 -1
  54. package/dist/assets/{index-Iv2oisWn.js → index-BEKYMIn1.js} +1 -1
  55. package/dist/assets/{index-Cm7r5rvw.js → index-BUiXC-M8.js} +6 -6
  56. package/dist/assets/{index-CeqM1ZpW.js → index-Bd8jbR-Z.js} +1 -1
  57. package/dist/assets/{index-CK4-I4Dt.js → index-BnCifgrr.js} +5 -5
  58. package/dist/assets/{index-B0xpDUsO.js → index-BpP1Znfh.js} +6 -6
  59. package/dist/assets/{index-CYFNAQl1.js → index-BqxH9RUX.js} +1 -1
  60. package/dist/assets/{index-DjfjJ3Fo.js → index-BwLbaIOO.js} +1 -1
  61. package/dist/assets/{index-Dy-MET-d.js → index-CF0F1TwU.js} +1 -1
  62. package/dist/assets/{index-DNQJZcPj.js → index-CPh83bMS.js} +2 -2
  63. package/dist/assets/{index-DIBGQQQm.js → index-CXr199vi.js} +4 -4
  64. package/dist/assets/{index-COypY_9V.js → index-CeSZphll.js} +12 -12
  65. package/dist/assets/{index-Bu80qBT0.js → index-D4YNeVBT.js} +12 -12
  66. package/dist/assets/{index-BfwIRDCT.js → index-Dcvh9y_X.js} +1 -1
  67. package/dist/assets/{index-fy1uK_IR.js → index-DmmlDdES.js} +1 -1
  68. package/dist/assets/{index-BpkAJRJ3.js → index-DnIF_NYU.js} +1 -1
  69. package/dist/assets/{index-CMkvpy46.js → index-DyFP7QxB.js} +1 -1
  70. package/dist/assets/{index-DRLhEfAl.js → index-M4aOFxEp.js} +1 -1
  71. package/dist/assets/{index-If1MEgvU.js → index-QJUPJwU5.js} +2 -2
  72. package/dist/assets/{index-PN2leRF6.js → index-SCzvv_RV.js} +3 -3
  73. package/dist/assets/index-WQwUkHG7.js +113 -0
  74. package/dist/assets/{index-BLIgZ0kx.js → index-azWn8MOB.js} +6 -6
  75. package/dist/assets/{index-GF3HOour.js → index-m1CzDMXa.js} +1 -1
  76. package/dist/assets/{index-Cwk7U-s7.js → index-sx11rzaE.js} +1 -1
  77. package/dist/assets/{index-BFT0qxie.js → index-v4-5jfLi.js} +1 -1
  78. package/dist/assets/{index-DuEs5obm.js → index-vQRat2tv.js} +1 -1
  79. package/dist/assets/{index-JZtXFT6r.js → index-wBG-OAs3.js} +1 -1
  80. package/dist/assets/{index-LLcbh8Mm.js → index-wrdyuzbe.js} +1 -1
  81. package/dist/assets/{index-CWV__hd3.js → index-yMf5L8qr.js} +1 -1
  82. package/dist/assets/{invitation-B34gciAx.js → invitation-gz7ZaT6I.js} +1 -1
  83. package/dist/assets/{invite-ByfXPpkh.js → invite-aUuSwMvb.js} +1 -1
  84. package/dist/assets/{issue-passport-CF7kjIha.js → issue-passport-CvpS7DxT.js} +1 -1
  85. package/dist/assets/{item-CT17goAk.js → item-CbTF-0Oa.js} +1 -1
  86. package/dist/assets/{landing-page-8lE7kpfr.js → landing-page-D37ZgHkj.js} +1 -1
  87. package/dist/assets/{launch-result-message-B0akHCFQ.js → launch-result-message-CDvcIXJ3.js} +1 -1
  88. package/dist/assets/{layout-Df4ylgze.js → layout-BEzS8OOg.js} +1 -1
  89. package/dist/assets/list-BJA6szjY.js +2 -0
  90. package/dist/assets/{list-BqjxSFj_.js → list-BqHIXcPP.js} +1 -1
  91. package/dist/assets/{list-header-BbJpGLxs.js → list-header-Bcr2R_3c.js} +1 -1
  92. package/dist/assets/localization-Lor7sJD1.js +1 -0
  93. package/dist/assets/{log-B8snR1zU.js → log-BQUD4DCn.js} +1 -1
  94. package/dist/assets/logger-Bohy94BY.js +1 -0
  95. package/dist/assets/{login-LEjGUnmy.js → login-C2QfPDRA.js} +1 -1
  96. package/dist/assets/{login-oauth-callback-VnZviVo0.js → login-oauth-callback-M7KZI2Od.js} +1 -1
  97. package/dist/assets/{logo-uploader-C_Xk3axk.js → logo-uploader-DN6GOOGh.js} +5 -5
  98. package/dist/assets/{lost-passport-D6MwfL4M.js → lost-passport-CJIQWjW5.js} +1 -1
  99. package/dist/assets/{open-window-BVAimsZ8.js → open-window-DfDYFiaE.js} +1 -1
  100. package/dist/assets/{over-due-invoice-payment-DjR5rU46.js → over-due-invoice-payment-Bd6FvSmz.js} +1 -1
  101. package/dist/assets/{overview-Dr0GLBll.js → overview-DjT71Ru7.js} +1 -1
  102. package/dist/assets/{page-header-Dhv5B-BX.js → page-header-a5Qh5Tr1.js} +1 -1
  103. package/dist/assets/{passport-item-Cvgw81pu.js → passport-item-wFQM_IPn.js} +1 -1
  104. package/dist/assets/{permission-CKmU8Z_5.js → permission-C8zjFCnE.js} +1 -1
  105. package/dist/assets/preferences-BfPbWKcX.js +1 -0
  106. package/dist/assets/profile-embed-C7Eh6vHi.js +1 -0
  107. package/dist/assets/publish-resource-B6a9Z8Sv.js +1 -0
  108. package/dist/assets/{react-beautiful-dnd.esm-C53HbB7P.js → react-beautiful-dnd.esm-Jbqi4QL3.js} +1 -1
  109. package/dist/assets/{react-stripe.esm-DdI1E_2N.js → react-stripe.esm-D_PEjY7V.js} +1 -1
  110. package/dist/assets/{runtime-Bjcp30CT.js → runtime-CPv3tqpJ.js} +1 -1
  111. package/dist/assets/sdk-D8T5YhY1.js +1 -0
  112. package/dist/assets/{section-Be6GDkk8.js → section-76c1fWcb.js} +1 -1
  113. package/dist/assets/{security-DYUzNKac.js → security-zyp6GX8Q.js} +1 -1
  114. package/dist/assets/{session-Bj1hMOts.js → session-Ctfgia_m.js} +1 -1
  115. package/dist/assets/setup-CDOoR5tS.js +30 -0
  116. package/dist/assets/{shorten-label-Ba-bmb_4.js → shorten-label-CqCkrOW-.js} +1 -1
  117. package/dist/assets/{simple-select-CGk0N_bX.js → simple-select-BtDvaDm3.js} +1 -1
  118. package/dist/assets/{spaces-C1fb5NDx.js → spaces-BaVWWOGx.js} +1 -1
  119. package/dist/assets/{start-wlEhUSyq.js → start-ic-fIO06.js} +1 -1
  120. package/dist/assets/{starting-progress-IzrgfSED.js → starting-progress-DIeXw59f.js} +1 -1
  121. package/dist/assets/{status-CwzJOHQ-.js → status-DHHxfaoI.js} +1 -1
  122. package/dist/assets/{step-actions-DZNamIJE.js → step-actions-Br-SRUy8.js} +1 -1
  123. package/dist/assets/{studio-CMWQYNVG.js → studio-BoDvKSdd.js} +1 -1
  124. package/dist/assets/{switch-control-Z293FB2U.js → switch-control-gGb7roLA.js} +1 -1
  125. package/dist/assets/{table-tips-GxhBg0e3.js → table-tips-DCJRX0td.js} +1 -1
  126. package/dist/assets/{traffic-CbhaWm03.js → traffic-D1T3F5UM.js} +1 -1
  127. package/dist/assets/{transfer-B5jo0mhi.js → transfer-DJIdkLYb.js} +1 -1
  128. package/dist/assets/{unsubscribe-CQgLMQmM.js → unsubscribe-CzVwGQa2.js} +1 -1
  129. package/dist/assets/{use-blocklet-logo-BKc9E-_L.js → use-blocklet-logo-CjoRB6rM.js} +1 -1
  130. package/dist/assets/{use-mobile-BmXUeM1i.js → use-mobile-BgklPLaO.js} +1 -1
  131. package/dist/assets/{use-mobile-DspJgIrG.js → use-mobile-BkNZycG6.js} +1 -1
  132. package/dist/assets/{use-server-logo-7qMC4vqP.js → use-server-logo-DZ_rNHFu.js} +1 -1
  133. package/dist/assets/{useLocalStorage-DvM3QMYe.js → useLocalStorage-BrLsVuBH.js} +1 -1
  134. package/dist/assets/user-center-BTomYU5X.js +126 -0
  135. package/dist/assets/{user-center-BAHrlllm.js → user-center-Beq7bNaq.js} +3 -3
  136. package/dist/assets/{user-sessions-DVo9LBeI.js → user-sessions-BxCDj69X.js} +1 -1
  137. package/dist/assets/{util-C6EYY0RW.js → util-Dp7qZZRR.js} +1 -1
  138. package/dist/assets/{util-fjAejugL.js → util-SCxpGcR7.js} +1 -1
  139. package/dist/assets/{vendor-arcblock-D026EX-Z.js → vendor-arcblock-Cvkavi6C.js} +1 -1
  140. package/dist/assets/{vendor-mui-core-BWI0_sKe.js → vendor-mui-core-Bz-X9hX7.js} +1 -1
  141. package/dist/assets/{vendor-mui-x-Bwa_JtSa.js → vendor-mui-x-Cgnunrow.js} +1 -1
  142. package/dist/assets/{vendor-ux-DVPR2iDY.js → vendor-ux-D2yvD18l.js} +90 -86
  143. package/dist/assets/{wrap-locale-CVw8KKu9.js → wrap-locale-DRH6wq1d.js} +1 -1
  144. package/dist/assets/{zh-BAK9QZ79.js → zh-D9byyq6s.js} +1 -1
  145. package/dist/index.html +4 -4
  146. package/dist/service-worker.js +1 -1
  147. package/package.json +32 -32
  148. package/dist/assets/add-resource-DOrkE3yq.js +0 -1
  149. package/dist/assets/branding-BfFZn4oO.js +0 -40
  150. package/dist/assets/button-V9BmeTRn.js +0 -1
  151. package/dist/assets/domains-DDnUseHb.js +0 -1
  152. package/dist/assets/engine-CqzMzhBR.js +0 -1
  153. package/dist/assets/get-safe-url-HSOeeYs_.js +0 -1
  154. package/dist/assets/index-BGsWoTbW.js +0 -113
  155. package/dist/assets/index-qmAWfCpk.js +0 -5
  156. package/dist/assets/list-yWg6vRtr.js +0 -2
  157. package/dist/assets/localization-CJcbV1c6.js +0 -1
  158. package/dist/assets/logger-BwL8cVCo.js +0 -1
  159. package/dist/assets/preferences-CojjhPk8.js +0 -1
  160. package/dist/assets/profile-embed-CzLWocm3.js +0 -1
  161. package/dist/assets/publish-resource-CCEV3Bm_.js +0 -1
  162. package/dist/assets/sdk-BI2up0A5.js +0 -1
  163. package/dist/assets/setup-D_EJHnh2.js +0 -30
  164. package/dist/assets/user-center-C8GAilfL.js +0 -81
@@ -1,4 +1,4 @@
1
- import{$ as o,j as n,ak as f,o as y,bc as I,av as j,J as _,a8 as A}from"./vendor-mui-core-BWI0_sKe.js";import{r as v}from"./vendor-react-x2lQvn4m.js";import{m as k,X as B,T as L,D as W}from"./vendor-ux-DVPR2iDY.js";import{aM as H,aR as V,aS as C,aT as X,aU as Y,k as Z,aV as J,a8 as U,aW as N,aX as G}from"./index-B0xpDUsO.js";import{Z as K,I as P,Y as Q}from"./vendor-utils-Vke2d2wu.js";import{f as ee}from"./vendor-hooks-CFpNP5Ql.js";function z({name:e="",logo:t="",description:i="",...p}){if(!e&&!t&&!i)return null;const c=v.isValidElement(t)?t:n.jsx("img",{src:t,alt:e});return n.jsxs(ne,{...p,children:[n.jsxs("div",{children:[t&&n.jsx(f,{component:"a",href:"/",className:"footer-brand-logo",children:c}),e&&n.jsx("div",{className:"footer-brand-name",children:e})]}),i&&n.jsx("div",{className:"footer-brand-desc",children:i})]})}z.propTypes={name:o.node,logo:o.node,description:o.string};const ne=k("div")`
1
+ import{$ as o,j as n,ak as f,o as y,bc as I,av as j,J as _,a8 as A}from"./vendor-mui-core-Bz-X9hX7.js";import{r as v}from"./vendor-react-x2lQvn4m.js";import{m as k,Z as B,T as L,G as W}from"./vendor-ux-D2yvD18l.js";import{aM as Z,aR as H,aS as C,aT as V,aU as Y,k as G,aV as J,a8 as U,aW as N,aX as X}from"./index-BpP1Znfh.js";import{Z as K,I as P,Y as Q}from"./vendor-utils-Vke2d2wu.js";import{f as ee}from"./vendor-hooks-CFpNP5Ql.js";function z({name:e="",logo:t="",description:i="",...p}){if(!e&&!t&&!i)return null;const c=v.isValidElement(t)?t:n.jsx("img",{src:t,alt:e});return n.jsxs(ne,{...p,children:[n.jsxs("div",{children:[t&&n.jsx(f,{component:"a",href:"/",className:"footer-brand-logo",children:c}),e&&n.jsx("div",{className:"footer-brand-name",children:e})]}),i&&n.jsx("div",{className:"footer-brand-desc",children:i})]})}z.propTypes={name:o.node,logo:o.node,description:o.string};const ne=k("div")`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  font-size: 14px;
@@ -45,7 +45,7 @@ import{$ as o,j as n,ak as f,o as y,bc as I,av as j,J as _,a8 as A}from"./vendor
45
45
  }
46
46
  }
47
47
  }
48
- `;function M({links:e=[],flowLayout:t=!1,columns:i,...p}){const[c,d]=v.useState(-1),x=H({key:"md"}),g=e.some(a=>a.items?.length),b=!x&&g&&K(i)&&i>1,u=({label:a,link:s,icon:l,render:m,props:r})=>{let h=a;if(m)h=m({label:a,link:s,props:r});else if(s&&P(s)){const $=s.startsWith("http")||s.startsWith("//");h=n.jsx("a",{href:s,"aria-label":`Footer link for ${a}`,target:$?"_blank":"_self",rel:$?"noreferrer noopener":void 0,...r,children:a})}return n.jsxs(n.Fragment,{children:[l&&n.jsx(C,{icon:l,size:20,sx:{mr:.5}}),h]})},w=ee(()=>e?.length?t?e.map((a,s)=>n.jsx("span",{className:"footer-links-item",children:u(a)},s)):b?V(e,{columns:i}).map((a,s)=>n.jsx("div",{className:"footer-links-column",children:a.filter(l=>l.group).map((l,m)=>{const{items:r}=l;return n.jsxs("div",{className:"footer-links-group",children:[n.jsx("span",{className:"footer-links-item",children:u(l)}),!!r?.length&&n.jsx("div",{className:"footer-links-sub",children:r.map((h,$)=>n.jsx("span",{className:y("footer-links-item",{"footer-links-item--new":h.isNew}),children:u(h)},$))})]},m)})},s)):e.map((a,s)=>{const{items:l}=a,m=s===c;return n.jsxs("div",{className:y("footer-links-group",{"footer-links-group--active":m}),onClick:()=>d(c===s?-1:s),children:[n.jsxs("span",{className:"footer-links-item",children:[u(a),!!l?.length&&n.jsx("span",{className:"footer-links-group-expand-icon",children:n.jsx(I,{style:{transform:`rotate(${m?180:0}deg)`}})})]}),!!l?.length&&n.jsx("div",{className:"footer-links-sub",children:l.map((r,h)=>n.jsx("span",{className:y("footer-links-item",{"footer-links-item--new":r.isNew}),children:u(r)},h))})]},s)}):null,[e,t,b,c]);return e?.length?n.jsx(oe,{...p,className:y(p.className,{"footer-links--grouped":g,"footer-links--flow":t,"footer-links--columns":b}),children:n.jsx("div",{className:"footer-links-inner",children:w})}):null}M.propTypes={links:o.arrayOf(o.shape({label:o.string,link:o.string,render:o.func,props:o.object})),flowLayout:o.bool,columns:o.number.isRequired};const oe=k("div")`
48
+ `;function M({links:e=[],flowLayout:t=!1,columns:i,...p}){const[c,d]=v.useState(-1),x=Z({key:"md"}),g=e.some(a=>a.items?.length),b=!x&&g&&K(i)&&i>1,u=({label:a,link:s,icon:l,render:m,props:r})=>{let h=a;if(m)h=m({label:a,link:s,props:r});else if(s&&P(s)){const $=s.startsWith("http")||s.startsWith("//");h=n.jsx("a",{href:s,"aria-label":`Footer link for ${a}`,target:$?"_blank":"_self",rel:$?"noreferrer noopener":void 0,...r,children:a})}return n.jsxs(n.Fragment,{children:[l&&n.jsx(C,{icon:l,size:20,sx:{mr:.5}}),h]})},w=ee(()=>e?.length?t?e.map((a,s)=>n.jsx("span",{className:"footer-links-item",children:u(a)},s)):b?H(e,{columns:i}).map((a,s)=>n.jsx("div",{className:"footer-links-column",children:a.filter(l=>l.group).map((l,m)=>{const{items:r}=l;return n.jsxs("div",{className:"footer-links-group",children:[n.jsx("span",{className:"footer-links-item",children:u(l)}),!!r?.length&&n.jsx("div",{className:"footer-links-sub",children:r.map((h,$)=>n.jsx("span",{className:y("footer-links-item",{"footer-links-item--new":h.isNew}),children:u(h)},$))})]},m)})},s)):e.map((a,s)=>{const{items:l}=a,m=s===c;return n.jsxs("div",{className:y("footer-links-group",{"footer-links-group--active":m}),onClick:()=>d(c===s?-1:s),children:[n.jsxs("span",{className:"footer-links-item",children:[u(a),!!l?.length&&n.jsx("span",{className:"footer-links-group-expand-icon",children:n.jsx(I,{style:{transform:`rotate(${m?180:0}deg)`}})})]}),!!l?.length&&n.jsx("div",{className:"footer-links-sub",children:l.map((r,h)=>n.jsx("span",{className:y("footer-links-item",{"footer-links-item--new":r.isNew}),children:u(r)},h))})]},s)}):null,[e,t,b,c]);return e?.length?n.jsx(oe,{...p,className:y(p.className,{"footer-links--grouped":g,"footer-links--flow":t,"footer-links--columns":b}),children:n.jsx("div",{className:"footer-links-inner",children:w})}):null}M.propTypes={links:o.arrayOf(o.shape({label:o.string,link:o.string,render:o.func,props:o.object})),flowLayout:o.bool,columns:o.number.isRequired};const oe=k("div")`
49
49
  overflow: hidden;
50
50
  color: ${({theme:e})=>e.palette.text.secondary};
51
51
  .footer-links-inner {
@@ -236,7 +236,7 @@ import{$ as o,j as n,ak as f,o as y,bc as I,av as j,J as _,a8 as A}from"./vendor
236
236
  margin: 0 auto;
237
237
  }
238
238
  }
239
- `;function D({elements:e,data:t,className:i="",...p}){const c=!!t.navigation?.length;let d=null;return c?d=n.jsxs(j,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},justifyContent:"space-between"},children:[n.jsxs(f,{sx:{flex:"1 1 auto",paddingRight:{xs:0,md:3},display:"flex",flexDirection:"column",alignItems:"flex-start",gap:2,pb:3},children:[n.jsx(f,{children:e.brand}),n.jsx(f,{sx:{lineHeight:1},children:e.socialMedia})]}),n.jsx(f,{sx:({palette:x})=>({mb:3,borderTop:{xs:`1px solid ${x.grey[200]}`,md:0}}),children:e.navigation})]}):d=n.jsxs(j,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},justifyContent:"space-between",alignItems:"space-between",gap:2,pb:3},children:[n.jsx(f,{children:e.brand}),n.jsx(f,{sx:{lineHeight:1},children:e.socialMedia})]}),n.jsx(se,{...p,className:y({"footer--with-navs":c},i),children:n.jsxs(j,{style:{padding:0},children:[d,n.jsx(f,{sx:{pt:3,borderTop:1,borderColor:"divider"}}),n.jsx(j,{children:n.jsxs(T,{autoCenter:!0,children:[e.copyright,e.links]})})]})})}D.propTypes={elements:o.shape({brand:o.element,navigation:o.element,socialMedia:o.element,copyright:o.element,links:o.element}).isRequired,data:o.object.isRequired,className:o.string};const se=k("div")`
239
+ `;function E({elements:e,data:t,className:i="",...p}){const c=!!t.navigation?.length;let d=null;return c?d=n.jsxs(j,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},justifyContent:"space-between"},children:[n.jsxs(f,{sx:{flex:"1 1 auto",paddingRight:{xs:0,md:3},display:"flex",flexDirection:"column",alignItems:"flex-start",gap:2,pb:3},children:[n.jsx(f,{children:e.brand}),n.jsx(f,{sx:{lineHeight:1},children:e.socialMedia})]}),n.jsx(f,{sx:({palette:x})=>({mb:3,borderTop:{xs:`1px solid ${x.grey[200]}`,md:0}}),children:e.navigation})]}):d=n.jsxs(j,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},justifyContent:"space-between",alignItems:"space-between",gap:2,pb:3},children:[n.jsx(f,{children:e.brand}),n.jsx(f,{sx:{lineHeight:1},children:e.socialMedia})]}),n.jsx(se,{...p,className:y({"footer--with-navs":c},i),children:n.jsxs(j,{style:{padding:0},children:[d,n.jsx(f,{sx:{pt:3,borderTop:1,borderColor:"divider"}}),n.jsx(j,{children:n.jsxs(T,{autoCenter:!0,children:[e.copyright,e.links]})})]})})}E.propTypes={elements:o.shape({brand:o.element,navigation:o.element,socialMedia:o.element,copyright:o.element,links:o.element}).isRequired,data:o.object.isRequired,className:o.string};const se=k("div")`
240
240
  padding: 32px 0 24px 0;
241
241
  .footer-brand-name,
242
242
  .footer-brand-desc {
@@ -253,7 +253,7 @@ import{$ as o,j as n,ak as f,o as y,bc as I,av as j,J as _,a8 as A}from"./vendor
253
253
  && .footer-brand-logo {
254
254
  margin-right: 0;
255
255
  }
256
- `;function E({elements:e,data:t,...i}){return n.jsx(le,{...i,children:n.jsx(j,{style:{padding:0},children:n.jsxs(j,{className:"plain-layout-container",children:[e.links&&n.jsxs(T,{sx:{width:1},autoCenter:!0,children:[e.copyright,e.links]}),!e.links&&n.jsxs(n.Fragment,{children:[v.cloneElement(e.brand,{name:null,description:null}),e.copyright]})]})})})}E.propTypes={elements:o.shape({brand:o.element,navigation:o.element,socialMedia:o.element,copyright:o.element,links:o.element}).isRequired,data:o.object.isRequired};const le=k("div")`
256
+ `;function F({elements:e,data:t,...i}){return n.jsx(le,{...i,children:n.jsx(j,{style:{padding:0},children:n.jsxs(j,{className:"plain-layout-container",children:[e.links&&n.jsxs(T,{sx:{width:1},autoCenter:!0,children:[e.copyright,e.links]}),!e.links&&n.jsxs(n.Fragment,{children:[v.cloneElement(e.brand,{name:null,description:null}),e.copyright]})]})})})}F.propTypes={elements:o.shape({brand:o.element,navigation:o.element,socialMedia:o.element,copyright:o.element,links:o.element}).isRequired,data:o.object.isRequired};const le=k("div")`
257
257
  padding: 24px 0;
258
258
  .plain-layout-container {
259
259
  display: flex;
@@ -262,8 +262,8 @@ import{$ as o,j as n,ak as f,o as y,bc as I,av as j,J as _,a8 as A}from"./vendor
262
262
  flex-wrap: wrap;
263
263
  gap: 8px;
264
264
  }
265
- `,F=[{name:"plain",support:(e,t)=>!t.navigation?.length&&!t.socialMedia?.length,component:E},{name:"standard",support:()=>!0,component:D}],ae=F.reduce((e,t)=>({...e,[t.name]:t}),{});function S({...e}){const{brand:t=null,navigation:i=null,socialMedia:p=null,copyright:c=null,links:d=null,layout:x="auto",...g}=e,b=()=>t?n.jsx(z,{...t}):null,u=()=>i?.length?n.jsx(M,{links:i,columns:3}):null,w=()=>p?.length?n.jsx(R,{items:p}):null,a=()=>{const r=c?.owner||t?.name;return r?n.jsx(O,{owner:r,year:c?.year||void 0}):null},s=()=>d?.length?n.jsx(M,{flowLayout:!0,links:d}):null,l={brand:b(),navigation:u(),socialMedia:w(),copyright:a(),links:s()};let m=null;if(x==="auto"?m=F.find(r=>r.support(l,e)).component:m=ae[x]?.component,!m)throw new Error(`layout ${x} is not supported.`);return n.jsxs(f,{...g,className:y("blocklet__footer",g.className),sx:[{position:"relative"},...Array.isArray(g.sx)?g.sx:[g.sx]],children:[n.jsx(m,{elements:l,data:e}),n.jsx(f,{sx:{position:"absolute",right:16,bottom:0,fontSize:12,color:"transparent","::selection":{background:"#000",color:"#fff"}},children:window?.blocklet?.version})]})}S.propTypes={brand:o.shape({name:o.node,description:o.string,logo:o.node}),navigation:o.arrayOf(o.shape({label:o.node,link:o.string})),socialMedia:o.arrayOf(o.shape({icon:o.node,link:o.string})),copyright:o.shape({owner:o.string,year:o.oneOfType([o.string,o.number])}),links:o.arrayOf(o.shape({label:o.node,link:o.string})),layout:o.oneOf(["auto","standard","plain"])};function q({meta:e={},theme:t=null,...i}){const{locale:p}=L()||{},c=_(),d=v.useMemo(()=>{const r=Object.assign({},window.blocklet,e);try{return J(r)}catch(h){return console.error("Failed to format blocklet info",h,r),r}},[e]),x=v.useMemo(()=>A(c,t),[c,t]),g=U({key:"xs",meta:e,theme:t});if(!d.appName)return null;const{appName:b,appDescription:u,description:w,copyright:a}=d,s=x.palette.background.default,l={footerNav:N(d?.navigation?.footer,p)||[],socialMedia:N(d?.navigation?.social,p)||[],links:N(d?.navigation?.bottom,p)||[]},m={brand:{name:b,description:u||w,logo:g},navigation:G(l.footerNav,r=>({...r,label:r.title,link:r.link}),"items"),copyright:a,socialMedia:l.socialMedia,links:l.links.map(r=>({...r,label:r.title}))};return n.jsx(W,{theme:x,children:n.jsx(pe,{...m,...Q(i,["bordered"]),$bordered:i?.bordered,$bgcolor:s})})}q.propTypes={meta:Y,theme:o.object};const pe=k(S)`
265
+ `,D=[{name:"plain",support:(e,t)=>!t.navigation?.length&&!t.socialMedia?.length,component:F},{name:"standard",support:()=>!0,component:E}],ae=D.reduce((e,t)=>({...e,[t.name]:t}),{});function S({...e}){const{brand:t=null,navigation:i=null,socialMedia:p=null,copyright:c=null,links:d=null,layout:x="auto",...g}=e,b=()=>t?n.jsx(z,{...t}):null,u=()=>i?.length?n.jsx(M,{links:i,columns:3}):null,w=()=>p?.length?n.jsx(R,{items:p}):null,a=()=>{const r=c?.owner||t?.name;return r?n.jsx(O,{owner:r,year:c?.year||void 0}):null},s=()=>d?.length?n.jsx(M,{flowLayout:!0,links:d}):null,l={brand:b(),navigation:u(),socialMedia:w(),copyright:a(),links:s()};let m=null;if(x==="auto"?m=D.find(r=>r.support(l,e)).component:m=ae[x]?.component,!m)throw new Error(`layout ${x} is not supported.`);return n.jsxs(f,{...g,className:y("blocklet__footer",g.className),sx:[{position:"relative"},...Array.isArray(g.sx)?g.sx:[g.sx]],children:[n.jsx(m,{elements:l,data:e}),n.jsx(f,{sx:{position:"absolute",right:16,bottom:0,fontSize:12,color:"transparent","::selection":{background:"#000",color:"#fff"}},children:window?.blocklet?.version})]})}S.propTypes={brand:o.shape({name:o.node,description:o.string,logo:o.node}),navigation:o.arrayOf(o.shape({label:o.node,link:o.string})),socialMedia:o.arrayOf(o.shape({icon:o.node,link:o.string})),copyright:o.shape({owner:o.string,year:o.oneOfType([o.string,o.number])}),links:o.arrayOf(o.shape({label:o.node,link:o.string})),layout:o.oneOf(["auto","standard","plain"])};function q({meta:e={},theme:t=null,...i}){const{locale:p}=L()||{},c=_(),d=v.useMemo(()=>{const r=Object.assign({},window.blocklet,e);try{return J(r)}catch(h){return console.error("Failed to format blocklet info",h,r),r}},[e]),x=v.useMemo(()=>A(c,t),[c,t]),g=U({key:"xs",meta:e,theme:t});if(!d.appName)return null;const{appName:b,appDescription:u,description:w,copyright:a}=d,s=x.palette.background.default,l={footerNav:N(d?.navigation?.footer,p)||[],socialMedia:N(d?.navigation?.social,p)||[],links:N(d?.navigation?.bottom,p)||[]},m={brand:{name:b,description:u||w,logo:g},navigation:X(l.footerNav,r=>({...r,label:r.title,link:r.link}),"items"),copyright:a,socialMedia:l.socialMedia,links:l.links.map(r=>({...r,label:r.title}))};return n.jsx(W,{theme:x,children:n.jsx(pe,{...m,...Q(i,["bordered"]),$bordered:i?.bordered,$bgcolor:s})})}q.propTypes={meta:Y,theme:o.object};const pe=k(S)`
266
266
  ${({$bordered:e,theme:t})=>`border-top: 1px solid ${e&&t.palette.divider};`}
267
267
  color: ${({theme:e})=>e.palette.text.secondary};
268
268
  ${({$bgcolor:e})=>e&&`background-color: ${e};`}
269
- `,he=B(X(q),{FallbackComponent:Z});export{he as Z};
269
+ `,he=B(V(q),{FallbackComponent:G});export{he as Z};
@@ -1,4 +1,4 @@
1
- import{j as t,p as f,ak as r,at as j,$ as n}from"./vendor-mui-core-BWI0_sKe.js";import{r as h}from"./vendor-react-x2lQvn4m.js";import{b as S,n as p}from"./vendor-ux-DVPR2iDY.js";import{a as C}from"./page-header-Dhv5B-BX.js";import{Y as g}from"./index-B0xpDUsO.js";import{o as b}from"./vendor-arcblock-D026EX-Z.js";import{u as k}from"./config-space-D9QgW6OB.js";import{C as y,D as v,a as w}from"./connect-to-sTkrNSP4.js";import{S as c}from"./step-actions-DZNamIJE.js";import{S as E}from"./layout-Df4ylgze.js";import"./vendor-utils-Vke2d2wu.js";import"./vendor-hooks-CFpNP5Ql.js";import"./lottie-web-4koyQiv_.js";import"./spaces-C1fb5NDx.js";import"./api-B7LEhzE2.js";import"./index-If1MEgvU.js";import"./index-DRYJ0xIl.js";import"./index-BojVbZw0.js";import"./index-BpkAJRJ3.js";import"./index-DBs9Ljax.js";import"./use-mobile-DspJgIrG.js";import"./content-layout-C0J5I0TX.js";function T({onNext:s=()=>{},onPrevious:d=()=>{}}){const{t:e}=h.useContext(S),{blocklet:o}=g(),{spaceGateway:m,settingStorageEndpoint:l,updateSpaceGateway:u,hasStorageEndpoint:x,loading:i,storageEndpoint:a}=k();return i?t.jsx(b,{relative:"parent",children:t.jsx(f,{})}):t.jsxs(B,{children:[t.jsx("div",{className:"header",children:t.jsx(C,{title:e("setup.didSpace.title"),subTitle:e("setup.didSpace.subTitle"),onClickBack:d})}),t.jsx(r,{sx:{width:"100%",maxWidth:"720px"},children:x?t.jsx(y,{spaceGateway:m,settingStorageEndpoint:l}):t.jsx(v,{})}),o?.capabilities?.didSpace&&t.jsx(r,{sx:{display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"24px"},children:t.jsx(w,{onConnect:u,storageEndpoint:a})}),o?.capabilities?.didSpace==="required"&&t.jsx(c,{mt:8,children:t.jsx(p,{loading:i,variant:"contained",disabled:i||!a,onClick:()=>s(),children:e("setup.continue")})}),o?.capabilities?.didSpace==="optional"&&t.jsx(c,{blocklet:o,onStartNow:()=>s("complete"),children:t.jsx(p,{className:"start-now",loading:i,variant:"contained",disabled:i,onClick:()=>s(),children:e(a?"setup.continue":"setup.skip")})})]})}T.propTypes={onNext:n.func,onPrevious:n.func};const B=j(E)`
1
+ import{j as t,p as f,ak as r,at as j,$ as n}from"./vendor-mui-core-Bz-X9hX7.js";import{r as h}from"./vendor-react-x2lQvn4m.js";import{b as S,n as p}from"./vendor-ux-D2yvD18l.js";import{a as C}from"./page-header-a5Qh5Tr1.js";import{Y as g}from"./index-BpP1Znfh.js";import{o as b}from"./vendor-arcblock-Cvkavi6C.js";import{u as k}from"./config-space-BJHf-Cd6.js";import{C as y,D as v,a as w}from"./connect-to-DFUayzYa.js";import{S as c}from"./step-actions-Br-SRUy8.js";import{S as E}from"./layout-BEzS8OOg.js";import"./vendor-utils-Vke2d2wu.js";import"./vendor-hooks-CFpNP5Ql.js";import"./lottie-web-4koyQiv_.js";import"./spaces-BaVWWOGx.js";import"./api-B7LEhzE2.js";import"./index-QJUPJwU5.js";import"./index-DRYJ0xIl.js";import"./index-BojVbZw0.js";import"./index-DnIF_NYU.js";import"./index-DBs9Ljax.js";import"./use-mobile-BgklPLaO.js";import"./content-layout-U_bmDcVP.js";function T({onNext:s=()=>{},onPrevious:d=()=>{}}){const{t:e}=h.useContext(S),{blocklet:o}=g(),{spaceGateway:m,settingStorageEndpoint:l,updateSpaceGateway:u,hasStorageEndpoint:x,loading:i,storageEndpoint:a}=k();return i?t.jsx(b,{relative:"parent",children:t.jsx(f,{})}):t.jsxs(B,{children:[t.jsx("div",{className:"header",children:t.jsx(C,{title:e("setup.didSpace.title"),subTitle:e("setup.didSpace.subTitle"),onClickBack:d})}),t.jsx(r,{sx:{width:"100%",maxWidth:"720px"},children:x?t.jsx(y,{spaceGateway:m,settingStorageEndpoint:l}):t.jsx(v,{})}),o?.capabilities?.didSpace&&t.jsx(r,{sx:{display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"24px"},children:t.jsx(w,{onConnect:u,storageEndpoint:a})}),o?.capabilities?.didSpace==="required"&&t.jsx(c,{mt:8,children:t.jsx(p,{loading:i,variant:"contained",disabled:i||!a,onClick:()=>s(),children:e("setup.continue")})}),o?.capabilities?.didSpace==="optional"&&t.jsx(c,{blocklet:o,onStartNow:()=>s("complete"),children:t.jsx(p,{className:"start-now",loading:i,variant:"contained",disabled:i,onClick:()=>s(),children:e(a?"setup.continue":"setup.skip")})})]})}T.propTypes={onNext:n.func,onPrevious:n.func};const B=j(E)`
2
2
  height: 100%;
3
3
  overflow-y: auto;
4
4
  `;export{T as default};
@@ -1,4 +1,4 @@
1
- import{r as C,g as _e,a as ut}from"./vendor-react-x2lQvn4m.js";import{g as mt,k as re}from"./vendor-hooks-CFpNP5Ql.js";import{j as e,ak as g,at as W,b1 as ee,p as _,aX as Me,am as K,cy as ft,Y as xt,T as E,a7 as ht,$ as T,G as $,M as ae,I as q,cH as $e,cf as me,H as gt,D as Oe,bZ as qe,b_ as X,bv as We,F as He,bC as yt,b6 as jt,C as vt,O as Ct,V as bt,bu as St,s as Tt}from"./vendor-mui-core-BWI0_sKe.js";import{T as F,a as H,j as wt,C as fe,z as le,H as R,n as L,B as xe,M as Ue,q as Ge,Z as Dt,a8 as Ie,S as It,L as Pt}from"./vendor-ux-DVPR2iDY.js";import{_ as k,p as Rt,ad as Ve,c as U,ax as J,Y as kt,aw as At,f as Ft,M as Nt,af as se,b4 as Lt,b5 as Ye}from"./index-B0xpDUsO.js";import{W as he}from"./did-address-6ebqvNNq.js";import{u as M}from"./dashboard-D2WUGp4d.js";import{r as ge,a as ye,b as je,c as Ke,d as ne,e as Bt,u as zt,f as Et}from"./passport-item-Cvgw81pu.js";import{p as Ze}from"./util-C6EYY0RW.js";import{u as _t}from"./use-mobile-BmXUeM1i.js";import{v as Q}from"./index-BpkAJRJ3.js";import{w as G,P as Je}from"./permission-CKmU8Z_5.js";import{C as Mt}from"./Google-DEJzh5qu.js";import{A as $t}from"./vendor-arcblock-D026EX-Z.js";import{G as Z,a0 as Ot,H as qt}from"./vendor-utils-Vke2d2wu.js";import{e as oe}from"./edit.svg-D-deOViK.js";import{C as ve}from"./confirm-CDf7UR9D.js";import{L as Qe}from"./list-header-BbJpGLxs.js";import{f as te}from"./index-DBs9Ljax.js";import{u as Wt}from"./useSetState-BWrXo9eH.js";import{C as Ht}from"./lock.svg-xPuKHQ-O.js";import"./lottie-web-4koyQiv_.js";import"./useLocalStorage-DvM3QMYe.js";import"./get-safe-url-HSOeeYs_.js";import"./session-Bj1hMOts.js";import"./use-blocklet-logo-BKc9E-_L.js";import"./dot-DfSvSTo2.js";import"./useAsync-fxvoN33w.js";import"./index-Cm7r5rvw.js";import"./over-due-invoice-payment-DjR5rU46.js";import"./use-mobile-DspJgIrG.js";import"./index-JZtXFT6r.js";import"./base32-BCg8oKIC.js";import"./cloneDeep-C4F9EbDd.js";const ie=u=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...u},C.createElement("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})),Pe="info";function Xe({createPassportSvg:u,passport:o,onCancel:i,onSwitchPassport:p=()=>{}}){const{t:m}=F(),l=mt({tab:Pe}),h={info:{label:m("common.basicInfo"),value:Pe,component:()=>e.jsx(et,{passport:o,createPassportSvg:u})},logs:{label:m("common.logs"),value:"logs",component:()=>e.jsx(rt,{passport:o})},related:{label:m("team.passport.related"),value:"related",component:()=>e.jsx(at,{passport:o,onSwitchPassport:p})}},a=Object.values(h).map(({label:r,value:t})=>({label:r,value:t})).filter(r=>r.value==="related"?o.parentDid:!0),f=h[l.tab]||h.info,s=r=>{l.tab=r};return e.jsx(H,{title:m("common.passport"),onClose:i,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ut,{children:[e.jsx(g,{className:"tabs",children:e.jsx(wt,{tabs:a,current:l.tab,onChange:s,scrollButtons:"auto"})}),e.jsx(g,{className:"body",children:e.jsx(f.component,{})})]})})}Xe.propTypes={createPassportSvg:T.func.isRequired,passport:T.object.isRequired,onCancel:T.func.isRequired,onSwitchPassport:T.func};const Ut=W(g)`
1
+ import{r as C,g as _e,a as ut}from"./vendor-react-x2lQvn4m.js";import{g as mt,k as re}from"./vendor-hooks-CFpNP5Ql.js";import{j as e,ak as g,at as W,b1 as ee,p as _,aX as Me,am as K,cy as ft,Y as xt,T as E,a7 as ht,$ as T,G as $,M as ae,I as q,cH as $e,cf as me,H as gt,D as Oe,bZ as qe,b_ as X,bv as We,F as He,bC as yt,b6 as jt,C as vt,O as Ct,V as bt,bu as St,s as Tt}from"./vendor-mui-core-Bz-X9hX7.js";import{T as F,a as H,j as wt,D as fe,A as le,H as R,n as L,C as xe,M as Ue,q as Ge,a0 as Dt,a9 as Ie,S as It,N as Pt}from"./vendor-ux-D2yvD18l.js";import{_ as k,p as Rt,ad as Ve,c as U,ax as J,Y as kt,aw as At,f as Ft,M as Nt,af as se,b4 as Lt,b5 as Ye}from"./index-BpP1Znfh.js";import{W as he}from"./did-address-BbLERCPO.js";import{u as M}from"./dashboard-D5VBBuOs.js";import{r as ge,a as ye,b as je,c as Ke,d as ne,e as Bt,u as zt,f as Et}from"./passport-item-wFQM_IPn.js";import{p as Ze}from"./util-Dp7qZZRR.js";import{u as _t}from"./use-mobile-BkNZycG6.js";import{v as Q}from"./index-DnIF_NYU.js";import{w as G,P as Je}from"./permission-C8zjFCnE.js";import{C as Mt}from"./Google-Bo2ohqwo.js";import{A as $t}from"./vendor-arcblock-Cvkavi6C.js";import{G as Z,a0 as Ot,H as qt}from"./vendor-utils-Vke2d2wu.js";import{e as oe}from"./edit.svg-D-deOViK.js";import{C as ve}from"./confirm-Cap-op6n.js";import{L as Qe}from"./list-header-Bcr2R_3c.js";import{f as te}from"./index-DBs9Ljax.js";import{u as Wt}from"./useSetState-BWrXo9eH.js";import{C as Ht}from"./lock.svg-xPuKHQ-O.js";import"./lottie-web-4koyQiv_.js";import"./useLocalStorage-BrLsVuBH.js";import"./get-safe-url-DeteK1Tn.js";import"./session-Ctfgia_m.js";import"./use-blocklet-logo-CjoRB6rM.js";import"./dot-CSvzbUXF.js";import"./useAsync-fxvoN33w.js";import"./index-BUiXC-M8.js";import"./over-due-invoice-payment-Bd6FvSmz.js";import"./use-mobile-BgklPLaO.js";import"./index-wBG-OAs3.js";import"./base32-D5SW9slW.js";import"./cloneDeep-C4F9EbDd.js";const ie=u=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...u},C.createElement("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})),Pe="info";function Xe({createPassportSvg:u,passport:o,onCancel:i,onSwitchPassport:p=()=>{}}){const{t:m}=F(),l=mt({tab:Pe}),h={info:{label:m("common.basicInfo"),value:Pe,component:()=>e.jsx(et,{passport:o,createPassportSvg:u})},logs:{label:m("common.logs"),value:"logs",component:()=>e.jsx(rt,{passport:o})},related:{label:m("team.passport.related"),value:"related",component:()=>e.jsx(at,{passport:o,onSwitchPassport:p})}},a=Object.values(h).map(({label:r,value:t})=>({label:r,value:t})).filter(r=>r.value==="related"?o.parentDid:!0),f=h[l.tab]||h.info,s=r=>{l.tab=r};return e.jsx(H,{title:m("common.passport"),onClose:i,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ut,{children:[e.jsx(g,{className:"tabs",children:e.jsx(wt,{tabs:a,current:l.tab,onChange:s,scrollButtons:"auto"})}),e.jsx(g,{className:"body",children:e.jsx(f.component,{})})]})})}Xe.propTypes={createPassportSvg:T.func.isRequired,passport:T.object.isRequired,onCancel:T.func.isRequired,onSwitchPassport:T.func};const Ut=W(g)`
2
2
  margin-top: -16px;
3
3
 
4
4
  .tabs {
@@ -1 +1 @@
1
- import{j as t,ak as s,T as n,$ as i}from"./vendor-mui-core-BWI0_sKe.js";import{T as f}from"./vendor-ux-DVPR2iDY.js";import{L as g,r as k}from"./vendor-react-x2lQvn4m.js";import"./index-B0xpDUsO.js";import"./vendor-utils-Vke2d2wu.js";import"./vendor-hooks-CFpNP5Ql.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D026EX-Z.js";const l=(e,o)=>[e,...Array.isArray(o)?o:[o]],a=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function p({sx:e={},...o}){const r=l({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}p.propTypes={sx:i.object};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function b({title:e,desc:o,extra:r,cover:c,icon:d,to:x,sx:h}){const m=l({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,d&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:d})})]}),t.jsx(n,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...a()},children:e}),o&&t.jsx(n,{variant:"body2",sx:{my:1,...a(),color:"text.secondary"},children:o}),r]})})})}b.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const j="/.well-known/service/static/assets/doc-board-bg-DWZHV9Ng.png";function u({board:e,sx:o,...r}){return t.jsx(b,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}u.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function $(){const{locale:e}=f(),o=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/blocklet-developer/${e}/getting-started`},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/createblocklet/${e}/quick-start`},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:`https://www.arcblock.io/docs/launcher/${e}/launcher-welcome`},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:`https://www.arcblock.io/docs/did-spaces/${e}/did-spaces-getting-started`},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:`https://www.arcblock.io/docs/did-wallet/${e}/get-started`},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:`https://www.arcblock.io/docs/did-domain/${e}/did-domain-faq`},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:`https://www.arcblock.io/docs/blockchain/${e}/blockchain-how-to-guides`},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:`https://www.arcblock.io/docs/did-connect/${e}/developer-guides`}];return t.jsx(p,{children:o.map(r=>t.jsx(u,{board:r},r.id))})}export{$ as default};
1
+ import{j as t,ak as s,T as n,$ as i}from"./vendor-mui-core-Bz-X9hX7.js";import{T as f}from"./vendor-ux-D2yvD18l.js";import{L as g,r as k}from"./vendor-react-x2lQvn4m.js";import"./index-BpP1Znfh.js";import"./vendor-utils-Vke2d2wu.js";import"./vendor-hooks-CFpNP5Ql.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-Cvkavi6C.js";const l=(e,o)=>[e,...Array.isArray(o)?o:[o]],a=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function p({sx:e={},...o}){const r=l({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}p.propTypes={sx:i.object};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function b({title:e,desc:o,extra:r,cover:c,icon:d,to:x,sx:h}){const m=l({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,d&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:d})})]}),t.jsx(n,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...a()},children:e}),o&&t.jsx(n,{variant:"body2",sx:{my:1,...a(),color:"text.secondary"},children:o}),r]})})})}b.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const j="/.well-known/service/static/assets/doc-board-bg-DWZHV9Ng.png";function u({board:e,sx:o,...r}){return t.jsx(b,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}u.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function $(){const{locale:e}=f(),o=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/blocklet-developer/${e}/getting-started`},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/createblocklet/${e}/quick-start`},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:`https://www.arcblock.io/docs/launcher/${e}/launcher-welcome`},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:`https://www.arcblock.io/docs/did-spaces/${e}/did-spaces-getting-started`},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:`https://www.arcblock.io/docs/did-wallet/${e}/get-started`},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:`https://www.arcblock.io/docs/did-domain/${e}/did-domain-faq`},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:`https://www.arcblock.io/docs/blockchain/${e}/blockchain-how-to-guides`},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:`https://www.arcblock.io/docs/did-connect/${e}/developer-guides`}];return t.jsx(p,{children:o.map(r=>t.jsx(u,{board:r},r.id))})}export{$ as default};
@@ -1,4 +1,4 @@
1
- import{T as M,H as q,I as N,k as V,B as ve,C as Ce,L as Se}from"./vendor-ux-DVPR2iDY.js";import{q as Te,k as le,s as Ie}from"./vendor-hooks-CFpNP5Ql.js";import{r as E,a as ae}from"./vendor-react-x2lQvn4m.js";import{j as e,a1 as Re,bB as We,a3 as ze,ak as p,G as se,T as C,p as F,aX as te,W as De,V as H,b6 as ne,am as A,bt as _,C as J,Z as Q,X as Z,b4 as Oe,Y as L,I as B,cl as $e,bc as Ae,q as Pe,F as qe,$ as t,b1 as R,a7 as ce,bY as ee,cp as Le,aO as Me,aP as Be,cq as Fe,cr as He,cs as Ne,s as oe,aU as Ue,aj as _e,O as Ye,ct as Ke,aZ as Ve,cg as Je,c9 as Xe,cf as Ge}from"./vendor-mui-core-BWI0_sKe.js";import{g as de,a as pe,l as ue}from"./index-JZtXFT6r.js";import{_ as Y,c as xe,ad as Qe,Y as Ze,aY as X}from"./index-B0xpDUsO.js";import{u as K}from"./dashboard-D2WUGp4d.js";import{u as et}from"./use-mobile-BmXUeM1i.js";import{u as tt,C as G}from"./index.esm-BONQrRCU.js";import{C as he,a as me,J as ot}from"./vendor-utils-Vke2d2wu.js";import{C as st}from"./confirm-CDf7UR9D.js";import{A as nt}from"./actions-C2acYZqU.js";import{T as ie}from"./table-tips-GxhBg0e3.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D026EX-Z.js";import"./useLocalStorage-DvM3QMYe.js";import"./index-DBs9Ljax.js";import"./get-safe-url-HSOeeYs_.js";import"./session-Bj1hMOts.js";import"./use-blocklet-logo-BKc9E-_L.js";import"./dot-DfSvSTo2.js";import"./useAsync-fxvoN33w.js";import"./useSetState-BWrXo9eH.js";import"./index-Cm7r5rvw.js";import"./over-due-invoice-payment-DjR5rU46.js";import"./use-mobile-DspJgIrG.js";const it=i=>{const[u,c]=E.useState(null),[b,r]=E.useState(!0),[w,x]=E.useState(null),j=window.blocklet?.appUrl,l=E.useMemo(()=>{const g={};return u&&(u.sources.forEach(y=>{g[y.did]={source:y,events:[],count:0}}),u.events.forEach(y=>{g[y.source]&&(g[y.source].events.push(y),g[y.source].count+=1)})),g},[u]),f=async()=>{try{if(r(!0),!j)return;const y=await(await fetch(he(j,xe.WELLKNOWN_SERVICE_PATH_PREFIX,"/openevent.json"))).json();c(y),x(null)}catch(g){x(g instanceof Error?g:new Error(String(g)))}finally{r(!1)}};return E.useEffect(()=>{f()},[j]),{openEvent:u,setOpenEvent:c,eventsBySource:l,loading:b,error:w,loadData:f}};function ge({eventsBySource:i,selectedEvents:u,setSelectedEvents:c,error:b=null}){const{t:r}=M(),[w,x]=E.useState({}),j=E.useMemo(()=>{const n={};return Object.entries(i).forEach(([a,{events:m}])=>{const v=m.filter(S=>u[`${S.type}-${S.source}`]).length;n[a]=v}),n},[i,u]),l=E.useMemo(()=>Object.values(j).reduce((n,a)=>n+a,0),[j]),f=E.useMemo(()=>Object.values(i).reduce((n,{events:a})=>n+a.length,0),[i]),g=(n,a)=>{a.stopPropagation(),x({...w,[n]:!w[n]})},y=n=>{const a=`${n.type}-${n.source}`;c(m=>({...m,[a]:!m[a]}))},z=(n,a)=>{const m={};n.forEach(v=>{const S=`${v.type}-${v.source}`;m[S]=!a}),c(v=>({...v,...m}))},T=n=>{const a={};Object.values(i).forEach(({events:m})=>{m.forEach(v=>{const S=`${v.type}-${v.source}`;a[S]=n.target.checked})}),c(a)};return e.jsxs(p,{sx:{width:"100%"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ne,{control:e.jsx(J,{onChange:T,checked:l>0&&l===f}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[r("webhookEndpoint.selectAllEvents"),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(A,{title:r("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(_,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(C,{variant:"body2",color:"primary",sx:{ml:"auto"},children:r("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(p,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(Q,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(i).map(([n,{source:a,events:m,count:v}],S)=>{const D=j[n]>0,I=j[n]===m.length&&m.length>0,O=w[n];return e.jsxs(ae.Fragment,{children:[e.jsx(Z,{sx:{borderBottom:({palette:o})=>S<Object.keys(i).length-1?`1px solid ${o.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(p,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:o=>{o.target.closest(".MuiFormControlLabel-root")||g(n,o)},children:[e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:m.length>0&&e.jsx(ne,{control:e.jsx(J,{checked:I,indeterminate:D&&!I,onChange:o=>{o.stopPropagation(),z(m,I)}}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[a.logo&&e.jsx(Oe,{src:a.logo,sx:{width:24,height:24}}),e.jsx(p,{children:a.title||n}),D&&e.jsx(L,{label:r("webhookEndpoint.selectedCount",{count:j[n]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:o=>`${o.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(p,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(C,{variant:"body2",sx:{color:"text.secondary",mr:1},children:r("webhookEndpoint.eventsCount",{count:v})}),m.length>0&&e.jsx(B,{size:"small",edge:"end",children:O?e.jsx($e,{}):e.jsx(Ae,{})})]})]})}),m.length>0&&e.jsx(Pe,{in:O,timeout:"auto",unmountOnExit:!0,children:e.jsx(Q,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:m.map(o=>{const d=`${o.type}-${o.source}`,s=!!u[d];return e.jsx(Z,{dense:!0,sx:{py:.75},onClick:()=>y(o),children:e.jsxs(p,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(J,{checked:s,sx:{mr:1}}),e.jsxs(p,{children:[e.jsx(C,{variant:"body1",sx:{cursor:"pointer",color:"text.primary"},children:o.type}),e.jsx(C,{variant:"caption",sx:{color:"text.secondary",display:"block",cursor:"pointer"},children:o.description})]})]})},d)})})})]},n)})})}),b&&e.jsx(qe,{error:!0,sx:{mt:1},children:b})]})}ge.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};function fe({id:i=null,url:u="",description:c="",enabledEvents:b=[],onSubmit:r,onClose:w=()=>{}}){const{t:x}=M(),[j,l]=E.useState({}),{teamDid:f}=K(),{api:g}=Y(),{loading:y,error:z,eventsBySource:T}=it(),{control:n,handleSubmit:a,formState:{errors:m},reset:v,setValue:S,trigger:D}=tt({defaultValues:{url:"",description:""}});E.useEffect(()=>{const o=Object.values(j).some(d=>d);S("selectedEvents",o?"valid":""),D("selectedEvents")},[j,S,D]);const I=()=>{l({}),v(),w()},O=async o=>{const d=Object.keys(j).filter(h=>j[h]),s={url:o.url,description:o.description,enabledEvents:d.map(h=>{const[k,W]=h.split("-");return!k||!W?null:{type:k,source:W}}).filter(Boolean)};try{if(i){const h=await g.updateWebhookEndpoint({input:{teamDid:f,id:i,data:s}});q.success(`${x("webhookEndpoint.updateWebhook")} ${x("webhookEndpoint.success")}`),r(h)}else{const h=await g.createWebhookEndpoint({input:{teamDid:f,input:s}});q.success(`${x("webhookEndpoint.createWebhook")} ${x("webhookEndpoint.success")}`),r(h)}}catch(h){q.error(h?.message)}I()};return E.useEffect(()=>{v({url:u,description:c}),l(b.reduce((o,d)=>(o[`${d.type}-${d.source}`]=!0,o),{}))},[v,l,u,c,b]),e.jsx(Re,{open:!0,onClose:I,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:a(O),children:[e.jsx(We,{children:x(i?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(ze,{children:e.jsxs(p,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(G,{name:"url",control:n,rules:{required:x("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:x("webhookEndpoint.validation.urlInvalid")}},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.url.label"),fullWidth:!0,error:!!m.url,helperText:m.url?.message})}),e.jsx(G,{name:"description",control:n,rules:{required:x("webhookEndpoint.validation.descriptionRequired")},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!m.description,helperText:m.description?.message})}),e.jsx(G,{name:"selectedEvents",control:n,rules:{required:x("webhookEndpoint.validation.eventRequired")},render:({field:o})=>e.jsx("input",{type:"hidden",...o})}),!y&&T&&Object.keys(T).length>0&&e.jsx(ge,{eventsBySource:T,selectedEvents:j,setSelectedEvents:l,error:m.selectedEvents?.message}),!y&&(!T||Object.keys(T).length===0)&&e.jsx(C,{sx:{color:"text.secondary"},children:x("webhookEndpoint.noAvailableEvents")}),y&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(F,{size:20})}),z&&e.jsx(te,{severity:"error",children:x("webhookEndpoint.loadingError",{message:z?.message})})]})}),e.jsxs(De,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:I,children:x("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:x(i?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}fe.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};function be(i){switch(i){case"enabled":return"success";case"disabled":default:return"default"}}const rt=(i="en")=>i==="tw"?"zh":i;function U(i,u="YYYY-MM-DD HH:mm:ss",c="en"){return i?Qe(i).locale(rt(c)).format(u):"-"}function lt(i){return typeof i=="number"?!1:me(i)}function at(i){return i>=200&&i<300}function $({value:i,label:u,tip:c="",divider:b=!1}){const r=lt(i);return e.jsxs(e.Fragment,{children:[e.jsxs(R,{direction:"column",alignItems:"flex-start",children:[e.jsxs(C,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[u,!!c&&e.jsx(A,{title:c,children:e.jsx(_,{fontSize:"small"})})]}),e.jsx(C,{component:"div",variant:"body1",color:r?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:r?"-":i})]}),b&&e.jsx(ce,{orientation:"vertical",flexItem:!0})]})}$.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};function je({title:i,children:u=null,mb:c=1.5,mt:b=1.5}){return e.jsxs(R,{className:"section-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,mb:c,mt:b,pb:1},children:[e.jsx(C,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:i}),u]})}je.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};const ct={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},dt=i=>{const u={};return i.forEach(c=>{const b=new Date(c.createdAt).toLocaleDateString();u[b]||(u[b]=[]),u[b]?.push(c)}),u};function ye({eventId:i="",webhookEndpointId:u="",event:c=null}){const{api:b,ws:{useSubscription:r}}=Y(),{t:w}=M(),{teamDid:x}=K(),{blocklet:j}=Ze(),{data:l,loadMore:f,loadingMore:g,loading:y,mutate:z}=Te(s=>{const k=s?Math.ceil(s.list.length/15)+1:1;return b.getWebhookAttempts({input:{teamDid:x,input:{eventId:i,webhookId:u},paging:{page:k,pageSize:15}}})},{reloadDeps:[i,u]}),T=l?.list||[],[n,a]=E.useState(null),[m,v]=E.useState(!1),S=dt(T);if(E.useEffect(()=>{!n&&l?.list.length&&a(l.list[0])},[l?.list.length,n]),r(xe.EVENTS.WEBHOOK_ATTEMPT,s=>{z(h=>{if(h.list.find(W=>W.id===s.id)){const W=h.list.map(P=>P.id===s.id?{...P,...s}:P);return{...h,list:W}}return s.endpoint=h.list[0]?.endpoint,s.event=h.list[0]?.event,{...h,list:[s,...h.list]}})},[]),y)return e.jsx(F,{});const D=l&&l.list.length<l.paging.total,I=async()=>{n&&(v(!0),await b.retryWebhookAttempt({input:{teamDid:x,eventId:n.event.id,webhookId:u,attemptId:n.id}}).finally(()=>{setTimeout(()=>{v(!1)},1e3)}))},O=s=>{if(s.responseBody&&s.responseBody?.sessionId&&s.responseBody?.projectId&&s.responseBody?.agentId){const h=j?.site?.domainAliases[0]?.value,k=(j.children||[]).find(P=>P?.meta?.name==="ai-studio"),W=ot(he(`https://${h}`,k?.mountPoint||"","projects",s.responseBody.projectId,"logs/main"),{sessionId:s.responseBody.sessionId,agentId:s.responseBody.agentId});return e.jsx(B,{sx:{fontSize:20},onClick:()=>window.open(W,"_blank"),children:e.jsx(p,{component:N,icon:X})})}return null},o=s=>s.status==="pending"?e.jsx(Fe,{color:"warning"}):at(s.responseStatus)?e.jsx(He,{color:"success"}):e.jsx(Ne,{color:"error"}),d=n?.triggeredFrom&&(l?.list||[]).find(s=>s.id===n.triggeredFrom);return e.jsxs(pt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ee,{size:{xs:12,md:4},sx:{height:1},children:me(Object.keys(S))?e.jsx(C,{sx:{color:"text.secondary"},children:w("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(Q,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(S).map(([s,h])=>e.jsxs(ae.Fragment,{children:[e.jsx(Le,{sx:{p:0},children:s}),h.map(k=>e.jsxs(Z,{sx:{cursor:"pointer",px:1},onClick:()=>a(k),selected:n&&n?.id===k?.id,secondaryAction:e.jsx(C,{sx:{color:"text.secondary"},children:U(k.createdAt,"HH:mm:ss")}),children:[e.jsx(Me,{sx:{minWidth:0,mr:1.5},children:o(k)}),e.jsx(Be,{primary:e.jsx(C,{sx:{color:"text.primary"},children:k.event.type})})]},k.id))]},s))}),D&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:1},children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:f,disabled:g,sx:{color:s=>s.palette.text.disabled},children:w(g?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(ee,{size:{xs:12,md:8},sx:{height:1},children:[n&&e.jsxs(R,{direction:"column",spacing:2,sx:{height:1,overflow:"auto",pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"h4",children:w(`common.${n.status}`)}),e.jsx(p,{children:O(n)})]}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[d&&e.jsx(A,{placement:"left",title:e.jsxs(R,{onClick:()=>a(d),sx:{gap:1,cursor:"pointer",".did-address-text":{color:"common.white"}},children:[e.jsx(de,{showDid:!0,did:n.triggeredBy,cardType:ue.Detailed,infoType:pe.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(ce,{}),e.jsxs(p,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(C,{variant:"body2",sx:{color:"primary.main"},children:w("webhookEndpoint.triggeredFrom")}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"body2",children:n.id}),e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:X,sx:{fontSize:16,color:"common.white"}})})]})]})]}),slotProps:{tooltip:{sx:{maxWidth:400}}},children:e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:X,sx:{fontSize:16}})})}),e.jsxs(H,{variant:"outlined",color:"primary",size:"small",onClick:I,disabled:m,children:[e.jsx(p,{component:N,icon:ct,sx:{fontSize:16,animation:m?"spin 1s linear infinite":"none",mr:.5}}),w("notification.resend")]})]})]}),e.jsxs(p,{children:[e.jsxs(C,{variant:"h6",children:[w("webhookEndpoint.response")," (",n.responseStatus,")"]}),e.jsx(V,{language:"json",children:JSON.stringify(n.responseBody,null,2)})]}),e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.request")})}),e.jsx(V,{language:"json",sx:{margin:0},children:JSON.stringify(n.event,null,2)})]})]}),l?.list.length===0&&c&&e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.eventData")})}),e.jsx(V,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}ye.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};const pt=oe(ee)`
1
+ import{T as M,H as q,I as N,k as V,C as ve,D as Ce,N as Se}from"./vendor-ux-D2yvD18l.js";import{q as Te,k as le,s as Ie}from"./vendor-hooks-CFpNP5Ql.js";import{r as E,a as ae}from"./vendor-react-x2lQvn4m.js";import{j as e,a1 as Re,bB as We,a3 as ze,ak as p,G as se,T as C,p as F,aX as te,W as De,V as H,b6 as ne,am as A,bt as _,C as J,Z as Q,X as Z,b4 as Oe,Y as L,I as B,cl as $e,bc as Ae,q as Pe,F as qe,$ as t,b1 as R,a7 as ce,bY as ee,cp as Le,aO as Me,aP as Be,cq as Fe,cr as He,cs as Ne,s as oe,aU as Ue,aj as _e,O as Ye,ct as Ke,aZ as Ve,cg as Je,c9 as Xe,cf as Ge}from"./vendor-mui-core-Bz-X9hX7.js";import{g as de,a as pe,l as ue}from"./index-wBG-OAs3.js";import{_ as Y,c as xe,ad as Qe,Y as Ze,aY as X}from"./index-BpP1Znfh.js";import{u as K}from"./dashboard-D5VBBuOs.js";import{u as et}from"./use-mobile-BkNZycG6.js";import{u as tt,C as G}from"./index.esm-BONQrRCU.js";import{C as he,a as me,J as ot}from"./vendor-utils-Vke2d2wu.js";import{C as st}from"./confirm-Cap-op6n.js";import{A as nt}from"./actions-DK8uxYzD.js";import{T as ie}from"./table-tips-DCJRX0td.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-Cvkavi6C.js";import"./useLocalStorage-BrLsVuBH.js";import"./index-DBs9Ljax.js";import"./get-safe-url-DeteK1Tn.js";import"./session-Ctfgia_m.js";import"./use-blocklet-logo-CjoRB6rM.js";import"./dot-CSvzbUXF.js";import"./useAsync-fxvoN33w.js";import"./useSetState-BWrXo9eH.js";import"./index-BUiXC-M8.js";import"./over-due-invoice-payment-Bd6FvSmz.js";import"./use-mobile-BgklPLaO.js";const it=i=>{const[u,c]=E.useState(null),[b,r]=E.useState(!0),[w,x]=E.useState(null),j=window.blocklet?.appUrl,l=E.useMemo(()=>{const g={};return u&&(u.sources.forEach(y=>{g[y.did]={source:y,events:[],count:0}}),u.events.forEach(y=>{g[y.source]&&(g[y.source].events.push(y),g[y.source].count+=1)})),g},[u]),f=async()=>{try{if(r(!0),!j)return;const y=await(await fetch(he(j,xe.WELLKNOWN_SERVICE_PATH_PREFIX,"/openevent.json"))).json();c(y),x(null)}catch(g){x(g instanceof Error?g:new Error(String(g)))}finally{r(!1)}};return E.useEffect(()=>{f()},[j]),{openEvent:u,setOpenEvent:c,eventsBySource:l,loading:b,error:w,loadData:f}};function ge({eventsBySource:i,selectedEvents:u,setSelectedEvents:c,error:b=null}){const{t:r}=M(),[w,x]=E.useState({}),j=E.useMemo(()=>{const n={};return Object.entries(i).forEach(([a,{events:m}])=>{const v=m.filter(S=>u[`${S.type}-${S.source}`]).length;n[a]=v}),n},[i,u]),l=E.useMemo(()=>Object.values(j).reduce((n,a)=>n+a,0),[j]),f=E.useMemo(()=>Object.values(i).reduce((n,{events:a})=>n+a.length,0),[i]),g=(n,a)=>{a.stopPropagation(),x({...w,[n]:!w[n]})},y=n=>{const a=`${n.type}-${n.source}`;c(m=>({...m,[a]:!m[a]}))},z=(n,a)=>{const m={};n.forEach(v=>{const S=`${v.type}-${v.source}`;m[S]=!a}),c(v=>({...v,...m}))},T=n=>{const a={};Object.values(i).forEach(({events:m})=>{m.forEach(v=>{const S=`${v.type}-${v.source}`;a[S]=n.target.checked})}),c(a)};return e.jsxs(p,{sx:{width:"100%"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ne,{control:e.jsx(J,{onChange:T,checked:l>0&&l===f}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[r("webhookEndpoint.selectAllEvents"),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(A,{title:r("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(_,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(C,{variant:"body2",color:"primary",sx:{ml:"auto"},children:r("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(p,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(Q,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(i).map(([n,{source:a,events:m,count:v}],S)=>{const D=j[n]>0,I=j[n]===m.length&&m.length>0,O=w[n];return e.jsxs(ae.Fragment,{children:[e.jsx(Z,{sx:{borderBottom:({palette:o})=>S<Object.keys(i).length-1?`1px solid ${o.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(p,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:o=>{o.target.closest(".MuiFormControlLabel-root")||g(n,o)},children:[e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:m.length>0&&e.jsx(ne,{control:e.jsx(J,{checked:I,indeterminate:D&&!I,onChange:o=>{o.stopPropagation(),z(m,I)}}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[a.logo&&e.jsx(Oe,{src:a.logo,sx:{width:24,height:24}}),e.jsx(p,{children:a.title||n}),D&&e.jsx(L,{label:r("webhookEndpoint.selectedCount",{count:j[n]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:o=>`${o.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(p,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(C,{variant:"body2",sx:{color:"text.secondary",mr:1},children:r("webhookEndpoint.eventsCount",{count:v})}),m.length>0&&e.jsx(B,{size:"small",edge:"end",children:O?e.jsx($e,{}):e.jsx(Ae,{})})]})]})}),m.length>0&&e.jsx(Pe,{in:O,timeout:"auto",unmountOnExit:!0,children:e.jsx(Q,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:m.map(o=>{const d=`${o.type}-${o.source}`,s=!!u[d];return e.jsx(Z,{dense:!0,sx:{py:.75},onClick:()=>y(o),children:e.jsxs(p,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(J,{checked:s,sx:{mr:1}}),e.jsxs(p,{children:[e.jsx(C,{variant:"body1",sx:{cursor:"pointer",color:"text.primary"},children:o.type}),e.jsx(C,{variant:"caption",sx:{color:"text.secondary",display:"block",cursor:"pointer"},children:o.description})]})]})},d)})})})]},n)})})}),b&&e.jsx(qe,{error:!0,sx:{mt:1},children:b})]})}ge.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};function fe({id:i=null,url:u="",description:c="",enabledEvents:b=[],onSubmit:r,onClose:w=()=>{}}){const{t:x}=M(),[j,l]=E.useState({}),{teamDid:f}=K(),{api:g}=Y(),{loading:y,error:z,eventsBySource:T}=it(),{control:n,handleSubmit:a,formState:{errors:m},reset:v,setValue:S,trigger:D}=tt({defaultValues:{url:"",description:""}});E.useEffect(()=>{const o=Object.values(j).some(d=>d);S("selectedEvents",o?"valid":""),D("selectedEvents")},[j,S,D]);const I=()=>{l({}),v(),w()},O=async o=>{const d=Object.keys(j).filter(h=>j[h]),s={url:o.url,description:o.description,enabledEvents:d.map(h=>{const[k,W]=h.split("-");return!k||!W?null:{type:k,source:W}}).filter(Boolean)};try{if(i){const h=await g.updateWebhookEndpoint({input:{teamDid:f,id:i,data:s}});q.success(`${x("webhookEndpoint.updateWebhook")} ${x("webhookEndpoint.success")}`),r(h)}else{const h=await g.createWebhookEndpoint({input:{teamDid:f,input:s}});q.success(`${x("webhookEndpoint.createWebhook")} ${x("webhookEndpoint.success")}`),r(h)}}catch(h){q.error(h?.message)}I()};return E.useEffect(()=>{v({url:u,description:c}),l(b.reduce((o,d)=>(o[`${d.type}-${d.source}`]=!0,o),{}))},[v,l,u,c,b]),e.jsx(Re,{open:!0,onClose:I,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:a(O),children:[e.jsx(We,{children:x(i?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(ze,{children:e.jsxs(p,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(G,{name:"url",control:n,rules:{required:x("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:x("webhookEndpoint.validation.urlInvalid")}},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.url.label"),fullWidth:!0,error:!!m.url,helperText:m.url?.message})}),e.jsx(G,{name:"description",control:n,rules:{required:x("webhookEndpoint.validation.descriptionRequired")},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!m.description,helperText:m.description?.message})}),e.jsx(G,{name:"selectedEvents",control:n,rules:{required:x("webhookEndpoint.validation.eventRequired")},render:({field:o})=>e.jsx("input",{type:"hidden",...o})}),!y&&T&&Object.keys(T).length>0&&e.jsx(ge,{eventsBySource:T,selectedEvents:j,setSelectedEvents:l,error:m.selectedEvents?.message}),!y&&(!T||Object.keys(T).length===0)&&e.jsx(C,{sx:{color:"text.secondary"},children:x("webhookEndpoint.noAvailableEvents")}),y&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(F,{size:20})}),z&&e.jsx(te,{severity:"error",children:x("webhookEndpoint.loadingError",{message:z?.message})})]})}),e.jsxs(De,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:I,children:x("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:x(i?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}fe.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};function be(i){switch(i){case"enabled":return"success";case"disabled":default:return"default"}}const rt=(i="en")=>i==="tw"?"zh":i;function U(i,u="YYYY-MM-DD HH:mm:ss",c="en"){return i?Qe(i).locale(rt(c)).format(u):"-"}function lt(i){return typeof i=="number"?!1:me(i)}function at(i){return i>=200&&i<300}function $({value:i,label:u,tip:c="",divider:b=!1}){const r=lt(i);return e.jsxs(e.Fragment,{children:[e.jsxs(R,{direction:"column",alignItems:"flex-start",children:[e.jsxs(C,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[u,!!c&&e.jsx(A,{title:c,children:e.jsx(_,{fontSize:"small"})})]}),e.jsx(C,{component:"div",variant:"body1",color:r?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:r?"-":i})]}),b&&e.jsx(ce,{orientation:"vertical",flexItem:!0})]})}$.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};function je({title:i,children:u=null,mb:c=1.5,mt:b=1.5}){return e.jsxs(R,{className:"section-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,mb:c,mt:b,pb:1},children:[e.jsx(C,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:i}),u]})}je.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};const ct={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},dt=i=>{const u={};return i.forEach(c=>{const b=new Date(c.createdAt).toLocaleDateString();u[b]||(u[b]=[]),u[b]?.push(c)}),u};function ye({eventId:i="",webhookEndpointId:u="",event:c=null}){const{api:b,ws:{useSubscription:r}}=Y(),{t:w}=M(),{teamDid:x}=K(),{blocklet:j}=Ze(),{data:l,loadMore:f,loadingMore:g,loading:y,mutate:z}=Te(s=>{const k=s?Math.ceil(s.list.length/15)+1:1;return b.getWebhookAttempts({input:{teamDid:x,input:{eventId:i,webhookId:u},paging:{page:k,pageSize:15}}})},{reloadDeps:[i,u]}),T=l?.list||[],[n,a]=E.useState(null),[m,v]=E.useState(!1),S=dt(T);if(E.useEffect(()=>{!n&&l?.list.length&&a(l.list[0])},[l?.list.length,n]),r(xe.EVENTS.WEBHOOK_ATTEMPT,s=>{z(h=>{if(h.list.find(W=>W.id===s.id)){const W=h.list.map(P=>P.id===s.id?{...P,...s}:P);return{...h,list:W}}return s.endpoint=h.list[0]?.endpoint,s.event=h.list[0]?.event,{...h,list:[s,...h.list]}})},[]),y)return e.jsx(F,{});const D=l&&l.list.length<l.paging.total,I=async()=>{n&&(v(!0),await b.retryWebhookAttempt({input:{teamDid:x,eventId:n.event.id,webhookId:u,attemptId:n.id}}).finally(()=>{setTimeout(()=>{v(!1)},1e3)}))},O=s=>{if(s.responseBody&&s.responseBody?.sessionId&&s.responseBody?.projectId&&s.responseBody?.agentId){const h=j?.site?.domainAliases[0]?.value,k=(j.children||[]).find(P=>P?.meta?.name==="ai-studio"),W=ot(he(`https://${h}`,k?.mountPoint||"","projects",s.responseBody.projectId,"logs/main"),{sessionId:s.responseBody.sessionId,agentId:s.responseBody.agentId});return e.jsx(B,{sx:{fontSize:20},onClick:()=>window.open(W,"_blank"),children:e.jsx(p,{component:N,icon:X})})}return null},o=s=>s.status==="pending"?e.jsx(Fe,{color:"warning"}):at(s.responseStatus)?e.jsx(He,{color:"success"}):e.jsx(Ne,{color:"error"}),d=n?.triggeredFrom&&(l?.list||[]).find(s=>s.id===n.triggeredFrom);return e.jsxs(pt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ee,{size:{xs:12,md:4},sx:{height:1},children:me(Object.keys(S))?e.jsx(C,{sx:{color:"text.secondary"},children:w("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(Q,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(S).map(([s,h])=>e.jsxs(ae.Fragment,{children:[e.jsx(Le,{sx:{p:0},children:s}),h.map(k=>e.jsxs(Z,{sx:{cursor:"pointer",px:1},onClick:()=>a(k),selected:n&&n?.id===k?.id,secondaryAction:e.jsx(C,{sx:{color:"text.secondary"},children:U(k.createdAt,"HH:mm:ss")}),children:[e.jsx(Me,{sx:{minWidth:0,mr:1.5},children:o(k)}),e.jsx(Be,{primary:e.jsx(C,{sx:{color:"text.primary"},children:k.event.type})})]},k.id))]},s))}),D&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:1},children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:f,disabled:g,sx:{color:s=>s.palette.text.disabled},children:w(g?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(ee,{size:{xs:12,md:8},sx:{height:1},children:[n&&e.jsxs(R,{direction:"column",spacing:2,sx:{height:1,overflow:"auto",pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"h4",children:w(`common.${n.status}`)}),e.jsx(p,{children:O(n)})]}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[d&&e.jsx(A,{placement:"left",title:e.jsxs(R,{onClick:()=>a(d),sx:{gap:1,cursor:"pointer",".did-address-text":{color:"common.white"}},children:[e.jsx(de,{showDid:!0,did:n.triggeredBy,cardType:ue.Detailed,infoType:pe.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(ce,{}),e.jsxs(p,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(C,{variant:"body2",sx:{color:"primary.main"},children:w("webhookEndpoint.triggeredFrom")}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"body2",children:n.id}),e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:X,sx:{fontSize:16,color:"common.white"}})})]})]})]}),slotProps:{tooltip:{sx:{maxWidth:400}}},children:e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:X,sx:{fontSize:16}})})}),e.jsxs(H,{variant:"outlined",color:"primary",size:"small",onClick:I,disabled:m,children:[e.jsx(p,{component:N,icon:ct,sx:{fontSize:16,animation:m?"spin 1s linear infinite":"none",mr:.5}}),w("notification.resend")]})]})]}),e.jsxs(p,{children:[e.jsxs(C,{variant:"h6",children:[w("webhookEndpoint.response")," (",n.responseStatus,")"]}),e.jsx(V,{language:"json",children:JSON.stringify(n.responseBody,null,2)})]}),e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.request")})}),e.jsx(V,{language:"json",sx:{margin:0},children:JSON.stringify(n.event,null,2)})]})]}),l?.list.length===0&&c&&e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.eventData")})}),e.jsx(V,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}ye.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};const pt=oe(ee)`
2
2
  @keyframes spin {
3
3
  to {
4
4
  transform: rotate(360deg);
@@ -1 +1 @@
1
- import{j as a,T as y,ak as p,J as C,S as j}from"./vendor-mui-core-BWI0_sKe.js";import{r as c}from"./vendor-react-x2lQvn4m.js";import{aG as f,aH as S,aI as b,aJ as T,aK as w,aL as D}from"./index-B0xpDUsO.js";import{o as m,$ as N}from"./vendor-ux-DVPR2iDY.js";var i=(r=>(r.AvatarOnly="AvatarOnly",r.Detailed="Detailed",r))(i||{}),l=(r=>(r.NameOnly="NameOnly",r.Minimal="Minimal",r.Basic="Basic",r))(l||{});function P(r){const{user:e,infoType:o,avatarSize:s=48,shouldShowHoverCard:d=!1,renderCardContent:n,...t}=r;return o===l.NameOnly?a.jsx(f,{user:e,avatarSize:s,shouldShowHoverCard:!1,renderCardContent:n,tooltipTitle:e.fullName||e.email||e.did,...t}):a.jsx(f,{user:e,avatarSize:s,shouldShowHoverCard:d,renderCardContent:n,...t})}function O(r){const{user:e,avatarSize:o=48,onAvatarClick:s}=r;return a.jsxs(a.Fragment,{children:[S(e,o,r.avatarProps,s),a.jsx(y,{variant:"body1",children:e.fullName||e.email||e.did})]})}function R({...r}){const{user:e,avatarSize:o=40,renderCustomContent:s,infoType:d=l.Minimal,renderFields:n,popupRenderFields:t,...u}=r;return a.jsxs(p,{sx:{display:"flex",flexDirection:"column",width:"100%",flex:1,height:"100%"},children:[a.jsx(b,{user:e,avatarSize:o,...u}),d===l.Basic&&a.jsx(T,{user:e,renderFields:n}),a.jsx(p,{className:"user-card__footer",children:s&&a.jsx(p,{sx:{mt:1.5},children:s()})})]})}function h({...r}){const{infoType:e=l.Minimal}=r;switch(e){case l.NameOnly:return a.jsx(O,{...r});default:return a.jsx(R,{...r})}}function g({children:r,sx:e={}}){const o=C();return a.jsx(p,{sx:m({p:2,backgroundColor:o.palette.background.paper,border:"1px solid",borderColor:"divider",borderRadius:1,maxWidth:500,minWidth:320,display:"flex"},e||null),children:r})}function z({children:r,cardType:e=i.Detailed,variant:o="box",containerRef:s=void 0,sx:d={}}){const n={minWidth:320,p:2,borderRadius:1,...e===i.Detailed?{border:"1px solid",borderColor:"divider"}:{}};return o==="paper"?a.jsx(j,{ref:s,elevation:0,sx:n,children:r}):a.jsx(p,{ref:s,sx:m(n,{display:"flex",alignItems:e===i.AvatarOnly?"center":"flex-start",gap:2},d||null),children:r})}function B(r){const{cardType:e=i.Detailed,showHoverCard:o}=r,s=o!==void 0?o:e===i.AvatarOnly,d=c.useRef(null),[n,t]=c.useState(()=>r.user||null);if(c.useEffect(()=>{let x=!0;return r.user?t(r.user):r.did&&w(r.did)&&!r.user&&D(r.did).then(v=>{x&&t(v||{fullName:"Anonymous",did:r.did,avatar:""})}),()=>{x=!1}},[r.did,r.user]),!n)return a.jsx(N,{did:r.did,size:r.avatarSize,...r.avatarProps});const u=()=>a.jsx(g,{sx:r.popupSx,children:a.jsx(h,{...r,shouldShowHoverCard:!1,user:n,avatarProps:r.popupAvatarProps,shortenLabelProps:r.popupShortenLabelProps||r.shortenLabelProps,renderFields:r.popupRenderFields,renderName:r.popupRenderName,infoType:r.popupInfoType||r.infoType,didProps:r.popupDidProps||r.didProps,showDid:r.popupShowDid||r.showDid})});return e===i.AvatarOnly?a.jsx(P,{...r,shouldShowHoverCard:s,renderCardContent:u,user:n}):a.jsx(z,{containerRef:d,cardType:e,sx:r.sx,children:a.jsx(h,{...r,shouldShowHoverCard:s,renderCardContent:u,user:n})})}export{l as a,B as g,i as l};
1
+ import{j as a,T as y,ak as p,J as C,S as j}from"./vendor-mui-core-Bz-X9hX7.js";import{r as c}from"./vendor-react-x2lQvn4m.js";import{aG as f,aH as S,aI as b,aJ as T,aK as w,aL as D}from"./index-BpP1Znfh.js";import{o as m,$ as N}from"./vendor-ux-D2yvD18l.js";var i=(r=>(r.AvatarOnly="AvatarOnly",r.Detailed="Detailed",r))(i||{}),l=(r=>(r.NameOnly="NameOnly",r.Minimal="Minimal",r.Basic="Basic",r))(l||{});function P(r){const{user:e,infoType:o,avatarSize:s=48,shouldShowHoverCard:d=!1,renderCardContent:n,...t}=r;return o===l.NameOnly?a.jsx(f,{user:e,avatarSize:s,shouldShowHoverCard:!1,renderCardContent:n,tooltipTitle:e.fullName||e.email||e.did,...t}):a.jsx(f,{user:e,avatarSize:s,shouldShowHoverCard:d,renderCardContent:n,...t})}function O(r){const{user:e,avatarSize:o=48,onAvatarClick:s}=r;return a.jsxs(a.Fragment,{children:[S(e,o,r.avatarProps,s),a.jsx(y,{variant:"body1",children:e.fullName||e.email||e.did})]})}function R({...r}){const{user:e,avatarSize:o=40,renderCustomContent:s,infoType:d=l.Minimal,renderFields:n,popupRenderFields:t,...u}=r;return a.jsxs(p,{sx:{display:"flex",flexDirection:"column",width:"100%",flex:1,height:"100%"},children:[a.jsx(b,{user:e,avatarSize:o,...u}),d===l.Basic&&a.jsx(T,{user:e,renderFields:n}),a.jsx(p,{className:"user-card__footer",children:s&&a.jsx(p,{sx:{mt:1.5},children:s()})})]})}function h({...r}){const{infoType:e=l.Minimal}=r;switch(e){case l.NameOnly:return a.jsx(O,{...r});default:return a.jsx(R,{...r})}}function g({children:r,sx:e={}}){const o=C();return a.jsx(p,{sx:m({p:2,backgroundColor:o.palette.background.paper,border:"1px solid",borderColor:"divider",borderRadius:1,maxWidth:500,minWidth:320,display:"flex"},e||null),children:r})}function z({children:r,cardType:e=i.Detailed,variant:o="box",containerRef:s=void 0,sx:d={}}){const n={minWidth:320,p:2,borderRadius:1,...e===i.Detailed?{border:"1px solid",borderColor:"divider"}:{}};return o==="paper"?a.jsx(j,{ref:s,elevation:0,sx:n,children:r}):a.jsx(p,{ref:s,sx:m(n,{display:"flex",alignItems:e===i.AvatarOnly?"center":"flex-start",gap:2},d||null),children:r})}function B(r){const{cardType:e=i.Detailed,showHoverCard:o}=r,s=o!==void 0?o:e===i.AvatarOnly,d=c.useRef(null),[n,t]=c.useState(()=>r.user||null);if(c.useEffect(()=>{let x=!0;return r.user?t(r.user):r.did&&w(r.did)&&!r.user&&D(r.did).then(v=>{x&&t(v||{fullName:"Anonymous",did:r.did,avatar:""})}),()=>{x=!1}},[r.did,r.user]),!n)return a.jsx(N,{did:r.did,size:r.avatarSize,...r.avatarProps});const u=()=>a.jsx(g,{sx:r.popupSx,children:a.jsx(h,{...r,shouldShowHoverCard:!1,user:n,avatarProps:r.popupAvatarProps,shortenLabelProps:r.popupShortenLabelProps||r.shortenLabelProps,renderFields:r.popupRenderFields,renderName:r.popupRenderName,infoType:r.popupInfoType||r.infoType,didProps:r.popupDidProps||r.didProps,showDid:r.popupShowDid||r.showDid})});return e===i.AvatarOnly?a.jsx(P,{...r,shouldShowHoverCard:s,renderCardContent:u,user:n}):a.jsx(z,{containerRef:d,cardType:e,sx:r.sx,children:a.jsx(h,{...r,shouldShowHoverCard:s,renderCardContent:u,user:n})})}export{l as a,B as g,i as l};
@@ -1,4 +1,4 @@
1
- import{j as e,$ as u,p as O,T as j,at as Ne,J as _e,cI as V,ao as X,cJ as We,ak as S,b1 as K,a$ as Ke,s as xe,cK as be,cy as Ge,am as ge,cu as Fe,M as F,aO as Y,bR as Ye,aP as $,V as $e,bl as qe,aR as He,cL as Qe,cM as Je,cN as Ve,cO as Xe,bY as he}from"./vendor-mui-core-BWI0_sKe.js";import{k as Ze,j as ke,f as ue}from"./vendor-hooks-CFpNP5Ql.js";import{r as h,u as et}from"./vendor-react-x2lQvn4m.js";import{Y as z,_ as N,ad as D,M,aC as tt,aD as st,au as nt,c as I,$ as ot}from"./index-B0xpDUsO.js";import{H as B,T as E,b as at,Z as q,C as rt,G as it,n as le,j as ct}from"./vendor-ux-DVPR2iDY.js";import{u as lt}from"./use-mobile-BmXUeM1i.js";import{a as H,d as je,a1 as dt,e as pt,D as Ce,C as me}from"./vendor-utils-Vke2d2wu.js";import{o as we}from"./vendor-arcblock-D026EX-Z.js";import{b as ut,u as mt,D as ft,c as de,a as xt}from"./index-If1MEgvU.js";import"./index-BpkAJRJ3.js";import"./index-BojVbZw0.js";import"./api-B7LEhzE2.js";import{u as Be,C as gt,D as ht,a as St}from"./connect-to-sTkrNSP4.js";import{b as yt,c as bt,d as kt,i as jt,e as fe,f as Ct,h as wt,j as Bt}from"./spaces-C1fb5NDx.js";import{f as Q}from"./index-DBs9Ljax.js";import{v as Dt}from"./index-Dy-MET-d.js";import{E as Et}from"./index-DbIUA2zH.js";import{x as Tt}from"./index-DRYJ0xIl.js";import{g as Se}from"./get-safe-url-HSOeeYs_.js";import{S as It}from"./switch-control-Z293FB2U.js";import{C as Rt,u as Pt}from"./config-space-D9QgW6OB.js";import{L as ye}from"./list-header-BbJpGLxs.js";import"./lottie-web-4koyQiv_.js";import"./index-DjfjJ3Fo.js";async function At({blockletDid:t,nodeApi:o,spaceGateways:a}){let s=!1;const i=await Promise.all(a.map(async n=>{let{name:r}=n;const l=await yt(n.endpoint);return!H(l)&&l!==r&&(r=l,s=!0),{...n,name:r}}));return s&&await Promise.all(i.filter(n=>n.did).map(n=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:n.did},spaceGateway:{...n}}}))),i}function vt({refresh:t}={}){const{blocklet:o}=z(),a=o?.meta?.did,{api:s}=N();return Ze(async()=>{if(!a)return[];const{spaceGateways:i}=await s.getBlockletSpaceGateways({input:{did:a}});return await At({blockletDid:a,nodeApi:s,spaceGateways:i})??[]},{refreshDeps:[a,t],onError(i){i?.message?.includes("not logged")?console.warn(i):(console.error(i),B.error(Q(i)))}})}function De({deps:t,setLoading:o,backupDate:a}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=z(),[i,n]=h.useState([]),{api:r}=N(),[l,d]=h.useMemo(()=>a?[D(a).startOf("day").toISOString(),D(a).endOf("day").toISOString()]:[D().startOf("year").toISOString(),D().endOf("day").toISOString()],[a]),c=je(async()=>{try{if(o(!0),!s){n([]);return}const{backups:m}=await r.getBlockletBackups({input:{did:s.meta.did,startTime:l,endTime:d}});n(m??[])}catch(m){console.error(m),B.error(Q(m))}finally{o(!1)}},1e3);return ke(async()=>{c()},[s?.meta?.did].concat(t)),{backups:i}}function Ot({appDid:t}){const{backups:o}=De(),[a,s]=h.useState({message:"",progress:0,completed:!1}),i=N(),{ws:{useSubscription:n}}=i;return n(M.BlockletEvents.backupProgress,r=>{t===r?.appDid&&s(()=>({...r}))},[t]),h.useEffect(()=>{if(o?.length&&dt(o[0]?.status)){const[r]=o;s(()=>({message:r.message,progress:r.progress,completed:r.progress>=100}))}},[o]),a}function zt({deps:t=[],setLoading:o=()=>{}}={}){const{blocklet:a}=z(),[s,i]=h.useState([]),{api:n}=N(),r=h.useCallback(je(async()=>{if(!n||!a?.meta?.did){i([]);return}try{o(!0);const l=D(),d=l.subtract(1,"year"),{summary:c}=await n.getBlockletBackupSummary({input:{did:a.meta.did,startTime:d.toISOString(),endTime:l.toISOString()}});i(Array.isArray(c)?c:[])}catch(l){console.error("Failed to fetch backup summary:",l),B.error(Q(l)),i([])}finally{o(!1)}},1e3),[]);return ke(async()=>(await r(),()=>{r.cancel()}),[a?.meta?.did].concat(t)),{backupSummary:s}}const Ee=h.createContext({}),{Provider:Lt,Consumer:ys}=Ee;function Te({children:t}){const{t:o}=E(),{api:a}=N(),{blocklet:s}=z(),[i,n]=h.useState(null),[r,l]=h.useState(!1),{data:d,loading:c,mutate:m}=vt({refresh:r}),g=pt(d),f=Ot({appDid:s?.appDid}),p=h.useMemo(()=>bt(s?.environments),[s?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(!1),{backups:Z}=De({deps:[y,i],setLoading:w,backupDate:i}),[ee,te]=h.useState(!1),{backupSummary:se}=zt({deps:[ee]}),[_,U]=h.useState(d?.find(x=>x.endpoint===p)),T=s?.settings?.autoBackup,P=()=>{l(x=>!x)},ne=()=>{te(x=>!x)},oe=()=>{b(x=>!x)},G=async x=>{await a.updateAutoBackup({input:{did:s.meta.did,autoBackup:x}})},J=async()=>{await a.abortBlockletBackup({input:{appPid:s.meta.did}})},ae=async(x,v)=>{try{m(R=>{const A=[...R];return A.push({...x,loading:!0}),A}),await a.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:x}}),p!==v&&await a.configBlocklet({input:{did:[s.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:v}]}}),U(x),P(),B.success(o("storage.spaces.connectedWithName",{name:x?.name??"DID Spaces"}))}catch(R){throw console.error(R),m(A=>[...A].filter(W=>W.did!==x.did)),R}},re=async x=>{x&&(x.endpoint===p&&(await a.configBlocklet({input:{did:[s.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),T?.enabled&&await G({enabled:!1})),await a.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:x?.did}}),m(v=>{const R=[...v];return R.splice(R.indexOf(x),1),R}),U(x),P())},ie=async x=>{await Promise.all([a.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:x.did},spaceGateway:x}}),p!==x.endpoint&&a.configBlocklet({input:{did:[s.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:x.endpoint}]}})]),B.success(o("storage.spaces.connectedWithName",{name:x?.name??"DID Spaces"})),P()},C=x=>x?.endpoint===p;return e.jsx(Lt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ae,deleteSpaceGateway:re,updateSpaceGateway:ie,refreshSpaceGateways:P,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:g,spaceGatewayIsSelected:C,updateAutoBackup:G,abortBlockletBackup:J,backupEndpoint:p,backupProgress:f,backups:Z,backupSummary:se,refreshBackupSummary:ne,refreshBackups:oe,setBackupDate:n,backupsLoading:k,autoBackup:T},children:t})}Te.propTypes={children:u.any.isRequired};function L(){return h.useContext(Ee)}function Ie({...t}){const{blocklet:o}=z(),{info:a}=N(),{t:s}=E(),i=Be({blocklet:o}),n=tt(a),{spaceGateways:r,addSpaceGateway:l}=L(),d={checkFn:Ce.create({baseURL:me(window.location.origin,st())}).get,webWalletUrl:n,extraParams:{appPid:o.appPid,appDid:i.appDid,appName:i.appName,appDescription:i.appDescription,appUrl:i.appUrl,referrer:i.referrer,scopes:i.scopes,nodeDid:a.did}},c=async({endpoint:g,name:f,did:p})=>{const k=await kt(g);if(!await jt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(r.some(b=>b.endpoint===g)){B.error(s("storage.spaces.gateway.add.duplicate",{name:f}));return}await l({name:f,did:p,url:k,endpoint:g},g)},m=async({spaceGateway:g})=>{try{await c(g)}catch(f){console.error(f),B.error(Q(f))}};return e.jsx(ut,{...t,connectScope:"app",options:d,onSuccess:m})}function Re({...t}){const{t:o}=h.useContext(at),{blocklet:a,loadingDiskInfo:s,actions:i}=z();if(h.useEffect(()=>{i?.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),a.diskInfo){const n=(d,c,m)=>e.jsxs(j,{children:[d," ",e.jsx("strong",{children:c?nt(c):"empty"})]}),r=a.environments.reduce((d,c)=>(d[c.key]=c.value,d),{}),l=[{key:"appDir",name:o("blocklet.diskInfo.appDir"),value:n(r.BLOCKLET_APP_DIR,a.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:n(r.BLOCKLET_DATA_DIR,a.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:n(r.BLOCKLET_LOG_DIR,a.diskInfo.log)},{key:"cacheDir",name:o("blocklet.diskInfo.cacheDir"),value:n(r.BLOCKLET_CACHE_DIR,a.diskInfo.cache)}];return e.jsx(Ut,{component:"div",...t,children:l.map(d=>e.jsx(Dt,{valueComponent:"div",nameWidth:120,name:d.name,children:d.value},d.key))})}return s?e.jsx(O,{}):e.jsx(j,{children:o("blocklet.diskInfo.empty")})}const Ut=Ne(j)``;function Pe(){const{t}=E(),{setBackupDate:o,backupSummary:a}=L(),s=mt({key:"lg"}),i=h.useRef(null),n=_e(),r=h.useCallback(c=>{o(c)},[o]),l=h.useMemo(()=>{const c=D().add(1,"day"),m=D().subtract(11,"month").startOf("month"),g=new Map(a.map(p=>[p.date,{date:p.date,successCount:p.successCount,errorCount:p.errorCount}])),f=[];for(let p=m.clone();D(p).isBefore(c);p=p.add(1,"day")){const k=p.format("YYYY-MM-DD");f.push(g.get(k)||{date:k,successCount:0,errorCount:0})}return f},[a]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=l[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{j as e,$ as u,p as O,T as j,at as Ne,J as _e,cI as V,ao as X,cJ as We,ak as S,b1 as K,a$ as Ke,s as xe,cK as be,cy as Ge,am as ge,cu as Fe,M as F,aO as Y,bR as Ye,aP as $,V as $e,bl as qe,aR as He,cL as Qe,cM as Je,cN as Ve,cO as Xe,bY as he}from"./vendor-mui-core-Bz-X9hX7.js";import{k as Ze,j as ke,f as ue}from"./vendor-hooks-CFpNP5Ql.js";import{r as h,u as et}from"./vendor-react-x2lQvn4m.js";import{Y as z,_ as N,ad as D,M,aC as tt,aD as st,au as nt,c as I,$ as ot}from"./index-BpP1Znfh.js";import{H as B,T as E,b as at,a0 as q,D as rt,J as it,n as le,j as ct}from"./vendor-ux-D2yvD18l.js";import{u as lt}from"./use-mobile-BkNZycG6.js";import{a as H,d as je,a1 as dt,e as pt,D as Ce,C as me}from"./vendor-utils-Vke2d2wu.js";import{o as we}from"./vendor-arcblock-Cvkavi6C.js";import{b as ut,u as mt,D as ft,c as de,a as xt}from"./index-QJUPJwU5.js";import"./index-DnIF_NYU.js";import"./index-BojVbZw0.js";import"./api-B7LEhzE2.js";import{u as Be,C as gt,D as ht,a as St}from"./connect-to-DFUayzYa.js";import{b as yt,c as bt,d as kt,i as jt,e as fe,f as Ct,h as wt,j as Bt}from"./spaces-BaVWWOGx.js";import{f as Q}from"./index-DBs9Ljax.js";import{v as Dt}from"./index-CF0F1TwU.js";import{E as Et}from"./index-DbIUA2zH.js";import{x as Tt}from"./index-DRYJ0xIl.js";import{g as Se}from"./get-safe-url-DeteK1Tn.js";import{S as It}from"./switch-control-gGb7roLA.js";import{C as Rt,u as Pt}from"./config-space-BJHf-Cd6.js";import{L as ye}from"./list-header-Bcr2R_3c.js";import"./lottie-web-4koyQiv_.js";import"./index-BwLbaIOO.js";async function At({blockletDid:t,nodeApi:o,spaceGateways:a}){let s=!1;const i=await Promise.all(a.map(async n=>{let{name:r}=n;const l=await yt(n.endpoint);return!H(l)&&l!==r&&(r=l,s=!0),{...n,name:r}}));return s&&await Promise.all(i.filter(n=>n.did).map(n=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:n.did},spaceGateway:{...n}}}))),i}function vt({refresh:t}={}){const{blocklet:o}=z(),a=o?.meta?.did,{api:s}=N();return Ze(async()=>{if(!a)return[];const{spaceGateways:i}=await s.getBlockletSpaceGateways({input:{did:a}});return await At({blockletDid:a,nodeApi:s,spaceGateways:i})??[]},{refreshDeps:[a,t],onError(i){i?.message?.includes("not logged")?console.warn(i):(console.error(i),B.error(Q(i)))}})}function De({deps:t,setLoading:o,backupDate:a}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=z(),[i,n]=h.useState([]),{api:r}=N(),[l,d]=h.useMemo(()=>a?[D(a).startOf("day").toISOString(),D(a).endOf("day").toISOString()]:[D().startOf("year").toISOString(),D().endOf("day").toISOString()],[a]),c=je(async()=>{try{if(o(!0),!s){n([]);return}const{backups:m}=await r.getBlockletBackups({input:{did:s.meta.did,startTime:l,endTime:d}});n(m??[])}catch(m){console.error(m),B.error(Q(m))}finally{o(!1)}},1e3);return ke(async()=>{c()},[s?.meta?.did].concat(t)),{backups:i}}function Ot({appDid:t}){const{backups:o}=De(),[a,s]=h.useState({message:"",progress:0,completed:!1}),i=N(),{ws:{useSubscription:n}}=i;return n(M.BlockletEvents.backupProgress,r=>{t===r?.appDid&&s(()=>({...r}))},[t]),h.useEffect(()=>{if(o?.length&&dt(o[0]?.status)){const[r]=o;s(()=>({message:r.message,progress:r.progress,completed:r.progress>=100}))}},[o]),a}function zt({deps:t=[],setLoading:o=()=>{}}={}){const{blocklet:a}=z(),[s,i]=h.useState([]),{api:n}=N(),r=h.useCallback(je(async()=>{if(!n||!a?.meta?.did){i([]);return}try{o(!0);const l=D(),d=l.subtract(1,"year"),{summary:c}=await n.getBlockletBackupSummary({input:{did:a.meta.did,startTime:d.toISOString(),endTime:l.toISOString()}});i(Array.isArray(c)?c:[])}catch(l){console.error("Failed to fetch backup summary:",l),B.error(Q(l)),i([])}finally{o(!1)}},1e3),[]);return ke(async()=>(await r(),()=>{r.cancel()}),[a?.meta?.did].concat(t)),{backupSummary:s}}const Ee=h.createContext({}),{Provider:Lt,Consumer:ys}=Ee;function Te({children:t}){const{t:o}=E(),{api:a}=N(),{blocklet:s}=z(),[i,n]=h.useState(null),[r,l]=h.useState(!1),{data:d,loading:c,mutate:m}=vt({refresh:r}),g=pt(d),f=Ot({appDid:s?.appDid}),p=h.useMemo(()=>bt(s?.environments),[s?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(!1),{backups:Z}=De({deps:[y,i],setLoading:w,backupDate:i}),[ee,te]=h.useState(!1),{backupSummary:se}=zt({deps:[ee]}),[_,U]=h.useState(d?.find(x=>x.endpoint===p)),T=s?.settings?.autoBackup,P=()=>{l(x=>!x)},ne=()=>{te(x=>!x)},oe=()=>{b(x=>!x)},G=async x=>{await a.updateAutoBackup({input:{did:s.meta.did,autoBackup:x}})},J=async()=>{await a.abortBlockletBackup({input:{appPid:s.meta.did}})},ae=async(x,v)=>{try{m(R=>{const A=[...R];return A.push({...x,loading:!0}),A}),await a.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:x}}),p!==v&&await a.configBlocklet({input:{did:[s.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:v}]}}),U(x),P(),B.success(o("storage.spaces.connectedWithName",{name:x?.name??"DID Spaces"}))}catch(R){throw console.error(R),m(A=>[...A].filter(W=>W.did!==x.did)),R}},re=async x=>{x&&(x.endpoint===p&&(await a.configBlocklet({input:{did:[s.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),T?.enabled&&await G({enabled:!1})),await a.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:x?.did}}),m(v=>{const R=[...v];return R.splice(R.indexOf(x),1),R}),U(x),P())},ie=async x=>{await Promise.all([a.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:x.did},spaceGateway:x}}),p!==x.endpoint&&a.configBlocklet({input:{did:[s.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:x.endpoint}]}})]),B.success(o("storage.spaces.connectedWithName",{name:x?.name??"DID Spaces"})),P()},C=x=>x?.endpoint===p;return e.jsx(Lt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ae,deleteSpaceGateway:re,updateSpaceGateway:ie,refreshSpaceGateways:P,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:g,spaceGatewayIsSelected:C,updateAutoBackup:G,abortBlockletBackup:J,backupEndpoint:p,backupProgress:f,backups:Z,backupSummary:se,refreshBackupSummary:ne,refreshBackups:oe,setBackupDate:n,backupsLoading:k,autoBackup:T},children:t})}Te.propTypes={children:u.any.isRequired};function L(){return h.useContext(Ee)}function Ie({...t}){const{blocklet:o}=z(),{info:a}=N(),{t:s}=E(),i=Be({blocklet:o}),n=tt(a),{spaceGateways:r,addSpaceGateway:l}=L(),d={checkFn:Ce.create({baseURL:me(window.location.origin,st())}).get,webWalletUrl:n,extraParams:{appPid:o.appPid,appDid:i.appDid,appName:i.appName,appDescription:i.appDescription,appUrl:i.appUrl,referrer:i.referrer,scopes:i.scopes,nodeDid:a.did}},c=async({endpoint:g,name:f,did:p})=>{const k=await kt(g);if(!await jt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(r.some(b=>b.endpoint===g)){B.error(s("storage.spaces.gateway.add.duplicate",{name:f}));return}await l({name:f,did:p,url:k,endpoint:g},g)},m=async({spaceGateway:g})=>{try{await c(g)}catch(f){console.error(f),B.error(Q(f))}};return e.jsx(ut,{...t,connectScope:"app",options:d,onSuccess:m})}function Re({...t}){const{t:o}=h.useContext(at),{blocklet:a,loadingDiskInfo:s,actions:i}=z();if(h.useEffect(()=>{i?.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),a.diskInfo){const n=(d,c,m)=>e.jsxs(j,{children:[d," ",e.jsx("strong",{children:c?nt(c):"empty"})]}),r=a.environments.reduce((d,c)=>(d[c.key]=c.value,d),{}),l=[{key:"appDir",name:o("blocklet.diskInfo.appDir"),value:n(r.BLOCKLET_APP_DIR,a.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:n(r.BLOCKLET_DATA_DIR,a.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:n(r.BLOCKLET_LOG_DIR,a.diskInfo.log)},{key:"cacheDir",name:o("blocklet.diskInfo.cacheDir"),value:n(r.BLOCKLET_CACHE_DIR,a.diskInfo.cache)}];return e.jsx(Ut,{component:"div",...t,children:l.map(d=>e.jsx(Dt,{valueComponent:"div",nameWidth:120,name:d.name,children:d.value},d.key))})}return s?e.jsx(O,{}):e.jsx(j,{children:o("blocklet.diskInfo.empty")})}const Ut=Ne(j)``;function Pe(){const{t}=E(),{setBackupDate:o,backupSummary:a}=L(),s=mt({key:"lg"}),i=h.useRef(null),n=_e(),r=h.useCallback(c=>{o(c)},[o]),l=h.useMemo(()=>{const c=D().add(1,"day"),m=D().subtract(11,"month").startOf("month"),g=new Map(a.map(p=>[p.date,{date:p.date,successCount:p.successCount,errorCount:p.errorCount}])),f=[];for(let p=m.clone();D(p).isBefore(c);p=p.add(1,"day")){const k=p.format("YYYY-MM-DD");f.push(g.get(k)||{date:k,successCount:0,errorCount:0})}return f},[a]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=l[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:n.palette.background.paper,borderColor:n.palette.divider,textStyle:{color:n.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${n.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:V[600]},{min:-9,max:-6,color:V[500]},{min:-6,max:-3,color:V[400]},{min:-3,max:-1,color:V[300]},{min:0,max:0,color:n.palette.grey[200]},{min:1,max:3,color:X[300]},{min:3,max:6,color:X[400]},{min:6,max:9,color:X[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:X[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:n.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,color:n.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:n.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:n.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[D().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),D().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:l.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:We[200],color:"inherit"}}}}),[l,t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:i,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(Et,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:c=>{c.componentType==="series"&&c.data&&r(c.data[0])}}})})}),e.jsx(S,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2},children:e.jsxs(K,{direction:s?"column":"row",spacing:s?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center"},children:[e.jsxs(K,{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(K,{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(K,{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 Mt=xe(({className:t,...o})=>e.jsx(ge,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ae({status:t,message:o="",createdAt:a}){const{t:s}=E(),i=t===I.BACKUPS.STATUS.PROGRESS&&D().diff(a,"hours")>=I.BACKUPS.TIMEOUT_HOURS,n=i&&s("common.timeoutError"),r=t===I.BACKUPS.STATUS.PROGRESS&&!i,l=t===I.BACKUPS.STATUS.SUCCEEDED&&!i;return r?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(O,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):l?e.jsx(q,{type:"success",children:s("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"error",children:s("common.failed")}),e.jsx(ge,{style:{display:"flex",alignItems:"center",flexShrink:0},title:o||n,children:e.jsx(be,{children:e.jsx(Fe,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Ae.propTypes={status:u.string.isRequired,message:u.string,createdAt:u.string.isRequired};function ve({metadata:t={}}){const{t:o}=E();if(H(t))return e.jsx(q,{type:"success",children:o("common.succeeded")});const a=t.count||0,s=t.size||0,i=Tt(s,{iec:!0}),n=e.jsxs(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[o("common.fileCount"),": ",a]}),e.jsxs(j,{variant:"body2",children:[o("common.fileSize"),": ",i]})]});return e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"success",children:o("common.succeeded")}),e.jsx(Mt,{title:n,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(be,{children:e.jsx(Ge,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}ve.propTypes={metadata:u.object};function Oe(){const{t,locale:o}=E(),{spaceGateways:a,backups:s,backupsLoading:i}=L(),n=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:l=>{const{targetUrl:d,targetName:c,status:m,createdAt:g}=s[l],f=m===I.BACKUPS.STATUS.PROGRESS&&D().diff(g,"hours")>=I.BACKUPS.TIMEOUT_HOURS,p=m===I.BACKUPS.STATUS.SUCCEEDED&&!f,k=c||a.find(w=>d?.includes(fe(w?.endpoint)))?.name||"Unknown DID Space";return p?e.jsx(Ke,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:l=>{const d=t(l===0?"common.auto":"common.manual");return e.jsx(q,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:l=>D(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:l=>H(l)?"":D(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:l=>{const d=s?.[l]??{},{status:c,message:m,createdAt:g,metadata:f}=d,p=c===I.BACKUPS.STATUS.PROGRESS&&D().diff(g,"hours")>=I.BACKUPS.TIMEOUT_HOURS,k=c===I.BACKUPS.STATUS.PROGRESS&&!p,w=c===I.BACKUPS.STATUS.SUCCEEDED&&!p;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(O,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(ve,{metadata:f}):e.jsx(Ae,{status:c,message:m,createdAt:g})}}}],[s,a,t]),r=h.useMemo(()=>!s?.length,[s]);return e.jsx(e.Fragment,{children:r?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(rt,{title:"",loading:i,data:s,columns:n,emptyNode:t("storage.spaces.record.emptyData",o),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Nt(){const{t}=E();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(ft,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(Ie,{})]}),e.jsxs(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(Pe,{})]})]}),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(Re,{})]})}function ze({spaceGateway:t,onConfirm:o=()=>{},onCancel:a=()=>{}}){const{t:s}=E(),[i,n]=h.useState(!1),[r,l]=h.useState(!1),d=(g,f)=>{g?.preventDefault(),g?.stopPropagation(),n(f)},c=async g=>{try{g?.stopPropagation(),l(!0),await o?.(t),n(!1)}catch(f){console.error(f),B.error(`${s("storage.space.gateway.delete.failed")}: ${Q(f)}`)}finally{n(!1),l(!1)}},m=g=>{d(g,!1),a?.(g)};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{color:"red",onClick:g=>d(g,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(Ye,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(it,{title:s("storage.spaces.gateway.delete.title"),open:i,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:r}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:r}},onConfirm:c,onCancel:m,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}ze.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool}).isRequired,onConfirm:u.func,onCancel:u.func};function Le({spaceGateway:t,selected:o,onDelete:a=()=>{},onConnect:s=()=>{},enableSwitchToSpace:i=!0,backupInProgress:n=!1,...r}){const{abortBlockletBackup:l}=L(),[d,c]=h.useState(null),{t:m}=E(),[g,f]=h.useState(!1),p=(y,b)=>{y.stopPropagation(),y.preventDefault(),c(b&&y.currentTarget)},k=async y=>{try{f(!0),p(y,!1),await s(t)}catch(b){console.error(b),B.error(b.message)}finally{f(!1)}},w=async y=>{try{f(!0),p(y,!1),await l()}catch(b){console.error(b),B.error(b.message)}finally{f(!1)}};return e.jsxs(e.Fragment,{children:[g||t?.loading?e.jsx(O,{sx:{ml:1},size:"24px"}):e.jsx($e,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>p(y,!0),...r,children:e.jsx(qe,{})}),e.jsxs(He,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>p(y,!1),children:[e.jsxs(F,{onClick:y=>{p(y,!1),window.open(Se(t.endpoint?Ct(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Qe,{fontSize:"small"})}),e.jsx($,{children:m("common.open")})]}),e.jsxs(F,{onClick:y=>{p(y,!1),window.open(Se(wt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Je,{fontSize:"small"})}),e.jsx($,{children:m("storage.spaces.strategy.viewBackupFiles")})]}),!o&&i&&e.jsxs(F,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ve,{fontSize:"small"})}),e.jsx($,{children:m("storage.spaces.connect.switchToSpace")})]}),n&&e.jsxs(F,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Xe,{fontSize:"small"})}),e.jsx($,{children:m("storage.spaces.connect.abortBlockletBackup")})]}),!n&&e.jsx(ze,{spaceGateway:t,onConfirm:async()=>{c(null),await a?.(t)},onCancel:()=>c(null)})]})]})}Le.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool,endpoint:u.string.isRequired,loading:u.bool}).isRequired,selected:u.bool.isRequired,enableSwitchToSpace:u.bool,onDelete:u.func,onConnect:u.func,backupInProgress:u.bool};const _t=xe(({className:t,...o})=>e.jsx(ge,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ue({spaceGateway:t,spaceStatus:o,selected:a,onConnected:s=()=>{},onDeleted:i=()=>{},onBackedUp:n=()=>{}}){const{t:r,locale:l}=E(),{blocklet:d}=z(),{api:c,info:{did:m}}=N(),{appDid:g,appName:f,appDescription:p,scopes:k,appUrl:w,referrer:y}=Be({blocklet:d}),{backupProgress:b,updateSpaceGateway:Z,deleteSpaceGateway:ee,refreshBackupSummary:te,refreshBackups:se}=L(),[_,U]=h.useState(!1),[T,P]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:r("storage.spaces.authorize.title",{appName:f},l),scan:r("storage.spaces.authorize.scan",{appName:f},l),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:r("storage.spaces.authorize.success")})},onClose:()=>{P(C=>({...C,open:!1}))}}),ne=a&&!_&&o===de.DISCONNECTED,oe=a&&!_&&!t.loading&&o===de.CONNECTED,G=a&&_&&o===de.CONNECTED&&b?.progress>=0,J=async()=>{try{if(await Bt(t?.endpoint)){await c.configBlocklet({input:{did:[d.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(r("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s?.(null,t);return}}catch(C){console.error(C),s?.(C,t);return}P(C=>({...C,open:!0,prefix:me(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:Ce.create({baseURL:me(t.url,"space")}).get,extraParams:{appDid:g,appName:f,appDescription:p,scopes:k,appUrl:w,referrer:y,nodeDid:m,spaceDid:t.did}}))},ae=async(C,x)=>{const v=x(C.endpoint),R=fe(v),A=C.space?x(C.space):{};if(t.did&&R!==t.did){P(Me=>({...Me,open:!1}));const W=r("storage.spaces.gateway.switch.failedForMismatchSpace",{name:A?.name?A.name:""});B.error(W),s?.(new Error(W),t);return}const ce={...t,name:A.name??"DID Space",did:A.did??fe(v),endpoint:v};await Z(ce),P(W=>({...W,open:!1})),s?.(null,ce)},re=async()=>{try{if(_)return;U(!0),await c.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),n?.(C,t)}finally{U(!0)}},ie=async()=>{try{await ee(t),B.success(r("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),i?.(null,t)}catch(C){console.error(C),i?.(C,t)}};return h.useEffect(()=>{b?.completed?(a&&(b?.progress===100?(B.success(r("storage.spaces.backupSuccessfully")),n?.(null,t)):b.message&&n?.(new Error(b?.message),t),b.progress=0,b.message=""),U(!1),setTimeout(()=>{te(),se()},1e3)):b.progress&&U(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[oe&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:re,children:r("storage.spaces.strategy.backupNow")}),ne&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:J,children:r("storage.spaces.disconnected.reconnectNow")}),G&&e.jsx(_t,{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(le,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(O,{variant:"determinate",value:b?.progress,size:14,sx:{mr:1}}),b?.progress,"%"]})}),e.jsx(ot,{forceConnected:!1,saveConnect:!1,prefix:T.prefix,open:T.open,popup:!0,action:T.action,baseUrl:T.baseUrl,checkFn:T.checkFn,onSuccess:ae,onClose:T.onClose,checkTimeout:T.checkTimeout,extraParams:T.extraParams,messages:T.messages,locale:l},"get-endpoint")]}),e.jsx(Le,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:a,onDelete:ie,onConnect:J,enableSwitchToSpace:b?.completed||H(b?.message),backupInProgress:G})]})}Ue.propTypes={spaceGateway:u.shape({did:u.string.isRequired,name:u.string.isRequired,url:u.string.isRequired,endpoint:u.string.isRequired,protected:u.bool,loading:u.bool}).isRequired,spaceStatus:u.string.isRequired,selected:u.bool.isRequired,onConnected:u.func,onDeleted:u.func,onBackedUp:u.func};function Wt({...t}){const{t:o}=E();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(Pe,{}),e.jsx(Oe,{})]})}function Kt({...t}){const{t:o}=E(),{autoBackup:a,updateAutoBackup:s}=L(),i=async()=>{try{const n=!a?.enabled;await s({enabled:n}),B.success(o(n?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(n){B.error(n.message)}};return e.jsx(It,{checked:!!a?.enabled,onChange:i,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:o("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function Gt(){const{t}=E(),{spaceGateways:o,spaceGatewaysLoading:a,spaceGatewayIsSelected:s}=L(),i=a&&!o?.length,n=({spaceGateway:r,spaceStatus:l,selected:d,refresh:c})=>e.jsx(Ue,{spaceGateway:r,spaceStatus:l,selected:d,onConnected:()=>c(),onBackedUp:m=>m&&c()});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(Kt,{}),e.jsx(Ie,{})]}),e.jsx(S,{sx:{mt:2},children:i?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(O,{})}):e.jsx(he,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:o.map(r=>e.jsx(he,{size:{xs:12,md:6},children:e.jsx(xt,{endpoint:r.endpoint,selected:s(r),action:n},r.endpoint)},r.endpoint))})})}),e.jsx(Wt,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Re,{})]})}function Ft(){const{spaceGatewaysFirstLoading:t,spaceGateways:o}=L();return t?e.jsx(we,{relative:"parent",children:e.jsx(O,{})}):H(o)?e.jsx(Nt,{}):e.jsx(Gt,{})}function Yt(){return e.jsx(Te,{children:e.jsx(Ft,{})})}function $t(){const{spaceGateway:t,settingStorageEndpoint:o,updateSpaceGateway:a,hasStorageEndpoint:s,loading:i,storageEndpoint:n}=Pt(),r=ue(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return i?e.jsx(we,{relative:"parent",children:e.jsx(O,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(gt,{spaceGateway:t,settingStorageEndpoint:o}):e.jsx(ht,{}),e.jsx(S,{sx:r,children:e.jsx(St,{onConnect:a,storageEndpoint:n})})]})}function qt(){const{t}=E();return e.jsxs(Rt,{children:[e.jsxs(K,{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($t,{})]})}function Ht({navOrientation:t="vertical",...o}){const{t:a,locale:s}=E(),{blocklet:i}=z(),n=lt({key:"md"}),[r,l]=et(),d=r.get("tab")||"backup",c=n?"horizontal":t,m=ue(()=>{const w=[{label:a("common.backup"),value:"backup"}],y=i?.capabilities?.didSpace;return(y===M.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||y===M.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:a("common.storage"),value:"storage"}),w},[s,c]),f=ue(()=>({backup:e.jsx(Yt,{}),storage:e.jsx(qt,{})}))[d],p=w=>{l(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(m.length<=1)return e.jsx(pe,{children:f});const k=e.jsx(ct,{tabs:m,current:d,orientation:c,onChange:p,sx:[{borderRight:1,height:"100%",borderColor:"divider"},c==="horizontal"&&{borderRight:0}]});if(c==="vertical")return e.jsx(S,{...o,children:e.jsxs(K,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(ye,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(pe,{sx:{mt:1},children:f})})]})});if(c==="horizontal")return e.jsxs(S,{...o,children:[e.jsx(ye,{left:k}),e.jsx(pe,{sx:{mt:2},children:f})]})}Ht.propTypes={navOrientation:u.oneOf(["vertical","horizontal"])};const pe=xe(S)`
3
3
  position: relative;
4
4
  min-height: 66vh;
@@ -1 +1 @@
1
- import{c as A,v as R,p as w,s as p}from"./index-BfwIRDCT.js";const O=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,x=/^[a-zA-Z]:\\/;function N(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return x.test(e)?!1:O.test(e)}const _=["http","https"],z=["nofollow"],L={};function T(e){const r=e||L,g=r.protocols||_,u=A(r.test);return function(h){R(h,"element",function(t,y,E){if(t.tagName==="a"&&typeof t.properties.href=="string"&&u(t,y,E)){const o=t.properties.href;if(N(o)?g.includes(o.slice(0,o.indexOf(":"))):o.startsWith("//")){const n=s(r.content,t),c=n&&!Array.isArray(n)?[n]:n,i=s(r.rel,t)||z,a=typeof i=="string"?w(i):i,f=s(r.target,t),l=s(r.properties,t);if(l&&Object.assign(t.properties,p(l)),a.length>0&&(t.properties.rel=[...a]),f&&(t.properties.target=f),c){const m=s(r.contentProperties,t)||{};t.children.push({type:"element",tagName:"span",properties:p(m),children:p(c)})}}}})}}function s(e,r){return typeof e=="function"?e(r):e}export{T as r};
1
+ import{c as A,v as R,p as w,s as p}from"./index-Dcvh9y_X.js";const O=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,x=/^[a-zA-Z]:\\/;function N(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return x.test(e)?!1:O.test(e)}const _=["http","https"],z=["nofollow"],L={};function T(e){const r=e||L,g=r.protocols||_,u=A(r.test);return function(h){R(h,"element",function(t,y,E){if(t.tagName==="a"&&typeof t.properties.href=="string"&&u(t,y,E)){const o=t.properties.href;if(N(o)?g.includes(o.slice(0,o.indexOf(":"))):o.startsWith("//")){const n=s(r.content,t),c=n&&!Array.isArray(n)?[n]:n,i=s(r.rel,t)||z,a=typeof i=="string"?w(i):i,f=s(r.target,t),l=s(r.properties,t);if(l&&Object.assign(t.properties,p(l)),a.length>0&&(t.properties.rel=[...a]),f&&(t.properties.target=f),c){const m=s(r.contentProperties,t)||{};t.children.push({type:"element",tagName:"span",properties:p(m),children:p(c)})}}}})}}function s(e,r){return typeof e=="function"?e(r):e}export{T as r};
@@ -1,4 +1,4 @@
1
- import{j as i,c3 as $,at as x,$ as s,ak as y,b0 as L,p as T,s as A}from"./vendor-mui-core-BWI0_sKe.js";import{g as E,h as M,a as h,k as q}from"./vendor-hooks-CFpNP5Ql.js";import{ad as D,a6 as U,c as H,az as F,aA as j,aB as b,t as O}from"./index-B0xpDUsO.js";import{r as m}from"./vendor-react-x2lQvn4m.js";import{b as B,a as Y,T as _,$ as V}from"./vendor-ux-DVPR2iDY.js";import{N as W}from"./index-PN2leRF6.js";import{a as k}from"./index-fy1uK_IR.js";import{C as J}from"./vendor-utils-Vke2d2wu.js";import{u as K}from"./use-passport-id-B-b-_oYF.js";import{u as X}from"./session-Bj1hMOts.js";import{b as G}from"./sdk-BI2up0A5.js";import{w as Q}from"./wrap-locale-CVw8KKu9.js";function P({invitation:e,createPassportSvg:a,passportColor:c="auto"}){const[p,n]=m.useState(!1),{t}=m.useContext(B),l=m.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),d=m.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c,extra:e.passportExpireTime?{key:"Exp",value:D(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,l]),u=m.useCallback(()=>{n(!0)},[]),o=m.useCallback(()=>{n(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(Z,{children:i.jsxs("div",{className:"invite-passport__card",onClick:u,children:[!!e.display&&i.jsx(W,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:d}})]})}),i.jsx(Y,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:o,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(r=>i.jsx("li",{style:{listStyle:"circle"},children:r.description},r.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx($,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:t("invite.emptyPermission")})]})})]})}P.propTypes={invitation:s.object.isRequired,createPassportSvg:s.func.isRequired,passportColor:s.string};const Z=x.div`
1
+ import{j as i,c3 as $,at as x,$ as s,ak as y,b0 as L,p as T,s as A}from"./vendor-mui-core-Bz-X9hX7.js";import{g as E,h as M,a as h,k as q}from"./vendor-hooks-CFpNP5Ql.js";import{ad as D,a6 as U,c as H,az as F,aA as j,aB as b,t as O}from"./index-BpP1Znfh.js";import{r as m}from"./vendor-react-x2lQvn4m.js";import{b as B,a as Y,T as _,$ as V}from"./vendor-ux-D2yvD18l.js";import{N as W}from"./index-SCzvv_RV.js";import{a as k}from"./index-DmmlDdES.js";import{C as J}from"./vendor-utils-Vke2d2wu.js";import{u as K}from"./use-passport-id-B-b-_oYF.js";import{u as X}from"./session-Ctfgia_m.js";import{b as G}from"./sdk-D8T5YhY1.js";import{w as Q}from"./wrap-locale-DRH6wq1d.js";function P({invitation:e,createPassportSvg:a,passportColor:c="auto"}){const[p,n]=m.useState(!1),{t}=m.useContext(B),l=m.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),d=m.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c,extra:e.passportExpireTime?{key:"Exp",value:D(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,l]),u=m.useCallback(()=>{n(!0)},[]),o=m.useCallback(()=>{n(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(Z,{children:i.jsxs("div",{className:"invite-passport__card",onClick:u,children:[!!e.display&&i.jsx(W,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:d}})]})}),i.jsx(Y,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:o,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(r=>i.jsx("li",{style:{listStyle:"circle"},children:r.description},r.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx($,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:t("invite.emptyPermission")})]})})]})}P.propTypes={invitation:s.object.isRequired,createPassportSvg:s.func.isRequired,passportColor:s.string};const Z=x.div`
2
2
  display: flex;
3
3
  max-width: 350px;
4
4
  margin: 30px auto;
@@ -1 +1 @@
1
- import{j as i,ak as l}from"./vendor-mui-core-BWI0_sKe.js";import{i as x,r as g}from"./vendor-react-x2lQvn4m.js";import{a as v}from"./vendor-hooks-CFpNP5Ql.js";import{I as w}from"./invitation-B34gciAx.js";import{K as u}from"./landing-page-8lE7kpfr.js";import{T as I,w as S}from"./vendor-ux-DVPR2iDY.js";import{a as T,e as k,s as E,b as j,c as P,H as R,d as W}from"./index-B0xpDUsO.js";import{g as C}from"./get-safe-url-HSOeeYs_.js";import"./vendor-utils-Vke2d2wu.js";import"./index-PN2leRF6.js";import"./index-fy1uK_IR.js";import"./use-passport-id-B-b-_oYF.js";import"./session-Bj1hMOts.js";import"./sdk-BI2up0A5.js";import"./wrap-locale-CVw8KKu9.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D026EX-Z.js";function y(n){const c=x(),{searchParams:s}=new URL(window.location.href),{api:m,session:p}=T(),{t:d}=I(),a=s.get("inviteId"),r=s.get("redirect"),f=g.useCallback(async()=>{const{data:t}=await k.get("invitation",{params:{inviteId:a}});return t},[a]),h=v(async(t,o=e=>e)=>{t&&(E(o(t.sessionToken)),j(o(t.refreshToken)),t.visitorId&&S(o(t.visitorId))),await p.refresh(),setTimeout(()=>{if(r){const e=decodeURIComponent(r);e.startsWith(P.WELLKNOWN_SERVICE_PATH_PREFIX)?c(e,{replace:!0}):window.location.href=C(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(u,{did:window.blocklet?.appPid,children:[i.jsx(R,{children:i.jsx("title",{children:d("pageTitle.invite")})}),i.jsx(l,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...n,getDataFn:f,checkFn:m.get,createPassportSvg:t=>W({...t}),onLoginSuccess:h,inService:!0})})]})}export{y as default};
1
+ import{j as i,ak as l}from"./vendor-mui-core-Bz-X9hX7.js";import{i as x,r as g}from"./vendor-react-x2lQvn4m.js";import{a as v}from"./vendor-hooks-CFpNP5Ql.js";import{I as w}from"./invitation-gz7ZaT6I.js";import{K as u}from"./landing-page-D37ZgHkj.js";import{T as I,w as S}from"./vendor-ux-D2yvD18l.js";import{a as T,e as k,s as E,b as j,c as P,H as R,d as W}from"./index-BpP1Znfh.js";import{g as C}from"./get-safe-url-DeteK1Tn.js";import"./vendor-utils-Vke2d2wu.js";import"./index-SCzvv_RV.js";import"./index-DmmlDdES.js";import"./use-passport-id-B-b-_oYF.js";import"./session-Ctfgia_m.js";import"./sdk-D8T5YhY1.js";import"./wrap-locale-DRH6wq1d.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-Cvkavi6C.js";function y(n){const c=x(),{searchParams:s}=new URL(window.location.href),{api:m,session:p}=T(),{t:d}=I(),a=s.get("inviteId"),r=s.get("redirect"),f=g.useCallback(async()=>{const{data:t}=await k.get("invitation",{params:{inviteId:a}});return t},[a]),h=v(async(t,o=e=>e)=>{t&&(E(o(t.sessionToken)),j(o(t.refreshToken)),t.visitorId&&S(o(t.visitorId))),await p.refresh(),setTimeout(()=>{if(r){const e=decodeURIComponent(r);e.startsWith(P.WELLKNOWN_SERVICE_PATH_PREFIX)?c(e,{replace:!0}):window.location.href=C(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(u,{did:window.blocklet?.appPid,children:[i.jsx(R,{children:i.jsx("title",{children:d("pageTitle.invite")})}),i.jsx(l,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...n,getDataFn:f,checkFn:m.get,createPassportSvg:t=>W({...t}),onLoginSuccess:h,inService:!0})})]})}export{y as default};
@@ -1 +1 @@
1
- import{j as s,p as x,ak as w}from"./vendor-mui-core-BWI0_sKe.js";import{g as v,k as T,a as p}from"./vendor-hooks-CFpNP5Ql.js";import{I as k}from"./invitation-B34gciAx.js";import{K as I}from"./landing-page-8lE7kpfr.js";import{T as P,w as j}from"./vendor-ux-DVPR2iDY.js";import{a as R,s as S,b as E,c as W,H as C,d as F}from"./index-B0xpDUsO.js";import{g as L}from"./get-safe-url-HSOeeYs_.js";import{i as N}from"./vendor-react-x2lQvn4m.js";import"./vendor-utils-Vke2d2wu.js";import"./index-PN2leRF6.js";import"./index-fy1uK_IR.js";import"./use-passport-id-B-b-_oYF.js";import"./session-Bj1hMOts.js";import"./sdk-BI2up0A5.js";import"./wrap-locale-CVw8KKu9.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D026EX-Z.js";function Q(m){const{searchParams:r}=new URL(window.location.href),{api:a,session:f}=R(),d=N(),{t:h}=P(),n=r.get("id"),c=r.get("redirect"),u=v({state:""}),i=T(async()=>{if(!n)return null;const{data:t}=await a.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),g=p(()=>{if(i.error)throw i.error;return i?.data}),l=p(async(t,o=e=>e)=>{t&&(t.sessionToken&&S(o(t.sessionToken)),t.refreshToken&&E(o(t.refreshToken)),t.visitorId&&j(o(t.visitorId)),await f.refresh()),setTimeout(()=>{if(c){const e=decodeURIComponent(c);e.startsWith(W.WELLKNOWN_SERVICE_PATH_PREFIX)?d(e,{replace:!0}):window.location.href=L(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.loading?s.jsx(x,{}):s.jsxs(I,{did:window.blocklet?.appPid,children:[s.jsx(C,{children:s.jsx("title",{children:h("pageTitle.issuePassport")})}),s.jsx(w,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:s.jsx(k,{...m,action:"issue-passport",getDataFn:g,checkFn:a.get,createPassportSvg:F,onLoginSuccess:l,inService:!0,status:u.state})})]})}export{Q as default};
1
+ import{j as s,p as x,ak as w}from"./vendor-mui-core-Bz-X9hX7.js";import{g as v,k as T,a as p}from"./vendor-hooks-CFpNP5Ql.js";import{I as k}from"./invitation-gz7ZaT6I.js";import{K as I}from"./landing-page-D37ZgHkj.js";import{T as P,w as j}from"./vendor-ux-D2yvD18l.js";import{a as R,s as S,b as E,c as W,H as C,d as F}from"./index-BpP1Znfh.js";import{g as L}from"./get-safe-url-DeteK1Tn.js";import{i as N}from"./vendor-react-x2lQvn4m.js";import"./vendor-utils-Vke2d2wu.js";import"./index-SCzvv_RV.js";import"./index-DmmlDdES.js";import"./use-passport-id-B-b-_oYF.js";import"./session-Ctfgia_m.js";import"./sdk-D8T5YhY1.js";import"./wrap-locale-DRH6wq1d.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-Cvkavi6C.js";function Q(m){const{searchParams:r}=new URL(window.location.href),{api:a,session:f}=R(),d=N(),{t:h}=P(),n=r.get("id"),c=r.get("redirect"),u=v({state:""}),i=T(async()=>{if(!n)return null;const{data:t}=await a.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),g=p(()=>{if(i.error)throw i.error;return i?.data}),l=p(async(t,o=e=>e)=>{t&&(t.sessionToken&&S(o(t.sessionToken)),t.refreshToken&&E(o(t.refreshToken)),t.visitorId&&j(o(t.visitorId)),await f.refresh()),setTimeout(()=>{if(c){const e=decodeURIComponent(c);e.startsWith(W.WELLKNOWN_SERVICE_PATH_PREFIX)?d(e,{replace:!0}):window.location.href=L(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.loading?s.jsx(x,{}):s.jsxs(I,{did:window.blocklet?.appPid,children:[s.jsx(C,{children:s.jsx("title",{children:h("pageTitle.issuePassport")})}),s.jsx(w,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:s.jsx(k,{...m,action:"issue-passport",getDataFn:g,checkFn:a.get,createPassportSvg:F,onLoginSuccess:l,inService:!0,status:u.state})})]})}export{Q as default};