@abtnode/blocklet-services 1.16.52-beta-20250928-042319-ff3f0e04 → 1.16.52-beta-20250930-134044-9b691563
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/api/middlewares/launcher-login.js +3 -2
- package/api/routes/csp-proxy.js +7 -7
- package/dist/assets/{AdapterDayjs-Ch1GqpK7.js → AdapterDayjs-DJz1a4Qx.js} +1 -1
- package/dist/assets/{Google-CZPwmMCG.js → Google-D6480ezX.js} +2 -2
- package/dist/assets/{access-control-MtITiDMT.js → access-control-DBdY7ucY.js} +1 -1
- package/dist/assets/{actions-CL4xTGOh.js → actions-DiS46mya.js} +1 -1
- package/dist/assets/{add-component-core-DT871JXs.js → add-component-core-Cev7hXWc.js} +1 -1
- package/dist/assets/{add-resource-BnQPv53-.js → add-resource-A4bZ0dTp.js} +1 -1
- package/dist/assets/{addon-CAvqw8mm.js → addon-EoDNqFad.js} +1 -1
- package/dist/assets/{advanced-BeEKQmus.js → advanced-DKI68HjI.js} +1 -1
- package/dist/assets/{aigne-DepLc7CZ.js → aigne-CjC_i4GF.js} +1 -1
- package/dist/assets/api-eF9RCcCm.js +1 -0
- package/dist/assets/{appearance-CQM-3LPu.js → appearance-O0nUhNEQ.js} +1 -1
- package/dist/assets/{ar-DGfbWcRb.js → ar-DWsJvQhm.js} +2 -2
- package/dist/assets/{arrow-down.svg-VIKI4IBd.js → arrow-down.svg-KTkEGh4D.js} +1 -1
- package/dist/assets/{audit-logs-B4nW0HQW.js → audit-logs-m94KXy26.js} +1 -1
- package/dist/assets/{authorize-DtR2q4pL.js → authorize-BHa1jxY6.js} +1 -1
- package/dist/assets/{base-chart-BntWHeFy.js → base-chart-Be8WpaNd.js} +1 -1
- package/dist/assets/{base32-dGIGRTeZ.js → base32-d0IrDPx_.js} +1 -1
- package/dist/assets/{bind-account-DKu95GI-.js → bind-account-DQGyQsBg.js} +1 -1
- package/dist/assets/branding-BJoo_ZXQ.js +1 -0
- package/dist/assets/{branding-DIltHBq0.js → branding-BMzor1hN.js} +2 -2
- package/dist/assets/{branding-BxI7VSjI.js → branding-DZkv2-B6.js} +1 -1
- package/dist/assets/{bundle-avatar-BvwlMY-v.js → bundle-avatar-ClP0s92u.js} +1 -1
- package/dist/assets/button-iJgy0AQY.js +1 -0
- package/dist/assets/{click-to-copy-Dqmzk5Lh.js → click-to-copy-DBNEocQx.js} +1 -1
- package/dist/assets/{cloneDeep-sSKmkjV3.js → cloneDeep-DC1IBdzb.js} +1 -1
- package/dist/assets/{collapse-GMtfQlRs.js → collapse-C7KroRZD.js} +1 -1
- package/dist/assets/{complete-BiA0H-F-.js → complete-CACnLOf-.js} +4 -4
- package/dist/assets/{component-CcDcQA4R.js → component-CmQX5aKr.js} +3 -3
- package/dist/assets/{config-BDmrqxia.js → config-B7R4_aR5.js} +7 -7
- package/dist/assets/{config-7aDpCy1J.js → config-BlfZIK3N.js} +1 -1
- package/dist/assets/{config-CegNHv38.js → config-NAEGgfiM.js} +2 -2
- package/dist/assets/{config-navigation-DeVpCAhC.js → config-navigation-DcjynTKg.js} +13 -13
- package/dist/assets/{config-space-D3NLSAOS.js → config-space-CcdEKukD.js} +1 -1
- package/dist/assets/{confirm-BbY8YGyk.js → confirm-tusB0uUh.js} +1 -1
- package/dist/assets/{connect-3UzkXBvk.js → connect-D0Yxb636.js} +1 -1
- package/dist/assets/{connect-NiZcQvBT.js → connect-Gm3BGJOG.js} +1 -1
- package/dist/assets/{connect-to-QQ3T-HpF.js → connect-to-D3EWn_NY.js} +1 -1
- package/dist/assets/{content-layout-DYZYIlLo.js → content-layout-C5M6XN5d.js} +1 -1
- package/dist/assets/{createClass-CDs8uNCX.js → createClass-C0KDHIFs.js} +1 -1
- package/dist/assets/{dashboard-C_xJDuQY.js → dashboard-CmUsG3tt.js} +6 -6
- package/dist/assets/{de-DGZI-Bsh.js → de-rG0WLGYs.js} +2 -2
- package/dist/assets/{delete-confirm-ZcwDcAcQ.js → delete-confirm-Dogr_ntZ.js} +1 -1
- package/dist/assets/{did-address-CNnw4_bl.js → did-address-DtRDDQBD.js} +1 -1
- package/dist/assets/domain-3OQTdQwA.js +9 -0
- package/dist/assets/domain-action-card-mesh-ZO1.js +28 -0
- package/dist/assets/domains-D3oaqtHD.js +1 -0
- package/dist/assets/{email-BfBsaQZc.js → email-fmVVdTOG.js} +1 -1
- package/dist/assets/{empty-spinner-DCC7mgEb.js → empty-spinner-CBrinxF5.js} +1 -1
- package/dist/assets/engine-BGPujcMC.js +1 -0
- package/dist/assets/{es-CMwFpp7C.js → es-6DKPq8Yn.js} +2 -2
- package/dist/assets/{exchange-passport-DHCCHO-N.js → exchange-passport-DlMqIBtT.js} +1 -1
- package/dist/assets/{form-Csfi6zyX.js → form-Bii6E4NV.js} +1 -1
- package/dist/assets/{form-text-input-xNlMjrH6.js → form-text-input-TeuIo9S2.js} +1 -1
- package/dist/assets/{form-wrapper-BCRhnWhi.js → form-wrapper-DZhsWXpc.js} +1 -1
- package/dist/assets/{fr-eKsI9Vcp.js → fr-CT3g9qN-.js} +2 -2
- package/dist/assets/{fuel-CUlDLjak.js → fuel-BaMJ9704.js} +1 -1
- package/dist/assets/{gen-access-key-C3uuo9SI.js → gen-access-key-B97ypTb-.js} +1 -1
- package/dist/assets/gen-simple-access-key-US636G5K.js +1 -0
- package/dist/assets/get-safe-url-CpIY2Nr0.js +1 -0
- package/dist/assets/{hdkey-BgsbeAhG.js → hdkey-TGNLUqEt.js} +1 -1
- package/dist/assets/{hi-C0JqybmN.js → hi-CeUu25BW.js} +1 -1
- package/dist/assets/{home-BwyzLr74.js → home-C3u9ExRL.js} +1 -1
- package/dist/assets/{id-DHF6PX-M.js → id-BugYMmLN.js} +2 -2
- package/dist/assets/{iframe-SCM7rlz3.js → iframe-ByrkdYaj.js} +1 -1
- package/dist/assets/{index-DH4W6unN.js → index-26LcjK03.js} +1 -1
- package/dist/assets/{index-CKpQd8db.js → index-40tvlREo.js} +12 -12
- package/dist/assets/{index-B06oP6vd.js → index-5sEksRZE.js} +1 -1
- package/dist/assets/{index-CfHItWba.js → index-BC-hI70z.js} +4 -4
- package/dist/assets/{index-DO9UDa6G.js → index-BLaILoF2.js} +1 -1
- package/dist/assets/{index-Qx6e57-u.js → index-BPPTaU3u.js} +2 -2
- package/dist/assets/{index-uH_9YgA0.js → index-BROakthZ.js} +1 -1
- package/dist/assets/{index-BPJUfDZY.js → index-BVtCqyO7.js} +1 -1
- package/dist/assets/{index-VARWquqH.js → index-Basg4QeI.js} +1 -1
- package/dist/assets/{index-gcYTlYEZ.js → index-BhAogHJp.js} +1 -1
- package/dist/assets/{index-DS-40ZVK.js → index-BpIHv06W.js} +1 -1
- package/dist/assets/index-BsmMnQ_k.js +283 -0
- package/dist/assets/{index-DzI9kX_C.js → index-CCNgWb6m.js} +1 -1
- package/dist/assets/{index-v50gyNUL.js → index-CGUzaOG1.js} +6 -6
- package/dist/assets/{index-g5_ozUJZ.js → index-CUu0DjUL.js} +4 -4
- package/dist/assets/{index-CB__aq5L.js → index-Clgc5RbF.js} +1 -1
- package/dist/assets/{index-D7zqBJdA.js → index-Cs2FIJbg.js} +3 -3
- package/dist/assets/{index-CNvRrWdA.js → index-D5BfPJgd.js} +1 -1
- package/dist/assets/{index-D-puzkw-.js → index-DIDKpIk_.js} +1 -1
- package/dist/assets/{index-Cn5TXl_L.js → index-DJWOH9gC.js} +1 -1
- package/dist/assets/{index-c7w7Lgaw.js → index-DOCDPBXj.js} +3 -3
- package/dist/assets/{index-BwMsFaIR.js → index-DPbI7VX_.js} +1 -1
- package/dist/assets/index-DgDvwRqt.js +1041 -0
- package/dist/assets/{index-Ck6n4b0a.js → index-DhDY9QRj.js} +1 -1
- package/dist/assets/{index-BUiG3mKw.js → index-Di2bKYQ8.js} +1 -1
- package/dist/assets/index-HOEytilv.js +1 -0
- package/dist/assets/{index-kiLQKwVa.js → index-VQg2UaAe.js} +1 -1
- package/dist/assets/{index-CJWwSLdB.js → index-cZALvweI.js} +19 -19
- package/dist/assets/index-dIy0_-0B.js +124 -0
- package/dist/assets/index-oMo0FAbH.js +150 -0
- package/dist/assets/{invitation-GzoS6QSS.js → invitation-BEg6pBgL.js} +3 -3
- package/dist/assets/{invite-DDdJj6co.js → invite-PSJCbkuS.js} +1 -1
- package/dist/assets/{isURL-CCV0esLR.js → isURL-uDqs2WzZ.js} +2 -2
- package/dist/assets/{issue-passport-PUK3HiX7.js → issue-passport-DfPL_iUw.js} +1 -1
- package/dist/assets/{item-DAL9Dho-.js → item-BT44fN4f.js} +1 -1
- package/dist/assets/{ja-c-6MaUg1.js → ja-DaREJWmX.js} +2 -2
- package/dist/assets/{ko-CTFi4Ndk.js → ko-Crmr1RC-.js} +2 -2
- package/dist/assets/{landing-page-CL9L_8lE.js → landing-page-CiEaPNxq.js} +1 -1
- package/dist/assets/{launch-result-message-DN12F68Q.js → launch-result-message-CxGW5bAC.js} +1 -1
- package/dist/assets/{layout-CWE2T-JY.js → layout-C3Si15N2.js} +1 -1
- package/dist/assets/{list-B1IF52f7.js → list-DLK8qdTn.js} +2 -2
- package/dist/assets/{list-header-CoFZp82R.js → list-header-D3Jek4lG.js} +1 -1
- package/dist/assets/{list-DNkyeHs7.js → list-iYXxqPI6.js} +3 -3
- package/dist/assets/localization-BY1kjw33.js +1 -0
- package/dist/assets/{log-CH5xMfwF.js → log-J00kI7L6.js} +19 -19
- package/dist/assets/logger-Brrx9tV7.js +1 -0
- package/dist/assets/{login-C0H7ScpD.js → login-Wg20R9T3.js} +1 -1
- package/dist/assets/{login-oauth-callback-yy8oOs-S.js → login-oauth-callback-BAbCWNXl.js} +1 -1
- package/dist/assets/{logo-uploader-BbYoAyD-.js → logo-uploader-BMe29xQY.js} +2 -2
- package/dist/assets/{lost-passport-CnWY_gqA.js → lost-passport-BrFPShnF.js} +1 -1
- package/dist/assets/{observability-oDc3dKFA.js → observability-DpWIYJKx.js} +1 -1
- package/dist/assets/{omit-C2ouGG7F.js → omit-BpknVl5C.js} +1 -1
- package/dist/assets/{open-window-2gqXwgFW.js → open-window-BWuQbNLw.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-D2yclQzx.js → over-due-invoice-payment-DYA1LPYk.js} +1 -1
- package/dist/assets/{overview-B4sE3XPK.js → overview-BFfWkxz5.js} +2 -2
- package/dist/assets/{page-header-8LlFejLk.js → page-header-hQvIh9SJ.js} +1 -1
- package/dist/assets/{passport-item-CK1Zj4rm.js → passport-item-CF_y0rsT.js} +1 -1
- package/dist/assets/{permission-CSIyJtvw.js → permission-mCHWpIY_.js} +1 -1
- package/dist/assets/{playground-Dk2enS21.js → playground-D-q7ZMPl.js} +1 -1
- package/dist/assets/preferences-BmlOlGxi.js +1 -0
- package/dist/assets/profile-embed-BIIlF2uQ.js +1 -0
- package/dist/assets/{pt-QkdDdQuw.js → pt-DlPLN19J.js} +1 -1
- package/dist/assets/publish-resource-3lgLri0K.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-DPZZJVHP.js → react-beautiful-dnd.esm-CjbGIjxA.js} +1 -1
- package/dist/assets/{react-stripe.esm-DXXjh9xE.js → react-stripe.esm-UJXznrFM.js} +1 -1
- package/dist/assets/{required-B2SKELXR.js → required-BukCSojp.js} +1 -1
- package/dist/assets/{ru-swMH4bvc.js → ru-BNhuVXCB.js} +1 -1
- package/dist/assets/{runtime-B3mVl8w2.js → runtime-BS-wC6gn.js} +1 -1
- package/dist/assets/sanitize-yJUw5BK9.js +2 -0
- package/dist/assets/sdk-BLd-VTrL.js +1 -0
- package/dist/assets/{section-CndbjVtx.js → section-CGjbjaFj.js} +1 -1
- package/dist/assets/{security-g0CzShNx.js → security-BJOY2ThQ.js} +3 -3
- package/dist/assets/{session-m3orzHBa.js → session-CfoR5Wvh.js} +1 -1
- package/dist/assets/{setup-D_impIE6.js → setup-Betrrcxk.js} +1 -1
- package/dist/assets/{shorten-label-Cbu8wo9m.js → shorten-label-BIRHi2FS.js} +1 -1
- package/dist/assets/{simple-select-BqhbnnqN.js → simple-select-7X88QDSX.js} +1 -1
- package/dist/assets/slugify-bzSZ5XYw.js +1 -0
- package/dist/assets/{spaces-p4zKSeyp.js → spaces-MBu98S71.js} +1 -1
- package/dist/assets/{start-BD7Kr8U-.js → start-BvExYMOr.js} +1 -1
- package/dist/assets/{starting-progress-C6OFR0oi.js → starting-progress-DrUauyTC.js} +1 -1
- package/dist/assets/{status-D1-G3QED.js → status-DRtLD-z9.js} +1 -1
- package/dist/assets/{step-actions-RYL0A520.js → step-actions-CpLfyTzR.js} +1 -1
- package/dist/assets/{studio-Bp-XDrgR.js → studio-CBJGdxxo.js} +1 -1
- package/dist/assets/{switch-control-XooTt-i6.js → switch-control-DNlNJjsm.js} +1 -1
- package/dist/assets/{table-tips-CgCabdgD.js → table-tips-C_tKxS1_.js} +1 -1
- package/dist/assets/{team-B-jk7E5_.js → team-Dd8yHElY.js} +7 -7
- package/dist/assets/{th-DuqieD90.js → th-CSbI3a1U.js} +1 -1
- package/dist/assets/toLower-BqRfvn1N.js +1 -0
- package/dist/assets/{traffic-CInL395-.js → traffic-lCSWEOva.js} +1 -1
- package/dist/assets/{transfer-Z_9W88aQ.js → transfer-CnRpT327.js} +1 -1
- package/dist/assets/{unsubscribe-B07Ogw5q.js → unsubscribe-SOswYB3-.js} +1 -1
- package/dist/assets/{use-app-logo-D_gO-Dio.js → use-app-logo-Czrt0i-p.js} +1 -1
- package/dist/assets/{use-mobile-CQ7Tw4aD.js → use-mobile-6sugw6dZ.js} +1 -1
- package/dist/assets/{use-mobile-D93Bk2Ru.js → use-mobile-DdL6gIr_.js} +1 -1
- package/dist/assets/{use-server-logo-BJM5bxfh.js → use-server-logo-Cb1mX_m3.js} +1 -1
- package/dist/assets/{use-window-close-toR_SRTv.js → use-window-close-DRT8NYsb.js} +1 -1
- package/dist/assets/{useAsync-DZevTxbv.js → useAsync-BO3iirQz.js} +1 -1
- package/dist/assets/{useAsync-CNAYLnLm.js → useAsync-CP1EfcG_.js} +1 -1
- package/dist/assets/{useAsyncRetry-6TjWJyO6.js → useAsyncRetry-b_Q7rsZ1.js} +1 -1
- package/dist/assets/{useLocalStorage-CiLfInVV.js → useLocalStorage-D6j--D5r.js} +1 -1
- package/dist/assets/{user-center-DzijYiyQ.js → user-center-CUpoxNlx.js} +7 -7
- package/dist/assets/{user-follower-DWn8bXG-.js → user-follower-BzN1JToB.js} +1 -1
- package/dist/assets/{user-sessions-CuXtk29w.js → user-sessions-Cem_kfLj.js} +1 -1
- package/dist/assets/{util-BYg7Nb7Z.js → util-CFOWM3Un.js} +1 -1
- package/dist/assets/{util-Bravn321.js → util-Dr-F1wWu.js} +1 -1
- package/dist/assets/{vendor-arcblock-DEa0A9MF.js → vendor-arcblock-DbQi15Va.js} +27 -23
- package/dist/assets/vendor-hooks-Bm2oaDgr.js +7 -0
- package/dist/assets/{vendor-mui-core-CmD-NPnl.js → vendor-mui-core-C_NjJRjl.js} +18 -18
- package/dist/assets/{vendor-mui-x--K2rEM1j.js → vendor-mui-x-B2kLzf_6.js} +1 -1
- package/dist/assets/{vendor-utils-DQK0pEML.js → vendor-utils-Gk-1qvTR.js} +1 -1
- package/dist/assets/{vendor-ux-pYOhjQLA.js → vendor-ux-JmtAaYLa.js} +4 -4
- package/dist/assets/{vi-42QzvOuM.js → vi-C-IhikR1.js} +1 -1
- package/dist/assets/{wait-connect-CgBXxzyb.js → wait-connect-BJSNhW2P.js} +1 -1
- package/dist/assets/{wizard-BEs2v6uI.js → wizard-CxdbMgRd.js} +1 -1
- package/dist/assets/{wizard-components-5FNqoPRf.js → wizard-components-BlDjNTl3.js} +2 -2
- package/dist/assets/wrap-locale-DOt3Fsgq.js +1 -0
- package/dist/assets/{zh-NsxeedJj.js → zh-BCFTG394.js} +1 -1
- package/dist/assets/{zh-C-k4DKK-.js → zh-CWvcoHsp.js} +2 -2
- package/dist/assets/{zh-tw-Dxa4oubT.js → zh-tw-D_73qm-O.js} +2 -2
- package/dist/index.html +6 -6
- package/dist/service-worker.js +1 -1
- package/package.json +38 -38
- package/dist/assets/api-sewNv0AE.js +0 -1
- package/dist/assets/branding-DI8S4rKX.js +0 -1
- package/dist/assets/button-D5GaRQPz.js +0 -1
- package/dist/assets/domain-action-card-t81ZH6IT.js +0 -28
- package/dist/assets/domain-oUFlaLKy.js +0 -9
- package/dist/assets/domains-CMbykSQm.js +0 -1
- package/dist/assets/engine-BNoG81bE.js +0 -1
- package/dist/assets/gen-simple-access-key-CX90y0zh.js +0 -1
- package/dist/assets/get-safe-url-DKg8JLr1.js +0 -1
- package/dist/assets/index-BJbNz5vx.js +0 -1027
- package/dist/assets/index-BWAu1pEw.js +0 -1
- package/dist/assets/index-CKOznUni.js +0 -110
- package/dist/assets/index-DTU7_GN0.js +0 -124
- package/dist/assets/index-sQzZNoGx.js +0 -271
- package/dist/assets/localization-DWmiu7jH.js +0 -1
- package/dist/assets/logger-Cror7fb1.js +0 -1
- package/dist/assets/preferences-BBghzBy7.js +0 -1
- package/dist/assets/profile-embed-B2uhPkoV.js +0 -1
- package/dist/assets/publish-resource-DhuBgzO7.js +0 -1
- package/dist/assets/sanitize-BwaMGjTb.js +0 -2
- package/dist/assets/sdk-B4j47QQf.js +0 -1
- package/dist/assets/vendor-hooks-DLNZ8kxG.js +0 -7
- package/dist/assets/wrap-locale-B5OsZl6Q.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as o}from"./vendor-react-Dvs43sk9.js";import{j as t,b4 as _,W as n,D as F,n as xe,b0 as ye,cs as be,ct as ve,cu as je,cv as we,ak as g,T as q,Q as ke,a$ as te,a3 as Ie,s as Me,J as Re,I as Ce,at as Ae}from"./vendor-mui-core-CmD-NPnl.js";import{a as D,b as O,h as Te}from"./vendor-hooks-DLNZ8kxG.js";import{T as Q,a6 as Ne,ab as ne,G as re,a9 as $e}from"./vendor-ux-pYOhjQLA.js";import{t as Se}from"./server-logo-notext.svg-CKQB0tIp.js";import{B as Le}from"./bundle-avatar-BvwlMY-v.js";import{a as ze,g as se,i as ie,b as oe,c as V,M as ae,d as Ee,m as De,e as Be,f as Pe,h as qe,j as Ve,k as _e,l as Fe,n as Oe,N as He}from"./team-B-jk7E5_.js";import{R as Ue,J as We,C as G,a as H}from"./vendor-utils-DQK0pEML.js";import{c as Qe,Z as Ge}from"./index-BJbNz5vx.js";import{B as Je,o as Ke,l as Xe}from"./index-uH_9YgA0.js";import{p as Ye}from"./util-Bravn321.js";function le({blocklet:e,style:r={},size:s=40,...i}){const l=ze({blocklet:e,square:!0}),{variant:u}=i;return t.jsx(_,{variant:u||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},r),...i,children:t.jsx("img",{src:l,alt:"",style:{width:s}})})}le.propTypes={blocklet:n.object.isRequired,style:n.object,size:n.oneOfType([n.number,n.string])};function Ze(e){return e.includes(" ")?new Date(e.replace(" ","T").replace(" ","")).getTime():new Date(e).getTime()}function J({value:e="",shouldUpdate:r=!1,...s}){const{locale:i}=Q(),[l,u]=o.useState(0);if(o.useEffect(()=>{let d;if(r){const p=new Date(e).getTime(),y=Date.now(),v=Math.abs(Math.floor((p-y)/1e3)),b=()=>{u(k=>{const C=Math.random()*1e3;return parseFloat((k+C).toFixed(4))})};v<60?d=setInterval(b,1e3):v<60*60?d=setInterval(b,6e4):d=setInterval(b,36e5)}return()=>{clearInterval(d)}},[e,l,r]),!e)return"-";const m=Ze(e);return t.jsx(Ne,{value:m,locale:i,...s})}J.propTypes={value:n.any,shouldUpdate:n.bool};const et={error:je,warning:ve,info:be,success:ye};ce.propTypes={severity:n.oneOf(["error","warning","info","success"]).isRequired,size:n.number};function ce({severity:e="info",size:r=32}){const s=F(),l=D(()=>({error:s.palette.error.main,warning:s.palette.warning.main,info:s.palette.info.main,success:s.palette.success.main}))[e],u=et[e],m=xe(l,.1);return t.jsx(_,{sx:{width:r,height:r,bgcolor:m,color:l},children:t.jsx(u,{fontSize:"small"})})}const tt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M5.821 4.91c3.898-2.765 9.469-2.539 13.073.536c3.667 3.127 4.168 8.238 1.152 11.897c-2.842 3.447-7.965 4.583-12.231 2.805l-.232-.101l-4.375.931l-.075.013l-.11.009l-.113-.004l-.044-.005l-.11-.02l-.105-.034l-.1-.044l-.076-.042l-.108-.077l-.081-.074l-.073-.083l-.053-.075l-.065-.115l-.042-.106l-.031-.113l-.013-.075l-.009-.11l.004-.113l.005-.044l.02-.11l.022-.072l1.15-3.451l-.022-.036C.969 12.45 1.97 7.805 5.59 5.079l.23-.168z"/></g>'},nt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M12 2a5 5 0 1 1-5 5l.005-.217A5 5 0 0 1 12 2zm2 12a5 5 0 0 1 5 5v1a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-1a5 5 0 0 1 5-5h4z"/></g>'},rt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M17 3.34A10 10 0 1 1 2 12l.005-.324A10 10 0 0 1 17 3.34zM12 6a1 1 0 0 0-1 1a3 3 0 1 0 0 6v2a1.024 1.024 0 0 1-.866-.398l-.068-.101a1 1 0 0 0-1.732.998a3 3 0 0 0 2.505 1.5H11a1 1 0 0 0 .883.994L12 18a1 1 0 0 0 1-1l.176-.005A3 3 0 0 0 13 11V9c.358-.012.671.14.866.398l.068.101a1 1 0 0 0 1.732-.998A3 3 0 0 0 13.161 7H13a1 1 0 0 0-1-1zm1 7a1 1 0 0 1 0 2v-2zm-2-4v2a1 1 0 0 1 0-2z"/></g>'},st={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M8 12a4 4 0 1 0 8 0a4 4 0 1 0-8 0"/><path d="M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-5.5 8.28"/></g>'},it={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m15 10l-4 4l6 6l4-16l-18 7l4 2l2 6l3-4"/>'},Z={comment:{icon:tt,bgColor:"rgba(239, 246, 255, 1)",color:"rgba(43, 127, 255, 1)"},like:{icon:"👍",bgColor:"rgba(244, 244, 245, 1)",color:"yellow",renderType:"emoji"},follow:{icon:nt,bgColor:"rgba(238, 242, 255, 1)",color:"rgba(97, 95, 255, 1)"},tips:{icon:rt,bgColor:"rgba(254, 252, 232, 1)",color:"rgba(240, 177, 0, 1)"},mention:{icon:st,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"},assign:{icon:it,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"}};de.propTypes={activity:n.oneOf(["comment","like","follow","tips","mention","assign"]).isRequired,size:n.number};function de({activity:e,size:r=32}){const s=Z[e]||Z.comment,i=s.icon;return t.jsx(_,{sx:{bgcolor:s.bgColor,color:s.color,width:r,height:r},children:s.renderType==="emoji"?t.jsx("span",{style:{fontSize:"14px"},children:i}):t.jsx(ne,{icon:i})})}const U={avatar:n.string,fullName:n.string,did:n.string};function W({actor:e,size:r,teamDid:s="",inService:i=!1,showName:l=!1}){const u=D(()=>({...e,avatar:e?.avatar?Ye(e.avatar,s,i):null}),[e,s,i]),m=d=>{e&&(d.stopPropagation(),window.open(We(G(Qe.WELLKNOWN_SERVICE_PATH_PREFIX,"user"),{did:e.did}),"_blank"),d.customPreventRedirect=!0)};return t.jsxs(g,{onClick:m,role:"button",style:{cursor:"pointer"},title:e?.fullName||"",sx:{display:"flex",alignItems:"center",gap:1},children:[u.avatar?t.jsx(Je,{user:u,showDid:!0,cardType:Xe.AvatarOnly,infoType:Ke.Minimal,avatarSize:r,shape:"circle",sx:{width:r,height:r,borderRadius:"100%",overflow:"hidden",transition:"transform 0.2s ease-in-out","&:hover":{transform:"scale(1.1)"}}}):t.jsx(_,{sx:{width:r,height:r}}),l&&t.jsx("span",{children:e?.fullName})]})}W.propTypes={actor:n.shape(U).isRequired,size:n.number.isRequired,teamDid:n.string,inService:n.bool,showName:n.bool};K.propTypes={actors:n.oneOfType([n.shape(U),n.arrayOf(n.shape(U))]).isRequired,size:n.number,maxDisplay:n.number,teamDid:n.string,inService:n.bool,showName:n.bool,avatarFallback:n.node};function K({actors:e,size:r=32,maxDisplay:s=9,teamDid:i="",inService:l=!0,showName:u=!1,avatarFallback:m=null}){const d=D(()=>{const p=Array.isArray(e)?e:[e];return Ue(p,"did").filter(Boolean)},[e]);return d.length===1||!d.length?t.jsx(W,{actor:d[0],size:r,teamDid:i,inService:l,showName:u}):t.jsx(we,{total:d.length,renderSurplus:p=>p<100?t.jsxs("span",{children:["+",p]}):t.jsx("span",{children:"99+"}),max:s,sx:{justifyContent:"flex-end",height:`${r}px`,".MuiAvatar-root":{width:`${r}px`,height:`${r}px`,fontSize:`${r/2.5}px`,border:0,zIndex:2}},children:d.map((p,y)=>p?.avatar?t.jsx(W,{actor:p,size:r,teamDid:i,inService:l},p?.did||y):m)})}const ee=3;pe.propTypes={notification:n.object.isRequired,isMultiple:n.bool,blocklet:n.object,mountPoint:n.string,avatarFallback:n.node};ue.propTypes={notification:n.object.isRequired,mountPoint:n.string};he.propTypes={items:n.array.isRequired,activity:n.object.isRequired,blocklet:n.object,mountPoint:n.string,viewMoreLink:n.string,avatarFallback:n.node};function ue({notification:e,mountPoint:r=""}){const{activity:s}=e,{type:i,meta:l={}}=s||{},u=oe({activity:s,users:[e?.actorInfo],actors:[e?.activity?.actor],mountPoint:r});return H(s)||!s.type||!s.actor||H(s.target)?null:t.jsxs(g,{children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:.5,wordBreak:"break-all"},children:u}),l?t.jsx(ae,{meta:l,type:i}):null]})}function he({items:e,activity:r,blocklet:s,mountPoint:i="",viewMoreLink:l="",avatarFallback:u=null}){const m=F(),{t:d}=Q(),p=D(()=>s?.did||s?.meta?.did||"",[s]),{locale:y}=o.useContext(re),v=D(()=>!H(r.meta)&&Object.values(r.meta).some(a=>a!=null),[r]),b=oe({activity:r,users:e.map(a=>a?.actorInfo),actors:e.map(a=>a?.activity?.actor),mountPoint:i}),k=O(a=>{if(!a.activity)return null;const x=se(a.activity);return x?.metaLink?ie(x?.metaLink)?x?.metaLink:G(i,x.metaLink):null}),C=O((a,x)=>{if(!x)return;const h=k(x);h&&(window.open(h,"_blank"),a.customPreventRedirect=!0)}),$=e.length>ee,w=e.slice(0,ee);return t.jsxs(g,{sx:{width:"100%"},children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:3},children:b}),v?t.jsxs(g,{className:"sub-content",sx:{display:"flex",flexDirection:"column",gap:3},children:[w.map(a=>t.jsxs(g,{onClick:x=>C(x,a),sx:{display:"flex",flexDirection:"column",gap:1},children:[t.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[V(a)?t.jsx(K,{actors:a.actorInfo,size:32,teamDid:p}):u,t.jsx(q,{variant:"subtitle1",sx:{color:"text.primary"},children:V(a)?a?.actorInfo?.fullName:"System"})," ","·",t.jsx(J,{value:a.createdAt,locale:y,shouldUpdate:!0,style:{color:m.palette.text.secondary,fontSize:"0.875rem",minWidth:"50px",whiteSpace:"nowrap"}})]}),a.activity.meta?t.jsx(g,{sx:{pl:5},children:t.jsx(ae,{meta:a.activity.meta,type:a.activity.type})}):null]},a.id)),$&&l?t.jsx(g,{sx:{mt:1,display:"flex",justifyContent:"center"},children:t.jsxs(ke,{size:"large",variant:"text",component:te,href:l,target:"_blank",rel:"noopener noreferrer",onClick:a=>{a.customPreventRedirect=!0},children:[d("notification.viewMore")," ",t.jsx(ne,{icon:Ee,style:{marginLeft:4}})]})}):null]}):null]})}function pe({notification:e,isMultiple:r=!1,blocklet:s,mountPoint:i="",avatarFallback:l}){const u=D(()=>{if(!e.activity)return null;const m=se(e.activity);return m?.targetLink?ie(m?.targetLink)?m?.targetLink:G(i,m.targetLink):null},[e.activity,i]);return r?t.jsx(he,{items:e.items,activity:e.activity,blocklet:s,mountPoint:i,viewMoreLink:u,avatarFallback:l}):t.jsx(ue,{notification:e,mountPoint:i})}function me({notification:e}){const r=o.useMemo(()=>{const{actions:s,action:i}=e;let l=s??[];return!l.length&&i&&(l=[{name:"Visit",link:i}]),l},[e]);return r.length?t.jsx(g,{sx:{display:"flex",justifyContent:"start",flexWrap:"wrap",alignItems:"center",gap:1},children:r.map((s,i)=>t.jsxs(o.Fragment,{children:[t.jsx(te,{href:s.link,target:"_blank",className:"link",rel:"noopener noreferrer",sx:{fontSize:"15px"},onClick:l=>{l.customPreventRedirect=!0},children:s.name},s.link),i<r.length-1?t.jsx(Ie,{orientation:"vertical",sx:{height:12,borderWidth:"1px"}}):null]},s.link))}):null}me.propTypes={notification:n.object.isRequired};const ot=Me(g)`
|
|
1
|
+
import{r as o}from"./vendor-react-Dvs43sk9.js";import{j as t,b4 as _,W as n,D as F,n as xe,b0 as ye,cs as be,ct as ve,cu as je,cv as we,ak as g,T as q,Q as ke,a$ as te,a3 as Ie,s as Me,J as Ce,I as Re,at as Ae}from"./vendor-mui-core-C_NjJRjl.js";import{a as D,b as O,h as Te}from"./vendor-hooks-Bm2oaDgr.js";import{T as Q,a6 as Ne,ab as ne,G as re,a9 as Se}from"./vendor-ux-JmtAaYLa.js";import{t as $e}from"./server-logo-notext.svg-CKQB0tIp.js";import{B as Le}from"./bundle-avatar-ClP0s92u.js";import{a as ze,g as se,i as ie,b as oe,c as V,M as ae,d as Ee,m as De,e as Be,f as Pe,h as qe,j as Ve,k as _e,l as Fe,n as Oe,N as He}from"./team-Dd8yHElY.js";import{S as Ue,J as We,C as G,a as H}from"./vendor-utils-Gk-1qvTR.js";import{c as Qe,Z as Ge}from"./index-DgDvwRqt.js";import{B as Je,o as Ke,l as Xe}from"./index-BROakthZ.js";import{p as Ye}from"./util-Dr-F1wWu.js";function le({blocklet:e,style:r={},size:s=40,...i}){const l=ze({blocklet:e,square:!0}),{variant:u}=i;return t.jsx(_,{variant:u||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},r),...i,children:t.jsx("img",{src:l,alt:"",style:{width:s}})})}le.propTypes={blocklet:n.object.isRequired,style:n.object,size:n.oneOfType([n.number,n.string])};function Ze(e){return e.includes(" ")?new Date(e.replace(" ","T").replace(" ","")).getTime():new Date(e).getTime()}function J({value:e="",shouldUpdate:r=!1,...s}){const{locale:i}=Q(),[l,u]=o.useState(0);if(o.useEffect(()=>{let d;if(r){const p=new Date(e).getTime(),y=Date.now(),v=Math.abs(Math.floor((p-y)/1e3)),b=()=>{u(k=>{const R=Math.random()*1e3;return parseFloat((k+R).toFixed(4))})};v<60?d=setInterval(b,1e3):v<60*60?d=setInterval(b,6e4):d=setInterval(b,36e5)}return()=>{clearInterval(d)}},[e,l,r]),!e)return"-";const m=Ze(e);return t.jsx(Ne,{value:m,locale:i,...s})}J.propTypes={value:n.any,shouldUpdate:n.bool};const et={error:je,warning:ve,info:be,success:ye};ce.propTypes={severity:n.oneOf(["error","warning","info","success"]).isRequired,size:n.number};function ce({severity:e="info",size:r=32}){const s=F(),l=D(()=>({error:s.palette.error.main,warning:s.palette.warning.main,info:s.palette.info.main,success:s.palette.success.main}))[e],u=et[e],m=xe(l,.1);return t.jsx(_,{sx:{width:r,height:r,bgcolor:m,color:l},children:t.jsx(u,{fontSize:"small"})})}const tt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M5.821 4.91c3.898-2.765 9.469-2.539 13.073.536c3.667 3.127 4.168 8.238 1.152 11.897c-2.842 3.447-7.965 4.583-12.231 2.805l-.232-.101l-4.375.931l-.075.013l-.11.009l-.113-.004l-.044-.005l-.11-.02l-.105-.034l-.1-.044l-.076-.042l-.108-.077l-.081-.074l-.073-.083l-.053-.075l-.065-.115l-.042-.106l-.031-.113l-.013-.075l-.009-.11l.004-.113l.005-.044l.02-.11l.022-.072l1.15-3.451l-.022-.036C.969 12.45 1.97 7.805 5.59 5.079l.23-.168z"/></g>'},nt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M12 2a5 5 0 1 1-5 5l.005-.217A5 5 0 0 1 12 2zm2 12a5 5 0 0 1 5 5v1a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-1a5 5 0 0 1 5-5h4z"/></g>'},rt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M17 3.34A10 10 0 1 1 2 12l.005-.324A10 10 0 0 1 17 3.34zM12 6a1 1 0 0 0-1 1a3 3 0 1 0 0 6v2a1.024 1.024 0 0 1-.866-.398l-.068-.101a1 1 0 0 0-1.732.998a3 3 0 0 0 2.505 1.5H11a1 1 0 0 0 .883.994L12 18a1 1 0 0 0 1-1l.176-.005A3 3 0 0 0 13 11V9c.358-.012.671.14.866.398l.068.101a1 1 0 0 0 1.732-.998A3 3 0 0 0 13.161 7H13a1 1 0 0 0-1-1zm1 7a1 1 0 0 1 0 2v-2zm-2-4v2a1 1 0 0 1 0-2z"/></g>'},st={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M8 12a4 4 0 1 0 8 0a4 4 0 1 0-8 0"/><path d="M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-5.5 8.28"/></g>'},it={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m15 10l-4 4l6 6l4-16l-18 7l4 2l2 6l3-4"/>'},Z={comment:{icon:tt,bgColor:"rgba(239, 246, 255, 1)",color:"rgba(43, 127, 255, 1)"},like:{icon:"👍",bgColor:"rgba(244, 244, 245, 1)",color:"yellow",renderType:"emoji"},follow:{icon:nt,bgColor:"rgba(238, 242, 255, 1)",color:"rgba(97, 95, 255, 1)"},tips:{icon:rt,bgColor:"rgba(254, 252, 232, 1)",color:"rgba(240, 177, 0, 1)"},mention:{icon:st,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"},assign:{icon:it,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"}};de.propTypes={activity:n.oneOf(["comment","like","follow","tips","mention","assign"]).isRequired,size:n.number};function de({activity:e,size:r=32}){const s=Z[e]||Z.comment,i=s.icon;return t.jsx(_,{sx:{bgcolor:s.bgColor,color:s.color,width:r,height:r},children:s.renderType==="emoji"?t.jsx("span",{style:{fontSize:"14px"},children:i}):t.jsx(ne,{icon:i})})}const U={avatar:n.string,fullName:n.string,did:n.string};function W({actor:e,size:r,teamDid:s="",inService:i=!1,showName:l=!1}){const u=D(()=>({...e,avatar:e?.avatar?Ye(e.avatar,s,i):null}),[e,s,i]),m=d=>{e&&(d.stopPropagation(),window.open(We(G(Qe.WELLKNOWN_SERVICE_PATH_PREFIX,"user"),{did:e.did}),"_blank"),d.customPreventRedirect=!0)};return t.jsxs(g,{onClick:m,role:"button",style:{cursor:"pointer"},title:e?.fullName||"",sx:{display:"flex",alignItems:"center",gap:1},children:[u.avatar?t.jsx(Je,{user:u,showDid:!0,cardType:Xe.AvatarOnly,infoType:Ke.Minimal,avatarSize:r,shape:"circle",sx:{width:r,height:r,borderRadius:"100%",overflow:"hidden",transition:"transform 0.2s ease-in-out","&:hover":{transform:"scale(1.1)"}}}):t.jsx(_,{sx:{width:r,height:r}}),l&&t.jsx("span",{children:e?.fullName})]})}W.propTypes={actor:n.shape(U).isRequired,size:n.number.isRequired,teamDid:n.string,inService:n.bool,showName:n.bool};K.propTypes={actors:n.oneOfType([n.shape(U),n.arrayOf(n.shape(U))]).isRequired,size:n.number,maxDisplay:n.number,teamDid:n.string,inService:n.bool,showName:n.bool,avatarFallback:n.node};function K({actors:e,size:r=32,maxDisplay:s=9,teamDid:i="",inService:l=!0,showName:u=!1,avatarFallback:m=null}){const d=D(()=>{const p=Array.isArray(e)?e:[e];return Ue(p,"did").filter(Boolean)},[e]);return d.length===1||!d.length?t.jsx(W,{actor:d[0],size:r,teamDid:i,inService:l,showName:u}):t.jsx(we,{total:d.length,renderSurplus:p=>p<100?t.jsxs("span",{children:["+",p]}):t.jsx("span",{children:"99+"}),max:s,sx:{justifyContent:"flex-end",height:`${r}px`,".MuiAvatar-root":{width:`${r}px`,height:`${r}px`,fontSize:`${r/2.5}px`,border:0,zIndex:2}},children:d.map((p,y)=>p?.avatar?t.jsx(W,{actor:p,size:r,teamDid:i,inService:l},p?.did||y):m)})}const ee=3;pe.propTypes={notification:n.object.isRequired,isMultiple:n.bool,blocklet:n.object,mountPoint:n.string,avatarFallback:n.node};ue.propTypes={notification:n.object.isRequired,mountPoint:n.string};he.propTypes={items:n.array.isRequired,activity:n.object.isRequired,blocklet:n.object,mountPoint:n.string,viewMoreLink:n.string,avatarFallback:n.node};function ue({notification:e,mountPoint:r=""}){const{activity:s}=e,{type:i,meta:l={}}=s||{},u=oe({activity:s,users:[e?.actorInfo],actors:[e?.activity?.actor],mountPoint:r});return H(s)||!s.type||!s.actor||H(s.target)?null:t.jsxs(g,{children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:.5,wordBreak:"break-all"},children:u}),l?t.jsx(ae,{meta:l,type:i}):null]})}function he({items:e,activity:r,blocklet:s,mountPoint:i="",viewMoreLink:l="",avatarFallback:u=null}){const m=F(),{t:d}=Q(),p=D(()=>s?.did||s?.meta?.did||"",[s]),{locale:y}=o.useContext(re),v=D(()=>!H(r.meta)&&Object.values(r.meta).some(a=>a!=null),[r]),b=oe({activity:r,users:e.map(a=>a?.actorInfo),actors:e.map(a=>a?.activity?.actor),mountPoint:i}),k=O(a=>{if(!a.activity)return null;const x=se(a.activity);return x?.metaLink?ie(x?.metaLink)?x?.metaLink:G(i,x.metaLink):null}),R=O((a,x)=>{if(!x)return;const h=k(x);h&&(window.open(h,"_blank"),a.customPreventRedirect=!0)}),S=e.length>ee,w=e.slice(0,ee);return t.jsxs(g,{sx:{width:"100%"},children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:3},children:b}),v?t.jsxs(g,{className:"sub-content",sx:{display:"flex",flexDirection:"column",gap:3},children:[w.map(a=>t.jsxs(g,{onClick:x=>R(x,a),sx:{display:"flex",flexDirection:"column",gap:1},children:[t.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[V(a)?t.jsx(K,{actors:a.actorInfo,size:32,teamDid:p}):u,t.jsx(q,{variant:"subtitle1",sx:{color:"text.primary"},children:V(a)?a?.actorInfo?.fullName:"System"})," ","·",t.jsx(J,{value:a.createdAt,locale:y,shouldUpdate:!0,style:{color:m.palette.text.secondary,fontSize:"0.875rem",minWidth:"50px",whiteSpace:"nowrap"}})]}),a.activity.meta?t.jsx(g,{sx:{pl:5},children:t.jsx(ae,{meta:a.activity.meta,type:a.activity.type})}):null]},a.id)),S&&l?t.jsx(g,{sx:{mt:1,display:"flex",justifyContent:"center"},children:t.jsxs(ke,{size:"large",variant:"text",component:te,href:l,target:"_blank",rel:"noopener noreferrer",onClick:a=>{a.customPreventRedirect=!0},children:[d("notification.viewMore")," ",t.jsx(ne,{icon:Ee,style:{marginLeft:4}})]})}):null]}):null]})}function pe({notification:e,isMultiple:r=!1,blocklet:s,mountPoint:i="",avatarFallback:l}){const u=D(()=>{if(!e.activity)return null;const m=se(e.activity);return m?.targetLink?ie(m?.targetLink)?m?.targetLink:G(i,m.targetLink):null},[e.activity,i]);return r?t.jsx(he,{items:e.items,activity:e.activity,blocklet:s,mountPoint:i,viewMoreLink:u,avatarFallback:l}):t.jsx(ue,{notification:e,mountPoint:i})}function me({notification:e}){const r=o.useMemo(()=>{const{actions:s,action:i}=e;let l=s??[];return!l.length&&i&&(l=[{name:"Visit",link:i}]),l},[e]);return r.length?t.jsx(g,{sx:{display:"flex",justifyContent:"start",flexWrap:"wrap",alignItems:"center",gap:1},children:r.map((s,i)=>t.jsxs(o.Fragment,{children:[t.jsx(te,{href:s.link,target:"_blank",className:"link",rel:"noopener noreferrer",sx:{fontSize:"15px"},onClick:l=>{l.customPreventRedirect=!0},children:s.name},s.link),i<r.length-1?t.jsx(Ie,{orientation:"vertical",sx:{height:12,borderWidth:"1px"}}):null]},s.link))}):null}me.propTypes={notification:n.object.isRequired};const ot=Me(g)`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: center;
|
|
4
4
|
align-items: center;
|
|
@@ -9,7 +9,7 @@ import{r as o}from"./vendor-react-Dvs43sk9.js";import{j as t,b4 as _,W as n,D as
|
|
|
9
9
|
.empty-icon {
|
|
10
10
|
margin: 10px 0;
|
|
11
11
|
}
|
|
12
|
-
`;function fe({children:e=null,...r}){const s=Ge(),l=F().palette.mode==="dark";return t.jsxs(ot,{...r,children:[t.jsx("img",{src:`${s.imgPrefix}/${l?"all-done-dark":"all-done-light"}.svg`,alt:"All Done",width:120,height:120,style:{maxHeight:"100%",maxWidth:"100%"},onError:u=>{u.target.style.display="none"}}),t.jsx(g,{className:"empty-content",children:e})]})}fe.propTypes={color:n.string,children:n.any};at.propTypes={data:n.array,blockletMap:n.object,onReadBatch:n.func,inDialog:n.bool,highlightId:n.string,highlight:n.bool,type:n.oneOf(["server","service"])};ge.propTypes={notification:n.object,blocklet:n.object,onReadBatch:n.func,inDialog:n.bool,highlight:n.bool};P.propTypes={blocklet:n.object,size:n.number,showName:n.bool,hideDot:n.bool};function P({blocklet:e,size:r=40,showName:s=!1,hideDot:i=!1}){const l=e?.did||e?.meta?.did||"",u=(e?.alsoKnownAs||[]).concat(e?.appId||e?.appDid||e?.appPid||"");return t.jsxs(g,{className:"component-avatar",sx:{display:"flex",alignItems:"center",gap:i?"8px":"4px"},children:[!i&&t.jsx("span",{className:"dot"}),e?t.jsx(g,{children:u.includes(l)?t.jsx(le,{blocklet:e,size:r,style:{borderRadius:8}}):t.jsx(Le,{blocklet:e,ancestors:e.ancestors??[],size:r,style:{borderRadius:8}})}):t.jsx(
|
|
12
|
+
`;function fe({children:e=null,...r}){const s=Ge(),l=F().palette.mode==="dark";return t.jsxs(ot,{...r,children:[t.jsx("img",{src:`${s.imgPrefix}/${l?"all-done-dark":"all-done-light"}.svg`,alt:"All Done",width:120,height:120,style:{maxHeight:"100%",maxWidth:"100%"},onError:u=>{u.target.style.display="none"}}),t.jsx(g,{className:"empty-content",children:e})]})}fe.propTypes={color:n.string,children:n.any};at.propTypes={data:n.array,blockletMap:n.object,onReadBatch:n.func,inDialog:n.bool,highlightId:n.string,highlight:n.bool,type:n.oneOf(["server","service"])};ge.propTypes={notification:n.object,blocklet:n.object,onReadBatch:n.func,inDialog:n.bool,highlight:n.bool};P.propTypes={blocklet:n.object,size:n.number,showName:n.bool,hideDot:n.bool};function P({blocklet:e,size:r=40,showName:s=!1,hideDot:i=!1}){const l=e?.did||e?.meta?.did||"",u=(e?.alsoKnownAs||[]).concat(e?.appId||e?.appDid||e?.appPid||"");return t.jsxs(g,{className:"component-avatar",sx:{display:"flex",alignItems:"center",gap:i?"8px":"4px"},children:[!i&&t.jsx("span",{className:"dot"}),e?t.jsx(g,{children:u.includes(l)?t.jsx(le,{blocklet:e,size:r,style:{borderRadius:8}}):t.jsx(Le,{blocklet:e,ancestors:e.ancestors??[],size:r,style:{borderRadius:8}})}):t.jsx($e,{width:r,height:r}),s&&t.jsx("span",{className:"component-name",children:e?.meta?.title})]})}function ge({notification:e,blocklet:r,onReadBatch:s=()=>{},inDialog:i=!1,highlight:l}){const{locale:u}=o.useContext(re),m=F(),d=Ce(h=>h.breakpoints.down("md")),p=o.useRef(null),y=o.useMemo(()=>qe(e),[e]),v=o.useMemo(()=>Ve(e),[e]),b=o.useMemo(()=>V(e),[e]),k=o.useMemo(()=>e.items||[],[e]),R=o.useMemo(()=>k.length>0,[k]),S=o.useMemo(()=>v?R?k.map(h=>V(h)?h.actorInfo:{did:h.activity?.actor}).filter(Boolean):e.actorInfo??[]:[],[k,e.actorInfo,R,v]),w=o.useMemo(()=>r?.did||r?.meta?.did||"",[r]),a=o.useMemo(()=>_e(w,window.blocklet),[w]),x=O((h,$)=>{const A=Fe(h);if(A.length&&s(A.map(C=>C.id)),$&&!$.customPreventRedirect){const C=Oe(h,a);C&&typeof C=="string"&&window.open(C,"_blank","noopener,noreferrer")}});return t.jsxs(lt,{ref:p,className:"notification-row",id:e.id,isRead:y,inDialog:i,highlight:l,isMd:d,onClick:h=>x(e,h),children:[v?t.jsx(de,{activity:e.activity.type,size:d?24:32}):t.jsx(ce,{severity:e.severity,size:d?24:32}),t.jsxs(g,{className:"notification",sx:{display:"flex",flexDirection:"column",alignItems:"start"},children:[t.jsxs(g,{className:"header",sx:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",gap:1,mb:1.5},children:[v&&b?t.jsx(K,{actors:S,teamDid:w,size:d?24:32,avatarFallback:t.jsx(P,{blocklet:r,hideDot:!0,size:d?24:32})}):t.jsx(P,{blocklet:r,hideDot:!0,size:d?24:32}),t.jsx(J,{value:e.createdAt,locale:u,shouldUpdate:!0,style:{color:m.palette.text.secondary,fontSize:"0.875rem",minWidth:"50px",whiteSpace:"nowrap"}})]}),v?t.jsx(pe,{notification:e,isMultiple:R,blocklet:r,mountPoint:a,avatarFallback:t.jsx(P,{blocklet:r,hideDot:!0,size:d?24:32})}):t.jsxs(t.Fragment,{children:[t.jsx(q,{variant:"body1",className:"title",sx:{color:"rgba(24, 24, 27, 1)",mt:0,mb:.5},children:e.title}),t.jsx(He,{notification:e,rows:i?0:2})]}),t.jsx(me,{notification:e})]}),e?.description&&e.severity==="error"&&t.jsx(g,{className:"copy-button",children:t.jsx(Re,{size:"small",children:t.jsx(Se,{sx:{fontSize:22},content:e?.description||""})})})]})}function at({data:e,blockletMap:r,onReadBatch:s=()=>{},inDialog:i=!1,highlightId:l,highlight:u=!1,type:m="service"}){const{t:d}=Q(),p=o.useRef(null),[y,v]=o.useState(!1),[b,k]=o.useState(!0),[R,S]=o.useState(!1),w=o.useRef(new Set),a=o.useRef(new Set),x=o.useRef(null),h=o.useRef(null),$=o.useRef(!1),A=o.useRef(null),C=o.useMemo(()=>i?e?.slice(0,5):e,[i,e]),L=o.useMemo(()=>De(C),[C]),z=o.useMemo(()=>{const c=new Map;return L&&L.length&&L.forEach(f=>{c.set(f.id,f)}),c},[L]);o.useEffect(()=>{const c=()=>{k(document.visibilityState==="visible")};return document.addEventListener("visibilitychange",c),()=>{document.removeEventListener("visibilitychange",c)}},[]);const B=o.useCallback(()=>{if(!i&&w.current.size>0){const c=[];w.current.forEach(f=>{if(a.current.has(f))return;const I=z.get(f);if(I){const{receivers:T=[],items:N=[]}=I;if(T.length&&!T[0].read&&(c.push(f),a.current.add(f),N.length>0&&N.forEach(j=>{const M=j.id;M&&!a.current.has(M)&&(c.push(M),a.current.add(M))}),h.current)){const j=document.getElementById(f);j&&h.current.unobserve(j)}}}),c.length>0&&(s(c),setTimeout(()=>{v(!1)},300)),w.current.clear()}},[i,z,s]),X=o.useCallback(()=>{A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{B()},50)},[B]),E=o.useCallback(()=>{if(i||!p.current||!b)return;h.current&&h.current.disconnect();const c={root:null,rootMargin:"0px",threshold:.5},f=new IntersectionObserver(T=>{y&&T.forEach(N=>{const j=N.target.id;if(a.current.has(j))return;const M=z.get(j);if(M){const{receivers:Y=[]}=M;Y.length&&!Y[0].read&&(N.isIntersecting?(w.current.add(j),X()):w.current.delete(j))}})},c);h.current=f,Array.from(p.current.querySelectorAll(".notification-row")).filter(T=>{const N=T.id;if(a.current.has(N))return!1;const j=z.get(N);if(j){const{receivers:M=[]}=j;return M.length&&!M[0].read}return!1}).forEach(T=>{f.observe(T)}),$.current=!1},[y,i,b,z,X]);return o.useEffect(()=>{i||($.current=!0,h.current&&b&&y&&setTimeout(()=>{E()},0))},[C,y,b,E,i]),o.useEffect(()=>{if(i||!p.current||!b)return;let c=window;if(m==="server"&&(c=document.getElementById("arc__dashboard-main")),!c){const I=document.getElementsByClassName("dashboard-main")[0];I&&(c=I)}if(!c)return;const f=I=>{I.isTrusted&&(y||v(!0),S(!0),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{S(!1),B(),$.current&&E()},300))};return c.addEventListener("scroll",f,{passive:!0}),()=>{c.removeEventListener("scroll",f),x.current&&clearTimeout(x.current),A.current&&clearTimeout(A.current)}},[i,y,b,B,E,m]),o.useEffect(()=>(i||E(),()=>{h.current&&h.current.disconnect()}),[E,i]),Te(()=>{setTimeout(()=>{const c=Be(p.current),f=Pe(z,c);s(f.map(I=>I.id))},100)}),L?.length?t.jsx(g,{ref:p,sx:{display:"flex",flexDirection:"column",...i?{maxHeight:"calc(-200px + 100vh)",overflow:"auto"}:{}},children:L?.map(c=>{const f=c.source==="system"?r.get(c.entityId||c.sender):r.get(c.componentDid||c.sender);return c?.type?.toLowerCase()==="passthrough"?null:t.jsx(ge,{highlight:u&&l===c.id,inDialog:i,notification:c,blocklet:f,onReadBatch:s},c.id)})}):t.jsx(fe,{children:d("notification.allDone")})}const lt=Ae(g)`
|
|
13
13
|
@keyframes flash-bg {
|
|
14
14
|
0% {
|
|
15
15
|
background-color: ${e=>e.theme.palette.warning.light};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./vendor-react-Dvs43sk9.js";import{j as e,s as c,ak as a,b1 as i,W as l}from"./vendor-mui-core-
|
|
1
|
+
import"./vendor-react-Dvs43sk9.js";import{j as e,s as c,ak as a,b1 as i,W as l}from"./vendor-mui-core-C_NjJRjl.js";const t=c(a)(({theme:r})=>({backgroundColor:r.palette.background.default,"& .header-row":{display:"flex",justifyContent:"space-between",alignItems:"center",gap:r.spacing(1)},"& .right":{display:"flex",alignItems:"center",gap:r.spacing(1.5)},"& .tabs":{marginTop:r.spacing(2),"& .MuiButton-root":{border:"none",color:"#999","&.active":{color:"#222"}}},"@media (max-width: 900px)":{"& .header-row":{flexDirection:"column",alignItems:"flex-start"},"& .right":{flexDirection:"column",width:"100%",".search-always-open, .toolbar-btn-show, a, button, .MuiButtonGroup-root":{width:"100% !important"}}}}));function d({left:r=null,tabs:n=null,actions:s=null,...o}){return!r&&!n?e.jsx(t,{elevation:0,...o,children:e.jsxs(a,{className:"header-row",children:[e.jsx(a,{className:"left"}),e.jsx(i,{direction:"row",className:"right",children:s})]})}):r&&!n||!r&&n?e.jsx(t,{elevation:0,...o,children:e.jsxs(a,{className:"header-row",children:[e.jsx(a,{className:"left",children:r||n}),e.jsx(i,{direction:"row",className:"right",children:s})]})}):e.jsxs(t,{elevation:0,...o,children:[e.jsxs(a,{className:"header-row",children:[e.jsx(a,{className:"left",children:r}),e.jsx(i,{direction:"row",className:"right",children:s})]}),n&&e.jsx(a,{sx:{mt:2},children:n})]})}d.propTypes={left:l.node,tabs:l.node,actions:l.node};export{d as L};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{r as I,a as Kr}from"./vendor-react-Dvs43sk9.js";import{r as tr,a as rr,b as nr,c as ir,d as ut,e as sr,f as or,g as ar,h as ft,i as cr,j as lr,k as ur,m as Ie,n as fr,o as dr,p as hr,q as ve,s as pr,t as yr,u as mr,v as gr,an as Ir,b9 as Lr,T as $e,H as Ke,_ as qr,$ as _r,a6 as Ne,ac as Mr,O as Fr}from"./vendor-ux-pYOhjQLA.js";import{j as r,Y as dt,bB as ht,I as pt,aj as yt,$ as mt,b1 as _e,T as X,ak as R,z as V,F as M,b7 as Wr,b5 as br,b6 as Sr,a5 as Er,a3 as gt,aX as xr,R as Tr,Q as je,a6 as _t,W as w,am as Vr,cf as Hr,cg as zr,ch as Yr}from"./vendor-mui-core-CmD-NPnl.js";import{B as Xr,o as Jr,l as Gr}from"./index-uH_9YgA0.js";import{u as Zr}from"./useAsyncRetry-6TjWJyO6.js";import{w as Br,B as C,o as Qr,b as en,C as Ht}from"./vendor-utils-DQK0pEML.js";import{r as tn}from"./hdkey-BgsbeAhG.js";import{Z as Re,c as ie,a8 as rn}from"./index-BJbNz5vx.js";import{u as ke}from"./team-B-jk7E5_.js";import{u as jr,C as z}from"./index.esm-JPZAjt0x.js";import{T as nn}from"./index-BwMsFaIR.js";import{E as sn}from"./empty-spinner-DCC7mgEb.js";import{C as q}from"./click-to-copy-Dqmzk5Lh.js";import{D as on}from"./delete-confirm-ZcwDcAcQ.js";import{a as an}from"./passport-item-CK1Zj4rm.js";import{A as cn}from"./actions-CL4xTGOh.js";import{T as Bt}from"./table-tips-CgCabdgD.js";import{u as ln}from"./use-mobile-D93Bk2Ru.js";import"./vendor-hooks-DLNZ8kxG.js";import"./lottie-web-4koyQiv_.js";import"./useAsync-CNAYLnLm.js";import"./vendor-arcblock-DEa0A9MF.js";import"./session-m3orzHBa.js";import"./isURL-CCV0esLR.js";import"./use-app-logo-D_gO-Dio.js";import"./arrow-down.svg-VIKI4IBd.js";import"./vendor-mui-x--K2rEM1j.js";import"./AdapterDayjs-Ch1GqpK7.js";import"./confirm-BbY8YGyk.js";import"./index-DBs9Ljax.js";import"./did-address-CNnw4_bl.js";import"./util-Bravn321.js";import"./base32-dGIGRTeZ.js";var Ae={},Ce={},Z={},re={},jt;function un(){if(jt)return re;jt=1;var e=re&&re.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(re,"__esModule",{value:!0}),re.BaseBN=re.BN=void 0;const o=e(Br());re.BaseBN=o.default;class i extends o.default{constructor(a,s,p){super(a===null?"0":a,s,p)}}return re.BN=i,re}var vt;function se(){return vt||(vt=1,function(e){var o=Z&&Z.__createBinding||(Object.create?function(t,f,m,U){U===void 0&&(U=m);var E=Object.getOwnPropertyDescriptor(f,m);(!E||("get"in E?!f.__esModule:E.writable||E.configurable))&&(E={enumerable:!0,get:function(){return f[m]}}),Object.defineProperty(t,U,E)}:function(t,f,m,U){U===void 0&&(U=m),t[U]=f[m]}),i=Z&&Z.__setModuleDefault||(Object.create?function(t,f){Object.defineProperty(t,"default",{enumerable:!0,value:f})}:function(t,f){t.default=f}),u=Z&&Z.__importStar||function(t){if(t&&t.__esModule)return t;var f={};if(t!=null)for(var m in t)m!=="default"&&Object.prototype.hasOwnProperty.call(t,m)&&o(f,t,m);return i(f,t),f},a=Z&&Z.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.fromTokenToUnit=e.fromUnitToToken=e.numberToString=e.toHex=e.hexToBytes=e.bytesToHex=e.numberToHex=e.hexToNumber=e.hexToUtf8=e.utf8ToHex=e.toBN=e.isHex=e.isHexStrict=e.isBigNumber=e.isBN=e.stripHexPrefix=e.isHexPrefixed=e.numberToBN=e.rightPad=e.leftPad=e.BN=e.isBase58btc=void 0,e.isUint8Array=be,e.UUID=Qe,e.isUUID=et,e.toUint8Array=Se,e.toBuffer=Oe,e.toBase58=tt,e.fromBase58=rt,e.toBase64=nt,e.fromBase64=it,e.toAddress=te,e.toDid=st,e.isSameDid=ot,e.formatTxType=at;const s=a(tr),p=a(rr),d=a(nr),y=a(ir),g=a(ut),n=a(sr),c=a(or),l=a(ar);e.rightPad=l.default;const h=a(ft);e.leftPad=h.default;const S=a(cr()),_=a(lr()),H=u(ur()),x=un();Object.defineProperty(e,"BN",{enumerable:!0,get:function(){return x.BN}});const k="did:abt:",B=new x.BN(0),T=new x.BN(-1),j={encode:t=>`z${S.default.encode(t)}`,decode:t=>S.default.decode(t.slice(1))},O=t=>{if(typeof t!="string")return!1;if(t[0]==="z")try{return j.decode(t),!0}catch{return!1}return!1};e.isBase58btc=O;const b=t=>{if(typeof t=="string"||typeof t=="number"){let f=new x.BN(1);const m=String(t).toLowerCase().trim(),U=m.substr(0,2)==="0x"||m.substr(0,3)==="-0x";let E=(0,e.stripHexPrefix)(m);if(E.substr(0,1)==="-"&&(E=(0,e.stripHexPrefix)(E.slice(1)),f=new x.BN(-1,10)),E=E===""?"0":E,!E.match(/^-?[0-9]+$/)&&E.match(/^[0-9A-Fa-f]+$/)||E.match(/^[a-fA-F]+$/)||U===!0&&E.match(/^[0-9A-Fa-f]+$/))return new x.BN(E,16).mul(f);if((E.match(/^-?[0-9]+$/)||E==="")&&U===!1)return new x.BN(E,10).mul(f)}if((0,e.isBN)(t))return new x.BN(t.toString(10),10);throw new Error(`[number-to-bn] while converting number ${JSON.stringify(t)} to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.`)};e.numberToBN=b;const v=t=>{if(typeof t!="string")throw new Error("[is-hex-prefixed] value must be type string");return t.slice(0,2).toLowerCase()==="0x"};e.isHexPrefixed=v;const P=t=>typeof t=="string"&&(0,e.isHexPrefixed)(t)?t.slice(2):t;e.stripHexPrefix=P;const A=t=>t instanceof x.BN||t instanceof x.BaseBN||t&&t.constructor&&t.constructor.name==="BN";e.isBN=A;const K=t=>t&&t.constructor&&t.constructor.name==="BigNumber";e.isBigNumber=K;const ee=t=>((0,p.default)(t)||(0,d.default)(t))&&/^(-)?0x[0-9a-f]*$/i.test(t);e.isHexStrict=ee;const Le=t=>((0,p.default)(t)||(0,d.default)(t))&&/^(-0x|0x|0X|-0X)?[0-9a-f]*$/i.test(t);e.isHex=Le;const qe=(t,f=10)=>{try{if(typeof t=="number"&&t>0){const m=Number(t).toLocaleString("fullwide",{useGrouping:!1});return new x.BN(m,f)}return(0,e.numberToBN)(t)}catch(m){throw new Error(`${m} Given value: "${t}"`)}};e.toBN=qe;const Me=t=>{t=H.encode(t);let f="";t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join("");for(let m=0;m<t.length;m++){const E=t.charCodeAt(m).toString(16);f+=E.length<2?`0${E}`:E}return`0x${f}`};e.utf8ToHex=Me;const Fe=t=>{if(!(0,e.isHexStrict)(t))throw new Error(`The parameter "${t}" must be a valid HEX string.`);let f="",m=0;t=t.replace(/^0x/i,""),t=t.replace(/^(?:00)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:00)*/,""),t=t.split("").reverse().join("");const U=t.length;for(let E=0;E<U;E+=2)m=parseInt(t.substr(E,2),16),f+=String.fromCharCode(m);return H.decode(f)};e.hexToUtf8=Fe;const We=t=>t?(0,e.toBN)(t).toNumber():0;e.hexToNumber=We;const Ve=t=>{if((0,c.default)(t)||typeof t>"u")return t;if(!isFinite(t)&&!(0,e.isHex)(t))throw new Error(`Given input "${t}" is not a number.`);const f=(0,e.toBN)(t),m=f.toString(16);return f.lt(new x.BN(0))?`-0x${m.substr(1)}`:`0x${m}`};e.numberToHex=Ve;const ze=t=>{const f=[];for(let m=0;m<t.length;m++)f.push((t[m]>>>4).toString(16)),f.push((t[m]&15).toString(16));return`0x${f.join("")}`};e.bytesToHex=ze;const Ye=t=>{if(t=t.toString(16),!(0,e.isHex)(t))throw new Error(`Given value "${t}" is not a valid hex string.`);t=t.replace(/^0x/i,""),t=t.length%2?`0${t}`:t;const f=[];for(let m=0;m<t.length;m+=2)f.push(parseInt(t.substr(m,2),16));return f};e.hexToBytes=Ye;const Xe=(t,f=!1)=>be(t)||C.isBuffer(t)?f?"bytes":(0,e.bytesToHex)(t):(0,e.isBase58btc)(t)?f?"bytes":(0,e.bytesToHex)(j.decode(t)):(0,s.default)(t)?f?"bool":t?"0x01":"0x00":(0,y.default)(t)&&!(0,e.isBigNumber)(t)&&!(0,e.isBN)(t)?f?"string":(0,e.utf8ToHex)(JSON.stringify(t)):typeof t=="string"?t.indexOf("-0x")===0||t.indexOf("-0X")===0?f?"int256":(0,e.numberToHex)(t):t.indexOf("0x")===0||t.indexOf("0X")===0?f?"bytes":t:f?"string":(0,e.utf8ToHex)(t):f?+t<0?"int256":"uint256":(0,e.numberToHex)(t);e.toHex=Xe;const Je=t=>{if(typeof t=="string"){if(!t.match(/^-?[0-9.]+$/))throw new Error(`Invalid value '${t}' while converting to string, should be a number matching (^-?[0-9.]+).`);return t}if(typeof t=="number")return Number.isInteger(t)&&t>0?Number(t).toLocaleString("fullwide",{useGrouping:!1}):String(t);if(typeof t=="object"&&t.toString&&(t.toTwos||t.dividedToIntegerBy))return t.toPrecision?String(t.toPrecision()):t.toString(10);throw new Error(`while converting number to string, invalid number value '${t}' type ${typeof t}.`)};e.numberToString=Je;const Ge=(t,f=18,m={})=>{let U=(0,e.toBN)(t);const E=U.lt(B),F=(0,e.toBN)(`1${"0".repeat(f)}`,10),G=F.toString(10).length-1||1,N=m||{};E&&(U=U.mul(T));let $=U.mod(F).toString(10);for(;$.length<G;)$=`0${$}`;N.pad||($=$.match(/^([0-9]*[1-9]|0)(0*)/)[1]);let L=U.div(F).toString(10);N.commify&&(L=L.replace(/\B(?=(\d{3})+(?!\d))/g,","));let Ee=`${L}${$==="0"?"":`.${$}`}`;return E&&(Ee=`-${Ee}`),Ee};e.fromUnitToToken=Ge;const Ze=(t,f=18)=>{let m=(0,e.numberToString)(t);const U=(0,e.toBN)(`1${"0".repeat(f)}`,10),E=U.toString(10).length-1||1,F=m.substring(0,1)==="-";if(F&&(m=m.substring(1)),m===".")throw new Error(`error converting token ${t} to unit, invalid value`);const G=m.split(".");if(G.length>2)throw new Error(`error converting token ${t} to unit, too many decimal points`);let N=G[0],$=G[1];if(N||(N="0"),$||($="0"),$.length>E)throw new Error(`error converting token ${t} to unit, too many decimal places`);for(;$.length<E;)$+="0";N=new x.BN(N),$=new x.BN($);let L=N.mul(U).add($);return F&&(L=L.mul(T)),new x.BN(L.toString(10),10)};e.fromTokenToUnit=Ze;function be(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Qe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const f=Math.random()*16|0;return(t==="x"?f:f&3|8).toString(16)})}function et(t){return/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(t)}function Se(t){let f=null;if([null,void 0,""].includes(t))f=new Uint8Array;else if(C.isBuffer(t))f=new Uint8Array(t);else if((0,e.isHexStrict)(t))f=new Uint8Array((0,e.hexToBytes)(t));else if(be(t))f=new Uint8Array(t);else if((0,e.isBase58btc)(t))f=new Uint8Array(j.decode(t));else if(typeof t=="string")f=new Uint8Array((0,e.hexToBytes)((0,e.toHex)(t)));else throw new Error(`Unsupported input type ${typeof t} detected for toBuffer, only Uint8Array/Buffer/Hex/Base58 are supported`);return f}function Oe(t){return C.from(Se(t))}function tt(t){const f=j.encode(Se(t));return C.from(f).toString("utf-8")}function rt(t){if((0,e.isBase58btc)(t)===!1)throw new Error("fromBase58 expect strict base58 encoded string as input");return C.from(j.decode(t))}function nt(t,f=!0){const m=_.default.encode(Oe(t));return f?_.default.escape(m):m}function it(t){if(typeof t!="string")throw new Error("fromBase64 requires input to be a string");return C.from(_.default.unescape(t),"base64")}function te(t){return t.replace(k,"")}function st(t){return`${k}${te(t)}`}function ot(t,f){return te(t).toLowerCase()===te(f).toLowerCase()}function at(t){return(0,g.default)((0,n.default)(t))}}(Z)),Z}var wt;function we(){if(wt)return Ce;wt=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.encode=o;const e=se();function o(i,u="hex"){return["hex","base16"].includes(u)?(0,e.toHex)(i):u==="base58"?(0,e.toBase58)(i):u==="base64"?(0,e.toBase64)(i):u==="Uint8Array"?(0,e.toUint8Array)(i):u==="buffer"?(0,e.toBuffer)(i):i}return Ce}var oe={},Ut;function fn(){if(Ut)return oe;Ut=1;var e=oe&&oe.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(oe,"__esModule",{value:!0}),oe.KeccakHasher=void 0;const o=e(Ie()),i=se(),u=we();class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=n=>o.default[`keccak${p}`](n),g=(n,c)=>c===1?y(n):g(y(n),c-1);this[d]=(n,c=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=g(h,c);return(0,u.encode)(`0x${S}`,l)}})}}return oe.KeccakHasher=a,oe.default=new a,oe}var xe={},Ot;function dn(){if(Ot)return xe;Ot=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.Sha2Hasher=void 0;const e=se(),o=fr(),i=we(),u={sha224:o.sha224,sha256:o.sha256,sha384:o.sha384,sha512:o.sha512};class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=u[`sha${p}`],g=(n,c)=>{let l=n;try{l=(0,e.toUint8Array)(n)}catch{}return c===1?`0x${y().update(l).digest("hex")}`:g(g(l,1),c-1)};this[d]=(n,c=2,l="hex")=>{const h=g(n,c);return(0,i.encode)(h,l)}})}}return xe.Sha2Hasher=a,xe.default=new a,xe}var ae={},At;function hn(){if(At)return ae;At=1;var e=ae&&ae.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ae,"__esModule",{value:!0}),ae.Sha3Hasher=void 0;const o=e(Ie()),i=se(),u=we();class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=o.default[`sha3_${p}`],g=(n,c)=>c===1?y(n):g(y(n),c-1);this[d]=(n,c=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=g(h,c);return(0,u.encode)(`0x${S}`,l)}})}}return ae.Sha3Hasher=a,ae.default=new a,ae}var ce={},Te={},Pt;function bt(){if(Pt)return Te;Pt=1;var e=Te&&Te.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Te,"__esModule",{value:!0});const o=e(dr());return Te.default=o.default.create("genKeyPair","getPublicKey","sign","verify"),Te}var $t;function pn(){if($t)return ce;$t=1;var e=ce&&ce.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(ce,"__esModule",{value:!0}),ce.Ed25519Signer=void 0;const o=e(hr()),i=e(ve()),u=se(),a=e(bt()),s=we(),p=o.default.sign;class d extends a.default{constructor(){super()}genKeyPair(g="hex",n){const c=n?(0,u.toUint8Array)(n):new Uint8Array((0,i.default)(32));if(c.byteLength!==32)throw new Error("Invalid seed to generate key pair");const l=p.keyPair.fromSeed(c);return l.publicKey=(0,s.encode)(l.publicKey,g),l.secretKey=(0,s.encode)(l.secretKey,g),l}getPublicKey(g,n="hex"){const c=(0,u.toUint8Array)(g),l=p.keyPair.fromSecretKey(c).publicKey;return(0,s.encode)(l,n)}sign(g,n,c="hex"){const l=(0,u.toUint8Array)(n),h=(0,u.toUint8Array)(g),S=p.detached(h,l);return(0,s.encode)(S,c)}verify(g,n,c){const l=(0,u.toUint8Array)(c),h=(0,u.toUint8Array)(g),S=(0,u.toUint8Array)(n);return p.detached.verify(h,S,l)}}return ce.Ed25519Signer=d,ce.default=new d,ce}var le={},ue={},Rt;function vr(){if(Rt)return ue;Rt=1;var e=ue&&ue.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(ue,"__esModule",{value:!0}),ue.Secp256k1Signer=void 0;const o=e(pr()),i=se(),u=e(ve()),a=e(bt()),s=we(),p=o.default.ec,d=new p("secp256k1");class y extends a.default{constructor(){super(),this.pkHasFormatPrefix=!0,this.pkCompressed=!1}isValidSK(n){if(n.byteLength!==32)return!1;const c=new i.BN(n);return c.cmp(d.curve.n)<0&&!c.isZero()}genKeyPair(n="hex"){let c=null;do c=new Uint8Array((0,u.default)(32));while(!this.isValidSK(c));const l=this.getPublicKey((0,i.toHex)(c));return{secretKey:(0,s.encode)(c,n),publicKey:(0,s.encode)(l,n)}}getPublicKey(n,c="hex"){if(!this.isValidSK((0,i.toUint8Array)(n)))throw new Error("Invalid secret key");let l=d.keyFromPrivate((0,i.toBuffer)(n)).getPublic(this.pkCompressed,"hex");return this.pkHasFormatPrefix===!1&&(l=l.slice(2)),(0,s.encode)(`0x${l}`,c)}sign(n,c,l="hex"){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=d.keyFromPrivate((0,i.toBuffer)(c)).sign((0,i.stripHexPrefix)(h),{canonical:!0}).toDER("hex");return(0,s.encode)(`0x${S}`,l)}verify(n,c,l){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}let S=(0,i.toBuffer)(l);return this.pkHasFormatPrefix===!1&&S[0]!==4&&S.byteLength===64&&(S=C.concat([C.from([4]),S])),d.keyFromPublic(S).verify((0,i.stripHexPrefix)(h),(0,i.stripHexPrefix)((0,i.toHex)(c)))}}return ue.Secp256k1Signer=y,ue.default=new y,ue}var kt;function yn(){if(kt)return le;kt=1;var e=le&&le.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(le,"__esModule",{value:!0}),le.EthereumSigner=void 0;const o=e(yr()),i=e(mr()),u=se(),a=vr();class s extends a.Secp256k1Signer{constructor(){super(),this.pkHasFormatPrefix=!1}ethHash(d){const y=(0,u.isHexStrict)(d)?d:(0,u.utf8ToHex)(d),g=(0,u.hexToBytes)(y),n=C.from(g),c=`Ethereum Signed Message:
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-cZALvweI.js","assets/index-DgDvwRqt.js","assets/vendor-mui-core-C_NjJRjl.js","assets/vendor-react-Dvs43sk9.js","assets/vendor-ux-JmtAaYLa.js","assets/vendor-utils-Gk-1qvTR.js","assets/vendor-hooks-Bm2oaDgr.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-DbQi15Va.js","assets/index-DrVXX4fX.css","assets/index-BPy8_fa2.js","assets/index-DRYJ0xIl.js","assets/index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as I,a as Kr}from"./vendor-react-Dvs43sk9.js";import{r as tr,a as rr,b as nr,c as ir,d as ut,e as sr,f as or,g as ar,h as ft,i as cr,j as lr,k as ur,m as Ie,n as fr,o as dr,p as hr,q as ve,s as pr,t as yr,u as mr,v as gr,an as Ir,b9 as Lr,T as $e,H as Ke,_ as qr,$ as _r,a6 as Ne,ac as Mr,O as Fr}from"./vendor-ux-JmtAaYLa.js";import{j as r,Y as dt,bB as ht,I as pt,aj as yt,$ as mt,b1 as _e,T as X,ak as R,z as V,F as M,b7 as Wr,b5 as br,b6 as Sr,a5 as Er,a3 as gt,aX as xr,R as Tr,Q as je,a6 as _t,W as w,am as Vr,cf as Hr,cg as zr,ch as Yr}from"./vendor-mui-core-C_NjJRjl.js";import{B as Xr,o as Jr,l as Gr}from"./index-BROakthZ.js";import{u as Zr}from"./useAsyncRetry-b_Q7rsZ1.js";import{w as Br,B as C,o as Qr,b as en,C as Ht}from"./vendor-utils-Gk-1qvTR.js";import{r as tn}from"./hdkey-TGNLUqEt.js";import{Z as Re,c as ie,a8 as rn}from"./index-DgDvwRqt.js";import{u as ke}from"./team-Dd8yHElY.js";import{u as jr,C as z}from"./index.esm-JPZAjt0x.js";import{T as nn}from"./index-DPbI7VX_.js";import{E as sn}from"./empty-spinner-CBrinxF5.js";import{C as q}from"./click-to-copy-DBNEocQx.js";import{D as on}from"./delete-confirm-Dogr_ntZ.js";import{a as an}from"./passport-item-CF_y0rsT.js";import{A as cn}from"./actions-DiS46mya.js";import{T as Bt}from"./table-tips-C_tKxS1_.js";import{u as ln}from"./use-mobile-6sugw6dZ.js";import"./vendor-hooks-Bm2oaDgr.js";import"./lottie-web-4koyQiv_.js";import"./useAsync-CP1EfcG_.js";import"./vendor-arcblock-DbQi15Va.js";import"./session-CfoR5Wvh.js";import"./isURL-uDqs2WzZ.js";import"./use-app-logo-Czrt0i-p.js";import"./arrow-down.svg-KTkEGh4D.js";import"./vendor-mui-x-B2kLzf_6.js";import"./AdapterDayjs-DJz1a4Qx.js";import"./confirm-tusB0uUh.js";import"./index-DBs9Ljax.js";import"./did-address-DtRDDQBD.js";import"./util-Dr-F1wWu.js";import"./base32-d0IrDPx_.js";var Ae={},Ce={},Z={},re={},jt;function un(){if(jt)return re;jt=1;var e=re&&re.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(re,"__esModule",{value:!0}),re.BaseBN=re.BN=void 0;const o=e(Br());re.BaseBN=o.default;class i extends o.default{constructor(a,s,p){super(a===null?"0":a,s,p)}}return re.BN=i,re}var vt;function se(){return vt||(vt=1,function(e){var o=Z&&Z.__createBinding||(Object.create?function(t,f,m,U){U===void 0&&(U=m);var E=Object.getOwnPropertyDescriptor(f,m);(!E||("get"in E?!f.__esModule:E.writable||E.configurable))&&(E={enumerable:!0,get:function(){return f[m]}}),Object.defineProperty(t,U,E)}:function(t,f,m,U){U===void 0&&(U=m),t[U]=f[m]}),i=Z&&Z.__setModuleDefault||(Object.create?function(t,f){Object.defineProperty(t,"default",{enumerable:!0,value:f})}:function(t,f){t.default=f}),u=Z&&Z.__importStar||function(t){if(t&&t.__esModule)return t;var f={};if(t!=null)for(var m in t)m!=="default"&&Object.prototype.hasOwnProperty.call(t,m)&&o(f,t,m);return i(f,t),f},a=Z&&Z.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.fromTokenToUnit=e.fromUnitToToken=e.numberToString=e.toHex=e.hexToBytes=e.bytesToHex=e.numberToHex=e.hexToNumber=e.hexToUtf8=e.utf8ToHex=e.toBN=e.isHex=e.isHexStrict=e.isBigNumber=e.isBN=e.stripHexPrefix=e.isHexPrefixed=e.numberToBN=e.rightPad=e.leftPad=e.BN=e.isBase58btc=void 0,e.isUint8Array=be,e.UUID=Qe,e.isUUID=et,e.toUint8Array=Se,e.toBuffer=Oe,e.toBase58=tt,e.fromBase58=rt,e.toBase64=nt,e.fromBase64=it,e.toAddress=te,e.toDid=st,e.isSameDid=ot,e.formatTxType=at;const s=a(tr),p=a(rr),d=a(nr),y=a(ir),g=a(ut),n=a(sr),c=a(or),l=a(ar);e.rightPad=l.default;const h=a(ft);e.leftPad=h.default;const S=a(cr()),_=a(lr()),H=u(ur()),x=un();Object.defineProperty(e,"BN",{enumerable:!0,get:function(){return x.BN}});const k="did:abt:",B=new x.BN(0),T=new x.BN(-1),j={encode:t=>`z${S.default.encode(t)}`,decode:t=>S.default.decode(t.slice(1))},O=t=>{if(typeof t!="string")return!1;if(t[0]==="z")try{return j.decode(t),!0}catch{return!1}return!1};e.isBase58btc=O;const b=t=>{if(typeof t=="string"||typeof t=="number"){let f=new x.BN(1);const m=String(t).toLowerCase().trim(),U=m.substr(0,2)==="0x"||m.substr(0,3)==="-0x";let E=(0,e.stripHexPrefix)(m);if(E.substr(0,1)==="-"&&(E=(0,e.stripHexPrefix)(E.slice(1)),f=new x.BN(-1,10)),E=E===""?"0":E,!E.match(/^-?[0-9]+$/)&&E.match(/^[0-9A-Fa-f]+$/)||E.match(/^[a-fA-F]+$/)||U===!0&&E.match(/^[0-9A-Fa-f]+$/))return new x.BN(E,16).mul(f);if((E.match(/^-?[0-9]+$/)||E==="")&&U===!1)return new x.BN(E,10).mul(f)}if((0,e.isBN)(t))return new x.BN(t.toString(10),10);throw new Error(`[number-to-bn] while converting number ${JSON.stringify(t)} to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.`)};e.numberToBN=b;const v=t=>{if(typeof t!="string")throw new Error("[is-hex-prefixed] value must be type string");return t.slice(0,2).toLowerCase()==="0x"};e.isHexPrefixed=v;const P=t=>typeof t=="string"&&(0,e.isHexPrefixed)(t)?t.slice(2):t;e.stripHexPrefix=P;const A=t=>t instanceof x.BN||t instanceof x.BaseBN||t&&t.constructor&&t.constructor.name==="BN";e.isBN=A;const K=t=>t&&t.constructor&&t.constructor.name==="BigNumber";e.isBigNumber=K;const ee=t=>((0,p.default)(t)||(0,d.default)(t))&&/^(-)?0x[0-9a-f]*$/i.test(t);e.isHexStrict=ee;const Le=t=>((0,p.default)(t)||(0,d.default)(t))&&/^(-0x|0x|0X|-0X)?[0-9a-f]*$/i.test(t);e.isHex=Le;const qe=(t,f=10)=>{try{if(typeof t=="number"&&t>0){const m=Number(t).toLocaleString("fullwide",{useGrouping:!1});return new x.BN(m,f)}return(0,e.numberToBN)(t)}catch(m){throw new Error(`${m} Given value: "${t}"`)}};e.toBN=qe;const Me=t=>{t=H.encode(t);let f="";t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join("");for(let m=0;m<t.length;m++){const E=t.charCodeAt(m).toString(16);f+=E.length<2?`0${E}`:E}return`0x${f}`};e.utf8ToHex=Me;const Fe=t=>{if(!(0,e.isHexStrict)(t))throw new Error(`The parameter "${t}" must be a valid HEX string.`);let f="",m=0;t=t.replace(/^0x/i,""),t=t.replace(/^(?:00)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:00)*/,""),t=t.split("").reverse().join("");const U=t.length;for(let E=0;E<U;E+=2)m=parseInt(t.substr(E,2),16),f+=String.fromCharCode(m);return H.decode(f)};e.hexToUtf8=Fe;const We=t=>t?(0,e.toBN)(t).toNumber():0;e.hexToNumber=We;const Ve=t=>{if((0,c.default)(t)||typeof t>"u")return t;if(!isFinite(t)&&!(0,e.isHex)(t))throw new Error(`Given input "${t}" is not a number.`);const f=(0,e.toBN)(t),m=f.toString(16);return f.lt(new x.BN(0))?`-0x${m.substr(1)}`:`0x${m}`};e.numberToHex=Ve;const ze=t=>{const f=[];for(let m=0;m<t.length;m++)f.push((t[m]>>>4).toString(16)),f.push((t[m]&15).toString(16));return`0x${f.join("")}`};e.bytesToHex=ze;const Ye=t=>{if(t=t.toString(16),!(0,e.isHex)(t))throw new Error(`Given value "${t}" is not a valid hex string.`);t=t.replace(/^0x/i,""),t=t.length%2?`0${t}`:t;const f=[];for(let m=0;m<t.length;m+=2)f.push(parseInt(t.substr(m,2),16));return f};e.hexToBytes=Ye;const Xe=(t,f=!1)=>be(t)||C.isBuffer(t)?f?"bytes":(0,e.bytesToHex)(t):(0,e.isBase58btc)(t)?f?"bytes":(0,e.bytesToHex)(j.decode(t)):(0,s.default)(t)?f?"bool":t?"0x01":"0x00":(0,y.default)(t)&&!(0,e.isBigNumber)(t)&&!(0,e.isBN)(t)?f?"string":(0,e.utf8ToHex)(JSON.stringify(t)):typeof t=="string"?t.indexOf("-0x")===0||t.indexOf("-0X")===0?f?"int256":(0,e.numberToHex)(t):t.indexOf("0x")===0||t.indexOf("0X")===0?f?"bytes":t:f?"string":(0,e.utf8ToHex)(t):f?+t<0?"int256":"uint256":(0,e.numberToHex)(t);e.toHex=Xe;const Je=t=>{if(typeof t=="string"){if(!t.match(/^-?[0-9.]+$/))throw new Error(`Invalid value '${t}' while converting to string, should be a number matching (^-?[0-9.]+).`);return t}if(typeof t=="number")return Number.isInteger(t)&&t>0?Number(t).toLocaleString("fullwide",{useGrouping:!1}):String(t);if(typeof t=="object"&&t.toString&&(t.toTwos||t.dividedToIntegerBy))return t.toPrecision?String(t.toPrecision()):t.toString(10);throw new Error(`while converting number to string, invalid number value '${t}' type ${typeof t}.`)};e.numberToString=Je;const Ge=(t,f=18,m={})=>{let U=(0,e.toBN)(t);const E=U.lt(B),F=(0,e.toBN)(`1${"0".repeat(f)}`,10),G=F.toString(10).length-1||1,N=m||{};E&&(U=U.mul(T));let $=U.mod(F).toString(10);for(;$.length<G;)$=`0${$}`;N.pad||($=$.match(/^([0-9]*[1-9]|0)(0*)/)[1]);let L=U.div(F).toString(10);N.commify&&(L=L.replace(/\B(?=(\d{3})+(?!\d))/g,","));let Ee=`${L}${$==="0"?"":`.${$}`}`;return E&&(Ee=`-${Ee}`),Ee};e.fromUnitToToken=Ge;const Ze=(t,f=18)=>{let m=(0,e.numberToString)(t);const U=(0,e.toBN)(`1${"0".repeat(f)}`,10),E=U.toString(10).length-1||1,F=m.substring(0,1)==="-";if(F&&(m=m.substring(1)),m===".")throw new Error(`error converting token ${t} to unit, invalid value`);const G=m.split(".");if(G.length>2)throw new Error(`error converting token ${t} to unit, too many decimal points`);let N=G[0],$=G[1];if(N||(N="0"),$||($="0"),$.length>E)throw new Error(`error converting token ${t} to unit, too many decimal places`);for(;$.length<E;)$+="0";N=new x.BN(N),$=new x.BN($);let L=N.mul(U).add($);return F&&(L=L.mul(T)),new x.BN(L.toString(10),10)};e.fromTokenToUnit=Ze;function be(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Qe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const f=Math.random()*16|0;return(t==="x"?f:f&3|8).toString(16)})}function et(t){return/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(t)}function Se(t){let f=null;if([null,void 0,""].includes(t))f=new Uint8Array;else if(C.isBuffer(t))f=new Uint8Array(t);else if((0,e.isHexStrict)(t))f=new Uint8Array((0,e.hexToBytes)(t));else if(be(t))f=new Uint8Array(t);else if((0,e.isBase58btc)(t))f=new Uint8Array(j.decode(t));else if(typeof t=="string")f=new Uint8Array((0,e.hexToBytes)((0,e.toHex)(t)));else throw new Error(`Unsupported input type ${typeof t} detected for toBuffer, only Uint8Array/Buffer/Hex/Base58 are supported`);return f}function Oe(t){return C.from(Se(t))}function tt(t){const f=j.encode(Se(t));return C.from(f).toString("utf-8")}function rt(t){if((0,e.isBase58btc)(t)===!1)throw new Error("fromBase58 expect strict base58 encoded string as input");return C.from(j.decode(t))}function nt(t,f=!0){const m=_.default.encode(Oe(t));return f?_.default.escape(m):m}function it(t){if(typeof t!="string")throw new Error("fromBase64 requires input to be a string");return C.from(_.default.unescape(t),"base64")}function te(t){return t.replace(k,"")}function st(t){return`${k}${te(t)}`}function ot(t,f){return te(t).toLowerCase()===te(f).toLowerCase()}function at(t){return(0,g.default)((0,n.default)(t))}}(Z)),Z}var wt;function we(){if(wt)return Ce;wt=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.encode=o;const e=se();function o(i,u="hex"){return["hex","base16"].includes(u)?(0,e.toHex)(i):u==="base58"?(0,e.toBase58)(i):u==="base64"?(0,e.toBase64)(i):u==="Uint8Array"?(0,e.toUint8Array)(i):u==="buffer"?(0,e.toBuffer)(i):i}return Ce}var oe={},Ut;function fn(){if(Ut)return oe;Ut=1;var e=oe&&oe.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(oe,"__esModule",{value:!0}),oe.KeccakHasher=void 0;const o=e(Ie()),i=se(),u=we();class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=n=>o.default[`keccak${p}`](n),g=(n,c)=>c===1?y(n):g(y(n),c-1);this[d]=(n,c=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=g(h,c);return(0,u.encode)(`0x${S}`,l)}})}}return oe.KeccakHasher=a,oe.default=new a,oe}var xe={},Ot;function dn(){if(Ot)return xe;Ot=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.Sha2Hasher=void 0;const e=se(),o=fr(),i=we(),u={sha224:o.sha224,sha256:o.sha256,sha384:o.sha384,sha512:o.sha512};class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=u[`sha${p}`],g=(n,c)=>{let l=n;try{l=(0,e.toUint8Array)(n)}catch{}return c===1?`0x${y().update(l).digest("hex")}`:g(g(l,1),c-1)};this[d]=(n,c=2,l="hex")=>{const h=g(n,c);return(0,i.encode)(h,l)}})}}return xe.Sha2Hasher=a,xe.default=new a,xe}var ae={},At;function hn(){if(At)return ae;At=1;var e=ae&&ae.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ae,"__esModule",{value:!0}),ae.Sha3Hasher=void 0;const o=e(Ie()),i=se(),u=we();class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=o.default[`sha3_${p}`],g=(n,c)=>c===1?y(n):g(y(n),c-1);this[d]=(n,c=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=g(h,c);return(0,u.encode)(`0x${S}`,l)}})}}return ae.Sha3Hasher=a,ae.default=new a,ae}var ce={},Te={},Pt;function bt(){if(Pt)return Te;Pt=1;var e=Te&&Te.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Te,"__esModule",{value:!0});const o=e(dr());return Te.default=o.default.create("genKeyPair","getPublicKey","sign","verify"),Te}var $t;function pn(){if($t)return ce;$t=1;var e=ce&&ce.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(ce,"__esModule",{value:!0}),ce.Ed25519Signer=void 0;const o=e(hr()),i=e(ve()),u=se(),a=e(bt()),s=we(),p=o.default.sign;class d extends a.default{constructor(){super()}genKeyPair(g="hex",n){const c=n?(0,u.toUint8Array)(n):new Uint8Array((0,i.default)(32));if(c.byteLength!==32)throw new Error("Invalid seed to generate key pair");const l=p.keyPair.fromSeed(c);return l.publicKey=(0,s.encode)(l.publicKey,g),l.secretKey=(0,s.encode)(l.secretKey,g),l}getPublicKey(g,n="hex"){const c=(0,u.toUint8Array)(g),l=p.keyPair.fromSecretKey(c).publicKey;return(0,s.encode)(l,n)}sign(g,n,c="hex"){const l=(0,u.toUint8Array)(n),h=(0,u.toUint8Array)(g),S=p.detached(h,l);return(0,s.encode)(S,c)}verify(g,n,c){const l=(0,u.toUint8Array)(c),h=(0,u.toUint8Array)(g),S=(0,u.toUint8Array)(n);return p.detached.verify(h,S,l)}}return ce.Ed25519Signer=d,ce.default=new d,ce}var le={},ue={},Rt;function vr(){if(Rt)return ue;Rt=1;var e=ue&&ue.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(ue,"__esModule",{value:!0}),ue.Secp256k1Signer=void 0;const o=e(pr()),i=se(),u=e(ve()),a=e(bt()),s=we(),p=o.default.ec,d=new p("secp256k1");class y extends a.default{constructor(){super(),this.pkHasFormatPrefix=!0,this.pkCompressed=!1}isValidSK(n){if(n.byteLength!==32)return!1;const c=new i.BN(n);return c.cmp(d.curve.n)<0&&!c.isZero()}genKeyPair(n="hex"){let c=null;do c=new Uint8Array((0,u.default)(32));while(!this.isValidSK(c));const l=this.getPublicKey((0,i.toHex)(c));return{secretKey:(0,s.encode)(c,n),publicKey:(0,s.encode)(l,n)}}getPublicKey(n,c="hex"){if(!this.isValidSK((0,i.toUint8Array)(n)))throw new Error("Invalid secret key");let l=d.keyFromPrivate((0,i.toBuffer)(n)).getPublic(this.pkCompressed,"hex");return this.pkHasFormatPrefix===!1&&(l=l.slice(2)),(0,s.encode)(`0x${l}`,c)}sign(n,c,l="hex"){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=d.keyFromPrivate((0,i.toBuffer)(c)).sign((0,i.stripHexPrefix)(h),{canonical:!0}).toDER("hex");return(0,s.encode)(`0x${S}`,l)}verify(n,c,l){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}let S=(0,i.toBuffer)(l);return this.pkHasFormatPrefix===!1&&S[0]!==4&&S.byteLength===64&&(S=C.concat([C.from([4]),S])),d.keyFromPublic(S).verify((0,i.stripHexPrefix)(h),(0,i.stripHexPrefix)((0,i.toHex)(c)))}}return ue.Secp256k1Signer=y,ue.default=new y,ue}var kt;function yn(){if(kt)return le;kt=1;var e=le&&le.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(le,"__esModule",{value:!0}),le.EthereumSigner=void 0;const o=e(yr()),i=e(mr()),u=se(),a=vr();class s extends a.Secp256k1Signer{constructor(){super(),this.pkHasFormatPrefix=!1}ethHash(d){const y=(0,u.isHexStrict)(d)?d:(0,u.utf8ToHex)(d),g=(0,u.hexToBytes)(y),n=C.from(g),c=`Ethereum Signed Message:
|
|
3
3
|
${g.length}`,l=C.from(c),h=C.concat([l,n]);return i.default.keccak256s(h)}ethSign(d,y){return o.default.sign(d,y)}ethRecover(d,y){return o.default.recover(d,y)}}return le.EthereumSigner=s,le.default=new s,le}var fe={},Ct;function mn(){if(Ct)return fe;Ct=1;var e=fe&&fe.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(fe,"__esModule",{value:!0}),fe.PasskeySigner=void 0;const o=se(),i=gr(),u=e(bt());class a extends u.default{constructor(){super()}genKeyPair(p="hex",d){throw new Error("Not supported")}getPublicKey(p,d="hex"){throw new Error("Not supported")}sign(p,d,y="hex"){throw new Error("Not supported")}async verify(p,d,y,g){const n=JSON.parse(g);if(!n.authenticatorData||!n.clientDataJSON)throw new Error("extra.authenticatorData or extra.clientDataJSON is required for passkey signature verification");const c=(0,o.toBuffer)((0,o.fromBase64)(n.authenticatorData)),l=await(0,i.toHash)(i.isoBase64URL.toBuffer(n.clientDataJSON));if((0,i.decodeClientDataJSON)(n.clientDataJSON).challenge!==(0,o.toBase64)(p))throw new Error("challenge mismatch for passkey signature");return(0,i.verifySignature)({signature:i.isoBase64URL.toBuffer(typeof d=="string"?d:(0,o.toBase64)(d)),data:i.isoUint8Array.concat([c,l]),credentialPublicKey:y})}}return fe.PasskeySigner=a,fe.default=new a,fe}var Dt;function gn(){return Dt||(Dt=1,function(e){var o=Ae&&Ae.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(e,"__esModule",{value:!0}),e.toTxHash=e.Hashers=e.Signers=e.types=e.Hasher=e.Signer=void 0,e.getSigner=c,e.getHasher=l,e.getRandomBytes=h;const i=o(ve()),u=we(),a=o(fn()),s=o(dn()),p=o(hn()),d=o(pn()),y=o(yn()),g=o(vr()),n=o(mn());e.Signer={Ed25519:d.default,Secp256k1:g.default,Ethereum:y.default,Passkey:n.default},e.Hasher={SHA2:s.default,SHA3:p.default,Keccak:a.default},e.types={KeyType:{ED25519:0,SECP256K1:1,ETHEREUM:2,PASSKEY:3},HashType:{KECCAK:0,SHA3:1,KECCAK_384:2,SHA3_384:3,KECCAK_512:4,SHA3_512:5,SHA2:6},RoleType:{ROLE_ACCOUNT:0,ROLE_NODE:1,ROLE_DEVICE:2,ROLE_APPLICATION:3,ROLE_SMART_CONTRACT:4,ROLE_BOT:5,ROLE_ASSET:6,ROLE_STAKE:7,ROLE_VALIDATOR:8,ROLE_GROUP:9,ROLE_TX:10,ROLE_TETHER:11,ROLE_SWAP:12,ROLE_DELEGATION:13,ROLE_VC:14,ROLE_BLOCKLET:15,ROLE_STORE:16,ROLE_TOKEN:17,ROLE_FACTORY:18,ROLE_ROLLUP:19,ROLE_STORAGE:20,ROLE_PROFILE:21,ROLE_PASSKEY:22,ROLE_TOKEN_FACTORY:23,ROLE_ANY:63},EncodingType:{BASE16:0,BASE58:1}};function c(_){if(typeof e.Signers[_]>"u")throw new Error(`Unsupported signer type: ${_}`);return e.Signers[_]}function l(_){if(typeof e.Hashers[_]>"u")throw new Error(`Unsupported hash type: ${_}`);return e.Hashers[_]}function h(_=32,H="hex"){return(0,u.encode)((0,i.default)(_),H)}e.Signers=Object.freeze({[e.types.KeyType.ED25519]:e.Signer.Ed25519,[e.types.KeyType.SECP256K1]:e.Signer.Secp256k1,[e.types.KeyType.ETHEREUM]:e.Signer.Ethereum,[e.types.KeyType.PASSKEY]:e.Signer.Passkey}),e.Hashers=Object.freeze({[e.types.HashType.KECCAK]:e.Hasher.Keccak.hash256,[e.types.HashType.KECCAK_384]:e.Hasher.Keccak.hash384,[e.types.HashType.KECCAK_512]:e.Hasher.Keccak.hash512,[e.types.HashType.SHA3]:e.Hasher.SHA3.hash256,[e.types.HashType.SHA3_384]:e.Hasher.SHA3.hash384,[e.types.HashType.SHA3_512]:e.Hasher.SHA3.hash512,[e.types.HashType.SHA2]:e.Hasher.SHA2.hash256});const S=_=>e.Hasher.SHA2.hash256(_,1,"hex").replace(/^0x/,"").toUpperCase();e.toTxHash=S}(Ae)),Ae}var Y={},Q={},ne={},Nt;function _n(){if(Nt)return ne;Nt=1;var e=ne&&ne.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(ne,"__esModule",{value:!0}),ne.BaseBN=ne.BN=void 0;const o=e(Br());ne.BaseBN=o.default;class i extends o.default{constructor(a,s,p){super(a===null?"0":a,s,p)}}return ne.BN=i,ne}var Kt;function J(){return Kt||(Kt=1,function(e){var o=Q&&Q.__createBinding||(Object.create?function(t,f,m,U){U===void 0&&(U=m);var E=Object.getOwnPropertyDescriptor(f,m);(!E||("get"in E?!f.__esModule:E.writable||E.configurable))&&(E={enumerable:!0,get:function(){return f[m]}}),Object.defineProperty(t,U,E)}:function(t,f,m,U){U===void 0&&(U=m),t[U]=f[m]}),i=Q&&Q.__setModuleDefault||(Object.create?function(t,f){Object.defineProperty(t,"default",{enumerable:!0,value:f})}:function(t,f){t.default=f}),u=Q&&Q.__importStar||function(t){if(t&&t.__esModule)return t;var f={};if(t!=null)for(var m in t)m!=="default"&&Object.prototype.hasOwnProperty.call(t,m)&&o(f,t,m);return i(f,t),f},a=Q&&Q.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.fromTokenToUnit=e.fromUnitToToken=e.numberToString=e.toHex=e.hexToBytes=e.bytesToHex=e.numberToHex=e.hexToNumber=e.hexToUtf8=e.utf8ToHex=e.toBN=e.isHex=e.isHexStrict=e.isBigNumber=e.isBN=e.stripHexPrefix=e.isHexPrefixed=e.numberToBN=e.rightPad=e.leftPad=e.BN=e.isBase58btc=void 0,e.isUint8Array=be,e.UUID=Qe,e.isUUID=et,e.toUint8Array=Se,e.toBuffer=Oe,e.toBase58=tt,e.fromBase58=rt,e.toBase64=nt,e.fromBase64=it,e.toAddress=te,e.toDid=st,e.isSameDid=ot,e.formatTxType=at;const s=a(tr),p=a(rr),d=a(nr),y=a(ir),g=a(ut),n=a(sr),c=a(or),l=a(ar);e.rightPad=l.default;const h=a(ft);e.leftPad=h.default;const S=a(cr()),_=a(lr()),H=u(ur()),x=_n();Object.defineProperty(e,"BN",{enumerable:!0,get:function(){return x.BN}});const k="did:abt:",B=new x.BN(0),T=new x.BN(-1),j={encode:t=>`z${S.default.encode(t)}`,decode:t=>S.default.decode(t.slice(1))},O=t=>{if(typeof t!="string")return!1;if(t[0]==="z")try{return j.decode(t),!0}catch{return!1}return!1};e.isBase58btc=O;const b=t=>{if(typeof t=="string"||typeof t=="number"){let f=new x.BN(1);const m=String(t).toLowerCase().trim(),U=m.substr(0,2)==="0x"||m.substr(0,3)==="-0x";let E=(0,e.stripHexPrefix)(m);if(E.substr(0,1)==="-"&&(E=(0,e.stripHexPrefix)(E.slice(1)),f=new x.BN(-1,10)),E=E===""?"0":E,!E.match(/^-?[0-9]+$/)&&E.match(/^[0-9A-Fa-f]+$/)||E.match(/^[a-fA-F]+$/)||U===!0&&E.match(/^[0-9A-Fa-f]+$/))return new x.BN(E,16).mul(f);if((E.match(/^-?[0-9]+$/)||E==="")&&U===!1)return new x.BN(E,10).mul(f)}if((0,e.isBN)(t))return new x.BN(t.toString(10),10);throw new Error(`[number-to-bn] while converting number ${JSON.stringify(t)} to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.`)};e.numberToBN=b;const v=t=>{if(typeof t!="string")throw new Error("[is-hex-prefixed] value must be type string");return t.slice(0,2).toLowerCase()==="0x"};e.isHexPrefixed=v;const P=t=>typeof t=="string"&&(0,e.isHexPrefixed)(t)?t.slice(2):t;e.stripHexPrefix=P;const A=t=>t instanceof x.BN||t instanceof x.BaseBN||t&&t.constructor&&t.constructor.name==="BN";e.isBN=A;const K=t=>t&&t.constructor&&t.constructor.name==="BigNumber";e.isBigNumber=K;const ee=t=>((0,p.default)(t)||(0,d.default)(t))&&/^(-)?0x[0-9a-f]*$/i.test(t);e.isHexStrict=ee;const Le=t=>((0,p.default)(t)||(0,d.default)(t))&&/^(-0x|0x|0X|-0X)?[0-9a-f]*$/i.test(t);e.isHex=Le;const qe=(t,f=10)=>{try{if(typeof t=="number"&&t>0){const m=Number(t).toLocaleString("fullwide",{useGrouping:!1});return new x.BN(m,f)}return(0,e.numberToBN)(t)}catch(m){throw new Error(`${m} Given value: "${t}"`)}};e.toBN=qe;const Me=t=>{t=H.encode(t);let f="";t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join("");for(let m=0;m<t.length;m++){const E=t.charCodeAt(m).toString(16);f+=E.length<2?`0${E}`:E}return`0x${f}`};e.utf8ToHex=Me;const Fe=t=>{if(!(0,e.isHexStrict)(t))throw new Error(`The parameter "${t}" must be a valid HEX string.`);let f="",m=0;t=t.replace(/^0x/i,""),t=t.replace(/^(?:00)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:00)*/,""),t=t.split("").reverse().join("");const U=t.length;for(let E=0;E<U;E+=2)m=parseInt(t.substr(E,2),16),f+=String.fromCharCode(m);return H.decode(f)};e.hexToUtf8=Fe;const We=t=>t?(0,e.toBN)(t).toNumber():0;e.hexToNumber=We;const Ve=t=>{if((0,c.default)(t)||typeof t>"u")return t;if(!isFinite(t)&&!(0,e.isHex)(t))throw new Error(`Given input "${t}" is not a number.`);const f=(0,e.toBN)(t),m=f.toString(16);return f.lt(new x.BN(0))?`-0x${m.substr(1)}`:`0x${m}`};e.numberToHex=Ve;const ze=t=>{const f=[];for(let m=0;m<t.length;m++)f.push((t[m]>>>4).toString(16)),f.push((t[m]&15).toString(16));return`0x${f.join("")}`};e.bytesToHex=ze;const Ye=t=>{if(t=t.toString(16),!(0,e.isHex)(t))throw new Error(`Given value "${t}" is not a valid hex string.`);t=t.replace(/^0x/i,""),t=t.length%2?`0${t}`:t;const f=[];for(let m=0;m<t.length;m+=2)f.push(parseInt(t.substr(m,2),16));return f};e.hexToBytes=Ye;const Xe=(t,f=!1)=>be(t)||C.isBuffer(t)?f?"bytes":(0,e.bytesToHex)(t):(0,e.isBase58btc)(t)?f?"bytes":(0,e.bytesToHex)(j.decode(t)):(0,s.default)(t)?f?"bool":t?"0x01":"0x00":(0,y.default)(t)&&!(0,e.isBigNumber)(t)&&!(0,e.isBN)(t)?f?"string":(0,e.utf8ToHex)(JSON.stringify(t)):typeof t=="string"?t.indexOf("-0x")===0||t.indexOf("-0X")===0?f?"int256":(0,e.numberToHex)(t):t.indexOf("0x")===0||t.indexOf("0X")===0?f?"bytes":t:f?"string":(0,e.utf8ToHex)(t):f?+t<0?"int256":"uint256":(0,e.numberToHex)(t);e.toHex=Xe;const Je=t=>{if(typeof t=="string"){if(!t.match(/^-?[0-9.]+$/))throw new Error(`Invalid value '${t}' while converting to string, should be a number matching (^-?[0-9.]+).`);return t}if(typeof t=="number")return Number.isInteger(t)&&t>0?Number(t).toLocaleString("fullwide",{useGrouping:!1}):String(t);if(typeof t=="object"&&t.toString&&(t.toTwos||t.dividedToIntegerBy))return t.toPrecision?String(t.toPrecision()):t.toString(10);throw new Error(`while converting number to string, invalid number value '${t}' type ${typeof t}.`)};e.numberToString=Je;const Ge=(t,f=18,m={})=>{let U=(0,e.toBN)(t);const E=U.lt(B),F=(0,e.toBN)(`1${"0".repeat(f)}`,10),G=F.toString(10).length-1||1,N=m||{};E&&(U=U.mul(T));let $=U.mod(F).toString(10);for(;$.length<G;)$=`0${$}`;N.pad||($=$.match(/^([0-9]*[1-9]|0)(0*)/)[1]);let L=U.div(F).toString(10);N.commify&&(L=L.replace(/\B(?=(\d{3})+(?!\d))/g,","));let Ee=`${L}${$==="0"?"":`.${$}`}`;return E&&(Ee=`-${Ee}`),Ee};e.fromUnitToToken=Ge;const Ze=(t,f=18)=>{let m=(0,e.numberToString)(t);const U=(0,e.toBN)(`1${"0".repeat(f)}`,10),E=U.toString(10).length-1||1,F=m.substring(0,1)==="-";if(F&&(m=m.substring(1)),m===".")throw new Error(`error converting token ${t} to unit, invalid value`);const G=m.split(".");if(G.length>2)throw new Error(`error converting token ${t} to unit, too many decimal points`);let N=G[0],$=G[1];if(N||(N="0"),$||($="0"),$.length>E)throw new Error(`error converting token ${t} to unit, too many decimal places`);for(;$.length<E;)$+="0";N=new x.BN(N),$=new x.BN($);let L=N.mul(U).add($);return F&&(L=L.mul(T)),new x.BN(L.toString(10),10)};e.fromTokenToUnit=Ze;function be(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Qe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const f=Math.random()*16|0;return(t==="x"?f:f&3|8).toString(16)})}function et(t){return/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(t)}function Se(t){let f=null;if([null,void 0,""].includes(t))f=new Uint8Array;else if(C.isBuffer(t))f=new Uint8Array(t);else if((0,e.isHexStrict)(t))f=new Uint8Array((0,e.hexToBytes)(t));else if(be(t))f=new Uint8Array(t);else if((0,e.isBase58btc)(t))f=new Uint8Array(j.decode(t));else if(typeof t=="string")f=new Uint8Array((0,e.hexToBytes)((0,e.toHex)(t)));else throw new Error(`Unsupported input type ${typeof t} detected for toBuffer, only Uint8Array/Buffer/Hex/Base58 are supported`);return f}function Oe(t){return C.from(Se(t))}function tt(t){const f=j.encode(Se(t));return C.from(f).toString("utf-8")}function rt(t){if((0,e.isBase58btc)(t)===!1)throw new Error("fromBase58 expect strict base58 encoded string as input");return C.from(j.decode(t))}function nt(t,f=!0){const m=_.default.encode(Oe(t));return f?_.default.escape(m):m}function it(t){if(typeof t!="string")throw new Error("fromBase64 requires input to be a string");return C.from(_.default.unescape(t),"base64")}function te(t){return t.replace(k,"")}function st(t){return`${k}${te(t)}`}function ot(t,f){return te(t).toLowerCase()===te(f).toLowerCase()}function at(t){return(0,g.default)((0,n.default)(t))}}(Q)),Q}var Pe={},De={},It;function Ue(){if(It)return De;It=1,Object.defineProperty(De,"__esModule",{value:!0}),De.encode=o;const e=J();function o(i,u="hex"){return["hex","base16"].includes(u)?(0,e.toHex)(i):u==="base58"?(0,e.toBase58)(i):u==="base64"?(0,e.toBase64)(i):u==="Uint8Array"?(0,e.toUint8Array)(i):u==="buffer"?(0,e.toBuffer)(i):i}return De}var de={},Lt;function bn(){if(Lt)return de;Lt=1;var e=de&&de.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(de,"__esModule",{value:!0}),de.KeccakHasher=void 0;const o=e(Ie()),i=J(),u=Ue();class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=n=>o.default[`keccak${p}`](n),g=(n,c)=>c===1?y(n):g(y(n),c-1);this[d]=(n,c=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=g(h,c);return(0,u.encode)(`0x${S}`,l)}})}}return de.KeccakHasher=a,de.default=new a,de}var He={},qt;function Sn(){if(qt)return He;qt=1,Object.defineProperty(He,"__esModule",{value:!0}),He.Sha2Hasher=void 0;const e=J(),o=fr(),i=Ue(),u={sha224:o.sha224,sha256:o.sha256,sha384:o.sha384,sha512:o.sha512};class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=u[`sha${p}`],g=(n,c)=>{let l=n;try{l=(0,e.toUint8Array)(n)}catch{}return c===1?`0x${y().update(l).digest("hex")}`:g(g(l,1),c-1)};this[d]=(n,c=2,l="hex")=>{const h=g(n,c);return(0,i.encode)(h,l)}})}}return He.Sha2Hasher=a,He.default=new a,He}var he={},Mt;function En(){if(Mt)return he;Mt=1;var e=he&&he.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(he,"__esModule",{value:!0}),he.Sha3Hasher=void 0;const o=e(Ie()),i=J(),u=Ue();class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=o.default[`sha3_${p}`],g=(n,c)=>c===1?y(n):g(y(n),c-1);this[d]=(n,c=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=g(h,c);return(0,u.encode)(`0x${S}`,l)}})}}return he.Sha3Hasher=a,he.default=new a,he}var pe={},Be={},Ft;function St(){if(Ft)return Be;Ft=1;var e=Be&&Be.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Be,"__esModule",{value:!0});const o=e(dr());return Be.default=o.default.create("genKeyPair","getPublicKey","sign","verify"),Be}var Wt;function xn(){if(Wt)return pe;Wt=1;var e=pe&&pe.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(pe,"__esModule",{value:!0}),pe.Ed25519Signer=void 0;const o=e(hr()),i=e(ve()),u=J(),a=e(St()),s=Ue(),p=o.default.sign;class d extends a.default{constructor(){super()}genKeyPair(g="hex",n){const c=n?(0,u.toUint8Array)(n):new Uint8Array((0,i.default)(32));if(c.byteLength!==32)throw new Error("Invalid seed to generate key pair");const l=p.keyPair.fromSeed(c);return l.publicKey=(0,s.encode)(l.publicKey,g),l.secretKey=(0,s.encode)(l.secretKey,g),l}getPublicKey(g,n="hex"){const c=(0,u.toUint8Array)(g),l=p.keyPair.fromSecretKey(c).publicKey;return(0,s.encode)(l,n)}sign(g,n,c="hex"){const l=(0,u.toUint8Array)(n),h=(0,u.toUint8Array)(g),S=p.detached(h,l);return(0,s.encode)(S,c)}verify(g,n,c){const l=(0,u.toUint8Array)(c),h=(0,u.toUint8Array)(g),S=(0,u.toUint8Array)(n);return p.detached.verify(h,S,l)}}return pe.Ed25519Signer=d,pe.default=new d,pe}var ye={},me={},Vt;function wr(){if(Vt)return me;Vt=1;var e=me&&me.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(me,"__esModule",{value:!0}),me.Secp256k1Signer=void 0;const o=e(pr()),i=J(),u=e(ve()),a=e(St()),s=Ue(),p=o.default.ec,d=new p("secp256k1");class y extends a.default{constructor(){super(),this.pkHasFormatPrefix=!0,this.pkCompressed=!1}isValidSK(n){if(n.byteLength!==32)return!1;const c=new i.BN(n);return c.cmp(d.curve.n)<0&&!c.isZero()}genKeyPair(n="hex"){let c=null;do c=new Uint8Array((0,u.default)(32));while(!this.isValidSK(c));const l=this.getPublicKey((0,i.toHex)(c));return{secretKey:(0,s.encode)(c,n),publicKey:(0,s.encode)(l,n)}}getPublicKey(n,c="hex"){if(!this.isValidSK((0,i.toUint8Array)(n)))throw new Error("Invalid secret key");let l=d.keyFromPrivate((0,i.toBuffer)(n)).getPublic(this.pkCompressed,"hex");return this.pkHasFormatPrefix===!1&&(l=l.slice(2)),(0,s.encode)(`0x${l}`,c)}sign(n,c,l="hex"){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=d.keyFromPrivate((0,i.toBuffer)(c)).sign((0,i.stripHexPrefix)(h),{canonical:!0}).toDER("hex");return(0,s.encode)(`0x${S}`,l)}verify(n,c,l){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}let S=(0,i.toBuffer)(l);return this.pkHasFormatPrefix===!1&&S[0]!==4&&S.byteLength===64&&(S=C.concat([C.from([4]),S])),d.keyFromPublic(S).verify((0,i.stripHexPrefix)(h),(0,i.stripHexPrefix)((0,i.toHex)(c)))}}return me.Secp256k1Signer=y,me.default=new y,me}var zt;function Tn(){if(zt)return ye;zt=1;var e=ye&&ye.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(ye,"__esModule",{value:!0}),ye.EthereumSigner=void 0;const o=e(yr()),i=e(mr()),u=J(),a=wr();class s extends a.Secp256k1Signer{constructor(){super(),this.pkHasFormatPrefix=!1}ethHash(d){const y=(0,u.isHexStrict)(d)?d:(0,u.utf8ToHex)(d),g=(0,u.hexToBytes)(y),n=C.from(g),c=`Ethereum Signed Message:
|
|
4
|
-
${g.length}`,l=C.from(c),h=C.concat([l,n]);return i.default.keccak256s(h)}ethSign(d,y){return o.default.sign(d,y)}ethRecover(d,y){return o.default.recover(d,y)}}return ye.EthereumSigner=s,ye.default=new s,ye}var ge={},Yt;function Hn(){if(Yt)return ge;Yt=1;var e=ge&&ge.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ge,"__esModule",{value:!0}),ge.PasskeySigner=void 0;const o=J(),i=gr(),u=e(St());class a extends u.default{constructor(){super()}genKeyPair(p="hex",d){throw new Error("Not supported")}getPublicKey(p,d="hex"){throw new Error("Not supported")}sign(p,d,y="hex"){throw new Error("Not supported")}async verify(p,d,y,g){const n=JSON.parse(g);if(!n.authenticatorData||!n.clientDataJSON)throw new Error("extra.authenticatorData or extra.clientDataJSON is required for passkey signature verification");const c=(0,o.toBuffer)((0,o.fromBase64)(n.authenticatorData)),l=await(0,i.toHash)(i.isoBase64URL.toBuffer(n.clientDataJSON));if((0,i.decodeClientDataJSON)(n.clientDataJSON).challenge!==(0,o.toBase64)(p))throw new Error("challenge mismatch for passkey signature");return(0,i.verifySignature)({signature:i.isoBase64URL.toBuffer(typeof d=="string"?d:(0,o.toBase64)(d)),data:i.isoUint8Array.concat([c,l]),credentialPublicKey:y})}}return ge.PasskeySigner=a,ge.default=new a,ge}var Xt;function Et(){return Xt||(Xt=1,function(e){var o=Pe&&Pe.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(e,"__esModule",{value:!0}),e.toTxHash=e.Hashers=e.Signers=e.types=e.Hasher=e.Signer=void 0,e.getSigner=c,e.getHasher=l,e.getRandomBytes=h;const i=o(ve()),u=Ue(),a=o(bn()),s=o(Sn()),p=o(En()),d=o(xn()),y=o(Tn()),g=o(wr()),n=o(Hn());e.Signer={Ed25519:d.default,Secp256k1:g.default,Ethereum:y.default,Passkey:n.default},e.Hasher={SHA2:s.default,SHA3:p.default,Keccak:a.default},e.types={KeyType:{ED25519:0,SECP256K1:1,ETHEREUM:2,PASSKEY:3},HashType:{KECCAK:0,SHA3:1,KECCAK_384:2,SHA3_384:3,KECCAK_512:4,SHA3_512:5,SHA2:6},RoleType:{ROLE_ACCOUNT:0,ROLE_NODE:1,ROLE_DEVICE:2,ROLE_APPLICATION:3,ROLE_SMART_CONTRACT:4,ROLE_BOT:5,ROLE_ASSET:6,ROLE_STAKE:7,ROLE_VALIDATOR:8,ROLE_GROUP:9,ROLE_TX:10,ROLE_TETHER:11,ROLE_SWAP:12,ROLE_DELEGATION:13,ROLE_VC:14,ROLE_BLOCKLET:15,ROLE_STORE:16,ROLE_TOKEN:17,ROLE_FACTORY:18,ROLE_ROLLUP:19,ROLE_STORAGE:20,ROLE_PROFILE:21,ROLE_PASSKEY:22,ROLE_TOKEN_FACTORY:23,ROLE_ANY:63},EncodingType:{BASE16:0,BASE58:1}};function c(_){if(typeof e.Signers[_]>"u")throw new Error(`Unsupported signer type: ${_}`);return e.Signers[_]}function l(_){if(typeof e.Hashers[_]>"u")throw new Error(`Unsupported hash type: ${_}`);return e.Hashers[_]}function h(_=32,H="hex"){return(0,u.encode)((0,i.default)(_),H)}e.Signers=Object.freeze({[e.types.KeyType.ED25519]:e.Signer.Ed25519,[e.types.KeyType.SECP256K1]:e.Signer.Secp256k1,[e.types.KeyType.ETHEREUM]:e.Signer.Ethereum,[e.types.KeyType.PASSKEY]:e.Signer.Passkey}),e.Hashers=Object.freeze({[e.types.HashType.KECCAK]:e.Hasher.Keccak.hash256,[e.types.HashType.KECCAK_384]:e.Hasher.Keccak.hash384,[e.types.HashType.KECCAK_512]:e.Hasher.Keccak.hash512,[e.types.HashType.SHA3]:e.Hasher.SHA3.hash256,[e.types.HashType.SHA3_384]:e.Hasher.SHA3.hash384,[e.types.HashType.SHA3_512]:e.Hasher.SHA3.hash512,[e.types.HashType.SHA2]:e.Hasher.SHA2.hash256});const S=_=>e.Hasher.SHA2.hash256(_,1,"hex").replace(/^0x/,"").toUpperCase();e.toTxHash=S}(Pe)),Pe}var ct={},D={},W={},Jt;function Ur(){if(Jt)return W;Jt=1;var e=W&&W.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(W,"__esModule",{value:!0}),W.toStrictHex=W.toBytes=W.toBits=W.DID_PREFIX=void 0;const o=e(ft),i=J(),u="did:abt:";W.DID_PREFIX=u;const a=d=>{try{if((0,i.isHexStrict)(d))return C.from((0,i.stripHexPrefix)(d),"hex");let y=(0,i.fromBase58)(d.replace(u,""));for(;y.length<26;)y=C.concat([C.from([0]),y]);return y}catch(y){throw new Error(`Cannot convert DID string to byte array: ${y.message}`)}};W.toBytes=a;const s=(d,y)=>(0,o.default)((0,i.toBN)(d).toString(2),y,"0");W.toBits=s;const p=(d,y)=>{const g=d.replace(/^0x/i,"");return typeof y=="number"&&y%2===0?(0,o.default)(d,y,"0"):g.length%2===0?g:`0${g}`};return W.toStrictHex=p,W}var Gt;function Bn(){if(Gt)return D;Gt=1;var e=D&&D.__importDefault||function(B){return B&&B.__esModule?B:{default:B}};Object.defineProperty(D,"__esModule",{value:!0}),D.toChecksumAddress=D.isEthereumDid=D.isEthereumType=D.toTypeInfoStr=D.toTypeInfo=D.fromTypeInfo=D.DID_TYPE_PASSKEY=D.DID_TYPE_ETHEREUM=D.DID_TYPE_ARCBLOCK=void 0,D.DidType=_;const o=J(),i=e(ut),u=e(Ir),a=e(Lr),s=Et(),p=Ur(),d={pk:"key",address:"encoding"},y={role:s.types.RoleType.ROLE_ACCOUNT,pk:s.types.KeyType.ED25519,hash:s.types.HashType.SHA3,address:s.types.EncodingType.BASE58};D.DID_TYPE_ARCBLOCK=y;const g={role:s.types.RoleType.ROLE_PASSKEY,pk:s.types.KeyType.PASSKEY,hash:s.types.HashType.SHA2,address:s.types.EncodingType.BASE58};D.DID_TYPE_PASSKEY=g;const n={role:s.types.RoleType.ROLE_ACCOUNT,pk:s.types.KeyType.ETHEREUM,hash:s.types.HashType.KECCAK,address:s.types.EncodingType.BASE16};D.DID_TYPE_ETHEREUM=n;const c=B=>{const T=["pk","hash","address"];return(0,u.default)((0,a.default)(B,T),(0,a.default)(n,T))};D.isEthereumType=c;const l=B=>{const T=(0,o.toAddress)(B);return/^(0x)?[0-9a-f]{40}$/i.test(T)?/^(0x|0X)?[0-9a-f]{40}$/.test(T)||/^(0x|0X)?[0-9A-F]{40}$/.test(T)?!0:h(T):!1};D.isEthereumDid=l;const h=B=>{const T=B.replace(/^0x/i,""),j=s.Hasher.Keccak.hash256(T.toLowerCase()).replace(/^0x/i,"");for(let O=0;O<40;O++)if(parseInt(j[O],16)>7&&T[O].toUpperCase()!==T[O]||parseInt(j[O],16)<=7&&T[O].toLowerCase()!==T[O])return!1;return!0},S=B=>{if(typeof B>"u")return"";if(!/^(0x)?[0-9a-f]{40}$/i.test(B))throw new Error(`Given address "${B}" is not a valid Ethereum address.`);const T=B.toLowerCase().replace(/^0x/i,""),j=s.Hasher.Keccak.hash256(T).replace(/^0x/i,"");let O="0x";for(let b=0;b<T.length;b++)parseInt(j[b],16)>7?O+=T[b].toUpperCase():O+=T[b];return O};D.toChecksumAddress=S;function _(B={}){let T={};["default","arcblock"].includes(B)?T=y:["eth","ethereum"].includes(B)?T=n:["passkey"].includes(B)?T=g:T={...y,...B};const{role:j,pk:O,hash:b,address:v}=T;Object.keys(T).forEach(A=>{const K=(0,i.default)(`${d[A]||A}Type`);if(Object.values(s.types[K]).includes(T[A])===!1)throw new Error(`Unsupported ${A} type: ${T[A]}`)});const P={role:j,pk:O,hash:b,address:v};return c(P)===!1&&[s.types.RoleType.ROLE_NODE,s.types.RoleType.ROLE_VALIDATOR,s.types.RoleType.ROLE_TETHER,s.types.RoleType.ROLE_SWAP].includes(P.role)&&(P.hash=s.types.HashType.SHA2),P}_.toJSON=B=>Object.keys(B).reduce((T,j)=>{const O=(0,i.default)(`${d[j]||j}Type`),b=Object.keys(s.types[O]),v=Object.values(s.types[O]);return T[j]=b[v.indexOf(B[j])],T},{}),_.fromJSON=B=>Object.keys(B).reduce((T,j)=>{const O=(0,i.default)(`${d[j]||j}Type`),b=Object.keys(s.types[O]),v=Object.values(s.types[O]);return T[j]=v[b.indexOf(B[j])],T},{});const H=B=>{const T=_(B),j=(0,p.toBits)(T.role,6),O=(0,p.toBits)(T.pk,5),b=(0,p.toBits)(T.hash,5),v=`${j}${O}${b}`,P=(0,o.stripHexPrefix)((0,o.numberToHex)(parseInt(v,2)));return(0,p.toStrictHex)(P,4)};D.fromTypeInfo=H;const x=B=>{let T={};try{if(l(B))T=n;else{const O=(0,p.toBytes)(B).slice(0,2),b=(0,p.toStrictHex)(C.from(O).toString("hex")),v=(0,p.toBits)(new o.BN(b,16),16),P=v.slice(0,6),A=v.slice(6,11),K=v.slice(11,16);T={role:parseInt(P,2),pk:parseInt(A,2),hash:parseInt(K,2),address:(0,o.isHex)((0,o.toAddress)(B))?s.types.EncodingType.BASE16:s.types.EncodingType.BASE58}}return Object.keys(T).forEach(j=>{Object.values(s.types[`${(0,i.default)(d[j]||j)}Type`]).includes(T[j])===!1&&delete T[j]}),T}catch{return T}};D.toTypeInfo=x;const k=B=>{const T=x(B);return Object.keys(T).reduce((j,O)=>{const b=s.types[`${(0,i.default)(d[O]||O)}Type`];return j[O]=Object.keys(b).find(v=>b[v]===T[O]),j},{})};return D.toTypeInfoStr=k,D}var Zt;function jn(){return Zt||(Zt=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DID_TYPE_PASSKEY=e.DID_TYPE_ETHEREUM=e.DID_TYPE_ARCBLOCK=e.DID_PREFIX=e.DidType=e.fromTypeInfo=e.toTypeInfoStr=e.toTypeInfo=e.isEthereumType=e.isEthereumDid=e.isValid=e.isFromPublicKey=e.toDid=e.toAddress=e.fromHash=e.fromPublicKeyHash=e.fromPublicKey=e.fromSecretKey=e.toStrictHex=e.types=void 0;const o=Et();Object.defineProperty(e,"types",{enumerable:!0,get:function(){return o.types}});const i=J();Object.defineProperty(e,"toAddress",{enumerable:!0,get:function(){return i.toAddress}}),Object.defineProperty(e,"toDid",{enumerable:!0,get:function(){return i.toDid}});const u=Bn();Object.defineProperty(e,"DidType",{enumerable:!0,get:function(){return u.DidType}}),Object.defineProperty(e,"DID_TYPE_ARCBLOCK",{enumerable:!0,get:function(){return u.DID_TYPE_ARCBLOCK}}),Object.defineProperty(e,"DID_TYPE_ETHEREUM",{enumerable:!0,get:function(){return u.DID_TYPE_ETHEREUM}}),Object.defineProperty(e,"DID_TYPE_PASSKEY",{enumerable:!0,get:function(){return u.DID_TYPE_PASSKEY}}),Object.defineProperty(e,"fromTypeInfo",{enumerable:!0,get:function(){return u.fromTypeInfo}}),Object.defineProperty(e,"isEthereumDid",{enumerable:!0,get:function(){return u.isEthereumDid}}),Object.defineProperty(e,"isEthereumType",{enumerable:!0,get:function(){return u.isEthereumType}}),Object.defineProperty(e,"toTypeInfo",{enumerable:!0,get:function(){return u.toTypeInfo}}),Object.defineProperty(e,"toTypeInfoStr",{enumerable:!0,get:function(){return u.toTypeInfoStr}});const a=Ur();Object.defineProperty(e,"DID_PREFIX",{enumerable:!0,get:function(){return a.DID_PREFIX}}),Object.defineProperty(e,"toStrictHex",{enumerable:!0,get:function(){return a.toStrictHex}});const s=(c,l)=>{const h=(0,u.DidType)(l),S=(0,o.getSigner)(h.pk).getPublicKey(c);return p(S.indexOf("0x")===0?S:`0x${S}`,h)};e.fromSecretKey=s;const p=(c,l)=>{const h=(0,u.DidType)(l),_=(0,o.getHasher)(h.hash)(c,1);return d(_,h)};e.fromPublicKey=p;const d=(c,l)=>{const h=(0,u.DidType)(l),S=(0,i.stripHexPrefix)(c).slice(0,40),_=(0,o.getHasher)(h.hash),H=(0,u.fromTypeInfo)(h),x=(0,i.stripHexPrefix)(_(`0x${H}${S}`,1)).slice(0,8),k=`0x${H}${S}${x}`;return(0,u.isEthereumType)(h)?(0,u.toChecksumAddress)(`0x${c.slice(-40)}`):h.address===o.types.EncodingType.BASE58?(0,i.toBase58)(k):k};e.fromPublicKeyHash=d;const y=(c,l=o.types.RoleType.ROLE_ACCOUNT)=>{const h=Object.keys(o.types.RoleType),S=Object.values(o.types.RoleType);if(S.indexOf(l)===-1)throw new Error(`Unsupported role type ${l} when gen ddi from hash`);const _=(0,u.DidType)({role:o.types.RoleType[h[S.indexOf(l)]]});return d(c,_)};e.fromHash=y;const g=(c,l)=>{if(n(c)===!1)return!1;const h=(0,u.toTypeInfo)(c),S=p(l,h),_=c.replace(a.DID_PREFIX,"");return S===_};e.isFromPublicKey=g;const n=c=>{if(!c)return!1;const l=(0,i.toAddress)(String(c)),{hash:h}=(0,u.toTypeInfo)(l);if(typeof h>"u")return!1;if((0,u.isEthereumDid)(l))return!0;const S=(0,o.getHasher)(h),_=(0,a.toBytes)(l),H=(0,a.toStrictHex)(C.from(_.slice(0,22)).toString("hex")),x=(0,a.toStrictHex)(C.from(_.slice(22,26)).toString("hex")),k=(0,i.stripHexPrefix)(S(`0x${H}`,1)).slice(0,8);return x===k};e.isValid=n}(ct)),ct}var Qt;function vn(){if(Qt)return Y;Qt=1,Object.defineProperty(Y,"__esModule",{value:!0}),Y.WalletType=void 0,Y.Wallet=u,Y.fromSecretKey=a,Y.fromPublicKey=s,Y.fromAddress=p,Y.fromRandom=d,Y.fromJSON=y,Y.isValid=g;const e=J(),o=Et(),i=jn();Y.WalletType=i.DidType;function u(n,c="default"){const l=(0,i.DidType)(c),h=(0,o.getSigner)(l.pk),S=(0,o.getHasher)(l.hash);return{type:l,secretKey:n.sk,publicKey:n.pk,address:n.pk?(0,i.fromPublicKey)(n.pk,l):n.address,hash(_,H=1,x="hex"){return S(_,H,x)},sign(_,H=!0,x="hex"){if(!n.sk)throw new Error("Cannot sign data without a secretKey");if(H){const k=S(_,1);return h.sign(k,n.sk,x)}return h.sign(_,n.sk,x)},async verify(_,H,x=!0,k){if(!n.pk)throw new Error("Cannot verify data without a publicKey");const B=x?S(_,1):_;return h.verify(B,H,n.pk,k)},ethHash(_){if(typeof h.ethHash!="function")throw new Error("ethHash is not supported by signer");return h.ethHash(_)},ethSign(_,H=!0){if(!n.sk)throw new Error("Cannot sign data without a secretKey");if(typeof h.ethHash!="function")throw new Error("ethSign is not supported by signer");return H?h.ethSign(h.ethHash(_),(0,e.toHex)(n.sk)):h.ethSign(_,(0,e.toHex)(n.sk))},ethVerify(_,H,x=!0){if(typeof h.ethHash!="function")throw new Error("ethVerify is not supported by signer");const k=x?h.ethHash(_):_;return h.ethRecover(k,H)===this.address},toAddress(){return n.pk?(0,i.fromPublicKey)(n.pk,l):n.address},toJSON(){return{type:i.DidType.toJSON(l),sk:(0,e.toHex)(n.sk),pk:(0,e.toHex)(n.pk),address:this.address}}}}function a(n,c="default"){const l=(0,i.DidType)(c),h={sk:n,pk:(0,o.getSigner)(l.pk).getPublicKey(n)};return u(h,l)}function s(n,c="default"){return u({pk:n},(0,i.DidType)(c))}function p(n){return u({address:(0,i.toAddress)(n)},(0,i.toTypeInfo)(n))}function d(n="default"){const c=(0,i.DidType)(n),h=(0,o.getSigner)(c.pk).genKeyPair();return u({sk:h.secretKey,pk:h.publicKey},c)}function y(n){const c=i.DidType.fromJSON(n.type);return u(n,c)}function g(n,c=!0){return!(!n||typeof n!="object"||typeof n.verify!="function"||typeof n.toAddress!="function"||typeof n.toJSON!="function"||!n.type||!n.publicKey||c&&(!n.secretKey||typeof n.sign!="function"))}return Y}var lt,er;function wn(){if(er)return lt;er=1;const e=tn(),o=gn(),{fromSecretKey:i,WalletType:u}=vn(),{isHexStrict:a,toHex:s,toBuffer:p,stripHexPrefix:d}=se(),{types:y}=o;return lt={fromAppDid:(n,c,l={role:y.RoleType.ROLE_ACCOUNT},h=0)=>{if(!c)throw new Error("Cannot get user wallet with empty root sk");const S=o.Hasher.SHA3.hash256(p(n)),_=d(S).slice(0,16),H=_.slice(0,8),x=_.slice(8,16),k=parseInt(+`0x${H}`,10)&2147483647,B=parseInt(+`0x${x}`,10)&2147483647,T=d(a(c)?c:s(c)),j=e.fromMasterSeed(C.from(T,"hex")),O=`m/44'/260'/${k}'/${B}'/${h}`,b=j.derive(O),v=u(l),{pk:P=y.KeyType.ED25519}=v;let A;return P===y.KeyType.ED25519?A=o.Signer.Ed25519.genKeyPair("hex",b.privateKey).secretKey:A=s(b.privateKey),P===y.KeyType.ETHEREUM&&(A=A.slice(0,66)),i(A,v)}},lt}var Or=wn();const Un={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function Ar({onCreated:e,onClose:o}){const[i,u]=I.useState(!1),{t:a,locale:s}=$e(),{api:p}=Re(),{teamDid:d}=ke(),{control:y,handleSubmit:g,formState:{errors:n},watch:c,setValue:l}=jr({defaultValues:Un,mode:"onChange"}),h=c("scope"),S=H=>{H!=="profile:read"&&l("scope",h.includes(H)?h.filter(x=>x!==H):[...h,H])},_=async H=>{u(!0);try{const x={...H,redirectUris:H.redirectUris,contacts:H.contacts?H.contacts.split(",").map(k=>k.trim()):[],scope:H.scope.join(" ")};await p.createOAuthClient({input:{teamDid:d,input:Qr(x,en)}}),e(x)}catch(x){Ke.error(x.message||"Failed to create OAuth App")}finally{u(!1)}};return r.jsxs(dt,{open:!0,onClose:o,maxWidth:"md",fullWidth:!0,children:[r.jsxs(ht,{children:[a("oauth.client.register")," ",r.jsx(pt,{onClick:o,sx:{position:"absolute",right:8,top:8},children:r.jsx(yt,{})})]}),r.jsx(mt,{children:r.jsxs(_e,{spacing:4,sx:{mt:2},children:[r.jsx(X,{variant:"h6",gutterBottom:!0,children:a("oauth.client.requiredInformation")}),r.jsx(R,{children:r.jsx(z,{name:"clientName",control:y,rules:{required:a("oauth.client.validate.clientName"),minLength:{value:3,message:a("oauth.client.validate.clientNameMinLength")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.name"),required:!0,fullWidth:!0,placeholder:a("oauth.client.input.clientNamePlaceholder"),error:!!n.clientName,helperText:n.clientName?.message}),r.jsx(M,{children:a("oauth.client.helperText.clientName")})]})})}),r.jsx(R,{children:r.jsx(z,{name:"clientUri",control:y,rules:{required:a("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:a("oauth.client.validate.clientUriInvalid")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:a("oauth.client.input.clientUriPlaceholder"),error:!!n.clientUri,helperText:n.clientUri?.message}),r.jsx(M,{children:a("oauth.client.helperText.clientUri")})]})})}),r.jsx(R,{children:r.jsx(z,{name:"redirectUris",control:y,rules:{required:a("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:a("oauth.client.validate.redirectUrisInvalid")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:a("oauth.client.input.redirectUrisPlaceholder"),error:!!n.redirectUris,helperText:n.redirectUris?.message}),r.jsxs(R,{sx:{display:"flex",gap:"2px"},children:[r.jsx(M,{children:a("oauth.client.helperText.redirectUris")}),r.jsx(M,{children:a("oauth.client.helperText.read")}),r.jsx(M,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:a("oauth.client.helperText.document")}),r.jsx(M,{children:a("oauth.client.helperText.more")})]})]})})}),r.jsxs(Wr,{variant:"outlined",sx:{p:2,display:"none"},children:[r.jsx(X,{variant:"subtitle2",gutterBottom:!0,children:a("oauth.client.input.permissions")}),r.jsx(R,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:r.jsx(br,{children:Object.entries(ie.OAUTH_SCOPES).map(([H,x])=>r.jsx(Sr,{control:r.jsx(Er,{checked:h.includes(H),onChange:()=>S(H),disabled:H==="profile:read",color:"primary"}),label:r.jsx(R,{children:r.jsx(X,{variant:"body2",sx:{fontWeight:500},children:x})})},H))})})]}),r.jsx(gt,{}),r.jsx(X,{variant:"h6",gutterBottom:!0,children:a("oauth.client.optionalInformation")}),r.jsx(_e,{children:r.jsx(z,{name:"contacts",control:y,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:a("oauth.client.validate.contacts")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.contacts"),fullWidth:!0,placeholder:a("oauth.client.input.contactsPlaceholder"),error:!!n.contacts,helperText:n.contacts?.message}),r.jsx(M,{children:a("oauth.client.helperText.contacts")})]})})}),r.jsxs(_e,{direction:{xs:"column",sm:"row"},spacing:2,children:[r.jsx(z,{name:"tosUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:a("oauth.client.validate.tosUriInvalid")}},render:({field:H})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.tosUri"),fullWidth:!0,placeholder:a("oauth.client.input.tosUriPlaceholder"),error:!!n.tosUri,helperText:n.tosUri?.message}),r.jsx(M,{children:a("oauth.client.helperText.tosUri")})]})}),r.jsx(z,{name:"policyUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:a("oauth.client.validate.policyUriInvalid")}},render:({field:H})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.policyUri"),fullWidth:!0,placeholder:a("oauth.client.input.policyUriPlaceholder"),error:!!n.policyUri,helperText:n.policyUri?.message}),r.jsx(M,{children:a("oauth.client.helperText.policyUri")})]})})]}),n.error&&r.jsx(xr,{severity:"error",children:n.error.message})]})}),r.jsxs(Tr,{children:[r.jsx(je,{onClick:o,children:a("common.cancel")}),r.jsxs(je,{onClick:g(_),disabled:i,variant:"contained",color:"primary",children:[i?r.jsx(_t,{size:20,sx:{mr:1}}):null,a("oauth.client.registerButton")]})]})]})}Ar.propTypes={onCreated:w.func.isRequired,onClose:w.func.isRequired};function xt({scope:e="",...o}){if(!e)return null;const i=e.split(" ").filter(Boolean);return r.jsx(_e,{direction:"row",...o,sx:[{flexWrap:"wrap",gap:1},...Array.isArray(o.sx)?o.sx:[o.sx]],children:i.map(u=>r.jsx(Kr.Fragment,{children:r.jsx(Vr,{title:ie.OAUTH_SCOPES[u],children:r.jsx(q,{children:u})})},u))})}xt.propTypes={scope:w.string};const Tt=e=>{const{prefix:o}=Re(),{blocklet:i}=rn(),u=Ht(o,"/api/media/upload",i.appPid),a=I.useCallback(p=>p?p.startsWith("http")?p:`${Ht(o,"/api/media/upload",i.appPid)}/${p}`:"",[o,i.appPid]);return{clientLogoUrl:I.useMemo(()=>a(e),[e,a]),apiPath:u,getClientLogoUrl:a}},On=I.lazy(()=>qr(()=>import("./index-CJWwSLdB.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.Uploader})));function Pr({client:e,onUpdate:o,onClose:i}){const[u,a]=I.useState(!1),{t:s,locale:p}=$e(),d=I.useRef(null),{api:y}=Re(),{teamDid:g}=ke(),{control:n,handleSubmit:c,formState:{errors:l},watch:h,setValue:S,getValues:_}=jr({defaultValues:{clientName:e.clientName||"",clientUri:e.clientUri||"",redirectUris:Array.isArray(e.redirectUris)?e.redirectUris.join(","):"",scope:e.scope?e.scope.split(" "):["profile:read"],contacts:Array.isArray(e.contacts)?e.contacts.join(","):"",tosUri:e.tosUri||"",policyUri:e.policyUri||"",logoUri:e.logoUri||"",clientSecretExpiresAt:e.clientSecretExpiresAt||null},mode:"onChange"}),H=h("scope"),x=h("logoUri"),{clientLogoUrl:k,apiPath:B}=Tt(x),T=b=>{b!=="profile:read"&&S("scope",H.includes(b)?H.filter(v=>v!==b):[...H,b])},j=async b=>{const v={clientId:e.clientId,clientName:b.clientName.trim(),clientUri:b.clientUri,redirectUris:b.redirectUris.split(",").map(P=>P.trim()).filter(Boolean),contacts:b.contacts?b.contacts.split(",").map(P=>P.trim()):[],scope:b.scope.join(" "),tosUri:b.tosUri,policyUri:b.policyUri,logoUri:b.logoUri,clientSecretExpiresAt:b.clientSecretExpiresAt?parseInt(b.clientSecretExpiresAt/1e3,10):null};await y.updateOAuthClient({input:{teamDid:g,input:v}})},O=async b=>{a(!0);try{await j(b),o(),i()}catch(v){Ke.error(v.message||s("oauth.client.updateFailed"))}finally{a(!1)}};return r.jsxs(dt,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[r.jsxs(ht,{children:[s("oauth.client.update")," ",r.jsx(pt,{onClick:i,sx:{position:"absolute",right:8,top:8},children:r.jsx(yt,{})})]}),r.jsx(mt,{children:r.jsxs(_e,{spacing:3,sx:{mt:2},children:[r.jsxs(R,{sx:{mb:3},children:[r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),r.jsxs(R,{children:[r.jsx(R,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:k?r.jsx(R,{children:r.jsx("img",{src:k,alt:"client-logo",style:{width:"100%",height:"100%"}})}):r.jsx(R,{onClick:()=>{d.current?.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:r.jsx(Hr,{sx:{fontSize:40,color:"common.white"}})})}),r.jsx(je,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{d.current?.open()},children:s(k?"common.change":"common.upload")})]}),r.jsx(R,{sx:{display:"flex",alignItems:"center"},children:r.jsx(I.Suspense,{fallback:r.jsx(sn,{}),children:r.jsx(On,{ref:d,locale:p,popup:!0,onUploadFinish:b=>{S("logoUri",b.data.filename),j(_()).then(()=>{o()}).catch(v=>{Ke.error(v.message||s("oauth.client.updateFailed"))}).finally(()=>{d.current?.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:B,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),r.jsx(V,{label:"Client Id",fullWidth:!0,value:e.clientId,disabled:!0}),r.jsx(R,{children:r.jsx(z,{name:"clientName",control:n,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!l.clientName,helperText:l.clientName?.message}),r.jsx(M,{children:s("oauth.client.helperText.clientName")})]})})}),r.jsx(R,{children:r.jsx(z,{name:"clientUri",control:n,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!l.clientUri,helperText:l.clientUri?.message}),r.jsx(M,{children:s("oauth.client.helperText.clientUri")})]})})}),r.jsx(R,{children:r.jsx(z,{name:"redirectUris",control:n,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!l.redirectUris,helperText:l.redirectUris?.message}),r.jsx(M,{children:s("oauth.client.helperText.redirectUris")})]})})}),r.jsx(z,{name:"clientSecretExpiresAt",control:n,render:({field:b})=>r.jsx(nn,{placeholder:s("oauth.client.input.expireTime"),value:b.value*1e3,onChange:v=>{b.onChange(v)}})}),r.jsxs(R,{sx:{display:"none"},children:[r.jsx(X,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),r.jsx(R,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:r.jsx(br,{children:Object.entries(ie.OAUTH_SCOPES).map(([b,v])=>r.jsx(Sr,{control:r.jsx(Er,{checked:H.includes(b),onChange:()=>T(b),disabled:b==="profile:read",color:"primary"}),label:r.jsx(R,{children:r.jsx(X,{variant:"body2",sx:{fontWeight:500},children:v})})},b))})})]}),r.jsx(gt,{}),r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),r.jsx(R,{children:r.jsx(z,{name:"contacts",control:n,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!l.contacts,helperText:l.contacts?.message}),r.jsx(M,{children:s("oauth.client.helperText.contacts")})]})})}),r.jsxs(_e,{direction:{xs:"column",sm:"row"},spacing:2,children:[r.jsx(z,{name:"tosUri",control:n,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:b})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{...b,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!l.tosUri,helperText:l.tosUri?.message}),r.jsx(M,{children:s("oauth.client.helperText.tosUri")})]})}),r.jsx(z,{name:"policyUri",control:n,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:b})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{...b,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!l.policyUri,helperText:l.policyUri?.message}),r.jsx(M,{children:s("oauth.client.helperText.policyUri")})]})})]}),l.error&&r.jsx(xr,{severity:"error",children:l.error.message})]})}),r.jsxs(Tr,{children:[r.jsx(je,{onClick:i,children:s("common.cancel")}),r.jsx(je,{onClick:c(O),disabled:u,variant:"contained",color:"primary",children:u?r.jsx(_t,{size:16}):s("common.update")})]})]})}Pr.propTypes={client:w.shape({clientId:w.string.isRequired,clientName:w.string.isRequired,clientUri:w.string,redirectUris:w.arrayOf(w.string),scope:w.string,contacts:w.arrayOf(w.string),tosUri:w.string,policyUri:w.string,logoUri:w.string,clientSecretExpiresAt:w.number}).isRequired,onUpdate:w.func.isRequired,onClose:w.func.isRequired};function $r({client:e,onUpdate:o,onClose:i}){return r.jsx(Pr,{client:e,onUpdate:u=>o(u),onClose:i})}$r.propTypes={client:w.shape({clientId:w.string.isRequired,clientName:w.string.isRequired,clientUri:w.string,redirectUris:w.arrayOf(w.string),scope:w.string,contacts:w.arrayOf(w.string),tosUri:w.string,policyUri:w.string,logoUri:w.string,clientSecretExpiresAt:w.number}).isRequired,onUpdate:w.func.isRequired,onClose:w.func.isRequired};function Rr({clientId:e,clientName:o,onDelete:i=()=>{},onClose:u=()=>{}}){const{t:a}=$e(),{api:s}=Re(),{teamDid:p}=ke(),d=()=>{u()},y=async()=>{try{await s.deleteOAuthClient({input:{teamDid:p,clientId:e}}),i()}catch(n){Ke.error(n?.message)}finally{d()}},g={keyName:o,title:a("oauth.client.delete.title"),description:a("oauth.client.delete.description",{name:`<b>${o}</b>`}),confirmPlaceholder:a("oauth.client.delete.description",{name:o}),confirm:a("common.delConfirm"),cancel:a("common.cancel"),onConfirm:y,onCancel:d};return r.jsx(on,{keyName:g.keyName,title:g.title,description:g.description,confirmPlaceholder:g.confirmPlaceholder,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})}Rr.propTypes={clientId:w.string.isRequired,clientName:w.string.isRequired,onDelete:w.func,onClose:w.func};function kr({title:e,items:o}){return r.jsxs(R,{sx:{mb:3},children:[r.jsx(X,{variant:"h6",sx:{mb:1.5},children:e}),r.jsx(_e,{spacing:1.5,children:o.map(({label:i,value:u})=>r.jsxs(R,{sx:{display:"flex",alignItems:"center",gap:2},children:[r.jsx(X,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),r.jsx(X,{sx:{wordBreak:"break-all"},children:u||"-"})]},i))})]})}kr.propTypes={title:w.string.isRequired,items:w.arrayOf(w.shape({label:w.string.isRequired,value:w.any})).isRequired};function Cr({client:e,onClose:o}){const{t:i,locale:u}=$e(),{teamDid:a}=ke(),{clientName:s,clientId:p,clientSecret:d,redirectUris:y,scope:g,clientUri:n,logoUri:c,contacts:l,tosUri:h,policyUri:S,jwksUri:_,jwks:H,softwareId:x,softwareVersion:k,clientIdIssuedAt:B,clientSecretExpiresAt:T,updatedAt:j,createUser:O}=e,{clientLogoUrl:b}=Tt(c),v=K=>{try{const ee=new URL(window.blocklet.appUrl);return ee.pathname=K,ee.toString()}catch{return"-"}},P=Or.fromAppDid(p,a),A=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:s},{label:i("oauth.client.logoUri"),value:r.jsx(_r,{variant:"rounded",shape:"square",src:b,did:P.address,size:64})},{label:i("oauth.client.clientUri"),value:n?r.jsx(q,{children:n}):"-"},{label:i("oauth.client.clientId"),value:r.jsx(q,{children:p})},{label:i("oauth.client.clientSecret"),value:r.jsx(q,{children:d})},{label:i("oauth.client.redirectUris"),value:r.jsx(q,{children:(y||[]).join(", ")})},{label:i("oauth.client.scope"),value:r.jsx(xt,{scope:g})},{label:i("oauth.client.createUser"),value:O?an(O,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:r.jsx(q,{children:v("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:l.length?r.jsx(q,{children:(l||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:h?r.jsx(q,{children:h}):"-"},{label:i("oauth.client.policyUri"),value:S?r.jsx(q,{children:S}):"-"},{label:i("oauth.client.jwksUri"),value:_},{label:i("oauth.client.jwks"),value:H},{label:i("oauth.client.softwareId"),value:x},{label:i("oauth.client.softwareVersion"),value:k}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:B?r.jsx(Ne,{value:B*1e3,type:"all",locale:u}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:T?r.jsx(Ne,{value:T*1e3,type:"all",locale:u}):"-"},{label:i("common.updatedAt"),value:j?r.jsx(Ne,{value:j,type:"all",locale:u}):"-"}]}].filter(Boolean);return r.jsxs(dt,{open:!0,onClose:o,maxWidth:"lg",fullWidth:!0,children:[r.jsxs(ht,{children:[i("oauth.client.oauthAppDetails"),r.jsx(pt,{onClick:o,sx:{position:"absolute",right:8,top:8},children:r.jsx(yt,{})})]}),r.jsx(mt,{children:r.jsx(R,{sx:{mt:1},children:A.map((K,ee)=>r.jsxs(R,{children:[r.jsx(kr,{title:K.title,items:K.items}),ee!==A.length-1&&r.jsx(gt,{sx:{my:2}})]},K.title))})})]})}Cr.propTypes={client:w.object.isRequired,onClose:w.func.isRequired};function An(e){return r.jsx(Ne,{value:e*1e3})}function Dr({selected:e=null,onClose:o}){return e?r.jsx(Cr,{client:e,onClose:o}):null}Dr.propTypes={selected:w.object,onClose:w.func.isRequired};function Nr({open:e,onCreated:o,onClose:i}){return e?r.jsx(Ar,{onCreated:o,onClose:i}):null}Nr.propTypes={open:w.bool.isRequired,onCreated:w.func.isRequired,onClose:w.func.isRequired};function fi(){const[e,o]=I.useState({searchText:"",pageSize:10,page:1}),[i,u]=I.useState(null),[a,s]=I.useState(!1),p=I.useRef(null),{t:d,locale:y}=$e(),{api:g}=Re(),{teamDid:n}=ke(),[c,l]=I.useState(null),[h,S]=I.useState(null),_=ln(),{getClientLogoUrl:H}=Tt(),x=Zr(async()=>await g.getOAuthClients({input:{teamDid:n,paging:{page:e.page,pageSize:e.pageSize}}}),[e.page,e.pageSize]),{loading:k}=x,B=I.useMemo(()=>x.value?.list||[],[x.value?.list]),T=I.useMemo(()=>e.searchText?B.filter(b=>b.clientName.toLowerCase().includes(e.searchText.toLowerCase())||b.clientId.toLowerCase().includes(e.searchText.toLowerCase())||b.scope.toLowerCase().includes(e.searchText.toLowerCase())):B,[e.searchText,B]),j=I.useMemo(()=>[{label:d("oauth.client.name"),name:"clientName",options:{customBodyRender:(b,{rowIndex:v})=>{const P=T[v],A=H(P.logoUri),K=Or.fromAppDid(P.clientId,n);return r.jsx(R,{sx:{display:"flex",alignItems:"center",gap:2},children:r.jsxs(R,{sx:{display:"flex",alignItems:"center",gap:2,cursor:"pointer"},children:[r.jsx(_r,{variant:"rounded",shape:"square",did:K.address,src:A,size:48}),r.jsxs(_e,{sx:{gap:.5},children:[r.jsx(R,{sx:{color:"text.primary"},children:P.clientName}),r.jsx(R,{sx:{color:"text.secondary"},children:P.clientUri})]})]})})}}},{label:d("oauth.client.clientId"),name:"clientId"},{label:d("oauth.client.scope"),name:"scope",options:{customBodyRender:b=>r.jsx(xt,{scope:b})}},{label:d("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:An}},{label:d("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:b=>b?r.jsx(Xr,{showDid:!0,did:b,cardType:Gr.Detailed,infoType:Jr.Minimal,sx:{border:0,padding:0}}):d("oauth.client.openRegistration")}},{label:d("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(b,{rowIndex:v})=>{const P=T[v];return r.jsx(cn,{actions:[{icon:r.jsx(zr,{}),text:d("common.edit"),onClick:A=>{A.stopPropagation(),l(P)}},{icon:r.jsx(Yr,{}),text:d("common.delete"),onClick:A=>{A.stopPropagation(),S(P)}}]})}}}],[T,d,H,n,l,S]),O=({page:b,rowsPerPage:v,searchText:P})=>{e.pageSize!==v?o(A=>({...A,searchText:"",pageSize:v,page:1})):e.page!==b+1?o(A=>({...A,searchText:"",page:b+1})):e.searchText!==P&&o(A=>({...A,searchText:P,page:1}))};return r.jsxs(R,{ref:p,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[_?r.jsx(Bt,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}):null,r.jsx(Mr,{data:T,columns:j,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:e.page-1,rowsPerPage:e.pageSize,count:T.length,searchDebounceTime:400,onRowClick(b,{dataIndex:v},P){if(p.current?.contains(P.target)){const A=T[v];u(A)}}},onChange:O,title:_?null:r.jsx(Bt,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}),customButtons:[r.jsxs(je,{variant:"contained",size:"small",onClick:()=>s(!0),children:[k?r.jsx(_t,{size:16}):r.jsx(Hr,{style:{fontSize:16}}),d("common.create")]},"add")],loading:!1,emptyNode:r.jsx(Fr,{children:d("oauth.client.empty")})}),r.jsx(Dr,{selected:i,onClose:()=>u(null)}),r.jsx(Nr,{open:a,onCreated:()=>{s(!1),x.retry()},onClose:()=>s(!1)}),c&&r.jsx($r,{client:c,onUpdate:x.retry,onClose:()=>l(null)}),h&&r.jsx(Rr,{...h,onDelete:x.retry,onClose:()=>S(null)})]})}export{fi as default};
|
|
4
|
+
${g.length}`,l=C.from(c),h=C.concat([l,n]);return i.default.keccak256s(h)}ethSign(d,y){return o.default.sign(d,y)}ethRecover(d,y){return o.default.recover(d,y)}}return ye.EthereumSigner=s,ye.default=new s,ye}var ge={},Yt;function Hn(){if(Yt)return ge;Yt=1;var e=ge&&ge.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ge,"__esModule",{value:!0}),ge.PasskeySigner=void 0;const o=J(),i=gr(),u=e(St());class a extends u.default{constructor(){super()}genKeyPair(p="hex",d){throw new Error("Not supported")}getPublicKey(p,d="hex"){throw new Error("Not supported")}sign(p,d,y="hex"){throw new Error("Not supported")}async verify(p,d,y,g){const n=JSON.parse(g);if(!n.authenticatorData||!n.clientDataJSON)throw new Error("extra.authenticatorData or extra.clientDataJSON is required for passkey signature verification");const c=(0,o.toBuffer)((0,o.fromBase64)(n.authenticatorData)),l=await(0,i.toHash)(i.isoBase64URL.toBuffer(n.clientDataJSON));if((0,i.decodeClientDataJSON)(n.clientDataJSON).challenge!==(0,o.toBase64)(p))throw new Error("challenge mismatch for passkey signature");return(0,i.verifySignature)({signature:i.isoBase64URL.toBuffer(typeof d=="string"?d:(0,o.toBase64)(d)),data:i.isoUint8Array.concat([c,l]),credentialPublicKey:y})}}return ge.PasskeySigner=a,ge.default=new a,ge}var Xt;function Et(){return Xt||(Xt=1,function(e){var o=Pe&&Pe.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(e,"__esModule",{value:!0}),e.toTxHash=e.Hashers=e.Signers=e.types=e.Hasher=e.Signer=void 0,e.getSigner=c,e.getHasher=l,e.getRandomBytes=h;const i=o(ve()),u=Ue(),a=o(bn()),s=o(Sn()),p=o(En()),d=o(xn()),y=o(Tn()),g=o(wr()),n=o(Hn());e.Signer={Ed25519:d.default,Secp256k1:g.default,Ethereum:y.default,Passkey:n.default},e.Hasher={SHA2:s.default,SHA3:p.default,Keccak:a.default},e.types={KeyType:{ED25519:0,SECP256K1:1,ETHEREUM:2,PASSKEY:3},HashType:{KECCAK:0,SHA3:1,KECCAK_384:2,SHA3_384:3,KECCAK_512:4,SHA3_512:5,SHA2:6},RoleType:{ROLE_ACCOUNT:0,ROLE_NODE:1,ROLE_DEVICE:2,ROLE_APPLICATION:3,ROLE_SMART_CONTRACT:4,ROLE_BOT:5,ROLE_ASSET:6,ROLE_STAKE:7,ROLE_VALIDATOR:8,ROLE_GROUP:9,ROLE_TX:10,ROLE_TETHER:11,ROLE_SWAP:12,ROLE_DELEGATION:13,ROLE_VC:14,ROLE_BLOCKLET:15,ROLE_STORE:16,ROLE_TOKEN:17,ROLE_FACTORY:18,ROLE_ROLLUP:19,ROLE_STORAGE:20,ROLE_PROFILE:21,ROLE_PASSKEY:22,ROLE_TOKEN_FACTORY:23,ROLE_ANY:63},EncodingType:{BASE16:0,BASE58:1}};function c(_){if(typeof e.Signers[_]>"u")throw new Error(`Unsupported signer type: ${_}`);return e.Signers[_]}function l(_){if(typeof e.Hashers[_]>"u")throw new Error(`Unsupported hash type: ${_}`);return e.Hashers[_]}function h(_=32,H="hex"){return(0,u.encode)((0,i.default)(_),H)}e.Signers=Object.freeze({[e.types.KeyType.ED25519]:e.Signer.Ed25519,[e.types.KeyType.SECP256K1]:e.Signer.Secp256k1,[e.types.KeyType.ETHEREUM]:e.Signer.Ethereum,[e.types.KeyType.PASSKEY]:e.Signer.Passkey}),e.Hashers=Object.freeze({[e.types.HashType.KECCAK]:e.Hasher.Keccak.hash256,[e.types.HashType.KECCAK_384]:e.Hasher.Keccak.hash384,[e.types.HashType.KECCAK_512]:e.Hasher.Keccak.hash512,[e.types.HashType.SHA3]:e.Hasher.SHA3.hash256,[e.types.HashType.SHA3_384]:e.Hasher.SHA3.hash384,[e.types.HashType.SHA3_512]:e.Hasher.SHA3.hash512,[e.types.HashType.SHA2]:e.Hasher.SHA2.hash256});const S=_=>e.Hasher.SHA2.hash256(_,1,"hex").replace(/^0x/,"").toUpperCase();e.toTxHash=S}(Pe)),Pe}var ct={},D={},W={},Jt;function Ur(){if(Jt)return W;Jt=1;var e=W&&W.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(W,"__esModule",{value:!0}),W.toStrictHex=W.toBytes=W.toBits=W.DID_PREFIX=void 0;const o=e(ft),i=J(),u="did:abt:";W.DID_PREFIX=u;const a=d=>{try{if((0,i.isHexStrict)(d))return C.from((0,i.stripHexPrefix)(d),"hex");let y=(0,i.fromBase58)(d.replace(u,""));for(;y.length<26;)y=C.concat([C.from([0]),y]);return y}catch(y){throw new Error(`Cannot convert DID string to byte array: ${y.message}`)}};W.toBytes=a;const s=(d,y)=>(0,o.default)((0,i.toBN)(d).toString(2),y,"0");W.toBits=s;const p=(d,y)=>{const g=d.replace(/^0x/i,"");return typeof y=="number"&&y%2===0?(0,o.default)(d,y,"0"):g.length%2===0?g:`0${g}`};return W.toStrictHex=p,W}var Gt;function Bn(){if(Gt)return D;Gt=1;var e=D&&D.__importDefault||function(B){return B&&B.__esModule?B:{default:B}};Object.defineProperty(D,"__esModule",{value:!0}),D.toChecksumAddress=D.isEthereumDid=D.isEthereumType=D.toTypeInfoStr=D.toTypeInfo=D.fromTypeInfo=D.DID_TYPE_PASSKEY=D.DID_TYPE_ETHEREUM=D.DID_TYPE_ARCBLOCK=void 0,D.DidType=_;const o=J(),i=e(ut),u=e(Ir),a=e(Lr),s=Et(),p=Ur(),d={pk:"key",address:"encoding"},y={role:s.types.RoleType.ROLE_ACCOUNT,pk:s.types.KeyType.ED25519,hash:s.types.HashType.SHA3,address:s.types.EncodingType.BASE58};D.DID_TYPE_ARCBLOCK=y;const g={role:s.types.RoleType.ROLE_PASSKEY,pk:s.types.KeyType.PASSKEY,hash:s.types.HashType.SHA2,address:s.types.EncodingType.BASE58};D.DID_TYPE_PASSKEY=g;const n={role:s.types.RoleType.ROLE_ACCOUNT,pk:s.types.KeyType.ETHEREUM,hash:s.types.HashType.KECCAK,address:s.types.EncodingType.BASE16};D.DID_TYPE_ETHEREUM=n;const c=B=>{const T=["pk","hash","address"];return(0,u.default)((0,a.default)(B,T),(0,a.default)(n,T))};D.isEthereumType=c;const l=B=>{const T=(0,o.toAddress)(B);return/^(0x)?[0-9a-f]{40}$/i.test(T)?/^(0x|0X)?[0-9a-f]{40}$/.test(T)||/^(0x|0X)?[0-9A-F]{40}$/.test(T)?!0:h(T):!1};D.isEthereumDid=l;const h=B=>{const T=B.replace(/^0x/i,""),j=s.Hasher.Keccak.hash256(T.toLowerCase()).replace(/^0x/i,"");for(let O=0;O<40;O++)if(parseInt(j[O],16)>7&&T[O].toUpperCase()!==T[O]||parseInt(j[O],16)<=7&&T[O].toLowerCase()!==T[O])return!1;return!0},S=B=>{if(typeof B>"u")return"";if(!/^(0x)?[0-9a-f]{40}$/i.test(B))throw new Error(`Given address "${B}" is not a valid Ethereum address.`);const T=B.toLowerCase().replace(/^0x/i,""),j=s.Hasher.Keccak.hash256(T).replace(/^0x/i,"");let O="0x";for(let b=0;b<T.length;b++)parseInt(j[b],16)>7?O+=T[b].toUpperCase():O+=T[b];return O};D.toChecksumAddress=S;function _(B={}){let T={};["default","arcblock"].includes(B)?T=y:["eth","ethereum"].includes(B)?T=n:["passkey"].includes(B)?T=g:T={...y,...B};const{role:j,pk:O,hash:b,address:v}=T;Object.keys(T).forEach(A=>{const K=(0,i.default)(`${d[A]||A}Type`);if(Object.values(s.types[K]).includes(T[A])===!1)throw new Error(`Unsupported ${A} type: ${T[A]}`)});const P={role:j,pk:O,hash:b,address:v};return c(P)===!1&&[s.types.RoleType.ROLE_NODE,s.types.RoleType.ROLE_VALIDATOR,s.types.RoleType.ROLE_TETHER,s.types.RoleType.ROLE_SWAP].includes(P.role)&&(P.hash=s.types.HashType.SHA2),P}_.toJSON=B=>Object.keys(B).reduce((T,j)=>{const O=(0,i.default)(`${d[j]||j}Type`),b=Object.keys(s.types[O]),v=Object.values(s.types[O]);return T[j]=b[v.indexOf(B[j])],T},{}),_.fromJSON=B=>Object.keys(B).reduce((T,j)=>{const O=(0,i.default)(`${d[j]||j}Type`),b=Object.keys(s.types[O]),v=Object.values(s.types[O]);return T[j]=v[b.indexOf(B[j])],T},{});const H=B=>{const T=_(B),j=(0,p.toBits)(T.role,6),O=(0,p.toBits)(T.pk,5),b=(0,p.toBits)(T.hash,5),v=`${j}${O}${b}`,P=(0,o.stripHexPrefix)((0,o.numberToHex)(parseInt(v,2)));return(0,p.toStrictHex)(P,4)};D.fromTypeInfo=H;const x=B=>{let T={};try{if(l(B))T=n;else{const O=(0,p.toBytes)(B).slice(0,2),b=(0,p.toStrictHex)(C.from(O).toString("hex")),v=(0,p.toBits)(new o.BN(b,16),16),P=v.slice(0,6),A=v.slice(6,11),K=v.slice(11,16);T={role:parseInt(P,2),pk:parseInt(A,2),hash:parseInt(K,2),address:(0,o.isHex)((0,o.toAddress)(B))?s.types.EncodingType.BASE16:s.types.EncodingType.BASE58}}return Object.keys(T).forEach(j=>{Object.values(s.types[`${(0,i.default)(d[j]||j)}Type`]).includes(T[j])===!1&&delete T[j]}),T}catch{return T}};D.toTypeInfo=x;const k=B=>{const T=x(B);return Object.keys(T).reduce((j,O)=>{const b=s.types[`${(0,i.default)(d[O]||O)}Type`];return j[O]=Object.keys(b).find(v=>b[v]===T[O]),j},{})};return D.toTypeInfoStr=k,D}var Zt;function jn(){return Zt||(Zt=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DID_TYPE_PASSKEY=e.DID_TYPE_ETHEREUM=e.DID_TYPE_ARCBLOCK=e.DID_PREFIX=e.DidType=e.fromTypeInfo=e.toTypeInfoStr=e.toTypeInfo=e.isEthereumType=e.isEthereumDid=e.isValid=e.isFromPublicKey=e.toDid=e.toAddress=e.fromHash=e.fromPublicKeyHash=e.fromPublicKey=e.fromSecretKey=e.toStrictHex=e.types=void 0;const o=Et();Object.defineProperty(e,"types",{enumerable:!0,get:function(){return o.types}});const i=J();Object.defineProperty(e,"toAddress",{enumerable:!0,get:function(){return i.toAddress}}),Object.defineProperty(e,"toDid",{enumerable:!0,get:function(){return i.toDid}});const u=Bn();Object.defineProperty(e,"DidType",{enumerable:!0,get:function(){return u.DidType}}),Object.defineProperty(e,"DID_TYPE_ARCBLOCK",{enumerable:!0,get:function(){return u.DID_TYPE_ARCBLOCK}}),Object.defineProperty(e,"DID_TYPE_ETHEREUM",{enumerable:!0,get:function(){return u.DID_TYPE_ETHEREUM}}),Object.defineProperty(e,"DID_TYPE_PASSKEY",{enumerable:!0,get:function(){return u.DID_TYPE_PASSKEY}}),Object.defineProperty(e,"fromTypeInfo",{enumerable:!0,get:function(){return u.fromTypeInfo}}),Object.defineProperty(e,"isEthereumDid",{enumerable:!0,get:function(){return u.isEthereumDid}}),Object.defineProperty(e,"isEthereumType",{enumerable:!0,get:function(){return u.isEthereumType}}),Object.defineProperty(e,"toTypeInfo",{enumerable:!0,get:function(){return u.toTypeInfo}}),Object.defineProperty(e,"toTypeInfoStr",{enumerable:!0,get:function(){return u.toTypeInfoStr}});const a=Ur();Object.defineProperty(e,"DID_PREFIX",{enumerable:!0,get:function(){return a.DID_PREFIX}}),Object.defineProperty(e,"toStrictHex",{enumerable:!0,get:function(){return a.toStrictHex}});const s=(c,l)=>{const h=(0,u.DidType)(l),S=(0,o.getSigner)(h.pk).getPublicKey(c);return p(S.indexOf("0x")===0?S:`0x${S}`,h)};e.fromSecretKey=s;const p=(c,l)=>{const h=(0,u.DidType)(l),_=(0,o.getHasher)(h.hash)(c,1);return d(_,h)};e.fromPublicKey=p;const d=(c,l)=>{const h=(0,u.DidType)(l),S=(0,i.stripHexPrefix)(c).slice(0,40),_=(0,o.getHasher)(h.hash),H=(0,u.fromTypeInfo)(h),x=(0,i.stripHexPrefix)(_(`0x${H}${S}`,1)).slice(0,8),k=`0x${H}${S}${x}`;return(0,u.isEthereumType)(h)?(0,u.toChecksumAddress)(`0x${c.slice(-40)}`):h.address===o.types.EncodingType.BASE58?(0,i.toBase58)(k):k};e.fromPublicKeyHash=d;const y=(c,l=o.types.RoleType.ROLE_ACCOUNT)=>{const h=Object.keys(o.types.RoleType),S=Object.values(o.types.RoleType);if(S.indexOf(l)===-1)throw new Error(`Unsupported role type ${l} when gen ddi from hash`);const _=(0,u.DidType)({role:o.types.RoleType[h[S.indexOf(l)]]});return d(c,_)};e.fromHash=y;const g=(c,l)=>{if(n(c)===!1)return!1;const h=(0,u.toTypeInfo)(c),S=p(l,h),_=c.replace(a.DID_PREFIX,"");return S===_};e.isFromPublicKey=g;const n=c=>{if(!c)return!1;const l=(0,i.toAddress)(String(c)),{hash:h}=(0,u.toTypeInfo)(l);if(typeof h>"u")return!1;if((0,u.isEthereumDid)(l))return!0;const S=(0,o.getHasher)(h),_=(0,a.toBytes)(l),H=(0,a.toStrictHex)(C.from(_.slice(0,22)).toString("hex")),x=(0,a.toStrictHex)(C.from(_.slice(22,26)).toString("hex")),k=(0,i.stripHexPrefix)(S(`0x${H}`,1)).slice(0,8);return x===k};e.isValid=n}(ct)),ct}var Qt;function vn(){if(Qt)return Y;Qt=1,Object.defineProperty(Y,"__esModule",{value:!0}),Y.WalletType=void 0,Y.Wallet=u,Y.fromSecretKey=a,Y.fromPublicKey=s,Y.fromAddress=p,Y.fromRandom=d,Y.fromJSON=y,Y.isValid=g;const e=J(),o=Et(),i=jn();Y.WalletType=i.DidType;function u(n,c="default"){const l=(0,i.DidType)(c),h=(0,o.getSigner)(l.pk),S=(0,o.getHasher)(l.hash);return{type:l,secretKey:n.sk,publicKey:n.pk,address:n.pk?(0,i.fromPublicKey)(n.pk,l):n.address,hash(_,H=1,x="hex"){return S(_,H,x)},sign(_,H=!0,x="hex"){if(!n.sk)throw new Error("Cannot sign data without a secretKey");if(H){const k=S(_,1);return h.sign(k,n.sk,x)}return h.sign(_,n.sk,x)},async verify(_,H,x=!0,k){if(!n.pk)throw new Error("Cannot verify data without a publicKey");const B=x?S(_,1):_;return h.verify(B,H,n.pk,k)},ethHash(_){if(typeof h.ethHash!="function")throw new Error("ethHash is not supported by signer");return h.ethHash(_)},ethSign(_,H=!0){if(!n.sk)throw new Error("Cannot sign data without a secretKey");if(typeof h.ethHash!="function")throw new Error("ethSign is not supported by signer");return H?h.ethSign(h.ethHash(_),(0,e.toHex)(n.sk)):h.ethSign(_,(0,e.toHex)(n.sk))},ethVerify(_,H,x=!0){if(typeof h.ethHash!="function")throw new Error("ethVerify is not supported by signer");const k=x?h.ethHash(_):_;return h.ethRecover(k,H)===this.address},toAddress(){return n.pk?(0,i.fromPublicKey)(n.pk,l):n.address},toJSON(){return{type:i.DidType.toJSON(l),sk:(0,e.toHex)(n.sk),pk:(0,e.toHex)(n.pk),address:this.address}}}}function a(n,c="default"){const l=(0,i.DidType)(c),h={sk:n,pk:(0,o.getSigner)(l.pk).getPublicKey(n)};return u(h,l)}function s(n,c="default"){return u({pk:n},(0,i.DidType)(c))}function p(n){return u({address:(0,i.toAddress)(n)},(0,i.toTypeInfo)(n))}function d(n="default"){const c=(0,i.DidType)(n),h=(0,o.getSigner)(c.pk).genKeyPair();return u({sk:h.secretKey,pk:h.publicKey},c)}function y(n){const c=i.DidType.fromJSON(n.type);return u(n,c)}function g(n,c=!0){return!(!n||typeof n!="object"||typeof n.verify!="function"||typeof n.toAddress!="function"||typeof n.toJSON!="function"||!n.type||!n.publicKey||c&&(!n.secretKey||typeof n.sign!="function"))}return Y}var lt,er;function wn(){if(er)return lt;er=1;const e=tn(),o=gn(),{fromSecretKey:i,WalletType:u}=vn(),{isHexStrict:a,toHex:s,toBuffer:p,stripHexPrefix:d}=se(),{types:y}=o;return lt={fromAppDid:(n,c,l={role:y.RoleType.ROLE_ACCOUNT},h=0)=>{if(!c)throw new Error("Cannot get user wallet with empty root sk");const S=o.Hasher.SHA3.hash256(p(n)),_=d(S).slice(0,16),H=_.slice(0,8),x=_.slice(8,16),k=parseInt(+`0x${H}`,10)&2147483647,B=parseInt(+`0x${x}`,10)&2147483647,T=d(a(c)?c:s(c)),j=e.fromMasterSeed(C.from(T,"hex")),O=`m/44'/260'/${k}'/${B}'/${h}`,b=j.derive(O),v=u(l),{pk:P=y.KeyType.ED25519}=v;let A;return P===y.KeyType.ED25519?A=o.Signer.Ed25519.genKeyPair("hex",b.privateKey).secretKey:A=s(b.privateKey),P===y.KeyType.ETHEREUM&&(A=A.slice(0,66)),i(A,v)}},lt}var Or=wn();const Un={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function Ar({onCreated:e,onClose:o}){const[i,u]=I.useState(!1),{t:a,locale:s}=$e(),{api:p}=Re(),{teamDid:d}=ke(),{control:y,handleSubmit:g,formState:{errors:n},watch:c,setValue:l}=jr({defaultValues:Un,mode:"onChange"}),h=c("scope"),S=H=>{H!=="profile:read"&&l("scope",h.includes(H)?h.filter(x=>x!==H):[...h,H])},_=async H=>{u(!0);try{const x={...H,redirectUris:H.redirectUris,contacts:H.contacts?H.contacts.split(",").map(k=>k.trim()):[],scope:H.scope.join(" ")};await p.createOAuthClient({input:{teamDid:d,input:Qr(x,en)}}),e(x)}catch(x){Ke.error(x.message||"Failed to create OAuth App")}finally{u(!1)}};return r.jsxs(dt,{open:!0,onClose:o,maxWidth:"md",fullWidth:!0,children:[r.jsxs(ht,{children:[a("oauth.client.register")," ",r.jsx(pt,{onClick:o,sx:{position:"absolute",right:8,top:8},children:r.jsx(yt,{})})]}),r.jsx(mt,{children:r.jsxs(_e,{spacing:4,sx:{mt:2},children:[r.jsx(X,{variant:"h6",gutterBottom:!0,children:a("oauth.client.requiredInformation")}),r.jsx(R,{children:r.jsx(z,{name:"clientName",control:y,rules:{required:a("oauth.client.validate.clientName"),minLength:{value:3,message:a("oauth.client.validate.clientNameMinLength")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.name"),required:!0,fullWidth:!0,placeholder:a("oauth.client.input.clientNamePlaceholder"),error:!!n.clientName,helperText:n.clientName?.message}),r.jsx(M,{children:a("oauth.client.helperText.clientName")})]})})}),r.jsx(R,{children:r.jsx(z,{name:"clientUri",control:y,rules:{required:a("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:a("oauth.client.validate.clientUriInvalid")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:a("oauth.client.input.clientUriPlaceholder"),error:!!n.clientUri,helperText:n.clientUri?.message}),r.jsx(M,{children:a("oauth.client.helperText.clientUri")})]})})}),r.jsx(R,{children:r.jsx(z,{name:"redirectUris",control:y,rules:{required:a("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:a("oauth.client.validate.redirectUrisInvalid")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:a("oauth.client.input.redirectUrisPlaceholder"),error:!!n.redirectUris,helperText:n.redirectUris?.message}),r.jsxs(R,{sx:{display:"flex",gap:"2px"},children:[r.jsx(M,{children:a("oauth.client.helperText.redirectUris")}),r.jsx(M,{children:a("oauth.client.helperText.read")}),r.jsx(M,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:a("oauth.client.helperText.document")}),r.jsx(M,{children:a("oauth.client.helperText.more")})]})]})})}),r.jsxs(Wr,{variant:"outlined",sx:{p:2,display:"none"},children:[r.jsx(X,{variant:"subtitle2",gutterBottom:!0,children:a("oauth.client.input.permissions")}),r.jsx(R,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:r.jsx(br,{children:Object.entries(ie.OAUTH_SCOPES).map(([H,x])=>r.jsx(Sr,{control:r.jsx(Er,{checked:h.includes(H),onChange:()=>S(H),disabled:H==="profile:read",color:"primary"}),label:r.jsx(R,{children:r.jsx(X,{variant:"body2",sx:{fontWeight:500},children:x})})},H))})})]}),r.jsx(gt,{}),r.jsx(X,{variant:"h6",gutterBottom:!0,children:a("oauth.client.optionalInformation")}),r.jsx(_e,{children:r.jsx(z,{name:"contacts",control:y,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:a("oauth.client.validate.contacts")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.contacts"),fullWidth:!0,placeholder:a("oauth.client.input.contactsPlaceholder"),error:!!n.contacts,helperText:n.contacts?.message}),r.jsx(M,{children:a("oauth.client.helperText.contacts")})]})})}),r.jsxs(_e,{direction:{xs:"column",sm:"row"},spacing:2,children:[r.jsx(z,{name:"tosUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:a("oauth.client.validate.tosUriInvalid")}},render:({field:H})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.tosUri"),fullWidth:!0,placeholder:a("oauth.client.input.tosUriPlaceholder"),error:!!n.tosUri,helperText:n.tosUri?.message}),r.jsx(M,{children:a("oauth.client.helperText.tosUri")})]})}),r.jsx(z,{name:"policyUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:a("oauth.client.validate.policyUriInvalid")}},render:({field:H})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.policyUri"),fullWidth:!0,placeholder:a("oauth.client.input.policyUriPlaceholder"),error:!!n.policyUri,helperText:n.policyUri?.message}),r.jsx(M,{children:a("oauth.client.helperText.policyUri")})]})})]}),n.error&&r.jsx(xr,{severity:"error",children:n.error.message})]})}),r.jsxs(Tr,{children:[r.jsx(je,{onClick:o,children:a("common.cancel")}),r.jsxs(je,{onClick:g(_),disabled:i,variant:"contained",color:"primary",children:[i?r.jsx(_t,{size:20,sx:{mr:1}}):null,a("oauth.client.registerButton")]})]})]})}Ar.propTypes={onCreated:w.func.isRequired,onClose:w.func.isRequired};function xt({scope:e="",...o}){if(!e)return null;const i=e.split(" ").filter(Boolean);return r.jsx(_e,{direction:"row",...o,sx:[{flexWrap:"wrap",gap:1},...Array.isArray(o.sx)?o.sx:[o.sx]],children:i.map(u=>r.jsx(Kr.Fragment,{children:r.jsx(Vr,{title:ie.OAUTH_SCOPES[u],children:r.jsx(q,{children:u})})},u))})}xt.propTypes={scope:w.string};const Tt=e=>{const{prefix:o}=Re(),{blocklet:i}=rn(),u=Ht(o,"/api/media/upload",i.appPid),a=I.useCallback(p=>p?p.startsWith("http")?p:`${Ht(o,"/api/media/upload",i.appPid)}/${p}`:"",[o,i.appPid]);return{clientLogoUrl:I.useMemo(()=>a(e),[e,a]),apiPath:u,getClientLogoUrl:a}},On=I.lazy(()=>qr(()=>import("./index-cZALvweI.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.Uploader})));function Pr({client:e,onUpdate:o,onClose:i}){const[u,a]=I.useState(!1),{t:s,locale:p}=$e(),d=I.useRef(null),{api:y}=Re(),{teamDid:g}=ke(),{control:n,handleSubmit:c,formState:{errors:l},watch:h,setValue:S,getValues:_}=jr({defaultValues:{clientName:e.clientName||"",clientUri:e.clientUri||"",redirectUris:Array.isArray(e.redirectUris)?e.redirectUris.join(","):"",scope:e.scope?e.scope.split(" "):["profile:read"],contacts:Array.isArray(e.contacts)?e.contacts.join(","):"",tosUri:e.tosUri||"",policyUri:e.policyUri||"",logoUri:e.logoUri||"",clientSecretExpiresAt:e.clientSecretExpiresAt||null},mode:"onChange"}),H=h("scope"),x=h("logoUri"),{clientLogoUrl:k,apiPath:B}=Tt(x),T=b=>{b!=="profile:read"&&S("scope",H.includes(b)?H.filter(v=>v!==b):[...H,b])},j=async b=>{const v={clientId:e.clientId,clientName:b.clientName.trim(),clientUri:b.clientUri,redirectUris:b.redirectUris.split(",").map(P=>P.trim()).filter(Boolean),contacts:b.contacts?b.contacts.split(",").map(P=>P.trim()):[],scope:b.scope.join(" "),tosUri:b.tosUri,policyUri:b.policyUri,logoUri:b.logoUri,clientSecretExpiresAt:b.clientSecretExpiresAt?parseInt(b.clientSecretExpiresAt/1e3,10):null};await y.updateOAuthClient({input:{teamDid:g,input:v}})},O=async b=>{a(!0);try{await j(b),o(),i()}catch(v){Ke.error(v.message||s("oauth.client.updateFailed"))}finally{a(!1)}};return r.jsxs(dt,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[r.jsxs(ht,{children:[s("oauth.client.update")," ",r.jsx(pt,{onClick:i,sx:{position:"absolute",right:8,top:8},children:r.jsx(yt,{})})]}),r.jsx(mt,{children:r.jsxs(_e,{spacing:3,sx:{mt:2},children:[r.jsxs(R,{sx:{mb:3},children:[r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),r.jsxs(R,{children:[r.jsx(R,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:k?r.jsx(R,{children:r.jsx("img",{src:k,alt:"client-logo",style:{width:"100%",height:"100%"}})}):r.jsx(R,{onClick:()=>{d.current?.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:r.jsx(Hr,{sx:{fontSize:40,color:"common.white"}})})}),r.jsx(je,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{d.current?.open()},children:s(k?"common.change":"common.upload")})]}),r.jsx(R,{sx:{display:"flex",alignItems:"center"},children:r.jsx(I.Suspense,{fallback:r.jsx(sn,{}),children:r.jsx(On,{ref:d,locale:p,popup:!0,onUploadFinish:b=>{S("logoUri",b.data.filename),j(_()).then(()=>{o()}).catch(v=>{Ke.error(v.message||s("oauth.client.updateFailed"))}).finally(()=>{d.current?.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:B,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),r.jsx(V,{label:"Client Id",fullWidth:!0,value:e.clientId,disabled:!0}),r.jsx(R,{children:r.jsx(z,{name:"clientName",control:n,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!l.clientName,helperText:l.clientName?.message}),r.jsx(M,{children:s("oauth.client.helperText.clientName")})]})})}),r.jsx(R,{children:r.jsx(z,{name:"clientUri",control:n,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!l.clientUri,helperText:l.clientUri?.message}),r.jsx(M,{children:s("oauth.client.helperText.clientUri")})]})})}),r.jsx(R,{children:r.jsx(z,{name:"redirectUris",control:n,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!l.redirectUris,helperText:l.redirectUris?.message}),r.jsx(M,{children:s("oauth.client.helperText.redirectUris")})]})})}),r.jsx(z,{name:"clientSecretExpiresAt",control:n,render:({field:b})=>r.jsx(nn,{placeholder:s("oauth.client.input.expireTime"),value:b.value*1e3,onChange:v=>{b.onChange(v)}})}),r.jsxs(R,{sx:{display:"none"},children:[r.jsx(X,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),r.jsx(R,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:r.jsx(br,{children:Object.entries(ie.OAUTH_SCOPES).map(([b,v])=>r.jsx(Sr,{control:r.jsx(Er,{checked:H.includes(b),onChange:()=>T(b),disabled:b==="profile:read",color:"primary"}),label:r.jsx(R,{children:r.jsx(X,{variant:"body2",sx:{fontWeight:500},children:v})})},b))})})]}),r.jsx(gt,{}),r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),r.jsx(R,{children:r.jsx(z,{name:"contacts",control:n,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!l.contacts,helperText:l.contacts?.message}),r.jsx(M,{children:s("oauth.client.helperText.contacts")})]})})}),r.jsxs(_e,{direction:{xs:"column",sm:"row"},spacing:2,children:[r.jsx(z,{name:"tosUri",control:n,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:b})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{...b,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!l.tosUri,helperText:l.tosUri?.message}),r.jsx(M,{children:s("oauth.client.helperText.tosUri")})]})}),r.jsx(z,{name:"policyUri",control:n,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:b})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{...b,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!l.policyUri,helperText:l.policyUri?.message}),r.jsx(M,{children:s("oauth.client.helperText.policyUri")})]})})]}),l.error&&r.jsx(xr,{severity:"error",children:l.error.message})]})}),r.jsxs(Tr,{children:[r.jsx(je,{onClick:i,children:s("common.cancel")}),r.jsx(je,{onClick:c(O),disabled:u,variant:"contained",color:"primary",children:u?r.jsx(_t,{size:16}):s("common.update")})]})]})}Pr.propTypes={client:w.shape({clientId:w.string.isRequired,clientName:w.string.isRequired,clientUri:w.string,redirectUris:w.arrayOf(w.string),scope:w.string,contacts:w.arrayOf(w.string),tosUri:w.string,policyUri:w.string,logoUri:w.string,clientSecretExpiresAt:w.number}).isRequired,onUpdate:w.func.isRequired,onClose:w.func.isRequired};function $r({client:e,onUpdate:o,onClose:i}){return r.jsx(Pr,{client:e,onUpdate:u=>o(u),onClose:i})}$r.propTypes={client:w.shape({clientId:w.string.isRequired,clientName:w.string.isRequired,clientUri:w.string,redirectUris:w.arrayOf(w.string),scope:w.string,contacts:w.arrayOf(w.string),tosUri:w.string,policyUri:w.string,logoUri:w.string,clientSecretExpiresAt:w.number}).isRequired,onUpdate:w.func.isRequired,onClose:w.func.isRequired};function Rr({clientId:e,clientName:o,onDelete:i=()=>{},onClose:u=()=>{}}){const{t:a}=$e(),{api:s}=Re(),{teamDid:p}=ke(),d=()=>{u()},y=async()=>{try{await s.deleteOAuthClient({input:{teamDid:p,clientId:e}}),i()}catch(n){Ke.error(n?.message)}finally{d()}},g={keyName:o,title:a("oauth.client.delete.title"),description:a("oauth.client.delete.description",{name:`<b>${o}</b>`}),confirmPlaceholder:a("oauth.client.delete.description",{name:o}),confirm:a("common.delConfirm"),cancel:a("common.cancel"),onConfirm:y,onCancel:d};return r.jsx(on,{keyName:g.keyName,title:g.title,description:g.description,confirmPlaceholder:g.confirmPlaceholder,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})}Rr.propTypes={clientId:w.string.isRequired,clientName:w.string.isRequired,onDelete:w.func,onClose:w.func};function kr({title:e,items:o}){return r.jsxs(R,{sx:{mb:3},children:[r.jsx(X,{variant:"h6",sx:{mb:1.5},children:e}),r.jsx(_e,{spacing:1.5,children:o.map(({label:i,value:u})=>r.jsxs(R,{sx:{display:"flex",alignItems:"center",gap:2},children:[r.jsx(X,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),r.jsx(X,{sx:{wordBreak:"break-all"},children:u||"-"})]},i))})]})}kr.propTypes={title:w.string.isRequired,items:w.arrayOf(w.shape({label:w.string.isRequired,value:w.any})).isRequired};function Cr({client:e,onClose:o}){const{t:i,locale:u}=$e(),{teamDid:a}=ke(),{clientName:s,clientId:p,clientSecret:d,redirectUris:y,scope:g,clientUri:n,logoUri:c,contacts:l,tosUri:h,policyUri:S,jwksUri:_,jwks:H,softwareId:x,softwareVersion:k,clientIdIssuedAt:B,clientSecretExpiresAt:T,updatedAt:j,createUser:O}=e,{clientLogoUrl:b}=Tt(c),v=K=>{try{const ee=new URL(window.blocklet.appUrl);return ee.pathname=K,ee.toString()}catch{return"-"}},P=Or.fromAppDid(p,a),A=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:s},{label:i("oauth.client.logoUri"),value:r.jsx(_r,{variant:"rounded",shape:"square",src:b,did:P.address,size:64})},{label:i("oauth.client.clientUri"),value:n?r.jsx(q,{children:n}):"-"},{label:i("oauth.client.clientId"),value:r.jsx(q,{children:p})},{label:i("oauth.client.clientSecret"),value:r.jsx(q,{children:d})},{label:i("oauth.client.redirectUris"),value:r.jsx(q,{children:(y||[]).join(", ")})},{label:i("oauth.client.scope"),value:r.jsx(xt,{scope:g})},{label:i("oauth.client.createUser"),value:O?an(O,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:r.jsx(q,{children:v("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:l.length?r.jsx(q,{children:(l||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:h?r.jsx(q,{children:h}):"-"},{label:i("oauth.client.policyUri"),value:S?r.jsx(q,{children:S}):"-"},{label:i("oauth.client.jwksUri"),value:_},{label:i("oauth.client.jwks"),value:H},{label:i("oauth.client.softwareId"),value:x},{label:i("oauth.client.softwareVersion"),value:k}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:B?r.jsx(Ne,{value:B*1e3,type:"all",locale:u}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:T?r.jsx(Ne,{value:T*1e3,type:"all",locale:u}):"-"},{label:i("common.updatedAt"),value:j?r.jsx(Ne,{value:j,type:"all",locale:u}):"-"}]}].filter(Boolean);return r.jsxs(dt,{open:!0,onClose:o,maxWidth:"lg",fullWidth:!0,children:[r.jsxs(ht,{children:[i("oauth.client.oauthAppDetails"),r.jsx(pt,{onClick:o,sx:{position:"absolute",right:8,top:8},children:r.jsx(yt,{})})]}),r.jsx(mt,{children:r.jsx(R,{sx:{mt:1},children:A.map((K,ee)=>r.jsxs(R,{children:[r.jsx(kr,{title:K.title,items:K.items}),ee!==A.length-1&&r.jsx(gt,{sx:{my:2}})]},K.title))})})]})}Cr.propTypes={client:w.object.isRequired,onClose:w.func.isRequired};function An(e){return r.jsx(Ne,{value:e*1e3})}function Dr({selected:e=null,onClose:o}){return e?r.jsx(Cr,{client:e,onClose:o}):null}Dr.propTypes={selected:w.object,onClose:w.func.isRequired};function Nr({open:e,onCreated:o,onClose:i}){return e?r.jsx(Ar,{onCreated:o,onClose:i}):null}Nr.propTypes={open:w.bool.isRequired,onCreated:w.func.isRequired,onClose:w.func.isRequired};function fi(){const[e,o]=I.useState({searchText:"",pageSize:10,page:1}),[i,u]=I.useState(null),[a,s]=I.useState(!1),p=I.useRef(null),{t:d,locale:y}=$e(),{api:g}=Re(),{teamDid:n}=ke(),[c,l]=I.useState(null),[h,S]=I.useState(null),_=ln(),{getClientLogoUrl:H}=Tt(),x=Zr(async()=>await g.getOAuthClients({input:{teamDid:n,paging:{page:e.page,pageSize:e.pageSize}}}),[e.page,e.pageSize]),{loading:k}=x,B=I.useMemo(()=>x.value?.list||[],[x.value?.list]),T=I.useMemo(()=>e.searchText?B.filter(b=>b.clientName.toLowerCase().includes(e.searchText.toLowerCase())||b.clientId.toLowerCase().includes(e.searchText.toLowerCase())||b.scope.toLowerCase().includes(e.searchText.toLowerCase())):B,[e.searchText,B]),j=I.useMemo(()=>[{label:d("oauth.client.name"),name:"clientName",options:{customBodyRender:(b,{rowIndex:v})=>{const P=T[v],A=H(P.logoUri),K=Or.fromAppDid(P.clientId,n);return r.jsx(R,{sx:{display:"flex",alignItems:"center",gap:2},children:r.jsxs(R,{sx:{display:"flex",alignItems:"center",gap:2,cursor:"pointer"},children:[r.jsx(_r,{variant:"rounded",shape:"square",did:K.address,src:A,size:48}),r.jsxs(_e,{sx:{gap:.5},children:[r.jsx(R,{sx:{color:"text.primary"},children:P.clientName}),r.jsx(R,{sx:{color:"text.secondary"},children:P.clientUri})]})]})})}}},{label:d("oauth.client.clientId"),name:"clientId"},{label:d("oauth.client.scope"),name:"scope",options:{customBodyRender:b=>r.jsx(xt,{scope:b})}},{label:d("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:An}},{label:d("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:b=>b?r.jsx(Xr,{showDid:!0,did:b,cardType:Gr.Detailed,infoType:Jr.Minimal,sx:{border:0,padding:0}}):d("oauth.client.openRegistration")}},{label:d("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(b,{rowIndex:v})=>{const P=T[v];return r.jsx(cn,{actions:[{icon:r.jsx(zr,{}),text:d("common.edit"),onClick:A=>{A.stopPropagation(),l(P)}},{icon:r.jsx(Yr,{}),text:d("common.delete"),onClick:A=>{A.stopPropagation(),S(P)}}]})}}}],[T,d,H,n,l,S]),O=({page:b,rowsPerPage:v,searchText:P})=>{e.pageSize!==v?o(A=>({...A,searchText:"",pageSize:v,page:1})):e.page!==b+1?o(A=>({...A,searchText:"",page:b+1})):e.searchText!==P&&o(A=>({...A,searchText:P,page:1}))};return r.jsxs(R,{ref:p,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[_?r.jsx(Bt,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}):null,r.jsx(Mr,{data:T,columns:j,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:e.page-1,rowsPerPage:e.pageSize,count:T.length,searchDebounceTime:400,onRowClick(b,{dataIndex:v},P){if(p.current?.contains(P.target)){const A=T[v];u(A)}}},onChange:O,title:_?null:r.jsx(Bt,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}),customButtons:[r.jsxs(je,{variant:"contained",size:"small",onClick:()=>s(!0),children:[k?r.jsx(_t,{size:16}):r.jsx(Hr,{style:{fontSize:16}}),d("common.create")]},"add")],loading:!1,emptyNode:r.jsx(Fr,{children:d("oauth.client.empty")})}),r.jsx(Dr,{selected:i,onClose:()=>u(null)}),r.jsx(Nr,{open:a,onCreated:()=>{s(!1),x.retry()},onClose:()=>s(!1)}),c&&r.jsx($r,{client:c,onUpdate:x.retry,onClose:()=>l(null)}),h&&r.jsx(Rr,{...h,onDelete:x.retry,onClose:()=>S(null)})]})}export{fi as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./vendor-mui-core-C_NjJRjl.js";import"./vendor-react-Dvs43sk9.js";import{S as t}from"./studio-CBJGdxxo.js";import"./vendor-ux-JmtAaYLa.js";import"./vendor-utils-Gk-1qvTR.js";import"./vendor-hooks-Bm2oaDgr.js";import"./lottie-web-4koyQiv_.js";import"./index-Cs2FIJbg.js";import"./index-DgDvwRqt.js";import"./vendor-arcblock-DbQi15Va.js";function f(){return o.jsx(t,{children:"Coming soon..."})}export{f as default};
|