@abtnode/blocklet-services 1.17.8-beta-20260119-034126-467341b7 → 1.17.8-beta-20260121-102603-f9d0176f
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.
- package/dist/assets/{AdapterDayjs-CYW0YvmK.js → AdapterDayjs-QqQc9YbA.js} +1 -1
- package/dist/assets/{Google-DKRt92nm.js → Google-PffSpBc2.js} +1 -1
- package/dist/assets/{LottiePlayer.modern-CeQuigIa.js → LottiePlayer.modern-CE8erevJ.js} +1 -1
- package/dist/assets/access-control-B6JglGtO.js +14 -0
- package/dist/assets/actions-Do5Z9cxZ.js +64 -0
- package/dist/assets/{add-component-core-nc1ps0ni.js → add-component-core-CLOpD7CB.js} +21 -21
- package/dist/assets/add-resource-ipDE-D6W.js +1 -0
- package/dist/assets/{addon-DfWedLEC.js → addon-CrVdMlFe.js} +1 -1
- package/dist/assets/advanced-C3qjZMWH.js +14 -0
- package/dist/assets/{aigne-6nMSoyeQ.js → aigne-CeD5Xo7t.js} +1 -1
- package/dist/assets/api-BMcHDEnt.js +1 -0
- package/dist/assets/appearance-BJuIABu8.js +1 -0
- package/dist/assets/{ar-DOhYGTlW.js → ar-xXK-6slW.js} +1 -1
- package/dist/assets/audit-logs-DxVzMUJK.js +35 -0
- package/dist/assets/authorize-BxQgoA5F.js +1 -0
- package/dist/assets/{base-chart-DcZV4ZCI.js → base-chart-CQOyckBN.js} +1 -1
- package/dist/assets/{base32-7iZvvdX8.js → base32-CyUpiYTu.js} +1 -1
- package/dist/assets/bind-account-D5gBazop.js +1 -0
- package/dist/assets/branding-CDPvtKJm.js +40 -0
- package/dist/assets/{branding-CwSyd5WC.js → branding-CtbvPvdK.js} +3 -3
- package/dist/assets/branding-Dv3-0Q39.js +1 -0
- package/dist/assets/bundle-avatar-2ugE80w1.js +1 -0
- package/dist/assets/button-d8gvZuHP.js +1 -0
- package/dist/assets/{click-to-copy-BgIYUMoo.js → click-to-copy-CgakrWoh.js} +1 -1
- package/dist/assets/{cloneDeep-YxES7wNt.js → cloneDeep-q2Jbqwkh.js} +1 -1
- package/dist/assets/complete-B_lyTPVv.js +39 -0
- package/dist/assets/{component-CuKviNC8.js → component-pjnMydek.js} +37 -37
- package/dist/assets/config-BcCR6bUQ.js +1 -0
- package/dist/assets/config-BsWCoWa6.js +32 -0
- package/dist/assets/{config-D1OcHGlN.js → config-CyDF6KG9.js} +6 -6
- package/dist/assets/{config-navigation-hDihVsjx.js → config-navigation-B36NPLt0.js} +11 -11
- package/dist/assets/{config-space-DfstlHnF.js → config-space-DUkjNtdL.js} +1 -1
- package/dist/assets/{confirm-CdVn5WdC.js → confirm-CoDiNrSj.js} +1 -1
- package/dist/assets/{connect-CT2vMz6l.js → connect--GxmDNr3.js} +3 -3
- package/dist/assets/{connect-Dy0Y8HRB.js → connect-SOuN9k8I.js} +1 -1
- package/dist/assets/connect-ULEL84iL.js +1 -0
- package/dist/assets/connect-to-DnBUF-KE.js +1 -0
- package/dist/assets/{create-passport-svg-hldNORaB.js → create-passport-svg-BSRyjG0k.js} +1 -1
- package/dist/assets/{createClass-CgfWUrk8.js → createClass-DKvdNmc_.js} +1 -1
- package/dist/assets/dashboard-CkDdshHQ.js +93 -0
- package/dist/assets/{de-CtKPdGk6.js → de-CzlQlDUl.js} +1 -1
- package/dist/assets/{delete-confirm-CkiUXocp.js → delete-confirm-Cq9MJasT.js} +1 -1
- package/dist/assets/{did-address-CG36eCOx.js → did-address-CtvTDc_I.js} +1 -1
- package/dist/assets/{domain-CDTeLbkZ.js → domain-BOIdkJ_V.js} +1 -1
- package/dist/assets/domain-action-card-DuiLZ6sE.js +28 -0
- package/dist/assets/domains-C5GLc_A-.js +1 -0
- package/dist/assets/email-DN8lH7fV.js +17 -0
- package/dist/assets/engine-Crd5Z3lP.js +1 -0
- package/dist/assets/{es-BSYtSZPg.js → es-BpsyeJfJ.js} +1 -1
- package/dist/assets/exchange-passport-BvS_8Ud6.js +1 -0
- package/dist/assets/{fallback-D-IHOW-7.js → fallback-CuXkR699.js} +1 -1
- package/dist/assets/{form-Co-tgocU.js → form-CZjONW3r.js} +3 -3
- package/dist/assets/{form-text-input-CPLafaTk.js → form-text-input-BT3t62-a.js} +1 -1
- package/dist/assets/{fr-C35fi7h9.js → fr-BawgvFA1.js} +1 -1
- package/dist/assets/{fuel-BFx1ShM2.js → fuel-dijAR437.js} +1 -1
- package/dist/assets/gen-access-key-DaJCt-T5.js +1 -0
- package/dist/assets/gen-simple-access-key-DLZy8UKi.js +1 -0
- package/dist/assets/get-safe-url-czY77v8f.js +1 -0
- package/dist/assets/hi-ClGNxnSL.js +5 -0
- package/dist/assets/home-ChU7yi5l.js +1 -0
- package/dist/assets/{id-DoVb0JYr.js → id-_HQ0of3E.js} +1 -1
- package/dist/assets/{iframe-DUzp97tk.js → iframe-CYVXxx1r.js} +1 -1
- package/dist/assets/index-5RRpshJe.js +200 -0
- package/dist/assets/index-5Sys1Zsb.js +6 -0
- package/dist/assets/{index-Di2nSesc.js → index-B4A3W4qJ.js} +1 -1
- package/dist/assets/index-B4EOqUNT.js +1 -0
- package/dist/assets/{index-D1Fa760B.js → index-B5VPb4FA.js} +1 -1
- package/dist/assets/{index-C_kNXHsF.js → index-B9YNNXOw.js} +1 -1
- package/dist/assets/index-BDSBuO5S.js +7 -0
- package/dist/assets/{index-2M4w6J9r.js → index-BOoRVhLj.js} +3 -3
- package/dist/assets/{index-Bo9KtpTY.js → index-BVTsYhIX.js} +1 -1
- package/dist/assets/index-Boc2cNQ7.js +150 -0
- package/dist/assets/{index-D6pCyJv8.js → index-C2O2gJSR.js} +1 -1
- package/dist/assets/{index-8RHrVCC6.js → index-C3UXSk-k.js} +1 -1
- package/dist/assets/index-C6vJzTmT.js +81 -0
- package/dist/assets/index-CD7hq5dy.js +124 -0
- package/dist/assets/{index-3H6a5edM.js → index-CNlJloMN.js} +1 -1
- package/dist/assets/{index-D3BuekEe.js → index-CVuESID5.js} +5 -5
- package/dist/assets/{index-CEJb82tA.js → index-CZ-qZTKi.js} +1 -1
- package/dist/assets/{index-VKjWmvRV.js → index-Ci7zZ36D.js} +1 -1
- package/dist/assets/{index-CfvGuvbD.js → index-D7Er4cge.js} +1 -1
- package/dist/assets/{index-C1fKsLzf.js → index-D8oCzSQW.js} +1 -1
- package/dist/assets/{index-BUhEyicQ.js → index-DF1j89BT.js} +1 -1
- package/dist/assets/{index-DH4rC-7M.js → index-DGZbt7_m.js} +1 -1
- package/dist/assets/index-DKeuwD_Y.js +242 -0
- package/dist/assets/{index-DFUM0Pvk.js → index-Dn9eNAe6.js} +1 -1
- package/dist/assets/index-DswHt4-F.js +88 -0
- package/dist/assets/{index-DqcciDRh.js → index-Dvc-Bpkc.js} +2 -2
- package/dist/assets/index-NHiSMvgy.js +120 -0
- package/dist/assets/{index-Cx0E03Bs.js → index-WzGP4BGm.js} +1 -1
- package/dist/assets/{index-CqCXPf7W.js → index-Zxy2t-7f.js} +1 -1
- package/dist/assets/index-iOa1BVMr.js +280 -0
- package/dist/assets/index-s8xAfo-W.js +1 -0
- package/dist/assets/index-tRQj1y79.js +6 -0
- package/dist/assets/{index-ZzcJ7eKO.js → index-uUS1eXYF.js} +1 -1
- package/dist/assets/index-yoaLEniz.js +832 -0
- package/dist/assets/info-outline-rounded-DovRYvXo.js +1 -0
- package/dist/assets/{invitation-BP8hOEFv.js → invitation-DAWt0g1f.js} +3 -3
- package/dist/assets/{invitations-C8aZLxdl.js → invitations-B18y415k.js} +2 -2
- package/dist/assets/invite-DNSyQ-zG.js +1 -0
- package/dist/assets/issue-passport-Dd43b9Se.js +1 -0
- package/dist/assets/item-Cr70mAvV.js +1 -0
- package/dist/assets/{ja-DZPUwZ9l.js → ja-LErFaY57.js} +1 -1
- package/dist/assets/{ko-q4i4r9g6.js → ko-D4ub28je.js} +1 -1
- package/dist/assets/{landing-page-JLA-ZD1t.js → landing-page-CZoTtLnc.js} +1 -1
- package/dist/assets/layout-U4Obhm5w.js +29 -0
- package/dist/assets/list-BD3g0v2E.js +2 -0
- package/dist/assets/{list-3MUy-8Ol.js → list-D-9AeBju.js} +3 -3
- package/dist/assets/localization-ByZI4mSj.js +1 -0
- package/dist/assets/{log-Bq445Z1e.js → log-BWxaKOTA.js} +1 -1
- package/dist/assets/logger-B962sOsB.js +1 -0
- package/dist/assets/login-BWZaWrBW.js +1 -0
- package/dist/assets/login-method-item-aEisznLn.js +1 -0
- package/dist/assets/{login-oauth-callback-Bext19kc.js → login-oauth-callback-CB-osgdG.js} +1 -1
- package/dist/assets/{logo-uploader-CyZuvhwV.js → logo-uploader-DOPycN59.js} +1 -1
- package/dist/assets/{lost-passport-BiYg3QQI.js → lost-passport-H1fCptmJ.js} +2 -2
- package/dist/assets/metadata-DftwYKum.js +55 -0
- package/dist/assets/{nav-menu-DSdXRbfg.js → nav-menu-D7Sf6VZj.js} +1 -1
- package/dist/assets/{omit-Dq0FLBY8.js → omit-vVhnMpHQ.js} +1 -1
- package/dist/assets/{open-window-Dyu79ome.js → open-window-By98Pw1o.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-DzUsy6q0.js → over-due-invoice-payment-DeFNS-Us.js} +1 -1
- package/dist/assets/overview-DEkktSML.js +116 -0
- package/dist/assets/passport-BxMVp3TG.js +1 -0
- package/dist/assets/passport-item-CIv8Q8Ng.js +1 -0
- package/dist/assets/{permission-CvrrGfG6.js → permission-B22pCnUb.js} +1 -1
- package/dist/assets/preferences-BY_s4EkY.js +1 -0
- package/dist/assets/profile-embed-DUKyv_oX.js +1 -0
- package/dist/assets/provider-icon-DbnLu_85.js +1 -0
- package/dist/assets/pt-BU7pvSz6.js +5 -0
- package/dist/assets/{publish-resource-CMuHIOUf.js → publish-resource-Be5Gs98x.js} +1 -1
- package/dist/assets/{react-beautiful-dnd.esm-CWJ5I9Zv.js → react-beautiful-dnd.esm-D7zp9L4b.js} +1 -1
- package/dist/assets/ru-CtjyU-qF.js +5 -0
- package/dist/assets/{runtime-B_ZLP4FF.js → runtime-MjoLSEeg.js} +1 -1
- package/dist/assets/{sanitize-Bzl4lTuH.js → sanitize-BHeUjEo7.js} +1 -1
- package/dist/assets/sdk-Dy-R7tw7.js +1 -0
- package/dist/assets/security-BtD9TnGk.js +22 -0
- package/dist/assets/session-UEzmH-IS.js +1 -0
- package/dist/assets/setup-Bts0WUxD.js +24 -0
- package/dist/assets/simple-select-C6gRUbia.js +1 -0
- package/dist/assets/{spaces-ix8u0ZiI.js → spaces-DtMVp8Fn.js} +1 -1
- package/dist/assets/start-Dabk9waT.js +187 -0
- package/dist/assets/{starting-progress-CWp5fTY0.js → starting-progress-Ds2lnMge.js} +1 -1
- package/dist/assets/{status-Dn_LKaNp.js → status-CicPnfGJ.js} +1 -1
- package/dist/assets/{step-actions-DIZRcnXf.js → step-actions-CnJCnymc.js} +1 -1
- package/dist/assets/{studio-CVIa8-XY.js → studio-D7qZJqJ7.js} +1 -1
- package/dist/assets/{switch-control-BRjXGc1d.js → switch-control-C5gj6NIz.js} +1 -1
- package/dist/assets/{switch-BbyTGEOo.js → switch-qh9YpwMi.js} +1 -1
- package/dist/assets/{table-tips-Dvmdodc5.js → table-tips-BSl1oNMX.js} +1 -1
- package/dist/assets/team-Djzt5BWc.js +146 -0
- package/dist/assets/th-C0DkNnMF.js +5 -0
- package/dist/assets/theme-mode-toggle-Jvn37gNg.js +1 -0
- package/dist/assets/traffic-BtuX1qMz.js +1 -0
- package/dist/assets/transfer-UdrQjD9F.js +16 -0
- package/dist/assets/unsubscribe-Bj2S8OkH.js +1 -0
- package/dist/assets/{use-app-logo-IRizt64R.js → use-app-logo-DyU2iSXF.js} +1 -1
- package/dist/assets/{use-blocklet-logo-Cf1j7pQz.js → use-blocklet-logo-ys-h-CV_.js} +1 -1
- package/dist/assets/{use-window-close-Dpj5UcYT.js → use-window-close-CT9brY7I.js} +1 -1
- package/dist/assets/{useAsync-CkKfnulP.js → useAsync-DbIyJl2v.js} +1 -1
- package/dist/assets/{useAsync-DfiOQMQ_.js → useAsync-WuOY1bFS.js} +1 -1
- package/dist/assets/{useAsyncRetry-C4R9ufi-.js → useAsyncRetry-cAGDIsw4.js} +1 -1
- package/dist/assets/{useLocalStorage-BQfIniHX.js → useLocalStorage-D8kgfBAn.js} +1 -1
- package/dist/assets/{user-center-6K47tx8j.js → user-center-DLgnUI1s.js} +5 -5
- package/dist/assets/{user-follower-BwzTutxU.js → user-follower-BbQfOSyh.js} +4 -4
- package/dist/assets/util-BCpVIbwL.js +1 -0
- package/dist/assets/util-tg9hB6_c.js +1 -0
- package/dist/assets/{vendor-arcblock-Dll6qxMT.js → vendor-arcblock-Xw2zMy0D.js} +1 -1
- package/dist/assets/{vendor-hooks-DAZ1H6Va.js → vendor-hooks-164oA5kM.js} +1 -1
- package/dist/assets/vendor-utils-BbcnEeJI.js +23 -0
- package/dist/assets/{vendor-ux-CLT2i3Pv.js → vendor-ux-BGqHwkOM.js} +10 -10
- package/dist/assets/vi-nXB9zTif.js +5 -0
- package/dist/assets/wait-connect-BED_xYYA.js +1 -0
- package/dist/assets/wallet-hidden-topbar-dnCLvPpW.js +68 -0
- package/dist/assets/wizard-C6DvqdjM.js +8 -0
- package/dist/assets/wizard-components-1u7l8zuE.js +52 -0
- package/dist/assets/wrap-locale-C2lxMNe7.js +1 -0
- package/dist/assets/{zh-G2I44gfs.js → zh-DK-_Edsp.js} +1 -1
- package/dist/assets/zh-QEwKQjt8.js +1 -0
- package/dist/assets/{zh-tw-C4Juvs-i.js → zh-tw-Us2SjBNr.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +24 -24
- package/dist/assets/access-control-RI6LQbSm.js +0 -14
- package/dist/assets/actions-BlWED76c.js +0 -64
- package/dist/assets/add-resource-BVOdOQSW.js +0 -1
- package/dist/assets/advanced-CuKHqbLO.js +0 -14
- package/dist/assets/api-B8JXuhVp.js +0 -1
- package/dist/assets/appearance-C9TkbSjV.js +0 -1
- package/dist/assets/audit-logs-DKGke9hI.js +0 -35
- package/dist/assets/authorize-DkSqywe8.js +0 -1
- package/dist/assets/bind-account-DOwM9Nhe.js +0 -1
- package/dist/assets/branding-Cak2s8bn.js +0 -1
- package/dist/assets/branding-lcfxmmPp.js +0 -40
- package/dist/assets/bundle-avatar-DwiOyeMO.js +0 -1
- package/dist/assets/button-uUU4Wycr.js +0 -1
- package/dist/assets/complete-Udiv_yFp.js +0 -39
- package/dist/assets/config-6IwEgT3b.js +0 -32
- package/dist/assets/config-CJwxv2uK.js +0 -1
- package/dist/assets/connect-DA7RO2yv.js +0 -1
- package/dist/assets/connect-to-CQMUbQkH.js +0 -1
- package/dist/assets/dashboard-BvI3ii8Z.js +0 -93
- package/dist/assets/domain-action-card-kMPYS2Nj.js +0 -28
- package/dist/assets/domains-TI6o1CvX.js +0 -1
- package/dist/assets/email-DHRHueET.js +0 -17
- package/dist/assets/engine-D_fEFx9_.js +0 -1
- package/dist/assets/exchange-passport-Cc872mjQ.js +0 -1
- package/dist/assets/gen-access-key-DrgLVRbm.js +0 -1
- package/dist/assets/gen-simple-access-key-B24d6k7g.js +0 -1
- package/dist/assets/get-safe-url-beob4f2C.js +0 -1
- package/dist/assets/hi-5fpYJkiW.js +0 -5
- package/dist/assets/home-Dw18IODa.js +0 -1
- package/dist/assets/index--WQuhwJL.js +0 -6
- package/dist/assets/index-B-8044Gs.js +0 -280
- package/dist/assets/index-B6l4xGy5.js +0 -7
- package/dist/assets/index-BOPR4Iyc.js +0 -88
- package/dist/assets/index-BeunkI-Z.js +0 -242
- package/dist/assets/index-Bpic07NM.js +0 -200
- package/dist/assets/index-C4ZzROeE.js +0 -120
- package/dist/assets/index-CXp5SI_f.js +0 -832
- package/dist/assets/index-DKzBOJCu.js +0 -81
- package/dist/assets/index-DL0wTcgx.js +0 -1
- package/dist/assets/index-DWHFecw2.js +0 -150
- package/dist/assets/index-DcW3jqfL.js +0 -6
- package/dist/assets/index-Vf51dp11.js +0 -124
- package/dist/assets/index-bEFOmVth.js +0 -1
- package/dist/assets/info-outline-rounded-DlgANjBB.js +0 -1
- package/dist/assets/invite-Cd5zEHFb.js +0 -1
- package/dist/assets/issue-passport-D7zqv3Al.js +0 -1
- package/dist/assets/item-DNj7ORqk.js +0 -1
- package/dist/assets/layout-Cwvm7lmD.js +0 -29
- package/dist/assets/list-BSXHuqLM.js +0 -2
- package/dist/assets/localization-Dond4H78.js +0 -1
- package/dist/assets/logger-CCAAJ2Xo.js +0 -1
- package/dist/assets/login-dc2t9Qyo.js +0 -1
- package/dist/assets/login-method-item-CyTsqz88.js +0 -1
- package/dist/assets/metadata-B2-Ltdko.js +0 -55
- package/dist/assets/overview-0TBmi-_i.js +0 -116
- package/dist/assets/passport-BhEaZ-sr.js +0 -1
- package/dist/assets/passport-item-DHwif94N.js +0 -1
- package/dist/assets/preferences-BBSWzZiT.js +0 -1
- package/dist/assets/profile-embed-shcOdRUI.js +0 -1
- package/dist/assets/provider-icon-DO2PqSth.js +0 -1
- package/dist/assets/pt-BFCHl6F1.js +0 -5
- package/dist/assets/ru-CSTl62kK.js +0 -5
- package/dist/assets/sdk-CktKu_IW.js +0 -1
- package/dist/assets/security-DHRU8k0u.js +0 -22
- package/dist/assets/session-Bp3LV7zJ.js +0 -1
- package/dist/assets/setup-B6-Ei_3X.js +0 -24
- package/dist/assets/simple-select-nI-W90c_.js +0 -1
- package/dist/assets/start-oRp78RMQ.js +0 -187
- package/dist/assets/team-BTz28XqK.js +0 -146
- package/dist/assets/th-D75Dlluo.js +0 -5
- package/dist/assets/theme-mode-toggle-D3bcd10D.js +0 -1
- package/dist/assets/traffic-Cea69sMW.js +0 -1
- package/dist/assets/transfer-BydXCVCg.js +0 -16
- package/dist/assets/unsubscribe-BjAjx-Fl.js +0 -1
- package/dist/assets/util-DkTwHdRu.js +0 -1
- package/dist/assets/util-DySzCymV.js +0 -1
- package/dist/assets/vendor-utils-BzQg432x.js +0 -23
- package/dist/assets/vi-D1mKYrmb.js +0 -5
- package/dist/assets/wait-connect-q0_7mz_u.js +0 -1
- package/dist/assets/wallet-hidden-topbar-joIVZ1nl.js +0 -68
- package/dist/assets/wizard-C5Kl-g70.js +0 -8
- package/dist/assets/wizard-components-DQrlaeeW.js +0 -52
- package/dist/assets/wrap-locale-5DJTJTXP.js +0 -1
- package/dist/assets/zh-CJ9vCpmv.js +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import{V as $,y as P,F as me,bD as ke,dg as Lt,dh as Ct,b2 as le,ai as N,aG as we,b3 as H,U as Q,di as Dt,dj as It,b9 as qe,dk as Tt,aJ as At,ba as Ne}from"./vendor-ux-BGqHwkOM.js";import{b as g,a as ne,h as Pt,i as je,f as Ot}from"./vendor-hooks-164oA5kM.js";import{r as L,L as Ft}from"./vendor-react-DX7tU9aY.js";import{j as e,al as m,z as _,A as E,X as u,bK as X,R as Y,T as te,I as pe,a4 as he,G as Le,b3 as V,cr as Ve,ct as Ee,d$ as qt,aT as Je,ai as Ge,e0 as Ke,a7 as Be,an as Et,e1 as Bt,bb as zt,d1 as Rt,d2 as Wt,dW as Ut,bB as Nt,bR as Vt,d3 as _t,V as Ze,Z as Mt,b1 as Ht,a0 as $t,bN as Jt,M as Gt,S as Kt,e2 as Zt}from"./vendor-mui-core-CV-FnYH_.js";import{M as ae}from"./provider-icon-DbnLu_85.js";import{x as se,n as B,z as re,G as _e,F as Ye,b as xe,$ as Qe,aD as Yt,a as Xe}from"./vendor-utils-BbcnEeJI.js";import{X as G,V as J,W as be,cB as ze,L as Qt,av as et,cK as Xt,cL as en,bm as tn,F as Re,j as nn}from"./index-yoaLEniz.js";import{u as ie,C as A,a as Me}from"./index.esm-C4tuRtuv.js";import{S as D}from"./section-CZylgxjz.js";import{S as on}from"./switch-control-C5gj6NIz.js";import{d as an,a as sn}from"./edit-rounded-CnMn6J-D.js";import{S as rn}from"./simple-select-C6gRUbia.js";import{u as tt}from"./index-B9YNNXOw.js";import{v as ln}from"./index-B4A3W4qJ.js";import{r as cn}from"./base32-CyUpiYTu.js";import{C as dn}from"./click-to-copy-CgakrWoh.js";import{u as un}from"./use-mobile-DwGMuJlg.js";import"./google-icon-vNOJy67F.js";import"./passkey-rounded-_WDHIZVd.js";import"./vendor-arcblock-Xw2zMy0D.js";import"./required-DnQpCGsD.js";import"./arrow-down.svg-Dz9H9vM-.js";const Ce={domain:"",clientId:"",clientSecret:""};function nt({ref:r=null,onSuccess:s=B,sortMaps:c={}}){const{api:i}=G(),{blocklet:n}=J(),{t,locale:l}=$(),d=n?.meta?.did,f=Object.assign({...Ce},n?.settings?.authentication?.auth0||{}),h=(n.environments||[]).find(a=>a.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:y,control:w,formState:p,reset:b}=ie({defaultValues:se(f,Object.keys(Ce))}),x=g(async a=>{try{const{blocklet:o}=await i.configAuthentication({input:{did:d,authentication:JSON.stringify({...c,auth0:{...a,order:c.auth0?.order??Object.keys(c).length,enabled:!0,type:"oauth"}})}}),C=Object.assign({...Ce},o?.settings?.authentication?.auth0||{});b(C),P.success(t("common.saveSuccess")),s()}catch(o){P.error(o.message||t("common.saveFailed"))}}),I=g(a=>a?.trim()?!0:t("authentication.auth0.domainDescription")),S=g(a=>a?.trim()?!0:t("authentication.auth0.clientIdDescription")),T=g(a=>a?.trim()?!0:t("authentication.auth0.clientSecretDescription")),v=ne(()=>l==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[l]),j=re(h,be,"oauth/callback/auth0");return L.useImperativeHandle(r,()=>({submit:y(x)}),[y,x]),e.jsx(m,{children:e.jsxs("form",{onSubmit:y(x),disabled:!0,children:[e.jsx(D,{title:t("authentication.viewDocument"),children:e.jsxs(m,{component:"a",href:v,target:"_blank",rel:"noopener noreferrer",sx:{verticalAlign:"middle",color:"inherit",fontSize:"14px","&:hover":{textDecoration:"underline"}},children:[v,e.jsx(m,{component:me,icon:ze,sx:{marginLeft:"6px",verticalAlign:"middle",lineHeight:1,scale:1.1}})]})}),e.jsx(D,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[j,e.jsx(ke,{locale:l,content:j,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(D,{title:t("authentication.auth0.domain"),children:e.jsx(A,{name:"domain",control:w,rules:{validate:I},render:({field:a})=>e.jsx(_,{fullWidth:!0,children:e.jsx(E,{...a,size:"small",label:t("authentication.auth0.domain"),error:!!p.errors[a.name],helperText:p.errors[a.name]?.message||" "})})})}),e.jsx(D,{title:t("authentication.auth0.clientId"),children:e.jsx(A,{name:"clientId",control:w,rules:{validate:S},render:({field:a})=>e.jsx(_,{fullWidth:!0,children:e.jsx(E,{...a,size:"small",label:t("authentication.auth0.clientId"),error:!!p.errors[a.name],helperText:p.errors[a.name]?.message||" "})})})}),e.jsx(D,{title:t("authentication.auth0.clientSecret"),children:e.jsx(A,{name:"clientSecret",control:w,rules:{validate:T},render:({field:a})=>e.jsx(_,{fullWidth:!0,children:e.jsx(E,{...a,size:"small",type:"password",label:t("authentication.auth0.clientSecret"),error:!!p.errors[a.name],helperText:p.errors[a.name]?.message||" "})})})})]})})}nt.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};const De={clientId:"",clientSecret:""};function it({ref:r=null,onSuccess:s=B,sortMaps:c={}}){const{api:i}=G(),{blocklet:n}=J(),{t,locale:l}=$(),d=n?.meta?.did,f=Object.assign({...De},n?.settings?.authentication?.github||{}),h=(n.environments||[]).find(j=>j.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:y,control:w,formState:p,reset:b}=ie({defaultValues:se(f,Object.keys(De))}),x=g(async j=>{try{const{blocklet:a}=await i.configAuthentication({input:{did:d,authentication:JSON.stringify({...c,github:{...j,order:c.github?.order??Object.keys(c).length,enabled:!0,type:"oauth"}})}}),o=Object.assign({...De},a?.settings?.authentication?.github||{});b(o),P.success(t("common.saveSuccess")),s()}catch(a){P.error(a.message||t("common.saveFailed"))}}),I=g(j=>j?.trim()?!0:t("authentication.github.clientIdDescription")),S=g(j=>j?.trim()?!0:t("authentication.github.clientSecretDescription")),T=ne(()=>l==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[l]),v=re(h,be,"oauth/callback/github");return L.useImperativeHandle(r,()=>({submit:y(x)}),[y,x]),e.jsx(m,{children:e.jsxs("form",{disabled:!0,children:[e.jsx(D,{title:t("authentication.viewDocument"),children:e.jsxs(m,{component:"a",href:T,target:"_blank",rel:"noopener noreferrer",sx:{verticalAlign:"middle",color:"inherit",fontSize:"14px","&:hover":{textDecoration:"underline"}},children:[T,e.jsx(m,{component:me,icon:ze,sx:{marginLeft:"6px",verticalAlign:"middle",lineHeight:1,scale:1.1}})]})}),e.jsx(D,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[v,e.jsx(ke,{locale:l,content:v,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(D,{title:t("authentication.github.clientId"),children:e.jsx(A,{name:"clientId",control:w,rules:{validate:I},render:({field:j})=>e.jsx(_,{fullWidth:!0,children:e.jsx(E,{...j,size:"small",label:t("authentication.github.clientId"),error:!!p.errors[j.name],helperText:p.errors[j.name]?.message||" "})})})}),e.jsx(D,{title:t("authentication.github.clientSecret"),children:e.jsx(A,{name:"clientSecret",control:w,rules:{validate:S},render:({field:j})=>e.jsx(_,{fullWidth:!0,children:e.jsx(E,{...j,size:"small",type:"password",label:t("authentication.github.clientSecret"),error:!!p.errors[j.name],helperText:p.errors[j.name]?.message||" "})})})})]})})}it.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};const Ie={showQrcode:!0};function ot({ref:r=null,onSuccess:s=B,sortMaps:c={}}){const{api:i}=G(),{blocklet:n}=J(),{t}=$(),l=n?.meta?.did,d=Object.assign({...Ie},n?.settings?.authentication?.wallet||{}),{handleSubmit:f,control:h,reset:y}=ie({defaultValues:se(d,Object.keys(Ie))}),w=g(async p=>{try{const{blocklet:b}=await i.configAuthentication({input:{did:l,authentication:JSON.stringify({...c,wallet:{...p,order:c.wallet?.order??Object.keys(c).length,enabled:!0,type:"builtin"}})}}),x=Object.assign({...Ie},b?.settings?.authentication?.wallet||{});y(x),P.success(t("common.saveSuccess")),s()}catch(b){P.error(b.message||t("common.saveFailed"))}});return L.useImperativeHandle(r,()=>({submit:f(w)}),[f,w]),e.jsx(m,{children:e.jsx("form",{children:e.jsx(D,{title:t("authentication.wallet.showQrcode"),children:e.jsx(A,{name:"showQrcode",control:h,render:({field:p})=>e.jsx(X,{control:e.jsx(on,{sx:{ml:1},checked:p.value,...p})})})})})})}ot.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};function at({ref:r=null,onSuccess:s=B,sortMaps:c={}}){const{api:i,inService:n}=G(),{blocklet:t}=J(),{t:l}=$(),d=t?.meta?.did,f=g(async()=>{try{await i.configAuthentication({input:{did:d,authentication:JSON.stringify({...c,email:{order:c.email?.order??Object.keys(c).length,enabled:!0,type:"builtin"}})}}),P.success(l("common.saveSuccess")),s()}catch(y){P.error(y.message||l("common.saveFailed"))}}),h=ne(()=>n?_e(re(Qt,"/notification/settings"),{type:"email"}):_e(re("/blocklets",t.appPid,"/configuration"),{tab:"notification",type:"email"}),[n,t.appPid]);return L.useImperativeHandle(r,()=>({submit:f}),[f]),e.jsxs(m,{children:[l("authentication.emailLoginDescription"),e.jsx("br",{}),l("authentication.emailNotificationRequired"),e.jsx("br",{}),e.jsx(m,{component:Ft,to:h,sx:{mt:1,display:"inline-block"},children:e.jsx(Y,{size:"small",variant:"outlined",children:l("authentication.gotoEmailNotification")})})]})}at.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};function st({ref:r=null,onSuccess:s=B,sortMaps:c={}}){const{api:i}=G(),{blocklet:n}=J(),{t}=$(),l=n?.meta?.did,d=g(async()=>{try{await i.configAuthentication({input:{did:l,authentication:JSON.stringify({...c,passkey:{order:c.passkey?.order??Object.keys(c).length,enabled:!0,type:"builtin"}})}}),P.success(t("common.saveSuccess")),s()}catch(f){P.error(f.message||t("common.saveFailed"))}});return L.useImperativeHandle(r,()=>({submit:d}),[d]),null}st.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};const Te={clientId:"",clientSecret:""};function rt({ref:r=null,onSuccess:s=B,sortMaps:c={}}){const{api:i}=G(),{blocklet:n}=J(),{t,locale:l}=$(),d=n?.meta?.did,f=Object.assign({...Te},n?.settings?.authentication?.google||{}),h=(n.environments||[]).find(j=>j.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:y,control:w,formState:p,reset:b}=ie({defaultValues:se(f,Object.keys(Te))}),x=g(async j=>{try{const{blocklet:a}=await i.configAuthentication({input:{did:d,authentication:JSON.stringify({...c,google:{...j,order:c.google?.order??Object.keys(c).length,enabled:!0,type:"oauth"}})}}),o=Object.assign({...Te},a?.settings?.authentication?.google||{});b(o),P.success(t("common.saveSuccess")),s()}catch(a){P.error(a.message||t("common.saveFailed"))}}),I=g(j=>j?.trim()?!0:t("authentication.google.clientIdDescription")),S=g(j=>j?.trim()?!0:t("authentication.google.clientSecretDescription")),T=ne(()=>l==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[l]),v=re(h,be,"oauth/callback/google");return L.useImperativeHandle(r,()=>({submit:y(x)}),[y,x]),e.jsx(m,{children:e.jsxs("form",{onSubmit:y(x),disabled:!0,children:[e.jsx(D,{title:t("authentication.viewDocument"),children:e.jsxs(m,{component:"a",href:T,target:"_blank",rel:"noopener noreferrer",sx:{verticalAlign:"middle",color:"inherit",fontSize:"14px","&:hover":{textDecoration:"underline"}},children:[T,e.jsx(m,{component:me,icon:ze,sx:{marginLeft:"6px",verticalAlign:"middle",lineHeight:1,scale:1.1}})]})}),e.jsx(D,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[v,e.jsx(ke,{locale:l,content:v,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(D,{title:t("authentication.google.clientId"),children:e.jsx(A,{name:"clientId",control:w,rules:{validate:I},render:({field:j})=>e.jsx(_,{fullWidth:!0,children:e.jsx(E,{...j,size:"small",label:t("authentication.google.clientId"),error:!!p.errors[j.name],helperText:p.errors[j.name]?.message||" "})})})}),e.jsx(D,{title:t("authentication.google.clientSecret"),children:e.jsx(A,{name:"clientSecret",control:w,rules:{validate:S},render:({field:j})=>e.jsx(_,{fullWidth:!0,children:e.jsx(E,{...j,size:"small",type:"password",label:t("authentication.google.clientSecret"),error:!!p.errors[j.name],helperText:p.errors[j.name]?.message||" "})})})})]})})}rt.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};const Ae={teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function lt({ref:r=null,onSuccess:s=B,sortMaps:c={}}){const{api:i}=G(),{blocklet:n}=J(),{t,locale:l}=$(),d=n?.meta?.did,f=Object.assign({...Ae},n?.settings?.authentication?.apple||{}),h=(n.environments||[]).find(o=>o.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:y,control:w,formState:p,reset:b}=ie({defaultValues:se(f,Object.keys(Ae))}),x=g(async o=>{try{const{blocklet:C}=await i.configAuthentication({input:{did:d,authentication:JSON.stringify({...c,apple:{...o,order:c.apple?.order??Object.keys(c).length,enabled:!0,type:"oauth"}})}}),R=Object.assign({...Ae},C?.settings?.authentication?.apple||{});b(R),P.success(t("common.saveSuccess")),s()}catch(C){P.error(C.message||t("common.saveFailed"))}}),I=g(o=>o?.trim()?!0:t("authentication.apple.teamIdDescription")),S=g(o=>o?.trim()?!0:t("authentication.apple.serviceIdDescription")),T=g(o=>o?.trim()?!0:t("authentication.apple.keyIdDescription")),v=g(o=>o?.trim()?!0:t("authentication.apple.authKeyDescription")),j=g(o=>o?.trim()?!0:t("authentication.apple.bundleIdDescription")),a=re(h,be,"oauth/callback/apple");return L.useImperativeHandle(r,()=>({submit:y(x)}),[y,x]),e.jsx(m,{children:e.jsxs("form",{children:[e.jsx(D,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[a,e.jsx(ke,{locale:l,content:a,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(D,{title:t("authentication.apple.teamId"),children:e.jsx(A,{name:"teamId",control:w,rules:{validate:I},render:({field:o})=>e.jsx(_,{fullWidth:!0,children:e.jsx(E,{...o,size:"small",label:t("authentication.apple.teamId"),error:!!p.errors[o.name],helperText:p.errors[o.name]?.message||" "})})})}),e.jsx(D,{title:t("authentication.apple.bundleId"),children:e.jsx(A,{name:"bundleId",control:w,rules:{validate:j},render:({field:o})=>e.jsx(_,{fullWidth:!0,children:e.jsx(E,{...o,size:"small",label:t("authentication.apple.bundleId"),error:!!p.errors[o.name],helperText:p.errors[o.name]?.message||" "})})})}),e.jsx(D,{title:t("authentication.apple.serviceId"),children:e.jsx(A,{name:"serviceId",control:w,rules:{validate:S},render:({field:o})=>e.jsx(_,{fullWidth:!0,children:e.jsx(E,{...o,size:"small",label:t("authentication.apple.serviceId"),error:!!p.errors[o.name],helperText:p.errors[o.name]?.message||" "})})})}),e.jsx(D,{title:t("authentication.apple.keyId"),children:e.jsx(A,{name:"keyId",control:w,rules:{validate:T},render:({field:o})=>e.jsx(_,{fullWidth:!0,children:e.jsx(E,{...o,size:"small",label:t("authentication.apple.keyId"),error:!!p.errors[o.name],helperText:p.errors[o.name]?.message||" "})})})}),e.jsx(D,{title:t("authentication.apple.authKey"),children:e.jsx(A,{name:"authKey",control:w,rules:{validate:v},render:({field:o})=>e.jsx(_,{fullWidth:!0,children:e.jsx(E,{...o,size:"small",type:"password",label:t("authentication.apple.authKey"),multiline:!0,rows:4,error:!!p.errors[o.name],helperText:p.errors[o.name]?.message||" ",slotProps:{input:{sx:{WebkitTextSecurity:"disc",fontFamily:"text-security-disc, monospace"}}}})})})})]})})}lt.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};const Pe={clientId:"",clientSecret:""};function ct({ref:r=null,onSuccess:s=B,sortMaps:c={}}){const{api:i}=G(),{blocklet:n}=J(),{t,locale:l}=$(),d=n?.meta?.did,f=Object.assign({...Pe},n?.settings?.authentication?.twitter||{}),h=(n.environments||[]).find(v=>v.key==="BLOCKLET_APP_URL")?.value||window.location.origin,{handleSubmit:y,control:w,formState:p,reset:b}=ie({defaultValues:se(f,Object.keys(Pe))}),x=g(async v=>{try{const{blocklet:j}=await i.configAuthentication({input:{did:d,authentication:JSON.stringify({...c,twitter:{...v,order:c.twitter?.order??Object.keys(c).length,enabled:!0,type:"oauth"}})}}),a=Object.assign({...Pe},j?.settings?.authentication?.twitter||{});b(a),P.success(t("common.saveSuccess")),s()}catch(j){P.error(j.message||t("common.saveFailed"))}}),I=g(v=>v?.trim()?!0:t("authentication.twitter.clientIdDescription")),S=g(v=>v?.trim()?!0:t("authentication.twitter.clientSecretDescription")),T=re(h,be,"oauth/callback/twitter");return L.useImperativeHandle(r,()=>({submit:y(x)}),[y,x]),e.jsx(m,{children:e.jsxs("form",{onSubmit:y(x),disabled:!0,children:[e.jsx(D,{title:t("authentication.oauthCallbackUrl"),children:e.jsxs(m,{sx:{mb:1,verticalAlign:"middle",fontSize:"14px",wordBreak:"break-all"},children:[T,e.jsx(ke,{locale:l,content:T,style:{marginLeft:"6px",verticalAlign:"middle",scale:.8,lineHeight:1}})]})}),e.jsx(D,{title:t("authentication.twitter.clientId"),children:e.jsx(A,{name:"clientId",control:w,rules:{validate:I},render:({field:v})=>e.jsx(_,{fullWidth:!0,children:e.jsx(E,{...v,size:"small",label:t("authentication.twitter.clientId"),error:!!p.errors[v.name],helperText:p.errors[v.name]?.message||" "})})})}),e.jsx(D,{title:t("authentication.twitter.clientSecret"),children:e.jsx(A,{name:"clientSecret",control:w,rules:{validate:S},render:({field:v})=>e.jsx(_,{fullWidth:!0,children:e.jsx(E,{...v,size:"small",type:"password",label:t("authentication.twitter.clientSecret"),error:!!p.errors[v.name],helperText:p.errors[v.name]?.message||" "})})})})]})})}ct.propTypes={ref:u.any,onSuccess:u.func,sortMaps:u.object};const mn={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function dt({id:r,title:s,index:c,onBegin:i=B,onMove:n,onEnd:t,onEditItem:l=B,onDeleteItem:d=B,disableDelete:f=!1,icon:h=null}){const y=L.useRef(null),w=L.useRef(null),[{handlerId:p},b]=Lt({accept:"dragItem",collect(T){return{handlerId:T.getHandlerId()}},hover(T,v){if(!y.current)return;const j=T.index,a=c;if(j===a)return;const o=y.current?.getBoundingClientRect(),C=w.current?.getBoundingClientRect(),R=(C.bottom-C.top)/2,ge=v.getClientOffset().y-o.top;j<a&&ge<R||j>a&&ge>R||(n(j,a),T.index=a)}}),[{isDragging:x},I]=Ct({item:{index:c,type:"dragItem"},collect:T=>({isDragging:T.isDragging()}),begin:i,end:t});I(w),b(y);const S=x?.3:1;return e.jsx(m,{ref:y,children:e.jsxs(m,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:w,"data-handler-id":p,children:[e.jsxs(m,{sx:{py:2,px:1,opacity:S,display:"flex",alignItems:"center",gap:.5},draggable:!1,children:[e.jsx(m,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(me,{fontSize:20,icon:mn})}),e.jsx(m,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:h}),e.jsx(te,{sx:{flex:1},children:s}),e.jsx(pe,{size:"small",color:"primary",onClick:()=>{l(r)},children:e.jsx(me,{icon:an})}),e.jsx(pe,{size:"small",color:"error",onClick:()=>{d(r)},disabled:f,children:e.jsx(me,{icon:sn})})]}),e.jsx(he,{})]})})}dt.propTypes={title:u.string.isRequired,id:u.string.isRequired,index:u.number.isRequired,onBegin:u.func,onMove:u.func.isRequired,onEnd:u.func.isRequired,onEditItem:u.func,onDeleteItem:u.func,disableDelete:u.bool,icon:u.any};function ut({ref:r=null,providers:s=[],sortMaps:c={}}){const i=L.useRef(null),{t:n}=L.useContext(le),t=Le(),{control:l,watch:d,setValue:f,reset:h}=ie({mode:"onChange",defaultValues:{provider:""}}),y=d("provider"),w=s.find(a=>a.name===y),p=Pt(w),b=t?.transitions?.duration?.leavingScreen||300,x=je({initMode:"add",mode:"add",show:!1,callback:B,get dialogTitle(){return this.mode==="edit"?n("authentication.updateLoginProvider",{provider:p.current?.title}):n("authentication.addLoginProvider")}}),I=g(()=>{h(),x.mode="add",x.initMode="add"}),S=g(()=>{x.show=!1,setTimeout(()=>{I()},b)}),T=g((a,o=null)=>{if(x.show=!0,o)x.initMode="edit",x.mode="edit",f("provider",o.provider);else{const C=s.find(R=>R.enabled===!1)?.name||s[0]?.name||N.WALLET;f("provider",C)}a?x.callback=a:x.callback=B});L.useImperativeHandle(r,()=>({open:T,close:S}),[T,S]);const v=g(()=>{i.current.submit()}),j=s.map(a=>({value:a.name,title:a.title,description:a.enabled?n("common.enabled"):""}));return L.useEffect(()=>{w?.enabled?x.mode="edit":x.mode="add"},[w?.enabled]),e.jsxs(we,{open:x.show,title:x.dialogTitle,onClose:S,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(H,{color:"primary",autoFocus:!0,variant:"contained",onClick:v,disabled:!y,children:x.mode==="add"?n("common.confirm"):n("common.update")}),children:[x.initMode==="edit"?null:e.jsx(A,{name:"provider",control:l,render:({field:a})=>e.jsx(rn,{required:!0,fullWidth:!0,margin:"dense",size:"small",label:n("authentication.chooseProvider"),placeholder:n("authentication.chooseProviderPlaceholder"),options:j,...Ye(a,"ref"),slotProps:{optionItem:{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%"}}}})}),e.jsx(m,{sx:{mt:2,".section":{mb:1,gap:4},".section-left":{width:150}},children:w?.component&&e.jsx(w.component,{ref:i,onSuccess:S,sortMaps:c})})]})}ut.propTypes={ref:u.any,providers:u.array,sortMaps:u.object};function hn(){const{confirmApi:r,confirmHolder:s}=et(),c=L.useRef(),{t:i}=$(),{api:n}=G(),{blocklet:t}=J(),l=t?.meta?.did,d=t?.settings?.authentication||{},f=[{name:N.WALLET,title:Q[N.WALLET],icon:e.jsx(ae,{provider:"wallet",sx:{width:20,height:20,scale:.9}}),component:ot},{name:N.EMAIL,title:Q[N.EMAIL],icon:e.jsx(ae,{provider:"email",sx:{width:20,height:20,scale:.9}}),component:at},{name:N.PASSKEY,title:Q[N.PASSKEY],icon:e.jsx(ae,{provider:"passkey",sx:{width:20,height:20,scale:.9}}),component:st},{name:N.GOOGLE,title:Q[N.GOOGLE],icon:e.jsx(ae,{provider:"google",sx:{width:20,height:20}}),component:rt},{name:N.APPLE,title:Q[N.APPLE],icon:e.jsx(ae,{provider:"apple",sx:{width:20,height:20}}),component:lt},{name:N.GITHUB,title:Q[N.GITHUB],icon:e.jsx(ae,{provider:"github",sx:{width:20,height:20}}),component:it},{name:N.TWITTER,title:Q[N.TWITTER],icon:e.jsx(ae,{provider:"twitter",sx:{width:20,height:20}}),component:ct},{name:N.AUTH0,title:Q[N.AUTH0],icon:e.jsx(ae,{provider:"auth0",sx:{width:20,height:20}}),component:nt,hidden:!0}].map(a=>({...a,enabled:d[a.name]?.enabled??!1,order:d[a.name]?.order??null})),h=f.filter(a=>a.enabled),y=h.sort((a,o)=>!xe(a?.order)&&!xe(o?.order)?a.order-o.order:xe(a?.order)?1:-1),w=y.reduce((a,o,C)=>Object.assign(a,{[o.name]:{order:C}}),{}),p=je(y.reduce((a,o,C)=>Object.assign(a,{[o.name]:C}),{})),b=[...h].sort((a,o)=>p[a.name]-p[o.name]),x={};typeof window<"u"&&(x.context=window);const I=g((a,o)=>{const C=b[a],R=b[o];p[C.name]=o,p[R.name]=a}),S=g(async()=>{const a=Object.keys(p).reduce((o,C)=>(o[C]={order:p[C]},o),{});await n.configAuthentication({input:{did:l,authentication:JSON.stringify(a)}})}),T=()=>{c.current.open(()=>{c.current.close()})},v=g(a=>{c.current.open(B,{provider:a})}),j=g(a=>{r.open({title:i("authentication.deleteLoginProvider",{provider:Q[a]}),content:i("authentication.deleteLoginProviderDescription",{provider:Q[a]}),confirmButtonText:i("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:i("common.cancel"),async onConfirm(o){try{await n.configAuthentication({input:{did:l,authentication:JSON.stringify({[a]:{enabled:!1,order:null}})}}),delete p[a],P.success(i("common.removeSuccess")),o()}catch(C){P.error(C.message||i("common.deleteFailed"))}}})});return e.jsxs(m,{children:[e.jsx(H,{variant:"contained",onClick:T,sx:{mb:1},children:i("authentication.addLoginProvider")}),e.jsx(Dt,{backend:It,...x,children:b.map((a,o)=>e.jsx(dt,{index:o,id:a.name,title:a.title,icon:a.icon,onMove:I,onEnd:S,onEditItem:v,onDeleteItem:j,disableDelete:y.length<=1,children:a.component},a.name))}),e.jsx(ut,{ref:c,providers:f,sortMaps:w}),s]})}const ue={ttl:en,cacheTtl:Xt,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]},enableBlacklist:!1};function Z(r){return e.jsx(tt,{...r,sx:{transform:"scale(0.75)"}})}function Oe(r,s=!1){const c=s?r.ttl*86400:r.ttl/86400;return{...r,ttl:c}}function pn(){const{api:r}=G(),{blocklet:s}=J(),c=s?.meta?.did,i=Qe({},ue,s?.settings?.session||{});xe(i.ttl)&&(i.ttl=ue.ttl),xe(i.cacheTtl)&&(i.cacheTtl=ue.cacheTtl),i.phone||(i.phone=ue.phone),i.email||(i.email=ue.email),xe(i.enableBlacklist)&&(i.enableBlacklist=ue.enableBlacklist);const{handleSubmit:n,control:t,formState:l,reset:d,watch:f}=ie({defaultValues:se(Oe(i),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:h}=$(),y=f("email.enabled"),w=f("phone.enabled"),p=f("email.enableDomainBlackList"),b=f("email.enableDomainWhiteList"),{fields:x,append:I,remove:S}=Me({control:t,name:"email.domainBlackList"}),{fields:T,append:v,remove:j}=Me({control:t,name:"email.domainWhiteList"}),a=g(async o=>{try{const{blocklet:C}=await r.updateAppSessionConfig({input:{did:c,config:Ye(Oe(o,!0),["phone"])}}),R=Object.assign({},ue,se(C?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));d(Oe(R)),P.success(h("common.configSuccess"))}catch(C){P.error(C.message)}});return e.jsx(gn,{onSubmit:n(a),children:e.jsxs(V,{direction:"column",sx:{gap:6},children:[e.jsxs(m,{children:[e.jsxs(m,{children:[e.jsx(te,{variant:"h6",sx:{fontWeight:600},children:h("blocklet.config.session.profile")}),e.jsx(m,{component:he,sx:{my:3}})]}),e.jsxs(V,{sx:{gap:2},children:[e.jsx(D,{title:h("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(Z,{disabled:!0,checked:!0})})}),e.jsx(D,{title:h("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(Z,{disabled:!0,checked:!0})})}),e.jsx(D,{title:h("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"email.enabled",control:t,render:({field:o})=>e.jsx(Z,{...o,checked:o.value})})})}),y&&e.jsxs(V,{direction:"column",sx:{ml:2,gap:.5},children:[e.jsx(D,{title:h("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"email.requireVerified",control:t,render:({field:o})=>e.jsx(X,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})}),e.jsx(D,{title:h("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"email.requireUnique",control:t,render:({field:o})=>e.jsx(X,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})}),e.jsx(D,{title:h("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"email.trustOauthProviders",control:t,render:({field:o})=>e.jsx(X,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})}),e.jsx(D,{title:h("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"email.enableDomainBlackList",control:t,render:({field:o})=>e.jsx(X,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})}),p&&e.jsxs(m,{children:[x.map((o,C)=>e.jsxs(V,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(A,{name:`email.domainBlackList.${C}`,control:t,render:R=>e.jsx(E,{...R.field,size:"small",fullWidth:!0})}),e.jsx(pe,{onClick:()=>S(C),children:e.jsx(Ve,{})})]},o.id)),e.jsx(Y,{startIcon:e.jsx(Ee,{}),onClick:()=>I(""),children:h("blocklet.config.session.addDomain")})]}),e.jsx(D,{title:h("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"email.enableDomainWhiteList",control:t,render:({field:o})=>e.jsx(X,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})}),b&&e.jsxs(m,{children:[T.map((o,C)=>e.jsxs(V,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(A,{name:`email.domainWhiteList.${C}`,control:t,render:R=>e.jsx(E,{...R.field,size:"small",fullWidth:!0})}),e.jsx(pe,{onClick:()=>j(C),children:e.jsx(Ve,{})})]},o.id)),e.jsx(Y,{startIcon:e.jsx(Ee,{}),onClick:()=>v(""),children:h("blocklet.config.session.addDomain")})]})]}),e.jsxs(m,{sx:{display:"none"},children:[e.jsx(D,{title:h("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"phone.enabled",control:t,disabled:!0,render:({field:o})=>e.jsx(X,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})}),w&&e.jsxs(V,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(D,{title:h("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"phone.requireVerified",control:t,render:({field:o})=>e.jsx(X,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})}),e.jsx(D,{title:h("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"phone.requireUnique",control:t,render:({field:o})=>e.jsx(X,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})})]})]})]})]}),e.jsxs(m,{children:[e.jsx(te,{variant:"h6",sx:{fontWeight:600},children:h("blocklet.config.session.period")}),e.jsx(m,{component:he,sx:{my:3}}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(A,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:o})=>e.jsx(_,{fullWidth:!0,sx:{mb:2},children:e.jsx(D,{title:h("blocklet.config.session.ttl",{day:o.value}),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{width:"100%",maxWidth:500,px:2},children:e.jsx(qt,{...o,defaultValue:7,step:1,marks:[{value:1,label:h("blocklet.config.session.day",{day:1})},{value:7,label:h("blocklet.config.session.days",{day:7})},{value:14,label:h("blocklet.config.session.days",{day:14})},{value:21,label:h("blocklet.config.session.days",{day:21})},{value:30,label:h("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(m,{children:[e.jsx(te,{variant:"h6",sx:{fontWeight:600},children:h("blocklet.config.session.experimentalSettings")}),e.jsx(m,{component:he,sx:{my:3}}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(D,{title:h("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"enableBlacklist",control:t,render:({field:o})=>e.jsx(X,{sx:{ml:0},control:e.jsx(Z,{...o,checked:o.value})})})})})})]}),e.jsx(m,{children:e.jsx(Y,{type:"submit",variant:"contained",disabled:!l.isDirty,children:h("common.save")})})]})})}const gn=Je.form`
|
|
2
|
+
max-width: 1536px;
|
|
3
|
+
|
|
4
|
+
.advanced-config {
|
|
5
|
+
border: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.config-form {
|
|
10
|
+
flex-grow: 1;
|
|
11
|
+
overflow-y: auto;
|
|
12
|
+
will-change: transform;
|
|
13
|
+
|
|
14
|
+
&:first-child {
|
|
15
|
+
margin: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
${r=>r.theme.breakpoints.down("md")} {
|
|
19
|
+
width: 100%;
|
|
20
|
+
flex-shrink: 0;
|
|
21
|
+
padding: 0 24px;
|
|
22
|
+
transform: translate(0, 0);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.config-item {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: space-between;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.config-desc {
|
|
33
|
+
font-weight: normal;
|
|
34
|
+
font-size: 12px;
|
|
35
|
+
color: #666;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.form-item {
|
|
39
|
+
margin-top: 0;
|
|
40
|
+
}
|
|
41
|
+
`,fn={width:24,height:24,body:'<path fill="currentColor" d="M6 12.05q0 1.125.425 2.188T7.75 16.2l.25.25V15q0-.425.288-.713T9 14q.425 0 .713.288T10 15v4q0 .425-.288.713T9 20H5q-.425 0-.713-.288T4 19q0-.425.288-.713T5 18h1.75l-.4-.35q-1.3-1.15-1.825-2.625T4 12.05Q4 9.7 5.2 7.787T8.425 4.85q.35-.2.738-.025t.512.575q.125.375-.013.75t-.487.575q-1.45.8-2.313 2.213T6 12.05Zm12-.1q0-1.125-.425-2.187T16.25 7.8L16 7.55V9q0 .425-.288.713T15 10q-.425 0-.713-.288T14 9V5q0-.425.288-.713T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6h-1.75l.4.35q1.225 1.225 1.788 2.663T20 11.95q0 2.35-1.2 4.263t-3.225 2.937q-.35.2-.737.025t-.513-.575q-.125-.375.013-.75t.487-.575q1.45-.8 2.313-2.212T18 11.95Z"/>'};var Fe,He;function xn(){if(He)return Fe;He=1;const{DEFAULT_IP_DOMAIN_SUFFIX:r,SLOT_FOR_IP_DNS_SITE:s,DEFAULT_DID_DOMAIN:c}=tn(),{encode:i}=cn();return Fe={getIpDnsDomainForBlocklet:l=>`${i(l.meta.did)}-${s}.${r}`,getDidDomainForBlocklet:({did:l,didDomain:d=c})=>`${i(l)}.${d}`},Fe}var jn=xn();function mt({ref:r=null}){const{t:s}=L.useContext(le),{blocklet:c}=J(),{api:i}=G(),n=je({loadingReject:!1,loadingApprove:!1,mode:"view",show:!1,data:{},callback:B}),l=Le()?.transitions?.duration?.leavingScreen||300,d=g(()=>{n.mode="view",n.data={},n.callback=B}),f=g(()=>{n.show=!1,setTimeout(()=>{d()},l)}),h=g(I=>{n.mode="view",n.show=!0,n.data=I}),y=g((I,S=B)=>{n.mode="approve",n.show=!0,n.data=I,n.callback=S});L.useImperativeHandle(r,()=>({open:h,close:f,approve:y}),[h,f,y]);const w=ne(()=>{if(!n.show)return[];n.data.migratedFrom=[n.data.appId,n.data.appPid];const I=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return n.data.isMaster!==!1&&Yt(I,"appliedAt","status"),I.map(S=>{const T=s(`federated.info.${S}`);let v=n.data[S];if(S==="appName"&&n.data.isMaster&&(v=e.jsxs(m,{children:[e.jsx(Ge,{component:Ke}),v]})),["appId","appPid","serverId"].includes(S)&&(v=e.jsx(qe,{children:v})),["appUrl"].includes(S)&&(v=e.jsx(m,{component:"a",href:v,target:"_blank",children:v})),["appLogo"].includes(S)){const j=re(`https://${jn.getDidDomainForBlocklet({did:n.data.appPid})}`,be,"/blocklet/logo");try{const a=new URL(j);a.searchParams.set("imageFilter","resize"),a.searchParams.set("w","80"),a.searchParams.set("h","80"),v=e.jsx("img",{src:a.href,width:"60",height:"60",alt:n.data.appName})}catch{v=e.jsx("img",{src:j,width:"60",height:"60",alt:n.data.appName})}}return S==="status"&&(v=v&&s(`federated.status.${v}`)),S==="migratedFrom"&&(v=(n.data.migratedFrom||[]).filter(o=>![n.data.appId,n.data.appPid].includes(o)).map(o=>e.jsx(qe,{children:o}))),Xe(v)&&(v="-"),{name:T,value:v}})},[n.data]),p=n.mode==="approve",b=g(async()=>{try{n.loadingReject=!0,await i.auditFederatedLogin({input:{memberPid:n.data.appPid,did:c.appPid,status:"rejected"}}),f(),n?.callback(!1)}finally{n.loadingReject=!1}}),x=g(async()=>{try{n.loadingApprove=!0,await i.auditFederatedLogin({input:{memberPid:n.data.appPid,did:c.appPid,status:"approved"}}),f(),n?.callback(!0)}finally{n.loadingApprove=!1}});return e.jsx(we,{open:n.show,title:s(p?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:f,actions:p?e.jsxs(e.Fragment,{children:[e.jsxs(Y,{color:"error",variant:"contained",onClick:b,disabled:n.loadingReject,children:[n.loadingReject?e.jsx(Be,{size:16,color:"grey"}):null,s("common.reject")]}),e.jsxs(Y,{variant:"contained",onClick:x,disabled:n.loadingApprove,children:[n.loadingApprove?e.jsx(Be,{size:16,color:"grey"}):null,s("common.approve")]})]}):e.jsx(Y,{variant:"outlined",onClick:f,children:s("common.close")}),children:w.map(I=>e.jsx(ln,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:I.name,children:I.value},I.name))})}mt.propTypes={ref:u.any};function We({ref:r=null}){const c=Le()?.transitions?.duration?.leavingScreen||300,{t:i}=L.useContext(le),n=je({show:!1,data:{link:""}}),t=g(()=>{n.data.link=""}),l=g(()=>{n.show=!1,setTimeout(()=>{t()},c)}),d=g(({link:h})=>{n.show=!0,n.data.link=h});L.useImperativeHandle(r,()=>({open:d,close:l}),[d,l]);const f=g(()=>{Ot(n.data.link),l()});return e.jsxs(we,{open:n.show,title:i("federated.joinFederatedLogin"),onClose:l,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(H,{color:"primary",autoFocus:!0,variant:"contained",onClick:f,children:i("common.copyAndClose")}),children:[e.jsx(m,{sx:{mb:2},children:i("federated.inviteJoinFederatedLoginDescription")}),e.jsx(m,{sx:{"& .copy-button":{display:"none !important"}},children:e.jsx(dn,{children:n.data.link})})]})}We.propTypes={ref:u.any};function ht({mode:r="member"}){const s=L.useRef(null),c=L.useRef(null),{t:i,locale:n}=L.useContext(le),{blocklet:t,actions:{refreshBlocklet:l}}=J(),{confirmApi:d,confirmHolder:f}=et(),{api:h}=G(),y=t.settings.federated?.sites||[],w=t.settings.federated?.config||{},p=w.isMaster!==!1,b=y.find(O=>O.appPid===t.appPid),x=je({loadingSync:!1}),I=g(O=>{c.current?.open(O)}),S=g(O=>{c.current?.approve(O,l)}),T=g(O=>{d.open({title:i("federated.removeFederatedLogin"),content:i("federated.removeFederatedLoginDescription"),confirmButtonText:i("common.confirm"),cancelButtonText:i("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(z){await h.quitFederatedLogin({input:{did:t.appPid,targetDid:O.appPid}}),z()}})}),v=g(O=>{d.open({title:i("federated.disableFederatedLogin"),content:i("federated.disableFederatedLoginDescription"),confirmButtonText:i("common.confirm"),cancelButtonText:i("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(z){await h.auditFederatedLogin({input:{memberPid:O.appPid,did:t.appPid,status:"revoked"}}),z()}})}),j=g(O=>{d.open({title:i("federated.enableFederatedLogin"),content:i("federated.enableFederatedLoginDescription"),confirmButtonText:i("common.confirm"),cancelButtonText:i("common.cancel"),async onConfirm(z){await h.auditFederatedLogin({input:{memberPid:O.appPid,did:t.appPid,status:"approved"}}),z()}})}),a=ne(()=>{const O=[{label:i("common.name"),name:"appName",options:{customBodyRenderLite:z=>{const F=y[z],ce=F.isMaster!==!1;return e.jsx(m,{sx:{display:"inline-block"},children:e.jsxs(m,{component:"a",href:F.appUrl,target:"_blank",onClick:M=>{M.stopPropagation()},sx:{display:"flex",alignItems:"center"},children:[ce&&e.jsx(Ge,{component:Ke,style:{marginRight:"4px"}}),F.appName]})})}}},{label:i("common.did"),name:"appId",options:{customBodyRenderLite:z=>{const F=y[z];return e.jsx(qe,{children:F.appId})}}},{label:i("common.status"),name:"status",options:{customBodyRenderLite:z=>{const F=y[z],ce=F.isMaster!==!1;return e.jsx(m,{children:ce?"-":i(`federated.status.${F.status}`)})}}}];return p&&O.push({label:i("common.actions"),name:"actions",options:{customBodyRenderLite:z=>{const F=y[z],ce=F.isMaster!==!1;return e.jsx(m,{sx:{display:"flex",gap:1},children:ce?e.jsxs(e.Fragment,{children:[F.status==="rejected"&&e.jsx(H,{variant:"contained",color:"error",size:"small",onClick:M=>{M.stopPropagation()},children:i("federated.status.rejected")}),F.status==="revoked"&&e.jsx(H,{variant:"contained",color:"secondary",size:"small",onClick:M=>{M.stopPropagation()},children:i("federated.status.revoked")})]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{variant:"contained",color:"error",size:"small",onClick:M=>{M.stopPropagation(),T(F)},children:i("federated.quitMember")},"quiteSite"),F.status==="pending"&&e.jsx(H,{variant:"contained",color:"primary",size:"small",onClick:M=>{M.stopPropagation(),S(F)},children:i("federated.status.pending")},"auditSite"),F.status==="approved"&&e.jsx(H,{variant:"contained",color:"error",size:"small",onClick:M=>{M.stopPropagation(),v(F)},style:{whiteSpace:"nowrap"},children:i("federated.revoke")},"revokeSite"),F.status==="revoked"&&e.jsx(H,{variant:"contained",color:"warning",size:"small",onClick:M=>{M.stopPropagation(),j(F)},style:{whiteSpace:"nowrap"},children:i("federated.approve")},"approveSite")]})})}}}),O},[w.appId,y,p,i]),o=ne(()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(O,{dataIndex:z}){const F=y[z];I(F)}}),[]),C=g(()=>{const O=t.environments.find(z=>z.key===Re.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);O?.value?s.current?.open({link:O.value}):P.error(i("federated.failedToGetFederatedLoginLink"))},[t.site?.domainAliases?.[0]?.href]),R=g(()=>{d.open({title:i("federated.quitFederatedLogin"),content:i("federated.quitFederatedLoginDescription"),confirmButtonText:i("common.confirm"),cancelButtonText:i("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(O){await h.quitFederatedLogin({input:{did:t.appPid}}),O()}})}),ve=g(()=>{d.open({title:i("federated.disbandFederatedLogin"),content:i("federated.disbandFederatedLoginDescription"),confirmButtonText:i("common.confirm"),cancelButtonText:i("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(O){await h.disbandFederatedLogin({input:{did:t.appPid}}),O()}})}),ge=g(async()=>{try{x.loadingSync=!0,await Promise.all([await h.syncFederatedConfig({input:{did:t.appPid}}),Tt(500)]),P.success(i("common.succeeded"))}finally{x.loadingSync=!1}}),oe=[];return b.status!=="pending"&&oe.push(e.jsx(Et,{title:i("federated.syncConfig"),children:e.jsx(pe,{size:"small",onClick:ge,disabled:x.loadingSync,sx:[{"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}},x.loadingSync?{animation:"spin 1s linear infinite"}:{}],children:e.jsx(me,{icon:fn,style:{fontSize:24}})},"syncConfig")})),r==="master"?(oe.push(e.jsx(H,{size:"small",variant:"contained",onClick:C,sx:{ml:1},children:i("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),oe.push(e.jsx(H,{color:"error",size:"small",variant:"contained",onClick:ve,sx:{ml:1},children:i("federated.disbandFederatedLogin")},"disbandFederatedLogin"))):oe.push(e.jsx(H,{size:"small",variant:"contained",color:"error",onClick:R,sx:{ml:1},children:i("federated.quitFederatedLogin")},"quitFederatedLogin")),e.jsxs(e.Fragment,{children:[e.jsx(At,{className:"main-table",locale:n,data:y,columns:a,customButtons:oe,title:e.jsx(m,{className:"table-toolbar-left",children:i("authentication.federated")}),options:o}),f,e.jsx(We,{ref:s}),e.jsx(mt,{ref:c})]})}ht.propTypes={mode:u.oneOf(["member","master"])};function pt({ref:r=null}){const{t:s}=L.useContext(le),{api:c}=G(),{blocklet:i}=J(),n=i?.appPid,l=Le()?.transitions?.duration?.leavingScreen||300,d=je({loading:!1,show:!1,appUrl:"",appUrlError:"",callback:B}),f=g(()=>{d.appUrl="",d.appUrlError="",d.callback=B}),h=g(()=>{d.show=!1,setTimeout(()=>{f()},l)}),y=g((b=B)=>{d.show=!0,d.callback=b});L.useImperativeHandle(r,()=>({open:y,close:h}),[y,h]);const w=g(b=>{if(!b)throw new Error(s("federated.federatedJoinAppUrlRequired"));if(!nn(b))throw new Error(s("federated.federatedJoinAppUrlInvalid"))}),p=g(async()=>{try{w(d.appUrl),d.loading=!0;const b=await c.joinFederatedLogin({input:{did:n,appUrl:d.appUrl}});d.show=!1,h(),d?.callback(b)}catch(b){d.appUrlError=b.message}finally{d.loading=!1}});return e.jsxs(we,{open:d.show,title:s("federated.joinFederatedLogin"),onClose:h,PaperProps:{style:{minHeight:"unset"}},actions:e.jsxs(H,{color:"primary",autoFocus:!0,variant:"contained",onClick:p,disabled:d.loading,children:[d.loading?e.jsx(Be,{size:16,sx:{mr:1},color:"grey"}):null,s("common.confirm")]}),children:[e.jsx(m,{sx:{mb:1},children:s("federated.joinFederatedLoginDescription")}),e.jsx(E,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:s("federated.federatedJoinAppUrl"),label:s("federated.federatedJoinAppUrl"),value:d.appUrl,error:!!d.appUrlError,helperText:d.appUrlError||"eg: https://www.arcblock.io",onChange:b=>{d.appUrl=b.target.value}})]})}pt.propTypes={ref:u.any};function bn(){const{t:r}=L.useContext(le);return e.jsxs(V,{direction:"row",spacing:2,sx:{alignItems:"flex-start",p:2},children:[e.jsx(Bt,{fontSize:"large",color:"primary"}),e.jsxs(m,{children:[e.jsx(te,{variant:"h6",gutterBottom:!0,children:r("federated.title")}),e.jsx(te,{variant:"body2",sx:{color:"text.secondary"},children:r("federated.description")}),e.jsx(zt,{href:"https://www.arcblock.io/blog/zh/did-connect-federated-login-support",underline:"hover",variant:"body2",color:"primary",target:"_blank",sx:{display:"inline-flex",alignItems:"center",mt:1},children:r("federated.link")})]})]})}function vn(){const r=L.useRef(null),s=L.useRef(null),{t:c}=L.useContext(le),{blocklet:i,actions:{refreshBlocklet:n}}=J(),t=g(()=>{const d=i.site?.domainAliases?.[0]?.href;if(d)try{const f=new URL(d);r.current?.open({link:f.origin})}catch{P.error(c("federated.failedToGetFederatedLoginLink"))}},[i.site?.domainAliases?.[0]?.href]),l=g(()=>{s.current?.open(()=>{n()})});if(i.settings.federated?.sites.length>0){const d=i.settings.federated?.config.isMaster!==!1;return e.jsx(ht,{mode:d?"master":"member"})}return e.jsxs(e.Fragment,{children:[e.jsx(m,{sx:{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px"},children:e.jsxs(m,{sx:{maxWidth:400,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(bn,{}),e.jsx(he,{sx:{width:1}}),e.jsxs(V,{sx:{width:1,p:2,gap:1.5},children:[e.jsx(H,{variant:"contained",onClick:t,sx:{width:1},children:c("federated.inviteJoinFederatedLogin")}),e.jsx(H,{variant:"outlined",onClick:l,sx:{width:1},children:c("federated.joinFederatedLogin")})]})]})}),e.jsx(We,{ref:r}),e.jsx(pt,{ref:s})]})}const Ue={login:{en:{title:"Login",scan:"Login with one of the following methods",confirm:"Confirm connection in your DID Wallet",success:"Successfully logged in"},zh:{title:"登录",scan:"请使用下面的方式完成登录",confirm:"在 DID Wallet 中确认连接",success:"登录成功"}},"switch-profile":{en:{title:"Switch Profile",scan:"Use DID Wallet to switch profile",confirm:"Select profile in your DID Wallet",success:"Profile updated"},zh:{title:"切换个人信息",scan:"请使用 DID Wallet 来切换个人信息",confirm:"在 DID Wallet 中选择个人信息",success:"个人信息已经更新"}},"switch-passport":{en:{title:"Switch Passport",scan:"Use DID Wallet to switch passport",confirm:"Select passport in your DID Wallet",success:"Passport and session updated"},zh:{title:"切换通行证",scan:"请使用 DID Wallet 来切换通行证",confirm:"在 DID Wallet 中选择通行证",success:"通行证和会话已经更新"}}},yn={en:{title:"",scan:"",confirm:"",success:""},zh:{title:"",scan:"",confirm:"",success:""}},fe="new-action",gt=Object.keys(Ue),ft=["zh","en"],xt=r=>/^[a-z][a-z-]*$/.test(r),kn=r=>{const s=[];return r.includes("zh")&&s.push("zh"),r.includes("en")&&s.push("en"),r.filter(c=>!ft.includes(c)).forEach(c=>s.push(c)),s},jt=r=>{const s=Re.baseLanguages.find(c=>c.code===r);return s?s.name:r};function bt({value:r="",onChange:s=()=>{},onBlur:c=()=>{},onKeyDown:i=()=>{},isDuplicate:n=!1}){const{t}=$(),l=r&&!xt(r);let d="";return l?d=t("authentication.didConnect.actionNameError"):n&&(d=t("authentication.didConnect.actionNameDuplicate")),e.jsx(E,{value:r,onChange:s,onBlur:c,onKeyDown:i,onClick:f=>f.stopPropagation(),size:"small",variant:"standard",autoFocus:!0,placeholder:"action-name",helperText:d,error:l||n,sx:{"& .MuiInputBase-input":{py:0,fontSize:14,fontWeight:500}}})}bt.propTypes={value:u.string,onChange:u.func,onBlur:u.func,onKeyDown:u.func,isDuplicate:u.bool};function vt({langCode:r,isSelected:s=!1,canDelete:c=!1,onSelect:i=()=>{},onDelete:n=()=>{}}){return e.jsx(Ze,{label:jt(r),onClick:i,onDelete:c?n:void 0,size:"small",sx:{bgcolor:s?"primary.main":"grey.100",color:s?"primary.contrastText":"text.primary","&:hover":{bgcolor:s?"primary.dark":"grey.200"},"& .MuiChip-deleteIcon":{color:s?"primary.contrastText":"text.secondary","&:hover":{color:s?"primary.contrastText":"error.main"}}}})}vt.propTypes={langCode:u.string.isRequired,isSelected:u.bool,canDelete:u.bool,onSelect:u.func,onDelete:u.func};function yt({actionKey:r,actionData:s={},expanded:c=!1,selectedLang:i="",editing:n={},onChange:t={}}){const{t:l}=$(),d=!gt.includes(r),f=kn(Object.keys(s)),h=s[i]||{},y=n?.actionKey===r,w=n?.name&&n.name!==r&&n.allActions?.[n.name];return e.jsxs(Rt,{expanded:c,onChange:(p,b)=>t.accordion(b),elevation:0,sx:{border:"1px solid",borderColor:"grey.200",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{margin:0}},children:[e.jsxs(Wt,{expandIcon:e.jsx(Vt,{}),sx:{minHeight:48,"& .MuiAccordionSummary-content":{alignItems:"center",gap:1}},children:[y?e.jsx(bt,{value:n.name,onChange:t.editingName,onBlur:t.finishEditing,onKeyDown:t.editingKeyDown,isDuplicate:w}):e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:.5,"&:hover .edit-icon":{opacity:1}},children:[e.jsx(te,{sx:{fontWeight:500},children:r}),d&&e.jsx(pe,{className:"edit-icon",size:"small",onClick:t.startEditing,sx:{p:.25,opacity:0,transition:"opacity 0.2s",color:"text.secondary","&:hover":{color:"primary.main",bgcolor:"transparent"}},children:e.jsx(Ut,{sx:{fontSize:16}})})]}),d&&e.jsx(pe,{size:"small",onClick:t.delete,sx:{ml:"auto",mr:1,p:.5,color:"error.main","&:hover":{bgcolor:"error.lighter"}},children:e.jsx(Nt,{sx:{fontSize:20}})})]}),e.jsxs(_t,{sx:{pt:0},children:[e.jsxs(m,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:1,mb:2},children:[e.jsx(te,{variant:"body2",color:"text.secondary",sx:{flexShrink:0},children:"Languages:"}),f.map(p=>e.jsx(vt,{langCode:p,isSelected:i===p,canDelete:!ft.includes(p),onSelect:()=>t.language(p),onDelete:b=>t.deleteLanguage(p,b)},p)),e.jsx(Ze,{label:`${l("common.add")}`,onClick:t.addLanguage,size:"small",variant:"outlined",icon:e.jsx(Ee,{sx:{fontSize:16}}),sx:{borderStyle:"dashed","&:hover":{bgcolor:"action.hover"}}})]}),e.jsxs(V,{spacing:2,children:[e.jsx(E,{label:"Title",value:h.title||"",onChange:p=>t.field("title",p.target.value),fullWidth:!0,size:"small"}),e.jsx(E,{label:"Scan",value:h.scan||"",onChange:p=>t.field("scan",p.target.value),fullWidth:!0,size:"small",multiline:!0,minRows:2})]})]})]})}yt.propTypes={actionKey:u.string.isRequired,actionData:u.object,expanded:u.bool,selectedLang:u.string,editing:u.shape({actionKey:u.string,name:u.string,allActions:u.object}),onChange:u.shape({accordion:u.func,language:u.func,field:u.func,startEditing:u.func,editingName:u.func,finishEditing:u.func,editingKeyDown:u.func,delete:u.func,addLanguage:u.func,deleteLanguage:u.func})};function kt({open:r,onClose:s,existingLanguages:c,selectedLanguage:i,onLanguageChange:n,onAdd:t}){const{t:l}=$(),d=Re.baseLanguages.filter(f=>!c.includes(f.code));return e.jsxs(Mt,{open:r,onClose:s,maxWidth:"xs",fullWidth:!0,children:[e.jsx(Ht,{children:l("authentication.didConnect.addLanguage")}),e.jsx($t,{children:e.jsx(_,{fullWidth:!0,sx:{mt:1},children:e.jsx(Jt,{value:i,onChange:f=>n(f.target.value),displayEmpty:!0,size:"small",renderValue:f=>f?jt(f):e.jsx(te,{color:"text.secondary",children:l("authentication.didConnect.selectLanguage")}),children:d.map(f=>e.jsx(Gt,{value:f.code,children:f.name},f.code))})})}),e.jsxs(Kt,{children:[e.jsx(Y,{onClick:s,children:l("common.cancel")}),e.jsx(Y,{onClick:t,variant:"contained",disabled:!i,children:l("common.add")})]})]})}kt.propTypes={open:u.bool.isRequired,onClose:u.func.isRequired,existingLanguages:u.array.isRequired,selectedLanguage:u.string.isRequired,onLanguageChange:u.func.isRequired,onAdd:u.func.isRequired};function wt({open:r=!1,onClose:s=()=>{},onSave:c=()=>{},initialConfig:i=null}){const{t:n,locale:t}=$(),[l,d]=L.useState({}),[f,h]=L.useState("login"),[y,w]=L.useState({}),[p,b]=L.useState(!1),[x,I]=L.useState(""),[S,T]=L.useState(""),[v,j]=L.useState(null),[a,o]=L.useState(""),C=t||"en";L.useEffect(()=>{if(!r)return;const k=i||Ue;d(k);const q=Object.keys(k);h(q[0]||"login");const W={};q.forEach(K=>{const U=Object.keys(k[K]||{});W[K]=U.includes(C)?C:U[0]||"en"}),w(W),j(null)},[r,i,C]);const R=g(k=>k?Object.values(k).every(q=>!q?.title?.trim()&&!q?.scan?.trim()):!0),ve=g(()=>!Object.keys(l).some(q=>!gt.includes(q)&&R(l[q]))&&!l[fe]);g(()=>{ve()&&(d(k=>({...k,[fe]:yn})),h(fe),w(k=>({...k,[fe]:C})),j(fe),o(fe))});const ge=g(k=>{const{value:q}=k.target;(q===""||/^[a-z-]*$/.test(q))&&o(q)}),oe=g(()=>{const k=a.trim();if(!k||!xt(k)||k!==v&&l[k]){j(null);return}if(k!==v){const q={};Object.keys(l).forEach(W=>{q[W===v?k:W]=l[W]}),d(q),f===v&&h(k),y[v]&&w(W=>{const K={...W,[k]:W[v]};return delete K[v],K})}j(null)}),O=g(k=>{k.key==="Enter"?oe():k.key==="Escape"&&j(null)}),z=g((k,q)=>{q.stopPropagation();const W={...l};delete W[k],d(W),f===k&&h(Object.keys(W)[0]||!1)}),F=g(()=>{!S||!x||(d(k=>({...k,[x]:{...k[x],[S]:{title:"",scan:"",confirm:"",success:""}}})),w(k=>({...k,[x]:S})),b(!1))}),ce=g((k,q,W)=>{W.stopPropagation();const K=l[k];if(Object.keys(K||{}).length<=1)return;const ee={...K};delete ee[q],d(de=>({...de,[k]:ee})),y[k]===q&&w(de=>({...de,[k]:Object.keys(ee)[0]||"en"}))}),M=g(()=>{c(JSON.stringify(l)),s()});ve();const St=e.jsxs(e.Fragment,{children:[e.jsx(Y,{onClick:s,variant:"outlined",children:n("common.cancel")}),e.jsx(Y,{onClick:M,variant:"contained",startIcon:e.jsx(Zt,{}),children:n("common.confirm")})]});return e.jsxs(we,{open:r,onClose:s,maxWidth:"md",fullWidth:!0,title:n("authentication.didConnect.configDialogTitle"),actions:St,children:[e.jsxs(V,{spacing:1.5,children:[Object.keys(l).map(k=>{const q=l[k]||{},W=Object.keys(q),K=y[k]||W[0]||"en";return e.jsx(yt,{actionKey:k,actionData:q,expanded:f===k,selectedLang:K,editing:{actionKey:v,name:a,allActions:l},onChange:{accordion:U=>h(U?k:!1),language:U=>w(ee=>({...ee,[k]:U})),field:(U,ee)=>d(de=>({...de,[k]:{...de[k],[K]:{...de[k]?.[K],[U]:ee}}})),startEditing:U=>{U.stopPropagation(),j(k),o(k)},editingName:ge,finishEditing:oe,editingKeyDown:O,delete:U=>z(k,U),addLanguage:U=>{U.stopPropagation(),I(k),T(""),b(!0)},deleteLanguage:(U,ee)=>ce(k,U,ee)}},k)}),!1]}),e.jsx(kt,{open:p,onClose:()=>b(!1),existingLanguages:Object.keys(l[x]||{}),selectedLanguage:S,onLanguageChange:T,onAdd:F})]})}wt.propTypes={open:u.bool,onClose:u.func,onSave:u.func,initialConfig:u.object};const Se={showDidColor:!0,showAppInfo:!0};function $e(r){return e.jsx(tt,{...r,sx:{transform:"scale(0.75)"}})}function wn(){const{api:r}=G(),{blocklet:s}=J(),c=s?.meta?.did,{control:i,reset:n}=ie({defaultValues:Qe({},Se,s?.settings?.didConnect||{})}),t=ne(()=>{const b=s?.settings?.actionConfig;return b&&!Xe(b)?b:Ue},[s?.settings?.actionConfig]),{t:l}=$(),[d,f]=L.useState(!1),h=g(async(b,x)=>{try{const I={showDidColor:i._defaultValues?.showDidColor??Se.showDidColor,showAppInfo:i._defaultValues?.showAppInfo??Se.showAppInfo};I[b]=x;const{blocklet:S}=await r.configDidConnect({input:{did:c,didConnect:JSON.stringify(I)}}),T=Object.assign({},Se,S?.settings?.didConnect||{});n(T),P.success(l("common.configSuccess"))}catch(I){P.error(I.message),n(i._defaultValues)}}),y=g(()=>{f(!1)}),w=g(()=>{f(!0)}),p=g(async b=>{try{await r.configDidConnectActions({input:{did:c,actionConfig:b}}),P.success(l("common.configSuccess"))}catch(x){console.error(x),P.error(x.message)}});return e.jsxs(Sn,{children:[e.jsxs(V,{direction:"column",sx:{gap:4},children:[e.jsxs(m,{children:[e.jsx(m,{children:l("authentication.didConnect.basicSettings")}),e.jsx(he,{sx:{my:2}}),e.jsxs(V,{sx:{gap:2},children:[e.jsx(D,{title:l("authentication.didConnect.showDidColor"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"showDidColor",control:i,render:({field:b})=>e.jsx($e,{...b,checked:b.value,onChange:x=>{h("showDidColor",x.target.checked),b.onChange(x)}})})})}),e.jsx(D,{title:l("authentication.didConnect.showAppInfo"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(A,{name:"showAppInfo",control:i,render:({field:b})=>e.jsx($e,{...b,checked:b.value,onChange:x=>{h("showAppInfo",x.target.checked),b.onChange(x)}})})})})]})]}),e.jsxs(m,{children:[e.jsx(m,{children:l("authentication.didConnect.customSettings")}),e.jsx(he,{sx:{my:2}}),e.jsx(V,{direction:"row",sx:{gap:2},children:e.jsx(Y,{variant:"outlined",onClick:w,children:l("authentication.didConnect.configDialogTitle")})})]})]}),e.jsx(wt,{open:d,onClose:y,onSave:p,initialConfig:t})]})}const Sn=Je.div`
|
|
42
|
+
max-width: 1536px;
|
|
43
|
+
|
|
44
|
+
.advanced-config {
|
|
45
|
+
border: 0;
|
|
46
|
+
padding: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.config-form {
|
|
50
|
+
flex-grow: 1;
|
|
51
|
+
overflow-y: auto;
|
|
52
|
+
will-change: transform;
|
|
53
|
+
|
|
54
|
+
&:first-child {
|
|
55
|
+
margin: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
${r=>r.theme.breakpoints.down("md")} {
|
|
59
|
+
width: 100%;
|
|
60
|
+
flex-shrink: 0;
|
|
61
|
+
padding: 0 24px;
|
|
62
|
+
transform: translate(0, 0);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.config-item {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: space-between;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.config-desc {
|
|
73
|
+
font-weight: normal;
|
|
74
|
+
font-size: 12px;
|
|
75
|
+
color: #666;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.form-item {
|
|
79
|
+
margin-top: 0;
|
|
80
|
+
}
|
|
81
|
+
`;function ye({label:r}){return e.jsx(m,{sx:{textAlign:"center",width:"100%"},children:r})}ye.propTypes={label:u.any.isRequired};function Ln({orientation:r="horizontal"}){const{t:s}=L.useContext(le),c=un({key:"lg"}),i=[{label:e.jsx(ye,{label:s("authentication.didConnectSettings")}),value:"didConnect"},{label:e.jsx(ye,{label:s("authentication.loginProviders")}),value:"loginProviders"},{label:e.jsx(ye,{label:s("authentication.federated")}),value:"federated"},{label:e.jsx(ye,{label:s("authentication.sessionSettings")}),value:"session"}],[n,t]=L.useState(i[0].value),l=ne(()=>({didConnect:e.jsx(wn,{}),loginProviders:e.jsx(hn,{}),federated:e.jsx(vn,{}),session:e.jsx(pn,{})}),[s]);return r==="vertical"?e.jsx(m,{sx:{".MuiTab-root":{textAlign:"left",alignItems:"flex-start",fontWeight:"normal",div:{textAlign:"left"}},".Mui-selected":{fontWeight:"bold"}},children:e.jsxs(V,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(m,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(Ne,{tabs:i,current:n,orientation:c?"horizontal":"vertical",onChange:t,sx:{borderRight:c?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(m,{sx:{flexGrow:1,minWidth:0},children:e.jsx(m,{sx:{maxWidth:"1200px"},children:l[n]})})]})}):e.jsxs(m,{children:[e.jsx(Ne,{tabs:i,current:n,onChange:t}),e.jsx(m,{sx:{marginTop:"10px"},children:l[n]})]})}Ln.propTypes={orientation:u.oneOf(["horizontal","vertical"])};export{Ln as default};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import{j as e,z as yr,bN as ye,M as oe,al as m,R as G,X as u,L as ve,bO as vr,I as W,aL as wr,T as A,ak as jr,bP as Se,P as Pe,bK as Ie,a6 as Te,A as Ne,C as Ue,bQ as Cr,bR as kr,V as Re,aZ as Sr,bS as Pr,aT as Z,bT as Ir,a7 as Y,n as ne,G as Tr,bU as Rr,as as Me,b3 as we,bV as Mr,b4 as Ar,bb as Er,bW as zr}from"./vendor-mui-core-CV-FnYH_.js";import{r as y,a as Wr,j as Lr,m as Dr}from"./vendor-react-DX7tU9aY.js";import{t as Fe,F as Br,a8 as Or,a4 as Ae,E as $r,z as se,n as H,x as Nr}from"./vendor-utils-BbcnEeJI.js";import{u as Ur,ar as Fr,as as F,at as qr,W as qe,au as _r,j as Hr,av as _e,a4 as le,a5 as Gr,aw as Kr}from"./index-yoaLEniz.js";import{a as R,j as Yr,r as ce,i as Q,b as M,p as Vr}from"./vendor-hooks-164oA5kM.js";import{t as He}from"./arrow-down.svg-Dz9H9vM-.js";import{b2 as je,F as E,V as L,bd as Zr,aI as Ge,be as Qr,y as $,a4 as Xr,bf as Jr,bg as Ee,G as et,b3 as Ke,a5 as Ce,U as rt,ai as T,Q as tt,S as ot,E as nt,bh as st,bi as it,N as Ye}from"./vendor-ux-BGqHwkOM.js";import{N as at}from"./list-D-9AeBju.js";import{d as lt}from"./search-4YYphs0l.js";import{B as ze}from"./bundle-avatar-2ugE80w1.js";import{c as We,T as ct}from"./team-Djzt5BWc.js";import{b as dt,d as ut,a as Ve,c as Ze,e as pt,f as ft,h as ht,q as xt}from"./user-center-DLgnUI1s.js";import{T as ge,O as mt}from"./index-tRQj1y79.js";import{c as gt}from"./passport-BxMVp3TG.js";import{N as Qe,U as Xe}from"./index-C3UXSk-k.js";import{u as de}from"./use-mobile-DFkQ5N0b.js";import bt from"./index-s8xAfo-W.js";import{U as yt,a as vt}from"./user-follower-BbQfOSyh.js";import{f as V}from"./index-DBs9Ljax.js";import{S as Je}from"./switch-qh9YpwMi.js";import{M as er}from"./provider-icon-DbnLu_85.js";import{U as wt}from"./actions-Do5Z9cxZ.js";import{x as jt,d as Ct}from"./info-outline-rounded-DovRYvXo.js";import{u as Le}from"./index-B9YNNXOw.js";import kt from"./index-Boc2cNQ7.js";import{o as St}from"./vendor-arcblock-Xw2zMy0D.js";import{D as Pt,a as ie,b as It,S as Tt}from"./index-BOoRVhLj.js";import"./index-BojVbZw0.js";import"./server-logo-notext.svg-CtPRYaCm.js";import"./util-tg9hB6_c.js";import"./base32-CyUpiYTu.js";import"./session-UEzmH-IS.js";import"./purify.es-HRjpPm7y.js";import"./wallet-hidden-topbar-dnCLvPpW.js";import"./theme-mode-toggle-Jvn37gNg.js";import"./use-mobile-CyUZDIaX.js";import"./index-CZ-qZTKi.js";import"./isURL-CpQHQuaa.js";import"./isIP-BBY240SU.js";import"./use-blocklet-logo-ys-h-CV_.js";import"./use-app-logo-DyU2iSXF.js";import"./fallback-CuXkR699.js";import"./index-CVuESID5.js";import"./index-Ci7zZ36D.js";import"./nav-menu-D7Sf6VZj.js";import"./revoke.svg-BF_gJc34.js";import"./google-icon-vNOJy67F.js";import"./use-mobile-DwGMuJlg.js";import"./actions-DydkTgA0.js";import"./index-B4A3W4qJ.js";import"./form-text-input-BT3t62-a.js";import"./required-DnQpCGsD.js";import"./form-wrapper-kWYD3nZz.js";import"./edit.svg-BGhTyO6h.js";import"./lock.svg-BOhdQlHW.js";import"./index-DswHt4-F.js";import"./permission-B22pCnUb.js";import"./confirm-CoDiNrSj.js";import"./click-to-copy-CgakrWoh.js";import"./invitations-B18y415k.js";import"./create-passport-svg-BSRyjG0k.js";import"./api-BMcHDEnt.js";import"./table-tips-BSl1oNMX.js";import"./ua-parser-D6QF1h5N.js";import"./sdk-Dy-R7tw7.js";import"./passkey-rounded-_WDHIZVd.js";import"./login-method-item-aEisznLn.js";import"./isEmail-BwGDo3Ws.js";import"./passport-item-CIv8Q8Ng.js";import"./did-address-CtvTDc_I.js";import"./index-D7Er4cge.js";import"./vendor-mui-x-DwN6dcQH.js";import"./AdapterDayjs-QqQc9YbA.js";import"./delete-confirm-Cq9MJasT.js";import"./index-D29L5UKE.js";import"./index-BVTsYhIX.js";function Rt(){let r=new Map;function i({root:s,rootMargin:t,threshold:o}){let h=r.get(s);h||(h=new Map,r.set(s,h));let a=JSON.stringify({rootMargin:t,threshold:o}),p=h.get(a);if(!p){let l=new Map;p={observer:new IntersectionObserver(x=>{x.forEach(n=>{l.get(n.target)?.(n)})},{root:s,rootMargin:t,threshold:o}),entryCallbacks:l},h.set(a,p)}return{observe:(l,x)=>{p.entryCallbacks.set(l,x),p.observer.observe(l)},unobserve:l=>{p.entryCallbacks.delete(l),p.observer.unobserve(l)}}}return{getObserver:i}}var Mt="0px",At=[0],Et=Rt();function zt(r){let i=r?.rootMargin??Mt,s=r?.threshold??At,t=y.useRef(null),o=y.useRef(null),h=y.useRef(null),[a,p]=y.useState(),l=y.useCallback(()=>{let k=t.current;if(!k){p(void 0);return}let v=Et.getObserver({root:o.current,rootMargin:i,threshold:s});v.observe(k,d=>{p(d)}),h.current=v},[i,s]),x=y.useCallback(()=>{let k=h.current,v=t.current;v&&k?.unobserve(v),h.current=null},[]),n=y.useCallback(k=>{x(),t.current=k,l()},[l,x]),f=y.useCallback(k=>{x(),o.current=k,l()},[l,x]);return[n,{entry:a,rootRef:f}]}var Wt=zt;function Lt(r){let[i,s]=Wt(r),t=!!s.entry?.isIntersecting,[o,h]=y.useState(t);return t&&!o&&h(!0),[i,{...s,isVisible:t,wasEverVisible:o}]}var Dt=Lt,Bt=100;function Ot({loading:r,hasNextPage:i,onLoadMore:s,rootMargin:t,disabled:o,delayInMs:h=Bt}){let a=y.useRef(s),[p,{rootRef:l,isVisible:x}]=Dt({rootMargin:t});y.useEffect(()=>{a.current=s},[s]);let n=!o&&!r&&x&&i;return y.useEffect(()=>{if(n){let f=setTimeout(()=>{a.current()},h);return()=>{clearTimeout(f)}}},[n,h]),[p,{rootRef:l}]}var $t=Ot;const me={info:"#3B82F6",success:"#10B981",warning:"#F59E0B",error:"#EF4444"};ae.propTypes={severity:u.oneOf(["info","success","warning","error",""]).isRequired,size:u.number};function ae({severity:r,size:i=8}){return me[r]?e.jsx(m,{component:"span",sx:{display:"inline-block",width:i,height:i,borderRadius:"50%",backgroundColor:me[r]||me.info}}):null}rr.propTypes={theme:u.string,type:u.oneOf(["button","line","select"]),onSelectType:u.func,extra:u.node,loading:u.bool,currentTab:u.oneOf(["info","success","warning","error",""])};function rr({theme:r="dark",type:i="button",onSelectType:s,extra:t=void 0,currentTab:o="",loading:h=!1,...a}){const{t:p}=y.useContext(je),l=[{label:p("notification.allSeverity"),value:""},{label:p("notification.severityType.info"),value:"info"},{label:p("notification.severityType.success"),value:"success"},{label:p("notification.severityType.warning"),value:"warning"},{label:p("notification.severityType.error"),value:"error"}],x=g=>{(g!==o||!h)&&s(g)},n=y.useMemo(()=>{const g={width:"100%",bgcolor:r==="dark"?"#F9FAFB":"",overflowY:"auto",paddingTop:i==="select"?"0":"5px",whiteSpace:"nowrap",borderRadius:0,display:"flex",justifyContent:"space-between",alignItems:"flex-end",flexWrap:"wrap",gap:"8px"};return i==="line"?Object.assign(g,{}):g},[i,r]),f=(g,j,C)=>e.jsx(G,{disabled:h,onClick:()=>x(g.value),className:`profile-button ${j?"active":""}`,...a,children:g.label},g.value||C),k=(g,j,C)=>e.jsx(G,{variant:"text",disabled:h,onClick:()=>x(g.value),className:`profile-line-button ${j?"active":""}`,...a,children:g.label},g.value||C),v=()=>l?.map((g,j)=>{const C=o===g?.value;return i==="line"?e.jsx(y.Fragment,{children:k(g,C,j)},g.value||j):e.jsx(y.Fragment,{children:f(g,C,j)},g.value||j)}),d=g=>{const{value:j}=g.target;x(j==="all"?"":j)};return i==="select"?e.jsx(yr,{sx:{maxWidth:300},children:e.jsx(ye,{value:o||"all",onChange:d,size:"small",label:"Severity",IconComponent:g=>e.jsx(He,{...g,width:20,height:20}),MenuProps:{autoFocus:!1,PaperProps:{style:{maxHeight:400,overflowY:"auto",borderRadius:"8px",boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},variant:"outlined",sx:{fieldset:{border:"none"}},children:l.map((g,j)=>e.jsx(oe,{value:g.value||"all",children:e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ae,{severity:g.value}),g.label]})},g.value||j))})}):e.jsxs(m,{className:"severity-tabs",sx:n,children:[e.jsx(m,{sx:{...i==="line"?{flex:1,borderBottom:"1px solid",borderColor:"grey.200"}:{display:"flex",gap:"24px"}},children:v()}),t]})}tr.propTypes={paging:u.objectOf(u.any).isRequired,loading:u.bool.isRequired,onChange:u.func.isRequired};function tr({loading:r,paging:i,onChange:s}){const{t}=y.useContext(je),o=ve(l=>l.breakpoints.down("md"));if(i.pageCount<=0||o)return null;const h=(l,x)=>{s({page:x+1})},a=l=>{const x=Number(l.target.value);s({page:1,pageSize:x})},p=i.page-1<=0?0:i.page-1;return e.jsx(m,{className:"notification-pagination",sx:{mt:2,display:"flex",justifyContent:"flex-end"},children:e.jsx(vr,{component:"div",disabled:r,count:i.total,page:p,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:t("pagination.rowsPerPage"),labelDisplayedRows:({from:l,to:x,count:n})=>`${l}–${x} / ${n!==-1?n:`${t()}more than ${x}`}`,rowsPerPage:i.pageSize,onPageChange:h,onRowsPerPageChange:a})})}const Nt=y.memo(tr),Ut={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4h16v2.172a2 2 0 0 1-.586 1.414L15 12v7l-6 2v-8.5L4.52 7.572A2 2 0 0 1 4 6.227V4z"/>'},De=6,Be={"& .MuiCheckbox-root":{padding:"4px"},"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"1.35rem"},"& .MuiCheckbox-root:not(.Mui-checked)":{color:"divider"},"& .MuiCheckbox-root.Mui-checked":{color:"primary.main"},"& .MuiCheckbox-root .css-i4bv87-MuiSvgIcon-root":{width:"1.1em",height:"1.1em"},"& .MuiCheckbox-root svg":{stroke:"divider",strokeWidth:.7}},Ft={border:"1px solid",borderColor:"divider",borderRadius:1,overflow:"hidden",backgroundColor:"background.paper",backgroundImage:"none",transition:"all 0.2s ease-in-out"},Oe=()=>({...Ft,width:"calc(50% - 8px)"});or.propTypes={loading:u.bool,type:u.oneOf(["server","service"]),onFilterChange:u.func,blockletMap:u.object,filterType:u.oneOf(["component","entity"]),selectedId:u.array,severity:u.array,enableMarkAllAsRead:u.bool,unReadCount:u.number,onReadFilterChange:u.func,currentReadFilter:u.string};function or({onFilterChange:r=()=>{},loading:i=!1,type:s="service",blockletMap:t={},filterType:o="component",selectedId:h=[],severity:a=[],enableMarkAllAsRead:p=!0,unReadCount:l=0,onReadFilterChange:x=()=>{},currentReadFilter:n="all"}){const{t:f}=y.useContext(je),[k,v]=y.useState(null),d=!!k,[g,j]=y.useState(h),[C,D]=y.useState(a),[b,S]=y.useState(!1),[P,q]=y.useState(""),[B,N]=y.useState([]);y.useEffect(()=>{j(h),D(a)},[h,a]);const U=[{label:f("notification.filterType.all"),value:"all"},{label:f("notification.filterType.unread"),value:"unread"}],X=c=>{(c!==n||!i)&&x(c)},K=[{label:f("notification.severityType.info"),value:"info"},{label:f("notification.severityType.success"),value:"success"},{label:f("notification.severityType.warning"),value:"warning"},{label:f("notification.severityType.error"),value:"error"}],J=c=>{v(c.currentTarget),q(""),S(!1)},pe=()=>{v(null)},ee=c=>{const w=g.includes(c)?g.filter(I=>I!==c):[...g,c];j(w),r({id:w,severity:C})},re=c=>{const w=C.includes(c)?C.filter(I=>I!==c):[...C,c];D(w),r({severity:w,id:g})},fe=c=>{q(c.target.value)},he=()=>{S(!b)},_=Wr.useMemo(()=>{if(!t.size)return[];const c=[];return o==="component"&&c.push({label:f("notification.system"),id:"system"}),Array.from(t).forEach(([,w])=>{const I=w.did||w.meta?.did,z=w.title||w.meta?.title||"",O=w.appPid||w.appDid;(o==="component"&&O!==I||o==="entity"&&O===I)&&c.push({label:z,id:I,blocklet:w,ancestors:w.ancestors})}),c},[t,o,f]);y.useEffect(()=>{if(P.trim()==="")N(_);else{const c=P.toLowerCase(),w=_.filter(I=>I.label.toLowerCase().includes(c));N(w)}},[P,_]);const xe=P.trim()!==""||b?B:B.slice(0,De);return e.jsxs(m,{children:[e.jsxs(m,{sx:{display:"flex",justifyContent:p?"space-between":"flex-end",alignItems:"flex-start",flexWrap:"wrap",gap:1},children:[p&&e.jsx(m,{sx:{display:"flex",gap:1.5},children:U.map(c=>e.jsxs(G,{disabled:i,onClick:()=>X(c.value),className:`profile-button ${n===c.value?"active":""}`,sx:{...s==="service"&&n===c.value?{color:"secondary.main"}:{},color:"red",fontWeight:n===c.value?"bold":"normal"},children:[c.label,c.value==="unread"&&l>0&&` (${l})`]},c.value))}),e.jsxs(m,{sx:{display:"flex",justifyContent:"flex-end",gap:2},children:[e.jsx(W,{size:"small",onClick:J,disabled:i,sx:{minWidth:"auto",borderRadius:1,border:"1px solid",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:e.jsx(E,{icon:Ut,hFlip:!0})}),e.jsx(wr,{open:d,anchorEl:k,onClose:pe,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{p:3,width:450,maxHeight:500,overflowY:"auto",backgroundColor:"background.paper",backgroundImage:"none",borderRadius:1,boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},children:e.jsxs(m,{children:[e.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,height:"28px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("notification.severity")}),e.jsx(m,{sx:{minWidth:"60px",display:"flex",justifyContent:"flex-end"},children:(g.length>0||C.length>0)&&e.jsx(G,{size:"small",onClick:()=>{j([]),D([]),r({severity:[],id:[]})},startIcon:e.jsx(jr,{fontSize:"small"}),sx:{color:"text.secondary",textTransform:"none",minWidth:"auto","&:hover":{backgroundColor:"transparent"},"& .MuiButton-startIcon":{marginRight:"2px"}},children:f("notification.clear")})})]}),e.jsx(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(Se,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,flex:1},children:K.map(c=>e.jsx(Pe,{elevation:0,sx:Oe(C.includes(c.value)),children:e.jsx(Ie,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{display:"flex",alignItems:"center",gap:1,fontSize:"0.875rem"},...Be},control:e.jsx(Te,{checked:C.includes(c.value),onChange:()=>re(c.value),disabled:i,size:"small"}),label:e.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5},children:[e.jsx(ae,{severity:c.value}),c.label]})})},c.value))})}),e.jsxs(m,{sx:{mb:2},children:[e.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:1.5},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold",width:"calc(100% - 36px)"},children:f("notification.from")}),e.jsx(m,{sx:{display:"flex",alignItems:"center",width:"calc(100% - 36px)"},children:e.jsx(Ne,{size:"small",placeholder:"search",value:P,onChange:fe,sx:{width:"100%","& .MuiOutlinedInput-input":{padding:"6px 4px 6px 0"},".MuiOutlinedInput-root":{"&:hover":{fieldset:{borderColor:"divider"}},"&.Mui-focused":{fieldset:{borderColor:"divider"}}},fieldset:{borderColor:"divider"}},slotProps:{input:{size:"small",startAdornment:e.jsx(Ue,{position:"start",sx:{marginRight:"2px"},children:e.jsx(E,{icon:lt})})}}})})]}),e.jsx(Se,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2},children:xe.map(c=>e.jsx(Pe,{elevation:0,sx:Oe(g.includes(c.id)),children:e.jsx(Ie,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{fontSize:"0.875rem",width:"calc(100% - 36px)"},...Be},control:e.jsx(Te,{checked:g.includes(c.id),onChange:()=>ee(c.id),disabled:i,size:"small"}),label:e.jsxs(m,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,minWidth:0,width:"100%"},children:[c.blocklet&&e.jsx(ze,{size:20,blocklet:c.blocklet,ancestors:c.ancestors,style:{borderRadius:4,flexShrink:0}}),e.jsx(A,{noWrap:!0,variant:"body2",component:"span",title:c.label,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:c.label})]})})},c.id))}),B.length>De&&P.trim()===""&&e.jsx(G,{fullWidth:!0,size:"small",onClick:he,sx:{mt:1},endIcon:b?e.jsx(Cr,{}):e.jsx(kr,{})})]})]})})]})]}),g.length>0||C.length>0?e.jsxs(m,{className:"notification-filter-content",sx:{display:"flex",flexWrap:"wrap",gap:1,mt:2},children:[C.map(c=>{const w=K.find(I=>I.value===c);return e.jsx(Re,{label:e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(ae,{severity:c}),w?w.label:c]}),onDelete:()=>re(c),size:"small",variant:"outlined",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`severity-${c}`)}),g.map(c=>{const w=_.find(I=>I.id===c);return e.jsx(Re,{label:e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:.5},children:[w?.blocklet&&e.jsx(ze,{size:16,blocklet:w.blocklet,ancestors:w.ancestors,style:{borderRadius:4,flexShrink:0}}),w?w.label:c]}),variant:"outlined",onDelete:()=>ee(c),size:"small",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`component-${c}`)})]}):null]})}const qt=Z(Ir)`
|
|
2
|
+
position: fixed;
|
|
3
|
+
bottom: 20px;
|
|
4
|
+
right: 20px;
|
|
5
|
+
z-index: 1000;
|
|
6
|
+
@media (max-width: 600px) {
|
|
7
|
+
bottom: 16px;
|
|
8
|
+
right: 16px;
|
|
9
|
+
transform: scale(0.9);
|
|
10
|
+
}
|
|
11
|
+
`;function _t(){const[r,i]=y.useState(!1);y.useEffect(()=>{const t=Fe(()=>{i(window.pageYOffset>300)},200);return window.addEventListener("scroll",t),t(),()=>window.removeEventListener("scroll",t)},[]);const s=()=>{try{"scrollTo"in window?window.scrollTo({top:0,behavior:"smooth"}):window.scrollTo(0,0)}catch{window.scrollTo(0,0)}};return e.jsx(Sr,{in:r,children:e.jsx(qt,{color:"primary",size:"small","aria-label":"scroll back to top",onClick:s,children:e.jsx(Pr,{})})})}const Ht=Z.div`
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: ${r=>r.inDialog?0:"24px"};
|
|
15
|
+
.MuiContainer-root {
|
|
16
|
+
padding-right: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.profile-button.MuiButtonBase-root {
|
|
20
|
+
border-radius: 9999px;
|
|
21
|
+
margin-right: 2px;
|
|
22
|
+
padding: 5px 12px;
|
|
23
|
+
line-height: 22px;
|
|
24
|
+
font-size: 13px;
|
|
25
|
+
border: 1px solid transparent;
|
|
26
|
+
background-color: ${({theme:r})=>r.palette.background.default};
|
|
27
|
+
color: ${({theme:r})=>r.palette.text.primary};
|
|
28
|
+
font-weight: 400;
|
|
29
|
+
border: 1px solid ${({theme:r})=>r.palette.divider} !important;
|
|
30
|
+
}
|
|
31
|
+
.profile-button.active.MuiButtonBase-root,
|
|
32
|
+
.profile-button.active.MuiButtonBase-root:hover {
|
|
33
|
+
color: ${({theme:r})=>r.palette.primary.main};
|
|
34
|
+
font-weight: 600;
|
|
35
|
+
background-color: ${({theme:r})=>ne(r.palette.primary.main,.1)};
|
|
36
|
+
border: 1px solid ${({theme:r})=>ne(r.palette.primary.main,.24)} !important;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.profile-button.MuiButtonBase-root:hover {
|
|
40
|
+
background-color: rgba(0, 0, 0, 0.04);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.profile-line-button.MuiButtonBase-root {
|
|
44
|
+
margin-right: 2px;
|
|
45
|
+
color: ${({theme:r})=>r.palette.text.secondary};
|
|
46
|
+
padding: 5px 12px;
|
|
47
|
+
line-height: 22px;
|
|
48
|
+
font-size: 13px;
|
|
49
|
+
border: none !important;
|
|
50
|
+
border-radius: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.profile-line-button.active.MuiButtonBase-root {
|
|
54
|
+
color: ${({theme:r})=>r.palette.text.primary};
|
|
55
|
+
border-bottom: 1px solid ${({theme:r})=>r.palette.text.primary} !important;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.profile-button.MuiButtonBase-root:last-of-type,
|
|
59
|
+
.profile-line-button.MuiButtonBase-root {
|
|
60
|
+
margin-right: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.profile-line-button.MuiButtonBase-root:hover {
|
|
64
|
+
color: ${({theme:r})=>r.palette.text.primary};
|
|
65
|
+
background-color: unset;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
* {
|
|
69
|
+
scrollbar-width: none; /* Firefox */
|
|
70
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
*::-webkit-scrollbar {
|
|
74
|
+
display: none; /* Chrome, Safari and Opera */
|
|
75
|
+
}
|
|
76
|
+
`;nr.propTypes={blocklets:u.array,context:u.object,pagination:u.bool,inDialog:u.bool,filterType:u.oneOf(["component","entity"]),toViewAll:u.func,type:u.oneOf(["server","service"])};function nr({blocklets:r=[],context:i,pagination:s=!0,inDialog:t=!1,filterType:o="component",toViewAll:h=()=>{},type:a="service"}){const{data:p,paging:l,refresh:x,loading:n,params:f,onReadNotification:k,componentDids:v,filterUnReadCount:d,initial:g}=i,j=c=>{x({...f,severity:c&&typeof c=="string"?[c]:c||[],paging:{...f.paging,page:1}})},[C]=Lr(),D=R(()=>C.get("id"),[C]),b=ve(c=>c.breakpoints.down("md")),[S,P]=y.useState(0),[q,B]=y.useState(!1),N=y.useMemo(()=>f.read===!1?"unread":"all",[f.read]),U=R(()=>Fe(c=>{if(n)return;const w=p.length,I=p.filter(O=>!We(O)).length;let z={...f,append:!0,paging:{...f.paging,...c,currentPage:(l.currentPage||0)+1}};N==="unread"&&I<w&&c.page>f.paging.page&&(z={...f,append:!0,paging:{...f.paging,...c,page:f.paging.page||1,currentPage:(l.currentPage||0)+1}}),x(z)},500),[p,f,N,l,n,x]);Yr(()=>{g&&typeof g=="function"&&g()}),y.useEffect(()=>{(!l.currentPage||l.currentPage===1)&&P(l.total)},[l.total,l.currentPage]),y.useEffect(()=>{setTimeout(()=>{const c=document.getElementById(D);c&&c.scrollIntoView({behavior:"smooth",block:"center"}),B(!0)},100),setTimeout(()=>{B(!1)},3e3)},[D]);const X=R(()=>p?.length>0&&p.length<S,[p,S]),K=y.useCallback(c=>{const{blocklet:w={}}=window,I=[w?.did,...(w?.ancestors||[]).map(z=>z)];return v?.includes(c)||I.findIndex(z=>z===c)>-1},[v]),J=y.useMemo(()=>{const c=new Map;return r.length&&r.forEach(w=>{const I=w?.did||w.meta?.did;I&&!c.has(I)&&(w.ancestors=[],c.set(I,w),w?.alsoKnownAs?.length>0&&w.alsoKnownAs.forEach(z=>{c.has(z)||c.set(z,w)})),w?.children?.length>0&&w.children.forEach(z=>{const O=z?.did||z.meta?.did;O&&!c.has(O)&&K(O)&&(z.ancestors=[w],c.set(O,z))})}),c},[r,K]),pe=y.useCallback(()=>{n||U({page:l.page+1})},[l.page,n,U]),[ee]=$t({loading:n,hasNextPage:X,onLoadMore:pe}),re=c=>{!c||We(c)||k(c.id).then(()=>{t&&h()})},fe=({severity:c,id:w})=>{if(n)return;let I={};o==="component"?I={entityId:[],componentDid:w}:o==="entity"&&(I={componentDid:[],entityId:w}),x({...f,severity:c,...I,paging:{...f.paging,page:1}})},he=c=>{if(n)return;let w={...f,paging:{...f.paging,page:1}};c==="unread"?(w.read=!1,w.paging.currentPage=1):w=Br(w,"read"),x(w)},_=R(()=>o==="component"?Array.isArray(f.componentDid)?f.componentDid:[]:o==="entity"?Array.isArray(f.entityId)?f.entityId:[]:[],[f,o]),xe=R(()=>(Array.isArray(f.severity)?f.severity:[])[0]||"",[f.severity]);return e.jsxs(Ht,{inDialog:!!t,children:[t?e.jsx(rr,{currentTab:xe,type:"line",theme:"light",onSelectType:j}):e.jsx(or,{loading:n,blockletMap:J,unReadCount:d,filterType:o,type:a,selectedId:_,onFilterChange:fe,severity:f.severity,onReadFilterChange:he,currentReadFilter:N}),!b&&n?e.jsx(m,{sx:{display:"flex",width:"100%",minHeight:400,justifyContent:"center",alignItems:"center"},children:e.jsx(Y,{})}):e.jsx(at,{data:p,blockletMap:J,onReadNotification:re,onReadBatch:k,inDialog:t,highlightId:D,highlight:!t&&q,type:a}),s&&!b?e.jsx(Nt,{loading:n,paging:l,onChange:U}):null,s&&b&&(n||X)?e.jsx(m,{ref:ee,sx:{display:"flex",width:"100%",minHeight:100,justifyContent:"center",alignItems:"center"},children:e.jsx(Y,{})}):null,!t&&b?e.jsx(_t,{}):null]})}const Gt=y.memo(nr);function ue(r){const{userDid:i=""}={},{session:s}=Ur(),t=R(()=>{if(i)return i;const l=window.location.href,x=Or(l);return x?.did?Array.isArray(x.did)?x.did[0]:x.did:s?.user?.did},[s?.user?.did,i]),o=R(()=>s.user,[s]),h=R(()=>o?t===o?.did:!1,[t,o?.did]),a=ce(async()=>{if(await Fr(()=>s?.initialized),h)return s.user;if(t)return F.user.getUserPublicInfo({did:t})},{refreshDeps:[t,h,s?.initialized,o]}),p=R(()=>o?.passports?.some(l=>l.role===qr.OWNER),[o]);return{currentDid:t,session:s,isMyself:h,user:o,viewUser:a.data,isOwner:p}}function sr({user:r,...i}){const{t:s}=L(),t=Tr(),o=R(()=>{const p=(r?.passports||[]).map(l=>({...l,revoked:l.status===Zr.REVOKED}));return p.sort((l,x)=>l.revoked===x.revoked?0:l.revoked?1:-1),Ae(p.filter(l=>!l.display),"role").concat(Ae(p.filter(l=>l.display),"display.content"))},[r?.passports]),h=R(()=>o?.find(p=>p.name===r.role),[o,r?.role]),a=t.palette.primary.main;return o.length===0?e.jsx(m,{children:e.jsx(Ge,{children:s("userCenter.noPassport")})}):e.jsx(m,{...i,sx:{display:"grid",justifyItems:"start",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(2, 1fr)",md:"repeat(3, 1fr)",lg:"repeat(5, 1fr)"},gap:2.5,...i.sx},children:o.map(p=>e.jsx(dt,{passport:p,user:r,color:window.blocklet.passportColor,createPassportSvg:gt,title:h&&h.role===p.role?s("userCenter.currentPassport"):"",sx:{flexDirection:"column",alignItems:"center",gap:1,".passport-item__display":{width:166,height:166,borderRadius:1,px:2,display:"flex",justifyContent:"center",backgroundColor:"grey.50",boxShadow:h&&h.role===p.role?`0px 2px 4px 0px ${a}, 0px 1px 2px -1px ${a}, 0px 0px 0px 1px ${a} !important`:"unset"},".passport-item__body":{marginLeft:"0 !important"}}},p.id))})}sr.propTypes={user:u.object.isRequired};function Kt({visible:r,onClose:i,nft:s}){return!r||!s?null:e.jsx(Yt,{children:e.jsx(Rr,{open:r,onClose:i,children:e.jsx(Vt,{onClick:i,children:e.jsx(Qe,{data:Xe(s),address:s.address,inset:!0})})})})}const Yt=Z.div`
|
|
77
|
+
position: relative;
|
|
78
|
+
width: 100%;
|
|
79
|
+
height: 100%;
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
|
|
82
|
+
&:hover {
|
|
83
|
+
.mask {
|
|
84
|
+
opacity: 1;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.mask {
|
|
89
|
+
position: absolute;
|
|
90
|
+
top: 0;
|
|
91
|
+
left: 0;
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
width: 100%;
|
|
96
|
+
height: 100%;
|
|
97
|
+
background: rgba(0, 0, 0, 0.6);
|
|
98
|
+
opacity: 0;
|
|
99
|
+
transition: opacity 0.2s;
|
|
100
|
+
}
|
|
101
|
+
`,Vt=Z.div`
|
|
102
|
+
display: flex;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
align-items: center;
|
|
105
|
+
height: 100vh;
|
|
106
|
+
width: 100vw;
|
|
107
|
+
|
|
108
|
+
img,
|
|
109
|
+
object {
|
|
110
|
+
max-width: 90vw;
|
|
111
|
+
max-height: 75vh;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.nft-display--inset {
|
|
115
|
+
> .MuiBox-root,
|
|
116
|
+
.nft-display__loading {
|
|
117
|
+
width: 75vmin;
|
|
118
|
+
height: 75vmin;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
`,Zt=r=>({position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.6)",opacity:0,transition:"opacity 0.3s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1,"& .mask-item":{backgroundColor:ne(r.palette.background.paper,.9),color:"text.primary","&:hover":{backgroundColor:ne(r.palette.background.paper,1)}}}),Qt={position:"absolute",bottom:0,left:0,right:0,height:24,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",gap:1,zIndex:1,"& .mask-item":{width:20,height:20,color:"white"}},$e="https://main.abtnetwork.io/explorer";function ir({user:r}){const{t:i,locale:s}=L(),t=de(),[o,h]=y.useState({visible:!1,nft:null}),[a,p]=y.useState({anchorEl:null,props:null}),l=b=>{const S=se($e,"assets",b);window.open(S,"_blank")},x=(b,S)=>{let P="";typeof S.data?.value=="string"?P=JSON.parse(S.data?.value)?.domain:P=S.data?.value?.domain,p({anchorEl:b,props:{title:P?`Hey, I just won an NFT at the ${P} event!`:"Hey, I just won an NFT!",url:se($e,"assets",S.address)}})},n=b=>{h({visible:!0,nft:b})},f=Q({page:1,size:20}),k=ce(async(b=f)=>(await $r.get(`${qe}/ocap/listAssets`,{params:{ownerAddress:r.did,...b}})).data,{ready:r?.did&&f,defaultParams:[f],refreshDeps:[r?.did,f]}),{loading:v,data:d}=k,g=d?.page??{cursor:0,next:!1,total:0},j=(b,S)=>{f.page=S,k.run(f)},C=M(b=>[e.jsx(W,{size:"small",className:"mask-item",onClick:S=>{S.stopPropagation(),l(b.address)},children:e.jsx(E,{icon:"tabler:link",fontSize:18})},"link"),e.jsx(W,{size:"small",onClick:S=>{S.stopPropagation(),x(S.currentTarget,b)},className:"mask-item",children:e.jsx(E,{icon:"tabler:share-2",fontSize:18})},"share"),e.jsx(W,{size:"small",onClick:S=>{S.stopPropagation(),n(b)},className:"mask-item",children:e.jsx(E,{icon:"tabler:eye",fontSize:18})},"view")]),D=R(()=>{if(v){const b=["skeleton-1","skeleton-2","skeleton-3","skeleton-4","skeleton-5"].map(S=>e.jsx(Me,{variant:"rectangular",width:"15%",height:166,sx:{borderRadius:1,flexShrink:0}},S));return e.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(Me,{width:"20%"}),e.jsx(m,{sx:{display:"flex",flexDirection:"row",gap:2,flexWrap:"nowrap"},children:b})]})}return e.jsxs(e.Fragment,{children:[e.jsx(A,{sx:{color:"grey.A700",fontWeight:600,mb:2.5},children:i("userCenter.common.nft")}),d?.assets?.length===0&&!v&&e.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},children:e.jsx(Ge,{children:i("userCenter.common.noNFT")})}),e.jsx(m,{className:"nft-list-wrapper",sx:{display:"grid",justifyItems:"start",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(3, 1fr)",md:"repeat(3, 1fr)",lg:"repeat(5, 1fr)"},gap:2.5},children:d?.assets?.map(b=>e.jsxs(m,{sx:{flexShrink:0,width:{xs:120,sm:120,md:120,lg:166},height:{xs:120,sm:120,md:120,lg:166},position:"relative",borderRadius:1,overflow:"hidden",cursor:"pointer",...t?{}:{"&:hover .mask":{opacity:1}}},children:[e.jsx(Qe,{data:Xe(b),address:b.address,inset:!0,imageFilter:{imageFilter:"resize",w:"500",f:"webp"}}),t?e.jsx(m,{className:"footer-mask",sx:Qt,children:C(b)}):e.jsx(m,{className:"mask",sx:Zt,children:e.jsx(we,{direction:"row",spacing:1,children:C(b)})})]},b.address))}),g.next||f.page>1?e.jsx(Mr,{sx:{display:"flex",justifyContent:"center",mt:2},page:f.page,onChange:j,count:Math.ceil(g.total/f.size),size:"small"}):null,e.jsx(Kt,{visible:o.visible&&!!o.nft,nft:o.nft,onClose:()=>{h({visible:!1,nft:null})}}),e.jsx(Qr,{locale:s,anchorEl:a.anchorEl,onClose:()=>{p({anchorEl:null,props:null})},sharedProps:a.props||{title:"",url:""}})]})},[v,g,f.page,f.size,j,a,o]);return e.jsx(m,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2,mb:5},children:D})}ir.propTypes={user:u.object.isRequired};function Xt(){const{t:r}=L(),{user:i,isMyself:s,viewUser:t}=ue();return e.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[s?e.jsxs(m,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,p:2},children:[e.jsx(A,{sx:{color:"text.primary",fontWeight:600,mb:2.5},children:r("userCenter.passport")}),e.jsx(sr,{user:i})]}):null,e.jsx(ir,{user:s?i:t})]})}const Jt=[{name:"English",code:"en"},{name:"中文",code:"zh"}];function ar({user:r,onSave:i}){const{t:s,changeLocale:t}=L(),o=Q({locale:r.locale,loading:!1}),h=M(async a=>{try{const{value:p}=a.target;o.loading=!0,await F.user.saveProfile({locale:p}),await i("profile"),t(p),o.locale=p}catch(p){$.error(V(p))}finally{o.loading=!1}});return e.jsxs(m,{sx:{gap:1,display:"grid",alignItems:"center",gridTemplateColumns:{xs:"1fr",sm:"max-content 1fr"}},children:[e.jsx(m,{children:s("userCenter.commonSetting.locale")}),e.jsx(m,{children:e.jsx(ye,{value:o.locale,onChange:h,size:"small",IconComponent:a=>e.jsx(He,{...a,width:20,height:20}),sx:{minWidth:200,"&:hover":{"fieldset.MuiOutlinedInput-notchedOutline":{borderColor:"divider"}},fieldset:{borderColor:"divider"}},children:(window.blocklet.languages||Jt).map(a=>e.jsx(oe,{value:a.code,children:a.name},a.code))})})]})}ar.propTypes={user:u.shape({locale:u.string}).isRequired,onSave:u.func.isRequired};function lr({type:r,url:i,enabled:s,onEdit:t,onChange:o,onDelete:h}){return e.jsxs(m,{sx:{display:"flex",width:"100%",alignItems:"center",justifyContent:"space-between",py:1,px:1.5,gap:.75,borderRadius:1,"& .hover-actions":{opacity:0,transition:"opacity 0.2s"},"&:hover":{backgroundColor:"action.hover","& .hover-actions":{opacity:1}}},children:[e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1,flex:1,minWidth:0,cursor:"pointer"},onClick:t,children:[e.jsx(ge,{title:r,children:e.jsx(E,{icon:r==="slack"?"logos:slack-icon":"material-symbols:link-rounded"})}),e.jsx(A,{sx:{color:"text.primary",fontSize:14,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i})]}),e.jsxs(m,{sx:{minWidth:72,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"flex-end",gap:1},children:[e.jsx(W,{className:"hover-actions",size:"small",onClick:t,sx:{p:0},children:e.jsx(E,{icon:Ve})}),e.jsx(W,{color:"error",onClick:h,size:"small",sx:{p:0},children:e.jsx(E,{icon:Ze})}),e.jsx(Je,{checked:s,onChange:o})]})]})}lr.propTypes={type:u.string.isRequired,url:u.string.isRequired,onEdit:u.func.isRequired,onChange:u.func.isRequired,enabled:u.bool.isRequired,onDelete:u.func.isRequired};function be({onTest:r=H,onDelete:i=H,onSave:s=H,onCancel:t=H,type:o="slack",url:h="",enabled:a=!0,edit:p=!1,webhooks:l=[]}){const{t:x}=L(),n=Q({type:o||"slack",url:h||"",edit:p??!1,enabled:a??!0,error:"",loading:!1}),f=M(()=>n.url?n.type==="slack"&&!_r.isSlackWebhookUrl(n.url)||!Hr(n.url)?(n.error=x("common.invalid"),!1):l.some(C=>C.url===h&&n.url===h?!1:C.url===n.url)?(n.error=x("common.duplicate"),!1):(n.error="",!0):(n.error=x("common.required"),!1)),k=M(()=>{n.edit=!1,n.url=h||"",n.type=o||"slack",n.error="",n.loading=!1,t()}),v=M(async j=>{n.loading=!0,await r(j),n.loading=!1}),d=M(j=>()=>{f()&&j({type:n.type,url:n.url,enabled:n.enabled})}),g=R(()=>n.error?e.jsx(A,{component:"span",color:"error",children:n.error}):n.edit?n.loading?e.jsx(Y,{size:16}):e.jsx(W,{size:"small",onClick:d(v),sx:{mr:-1},children:e.jsx(E,{icon:ut})}):null,[n.error,n.edit,n.loading]);return n.edit?e.jsxs(m,{sx:{display:"flex",gap:1.5,px:1.5,width:"100%",alignItems:{xs:"flex-start",md:"center"},flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(ye,{sx:{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}},disabled:!n.edit||n.loading,size:"small",value:n.type,onChange:j=>{n.type=j.target.value},children:[e.jsx(oe,{value:"api",children:x("userCenter.webhook.url")}),e.jsx(oe,{value:"slack",children:x("userCenter.webhook.slack")})]}),e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:.5,width:"100%"},children:[e.jsx(Ne,{sx:{flex:1,".MuiInputBase-root":{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}}},disabled:!n.edit||n.loading,fullWidth:!0,size:"small",required:!0,value:n.url,onChange:j=>{n.url=j.target.value,n.error="",f()},error:!!n.error,slotProps:{input:{endAdornment:e.jsx(Ue,{position:"end",children:g})}}}),e.jsx(m,{sx:{display:"flex",gap:.5},children:n.edit?e.jsxs(e.Fragment,{children:[e.jsx(W,{color:"success",onClick:d((...j)=>{s(...j),n.edit=!1}),sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(E,{icon:Xr})}),e.jsx(W,{color:"error",onClick:k,sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(E,{icon:Jr})})]}):e.jsxs(e.Fragment,{children:[e.jsx(W,{onClick:()=>{n.edit=!0},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(E,{icon:Ve})}),e.jsx(W,{color:"error",onClick:()=>{i({type:n.type,url:n.url})},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(E,{icon:Ze})})]})})]})]}):e.jsx(lr,{type:n.type,url:n.url,enabled:n.enabled,onEdit:()=>{n.edit=!0},onChange:j=>{n.enabled=j,d((...C)=>s(...C))()},onDelete:()=>{i({type:n.type,url:n.url})}})}be.propTypes={onTest:u.func,onDelete:u.func,onSave:u.func,onCancel:u.func,type:u.oneOf(["api","slack"]),url:u.string,edit:u.bool,webhooks:u.array,enabled:u.bool};function te({title:r=void 0,description:i=void 0,value:s,onChange:t,isMobile:o,type:h}){const a=M(p=>{p.stopPropagation()});return e.jsxs(m,{sx:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",py:1,px:1.5,gap:.75,borderRadius:1,"&:hover":{backgroundColor:"action.hover"}},children:[e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[h==="push"?e.jsx(E,{icon:"tabler:bell"}):e.jsx(er,{provider:h,sx:{width:"1em",height:"1em",flexShrink:0,fontSize:16}}),e.jsxs(A,{component:"div",onClick:a,sx:{color:"text.primary",fontSize:14,display:"flex",flexWrap:o?"wrap":"nowrap",columnGap:1,flex:1,whiteSpace:o?"normal":"nowrap"},children:[r,i]})]}),e.jsx(Je,{sx:{minWidth:36,flexShrink:0},checked:s,onChange:t})]})}te.propTypes={title:u.string,description:u.node,value:u.bool.isRequired,onChange:u.func.isRequired,isMobile:u.bool.isRequired,type:u.oneOf(["wallet","email","push"]).isRequired};function cr({user:r,isMobile:i}){const{t:s}=L(),t=Q({showAdd:!1}),o=ce(async()=>await F.user.getUserNotificationConfig(),{refreshDeps:[r],loadingDelay:300}),h=R(()=>({wallet:!0,email:!0,phone:!1,push:!0,...o?.data?.notifications||{}}),[o?.data?.notifications]),a=R(()=>o?.data?.webhooks||[],[o?.data?.webhooks]),p=M(async v=>{try{await F.user.saveUserNotificationConfig(v),$.success(s("userCenter.saveSuccess")),o.run()}catch(d){$.error(V(d))}}),l=M(async(v,d)=>{await p({notifications:{[v]:d}})}),x=async v=>{try{await F.user.testNotificationWebhook(v),$.success(s("userCenter.webhookTested"))}catch(d){$.error(V(d))}},n=M(async v=>{await p({webhooks:a.filter((d,g)=>g!==v)})}),f=M(async(v,d)=>{await p({webhooks:a.map((g,j)=>j===v?d:g)})}),k=M(async v=>{await p({webhooks:[...a,v]}),t.showAdd=!1});return o.error?e.jsx(Ar,{severity:"error",children:o.error.message}):o.loading||!o.data?e.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px"},children:e.jsx(Y,{})}):e.jsxs(m,{sx:{display:"flex",flexDirection:"column",".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:[e.jsxs(m,{sx:{display:"flex",flexDirection:"column",alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}}},children:[e.jsx(te,{value:h.wallet,isMobile:i,type:"wallet",title:s("userCenter.walletNotification"),onChange:v=>l("wallet",v),description:Ee(r)&&e.jsx(et,{did:Ee(r),showQrcode:!1,showAvatar:!i,copyable:!0,compact:!0,responsive:!0,startChars:i?2:6})}),e.jsx(te,{value:h.email,isMobile:i,type:"email",onChange:v=>l("email",v),title:s("userCenter.emailNotification"),description:r?.email&&e.jsx(A,{component:"span",sx:{color:"text.secondary",fontSize:13},children:r?.email})}),e.jsx(te,{isMobile:i,value:h.push,type:"push",title:s("userCenter.pushNotification"),onChange:v=>l("push",v)})]}),e.jsxs(we,{useFlexGap:!0,direction:"column",sx:{alignItems:"start"},children:[a.map((v,d)=>e.jsx(be,{enabled:v.enabled,onTest:x,onDelete:()=>n(d),onSave:(...g)=>f(d,...g),type:v.type,url:v.url,edit:!1,webhooks:a},`${d}_${v.url}`)),t.showAdd&&e.jsx(be,{onTest:x,onCancel:()=>{t.showAdd=!1},onSave:(...v)=>k(...v),edit:!0,webhooks:a},"add"),e.jsx(Ke,{variant:"outlined",size:"small",sx:{color:"text.primary",borderColor:"divider","&:hover":{borderColor:"divider"},py:.5,borderRadius:1,mt:1,ml:1.5},startIcon:e.jsx(E,{icon:pt}),onClick:()=>{t.showAdd=!0},children:s("userCenter.addWebhook")})]})]})}cr.propTypes={user:u.object.isRequired,isMobile:u.bool.isRequired};function dr({item:r}){const i=Ce(),{blocklet:s}=jt(),{confirmApi:t,confirmHolder:o}=_e(),h=Q({loading:!1}),{t:a}=L(),{session:p}=y.use(le),{bindOAuth:l,unbindOAuth:x,setBaseUrl:n,baseUrl:f}=p.useOAuth(),{disconnectPasskey:k,setTargetAppPid:v}=p.usePasskey(),d=R(()=>rt[r?.provider]||"unknown",[r?.provider]),g=M(b=>b?._bind?b.provider===T.WALLET&&b.did?a("userCenter.thirdPartyLogin.walletAccountCantRemove"):b.provider===T.PASSKEY&&i.arcSphere?a("userCenter.thirdPartyLogin.dontSupportRemoveinArcSphere"):b._mainProvider&&i.arcSphere?a("userCenter.thirdPartyLogin.mainProviderCantRemove"):"":""),j=M(async()=>{if(r?.provider===T.PASSKEY){await new Promise((b,S)=>{t.open({title:a("userCenter.thirdPartyLogin.disconnectPasskey",{name:d}),content:a("userCenter.thirdPartyLogin.disconnectPasskeyDescription",{name:d}),confirmButtonText:a("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:a("common.cancel"),onConfirm(P){k({session:p,connectedAccount:r}).then(b).catch(S),P()},onCancel:b})});return}try{h.loading=!0,await new Promise((b,S)=>{if(r?._bind)t.open({title:a("userCenter.thirdPartyLogin.confirmUnbind",{name:d}),content:a("userCenter.thirdPartyLogin.confirmUnbindDescription",{name:d}),confirmButtonText:a("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:a("common.cancel"),onConfirm(P){x({session:p,connectedAccount:{...Nr(r,["did","pk"]),showProvider:r.provider,provider:r._rawProvider}}).then(b).catch(S),P()},onCancel:b});else if(r.provider===T.WALLET)t.open({title:a("userCenter.thirdPartyLogin.confirmBindWallet",{name:d}),content:a("userCenter.thirdPartyLogin.confirmBindWalletDescription",{name:d}),confirmButtonText:a("common.confirm"),confirmButtonProps:{color:"primary"},cancelButtonText:a("common.cancel"),onConfirm:P=>{p.bindWallet({onSuccess:b,onCancel:S}),P()},onCancel:b});else{const P=f,q=window?.blocklet;let B="/";const N=tt(q),U=ot(q);N&&U?.appPid&&p?.user?.sourceAppPid&&(B=U.appUrl),n(B),v(s?.appPid),l({session:p,oauthItem:{...r,provider:r._rawProvider}}).then(b).catch(S).finally(()=>{n(P),v()})}})}catch(b){console.error(`Failed to ${r?._bind?"unbind":"bind"} oauth account`,b)}finally{h.loading=!1}}),C=M(b=>b.provider===T.WALLET&&b.did?a("userCenter.thirdPartyLogin.walletAccount"):b._mainProvider?a("userCenter.thirdPartyLogin.mainAccount"):b?._bind?a("userCenter.thirdPartyLogin.disconnect"):a("userCenter.thirdPartyLogin.connect")),D=M(b=>b.provider===T.WALLET&&b.did||b.provider===T.PASSKEY&&(i.arcSphere||i.wallet)?!0:!!r._mainProvider,[i.arcSphere]);return e.jsxs(e.Fragment,{children:[e.jsxs(m,{sx:{borderRadius:1,border:"1px solid",borderColor:"divider",backgroundColor:"grey.50",display:"flex",alignItems:"center",py:1,px:1.5,gap:.75,fontSize:"14px",lineHeight:1,overflow:"hidden"},children:[e.jsx(er,{provider:r?.provider,sx:{width:"1em",height:"1em",flexShrink:0,fontSize:16}}),e.jsx(m,{sx:{flex:1,display:{xs:r.userInfo?.email||r.did?"none":"block",sm:"block"}},children:d}),r.userInfo?.email||r.did?e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:.5,overflow:"hidden"},children:[e.jsx(m,{sx:{flex:1,textOverflow:"ellipsis",overflow:"hidden",lineHeight:"normal"},children:r.userInfo?.email||r.did}),r.userInfo?.name?e.jsx(ge,{title:e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(nt,{size:36,variant:"circle",shape:"circle",src:r.userInfo?.picture,did:r.did}),e.jsxs(m,{children:[e.jsx(A,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:r.userInfo?.name}),e.jsx(A,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:r.userInfo?.email})]})]}),children:e.jsx(m,{component:E,icon:Ct,sx:{color:"text.secondary",fontSize:16,cursor:"pointer",flexShrink:0}})}):null]}):null]}),e.jsx(ge,{title:g(r),placement:"auto",children:e.jsx(m,{children:e.jsx(Ke,{variant:"outlined",size:"small",sx:b=>{const S=b.palette.error.main,P=b.palette.primary.main;return{color:r?._bind?S:P,borderColor:r?._bind?S:P,backgroundColor:"background.default","&:hover":{borderColor:r?._bind?S:P,backgroundColor:"action.hover"},py:.5,borderRadius:1,fontWeight:500,whiteSpace:"nowrap"}},fullWidth:!0,startIcon:h.loading?null:e.jsx(E,{icon:ft}),onClick:j,disabled:D(r),loading:h.loading,children:C(r)})})}),o]})}dr.propTypes={item:u.shape({provider:u.string,did:u.string,pk:u.string,userInfo:u.object,id:u.string,_bind:u.bool,_rawProvider:u.string,_mainProvider:u.bool}).isRequired};function ur({user:r}){const{session:i}=y.use(le),[s,t]=y.useState({}),{getOAuthConfigs:o}=i.useOAuth(),h=Ce();Vr(async()=>{const l=await o({sourceAppPid:r?.sourceAppPid});t(l)},[r?.sourceAppPid]);const a=R(()=>{const l=Object.keys(s).map(x=>({...s[x],provider:x})).filter(x=>x.enabled);return[{provider:T.WALLET,order:-1},...l,{provider:T.PASSKEY,order:1/0}]},[s]),p=R(()=>{const l=st(r);let x=!1,n="",f=it(r);const k=l.find(d=>d.provider===T.AUTH0);return k&&(k.id.startsWith("google-oauth2|")&&(l.some(d=>d.provider==="google")||(x=!0,n=T.GOOGLE,f===T.AUTH0&&(f=T.GOOGLE))),k.id.startsWith("appleid|")&&(l.some(d=>d.provider===T.APPLE)||(x=!0,n=T.APPLE,f===T.AUTH0&&(f=T.APPLE))),k.id.startsWith("github|")&&(l.some(d=>d.provider===T.GITHUB)||(x=!0,n=T.GITHUB,f===T.AUTH0&&(f=T.GITHUB)))),a.flatMap(d=>{if(d.provider===T.AUTH0&&x)return null;if(d.provider===T.PASSKEY){const j=l.filter(C=>C.provider===T.PASSKEY);return j.length===0?null:j.map(C=>({...d,provider:d.provider,did:C.did,pk:C.pk,userInfo:C.userInfo,_bind:!0,_rawProvider:C.provider,_mainProvider:d.provider===f}))}const g=x&&d.provider===n?l.find(j=>j.provider===T.AUTH0):l.find(j=>j.provider===d.provider);return g?{...d,provider:d.provider,did:g.did,pk:g.pk,userInfo:g.userInfo,_bind:!0,_rawProvider:g.provider,_mainProvider:d.provider===f}:{...d,provider:d.provider,_rawProvider:d.provider,_mainProvider:d.provider===f}}).filter(d=>!!d).sort((d,g)=>d._mainProvider?-1:d?.order!==void 0&&g?.order!==void 0?d.order-g.order:d?.order!==void 0?-1:1)},[r?.connectedAccounts,a]);return e.jsxs(m,{sx:{gap:1,display:"grid",gridTemplateColumns:"1fr min-content"},children:[p.map(l=>e.jsx(dr,{item:l},l?.provider)),h.wallet||h.arcSphere?null:e.jsx(wt,{behavior:"only-new",action:"connect",createMode:"connect",createButtonText:"Add New Passkey",onSuccess:H,onError:H,dense:!0,sx:{px:1.5,py:1,gap:.75}})]})}ur.propTypes={user:u.object.isRequired};function pr({configList:r,onSave:i}){const[s,t]=y.useState(r),{t:o}=L(),h=M(async(a,p)=>{try{const l=await F.user.saveUserPrivacyConfig({[a]:typeof p=="string"?p:!p});t(s.map(x=>({...x,value:l?.[x.key]??x.value}))),$.success(o("userCenter.saveSuccess")),i("privacy")}catch(l){$.error(V(l))}});return y.useEffect(()=>{t(r)},[r]),e.jsx(m,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}},".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:s.map(a=>{if(a.isPrivate)return null;const p=!a.value||["all","follower-only"].includes(a.value);return e.jsxs(m,{children:[e.jsx(Le,{checked:p,labelProps:{label:e.jsx(A,{sx:{color:"text.primary",fontSize:14,display:"flex",flexFlow:"wrap",columnGap:1,flex:1},children:o("userCenter.toPublic",{name:a.name})})},size:"small",onChange:l=>{const{checked:x}=l.target;a.followersOnly?h(a.key,x?"all":"private"):h(a.key,x)}},a.key),a.followersOnly&&p&&e.jsx(m,{sx:{pl:3,pt:1},children:e.jsx(Le,{checked:a.value==="follower-only",labelProps:{label:e.jsx(A,{sx:{color:"text.primary",fontSize:14,display:"flex",flexFlow:"wrap",columnGap:1,flex:1},children:o("team.userFollowers.followersOnly")})},size:"small",onChange:l=>{const{checked:x}=l.target;h(a.key,x?"follower-only":"all")}})})]})})})}pr.propTypes={configList:u.arrayOf(u.shape({key:u.string.isRequired,name:u.string.isRequired,value:u.bool.isRequired,isPrivate:u.bool})).isRequired,onSave:u.func.isRequired};function fr({onDestroySelf:r=void 0}){const{confirmHolder:i}=_e(),{t:s}=L(),{session:t}=y.use(le),o=M(async()=>{if(!r||typeof r!="function")return;const h=t.withSecondaryAuth(r,{extraParams:{removeUserDid:t?.user?.did,input:{user:{did:t?.user?.did},teamDid:window?.blocklet?.did}},operation:"destroySelf"});try{await h(),t.logout()}catch(a){$.error(a?.message||s("userCenter.destroyMyself.error"))}});return e.jsxs(e.Fragment,{children:[e.jsx(m,{children:e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"space-between",flexWrap:"wrap"},children:[e.jsxs(m,{children:[e.jsx(A,{variant:"h6",sx:{fontSize:"0.875rem !important",fontWeight:"bold"},children:s("userCenter.dangerZone.deleteAccount")}),e.jsx(A,{variant:"caption",sx:{color:"text.secondary"},children:s("userCenter.dangerZone.deleteAccountDescription")})]}),e.jsx(G,{variant:"contained",color:"error",size:"small",onClick:o,children:s("userCenter.dangerZone.delete")})]})}),i]})}fr.propTypes={onDestroySelf:u.func};function eo(){const r=de({key:"md"}),i=ve(o=>o.breakpoints.down("lg")),s={display:"flex",justifyContent:"flex-end",flexWrap:"wrap",textAlign:"right","&.expired-at > div":{maxWidth:160,justifyContent:"flex-end",flexWrap:"wrap"}},t=R(()=>Ye({},r?s:{}),[r]);return e.jsx(m,{id:"user-center-access-key-setting",sx:{maxWidth:r?"unset":i?"calc(100vw - 300px)":"100%",...r&&{".pc-access-key-table > div:nth-child(2)":{border:"1px solid",borderColor:"divider",borderRadius:1}},".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableRow-root":{border:"unset","&:nth-child(even)":{backgroundColor:"grey.50","&:hover":{backgroundColor:o=>`${o.palette.grey[50]} !important`}}},".MuiTableRow-hover":{"&:hover":{backgroundColor:"inherit !important"}},".MuiTableCell-root":{paddingRight:"8px",paddingLeft:"8px",color:"text.secondary",...r&&{padding:"8px !important","&:first-child":{paddingTop:"20px!important"},"&:last-child":{paddingBottom:"20px!important"}}}},children:e.jsx(kt,{isSelf:!0,columnSx:t})})}function hr({onDestroySelf:r=void 0,userCenterTabs:i=[]}){const{t:s}=L(),{user:t,session:o,isMyself:h,isOwner:a}=ue(),l=Ce().arcSphere,x=de({key:"md"}),n=ce(async()=>t&&h?await F.user.getUserPrivacyConfig({did:t.did}):null,{refreshDeps:[t,h],loadingDelay:300}),f=R(()=>i.map(d=>({key:d.value,name:d.label,value:d.protected,isPrivate:d.isPrivate,followersOnly:d.followersOnly})).filter(d=>!d.isPrivate),[i]),k=M(async d=>d==="privacy"?(await n.runAsync(),n.data):(d==="profile"&&await o.refresh(),null));y.useEffect(()=>{const d=window.location.hash.slice(1);d&&document.getElementById(d)?.scrollIntoView({behavior:"smooth"})},[]);const v=R(()=>[l?void 0:{label:s("userCenter.commonSetting.title"),value:"common",content:e.jsx(ar,{user:t,onSave:k})},{label:s("userCenter.notificationManagement"),value:"notification",content:e.jsx(cr,{user:t,isMobile:x})},{label:s("userCenter.thirdPartyLogin.title"),value:"thirdPartyLogin",content:e.jsx(ur,{user:t})},{label:s("common.accessKeys"),value:"accessKeys",content:e.jsx(eo,{isSelf:!0})},{label:s("common.mcpServers"),value:"mcpServers",content:e.jsx(bt,{})},f.length>0&&{label:s("userCenter.privacyManagement"),value:"privacy",content:e.jsx(pr,{configList:f,onSave:k})},{label:s("userCenter.sessionManagement"),value:"session",content:e.jsx(yt,{user:t,showUser:!1,getUserSessions:d=>F.userSession.getMyLoginSessions({},d)})},!a&&r&&typeof r=="function"?{label:s("userCenter.dangerZone.title"),value:"dangerZone",content:e.jsx(fr,{onDestroySelf:r}),sx:{borderColor:"error.main"}}:null].filter(Boolean),[t,f,x,a,r]);return h?e.jsx(m,{className:"user-center-settings",sx:{display:"flex",flexDirection:"column",gap:2.5,minWidth:{md:500},"@media (min-width: 1200px) and (max-width: 1260px)":{maxWidth:750},"@media (min-width: 1100px) and (max-width: 1199px)":{maxWidth:650},"@media (min-width: 1000px) and (max-width: 1099px)":{maxWidth:600},"@media (max-width: 1049px)":{maxWidth:"100%"}},children:v.map(d=>d?e.jsxs(m,{id:d.value,sx:Ye({border:"1px solid",borderColor:"divider",borderRadius:1,p:2,"&:last-child":{mb:5}},d.sx),children:[e.jsx(A,{sx:{color:"text.primary",fontWeight:600},children:d.label}),e.jsx(m,{sx:{mt:2.5},children:d.content})]},d.value):null)}):null}hr.propTypes={onDestroySelf:u.func,userCenterTabs:u.array};const xr=y.createContext({}),{Provider:ro,Consumer:zn}=xr;function mr({children:r}){const[i]=y.useState(!1),{session:s}=y.use(le),{user:t}=s,[o,h]=y.useState(),a=y.useMemo(()=>t?.didSpace?.endpoint,[t?.didSpace]);y.useEffect(()=>{h(t?.didSpace)},[t?.didSpace]);const p=async()=>{h(void 0)},l=f=>{},x=async f=>{h(f),await l(f.endpoint)},n=!!(a&&o);return e.jsx(ro,{value:{loading:i,spaceGateway:o,session:s,deleteSpaceGateway:p,updateSpaceGateway:x,storageEndpoint:a,settingStorageEndpoint:l,hasStorageEndpoint:n},children:r})}function ke(){return y.use(xr)}mr.propTypes={children:u.node.isRequired};function to(r){const i=r.replace(/\/api\/space\/.+/,""),t=r.replace(/\/$/,"").split("/").at(-4);return se(i,"space",t)}function gr({session:r,spaceGateway:i,spaceStatus:s,refresh:t}){return e.jsxs(we,{direction:"row",spacing:1,children:[s===Pt.DISCONNECTED&&e.jsx(ie,{reconnect:!0,variant:"outlined",session:r,spaceDid:r.user?.didSpace?.did,spaceGatewayUrl:r.user?.didSpace?.url,connectScope:"user",onSuccess:async()=>{await t()},onError:o=>{console.error(o),$.error(V(o))}}),e.jsx(W,{size:"small",LinkComponent:Er,href:to(i.endpoint),target:"_blank",children:e.jsx(zr,{})})]})}gr.propTypes={session:u.object.isRequired,spaceGateway:u.object.isRequired,spaceStatus:u.string.isRequired,refresh:u.func.isRequired};function br({spaceGateway:r=void 0}){const{t:i}=L(),{updateSpaceGateway:s,session:t}=ke(),o=de(),h=({spaceGateway:a})=>s(a);return e.jsxs(m,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(m,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[e.jsx(A,{sx:{fontSize:"16px",fontWeight:"bold"},children:i("userCenter.storage.spaces.connected.title")}),!o&&e.jsx(ie,{connectScope:"user",connectText:i("userCenter.storage.spaces.connected.switch"),session:t,onSuccess:h})]}),e.jsx(m,{children:r&&e.jsx(It,{endpoint:r.endpoint,deps:[r],selected:!0,footer:!0,action:a=>e.jsx(gr,{session:t,...a})},r.endpoint)}),o&&e.jsx(m,{sx:{display:"flex",alignItems:"center",justifyContent:"center",marginTop:2},children:e.jsx(ie,{connectScope:"user",connectText:i("userCenter.storage.spaces.connected.switch"),session:t,onSuccess:h})})]})}br.propTypes={spaceGateway:u.object};function oo(){const{t:r}=L(),{updateSpaceGateway:i,session:s}=ke(),t=({spaceGateway:o})=>i(o);return e.jsxs(m,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(A,{sx:{fontSize:"16px",fontWeight:"bold"},children:r("userCenter.storage.spaces.connect.providerForStorage")}),e.jsx(Tt,{viewBox:"0 0 228 258",style:{width:"156px",height:"156px",margin:"16px 0"}}),e.jsx(m,{children:e.jsx(ie,{session:s,onSuccess:t})})]})}function no(){const{spaceGateway:r,hasStorageEndpoint:i,loading:s}=ke(),{isMyself:t}=ue();return t?s?e.jsx(St,{relative:"parent",children:e.jsx(Y,{})}):e.jsx(io,{children:e.jsx(m,{sx:{maxWidth:"720px"},children:i?e.jsx(br,{spaceGateway:r}):e.jsx(oo,{})})}):null}function so(){return e.jsx(mr,{children:e.jsx(no,{})})}const io=Z(m)`
|
|
122
|
+
height: 100%;
|
|
123
|
+
overflow-y: auto;
|
|
124
|
+
`;function ao(){const{user:r,isMyself:i,viewUser:s}=ue(),{followed:t}=ht();return e.jsx(m,{children:e.jsx(vt,{teamDid:window?.blocklet?.did||"",user:i?r:s,showInvitees:i,followed:t})})}function lo({tab:r=""}){const{api:i}=Gr(),s=y.useRef(null),t=Dr(),o=r||t.tab,a=new URLSearchParams(window.location.search).get("embed")||window.sessionStorage?.getItem("embed"),p=Kr(),l=R(()=>({...window.blocklet,meta:{did:window.blocklet.did,name:window.blocklet.did},children:window?.blocklet?.componentMountPoints.map(n=>({...n,meta:{...n,did:n.did,name:n.name||n.title||"",logo:"logo.png"}}))})),x=async n=>{const{input:f,sessionId:k}=n;try{await i.destroySelf({input:{...f,sessionId:k}})}catch(v){console.error("destroy myself error",v)}};return e.jsx(ct,{mode:"user-center",children:e.jsxs(xt,{ref:s,embed:a==="1",currentTab:o?se(qe,"user",o):"",disableAutoRedirect:o==="settings",children:[o==="notifications"?e.jsx(Gt,{blocklets:[l],context:p}):null,o==="nfts"?e.jsx(Xt,{}):null,o==="settings"?e.jsx(hr,{onDestroySelf:x}):null,o==="did-spaces"?e.jsx(so,{}):null,o==="user-followers"?e.jsx(ao,{}):null,o==="orgs"?e.jsx(mt,{id:t.id||""}):null]})})}lo.propTypes={tab:u.string};export{lo as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a,G as M,T as _,c9 as T,R as W,ca as Q,aW as X,al as h,cb as Y,aV as Z,aS as B,f as C,cc as J,cd as K}from"./vendor-mui-core-CV-FnYH_.js";import{r as d,i as L,L as z,n as ee,o as ae}from"./vendor-react-DX7tU9aY.js";import{H as E}from"./index-
|
|
1
|
+
import{j as a,G as M,T as _,c9 as T,R as W,ca as Q,aW as X,al as h,cb as Y,aV as Z,aS as B,f as C,cc as J,cd as K}from"./vendor-mui-core-CV-FnYH_.js";import{r as d,i as L,L as z,n as ee,o as ae}from"./vendor-react-DX7tU9aY.js";import{H as E}from"./index-yoaLEniz.js";import{g as te}from"./vendor-hooks-164oA5kM.js";import{M as ie,l as m,bs as S,bt as A}from"./vendor-ux-BGqHwkOM.js";import{z as re}from"./vendor-arcblock-Xw2zMy0D.js";import{G as oe}from"./nav-menu-D7Sf6VZj.js";const H=d.createContext(null),se=e=>{const i=d.use(H);return d.useLayoutEffect(()=>{},[]),i};function le({children:e=void 0,...i}){const[t,r]=d.useState({inFullPage:!1,showToggleButton:!1,headerVisibleInFullPage:!0,footerVisibleInFullPage:!1,sidebarVisibleInFullPage:!1}),s=()=>{r(o=>({...o,inFullPage:!o.inFullPage}))},l=d.useMemo(()=>({...t,headerVisible:!t.inFullPage||t.headerVisibleInFullPage,footerVisible:!t.inFullPage||t.footerVisibleInFullPage,sidebarVisible:!t.inFullPage||t.sidebarVisibleInFullPage,toggleFullPage:s,configure:o=>r(n=>({...n,...o}))}),[t]);return a.jsx(H,{value:l,...i,children:e})}function ne({name:e,size:i=36,alt:t="",color:r="#000000",prefix:s="/images",showBadge:l=!1,style:o={},...n}){const c=`${s}/${e}-${r.replace(/^#/,"")}.png`;return a.jsxs(de,{style:{width:i,height:i},children:[a.jsx(ie,{width:i,height:i,alt:t||e,src:c,style:Object.assign({width:i},o),...n}),l&&a.jsx("i",{className:"badge-point"})]})}const de=m("div")`
|
|
2
2
|
position: relative;
|
|
3
3
|
.badge-point {
|
|
4
4
|
position: absolute;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o,al as f,X as n,f as y,bR as
|
|
1
|
+
import{j as o,al as f,X as n,f as y,bR as I,aS as v,G as A}from"./vendor-mui-core-CV-FnYH_.js";import{r as N}from"./vendor-react-DX7tU9aY.js";import{l as b,bB as H,V,m as W,k as G}from"./vendor-ux-BGqHwkOM.js";import{k as P}from"./fallback-CuXkR699.js";import{M as X}from"./use-blocklet-logo-ys-h-CV_.js";import{ah as Y,h as J,F as K}from"./vendor-utils-BbcnEeJI.js";import{a as Q}from"./vendor-hooks-164oA5kM.js";import{M as O,p as U}from"./index-Ci7zZ36D.js";import{u as Z}from"./use-mobile-CyUZDIaX.js";import{k as ee,S as ne,n as oe,L as te,N as C,p as ie}from"./wallet-hidden-topbar-dnCLvPpW.js";function F({name:e="",logo:t="",description:i="",...p}){if(!e&&!t&&!i)return null;const c=N.isValidElement(t)?t:o.jsx("img",{src:t,alt:e});return o.jsxs(re,{...p,children:[o.jsxs("div",{children:[t&&o.jsx(f,{component:"a",href:"/",className:"footer-brand-logo",children:c}),e&&o.jsx("div",{className:"footer-brand-name",children:e})]}),i&&o.jsx("div",{className:"footer-brand-desc",children:i})]})}F.propTypes={name:n.node,logo:n.node,description:n.string};const re=b("div")`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
font-size: 14px;
|
|
@@ -45,7 +45,7 @@ import{j as o,al as f,X as n,f as y,bR as A,aS as v,G as B}from"./vendor-mui-cor
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
`;function T({links:e=[],flowLayout:t=!1,minColumns:i=1,maxColumns:p=4,...c}){const[d,m]=N.useState(-1),x=Z({key:"md"}),j=e.some(
|
|
48
|
+
`;function T({links:e=[],flowLayout:t=!1,minColumns:i=1,maxColumns:p=4,...c}){const[d,m]=N.useState(-1),x=Z({key:"md"}),j=e.some(l=>l.items?.length),h=!x&&j&&Y(i)&&i>1&&p>=i,w=h?Math.min(Math.max(e.length,i),p):1,g=({label:l,link:r,icon:s,render:a,props:u})=>{let k=l;if(a)k=a({label:l,link:r,props:u});else if(r&&J(r)){const M=r.startsWith("http")||r.startsWith("//"),B=ne(r)?{}:{target:M?"_blank":"_self",rel:M?"noreferrer noopener":void 0};k=o.jsx("a",{href:r,"aria-label":`Footer link for ${l}`,...B,...u,children:l})}return o.jsxs(o.Fragment,{children:[s&&o.jsx(O,{icon:s,size:20,sx:{mr:.5}}),k]})},$=Q(()=>e?.length?t?e.map((l,r)=>o.jsx("span",{className:"footer-links-item",children:g(l)},r)):h?ee(e,{columns:w}).map((l,r)=>o.jsx("div",{className:"footer-links-column",children:l.filter(s=>s.group).map((s,a)=>{const{items:u}=s;return o.jsxs("div",{className:"footer-links-group",children:[o.jsx("span",{className:"footer-links-item",children:g(s)}),!!u?.length&&o.jsx("div",{className:"footer-links-sub",children:u.map((k,M)=>o.jsx("span",{className:y("footer-links-item",{"footer-links-item--new":k.isNew}),children:g(k)},M))})]},a)})},r)):e.map((l,r)=>{const{items:s}=l,a=r===d;return o.jsxs("div",{className:y("footer-links-group",{"footer-links-group--active":a}),onClick:()=>m(d===r?-1:r),children:[o.jsxs("span",{className:"footer-links-item",children:[g(l),!!s?.length&&o.jsx("span",{className:"footer-links-group-expand-icon",children:o.jsx(I,{style:{transform:`rotate(${a?180:0}deg)`}})})]}),!!s?.length&&o.jsx("div",{className:"footer-links-sub",children:s.map((u,k)=>o.jsx("span",{className:y("footer-links-item",{"footer-links-item--new":u.isNew}),children:g(u)},k))})]},r)}):null,[e,t,h,d]);return e?.length?o.jsx(le,{columns:w,...c,className:y(c.className,{"footer-links--grouped":j,"footer-links--flow":t,"footer-links--columns":h}),children:o.jsx("div",{className:"footer-links-inner",children:$})}):null}T.propTypes={links:n.arrayOf(n.shape({label:n.string,link:n.string,render:n.func,props:n.object})),flowLayout:n.bool,minColumns:n.number,maxColumns:n.number};const le=b("div",{shouldForwardProp:e=>e!=="columns"})`
|
|
49
49
|
overflow: hidden;
|
|
50
50
|
color: ${({theme:e})=>e.palette.text.secondary};
|
|
51
51
|
.footer-links-inner {
|
|
@@ -194,7 +194,7 @@ import{j as o,al as f,X as n,f as y,bR as A,aS as v,G as B}from"./vendor-mui-cor
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
`;function L({items:e=null,...t}){return e?.length?o.jsx(
|
|
197
|
+
`;function L({items:e=null,...t}){return e?.length?o.jsx(se,{...t,children:e.map((i,p)=>o.jsx("a",{href:i.link,target:"_blank","aria-label":`Social media icon${i.title?` for ${i.title}`:""}`,rel:"noreferrer",children:o.jsx(O,{icon:i.icon||i.title,size:24,component:"span"})},p))}):null}L.propTypes={items:n.arrayOf(n.shape({icon:n.string,link:n.string}))};const se=b("div")`
|
|
198
198
|
display: inline-flex;
|
|
199
199
|
flex-wrap: wrap;
|
|
200
200
|
align-items: center;
|
|
@@ -237,7 +237,7 @@ import{j as o,al as f,X as n,f as y,bR as A,aS as v,G as B}from"./vendor-mui-cor
|
|
|
237
237
|
margin: 0 auto;
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
`;function
|
|
240
|
+
`;function E({elements:e,data:t,className:i="",...p}){const c=!!t.navigation?.length;let d=null;return c?d=o.jsxs(v,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},justifyContent:"space-between"},children:[o.jsxs(f,{sx:{flex:"1 1 auto",paddingRight:{xs:0,md:3},display:"flex",flexDirection:"column",alignItems:"flex-start",gap:2,pb:3},children:[o.jsx(f,{children:e.brand}),o.jsx(f,{sx:{lineHeight:1},children:e.socialMedia})]}),o.jsx(f,{sx:({palette:m})=>({mb:3,borderTop:{xs:`1px solid ${m.grey[200]}`,md:0}}),children:e.navigation})]}):d=o.jsxs(v,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},justifyContent:"space-between",alignItems:"space-between",gap:2,pb:3},children:[o.jsx(f,{children:e.brand}),o.jsx(f,{sx:{lineHeight:1},children:e.socialMedia})]}),o.jsx(ce,{...p,className:y({"footer--with-navs":c},i),children:o.jsxs(v,{style:{padding:0},children:[d,o.jsx(f,{sx:{pt:3,borderTop:1,borderColor:"divider"}}),o.jsx(v,{children:o.jsxs(z,{autoCenter:!0,children:[e.copyright,e.links]})})]})})}E.propTypes={elements:n.shape({brand:n.element,navigation:n.element,socialMedia:n.element,copyright:n.element,links:n.element}).isRequired,data:n.object.isRequired,className:n.string};const ce=b("div")`
|
|
241
241
|
padding: 32px 0 24px 0;
|
|
242
242
|
.footer-brand-name,
|
|
243
243
|
.footer-brand-desc {
|
|
@@ -263,7 +263,7 @@ import{j as o,al as f,X as n,f as y,bR as A,aS as v,G as B}from"./vendor-mui-cor
|
|
|
263
263
|
flex-wrap: wrap;
|
|
264
264
|
gap: 8px;
|
|
265
265
|
}
|
|
266
|
-
`,_=[{name:"plain",support:(e,t)=>!t.navigation?.length&&!t.socialMedia?.length,component:R},{name:"standard",support:()=>!0,component:
|
|
266
|
+
`,_=[{name:"plain",support:(e,t)=>!t.navigation?.length&&!t.socialMedia?.length,component:R},{name:"standard",support:()=>!0,component:E}],me=_.reduce((e,t)=>({...e,[t.name]:t}),{});function D({...e}){const{brand:t=null,navigation:i=null,socialMedia:p=null,copyright:c=null,links:d=null,layout:m="auto",...x}=e,j=()=>t?o.jsx(F,{...t}):null,h=()=>i?.length?o.jsx(T,{links:i,minColumns:3}):null,w=()=>p?.length?o.jsx(L,{items:p}):null,g=()=>{const s=c?.owner||t?.name;return s?o.jsx(S,{owner:s,year:c?.year||void 0}):null},$=()=>d?.length?o.jsx(T,{flowLayout:!0,links:d}):null,l={brand:j(),navigation:h(),socialMedia:w(),copyright:g(),links:$()};let r=null;if(m==="auto"?r=_.find(s=>s.support(l,e)).component:r=me[m]?.component,!r)throw new Error(`layout ${m} is not supported.`);return o.jsxs(f,{...x,className:y("blocklet__footer",x.className),sx:[{position:"relative"},...Array.isArray(x.sx)?x.sx:[x.sx]],children:[o.jsx(r,{elements:l,data:e}),o.jsx(f,{sx:{position:"absolute",right:16,bottom:0,fontSize:12,color:"transparent","::selection":{background:"#000",color:"#fff"}},children:window?.blocklet?.version})]})}D.propTypes={brand:n.shape({name:n.node,description:n.string,logo:n.node}),navigation:n.arrayOf(n.shape({label:n.node,link:n.string})),socialMedia:n.arrayOf(n.shape({icon:n.node,link:n.string})),copyright:n.shape({owner:n.string,year:n.oneOfType([n.string,n.number])}),links:n.arrayOf(n.shape({label:n.node,link:n.string})),layout:n.oneOf(["auto","standard","plain"])};function q({meta:e={},theme:t={},...i}){const{locale:p,defaultLocale:c}=V()||{},d=A(),m=N.useMemo(()=>{const a=Object.assign({},window.blocklet,e);try{return te(a)}catch(u){return console.error("Failed to format blocklet info",u,a),a}},[e]),x=N.useMemo(()=>W(d,t),[d,t]),j=X({key:"xs",meta:e,theme:t});if(!m.appName)return null;const{appName:h,appDescription:w,description:g,copyright:$}=m,l=x.palette.background.default,r={footerNav:C({navigation:m?.navigation?.footer,locale:p,defaultLocale:c,section:"footer"})||[],socialMedia:C({navigation:m?.navigation?.social,locale:p,defaultLocale:c,section:"footer"})||[],links:C({navigation:m?.navigation?.bottom,locale:p,defaultLocale:c,section:"footer"})||[]},s={brand:{name:h,description:w||g,logo:j},navigation:ie(r.footerNav,a=>({...a,label:a.title,link:a.link}),"items"),copyright:$,socialMedia:r.socialMedia,links:r.links.map(a=>({...a,label:a.title}))};return o.jsx(G,{theme:x,children:o.jsx(fe,{...s,...K(i,["bordered"]),$bordered:i?.bordered,$bgcolor:l})})}q.propTypes={meta:oe,theme:n.object};const fe=b(D)`
|
|
267
267
|
${({$bordered:e,theme:t})=>`border-top: 1px solid ${e&&t.palette.divider};`}
|
|
268
268
|
color: ${({theme:e})=>e.palette.text.secondary};
|
|
269
269
|
${({$bgcolor:e})=>e&&`background-color: ${e};`}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as H,ac as Y}from"./vendor-utils-
|
|
1
|
+
import{B as H,ac as Y}from"./vendor-utils-BbcnEeJI.js";import{aK as U,aL as g,aM as M,aN as N,aO as w}from"./index-yoaLEniz.js";import{e as F}from"./vendor-react-DX7tU9aY.js";var a={},$={},B;function C(){if(B)return $;B=1;var _=Object.create,r=Object.defineProperty,t=Object.getOwnPropertyDescriptor,y=Object.getOwnPropertyNames,T=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty,D=(s,f,p,c)=>{if(f&&typeof f=="object"||typeof f=="function")for(var u=y(f),d=0,S=u.length,h;d<S;d++)h=u[d],!O.call(s,h)&&h!==p&&r(s,h,{get:(P=>f[P]).bind(null,h),enumerable:!(c=t(f,h))||c.enumerable});return s},l=(s,f,p)=>(p=s!=null?_(T(s)):{},D(f||!s||!s.__esModule?r(p,"default",{value:s,enumerable:!0}):p,s));return $.__toESM=l,$}var b={},k;function q(){if(k)return b;k=1;const _=C();let r=g(),t=U;t=_.__toESM(t);const y="did:abt:",T=l=>{try{if((0,r.isHexStrict)(l))return H.from((0,r.stripHexPrefix)(l),"hex");let s=(0,r.fromBase58)(l.replace(y,""));for(;s.length<26;)s=H.concat([H.from([0]),s]);return s}catch(s){throw new Error(`Cannot convert DID string to byte array: ${s.message}`)}},O=(l,s)=>(0,t.default)((0,r.toBN)(l).toString(2),s,"0"),D=(l,s)=>{const f=l.replace(/^0x/i,"");return typeof s=="number"&&s%2===0?(0,t.default)(l,s,"0"):f.length%2===0?f:`0${f}`};return b.DID_PREFIX=y,b.toBits=O,b.toBytes=T,b.toStrictHex=D,b}var m={};const X=F(Y);var K;function V(){if(K)return m;K=1;const _=C(),r=q();let t=w(),y=g(),T=M;T=_.__toESM(T);let O=X;O=_.__toESM(O);let D=N;D=_.__toESM(D);const l={pk:"key",address:"encoding"},s={role:t.types.RoleType.ROLE_ACCOUNT,pk:t.types.KeyType.ED25519,hash:t.types.HashType.SHA3,address:t.types.EncodingType.BASE58},f={role:t.types.RoleType.ROLE_PASSKEY,pk:t.types.KeyType.PASSKEY,hash:t.types.HashType.SHA2,address:t.types.EncodingType.BASE58},p={role:t.types.RoleType.ROLE_ACCOUNT,pk:t.types.KeyType.ETHEREUM,hash:t.types.HashType.KECCAK,address:t.types.EncodingType.BASE16},c=o=>{const e=["pk","hash","address"];return(0,O.default)((0,D.default)(o,e),(0,D.default)(p,e))},u=o=>{const e=(0,y.toAddress)(o);return/^(0x)?[0-9a-f]{40}$/i.test(e)?/^(0x|0X)?[0-9a-f]{40}$/.test(e)||/^(0x|0X)?[0-9A-F]{40}$/.test(e)?!0:d(e):!1},d=o=>{const e=o.replace(/^0x/i,""),i=t.Hasher.Keccak.hash256(e.toLowerCase()).replace(/^0x/i,"");for(let n=0;n<40;n++)if(parseInt(i[n],16)>7&&e[n].toUpperCase()!==e[n]||parseInt(i[n],16)<=7&&e[n].toLowerCase()!==e[n])return!1;return!0},S=o=>{if(typeof o>"u")return"";if(!/^(0x)?[0-9a-f]{40}$/i.test(o))throw new Error(`Given address "${o}" is not a valid Ethereum address.`);const e=o.toLowerCase().replace(/^0x/i,""),i=t.Hasher.Keccak.hash256(e).replace(/^0x/i,"");let n="0x";for(let E=0;E<e.length;E++)parseInt(i[E],16)>7?n+=e[E].toUpperCase():n+=e[E];return n};function h(o={}){let e={};["default","arcblock"].includes(o)?e=s:["eth","ethereum"].includes(o)?e=p:["passkey"].includes(o)?e=f:e={...s,...o};const{role:i,pk:n,hash:E,address:R}=e;Object.keys(e).forEach(A=>{const j=(0,T.default)(`${l[A]||A}Type`);if(Object.values(t.types[j]).includes(e[A])===!1)throw new Error(`Unsupported ${A} type: ${e[A]}`)});const I={role:i,pk:n,hash:E,address:R};return c(I)===!1&&[t.types.RoleType.ROLE_NODE,t.types.RoleType.ROLE_VALIDATOR,t.types.RoleType.ROLE_TETHER,t.types.RoleType.ROLE_SWAP].includes(I.role)&&(I.hash=t.types.HashType.SHA2),I}h.toJSON=o=>Object.keys(o).reduce((e,i)=>{const n=(0,T.default)(`${l[i]||i}Type`);return e[i]=Object.keys(t.types[n])[Object.values(t.types[n]).indexOf(o[i])],e},{}),h.fromJSON=o=>Object.keys(o).reduce((e,i)=>{const n=(0,T.default)(`${l[i]||i}Type`),E=Object.keys(t.types[n]);return e[i]=Object.values(t.types[n])[E.indexOf(o[i])],e},{});const P=o=>{const e=h(o),i=`${r.toBits(e.role,6)}${r.toBits(e.pk,5)}${r.toBits(e.hash,5)}`;return r.toStrictHex((0,y.stripHexPrefix)((0,y.numberToHex)(parseInt(i,2))),4)},x=o=>{let e={};try{if(u(o))e=p;else{const i=r.toBytes(o).slice(0,2),n=r.toBits(new y.BN(r.toStrictHex(H.from(i).toString("hex")),16),16),E=n.slice(0,6),R=n.slice(6,11),I=n.slice(11,16);e={role:parseInt(E,2),pk:parseInt(R,2),hash:parseInt(I,2),address:(0,y.isHex)((0,y.toAddress)(o))?t.types.EncodingType.BASE16:t.types.EncodingType.BASE58}}return Object.keys(e).forEach(i=>{Object.values(t.types[`${(0,T.default)(l[i]||i)}Type`]).includes(e[i])===!1&&delete e[i]}),e}catch{return e}},L=o=>{const e=x(o);return Object.keys(e).reduce((i,n)=>{const E=t.types[`${(0,T.default)(l[n]||n)}Type`];return i[n]=Object.keys(E).find(R=>E[R]===e[n]),i},{})};return m.DID_TYPE_ARCBLOCK=s,m.DID_TYPE_ETHEREUM=p,m.DID_TYPE_PASSKEY=f,m.DidType=h,m.fromTypeInfo=P,m.isEthereumDid=u,m.isEthereumType=c,m.toChecksumAddress=S,m.toTypeInfo=x,m.toTypeInfoStr=L,m}var v;function z(){if(v)return a;v=1;const _=q(),r=V();let t=w(),y=g();const T=(p,c)=>{const u=r.DidType(c),d=(0,t.getSigner)(u.pk).getPublicKey(p);return O(d.indexOf("0x")===0?d:`0x${d}`,u)},O=(p,c)=>{const u=r.DidType(c);return D((0,t.getHasher)(u.hash)(p,1),u)},D=(p,c)=>{const u=r.DidType(c),d=(0,y.stripHexPrefix)(p).slice(0,40),S=(0,t.getHasher)(u.hash),h=r.fromTypeInfo(u),P=`0x${h}${d}${(0,y.stripHexPrefix)(S(`0x${h}${d}`,1)).slice(0,8)}`;return r.isEthereumType(u)?r.toChecksumAddress(`0x${p.slice(-40)}`):u.address===t.types.EncodingType.BASE58?(0,y.toBase58)(P):P},l=(p,c=t.types.RoleType.ROLE_ACCOUNT)=>{const u=Object.keys(t.types.RoleType),d=Object.values(t.types.RoleType);if(d.indexOf(c)===-1)throw new Error(`Unsupported role type ${c} when gen ddi from hash`);return D(p,r.DidType({role:t.types.RoleType[u[d.indexOf(c)]]}))},s=(p,c)=>f(p)===!1?!1:O(c,r.toTypeInfo(p))===p.replace(_.DID_PREFIX,""),f=p=>{if(!p)return!1;const c=(0,y.toAddress)(String(p)),{hash:u}=r.toTypeInfo(c);if(typeof u>"u")return!1;if(r.isEthereumDid(c))return!0;const d=(0,t.getHasher)(u),S=_.toBytes(c),h=_.toStrictHex(H.from(S.slice(0,22)).toString("hex"));return _.toStrictHex(H.from(S.slice(22,26)).toString("hex"))===(0,y.stripHexPrefix)(d(`0x${h}`,1)).slice(0,8)};return a.DID_PREFIX=_.DID_PREFIX,a.DID_TYPE_ARCBLOCK=r.DID_TYPE_ARCBLOCK,a.DID_TYPE_ETHEREUM=r.DID_TYPE_ETHEREUM,a.DID_TYPE_PASSKEY=r.DID_TYPE_PASSKEY,a.DidType=r.DidType,a.fromHash=l,a.fromPublicKey=O,a.fromPublicKeyHash=D,a.fromSecretKey=T,a.fromTypeInfo=r.fromTypeInfo,a.isEthereumDid=r.isEthereumDid,a.isEthereumType=r.isEthereumType,a.isFromPublicKey=s,a.isValid=f,a.toAddress=y.toAddress,a.toDid=y.toDid,a.toStrictHex=_.toStrictHex,a.toTypeInfo=r.toTypeInfo,a.toTypeInfoStr=r.toTypeInfoStr,a.types=t.types,a}export{X as a,z as r};
|