@abtnode/blocklet-services 1.16.44-beta-20250524-065731-c62fd374 → 1.16.44-beta-20250526-130644-5e05dc90
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/util/index.js +6 -0
- package/dist/assets/{AdapterDayjs-DnsMePpQ.js → AdapterDayjs-Bs_Q9JXL.js} +1 -1
- package/dist/assets/{ArrowDropDown-Dzy2X1bv.js → ArrowDropDown-DUn14Acv.js} +1 -1
- package/dist/assets/{CheckCircle-DA1-Q3VQ.js → CheckCircle-DsdIIzds.js} +1 -1
- package/dist/assets/{ChevronLeft-C7-bj_BM.js → ChevronLeft-BXDIS6AE.js} +1 -1
- package/dist/assets/{ChevronRight-CA18V4hg.js → ChevronRight-BfSAowju.js} +1 -1
- package/dist/assets/{DeleteOutline-DIXSGJ49.js → DeleteOutline-lCPjjhKz.js} +1 -1
- package/dist/assets/{Done-BHbsILFJ.js → Done-BoNuG9Iy.js} +1 -1
- package/dist/assets/{Download-CmhNaqwS.js → Download-4NCgy4QK.js} +1 -1
- package/dist/assets/{Edit-CNRD5aKM.js → Edit-BqpcPg9o.js} +1 -1
- package/dist/assets/{Error-DDQf7Wzw.js → Error-B7SzGNr8.js} +1 -1
- package/dist/assets/{ExpandLess-D15nWpBQ.js → ExpandLess-EFI-Ij5Y.js} +1 -1
- package/dist/assets/{Google-BEEvQjkX.js → Google-DYpd3dQM.js} +1 -1
- package/dist/assets/{Home-C8za96Ud.js → Home-Ccm-s4KT.js} +1 -1
- package/dist/assets/{InfoOutlined-Cxpk0UTX.js → InfoOutlined-Duq1UDPu.js} +1 -1
- package/dist/assets/{Launch-CKr_eo1b.js → Launch-ipC6Ic2p.js} +1 -1
- package/dist/assets/{LaunchOutlined-Drryv7vp.js → LaunchOutlined-C-M166rt.js} +1 -1
- package/dist/assets/{MoreHoriz-CKCGMlB8.js → MoreHoriz-jwSUI8G2.js} +1 -1
- package/dist/assets/{PlayArrow-CrmMAssx.js → PlayArrow-Cv1uXXJt.js} +1 -1
- package/dist/assets/{TuneOutlined-Dp4gMD_8.js → TuneOutlined-BvxrpP1M.js} +1 -1
- package/dist/assets/{ViewList-ByzGtByR.js → ViewList-PrXAmQts.js} +1 -1
- package/dist/assets/{access-control-CHRw2bbp.js → access-control-Dvlg7x0h.js} +1 -1
- package/dist/assets/{actions-XNIU_ion.js → actions-BA8hCarh.js} +1 -1
- package/dist/assets/{add-component-core-eEjKF53n.js → add-component-core-RTpy3oS3.js} +1 -1
- package/dist/assets/{add-resource-W-ML3m5q.js → add-resource-DKnJ3N_A.js} +1 -1
- package/dist/assets/{addon-DGwzoD-f.js → addon-DmglQWiB.js} +1 -1
- package/dist/assets/{advanced-CPhRkaAJ.js → advanced-CzssFl-I.js} +1 -1
- package/dist/assets/{appearance-Bgtb4-LE.js → appearance-DIaCQMdO.js} +1 -1
- package/dist/assets/{audit-logs-DCTnwVQT.js → audit-logs-BwUEGKxZ.js} +1 -1
- package/dist/assets/{authorize-0cAl16_K.js → authorize-DqVeyhPc.js} +1 -1
- package/dist/assets/{base32-DEQDAhbh.js → base32-D35YSxth.js} +1 -1
- package/dist/assets/{branding-6OsQw5QJ.js → branding-D9cgoVZN.js} +2 -2
- package/dist/assets/{branding-Bv8Tk-Am.js → branding-yRBlkhNg.js} +1 -1
- package/dist/assets/{bundle-avatar-WoSDDX0E.js → bundle-avatar-BP8xFngr.js} +1 -1
- package/dist/assets/{button-D7WVH4Bm.js → button-Da_a32NC.js} +1 -1
- package/dist/assets/{click-to-copy-DsH0RQVg.js → click-to-copy-B26zKr7i.js} +1 -1
- package/dist/assets/{collapse-DRHShQoZ.js → collapse-BF9pIOsL.js} +1 -1
- package/dist/assets/{complete-BJLGhmnP.js → complete-BFgID4Zc.js} +1 -1
- package/dist/assets/{component-BFi7evus.js → component-ESUBkOno.js} +1 -1
- package/dist/assets/{config-BfjiZ8-q.js → config-Bt_JcEZR.js} +1 -1
- package/dist/assets/config-navigation-Dyu8rgOf.js +26 -0
- package/dist/assets/{config-C77UXU2G.js → config-rMbgmGkF.js} +1 -1
- package/dist/assets/{config-space-DID86BbB.js → config-space-D2Cjeyk0.js} +1 -1
- package/dist/assets/{confirm-BnRcXvxs.js → confirm-CiiHIA-a.js} +1 -1
- package/dist/assets/{connect-DJCBGsCy.js → connect-Druwkt_h.js} +1 -1
- package/dist/assets/connect-QKA3Mcyx.js +5 -0
- package/dist/assets/{connect-to-BYS6M9JU.js → connect-to-BLuNgRR8.js} +1 -1
- package/dist/assets/{dashboard-RTzIKcnI.js → dashboard-vkFEu-wZ.js} +13 -13
- package/dist/assets/{delete-confirm-2yiel8lV.js → delete-confirm-BPtFZ4JP.js} +1 -1
- package/dist/assets/{did-address-2a_50VlM.js → did-address-BtAnHi7m.js} +1 -1
- package/dist/assets/domain-CSsoH0JI.js +9 -0
- package/dist/assets/{domain-action-card-CLEjpu-P.js → domain-action-card-CEIB4y6O.js} +1 -1
- package/dist/assets/domains-DySxSy7r.js +1 -0
- package/dist/assets/dot-DX56IFTM.js +7 -0
- package/dist/assets/{email-9sDMxuoB.js → email-D6f0kuZJ.js} +1 -1
- package/dist/assets/{exchange-passport-CzmhafoN.js → exchange-passport-CyZiYD_w.js} +1 -1
- package/dist/assets/{fuel-D_QIEw1n.js → fuel-BzVicj7n.js} +1 -1
- package/dist/assets/{gen-access-key-BmDWpAif.js → gen-access-key-DiLTrx9k.js} +1 -1
- package/dist/assets/{get-safe-url-BdFxF8pA.js → get-safe-url-CiQ8_q49.js} +1 -1
- package/dist/assets/{get-safe-url-DfW-qoLB.js → get-safe-url-DSt3eVbO.js} +1 -1
- package/dist/assets/{home-DtVAZY8s.js → home-AVCu7DmN.js} +1 -1
- package/dist/assets/{iframe-dmrNn49R.js → iframe-CJ1Wo1WH.js} +1 -1
- package/dist/assets/{index-CGHej0Ek.js → index-8lA5-nM7.js} +3 -3
- package/dist/assets/{index-DLdz4ykT.js → index-99E5Ux4J.js} +1 -1
- package/dist/assets/{index-BctwEFbW.js → index-B7Ih-tce.js} +1 -1
- package/dist/assets/{index-Z_7QgoWt.js → index-BDhncHq5.js} +1 -1
- package/dist/assets/{index-C5N0NjEs.js → index-BhMu-yLO.js} +1 -1
- package/dist/assets/{index-DtsBFtZP.js → index-Biu0_3VS.js} +1 -1
- package/dist/assets/{index-Bhwq-PC6.js → index-CCsDojsm.js} +1 -1
- package/dist/assets/index-CG5aY0sO.js +6 -0
- package/dist/assets/{index-CT4keHaK.js → index-CVeug3aj.js} +1 -1
- package/dist/assets/{index-CBALX7k4.js → index-Cj_-M8SX.js} +1 -1
- package/dist/assets/{index-DBBjaba5.js → index-CkuD5Vfn.js} +1 -1
- package/dist/assets/{index-CtxraYdM.js → index-CpRFDVw4.js} +1 -1
- package/dist/assets/{index-B6g_NzxF.js → index-DJzuhKQh.js} +4 -4
- package/dist/assets/{index-Dq_lSUqL.js → index-D_aS7-BV.js} +1 -1
- package/dist/assets/{index-B4rUFDP9.js → index-DeD4o13y.js} +1 -1
- package/dist/assets/{index-C2wxmxz2.js → index-IuBCAZn2.js} +1 -1
- package/dist/assets/{index-DdKYu9HL.js → index-Jryn5flm.js} +4 -4
- package/dist/assets/{index-D45FqXMt.js → index-XdA5ax9j.js} +1 -1
- package/dist/assets/{index-B4CzEaVv.js → index-hO3Mo-qi.js} +1 -1
- package/dist/assets/{index-iphP5FWX.js → index-nhpGyAFA.js} +1 -1
- package/dist/assets/{invitation-DG9MWQbS.js → invitation-CbZcjplG.js} +1 -1
- package/dist/assets/{invite-DLCj8sz9.js → invite-CG68Mxoz.js} +1 -1
- package/dist/assets/{issue-passport-BWxVIA89.js → issue-passport-3aP4u6AF.js} +1 -1
- package/dist/assets/{item-CUEEdtq7.js → item-DLwktWNI.js} +1 -1
- package/dist/assets/{landing-page-DErP-951.js → landing-page-B3KyXZXw.js} +1 -1
- package/dist/assets/{layout-BpHPXY7v.js → layout-BzSCNNrb.js} +1 -1
- package/dist/assets/{list-95F7XaG9.js → list-D29W3nMj.js} +1 -1
- package/dist/assets/{list-TUiipUoi.js → list-y33VQBpr.js} +2 -2
- package/dist/assets/localization-Y6Zfd1Kb.js +1 -0
- package/dist/assets/{log-aS7wDHYq.js → log-D5wtGlYv.js} +1 -1
- package/dist/assets/{logger-DRlJhYNs.js → logger-DTzDRWqY.js} +1 -1
- package/dist/assets/{login-BEhRbdo1.js → login-Bq9K3qHu.js} +1 -1
- package/dist/assets/{login-oauth-callback-T6cLlJXo.js → login-oauth-callback-DjqRVYt8.js} +1 -1
- package/dist/assets/{logo-uploader-CLz5RPTu.js → logo-uploader-B-RJuXxH.js} +3 -3
- package/dist/assets/{lost-passport-C2TUuANu.js → lost-passport-n3UXYXA8.js} +1 -1
- package/dist/assets/{open-window-xER4N-kf.js → open-window-Dyr68wBS.js} +1 -1
- package/dist/assets/{overview-CSLXBT0F.js → overview-C2L5ReTa.js} +1 -1
- package/dist/assets/{page-header-IRqa6Qvs.js → page-header-BS-digIw.js} +1 -1
- package/dist/assets/{passport-item-hLzOrz7-.js → passport-item-B9iOvD4Y.js} +1 -1
- package/dist/assets/{permission-BkpeOUF9.js → permission-CbTKdC7W.js} +1 -1
- package/dist/assets/{preferences-CaXn4vHX.js → preferences-DETzTJeF.js} +1 -1
- package/dist/assets/{profile-embed-DP-NpR-H.js → profile-embed-7uAZGWnU.js} +1 -1
- package/dist/assets/{publish-resource-BImGOxGu.js → publish-resource-Bk1sOsMC.js} +1 -1
- package/dist/assets/{react-beautiful-dnd.esm-CXMxXaUW.js → react-beautiful-dnd.esm-WW1RMrIr.js} +1 -1
- package/dist/assets/{runtime-BdS45sOH.js → runtime-CA329eRU.js} +1 -1
- package/dist/assets/sdk-Bxy9kDUo.js +1 -0
- package/dist/assets/{security-bFZAakv0.js → security-BYPCwU9I.js} +1 -1
- package/dist/assets/{session-E0e-X6-a.js → session-ugMCR4Iu.js} +1 -1
- package/dist/assets/setup-BuHGJK0U.js +30 -0
- package/dist/assets/{spaces-BKlIkPYo.js → spaces-CTEbtAyX.js} +1 -1
- package/dist/assets/{start-BXBhW0EF.js → start-Df7Wiv2W.js} +1 -1
- package/dist/assets/{starting-progress-CyKicFZc.js → starting-progress-Dvw39Hou.js} +1 -1
- package/dist/assets/{status-CIwF9IiE.js → status-CH0vjcu4.js} +1 -1
- package/dist/assets/{step-actions-Cy_Wn9XZ.js → step-actions-QyMIKyQA.js} +1 -1
- package/dist/assets/{studio-BSiEg8xP.js → studio-B1PGcNac.js} +1 -1
- package/dist/assets/{switch-control-DzZXz9Ks.js → switch-control-D5eJVUaV.js} +1 -1
- package/dist/assets/{table-tips-BP0JTpDH.js → table-tips-biAHyN1z.js} +1 -1
- package/dist/assets/{traffic-Bz2-5BjC.js → traffic-DVUW14yF.js} +1 -1
- package/dist/assets/{transfer-CZ88q7e8.js → transfer-CsdMd63R.js} +1 -1
- package/dist/assets/{unsubscribe-Dc0yE6SM.js → unsubscribe-1jeXeeTi.js} +1 -1
- package/dist/assets/{use-blocklet-logo-DeL5Lmpn.js → use-blocklet-logo-a8QJI4r-.js} +1 -1
- package/dist/assets/use-server-logo-CxuMvwKh.js +1 -1
- package/dist/assets/useAsync-Dv214fz8.js +1 -0
- package/dist/assets/useAsync-KYUBhVsb.js +1 -0
- package/dist/assets/{useLocalStorage-DvcK7KsP.js → useLocalStorage-BDA4jbwL.js} +1 -1
- package/dist/assets/{user-center-3TxDrG6m.js → user-center-BQcfE646.js} +3 -3
- package/dist/assets/{util-KGAW0YJ4.js → util-BwAoiA7E.js} +1 -1
- package/dist/assets/{util-IzAdTupy.js → util-D-q3oYk9.js} +1 -1
- package/dist/assets/{vendor-arcblock-CUb0jDdY.js → vendor-arcblock-5qqHEVGo.js} +4 -4
- package/dist/assets/{vendor-ux-did-connect-DprdyYny.js → vendor-ux-did-connect-DROQhYpS.js} +92 -92
- package/dist/assets/{wrap-locale-BjqARXGJ.js → wrap-locale-CvN5krOj.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/service-worker.js +1 -1
- package/package.json +31 -31
- package/dist/assets/config-navigation-BkfKynqT.js +0 -26
- package/dist/assets/connect-DyhNsjIB.js +0 -5
- package/dist/assets/domain-B7QeQ3KX.js +0 -9
- package/dist/assets/domains-Bu0iN_az.js +0 -1
- package/dist/assets/dot-itVN8XTt.js +0 -7
- package/dist/assets/index-Bw-rbXJI.js +0 -6
- package/dist/assets/localization-Dale72UG.js +0 -1
- package/dist/assets/sdk-DeUOtvaE.js +0 -1
- package/dist/assets/setup-DMmxE-ov.js +0 -30
- package/dist/assets/useAsync-510ntT1B.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as se,Z as U,c0 as Me,c1 as $e,I as K,b_ as Ve,b$ as Ne,ad as He,ac as Je,c2 as Ke,b4 as De,j as he,r as Pe,b2 as G,c3 as xe,am as ge,B as z,bN as Ge,a6 as Ze,c4 as Xe,a7 as Ye,a3 as Qe,a0 as et,as as Ce}from"./vendor-ux-did-connect-DprdyYny.js";import{u as p,a as ae,f as te,c as tt}from"./vendor-hooks-BgUTpb6X.js";import{r as A}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bs as _,bo as E,O,y as V,H,T as ne,I as oe,X as ie,ah as Oe,al as $,cI as nt,a9 as Be,e as je,ab as fe,a7 as ze,ad as st,be as at}from"./vendor-mui-core-BV2FUxWJ.js";import{a9 as rt,O as qe,X as ot,c as it}from"./vendor-arcblock-CUb0jDdY.js";import{J as Y,a8 as lt,c as Fe,D as ct,n as X,aJ as dt,A as ut,b as mt}from"./vendor-utils-rHXShPKm.js";import{D as J,G as N,aA as re,aB as L,aJ as Re}from"./index-B6g_NzxF.js";import{S as le}from"./switch-control-DzZXz9Ks.js";import{S as D}from"./section-BB6hVmdO.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-CBALX7k4.js";import{b as xt}from"./base32-DEQDAhbh.js";import{u as ft}from"./use-mobile-C21X4TYN.js";import"./lottie-web-jYmAQWuC.js";const ce={enabled:!1,domain:"",clientId:"",clientSecret:""};function gt(){var v,S,i;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(v=o==null?void 0:o.meta)==null?void 0:v.did,w=Object.assign({...ce},((i=(S=o==null?void 0:o.settings)==null?void 0:S.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ce))}),d=h("enabled"),k=p(async r=>{var T,a;try{const{blocklet:b}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:r})}}),m=Object.assign({...ce},((a=(T=b==null?void 0:b.settings)==null?void 0:T.oauth)==null?void 0:a.auth0)||{});l(m),U.success(n("oauth.saveSuccess"))}catch(b){U.error(b.message||n("oauth.saveFailed"))}}),I=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.domainDescription")),x=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientSecretDescription")),y=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:r})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(D,{title:n("oauth.auth0.domain"),children:e.jsx(L,{name:"domain",control:f,rules:{validate:d?I:y},render:({field:r})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((T=c.errors[r.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientId"),children:e.jsx(L,{name:"clientId",control:f,rules:{validate:d?x:y},render:({field:r})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[r.name],helperText:((T=c.errors[r.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientSecret"),children:e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?g:y},render:({field:r})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[r.name],helperText:((T=c.errors[r.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const de={enabled:!1,clientId:"",clientSecret:""};function jt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...de},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async i=>{var r,T;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),b=Object.assign({...de},((T=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:T.github)||{});l(b),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),I=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.github.clientId"),children:e.jsx(L,{name:"clientId",control:f,rules:{validate:d?I:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.github.clientSecret"),children:e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function bt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...ue},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async i=>{var r,T;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),b=Object.assign({...ue},((T=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:T.google)||{});l(b),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),I=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.google.clientId"),children:e.jsx(L,{name:"clientId",control:f,rules:{validate:d?I:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.google.clientSecret"),children:e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function vt(){var i,r,T;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(i=o==null?void 0:o.meta)==null?void 0:i.did,w=Object.assign({...me},((T=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:T.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(me))}),d=h("enabled"),k=p(async a=>{var b,m;try{const{blocklet:R}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),P=Object.assign({...me},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(P),U.success(n("oauth.saveSuccess"))}catch(R){U.error(R.message||n("oauth.saveFailed"))}}),I=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),y=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.bundleIdDescription")),S=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:a})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(D,{title:n("oauth.apple.teamId"),children:e.jsx(L,{name:"teamId",control:f,rules:{validate:d?I:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.bundleId"),children:e.jsx(L,{name:"bundleId",control:f,rules:{validate:d?v:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.serviceId"),children:e.jsx(L,{name:"serviceId",control:f,rules:{validate:d?x:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.keyId"),children:e.jsx(L,{name:"keyId",control:f,rules:{validate:d?g:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.authKey"),children:e.jsx(L,{name:"authKey",control:f,rules:{validate:d?y:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const yt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function be({title:j,id:o,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=A.useState(t),l=A.useRef(null),d=A.useRef(null),[{handlerId:k},I]=Me({accept:"dragItem",collect(S){return{handlerId:S.getHandlerId()}},hover(S,i){var M,Q;if(!l.current)return;const r=S.index,T=s;if(r===T)return;const a=(M=l.current)==null?void 0:M.getBoundingClientRect(),b=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),m=(b.bottom-b.top)/2,P=i.getClientOffset().y-a.top;r<T&&P<m||r>T&&P>m||(w(r,T),S.index=T)}}),[{isDragging:x},g]=$e({item:{index:s,type:"dragItem"},collect:S=>({isDragging:S.isDragging()}),end:f});g(d),I(l);const y=x?.5:1,v=p(S=>{S.preventDefault(),S.stopPropagation(),h(!c)});return e.jsxs(u,{ref:l,children:[e.jsxs(u,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(u,{sx:{py:2,px:1,opacity:y,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:v,children:[e.jsx(u,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:yt})}),e.jsx(ne,{sx:{flex:1},children:j}),e.jsx(oe,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:pt,style:{transform:"scale(1.5)"}})})]}),e.jsx(ie,{})]}),e.jsx(u,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:H.string.isRequired,id:H.string.isRequired,children:H.node.isRequired,index:H.number.isRequired,onMove:H.func.isRequired,onEnd:H.func.isRequired,defaultExpand:H.bool};be.defaultProps={defaultExpand:!1};const St=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:rt}),component:e.jsx(jt,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:He}),component:e.jsx(bt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:Je}),component:e.jsx(vt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ke}),component:e.jsx(gt,{})}],wt=["github","google","apple","auth0"];function kt(){var k,I;const{api:j}=J(),{blocklet:o}=N(),n=(k=o==null?void 0:o.meta)==null?void 0:k.did,s=((I=o==null?void 0:o.settings)==null?void 0:I.oauth)||{},w=Object.keys(s).sort((x,g)=>{var y,v,S;return((y=s[x])==null?void 0:y.order)!==void 0&&((v=s[g])==null?void 0:v.order)!==void 0?s[x].order-s[g].order:((S=s[x])==null?void 0:S.order)!==void 0?-1:1});for(const x of wt)w.includes(x)||w.push(x);const t=ae(w.reduce((x,g,y)=>Object.assign(x,{[g]:y}),{})),f=te(()=>{const x=[...St];return x.sort((g,y)=>t[g.name]-t[y.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(y=>{g[y]={order:x[y]}}),await j.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const y=f[x],v=f[g];t[y.name]=g,t[v.name]=x}),d=p(async()=>{await h(t)});return e.jsx(u,{sx:{".section-left":{width:"160px"}},children:e.jsx(Ve,{backend:Ne,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const Z={ttl:he.SESSION_TTL,cacheTtl:he.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function W(j){return e.jsx(ot,{...j,sx:{transform:"scale(0.75)"}})}function pe(j,o=!1){const n=o?j.ttl*86400:j.ttl/86400;return{...j,ttl:n}}function Tt(){var a,b;const{api:j}=J(),{blocklet:o}=N(),n=(a=o==null?void 0:o.meta)==null?void 0:a.did,s=lt({},Z,((b=o==null?void 0:o.settings)==null?void 0:b.session)||{});Fe(s.ttl)&&(s.ttl=Z.ttl),Fe(s.cacheTtl)&&(s.cacheTtl=Z.cacheTtl),s.phone||(s.phone=Z.phone),s.email||(s.email=Z.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=re({defaultValues:Y(pe(s),["ttl","cacheTtl","email","phone"])}),{t:l}=se(),d=h("email.enabled"),k=h("phone.enabled"),I=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:y,remove:v}=Re({control:t,name:"email.domainBlackList"}),{fields:S,append:i,remove:r}=Re({control:t,name:"email.domainWhiteList"}),T=p(async m=>{var R;try{const{blocklet:P}=await j.updateAppSessionConfig({input:{did:n,config:ct(pe(m,!0),["phone"])}}),M=Object.assign({},Z,Y(((R=P==null?void 0:P.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(pe(M)),U.success(l("common.configSuccess"))}catch(P){U.error(P.message)}});return e.jsx(It,{onSubmit:w(T),children:e.jsxs($,{direction:"column",gap:6,children:[e.jsxs(u,{children:[e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(u,{component:ie,my:3})]}),e.jsxs($,{gap:2,children:[e.jsx(D,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.enabled",control:t,render:({field:m})=>e.jsx(W,{...m,checked:m.value})})})}),d&&e.jsxs($,{direction:"column",ml:2,children:[e.jsx(D,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.requireVerified",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.requireUnique",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.trustOauthProviders",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.enableDomainBlackList",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),I&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs($,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainBlackList.${R}`,control:t,render:P=>e.jsx(O,{...P.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>v(R),children:e.jsx(De,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(D,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.enableDomainWhiteList",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs($,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainWhiteList.${R}`,control:t,render:P=>e.jsx(O,{...P.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>r(R),children:e.jsx(De,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(D,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"phone.enabled",control:t,disabled:!0,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),k&&e.jsxs($,{direction:"column",ml:2,mt:1,children:[e.jsx(D,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"phone.requireVerified",control:t,render:({field:m})=>e.jsx(_,{control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"phone.requireUnique",control:t,render:({field:m})=>e.jsx(_,{control:e.jsx(W,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(u,{component:ie,my:3}),e.jsx($,{direction:"column",spacing:2,children:e.jsx(L,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:m})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(D,{title:l("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx(nt,{...m,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(u,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const It=Oe.form`
|
|
1
|
+
import{a as se,Z as U,c0 as Me,c1 as $e,I as K,b_ as Ve,b$ as Ne,ad as He,ac as Je,c2 as Ke,b4 as De,j as he,r as Pe,b2 as G,c3 as xe,am as ge,B as z,bN as Ge,a6 as Ze,c4 as Xe,a7 as Ye,a3 as Qe,a0 as et,as as Ce}from"./vendor-ux-did-connect-DROQhYpS.js";import{u as p,a as ae,f as te,c as tt}from"./vendor-hooks-BgUTpb6X.js";import{r as A}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bs as _,bo as E,O,y as V,H,T as ne,I as oe,X as ie,ah as Oe,al as $,cI as nt,a9 as Be,e as je,ab as fe,a7 as ze,ad as st,be as at}from"./vendor-mui-core-BV2FUxWJ.js";import{a9 as rt,O as qe,X as ot,c as it}from"./vendor-arcblock-5qqHEVGo.js";import{J as Y,a8 as lt,c as Fe,D as ct,n as X,aJ as dt,A as ut,b as mt}from"./vendor-utils-rHXShPKm.js";import{D as J,G as N,aA as re,aB as L,aJ as Re}from"./index-DJzuhKQh.js";import{S as le}from"./switch-control-D5eJVUaV.js";import{S as D}from"./section-BB6hVmdO.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-Cj_-M8SX.js";import{b as xt}from"./base32-D35YSxth.js";import{u as ft}from"./use-mobile-BAa0wi8o.js";import"./lottie-web-jYmAQWuC.js";const ce={enabled:!1,domain:"",clientId:"",clientSecret:""};function gt(){var v,S,i;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(v=o==null?void 0:o.meta)==null?void 0:v.did,w=Object.assign({...ce},((i=(S=o==null?void 0:o.settings)==null?void 0:S.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ce))}),d=h("enabled"),k=p(async r=>{var T,a;try{const{blocklet:b}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:r})}}),m=Object.assign({...ce},((a=(T=b==null?void 0:b.settings)==null?void 0:T.oauth)==null?void 0:a.auth0)||{});l(m),U.success(n("oauth.saveSuccess"))}catch(b){U.error(b.message||n("oauth.saveFailed"))}}),I=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.domainDescription")),x=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientSecretDescription")),y=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:r})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(D,{title:n("oauth.auth0.domain"),children:e.jsx(L,{name:"domain",control:f,rules:{validate:d?I:y},render:({field:r})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((T=c.errors[r.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientId"),children:e.jsx(L,{name:"clientId",control:f,rules:{validate:d?x:y},render:({field:r})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[r.name],helperText:((T=c.errors[r.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientSecret"),children:e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?g:y},render:({field:r})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[r.name],helperText:((T=c.errors[r.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const de={enabled:!1,clientId:"",clientSecret:""};function jt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...de},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async i=>{var r,T;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),b=Object.assign({...de},((T=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:T.github)||{});l(b),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),I=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.github.clientId"),children:e.jsx(L,{name:"clientId",control:f,rules:{validate:d?I:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.github.clientSecret"),children:e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function bt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...ue},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async i=>{var r,T;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),b=Object.assign({...ue},((T=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:T.google)||{});l(b),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),I=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.google.clientId"),children:e.jsx(L,{name:"clientId",control:f,rules:{validate:d?I:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.google.clientSecret"),children:e.jsx(L,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function vt(){var i,r,T;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(i=o==null?void 0:o.meta)==null?void 0:i.did,w=Object.assign({...me},((T=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:T.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(me))}),d=h("enabled"),k=p(async a=>{var b,m;try{const{blocklet:R}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),P=Object.assign({...me},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(P),U.success(n("oauth.saveSuccess"))}catch(R){U.error(R.message||n("oauth.saveFailed"))}}),I=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),y=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.bundleIdDescription")),S=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:a})=>e.jsx(_,{control:e.jsx(le,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(D,{title:n("oauth.apple.teamId"),children:e.jsx(L,{name:"teamId",control:f,rules:{validate:d?I:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.bundleId"),children:e.jsx(L,{name:"bundleId",control:f,rules:{validate:d?v:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.serviceId"),children:e.jsx(L,{name:"serviceId",control:f,rules:{validate:d?x:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.keyId"),children:e.jsx(L,{name:"keyId",control:f,rules:{validate:d?g:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.authKey"),children:e.jsx(L,{name:"authKey",control:f,rules:{validate:d?y:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const yt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function be({title:j,id:o,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=A.useState(t),l=A.useRef(null),d=A.useRef(null),[{handlerId:k},I]=Me({accept:"dragItem",collect(S){return{handlerId:S.getHandlerId()}},hover(S,i){var M,Q;if(!l.current)return;const r=S.index,T=s;if(r===T)return;const a=(M=l.current)==null?void 0:M.getBoundingClientRect(),b=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),m=(b.bottom-b.top)/2,P=i.getClientOffset().y-a.top;r<T&&P<m||r>T&&P>m||(w(r,T),S.index=T)}}),[{isDragging:x},g]=$e({item:{index:s,type:"dragItem"},collect:S=>({isDragging:S.isDragging()}),end:f});g(d),I(l);const y=x?.5:1,v=p(S=>{S.preventDefault(),S.stopPropagation(),h(!c)});return e.jsxs(u,{ref:l,children:[e.jsxs(u,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(u,{sx:{py:2,px:1,opacity:y,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:v,children:[e.jsx(u,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:yt})}),e.jsx(ne,{sx:{flex:1},children:j}),e.jsx(oe,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:pt,style:{transform:"scale(1.5)"}})})]}),e.jsx(ie,{})]}),e.jsx(u,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:H.string.isRequired,id:H.string.isRequired,children:H.node.isRequired,index:H.number.isRequired,onMove:H.func.isRequired,onEnd:H.func.isRequired,defaultExpand:H.bool};be.defaultProps={defaultExpand:!1};const St=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:rt}),component:e.jsx(jt,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:He}),component:e.jsx(bt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:Je}),component:e.jsx(vt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ke}),component:e.jsx(gt,{})}],wt=["github","google","apple","auth0"];function kt(){var k,I;const{api:j}=J(),{blocklet:o}=N(),n=(k=o==null?void 0:o.meta)==null?void 0:k.did,s=((I=o==null?void 0:o.settings)==null?void 0:I.oauth)||{},w=Object.keys(s).sort((x,g)=>{var y,v,S;return((y=s[x])==null?void 0:y.order)!==void 0&&((v=s[g])==null?void 0:v.order)!==void 0?s[x].order-s[g].order:((S=s[x])==null?void 0:S.order)!==void 0?-1:1});for(const x of wt)w.includes(x)||w.push(x);const t=ae(w.reduce((x,g,y)=>Object.assign(x,{[g]:y}),{})),f=te(()=>{const x=[...St];return x.sort((g,y)=>t[g.name]-t[y.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(y=>{g[y]={order:x[y]}}),await j.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const y=f[x],v=f[g];t[y.name]=g,t[v.name]=x}),d=p(async()=>{await h(t)});return e.jsx(u,{sx:{".section-left":{width:"160px"}},children:e.jsx(Ve,{backend:Ne,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const Z={ttl:he.SESSION_TTL,cacheTtl:he.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function W(j){return e.jsx(ot,{...j,sx:{transform:"scale(0.75)"}})}function pe(j,o=!1){const n=o?j.ttl*86400:j.ttl/86400;return{...j,ttl:n}}function Tt(){var a,b;const{api:j}=J(),{blocklet:o}=N(),n=(a=o==null?void 0:o.meta)==null?void 0:a.did,s=lt({},Z,((b=o==null?void 0:o.settings)==null?void 0:b.session)||{});Fe(s.ttl)&&(s.ttl=Z.ttl),Fe(s.cacheTtl)&&(s.cacheTtl=Z.cacheTtl),s.phone||(s.phone=Z.phone),s.email||(s.email=Z.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=re({defaultValues:Y(pe(s),["ttl","cacheTtl","email","phone"])}),{t:l}=se(),d=h("email.enabled"),k=h("phone.enabled"),I=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:y,remove:v}=Re({control:t,name:"email.domainBlackList"}),{fields:S,append:i,remove:r}=Re({control:t,name:"email.domainWhiteList"}),T=p(async m=>{var R;try{const{blocklet:P}=await j.updateAppSessionConfig({input:{did:n,config:ct(pe(m,!0),["phone"])}}),M=Object.assign({},Z,Y(((R=P==null?void 0:P.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(pe(M)),U.success(l("common.configSuccess"))}catch(P){U.error(P.message)}});return e.jsx(It,{onSubmit:w(T),children:e.jsxs($,{direction:"column",gap:6,children:[e.jsxs(u,{children:[e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(u,{component:ie,my:3})]}),e.jsxs($,{gap:2,children:[e.jsx(D,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.enabled",control:t,render:({field:m})=>e.jsx(W,{...m,checked:m.value})})})}),d&&e.jsxs($,{direction:"column",ml:2,children:[e.jsx(D,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.requireVerified",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.requireUnique",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.trustOauthProviders",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.enableDomainBlackList",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),I&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs($,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainBlackList.${R}`,control:t,render:P=>e.jsx(O,{...P.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>v(R),children:e.jsx(De,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(D,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"email.enableDomainWhiteList",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs($,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainWhiteList.${R}`,control:t,render:P=>e.jsx(O,{...P.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>r(R),children:e.jsx(De,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(D,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"phone.enabled",control:t,disabled:!0,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),k&&e.jsxs($,{direction:"column",ml:2,mt:1,children:[e.jsx(D,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"phone.requireVerified",control:t,render:({field:m})=>e.jsx(_,{control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(L,{name:"phone.requireUnique",control:t,render:({field:m})=>e.jsx(_,{control:e.jsx(W,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(u,{component:ie,my:3}),e.jsx($,{direction:"column",spacing:2,children:e.jsx(L,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:m})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(D,{title:l("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx(nt,{...m,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(u,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const It=Oe.form`
|
|
2
2
|
max-width: 1536px;
|
|
3
3
|
|
|
4
4
|
.advanced-config {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as u}from"./vendor-react-DEoibe3W.js";import{H as o,j as e,aa as b,b3 as A,O as K,c1 as B,I as O,ab as M,ah as W}from"./vendor-mui-core-BV2FUxWJ.js";import{b2 as X,aN as $,d as H}from"./vendor-ux-did-connect-
|
|
1
|
+
import{r as u}from"./vendor-react-DEoibe3W.js";import{H as o,j as e,aa as b,b3 as A,O as K,c1 as B,I as O,ab as M,ah as W}from"./vendor-mui-core-BV2FUxWJ.js";import{b2 as X,aN as $,d as H}from"./vendor-ux-did-connect-DROQhYpS.js";import{d as G}from"./Done-BoNuG9Iy.js";import{A as U,a as Y,d as J,b as Q}from"./collapse-BF9pIOsL.js";import{C as Z}from"./Google-DYpd3dQM.js";import{ad as v,f as ee}from"./index-DJzuhKQh.js";import{R as ne,F as te,L as re}from"./logo-uploader-B-RJuXxH.js";const S={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function N({editing:n,value:s,onChange:i}){const[a,d]=u.useState(!1),f=u.useRef(),m=u.useRef(s);u.useEffect(()=>{let l=null;return n&&(l=setTimeout(()=>{d(!0)},50)),()=>{clearTimeout(l)}},[n]);const x=l=>{m.current=l,i(l)},j=()=>{d(!1),i(m.current)},y=e.jsx(b,{className:"form-item-input slot",px:1,children:e.jsxs(b,{display:"flex",alignItems:"center",children:[s,s!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:s,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),p=e.jsxs(b,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:j,children:[e.jsx(b,{display:"flex",alignItems:"center",onClick:()=>d(!0),children:e.jsx("div",{ref:f,style:{flexShrink:0,marginLeft:"8px",backgroundColor:s,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:s==="auto"?"default":"pointer"}})}),e.jsx(A,{open:a,anchorEl:f.current,onClose:()=>d(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(Z,{color:s,onChange:l=>x(l.hex)})})]});return n?p:y}N.propTypes=S;function T({editing:n,description:s,value:i,onChange:a,componentProps:d,...f}){const{placeholder:m}=d,x=u.useRef(i),{t:j}=u.useContext(X),y=l=>{l.key==="Enter"&&a(x.current,"confirm")},p=l=>{x.current=l,a(l)};return n?e.jsx(K,{style:{flex:1},fullWidth:!0,value:i,onChange:l=>{l.persist(),p(l.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:s||m,onKeyDown:y,...f}):e.jsx(b,{px:1,className:"form-item-input slot",children:i||e.jsx("span",{className:"placeholder",children:j("common.requiredInputPlaceholder",{name:s||m})})})}T.propTypes=S;T.defaultProps={componentProps:{}};function _({editing:n,value:s,onChange:i,componentProps:a,...d}){const{blocklet:f}=a,m=s==="auto"?$.getPassportColorFromDid(f.appDid):s;return e.jsxs(b,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:v({title:"Owner",issuer:ee.getDisplayName(f),issuerDid:f.appDid,ownerName:"Your Name",ownerDid:f.appDid,preferredColor:s||"auto"})}}),e.jsx(N,{...d,editing:n,value:n?m:s,onChange:i,componentProps:a})]})}_.propTypes={...S,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};_.defaultProps={};const oe=B`
|
|
2
2
|
0%, 100% {
|
|
3
3
|
transform: scale(1) translateX(0);
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{v as ye,B as Br}from"./vendor-utils-rHXShPKm.js";import{bz as De,bA as Dr,bB as Mr,bC as Pr,bD as Cr,bE as Lr,bF as Vr,bG as Rr,bH as Fr,bI as ar,bJ as $r,bK as Gr,bL as zr,bM as Yr,aJ as Hr,by as Zr,aA as Wr}from"./vendor-ux-did-connect-
|
|
1
|
+
import{v as ye,B as Br}from"./vendor-utils-rHXShPKm.js";import{bz as De,bA as Dr,bB as Mr,bC as Pr,bD as Cr,bE as Lr,bF as Vr,bG as Rr,bH as Fr,bI as ar,bJ as $r,bK as Gr,bL as zr,bM as Yr,aJ as Hr,by as Zr,aA as Wr}from"./vendor-ux-did-connect-DROQhYpS.js";var ze={exports:{}},Ye={},fr;function Ir(){if(fr)return Ye;fr=1;function r(p){"@babel/helpers - typeof";return r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},r(p)}function e(p,l,m){return Object.defineProperty(p,"prototype",{writable:!1}),p}function t(p,l){if(!(p instanceof l))throw new TypeError("Cannot call a class as a function")}function n(p,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function");p.prototype=Object.create(l&&l.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),Object.defineProperty(p,"prototype",{writable:!1}),l&&f(p,l)}function f(p,l){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(j,L){return j.__proto__=L,j},f(p,l)}function s(p){var l=q();return function(){var j=S(p),L;if(l){var P=S(this).constructor;L=Reflect.construct(j,arguments,P)}else L=j.apply(this,arguments);return y(this,L)}}function y(p,l){if(l&&(r(l)==="object"||typeof l=="function"))return l;if(l!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return x(p)}function x(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function q(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function S(p){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(m){return m.__proto__||Object.getPrototypeOf(m)},S(p)}var K={},C,T;function N(p,l,m){m||(m=Error);function j(P,te,$){return typeof l=="string"?l:l(P,te,$)}var L=function(P){n($,P);var te=s($);function $(ce,ue,k){var ne;return t(this,$),ne=te.call(this,j(ce,ue,k)),ne.code=p,ne}return e($)}(m);K[p]=L}function B(p,l){if(Array.isArray(p)){var m=p.length;return p=p.map(function(j){return String(j)}),m>2?"one of ".concat(l," ").concat(p.slice(0,m-1).join(", "),", or ")+p[m-1]:m===2?"one of ".concat(l," ").concat(p[0]," or ").concat(p[1]):"of ".concat(l," ").concat(p[0])}else return"of ".concat(l," ").concat(String(p))}function J(p,l,m){return p.substr(0,l.length)===l}function Y(p,l,m){return(m===void 0||m>p.length)&&(m=p.length),p.substring(m-l.length,m)===l}function D(p,l,m){return typeof m!="number"&&(m=0),m+l.length>p.length?!1:p.indexOf(l,m)!==-1}return N("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),N("ERR_INVALID_ARG_TYPE",function(p,l,m){C===void 0&&(C=ir()),C(typeof p=="string","'name' must be a string");var j;typeof l=="string"&&J(l,"not ")?(j="must not be",l=l.replace(/^not /,"")):j="must be";var L;if(Y(p," argument"))L="The ".concat(p," ").concat(j," ").concat(B(l,"type"));else{var P=D(p,".")?"property":"argument";L='The "'.concat(p,'" ').concat(P," ").concat(j," ").concat(B(l,"type"))}return L+=". Received type ".concat(r(m)),L},TypeError),N("ERR_INVALID_ARG_VALUE",function(p,l){var m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";T===void 0&&(T=De);var j=T.inspect(l);return j.length>128&&(j="".concat(j.slice(0,128),"...")),"The argument '".concat(p,"' ").concat(m,". Received ").concat(j)},TypeError),N("ERR_INVALID_RETURN_VALUE",function(p,l,m){var j;return m&&m.constructor&&m.constructor.name?j="instance of ".concat(m.constructor.name):j="type ".concat(r(m)),"Expected ".concat(p,' to be returned from the "').concat(l,'"')+" function but got ".concat(j,".")},TypeError),N("ERR_MISSING_ARGS",function(){for(var p=arguments.length,l=new Array(p),m=0;m<p;m++)l[m]=arguments[m];C===void 0&&(C=ir()),C(l.length>0,"At least one arg needs to be specified");var j="The ",L=l.length;switch(l=l.map(function(P){return'"'.concat(P,'"')}),L){case 1:j+="".concat(l[0]," argument");break;case 2:j+="".concat(l[0]," and ").concat(l[1]," arguments");break;default:j+=l.slice(0,L-1).join(", "),j+=", and ".concat(l[L-1]," arguments");break}return"".concat(j," must be specified")},TypeError),Ye.codes=K,Ye}var He,sr;function kr(){if(sr)return He;sr=1;function r(h,d){var A=Object.keys(h);if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(h);d&&(w=w.filter(function(_){return Object.getOwnPropertyDescriptor(h,_).enumerable})),A.push.apply(A,w)}return A}function e(h){for(var d=1;d<arguments.length;d++){var A=arguments[d]!=null?arguments[d]:{};d%2?r(Object(A),!0).forEach(function(w){t(h,w,A[w])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(A)):r(Object(A)).forEach(function(w){Object.defineProperty(h,w,Object.getOwnPropertyDescriptor(A,w))})}return h}function t(h,d,A){return d=y(d),d in h?Object.defineProperty(h,d,{value:A,enumerable:!0,configurable:!0,writable:!0}):h[d]=A,h}function n(h,d){if(!(h instanceof d))throw new TypeError("Cannot call a class as a function")}function f(h,d){for(var A=0;A<d.length;A++){var w=d[A];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(h,y(w.key),w)}}function s(h,d,A){return d&&f(h.prototype,d),Object.defineProperty(h,"prototype",{writable:!1}),h}function y(h){var d=x(h,"string");return p(d)==="symbol"?d:String(d)}function x(h,d){if(p(h)!=="object"||h===null)return h;var A=h[Symbol.toPrimitive];if(A!==void 0){var w=A.call(h,d||"default");if(p(w)!=="object")return w;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(h)}function q(h,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");h.prototype=Object.create(d&&d.prototype,{constructor:{value:h,writable:!0,configurable:!0}}),Object.defineProperty(h,"prototype",{writable:!1}),d&&Y(h,d)}function S(h){var d=B();return function(){var w=D(h),_;if(d){var c=D(this).constructor;_=Reflect.construct(w,arguments,c)}else _=w.apply(this,arguments);return K(this,_)}}function K(h,d){if(d&&(p(d)==="object"||typeof d=="function"))return d;if(d!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return C(h)}function C(h){if(h===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h}function T(h){var d=typeof Map=="function"?new Map:void 0;return T=function(w){if(w===null||!J(w))return w;if(typeof w!="function")throw new TypeError("Super expression must either be null or a function");if(typeof d<"u"){if(d.has(w))return d.get(w);d.set(w,_)}function _(){return N(w,arguments,D(this).constructor)}return _.prototype=Object.create(w.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),Y(_,w)},T(h)}function N(h,d,A){return B()?N=Reflect.construct.bind():N=function(_,c,o){var u=[null];u.push.apply(u,c);var v=Function.bind.apply(_,u),b=new v;return o&&Y(b,o.prototype),b},N.apply(null,arguments)}function B(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function J(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function Y(h,d){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(w,_){return w.__proto__=_,w},Y(h,d)}function D(h){return D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(A){return A.__proto__||Object.getPrototypeOf(A)},D(h)}function p(h){"@babel/helpers - typeof";return p=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},p(h)}var l=De,m=l.inspect,j=Ir(),L=j.codes.ERR_INVALID_ARG_TYPE;function P(h,d,A){return(A===void 0||A>h.length)&&(A=h.length),h.substring(A-d.length,A)===d}function te(h,d){if(d=Math.floor(d),h.length==0||d==0)return"";var A=h.length*d;for(d=Math.floor(Math.log(d)/Math.log(2));d;)h+=h,d--;return h+=h.substring(0,A-h.length),h}var $="",ce="",ue="",k="",ne={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},Ie=10;function je(h){var d=Object.keys(h),A=Object.create(Object.getPrototypeOf(h));return d.forEach(function(w){A[w]=h[w]}),Object.defineProperty(A,"message",{value:h.message}),A}function he(h){return m(h,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function xe(h,d,A){var w="",_="",c=0,o="",u=!1,v=he(h),b=v.split(`
|
|
2
2
|
`),E=he(d).split(`
|
|
3
3
|
`),R=0,H="";if(A==="strictEqual"&&p(h)==="object"&&p(d)==="object"&&h!==null&&d!==null&&(A="strictEqualObject"),b.length===1&&E.length===1&&b[0]!==E[0]){var X=b[0].length+E[0].length;if(X<=Ie){if((p(h)!=="object"||h===null)&&(p(d)!=="object"||d===null)&&(h!==0||d!==0))return"".concat(ne[A],`
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,l as ne}from"./vendor-hooks-BgUTpb6X.js";import{j as e,aa as y,H as w,ah as H,E as pt,T as E,X as ut,al as te,ad as Y,ab as M,ak as Me,a9 as mt,I as q,O as W,q as oe,N as ft,br as $e,cn as Oe,co as ee,bU as We,bq as qe,bx as ht,bs as xt,bR as gt,v as yt,y as jt,bn as vt,s as bt}from"./vendor-mui-core-BV2FUxWJ.js";import{a as L,am as U,as as Ct,W as fe,Z as F,a7 as xe,j as G,aN as St,B as _,r as Tt,a0 as ge,bv as He,h as wt,b7 as Pt,bP as Fe,bi as It,bu as Rt}from"./vendor-ux-did-connect-
|
|
1
|
+
import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,l as ne}from"./vendor-hooks-BgUTpb6X.js";import{j as e,aa as y,H as w,ah as H,E as pt,T as E,X as ut,al as te,ad as Y,ab as M,ak as Me,a9 as mt,I as q,O as W,q as oe,N as ft,br as $e,cn as Oe,co as ee,bU as We,bq as qe,bx as ht,bs as xt,bR as gt,v as yt,y as jt,bn as vt,s as bt}from"./vendor-mui-core-BV2FUxWJ.js";import{a as L,am as U,as as Ct,W as fe,Z as F,a7 as xe,j as G,aN as St,B as _,r as Tt,a0 as ge,bv as He,h as wt,b7 as Pt,bP as Fe,bi as It,bu as Rt}from"./vendor-ux-did-connect-DROQhYpS.js";import{D as A,y as Ue,n as Dt,V as J,G as kt,ad as Ft,f as At,b as re,aC as Nt,T as Ge}from"./index-DJzuhKQh.js";import{w as Lt,c as Bt,O as ye,a1 as X}from"./vendor-arcblock-5qqHEVGo.js";import{W as je}from"./did-address-BtAnHi7m.js";import{u as $}from"./dashboard-vkFEu-wZ.js";import{r as ve,a as be,b as Ce,c as ie,d as zt,e as Ve,u as _t,f as Et}from"./passport-item-B9iOvD4Y.js";import{p as Ke}from"./util-D-q3oYk9.js";import{u as Mt}from"./use-mobile-BAa0wi8o.js";import{w as V,P as Ye}from"./permission-CbTKdC7W.js";import{C as $t}from"./Google-DYpd3dQM.js";import{M as Z,aA as Ot,K as Wt}from"./vendor-utils-rHXShPKm.js";import{E as le}from"./EditIcon-8BXW1OHp.js";import{C as Se}from"./confirm-CiiHIA-a.js";import{L as Ze}from"./list-header-xt282ZMS.js";import{f as se}from"./index-8eXqqyHQ.js";import{_ as qt}from"./useSetState-CWq0AVWn.js";import{L as Ht}from"./LockIcon-DFb6sSpT.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BDA4jbwL.js";import"./PlayArrow-Cv1uXXJt.js";import"./get-safe-url-CiQ8_q49.js";import"./session-ugMCR4Iu.js";import"./use-blocklet-logo-a8QJI4r-.js";import"./InfoOutlined-Duq1UDPu.js";import"./dot-DX56IFTM.js";import"./useAsync-Dv214fz8.js";import"./use-mobile-C21X4TYN.js";import"./index-nhpGyAFA.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./base32-D35YSxth.js";import"./cloneDeep-UpFQ2VNg.js";const Ae="info";function Te({createPassportSvg:c,passport:o,onCancel:d,onSwitchPassport:f}){const{t:u}=L(),l=dt({tab:Ae}),h={info:{label:u("common.basicInfo"),value:Ae,component:()=>e.jsx(Je,{passport:o,createPassportSvg:c})},logs:{label:u("common.logs"),value:"logs",component:()=>e.jsx(et,{passport:o})},related:{label:u("team.passport.related"),value:"related",component:()=>e.jsx(tt,{passport:o,onSwitchPassport:f})}},s=Object.values(h).map(({label:n,value:t})=>({label:n,value:t})).filter(n=>n.value==="related"?o.parentDid:!0),m=h[l.tab]||h.info,r=n=>{l.tab=n};return e.jsx(U,{title:u("common.passport"),onClose:d,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ut,{children:[e.jsx(y,{className:"tabs",children:e.jsx(Ct,{tabs:s,current:l.tab,onChange:r,scrollButtons:"auto"})}),e.jsx(y,{className:"body",children:e.jsx(m.component,{})})]})})}Te.propTypes={createPassportSvg:w.func.isRequired,passport:w.object.isRequired,onCancel:w.func.isRequired,onSwitchPassport:w.func};Te.defaultProps={onSwitchPassport:()=>{}};const Ut=H(y)`
|
|
2
2
|
margin-top: -16px;
|
|
3
3
|
|
|
4
4
|
.tabs {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as P,t as gn,g as xn,e as Ct,a as yn}from"./vendor-react-DEoibe3W.js";import{a9 as Et,j as e,aa as E,bo as Be,br as Fe,bn as $e,q as Ce,T as Y,O as de,ab as oe,bx as qe,ak as re,H as v,ah as M,e as vn,ad as me,w as bn,y as Ot,b4 as Cn,b5 as jn,I as Sn,bh as wn,bs as Pn,bR as In}from"./vendor-mui-core-BV2FUxWJ.js";import{B as jt,e as We,$ as kn,ay as Tn,n as St,A as Dn,b as An}from"./vendor-utils-rHXShPKm.js";import{r as Nt,aJ as _t,by as Rn,h as Ln,a as V,Y as En,X as On,Z,am as te,B as z,e as Nn,ao as _n,d as Un,b2 as ue,bo as Bn,j as Q,a0 as Ut,ai as Fn,I as $n,as as Wn,W as ze,b4 as zn,a7 as Bt,a6 as Ft,bu as Mn}from"./vendor-ux-did-connect-DprdyYny.js";import{c as G,a as qn,Z as $t,O as je,I as Hn,_ as Vn}from"./vendor-arcblock-CUb0jDdY.js";import{d as Kn}from"./ViewList-ByzGtByR.js";import{a2 as Zn,f as Yn,D as H,ax as Se,n as pe,a3 as Qn,V as ne,ay as Gn,G as Wt,az as zt,y as Jn,b as Xn}from"./index-B6g_NzxF.js";import{U as Mt,C as qt,I as es}from"./index-iphP5FWX.js";import{k as ts,u as He,a as Ve,c as ns,m as ss,f as rs}from"./vendor-hooks-BgUTpb6X.js";import{l as os}from"./index-C5N0NjEs.js";import{u as K,d as wt,W as Ht}from"./dashboard-RTzIKcnI.js";import{W as Ke}from"./did-address-2a_50VlM.js";import{P as J}from"./permission-BkpeOUF9.js";import{C as ke}from"./click-to-copy-DsH0RQVg.js";import{T as Vt}from"./index-B4CzEaVv.js";import{f as X}from"./index-8eXqqyHQ.js";import{_ as is}from"./useAsync-510ntT1B.js";import{I as q}from"./index-CBALX7k4.js";import{d as as}from"./DeleteOutline-DIXSGJ49.js";import{C as fe}from"./confirm-BnRcXvxs.js";import{u as he}from"./session-E0e-X6-a.js";import{i as Kt,a as we,p as Zt}from"./util-IzAdTupy.js";import{b as ls}from"./sdk-DeUOtvaE.js";import{A as cs}from"./actions-XNIU_ion.js";import{S as ds}from"./shorten-label-DPIZ5X7v.js";import"./lottie-web-jYmAQWuC.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./useLocalStorage-DvcK7KsP.js";import"./PlayArrow-CrmMAssx.js";import"./get-safe-url-BdFxF8pA.js";import"./use-blocklet-logo-DeL5Lmpn.js";import"./InfoOutlined-Cxpk0UTX.js";import"./dot-itVN8XTt.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-BAa0wi8o.js";import"./vendor-mui-x-Bo-XOtzq.js";import"./AdapterDayjs-DnsMePpQ.js";import"./base32-DEQDAhbh.js";import"./MoreHoriz-CKCGMlB8.js";var Ze={},ms=Et;Object.defineProperty(Ze,"__esModule",{value:!0});var Yt=Ze.default=void 0,ps=ms(Nt()),us=e;Yt=Ze.default=(0,ps.default)((0,us.jsx)("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8m0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4z"}),"Loop");var Ye=function(t){return e.jsxs("svg",{...t,children:[e.jsx("g",{clipPath:"url(#clip0)",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.99997 1.59778C8.19071 1.59778 7.39961 1.83775 6.72673 2.28736C6.05385 2.73697 5.5294 3.37601 5.21971 4.12367C4.91001 4.87134 4.82898 5.69405 4.98686 6.48777C5.14474 7.28149 5.53444 8.01056 6.10668 8.5828C6.67892 9.15504 7.408 9.54474 8.20172 9.70262C8.99544 9.8605 9.81815 9.77947 10.5658 9.46978C11.3135 9.16009 11.9525 8.63564 12.4021 7.96276C12.8517 7.28987 13.0917 6.49878 13.0917 5.68951C13.0917 4.60432 12.6606 3.56357 11.8933 2.79622C11.1259 2.02887 10.0852 1.59778 8.99997 1.59778ZM7.27426 3.9638C7.73195 3.50611 8.35271 3.24899 8.99997 3.24899C9.48266 3.24899 9.95452 3.39212 10.3559 3.66029C10.7572 3.92846 11.07 4.30962 11.2547 4.75556C11.4394 5.20151 11.4878 5.69222 11.3936 6.16563C11.2994 6.63905 11.067 7.07391 10.7257 7.41522C10.3844 7.75654 9.94951 7.98897 9.4761 8.08314C9.00268 8.17731 8.51197 8.12898 8.06603 7.94426C7.62008 7.75954 7.23892 7.44674 6.97075 7.04539C6.70258 6.64405 6.55945 6.1722 6.55945 5.68951C6.55945 5.04224 6.81658 4.42149 7.27426 3.9638ZM7.36691 10.3075C6.28172 10.3075 5.24097 10.7385 4.47362 11.5059C3.70627 12.2732 3.27518 13.314 3.27518 14.3992V17.121C3.27518 17.2763 3.4011 17.4022 3.55643 17.4022H4.64514C4.80047 17.4022 4.92639 17.2763 4.92639 17.121V14.3992C4.92639 13.7519 5.18351 13.1312 5.6412 12.6735C6.09889 12.2158 6.71964 11.9587 7.36691 11.9587H10.633C10.9535 11.9587 11.2709 12.0218 11.567 12.1444C11.8631 12.2671 12.1321 12.4469 12.3588 12.6735C12.5854 12.9001 12.7651 13.1691 12.8878 13.4652C13.0104 13.7613 13.0736 14.0787 13.0736 14.3992V17.121C13.0736 17.2763 13.1995 17.4022 13.3548 17.4022H14.4435C14.5989 17.4022 14.7248 17.2763 14.7248 17.121V14.3992C14.7248 13.314 14.2937 12.2732 13.5263 11.5059C12.759 10.7385 11.7182 10.3075 10.633 10.3075H7.36691Z"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0",children:e.jsx("rect",{width:"18",height:"18",transform:"translate(0 0.5)"})})})]})};Ye.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};Ye.displayName="person";const fs=Ye;var Qe=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M1.25 2.7087C1.25 2.24826 1.62326 1.875 2.0837 1.875H14.339C14.7995 1.875 15.1727 2.24826 15.1727 2.7087V9.31574C15.1727 9.77618 14.7995 10.1494 14.339 10.1494C13.8786 10.1494 13.5053 9.77618 13.5053 9.31574V3.54239H2.91739V16.7565H6.53772H8.34788H9.32435C9.78479 16.7565 10.158 17.1297 10.158 17.5902C10.158 18.0506 9.78479 18.4239 9.32435 18.4239H8.34788H2.0837C1.62326 18.4239 1.25 18.0506 1.25 17.5902V2.7087Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.21129 7.91935C7.70481 7.91935 7.29422 8.32993 7.29422 8.83641C7.29422 9.34289 7.70481 9.75348 8.21129 9.75348C8.71777 9.75348 9.12836 9.34289 9.12836 8.83641C9.12836 8.32993 8.71777 7.91935 8.21129 7.91935ZM5.62683 8.83641C5.62683 7.40905 6.78393 6.25195 8.21129 6.25195C9.63865 6.25195 10.7957 7.40905 10.7957 8.83641C10.7957 10.2638 9.63865 11.4209 8.21129 11.4209C6.78393 11.4209 5.62683 10.2638 5.62683 8.83641Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.62683 13.2133C5.62683 12.7529 6.00009 12.3796 6.46053 12.3796H9.96205C10.4225 12.3796 10.7957 12.7529 10.7957 13.2133C10.7957 13.6737 10.4225 14.047 9.96205 14.047H6.46053C6.00009 14.047 5.62683 13.6737 5.62683 13.2133Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6406 11.3125C15.8547 11.3125 16.0503 11.434 16.145 11.626L17.1779 13.7184L19.4876 14.056C19.6994 14.087 19.8753 14.2355 19.9413 14.4391C20.0074 14.6427 19.9521 14.8662 19.7987 15.0156L18.1279 16.643L18.5222 18.9421C18.5584 19.1532 18.4716 19.3665 18.2984 19.4923C18.1252 19.6182 17.8955 19.6347 17.706 19.5351L15.6406 18.4489L13.5753 19.5351C13.3858 19.6347 13.1561 19.6182 12.9829 19.4923C12.8096 19.3665 12.7229 19.1532 12.7591 18.9421L13.1534 16.643L11.4825 15.0156C11.3292 14.8662 11.2739 14.6427 11.3399 14.4391C11.406 14.2355 11.5818 14.087 11.7937 14.056L14.1034 13.7184L15.1362 11.626C15.231 11.434 15.4265 11.3125 15.6406 11.3125ZM15.6406 13.1458L14.9815 14.4813C14.8996 14.6471 14.7414 14.7621 14.5584 14.7889L13.0835 15.0044L14.1503 16.0435C14.283 16.1727 14.3435 16.359 14.3122 16.5416L14.0606 18.0088L15.3788 17.3155C15.5427 17.2293 15.7386 17.2293 15.9025 17.3155L17.2207 18.0088L16.969 16.5416C16.9377 16.359 16.9983 16.1727 17.131 16.0435L18.1978 15.0044L16.7229 14.7889C16.5399 14.7621 16.3817 14.6471 16.2998 14.4813L15.6406 13.1458Z"})]})};Qe.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Qe.displayName="external-issuer";const Qt=Qe;var be={},hs=t=>encodeURIComponent(t).replace(/[!'()*]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),Gt="%[a-f0-9]{2}",Pt=new RegExp("("+Gt+")|([^%]+?)","gi"),It=new RegExp("("+Gt+")+","gi");function Me(t,r){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;r=r||1;var l=t.slice(0,r),p=t.slice(r);return Array.prototype.concat.call([],Me(l),Me(p))}function gs(t){try{return decodeURIComponent(t)}catch{for(var r=t.match(Pt)||[],l=1;l<r.length;l++)t=Me(r,l).join(""),r=t.match(Pt)||[];return t}}function xs(t){for(var r={"%FE%FF":"��","%FF%FE":"��"},l=It.exec(t);l;){try{r[l[0]]=decodeURIComponent(l[0])}catch{var p=gs(l[0]);p!==l[0]&&(r[l[0]]=p)}l=It.exec(t)}r["%C2"]="�";for(var d=Object.keys(r),g=0;g<d.length;g++){var S=d[g];t=t.replace(new RegExp(S,"g"),r[S])}return t}var ys=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return xs(t)}},vs=(t,r)=>{if(!(typeof t=="string"&&typeof r=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(r==="")return[t];const l=t.indexOf(r);return l===-1?[t]:[t.slice(0,l),t.slice(l+r.length)]},bs=function(t,r){for(var l={},p=Object.keys(t),d=Array.isArray(r),g=0;g<p.length;g++){var S=p[g],u=t[S];(d?r.indexOf(S)!==-1:r(S,u,t))&&(l[S]=u)}return l};(function(t){const r=hs,l=ys,p=vs,d=bs,g=n=>n==null;function S(n){switch(n.arrayFormat){case"index":return s=>(a,c)=>{const x=a.length;return c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,[h(s,n),"[",x,"]"].join("")]:[...a,[h(s,n),"[",h(x,n),"]=",h(c,n)].join("")]};case"bracket":return s=>(a,c)=>c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,[h(s,n),"[]"].join("")]:[...a,[h(s,n),"[]=",h(c,n)].join("")];case"comma":case"separator":return s=>(a,c)=>c==null||c.length===0?a:a.length===0?[[h(s,n),"=",h(c,n)].join("")]:[[a,h(c,n)].join(n.arrayFormatSeparator)];default:return s=>(a,c)=>c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,h(s,n)]:[...a,[h(s,n),"=",h(c,n)].join("")]}}function u(n){let s;switch(n.arrayFormat){case"index":return(a,c,x)=>{if(s=/\[(\d*)\]$/.exec(a),a=a.replace(/\[\d*\]$/,""),!s){x[a]=c;return}x[a]===void 0&&(x[a]={}),x[a][s[1]]=c};case"bracket":return(a,c,x)=>{if(s=/(\[\])$/.exec(a),a=a.replace(/\[\]$/,""),!s){x[a]=c;return}if(x[a]===void 0){x[a]=[c];return}x[a]=[].concat(x[a],c)};case"comma":case"separator":return(a,c,x)=>{const y=typeof c=="string"&&c.includes(n.arrayFormatSeparator),w=typeof c=="string"&&!y&&o(c,n).includes(n.arrayFormatSeparator);c=w?o(c,n):c;const U=y||w?c.split(n.arrayFormatSeparator).map(F=>o(F,n)):c===null?c:o(c,n);x[a]=U};default:return(a,c,x)=>{if(x[a]===void 0){x[a]=c;return}x[a]=[].concat(x[a],c)}}}function b(n){if(typeof n!="string"||n.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function h(n,s){return s.encode?s.strict?r(n):encodeURIComponent(n):n}function o(n,s){return s.decode?l(n):n}function T(n){return Array.isArray(n)?n.sort():typeof n=="object"?T(Object.keys(n)).sort((s,a)=>Number(s)-Number(a)).map(s=>n[s]):n}function C(n){const s=n.indexOf("#");return s!==-1&&(n=n.slice(0,s)),n}function I(n){let s="";const a=n.indexOf("#");return a!==-1&&(s=n.slice(a)),s}function i(n){n=C(n);const s=n.indexOf("?");return s===-1?"":n.slice(s+1)}function k(n,s){return s.parseNumbers&&!Number.isNaN(Number(n))&&typeof n=="string"&&n.trim()!==""?n=Number(n):s.parseBooleans&&n!==null&&(n.toLowerCase()==="true"||n.toLowerCase()==="false")&&(n=n.toLowerCase()==="true"),n}function m(n,s){s=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},s),b(s.arrayFormatSeparator);const a=u(s),c=Object.create(null);if(typeof n!="string"||(n=n.trim().replace(/^[?#&]/,""),!n))return c;for(const x of n.split("&")){if(x==="")continue;let[y,w]=p(s.decode?x.replace(/\+/g," "):x,"=");w=w===void 0?null:["comma","separator"].includes(s.arrayFormat)?w:o(w,s),a(o(y,s),w,c)}for(const x of Object.keys(c)){const y=c[x];if(typeof y=="object"&&y!==null)for(const w of Object.keys(y))y[w]=k(y[w],s);else c[x]=k(y,s)}return s.sort===!1?c:(s.sort===!0?Object.keys(c).sort():Object.keys(c).sort(s.sort)).reduce((x,y)=>{const w=c[y];return w&&typeof w=="object"&&!Array.isArray(w)?x[y]=T(w):x[y]=w,x},Object.create(null))}t.extract=i,t.parse=m,t.stringify=(n,s)=>{if(!n)return"";s=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},s),b(s.arrayFormatSeparator);const a=w=>s.skipNull&&g(n[w])||s.skipEmptyString&&n[w]==="",c=S(s),x={};for(const w of Object.keys(n))a(w)||(x[w]=n[w]);const y=Object.keys(x);return s.sort!==!1&&y.sort(s.sort),y.map(w=>{const U=n[w];return U===void 0?"":U===null?h(w,s):Array.isArray(U)?U.reduce(c(w),[]).join("&"):h(w,s)+"="+h(U,s)}).filter(w=>w.length>0).join("&")},t.parseUrl=(n,s)=>{s=Object.assign({decode:!0},s);const[a,c]=p(n,"#");return Object.assign({url:a.split("?")[0]||"",query:m(i(n),s)},s&&s.parseFragmentIdentifier&&c?{fragmentIdentifier:o(c,s)}:{})},t.stringifyUrl=(n,s)=>{s=Object.assign({encode:!0,strict:!0},s);const a=C(n.url).split("?")[0]||"",c=t.extract(n.url),x=t.parse(c,{sort:!1}),y=Object.assign(x,n.query);let w=t.stringify(y,s);w&&(w=`?${w}`);let U=I(n.url);return n.fragmentIdentifier&&(U=`#${h(n.fragmentIdentifier,s)}`),`${a}${w}${U}`},t.pick=(n,s,a)=>{a=Object.assign({parseFragmentIdentifier:!0},a);const{url:c,query:x,fragmentIdentifier:y}=t.parseUrl(n,a);return t.stringifyUrl({url:c,query:d(x,s),fragmentIdentifier:y},a)},t.exclude=(n,s,a)=>{const c=Array.isArray(s)?x=>!s.includes(x):(x,y)=>!s(x,y);return t.pick(n,c,a)}})(be);const ae=gn,Cs={parseNumbers:!1,parseBooleans:!1},js={skipNull:!1,skipEmptyString:!1},Ss=(t,r)=>{var l,p;const{navigateMode:d="push",parseOptions:g,stringifyOptions:S}={},u=Object.assign(Object.assign({},Cs),g),b=Object.assign(Object.assign({},js),S),h=ae.useLocation(),o=(l=ae.useHistory)===null||l===void 0?void 0:l.call(ae),T=(p=ae.useNavigate)===null||p===void 0?void 0:p.call(ae),C=ts(),I=P.useRef(typeof t=="function"?t():t||{}),i=P.useMemo(()=>be.parse(h.search,u),[h.search]),k=P.useMemo(()=>Object.assign(Object.assign({},I.current),i),[i]);return[k,He(n=>{const s=typeof n=="function"?n(k):n;C(),o&&o[d]({hash:h.hash,search:be.stringify(Object.assign(Object.assign({},i),s),b)||"?"},h.state),T&&T({hash:h.hash,search:be.stringify(Object.assign(Object.assign({},i),s),b)||"?"},{replace:d==="replace",state:h.state})})]},ws=Ss,Ps=_t,Ne=Rn,_e=Ln,Is=os,kt={role:Ps.types.RoleType.ROLE_APPLICATION},ks=(t,r,l,p)=>{let d=l||kt;const g=(0,_e.isEthereumType)((0,_e.DidType)(l));if(g?d=(0,Ne.WalletType)(l):d=(0,Ne.WalletType)(kt),!(0,_e.isValid)(t)){let S="";try{return g?S=t.slice(0,66):S=t,(0,Ne.fromSecretKey)(S,d)}catch(u){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${u.message}`)}}if(!r)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,Is.fromAppDid)(t,r,d,p||0)};var Ts=ks,Jt=Ct&&Ct.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const le=Jt(Zn),Ds=_t,ye=Jt(Ts),As=Yn,Rs=(t,r,{returnWallet:l=!0}={})=>{var F,A;if(!t||typeof t!="object"||!Array.isArray(t.environments)||!(0,le.default)(t,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:p,configs:d=[]}=t,g=[...d,...p],S=g.find(D=>D.key==="BLOCKLET_APP_DESCRIPTION"),u=g.find(D=>D.key==="BLOCKLET_PASSPORT_COLOR"),b=g.find(D=>D.key==="BLOCKLET_APP_URL"),h=g.find(D=>D.key==="BLOCKLET_APP_TENANT_MODE"),{did:o,version:T}=t.meta,C=(0,As.getDisplayName)(t),I=(0,le.default)(S,"value",t.meta.description),i=(0,le.default)(u,"value","auto"),k=(0,le.default)(b,"value",""),m=(0,le.default)(h,"value","");if(!l)return{did:o,version:T,name:C,description:I,passportColor:i,appUrl:k,secret:"",wallet:null,permanentWallet:null,tenantMode:m};const n=g.find(D=>D.key==="BLOCKLET_APP_SK"),s=g.find(D=>D.key==="BLOCKLET_APP_CHAIN_TYPE")||g.find(D=>D.key==="BLOCKLET_WALLET_TYPE"),a=g.find(D=>D.key==="BLOCKLET_APP_PSK");let c;s&&(s.value==="ethereum"||s.value==="eth")&&(c=s.value);let x=null,y=null;if(n&&n.value)x=(0,ye.default)(n.value,void 0,c),a&&a.value&&a.value!==n.value&&(y=(0,ye.default)(a.value,void 0,c));else{if(!r||typeof r!="string")throw new Error("Node secret key must be a string");s?x=(0,ye.default)(t.meta.did,r,c):x=(0,ye.default)(t.meta.did,r)}const w=((A=(F=t.settings)==null?void 0:F.session)==null?void 0:A.salt)||"",U=Ds.Hasher.SHA3.hash256(jt.concat([x.secretKey,x.address,w].filter(Boolean).map(D=>jt.from(D))));return{did:o,version:T,name:C,description:I,passportColor:i,appUrl:k,secret:U,wallet:x,permanentWallet:y||x,tenantMode:m}};var Ls=Rs;const Es=xn(Ls);function Ge({teamDid:t,roles:r,apps:l,onCancel:p,onSuccess:d,onError:g,endpoint:S}){var k;const{api:u}=H(),{t:b,locale:h}=V(),o=Ve({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:l.length>0?l[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),T=async()=>{if(!o.role){o.error=b("team.member.error.passportEmpty");return}const m=o.remark.trim();o.error=null,o.loading=!0;try{let n=o.sourceAppPid??null;n===t&&(n=null);const s={teamDid:t,role:o.role,remark:m,sourceAppPid:n,passportExpireTime:o.passportExpireTime?o.passportExpireTime.toISOString():""};o.display&&(s.display={type:"url",content:o.display});const{inviteInfo:a}=await u.createMemberInvitation({input:s});o.inviteInfo=a,o.activeStep=1}catch(n){const s=X(n);o.error=s,g(n)}finally{o.loading=!1}},C=r.find(m=>m.name===o.role),i=[{body:e.jsxs(E,{sx:{display:"flex",flexDirection:"column",gap:3},children:[l.length>1?e.jsxs(Be,{fullWidth:!0,children:[e.jsx(Fe,{children:b("common.sourceApp")}),e.jsx($e,{value:o.sourceAppPid,onChange:m=>{o.error=null,o.sourceAppPid=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:o.loading,children:l.map(m=>e.jsx(Ce,{value:m.appPid,children:e.jsxs(E,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(E,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(En,{did:m.appPid,size:28}),m.appName]}),e.jsx(On,{did:m.appPid,compact:!0,responsive:!1})]})},m.appPid))})]}):null,e.jsxs(Be,{fullWidth:!0,variant:"outlined",children:[e.jsx(Fe,{children:b("common.passport")}),e.jsx($e,{"data-cy":"invite-member-select-role",value:o.role,onChange:m=>{o.error=null,o.role=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:o.loading,onKeyPress:m=>{m.key==="Enter"&&(m.preventDefault(),T())},children:r.filter(m=>m.name!=="owner").map(m=>e.jsx(Ce,{value:m.name,"data-cy":`invite-member-select-option-${m.name}`,children:e.jsxs(E,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(Y,{variant:"subtitle1",children:m.title||m.name}),e.jsx(Y,{variant:"caption",sx:{opacity:.7},children:m.description})]})},m.name))})]}),((k=C==null?void 0:C.extra)==null?void 0:k.display)==="custom"&&e.jsx(de,{label:b("common.display"),type:"url",value:o.display,onChange:m=>{o.error=null,o.display=m.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(de,{label:b("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.remark,onChange:m=>{o.error=null,o.remark=m.target.value},disabled:o.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Vt,{value:o.passportExpireTime,onChange:m=>{o.passportExpireTime=m}})]}),cancel:b("common.cancel"),confirm:b("team.member.inviteDialog.createInviteLink"),onCancel:p,onConfirm:T},{body:()=>{var n,s;const m=Se({inviteId:(n=o.inviteInfo)==null?void 0:n.inviteId,endpoint:S});return e.jsxs("div",{children:[e.jsx(E,{sx:{fontSize:16,fontWeight:"bold"},children:b("team.member.inviteDialog.createSuccessTip",{expireDate:pe((s=o.inviteInfo)==null?void 0:s.expireDate,h)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:m})]})},confirm:b("common.copy"),onConfirm:()=>{var n;const m=Se({inviteId:(n=o.inviteInfo)==null?void 0:n.inviteId,endpoint:S});ns(m),Z.success(b("common.copied")),d()},cancel:b("common.cancel"),onCancel:p}][o.activeStep];return e.jsxs(te,{title:b("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[i.cancel&&e.jsx(z,{onClick:i.onCancel,color:"inherit",children:i.cancel}),e.jsxs(z,{onClick:i.onConfirm,color:"primary",disabled:o.loading||!o.role,variant:"contained",autoFocus:!0,children:[o.loading&&e.jsx(oe,{size:16}),i.confirm]})]}),children:[e.jsx(qe,{component:"div",children:typeof i.body=="function"?i.body():i.body}),!!o.error&&e.jsx(re,{severity:"error",variant:"icon",children:o.error})]})}Ge.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,roles:v.array,apps:v.array,endpoint:v.string};Ge.defaultProps={onError:()=>{},roles:[],apps:[],endpoint:""};function Je({teamDid:t,onCancel:r,onSuccess:l,onError:p,endpoint:d}){const{api:g,info:S}=H(),{api:u}=P.useContext(Nn),[b,h]=P.useState(!1),{t:o,locale:T}=V(),[C,I]=P.useState(""),[i,k]=P.useState(!1),[m,n]=P.useState(0),[s,a]=P.useState(""),[c,x]=P.useState(""),y=!!We(S,"ownerNft.did"),w=is(async()=>{if(y){const{state:R}=await g.getDelegationState();return R}return{delegated:!0}});if(w.loading)return e.jsx(te,{title:o("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(oe,{})})});if(w.error)return e.jsx(te,{title:o("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx(re,{severity:"error",variant:"icon",children:X(w.error)})});const U=async()=>{I(null),h(!0);try{const{inviteInfo:R}=await g.createTransferInvitation({input:{teamDid:t,role:"owner",remark:c.trim()}});a(R),n(D.length-1)}catch(R){const W=X(R);I(W),p(R)}finally{h(!1)}},F=()=>{k(!0),n(1)},A=()=>{k(!1),n(0)},D=[{body:e.jsxs(Y,{component:"div",children:[e.jsxs(re,{severity:"warning",children:[e.jsx(Y,{children:o("team.transferNode.inviteDialog.tips.progress")}),e.jsx(Y,{children:o("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(re,{severity:"warning",children:e.jsx(Y,{children:o("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(de,{label:o("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:c,onChange:R=>{I(null),x(R.target.value)},disabled:b,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:o("common.cancel"),confirm:o("team.transferNode.inviteDialog.createInviteLink"),onCancel:r,onConfirm:y&&!We(w,"value.delegated")?F:U},{body:()=>e.jsx(_n,{action:"delegate-transfer-nft",open:i,locale:T,checkFn:u.get,onClose:A,onSuccess:U,checkTimeout:5*60*1e3,webWalletUrl:Qn(S),extraParams:{targetDID:S.did},messages:{title:o("team.transferNode.delegateDialog.title"),scan:o("team.transferNode.delegateDialog.scan"),confirm:o("team.transferNode.delegateDialog.confirm"),success:o("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const R=Se({inviteId:s.inviteId,endpoint:d});return e.jsxs("div",{children:[e.jsx(Os,{children:o("team.transferNode.inviteDialog.createSuccessTip",{expireDate:pe(s.expireDate,T)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:R})]})},confirm:o("common.confirm"),onConfirm:l}],O=D[m];return e.jsxs(te,{title:o("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[O.cancel&&e.jsx(z,{onClick:O.onCancel,color:"inherit",children:O.cancel}),e.jsxs(z,{onClick:O.onConfirm,color:"primary",disabled:b,variant:"contained",autoFocus:!0,children:[b&&e.jsx(oe,{size:16}),O.confirm]})]}),children:[e.jsx(qe,{component:"div",children:typeof O.body=="function"?O.body():O.body}),!!C&&e.jsx(re,{severity:"error",variant:"icon",children:C})]})}Je.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,endpoint:v.string};Je.defaultProps={onError:()=>{},endpoint:""};const Os=M.div`
|
|
1
|
+
import{r as P,t as gn,g as xn,e as Ct,a as yn}from"./vendor-react-DEoibe3W.js";import{a9 as Et,j as e,aa as E,bo as Be,br as Fe,bn as $e,q as Ce,T as Y,O as de,ab as oe,bx as qe,ak as re,H as v,ah as M,e as vn,ad as me,w as bn,y as Ot,b4 as Cn,b5 as jn,I as Sn,bh as wn,bs as Pn,bR as In}from"./vendor-mui-core-BV2FUxWJ.js";import{B as jt,e as We,$ as kn,ay as Tn,n as St,A as Dn,b as An}from"./vendor-utils-rHXShPKm.js";import{r as Nt,aJ as _t,by as Rn,h as Ln,a as V,Y as En,X as On,Z,am as te,B as z,e as Nn,ao as _n,d as Un,b2 as ue,bo as Bn,j as Q,a0 as Ut,ai as Fn,I as $n,as as Wn,W as ze,b4 as zn,a7 as Bt,a6 as Ft,bu as Mn}from"./vendor-ux-did-connect-DROQhYpS.js";import{c as G,a as qn,Z as $t,O as je,I as Hn,_ as Vn}from"./vendor-arcblock-5qqHEVGo.js";import{d as Kn}from"./ViewList-PrXAmQts.js";import{a2 as Zn,f as Yn,D as H,ax as Se,n as pe,a3 as Qn,V as ne,ay as Gn,G as Wt,az as zt,y as Jn,b as Xn}from"./index-DJzuhKQh.js";import{U as Mt,C as qt,I as es}from"./index-nhpGyAFA.js";import{k as ts,u as He,a as Ve,c as ns,m as ss,f as rs}from"./vendor-hooks-BgUTpb6X.js";import{l as os}from"./index-BhMu-yLO.js";import{u as K,d as wt,W as Ht}from"./dashboard-vkFEu-wZ.js";import{W as Ke}from"./did-address-BtAnHi7m.js";import{P as J}from"./permission-CbTKdC7W.js";import{C as ke}from"./click-to-copy-B26zKr7i.js";import{T as Vt}from"./index-hO3Mo-qi.js";import{f as X}from"./index-8eXqqyHQ.js";import{u as is}from"./useAsync-KYUBhVsb.js";import{I as q}from"./index-Cj_-M8SX.js";import{d as as}from"./DeleteOutline-lCPjjhKz.js";import{C as fe}from"./confirm-CiiHIA-a.js";import{u as he}from"./session-ugMCR4Iu.js";import{i as Kt,a as we,p as Zt}from"./util-D-q3oYk9.js";import{b as ls}from"./sdk-Bxy9kDUo.js";import{A as cs}from"./actions-BA8hCarh.js";import{S as ds}from"./shorten-label-DPIZ5X7v.js";import"./lottie-web-jYmAQWuC.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./useLocalStorage-BDA4jbwL.js";import"./PlayArrow-Cv1uXXJt.js";import"./get-safe-url-CiQ8_q49.js";import"./use-blocklet-logo-a8QJI4r-.js";import"./InfoOutlined-Duq1UDPu.js";import"./dot-DX56IFTM.js";import"./useAsync-Dv214fz8.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./vendor-mui-x-Bo-XOtzq.js";import"./AdapterDayjs-Bs_Q9JXL.js";import"./base32-D35YSxth.js";import"./MoreHoriz-jwSUI8G2.js";var Ze={},ms=Et;Object.defineProperty(Ze,"__esModule",{value:!0});var Yt=Ze.default=void 0,ps=ms(Nt()),us=e;Yt=Ze.default=(0,ps.default)((0,us.jsx)("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8m0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4z"}),"Loop");var Ye=function(t){return e.jsxs("svg",{...t,children:[e.jsx("g",{clipPath:"url(#clip0)",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.99997 1.59778C8.19071 1.59778 7.39961 1.83775 6.72673 2.28736C6.05385 2.73697 5.5294 3.37601 5.21971 4.12367C4.91001 4.87134 4.82898 5.69405 4.98686 6.48777C5.14474 7.28149 5.53444 8.01056 6.10668 8.5828C6.67892 9.15504 7.408 9.54474 8.20172 9.70262C8.99544 9.8605 9.81815 9.77947 10.5658 9.46978C11.3135 9.16009 11.9525 8.63564 12.4021 7.96276C12.8517 7.28987 13.0917 6.49878 13.0917 5.68951C13.0917 4.60432 12.6606 3.56357 11.8933 2.79622C11.1259 2.02887 10.0852 1.59778 8.99997 1.59778ZM7.27426 3.9638C7.73195 3.50611 8.35271 3.24899 8.99997 3.24899C9.48266 3.24899 9.95452 3.39212 10.3559 3.66029C10.7572 3.92846 11.07 4.30962 11.2547 4.75556C11.4394 5.20151 11.4878 5.69222 11.3936 6.16563C11.2994 6.63905 11.067 7.07391 10.7257 7.41522C10.3844 7.75654 9.94951 7.98897 9.4761 8.08314C9.00268 8.17731 8.51197 8.12898 8.06603 7.94426C7.62008 7.75954 7.23892 7.44674 6.97075 7.04539C6.70258 6.64405 6.55945 6.1722 6.55945 5.68951C6.55945 5.04224 6.81658 4.42149 7.27426 3.9638ZM7.36691 10.3075C6.28172 10.3075 5.24097 10.7385 4.47362 11.5059C3.70627 12.2732 3.27518 13.314 3.27518 14.3992V17.121C3.27518 17.2763 3.4011 17.4022 3.55643 17.4022H4.64514C4.80047 17.4022 4.92639 17.2763 4.92639 17.121V14.3992C4.92639 13.7519 5.18351 13.1312 5.6412 12.6735C6.09889 12.2158 6.71964 11.9587 7.36691 11.9587H10.633C10.9535 11.9587 11.2709 12.0218 11.567 12.1444C11.8631 12.2671 12.1321 12.4469 12.3588 12.6735C12.5854 12.9001 12.7651 13.1691 12.8878 13.4652C13.0104 13.7613 13.0736 14.0787 13.0736 14.3992V17.121C13.0736 17.2763 13.1995 17.4022 13.3548 17.4022H14.4435C14.5989 17.4022 14.7248 17.2763 14.7248 17.121V14.3992C14.7248 13.314 14.2937 12.2732 13.5263 11.5059C12.759 10.7385 11.7182 10.3075 10.633 10.3075H7.36691Z"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0",children:e.jsx("rect",{width:"18",height:"18",transform:"translate(0 0.5)"})})})]})};Ye.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};Ye.displayName="person";const fs=Ye;var Qe=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M1.25 2.7087C1.25 2.24826 1.62326 1.875 2.0837 1.875H14.339C14.7995 1.875 15.1727 2.24826 15.1727 2.7087V9.31574C15.1727 9.77618 14.7995 10.1494 14.339 10.1494C13.8786 10.1494 13.5053 9.77618 13.5053 9.31574V3.54239H2.91739V16.7565H6.53772H8.34788H9.32435C9.78479 16.7565 10.158 17.1297 10.158 17.5902C10.158 18.0506 9.78479 18.4239 9.32435 18.4239H8.34788H2.0837C1.62326 18.4239 1.25 18.0506 1.25 17.5902V2.7087Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.21129 7.91935C7.70481 7.91935 7.29422 8.32993 7.29422 8.83641C7.29422 9.34289 7.70481 9.75348 8.21129 9.75348C8.71777 9.75348 9.12836 9.34289 9.12836 8.83641C9.12836 8.32993 8.71777 7.91935 8.21129 7.91935ZM5.62683 8.83641C5.62683 7.40905 6.78393 6.25195 8.21129 6.25195C9.63865 6.25195 10.7957 7.40905 10.7957 8.83641C10.7957 10.2638 9.63865 11.4209 8.21129 11.4209C6.78393 11.4209 5.62683 10.2638 5.62683 8.83641Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.62683 13.2133C5.62683 12.7529 6.00009 12.3796 6.46053 12.3796H9.96205C10.4225 12.3796 10.7957 12.7529 10.7957 13.2133C10.7957 13.6737 10.4225 14.047 9.96205 14.047H6.46053C6.00009 14.047 5.62683 13.6737 5.62683 13.2133Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6406 11.3125C15.8547 11.3125 16.0503 11.434 16.145 11.626L17.1779 13.7184L19.4876 14.056C19.6994 14.087 19.8753 14.2355 19.9413 14.4391C20.0074 14.6427 19.9521 14.8662 19.7987 15.0156L18.1279 16.643L18.5222 18.9421C18.5584 19.1532 18.4716 19.3665 18.2984 19.4923C18.1252 19.6182 17.8955 19.6347 17.706 19.5351L15.6406 18.4489L13.5753 19.5351C13.3858 19.6347 13.1561 19.6182 12.9829 19.4923C12.8096 19.3665 12.7229 19.1532 12.7591 18.9421L13.1534 16.643L11.4825 15.0156C11.3292 14.8662 11.2739 14.6427 11.3399 14.4391C11.406 14.2355 11.5818 14.087 11.7937 14.056L14.1034 13.7184L15.1362 11.626C15.231 11.434 15.4265 11.3125 15.6406 11.3125ZM15.6406 13.1458L14.9815 14.4813C14.8996 14.6471 14.7414 14.7621 14.5584 14.7889L13.0835 15.0044L14.1503 16.0435C14.283 16.1727 14.3435 16.359 14.3122 16.5416L14.0606 18.0088L15.3788 17.3155C15.5427 17.2293 15.7386 17.2293 15.9025 17.3155L17.2207 18.0088L16.969 16.5416C16.9377 16.359 16.9983 16.1727 17.131 16.0435L18.1978 15.0044L16.7229 14.7889C16.5399 14.7621 16.3817 14.6471 16.2998 14.4813L15.6406 13.1458Z"})]})};Qe.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Qe.displayName="external-issuer";const Qt=Qe;var be={},hs=t=>encodeURIComponent(t).replace(/[!'()*]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),Gt="%[a-f0-9]{2}",Pt=new RegExp("("+Gt+")|([^%]+?)","gi"),It=new RegExp("("+Gt+")+","gi");function Me(t,r){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;r=r||1;var l=t.slice(0,r),p=t.slice(r);return Array.prototype.concat.call([],Me(l),Me(p))}function gs(t){try{return decodeURIComponent(t)}catch{for(var r=t.match(Pt)||[],l=1;l<r.length;l++)t=Me(r,l).join(""),r=t.match(Pt)||[];return t}}function xs(t){for(var r={"%FE%FF":"��","%FF%FE":"��"},l=It.exec(t);l;){try{r[l[0]]=decodeURIComponent(l[0])}catch{var p=gs(l[0]);p!==l[0]&&(r[l[0]]=p)}l=It.exec(t)}r["%C2"]="�";for(var d=Object.keys(r),g=0;g<d.length;g++){var S=d[g];t=t.replace(new RegExp(S,"g"),r[S])}return t}var ys=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return xs(t)}},vs=(t,r)=>{if(!(typeof t=="string"&&typeof r=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(r==="")return[t];const l=t.indexOf(r);return l===-1?[t]:[t.slice(0,l),t.slice(l+r.length)]},bs=function(t,r){for(var l={},p=Object.keys(t),d=Array.isArray(r),g=0;g<p.length;g++){var S=p[g],u=t[S];(d?r.indexOf(S)!==-1:r(S,u,t))&&(l[S]=u)}return l};(function(t){const r=hs,l=ys,p=vs,d=bs,g=n=>n==null;function S(n){switch(n.arrayFormat){case"index":return s=>(a,c)=>{const x=a.length;return c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,[h(s,n),"[",x,"]"].join("")]:[...a,[h(s,n),"[",h(x,n),"]=",h(c,n)].join("")]};case"bracket":return s=>(a,c)=>c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,[h(s,n),"[]"].join("")]:[...a,[h(s,n),"[]=",h(c,n)].join("")];case"comma":case"separator":return s=>(a,c)=>c==null||c.length===0?a:a.length===0?[[h(s,n),"=",h(c,n)].join("")]:[[a,h(c,n)].join(n.arrayFormatSeparator)];default:return s=>(a,c)=>c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,h(s,n)]:[...a,[h(s,n),"=",h(c,n)].join("")]}}function u(n){let s;switch(n.arrayFormat){case"index":return(a,c,x)=>{if(s=/\[(\d*)\]$/.exec(a),a=a.replace(/\[\d*\]$/,""),!s){x[a]=c;return}x[a]===void 0&&(x[a]={}),x[a][s[1]]=c};case"bracket":return(a,c,x)=>{if(s=/(\[\])$/.exec(a),a=a.replace(/\[\]$/,""),!s){x[a]=c;return}if(x[a]===void 0){x[a]=[c];return}x[a]=[].concat(x[a],c)};case"comma":case"separator":return(a,c,x)=>{const y=typeof c=="string"&&c.includes(n.arrayFormatSeparator),w=typeof c=="string"&&!y&&o(c,n).includes(n.arrayFormatSeparator);c=w?o(c,n):c;const U=y||w?c.split(n.arrayFormatSeparator).map(F=>o(F,n)):c===null?c:o(c,n);x[a]=U};default:return(a,c,x)=>{if(x[a]===void 0){x[a]=c;return}x[a]=[].concat(x[a],c)}}}function b(n){if(typeof n!="string"||n.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function h(n,s){return s.encode?s.strict?r(n):encodeURIComponent(n):n}function o(n,s){return s.decode?l(n):n}function T(n){return Array.isArray(n)?n.sort():typeof n=="object"?T(Object.keys(n)).sort((s,a)=>Number(s)-Number(a)).map(s=>n[s]):n}function C(n){const s=n.indexOf("#");return s!==-1&&(n=n.slice(0,s)),n}function I(n){let s="";const a=n.indexOf("#");return a!==-1&&(s=n.slice(a)),s}function i(n){n=C(n);const s=n.indexOf("?");return s===-1?"":n.slice(s+1)}function k(n,s){return s.parseNumbers&&!Number.isNaN(Number(n))&&typeof n=="string"&&n.trim()!==""?n=Number(n):s.parseBooleans&&n!==null&&(n.toLowerCase()==="true"||n.toLowerCase()==="false")&&(n=n.toLowerCase()==="true"),n}function m(n,s){s=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},s),b(s.arrayFormatSeparator);const a=u(s),c=Object.create(null);if(typeof n!="string"||(n=n.trim().replace(/^[?#&]/,""),!n))return c;for(const x of n.split("&")){if(x==="")continue;let[y,w]=p(s.decode?x.replace(/\+/g," "):x,"=");w=w===void 0?null:["comma","separator"].includes(s.arrayFormat)?w:o(w,s),a(o(y,s),w,c)}for(const x of Object.keys(c)){const y=c[x];if(typeof y=="object"&&y!==null)for(const w of Object.keys(y))y[w]=k(y[w],s);else c[x]=k(y,s)}return s.sort===!1?c:(s.sort===!0?Object.keys(c).sort():Object.keys(c).sort(s.sort)).reduce((x,y)=>{const w=c[y];return w&&typeof w=="object"&&!Array.isArray(w)?x[y]=T(w):x[y]=w,x},Object.create(null))}t.extract=i,t.parse=m,t.stringify=(n,s)=>{if(!n)return"";s=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},s),b(s.arrayFormatSeparator);const a=w=>s.skipNull&&g(n[w])||s.skipEmptyString&&n[w]==="",c=S(s),x={};for(const w of Object.keys(n))a(w)||(x[w]=n[w]);const y=Object.keys(x);return s.sort!==!1&&y.sort(s.sort),y.map(w=>{const U=n[w];return U===void 0?"":U===null?h(w,s):Array.isArray(U)?U.reduce(c(w),[]).join("&"):h(w,s)+"="+h(U,s)}).filter(w=>w.length>0).join("&")},t.parseUrl=(n,s)=>{s=Object.assign({decode:!0},s);const[a,c]=p(n,"#");return Object.assign({url:a.split("?")[0]||"",query:m(i(n),s)},s&&s.parseFragmentIdentifier&&c?{fragmentIdentifier:o(c,s)}:{})},t.stringifyUrl=(n,s)=>{s=Object.assign({encode:!0,strict:!0},s);const a=C(n.url).split("?")[0]||"",c=t.extract(n.url),x=t.parse(c,{sort:!1}),y=Object.assign(x,n.query);let w=t.stringify(y,s);w&&(w=`?${w}`);let U=I(n.url);return n.fragmentIdentifier&&(U=`#${h(n.fragmentIdentifier,s)}`),`${a}${w}${U}`},t.pick=(n,s,a)=>{a=Object.assign({parseFragmentIdentifier:!0},a);const{url:c,query:x,fragmentIdentifier:y}=t.parseUrl(n,a);return t.stringifyUrl({url:c,query:d(x,s),fragmentIdentifier:y},a)},t.exclude=(n,s,a)=>{const c=Array.isArray(s)?x=>!s.includes(x):(x,y)=>!s(x,y);return t.pick(n,c,a)}})(be);const ae=gn,Cs={parseNumbers:!1,parseBooleans:!1},js={skipNull:!1,skipEmptyString:!1},Ss=(t,r)=>{var l,p;const{navigateMode:d="push",parseOptions:g,stringifyOptions:S}={},u=Object.assign(Object.assign({},Cs),g),b=Object.assign(Object.assign({},js),S),h=ae.useLocation(),o=(l=ae.useHistory)===null||l===void 0?void 0:l.call(ae),T=(p=ae.useNavigate)===null||p===void 0?void 0:p.call(ae),C=ts(),I=P.useRef(typeof t=="function"?t():t||{}),i=P.useMemo(()=>be.parse(h.search,u),[h.search]),k=P.useMemo(()=>Object.assign(Object.assign({},I.current),i),[i]);return[k,He(n=>{const s=typeof n=="function"?n(k):n;C(),o&&o[d]({hash:h.hash,search:be.stringify(Object.assign(Object.assign({},i),s),b)||"?"},h.state),T&&T({hash:h.hash,search:be.stringify(Object.assign(Object.assign({},i),s),b)||"?"},{replace:d==="replace",state:h.state})})]},ws=Ss,Ps=_t,Ne=Rn,_e=Ln,Is=os,kt={role:Ps.types.RoleType.ROLE_APPLICATION},ks=(t,r,l,p)=>{let d=l||kt;const g=(0,_e.isEthereumType)((0,_e.DidType)(l));if(g?d=(0,Ne.WalletType)(l):d=(0,Ne.WalletType)(kt),!(0,_e.isValid)(t)){let S="";try{return g?S=t.slice(0,66):S=t,(0,Ne.fromSecretKey)(S,d)}catch(u){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${u.message}`)}}if(!r)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,Is.fromAppDid)(t,r,d,p||0)};var Ts=ks,Jt=Ct&&Ct.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const le=Jt(Zn),Ds=_t,ye=Jt(Ts),As=Yn,Rs=(t,r,{returnWallet:l=!0}={})=>{var F,A;if(!t||typeof t!="object"||!Array.isArray(t.environments)||!(0,le.default)(t,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:p,configs:d=[]}=t,g=[...d,...p],S=g.find(D=>D.key==="BLOCKLET_APP_DESCRIPTION"),u=g.find(D=>D.key==="BLOCKLET_PASSPORT_COLOR"),b=g.find(D=>D.key==="BLOCKLET_APP_URL"),h=g.find(D=>D.key==="BLOCKLET_APP_TENANT_MODE"),{did:o,version:T}=t.meta,C=(0,As.getDisplayName)(t),I=(0,le.default)(S,"value",t.meta.description),i=(0,le.default)(u,"value","auto"),k=(0,le.default)(b,"value",""),m=(0,le.default)(h,"value","");if(!l)return{did:o,version:T,name:C,description:I,passportColor:i,appUrl:k,secret:"",wallet:null,permanentWallet:null,tenantMode:m};const n=g.find(D=>D.key==="BLOCKLET_APP_SK"),s=g.find(D=>D.key==="BLOCKLET_APP_CHAIN_TYPE")||g.find(D=>D.key==="BLOCKLET_WALLET_TYPE"),a=g.find(D=>D.key==="BLOCKLET_APP_PSK");let c;s&&(s.value==="ethereum"||s.value==="eth")&&(c=s.value);let x=null,y=null;if(n&&n.value)x=(0,ye.default)(n.value,void 0,c),a&&a.value&&a.value!==n.value&&(y=(0,ye.default)(a.value,void 0,c));else{if(!r||typeof r!="string")throw new Error("Node secret key must be a string");s?x=(0,ye.default)(t.meta.did,r,c):x=(0,ye.default)(t.meta.did,r)}const w=((A=(F=t.settings)==null?void 0:F.session)==null?void 0:A.salt)||"",U=Ds.Hasher.SHA3.hash256(jt.concat([x.secretKey,x.address,w].filter(Boolean).map(D=>jt.from(D))));return{did:o,version:T,name:C,description:I,passportColor:i,appUrl:k,secret:U,wallet:x,permanentWallet:y||x,tenantMode:m}};var Ls=Rs;const Es=xn(Ls);function Ge({teamDid:t,roles:r,apps:l,onCancel:p,onSuccess:d,onError:g,endpoint:S}){var k;const{api:u}=H(),{t:b,locale:h}=V(),o=Ve({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:l.length>0?l[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),T=async()=>{if(!o.role){o.error=b("team.member.error.passportEmpty");return}const m=o.remark.trim();o.error=null,o.loading=!0;try{let n=o.sourceAppPid??null;n===t&&(n=null);const s={teamDid:t,role:o.role,remark:m,sourceAppPid:n,passportExpireTime:o.passportExpireTime?o.passportExpireTime.toISOString():""};o.display&&(s.display={type:"url",content:o.display});const{inviteInfo:a}=await u.createMemberInvitation({input:s});o.inviteInfo=a,o.activeStep=1}catch(n){const s=X(n);o.error=s,g(n)}finally{o.loading=!1}},C=r.find(m=>m.name===o.role),i=[{body:e.jsxs(E,{sx:{display:"flex",flexDirection:"column",gap:3},children:[l.length>1?e.jsxs(Be,{fullWidth:!0,children:[e.jsx(Fe,{children:b("common.sourceApp")}),e.jsx($e,{value:o.sourceAppPid,onChange:m=>{o.error=null,o.sourceAppPid=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:o.loading,children:l.map(m=>e.jsx(Ce,{value:m.appPid,children:e.jsxs(E,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(E,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(En,{did:m.appPid,size:28}),m.appName]}),e.jsx(On,{did:m.appPid,compact:!0,responsive:!1})]})},m.appPid))})]}):null,e.jsxs(Be,{fullWidth:!0,variant:"outlined",children:[e.jsx(Fe,{children:b("common.passport")}),e.jsx($e,{"data-cy":"invite-member-select-role",value:o.role,onChange:m=>{o.error=null,o.role=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:o.loading,onKeyPress:m=>{m.key==="Enter"&&(m.preventDefault(),T())},children:r.filter(m=>m.name!=="owner").map(m=>e.jsx(Ce,{value:m.name,"data-cy":`invite-member-select-option-${m.name}`,children:e.jsxs(E,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(Y,{variant:"subtitle1",children:m.title||m.name}),e.jsx(Y,{variant:"caption",sx:{opacity:.7},children:m.description})]})},m.name))})]}),((k=C==null?void 0:C.extra)==null?void 0:k.display)==="custom"&&e.jsx(de,{label:b("common.display"),type:"url",value:o.display,onChange:m=>{o.error=null,o.display=m.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(de,{label:b("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.remark,onChange:m=>{o.error=null,o.remark=m.target.value},disabled:o.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Vt,{value:o.passportExpireTime,onChange:m=>{o.passportExpireTime=m}})]}),cancel:b("common.cancel"),confirm:b("team.member.inviteDialog.createInviteLink"),onCancel:p,onConfirm:T},{body:()=>{var n,s;const m=Se({inviteId:(n=o.inviteInfo)==null?void 0:n.inviteId,endpoint:S});return e.jsxs("div",{children:[e.jsx(E,{sx:{fontSize:16,fontWeight:"bold"},children:b("team.member.inviteDialog.createSuccessTip",{expireDate:pe((s=o.inviteInfo)==null?void 0:s.expireDate,h)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:m})]})},confirm:b("common.copy"),onConfirm:()=>{var n;const m=Se({inviteId:(n=o.inviteInfo)==null?void 0:n.inviteId,endpoint:S});ns(m),Z.success(b("common.copied")),d()},cancel:b("common.cancel"),onCancel:p}][o.activeStep];return e.jsxs(te,{title:b("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[i.cancel&&e.jsx(z,{onClick:i.onCancel,color:"inherit",children:i.cancel}),e.jsxs(z,{onClick:i.onConfirm,color:"primary",disabled:o.loading||!o.role,variant:"contained",autoFocus:!0,children:[o.loading&&e.jsx(oe,{size:16}),i.confirm]})]}),children:[e.jsx(qe,{component:"div",children:typeof i.body=="function"?i.body():i.body}),!!o.error&&e.jsx(re,{severity:"error",variant:"icon",children:o.error})]})}Ge.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,roles:v.array,apps:v.array,endpoint:v.string};Ge.defaultProps={onError:()=>{},roles:[],apps:[],endpoint:""};function Je({teamDid:t,onCancel:r,onSuccess:l,onError:p,endpoint:d}){const{api:g,info:S}=H(),{api:u}=P.useContext(Nn),[b,h]=P.useState(!1),{t:o,locale:T}=V(),[C,I]=P.useState(""),[i,k]=P.useState(!1),[m,n]=P.useState(0),[s,a]=P.useState(""),[c,x]=P.useState(""),y=!!We(S,"ownerNft.did"),w=is(async()=>{if(y){const{state:R}=await g.getDelegationState();return R}return{delegated:!0}});if(w.loading)return e.jsx(te,{title:o("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(oe,{})})});if(w.error)return e.jsx(te,{title:o("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx(re,{severity:"error",variant:"icon",children:X(w.error)})});const U=async()=>{I(null),h(!0);try{const{inviteInfo:R}=await g.createTransferInvitation({input:{teamDid:t,role:"owner",remark:c.trim()}});a(R),n(D.length-1)}catch(R){const W=X(R);I(W),p(R)}finally{h(!1)}},F=()=>{k(!0),n(1)},A=()=>{k(!1),n(0)},D=[{body:e.jsxs(Y,{component:"div",children:[e.jsxs(re,{severity:"warning",children:[e.jsx(Y,{children:o("team.transferNode.inviteDialog.tips.progress")}),e.jsx(Y,{children:o("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(re,{severity:"warning",children:e.jsx(Y,{children:o("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(de,{label:o("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:c,onChange:R=>{I(null),x(R.target.value)},disabled:b,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:o("common.cancel"),confirm:o("team.transferNode.inviteDialog.createInviteLink"),onCancel:r,onConfirm:y&&!We(w,"value.delegated")?F:U},{body:()=>e.jsx(_n,{action:"delegate-transfer-nft",open:i,locale:T,checkFn:u.get,onClose:A,onSuccess:U,checkTimeout:5*60*1e3,webWalletUrl:Qn(S),extraParams:{targetDID:S.did},messages:{title:o("team.transferNode.delegateDialog.title"),scan:o("team.transferNode.delegateDialog.scan"),confirm:o("team.transferNode.delegateDialog.confirm"),success:o("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const R=Se({inviteId:s.inviteId,endpoint:d});return e.jsxs("div",{children:[e.jsx(Os,{children:o("team.transferNode.inviteDialog.createSuccessTip",{expireDate:pe(s.expireDate,T)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:R})]})},confirm:o("common.confirm"),onConfirm:l}],O=D[m];return e.jsxs(te,{title:o("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[O.cancel&&e.jsx(z,{onClick:O.onCancel,color:"inherit",children:O.cancel}),e.jsxs(z,{onClick:O.onConfirm,color:"primary",disabled:b,variant:"contained",autoFocus:!0,children:[b&&e.jsx(oe,{size:16}),O.confirm]})]}),children:[e.jsx(qe,{component:"div",children:typeof O.body=="function"?O.body():O.body}),!!C&&e.jsx(re,{severity:"error",variant:"icon",children:C})]})}Je.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,endpoint:v.string};Je.defaultProps={onError:()=>{},endpoint:""};const Os=M.div`
|
|
2
2
|
font-size: 16px;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
`;var Xe=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),e.jsx("rect",{x:"12.5",y:"9.375",width:"7.5",height:"1.875",rx:"0.9375"})]})};Xe.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Xe.displayName="forbid-login";const Xt=Xe;var et=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),e.jsx("rect",{x:"12.5",y:"9.375",width:"7.5",height:"1.875",rx:"0.9375"}),e.jsx("rect",{x:"15.3125",y:"14.0625",width:"7.5",height:"1.875",rx:"0.9375",transform:"rotate(-90 15.3125 14.0625)"})]})};et.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};et.displayName="allow-login";const en=et;function Pe(t){const{passport:r,onDelete:l,...p}=t;return e.jsxs(Ns,{...p,children:[r.title||r.name," ",!!l&&e.jsx(Un,{"data-cy":"delete-issuance",className:"delete",onClick:l})]})}Pe.propTypes={passport:v.object.isRequired,onDelete:v.func};Pe.defaultProps={onDelete:null};const Ns=M.span`
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{j as e,H as h,ah as Ze,T as C,ab as A,e as Je,cF as J,ae as G,cG as Ge,aa as j,al as W,s as ge,ad as Se,be as et,cH as ze,a9 as ye,q,b4 as Y,b5 as H,y as tt,ap as st,bb as Ae}from"./vendor-mui-core-BV2FUxWJ.js";import{l as nt,i as Pe,f as fe}from"./vendor-hooks-BgUTpb6X.js";import{r as y,h as ot}from"./vendor-react-DEoibe3W.js";import{c as _,V as rt,a6 as at,$ as it,a7 as ct,w as lt,P as dt,a8 as ue,Q as ut}from"./vendor-arcblock-5qqHEVGo.js";import{Z as B,a as T,b2 as pt,j as R,b7 as V,a7 as mt,r as je,br as ft,B as pe,ao as ht,C as _e,as as xt}from"./vendor-ux-did-connect-DROQhYpS.js";import{G as O,D as M,y as E,a3 as gt,af as St,aD as yt}from"./index-DJzuhKQh.js";import{u as jt}from"./use-mobile-BAa0wi8o.js";import{b as Q,d as Me,a7 as bt,I as Ct,E as Ue,A as he}from"./vendor-utils-rHXShPKm.js";import"./api-BjteVZFg.js";import{u as Ne,C as kt,D as Dt,a as Bt}from"./connect-to-BLuNgRR8.js";import{b as wt,c as Et,d as Tt,i as It,e as xe,f as Rt,h as vt,j as At}from"./spaces-CTEbtAyX.js";import{f as X}from"./index-8eXqqyHQ.js";import{I as Ot}from"./index-Cj_-M8SX.js";import{R as Lt}from"./index-J3Tqz9ZT.js";import{d as zt}from"./MoreHoriz-jwSUI8G2.js";import{c as Pt}from"./dashboard-vkFEu-wZ.js";import{d as _t}from"./DeleteOutline-lCPjjhKz.js";import{g as Oe}from"./get-safe-url-CiQ8_q49.js";import{S as Mt}from"./switch-control-D5eJVUaV.js";import{C as Ut,u as Nt}from"./config-space-D2Cjeyk0.js";import{L as Le}from"./list-header-xt282ZMS.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BDA4jbwL.js";import"./confirm-CiiHIA-a.js";import"./PlayArrow-Cv1uXXJt.js";import"./session-ugMCR4Iu.js";import"./use-blocklet-logo-a8QJI4r-.js";import"./InfoOutlined-Duq1UDPu.js";import"./dot-DX56IFTM.js";import"./useAsync-Dv214fz8.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";async function Wt({blockletDid:t,nodeApi:r,spaceGateways:o}){let s=!1;const i=await Promise.all(o.map(async n=>{let{name:a}=n;const d=await wt(n.endpoint);return!Q(d)&&d!==a&&(a=d,s=!0),{...n,name:a}}));return s&&await Promise.all(i.filter(n=>n.did).map(n=>r.updateBlockletSpaceGateway({input:{did:t,where:{did:n.did},spaceGateway:{...n}}}))),i}function Ft({refresh:t}={}){var i;const{blocklet:r}=O(),o=(i=r==null?void 0:r.meta)==null?void 0:i.did,{api:s}=M();return nt(async()=>{if(!o)return[];const{spaceGateways:n}=await s.getBlockletSpaceGateways({input:{did:o}});return await Wt({blockletDid:o,nodeApi:s,spaceGateways:n})??[]},{refreshDeps:[o,t],onError(n){var a;(a=n==null?void 0:n.message)!=null&&a.includes("not logged")?console.warn(n):(console.error(n),B.error(X(n)))}})}function We({deps:t,setLoading:r,backupDate:o}={deps:[],setLoading:()=>{},backupDate:new Date}){var x;const{blocklet:s}=O(),[i,n]=y.useState([]),{api:a}=M(),[d,u]=y.useMemo(()=>o?[E(o).startOf("day").toISOString(),E(o).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[o]),c=Me(async()=>{try{if(r(!0),!s){n([]);return}const{backups:p}=await a.getBlockletBackups({input:{did:s.meta.did,startTime:d,endTime:u}});n(p??[])}catch(p){console.error(p),B.error(X(p))}finally{r(!1)}},1e3);return Pe(async()=>{c()},[(x=s==null?void 0:s.meta)==null?void 0:x.did].concat(t)),{backups:i}}function Kt({appDid:t}){const{backups:r}=We(),[o,s]=y.useState({message:"",progress:0,completed:!1}),i=M(),{ws:{useSubscription:n}}=i;return n(_.BlockletEvents.backupProgress,a=>{t===(a==null?void 0:a.appDid)&&s(()=>({...a}))},[t]),y.useEffect(()=>{var a;if(r!=null&&r.length&&bt((a=r[0])==null?void 0:a.status)){const[d]=r;s(()=>({message:d.message,progress:d.progress,completed:d.progress>=100}))}},[r]),o}function $t({deps:t=[],setLoading:r=()=>{}}={}){var d;const{blocklet:o}=O(),[s,i]=y.useState([]),{api:n}=M(),a=y.useCallback(Me(async()=>{var u;if(!n||!((u=o==null?void 0:o.meta)!=null&&u.did)){i([]);return}try{r(!0);const c=E(),x=c.subtract(1,"year"),{summary:p}=await n.getBlockletBackupSummary({input:{did:o.meta.did,startTime:x.toISOString(),endTime:c.toISOString()}});i(Array.isArray(p)?p:[])}catch(c){console.error("Failed to fetch backup summary:",c),B.error(X(c)),i([])}finally{r(!1)}},1e3),[]);return Pe(async()=>(await a(),()=>{a.cancel()}),[(d=o==null?void 0:o.meta)==null?void 0:d.did].concat(t)),{backupSummary:s}}const Fe=y.createContext({}),{Provider:qt,Consumer:Ws}=Fe;function be({children:t}){var K;const{t:r}=T(),{api:o}=M(),{blocklet:s}=O(),[i,n]=y.useState(null),[a,d]=y.useState(!1),{data:u,loading:c,mutate:x}=Ft({refresh:a}),p=Ct(u),g=Kt({appDid:s==null?void 0:s.appDid}),f=y.useMemo(()=>Et(s==null?void 0:s.environments),[s==null?void 0:s.environments]),[b,D]=y.useState(!1),[S,l]=y.useState(!1),{backups:te}=We({deps:[S,i],setLoading:D,backupDate:i}),[se,ne]=y.useState(!1),{backupSummary:oe}=$t({deps:[se]}),[U,z]=y.useState(u==null?void 0:u.find(m=>m.endpoint===f)),I=(K=s==null?void 0:s.settings)==null?void 0:K.autoBackup,v=()=>{d(m=>!m)},re=()=>{ne(m=>!m)},ae=()=>{l(m=>!m)},F=async m=>{await o.updateAutoBackup({input:{did:s.meta.did,autoBackup:m}})},Z=async()=>{await o.abortBlockletBackup({input:{appPid:s.meta.did}})},ie=async(m,N)=>{try{x(w=>{const P=[...w];return P.push({...m,loading:!0}),P}),await o.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:m}}),f!==N&&await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:N}]}}),z(m),v(),B.success(r("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"}))}catch(w){throw console.error(w),x(P=>[...P].filter(de=>de.did!==m.did)),w}},ce=async m=>{m&&(m.endpoint===f&&(await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I!=null&&I.enabled&&await F({enabled:!1})),await o.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:m==null?void 0:m.did}}),x(N=>{const w=[...N];return w.splice(w.indexOf(m),1),w}),z(m),v())},le=async m=>{await Promise.all([o.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:m.did},spaceGateway:m}}),f!==m.endpoint&&o.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:m.endpoint}]}})]),B.success(r("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"})),v()},k=m=>(m==null?void 0:m.endpoint)===f;return e.jsx(qt,{value:{spaceGateways:u||[],selectedSpaceGateway:U,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:v,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:p,spaceGatewayIsSelected:k,updateAutoBackup:F,abortBlockletBackup:Z,backupEndpoint:f,backupProgress:g,backups:te,backupSummary:oe,refreshBackupSummary:re,refreshBackups:ae,setBackupDate:n,backupsLoading:b,autoBackup:I},children:t})}be.propTypes={children:h.any.isRequired};be.defaultProps={};function L(){return y.useContext(Fe)}function ee({...t}){const{blocklet:r}=O(),{info:o}=M(),{t:s}=T(),i=Ne({blocklet:r}),n=gt(o),{spaceGateways:a,addSpaceGateway:d}=L(),u={checkFn:Ue.create({baseURL:he(window.location.origin,St())}).get,webWalletUrl:n,extraParams:{appPid:r.appPid,appDid:i.appDid,appName:i.appName,appDescription:i.appDescription,appUrl:i.appUrl,referrer:i.referrer,scopes:i.scopes,nodeDid:o.did}},c=async({endpoint:p,name:g,did:f})=>{const b=await Tt(p);if(!await It(b)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(a.some(l=>l.endpoint===p)){B.error(s("storage.spaces.gateway.add.duplicate",{name:g}));return}await d({name:g,did:f,url:b,endpoint:p},p)},x=async({spaceGateway:p})=>{try{await c(p)}catch(g){console.error(g),B.error(X(g))}};return e.jsx(rt,{...t,options:u,onSuccess:x})}ee.propTypes={};ee.defaultProps={};function Ke({...t}){const{t:r}=y.useContext(pt),{blocklet:o,loadingDiskInfo:s,actions:i}=O();if(y.useEffect(()=>{i==null||i.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),o.diskInfo){const n=(u,c,x)=>e.jsxs(C,{children:[u," ",e.jsx("strong",{children:c?yt(c):"empty"})]}),a=o.environments.reduce((u,c)=>(u[c.key]=c.value,u),{}),d=[{key:"appDir",name:r("blocklet.diskInfo.appDir"),value:n(a.BLOCKLET_APP_DIR,o.diskInfo.app)},{key:"dataDir",name:r("blocklet.diskInfo.dataDir"),value:n(a.BLOCKLET_DATA_DIR,o.diskInfo.data)},{key:"logDir",name:r("blocklet.diskInfo.logDir"),value:n(a.BLOCKLET_LOG_DIR,o.diskInfo.log)},{key:"cacheDir",name:r("blocklet.diskInfo.cacheDir"),value:n(a.BLOCKLET_CACHE_DIR,o.diskInfo.cache)}];return e.jsx(Yt,{component:"div",...t,children:d.map(u=>e.jsx(Ot,{valueComponent:"div",nameWidth:120,name:u.name,children:u.value},u.key))})}return s?e.jsx(A,{}):e.jsx(C,{children:r("blocklet.diskInfo.empty")})}const Yt=Ze(C)``;function Ce(){const{t}=T(),{setBackupDate:r,backupSummary:o}=L(),s=at({key:"lg"}),i=y.useRef(null),n=Je(),a=y.useCallback(c=>{r(c)},[r]),d=y.useMemo(()=>{const c=E().add(1,"day"),x=E().subtract(11,"month").startOf("month"),p=new Map(o.map(f=>[f.date,{date:f.date,successCount:f.successCount,errorCount:f.errorCount}])),g=[];for(let f=x.clone();E(f).isBefore(c);f=f.add(1,"day")){const b=f.format("YYYY-MM-DD");g.push(p.get(b)||{date:b,successCount:0,errorCount:0})}return g},[o]),u=y.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:b=>{const{date:D,successCount:S,errorCount:l}=d[b.dataIndex]||{date:b.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${D}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${l}</div>`].join(`
|
|
2
|
+
`)},backgroundColor:n.palette.background.paper,borderColor:n.palette.divider,textStyle:{color:n.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${n.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:J[600]},{min:-9,max:-6,color:J[500]},{min:-6,max:-3,color:J[400]},{min:-3,max:-1,color:J[300]},{min:0,max:0,color:n.palette.grey[200]},{min:1,max:3,color:G[300]},{min:3,max:6,color:G[400]},{min:6,max:9,color:G[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:G[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:n.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,color:n.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:n.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:n.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:d.map(b=>[b.date,b.errorCount?-b.errorCount:b.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:Ge[200],color:"inherit"}}}}),[d,t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(j,{ref:i,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(j,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Lt,{option:u,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:c=>{c.componentType==="series"&&c.data&&a(c.data[0])}}})})}),e.jsx(j,{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2,children:e.jsxs(W,{direction:s?"column":"row",spacing:s?2:1,width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center",children:[e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.failed")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.without")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.succeeded")})]})]})})]})}Ce.propTypes={};const Ht=ge(({className:t,...r})=>e.jsx(Se,{...r,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ke({status:t,message:r,createdAt:o}){const{t:s}=T(),i=t===R.BACKUPS.STATUS.PROGRESS&&E().diff(o,"hours")>=R.BACKUPS.TIMEOUT_HOURS,n=i&&s("common.timeoutError"),a=t===R.BACKUPS.STATUS.PROGRESS&&!i,d=t===R.BACKUPS.STATUS.SUCCEEDED&&!i;return a?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):d?e.jsx(V,{type:"success",children:s("common.succeeded")}):e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(V,{type:"error",children:s("common.failed")})," ",e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:r||n,children:e.jsx(ze,{children:e.jsx(it,{style:{width:"24px",height:"24px"},color:"error"})})})]})}ke.propTypes={status:h.string.isRequired,message:h.string,createdAt:h.string.isRequired};ke.defaultProps={message:""};function De({metadata:t}){const{t:r}=T();if(Q(t))return e.jsx(V,{type:"success",children:r("common.succeeded")});const o=t.count||0,s=t.size||0,i=ct(s,{iec:!0}),n=e.jsxs(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:[e.jsxs(C,{variant:"body2",children:[r("common.fileCount"),": ",o]}),e.jsxs(C,{variant:"body2",children:[r("common.fileSize"),": ",i]})]});return e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(V,{type:"success",children:r("common.succeeded")})," ",e.jsx(Ht,{title:n,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ze,{children:e.jsx(lt,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}De.propTypes={metadata:h.object};De.defaultProps={metadata:{}};function Be(){const{t,locale:r}=T(),{spaceGateways:o,backups:s,backupsLoading:i}=L(),n=y.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:d=>{var D;const{targetUrl:u,targetName:c,status:x,createdAt:p}=s[d],g=x===R.BACKUPS.STATUS.PROGRESS&&E().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,f=x===R.BACKUPS.STATUS.SUCCEEDED&&!g,b=c||((D=o.find(S=>u==null?void 0:u.includes(xe(S==null?void 0:S.endpoint))))==null?void 0:D.name)||"Unknown DID Space";return f?e.jsx(et,{fontSize:"16px",href:u,target:"_blank",children:b}):e.jsx(C,{variant:"body1",fontSize:"16px",children:b})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:d=>{const u=t(d===0?"common.auto":"common.manual");return e.jsx(V,{children:u})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:d=>E(d).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:d=>Q(d)?"":E(d).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:d=>{const u=(s==null?void 0:s[d])??{},{status:c,message:x,createdAt:p,metadata:g}=u,f=c===R.BACKUPS.STATUS.PROGRESS&&E().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,b=c===R.BACKUPS.STATUS.PROGRESS&&!f,D=c===R.BACKUPS.STATUS.SUCCEEDED&&!f;return b?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):D?e.jsx(De,{metadata:g}):e.jsx(ke,{status:c,message:x,createdAt:p})}}}],[s,o,t]),a=y.useMemo(()=>!(s!=null&&s.length),[s]);return e.jsx(e.Fragment,{children:a?e.jsx(j,{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px",children:t("storage.spaces.record.emptyData")}):e.jsx(mt,{title:"",loading:i,data:s,columns:n,emptyNode:t("storage.spaces.record.emptyData",r),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}Be.propTypes={};function $e(){const{t}=T();return e.jsxs(j,{children:[e.jsxs(j,{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"},children:[e.jsxs(j,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240,children:[e.jsx(dt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(C,{my:2,sx:{textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(ee,{})]}),e.jsxs(j,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.spaces.backup.records")})}),e.jsx(Ce,{})]})]}),e.jsx(Be,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2,children:t("common.dataStorage")}),e.jsx(Ke,{})]})}$e.propTypes={};var we={},Vt=ye;Object.defineProperty(we,"__esModule",{value:!0});var qe=we.default=void 0,Qt=Vt(je()),Xt=e;qe=we.default=(0,Qt.default)((0,Xt.jsx)("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"}),"ArrowOutward");var Ee={},Zt=ye;Object.defineProperty(Ee,"__esModule",{value:!0});var Ye=Ee.default=void 0,Jt=Zt(je()),Gt=e;Ye=Ee.default=(0,Jt.default)((0,Gt.jsx)("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"}),"ElectricBoltOutlined");var Te={},es=ye;Object.defineProperty(Te,"__esModule",{value:!0});var He=Te.default=void 0,ts=es(je()),ss=e;He=Te.default=(0,ts.default)((0,ss.jsx)("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}),"FolderOutlined");function Ie({spaceGateway:t,onConfirm:r,onCancel:o}){const{t:s}=T(),[i,n]=y.useState(!1),[a,d]=y.useState(!1),u=(p,g)=>{p==null||p.preventDefault(),p==null||p.stopPropagation(),n(g)},c=async p=>{try{p==null||p.stopPropagation(),d(!0),await(r==null?void 0:r(t)),n(!1)}catch(g){console.error(g),B.error(`${s("storage.space.gateway.delete.failed")}: ${X(g)}`)}finally{n(!1),d(!1)}},x=p=>{u(p,!1),o==null||o(p)};return e.jsxs(e.Fragment,{children:[e.jsxs(q,{color:"red",onClick:p=>u(p,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(_t,{fontSize:"small"})}),e.jsx(H,{style:{color:"red"},children:s("common.delete")})]}),e.jsx(ft,{title:s("storage.spaces.gateway.delete.title"),open:i,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:a}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:a}},onConfirm:c,onCancel:x,children:e.jsx(C,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t==null?void 0:t.name}`})})})]})}Ie.propTypes={spaceGateway:h.shape({name:h.string.isRequired,url:h.string.isRequired,protected:h.bool}).isRequired,onConfirm:h.func,onCancel:h.func};Ie.defaultProps={onConfirm:()=>{},onCancel:()=>{}};function Re({spaceGateway:t,selected:r,onDelete:o,onConnect:s,enableSwitchToSpace:i,backupInProgress:n,...a}){const{abortBlockletBackup:d}=L(),[u,c]=y.useState(null),{t:x}=T(),[p,g]=y.useState(!1),f=(S,l)=>{S.stopPropagation(),S.preventDefault(),c(l&&S.currentTarget)},b=async S=>{try{g(!0),f(S,!1),await s(t)}catch(l){console.error(l),B.error(l.message)}finally{g(!1)}},D=async S=>{try{g(!0),f(S,!1),await d()}catch(l){console.error(l),B.error(l.message)}finally{g(!1)}};return e.jsxs(e.Fragment,{children:[p||t!=null&&t.loading?e.jsx(A,{sx:{ml:1},size:"24px"}):e.jsx(tt,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>f(S,!0),...a,children:e.jsx(zt,{})}),e.jsxs(st,{id:"simple-menu",anchorEl:u,keepMounted:!0,open:!!u,onClose:S=>f(S,!1),children:[e.jsxs(q,{onClick:S=>{f(S,!1),window.open(Oe(t.endpoint?Rt(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(qe,{fontSize:"small"})}),e.jsx(H,{children:x("common.open")})]}),e.jsxs(q,{onClick:S=>{f(S,!1),window.open(Oe(vt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(He,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.strategy.viewBackupFiles")})]}),!r&&i&&e.jsxs(q,{onClick:b,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ye,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.connect.switchToSpace")})]}),n&&e.jsxs(q,{onClick:D,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Pt,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.connect.abortBlockletBackup")})]}),!n&&e.jsx(Ie,{spaceGateway:t,onConfirm:async()=>{c(null),await(o==null?void 0:o(t))},onCancel:()=>c(null)})]})]})}Re.propTypes={spaceGateway:h.shape({name:h.string.isRequired,url:h.string.isRequired,protected:h.bool,endpoint:h.string.isRequired,loading:h.bool}).isRequired,selected:h.bool.isRequired,enableSwitchToSpace:h.bool,onDelete:h.func,onConnect:h.func,backupInProgress:h.bool};Re.defaultProps={onDelete:()=>{},onConnect:()=>{},enableSwitchToSpace:!0,backupInProgress:!1};const ns=ge(({className:t,...r})=>e.jsx(Se,{...r,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ve({spaceGateway:t,spaceStatus:r,selected:o,onConnected:s,onDeleted:i,onBackedUp:n}){const{t:a,locale:d}=T(),{blocklet:u}=O(),{api:c,info:{did:x}}=M(),{appDid:p,appName:g,appDescription:f,scopes:b,appUrl:D,referrer:S}=Ne({blocklet:u}),{backupProgress:l,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:ne,refreshBackups:oe}=L(),[U,z]=y.useState(!1),[I,v]=y.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:a("storage.spaces.authorize.title",{appName:g},d),scan:a("storage.spaces.authorize.scan",{appName:g},d),confirm:"",success:e.jsx(C,{gutterBottom:!0,children:a("storage.spaces.authorize.success")})},onClose:()=>{v(k=>({...k,open:!1}))}}),re=o&&!U&&r===ue.DISCONNECTED,ae=o&&!U&&!t.loading&&r===ue.CONNECTED,F=o&&U&&r===ue.CONNECTED&&(l==null?void 0:l.progress)>=0,Z=async()=>{try{if(await At(t==null?void 0:t.endpoint)){await c.configBlocklet({input:{did:[u.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(a("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s==null||s(null,t);return}}catch(k){console.error(k),s==null||s(k,t);return}v(k=>({...k,open:!0,prefix:he(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:Ue.create({baseURL:he(t.url,"space")}).get,extraParams:{appDid:p,appName:g,appDescription:f,scopes:b,appUrl:D,referrer:S,nodeDid:x,spaceDid:t.did}}))},ie=async(k,K)=>{const m=K(k.endpoint),N=xe(m),w=k.space?K(k.space):{};if(t.did&&N!==t.did){v(de=>({...de,open:!1}));const $=a("storage.spaces.gateway.switch.failedForMismatchSpace",{name:w!=null&&w.name?w.name:""});B.error($),s==null||s(new Error($),t);return}const P={...t,name:w.name??"DID Space",did:w.did??xe(m),endpoint:m};await te(P),v($=>({...$,open:!1})),s==null||s(null,P)},ce=async()=>{try{if(U)return;z(!0),await c.backupBlocklet({input:{appDid:u.appDid,to:"spaces"}})}catch(k){console.error(k),B.error(k.message),n==null||n(k,t)}finally{z(!0)}},le=async()=>{try{await se(t),B.success(a("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),i==null||i(null,t)}catch(k){console.error(k),i==null||i(k,t)}};return y.useEffect(()=>{l!=null&&l.completed?(o&&((l==null?void 0:l.progress)===100?(B.success(a("storage.spaces.backupSuccessfully")),n==null||n(null,t)):l.message&&(n==null||n(new Error(l==null?void 0:l.message),t)),l.progress=0,l.message=""),z(!1),setTimeout(()=>{ne(),oe()},1e3)):l.progress&&z(!0)},[l]),e.jsxs(e.Fragment,{children:[e.jsxs(j,{sx:{".action-btn":{borderRadius:1,marginLeft:1}},display:"flex",alignItems:"center",children:[ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:a("storage.spaces.strategy.backupNow")}),re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:Z,children:a("storage.spaces.disconnected.reconnectNow")}),F&&e.jsx(ns,{title:(l==null?void 0:l.message)&&e.jsx(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:e.jsx(C,{variant:"body2",children:l.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(A,{variant:"determinate",value:l==null?void 0:l.progress,size:14,sx:{mr:1}}),l==null?void 0:l.progress,"%"]})}),e.jsx(ht,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:d},"get-endpoint")]}),e.jsx(Re,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:o,onDelete:le,onConnect:Z,enableSwitchToSpace:(l==null?void 0:l.completed)||Q(l==null?void 0:l.message),backupInProgress:F})]})}ve.propTypes={spaceGateway:h.shape({did:h.string.isRequired,name:h.string.isRequired,url:h.string.isRequired,endpoint:h.string.isRequired,protected:h.bool,loading:h.bool}).isRequired,spaceStatus:h.string.isRequired,selected:h.bool.isRequired,onConnected:h.func,onDeleted:h.func,onBackedUp:h.func};ve.defaultProps={onConnected:()=>{},onDeleted:()=>{},onBackedUp:()=>{}};function Ve({...t}){const{t:r}=T();return e.jsxs(j,{...t,children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:r("storage.spaces.backup.records")})}),e.jsx(Ce,{}),e.jsx(Be,{})]})}Ve.propTypes={};function Qe({...t}){const{t:r}=T(),{autoBackup:o,updateAutoBackup:s}=L(),i=async()=>{try{const n=!(o!=null&&o.enabled);await s({enabled:n}),B.success(r(n?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(n){B.error(n.message)}};return e.jsx(Mt,{checked:!!(o!=null&&o.enabled),onChange:i,name:"enableWelcomePage",labelProps:{label:e.jsx(C,{marginRight:"8px",children:e.jsx("span",{children:r("storage.spaces.autoBackup.title")})})},style:{...t.style}})}Qe.propTypes={};function os(){const{t}=T(),{spaceGateways:r,spaceGatewaysLoading:o,spaceGatewayIsSelected:s}=L(),i=o&&!(r!=null&&r.length),n=({spaceGateway:a,spaceStatus:d,selected:u,refresh:c})=>e.jsx(ve,{spaceGateway:a,spaceStatus:d,selected:u,onConnected:()=>c(),onBackedUp:x=>x&&c()});return e.jsxs(j,{display:"flex",flexDirection:"column",children:[e.jsxs(j,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1,children:t("storage.spaces.connected.title")}),e.jsx(Qe,{}),e.jsx(ee,{})]}),e.jsx(j,{mt:2,children:i?e.jsx(j,{display:"flex",justifyContent:"center",children:e.jsx(A,{})}):e.jsx(Ae,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:r.map(a=>e.jsx(Ae,{item:!0,xs:12,md:6,children:e.jsx(ut,{endpoint:a.endpoint,selected:s(a),action:n},a.endpoint)}))})})}),e.jsx(Ve,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,children:t("common.dataStorage")}),e.jsx(Ke,{})]})}function rs(){const{spaceGatewaysFirstLoading:t,spaceGateways:r}=L();return t?e.jsx(_e,{relative:"parent",children:e.jsx(A,{})}):Q(r)?e.jsx($e,{}):e.jsx(os,{})}function as(){return e.jsx(be,{children:e.jsx(rs,{})})}function is(){const{spaceGateway:t,settingStorageEndpoint:r,updateSpaceGateway:o,hasStorageEndpoint:s,loading:i,storageEndpoint:n}=Nt(),a=fe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return i?e.jsx(_e,{relative:"parent",children:e.jsx(A,{})}):e.jsxs(j,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(kt,{spaceGateway:t,settingStorageEndpoint:r}):e.jsx(Dt,{}),e.jsx(j,{sx:a,children:e.jsx(Bt,{onConnect:o,storageEndpoint:n})})]})}function cs(){const{t}=T();return e.jsxs(Ut,{children:[e.jsxs(W,{spacing:1,marginBottom:2,children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.appLevel.title")}),e.jsx(C,{color:"text.secondary",children:t("storage.appLevel.description")})]}),e.jsx(is,{})]})}function Xe({navOrientation:t,...r}){const{t:o,locale:s}=T(),{blocklet:i}=O(),n=jt({key:"md"}),[a,d]=ot(),u=a.get("tab")||"backup",c=n?"horizontal":t,x=fe(()=>{var l;const D=[{label:o("common.backup"),value:"backup"}],S=(l=i==null?void 0:i.capabilities)==null?void 0:l.didSpace;return(S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&D.push({label:o("common.storage"),value:"storage"}),D},[s,c]),g=fe(()=>({backup:e.jsx(as,{}),storage:e.jsx(cs,{})}))[u],f=D=>{d(S=>(D==="backup"?S.delete("tab"):S.set("tab",D),S))};if(x.length<=1)return e.jsx(me,{children:g});const b=e.jsx(xt,{tabs:x,current:u,orientation:c,onChange:f,sx:[{borderRight:1,height:"100%",borderColor:"divider"},c==="horizontal"&&{borderRight:0}]});if(c==="vertical")return e.jsx(j,{...r,children:e.jsxs(W,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(j,{sx:{flexShrink:0},children:e.jsx(Le,{left:b})}),e.jsx(j,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:g})})]})});if(c==="horizontal")return e.jsxs(j,{...r,children:[e.jsx(Le,{left:b}),e.jsx(me,{sx:{mt:2},children:g})]})}Xe.propTypes={navOrientation:h.oneOf(["vertical","horizontal"])};Xe.defaultProps={navOrientation:"vertical"};const me=ge(j)`
|
|
3
|
+
position: relative;
|
|
4
|
+
min-height: 66vh;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
`;export{Xe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as m}from"./vendor-react-DEoibe3W.js";import{a as k,Y as T,as as M,bN as P,j as R}from"./vendor-ux-did-connect-
|
|
1
|
+
import{r as m}from"./vendor-react-DEoibe3W.js";import{a as k,Y as T,as as M,bN as P,j as R}from"./vendor-ux-did-connect-DROQhYpS.js";import{l as v}from"./vendor-hooks-BgUTpb6X.js";import{j as e,aa as s,ab as C,ak as j,al as B,bo as E,br as L,bn as W,q as D,be as A,I as _,y as z,H as q}from"./vendor-mui-core-BV2FUxWJ.js";import{d as F}from"./Launch-ipC6Ic2p.js";import{a as U}from"./api-BjteVZFg.js";import{T as K}from"./table-tips-biAHyN1z.js";import{D as w}from"./index-DJzuhKQh.js";import{u as N}from"./dashboard-vkFEu-wZ.js";import"./vendor-utils-rHXShPKm.js";import"./lottie-web-jYmAQWuC.js";import"./InfoOutlined-Duq1UDPu.js";import"./use-mobile-BAa0wi8o.js";import"./vendor-arcblock-5qqHEVGo.js";import"./useLocalStorage-BDA4jbwL.js";import"./index-8eXqqyHQ.js";import"./confirm-CiiHIA-a.js";import"./PlayArrow-Cv1uXXJt.js";import"./get-safe-url-CiQ8_q49.js";import"./session-ugMCR4Iu.js";import"./use-blocklet-logo-a8QJI4r-.js";import"./dot-DX56IFTM.js";import"./useAsync-Dv214fz8.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";function y({endpoint:a}){const[i,r]=m.useState("mcp-link"),h=w(),{api:g}=w(),{teamDid:p}=N(),{t:u,locale:d}=k(),{data:o,run:b,loading:x}=v(()=>g.createAccessKey({input:{teamDid:p,passport:R.SERVER_ROLES.ADMIN,authType:"simple",remark:"Generated by MCP Servers"}}),{manual:!0}),{imgPrefix:t}=h,n=m.useMemo(()=>[{icon:e.jsx(s,{sx:{width:20,height:20},children:"🔗"}),value:"mcp-link",label:"MCP Link"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/claude.webp`,alt:"Claude",sx:{width:20,height:20}}),value:"claude",label:"Claude"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/cursor.png`,alt:"Cursor",sx:{width:20,height:20}}),value:"cursor",label:"Cursor"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/cline.png`,alt:"Cline",sx:{width:20,height:20}}),value:"cline",label:"Cline"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/roocline.png`,alt:"Roo Cline",sx:{width:20,height:20}}),value:"roo-cline",label:"Roo Cline"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/windsurf.png`,alt:"Windsurf",sx:{width:20,height:20}}),value:"windsurf",label:"Windsurf"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/witsy.png`,alt:"Witsy",sx:{width:20,height:20}}),value:"witsy",label:"Witsy"}],[t]),l=n.find(c=>c.value===i),f=m.useMemo(()=>{var c;return(c=o==null?void 0:o.data)==null?void 0:c.accessKeySecret},[o]),$=m.useMemo(()=>!f&&i!=="mcp-link",[f,i]),S=c=>{const I=`npx @blocklet/install-mcp@latest i ${a} --client ${c} --streamableHTTP --oauth2Bearer ${f}`;switch(c){case"cursor":case"claude":case"cline":case"roo-cline":case"windsurf":case"witsy":return I;case"mcp-link":default:return a}};return e.jsxs(s,{children:[e.jsx(M,{tabs:n,current:i,onChange:r,scrollButtons:"auto",iconPosition:"start"}),e.jsxs(s,{children:[e.jsxs(s,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(s,{component:"h2",children:i==="mcp-link"?l==null?void 0:l.label:`${l==null?void 0:l.label} ${u("installCommand")}`}),i!=="mcp-link"&&e.jsx(A,{href:`https://www.arcblock.io/docs/blocklet-developer/${d}/mcp-${i}`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(_,{size:"small",children:e.jsx(F,{})})})]}),e.jsxs(s,{position:"relative",sx:{"& .codeblock__inner":{overflow:"auto !important"}},children:[e.jsx(P,{code:S(i),language:"shell",style:{margin:0}}),$&&e.jsx(s,{position:"absolute",top:0,right:0,left:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",sx:{bgcolor:"action.active",backdropFilter:"blur(3px)",WebkitBackdropFilter:"blur(3px)",zIndex:1},children:x?e.jsx(C,{}):e.jsx(z,{variant:"contained",color:"primary",onClick:b,size:"small",children:`${u("common.generate")} ${u("command")}`})})]})]})]})}y.propTypes={endpoint:q.string.isRequired};function ge(){var x;const[a,i]=m.useState(null),{t:r,locale:h}=k(),g=`${(x=window==null?void 0:window.blocklet)==null?void 0:x.appUrl}/.well-known/service/mcp/servers`,{data:p,loading:u,error:d}=v(()=>Promise.all([U.get(g)])),o=m.useMemo(()=>{var t,n;return((n=(t=p==null?void 0:p[0])==null?void 0:t.data)==null?void 0:n.servers)||[]},[p]);m.useEffect(()=>{o!=null&&o.length&&i(o.find(t=>{var n;return t.did===((n=window==null?void 0:window.blocklet)==null?void 0:n.did)})||o[0])},[o]);const b=t=>{const n=t.target.value;i(o.find(l=>l.did===n))};return u?e.jsx(s,{children:e.jsx(C,{})}):d?e.jsx(j,{color:"error",children:d==null?void 0:d.message}):o!=null&&o.length?e.jsxs(B,{gap:2,sx:{maxWidth:1200},children:[e.jsx(K,{title:r("mcp.listTitle"),tooltipTitle:r("mcp.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${h}/mcp-server`}),e.jsxs(E,{fullWidth:!0,children:[e.jsx(L,{id:"server-select-label",children:r("mcp.available")}),e.jsx(W,{labelId:"server-select-label",value:(a==null?void 0:a.did)||"",label:r("mcp.available"),onChange:b,children:o.map(t=>e.jsx(D,{value:t.did,children:e.jsxs(s,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(T,{variant:"rounded",shape:"square",did:t.did,src:t.logo,size:20}),e.jsx(s,{sx:{fontSize:14},children:t.name})]})},t.did))})]}),a&&e.jsx(y,{endpoint:a.endpoint})]}):e.jsx(j,{color:"warning",children:r("mcp.noServer")})}export{ge as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as r,T as i}from"./vendor-mui-core-BV2FUxWJ.js";import{$ as p,an as x}from"./vendor-utils-rHXShPKm.js";import{s as c}from"./vendor-ux-did-connect-
|
|
1
|
+
import{j as r,T as i}from"./vendor-mui-core-BV2FUxWJ.js";import{$ as p,an as x}from"./vendor-utils-rHXShPKm.js";import{s as c}from"./vendor-ux-did-connect-DROQhYpS.js";function h({name:t,nameFormatter:a=o=>typeof o=="string"?o.split(" ").map(f=>p(x(f))).join(" "):o,layout:n="horizontal",children:e,valueComponent:l="div",nameWidth:s=90,...m}){return r.jsxs(u,{layout:n,width:s,...m,children:[r.jsx(i,{color:"textSecondary",className:"info-row__name",children:a(t)}),e&&r.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:e})]})}const u=c("div")`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: ${t=>t.layout==="vertical"?"column":"row"};
|
|
4
4
|
justify-content: flex-start;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as b}from"./vendor-react-DEoibe3W.js";import{a as D,W as R,j as ie,B as z,b2 as be,am as pe,bN as re,Z as je,aA as Ce,bu as ke,c3 as Ke,b4 as ve,a7 as Te,a0 as Ae}from"./vendor-ux-did-connect-
|
|
1
|
+
import{r as b}from"./vendor-react-DEoibe3W.js";import{a as D,W as R,j as ie,B as z,b2 as be,am as pe,bN as re,Z as je,aA as Ce,bu as ke,c3 as Ke,b4 as ve,a7 as Te,a0 as Ae}from"./vendor-ux-did-connect-DROQhYpS.js";import{d as we}from"./Edit-BqpcPg9o.js";import{f as Se}from"./index-8eXqqyHQ.js";import{r as me}from"./passport-item-B9iOvD4Y.js";import{D as B,n as M,aL as De,G as Ie,f as Re}from"./index-DJzuhKQh.js";import{u as $}from"./dashboard-vkFEu-wZ.js";import{j as e,H as x,bo as O,br as G,bn as H,q as V,aa as f,al as Q,O as E,ab as Be,bs as $e,bR as _e,ah as P,T as N,ad as ce,ak as Ne}from"./vendor-mui-core-BV2FUxWJ.js";import{O as Pe,a0 as We}from"./vendor-arcblock-5qqHEVGo.js";import{T as ue}from"./index-hO3Mo-qi.js";import{C as xe}from"./confirm-CiiHIA-a.js";import{a0 as Le}from"./vendor-utils-rHXShPKm.js";import{C as F}from"./click-to-copy-B26zKr7i.js";import{D as Ue}from"./delete-confirm-BPtFZ4JP.js";import{P as qe}from"./permission-CbTKdC7W.js";import{l as ze,y as Me}from"./vendor-hooks-BgUTpb6X.js";import{U as Ee,C as Fe,I as Oe}from"./index-nhpGyAFA.js";import{B as Ge}from"./bundle-avatar-BP8xFngr.js";import{p as He}from"./util-D-q3oYk9.js";import{W as le}from"./did-address-BtAnHi7m.js";import{A as Ve}from"./actions-BA8hCarh.js";import{u as Qe}from"./use-mobile-BAa0wi8o.js";import{T as de}from"./table-tips-biAHyN1z.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BDA4jbwL.js";import"./PlayArrow-Cv1uXXJt.js";import"./get-safe-url-CiQ8_q49.js";import"./session-ugMCR4Iu.js";import"./use-blocklet-logo-a8QJI4r-.js";import"./InfoOutlined-Duq1UDPu.js";import"./dot-DX56IFTM.js";import"./useAsync-Dv214fz8.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./vendor-mui-x-Bo-XOtzq.js";import"./AdapterDayjs-Bs_Q9JXL.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./base32-D35YSxth.js";import"./MoreHoriz-jwSUI8G2.js";function Z({value:t}){const{t:s,locale:m}=D(),l=new Date;return new Date(t)<l?e.jsxs("span",{style:{color:"red"},children:[e.jsx(R,{value:t,locale:m}),`${s("setting.accessKey.expired",{time:""})}`]}):e.jsx(R,{value:t,locale:m,type:"all"})}Z.propTypes={value:x.string.isRequired};function J({value:t,onChange:s,...m}){const{t:l}=D(),d=b.useMemo(()=>[{value:"signature",title:l("setting.accessKey.signature"),description:l("setting.accessKey.signatureDesc")},{value:"simple",title:l("setting.accessKey.simple"),description:l("setting.accessKey.simpleDesc")}],[l]);return e.jsxs(O,{style:{width:"100%"},variant:"outlined",...m,children:[e.jsx(G,{children:l("setting.accessKey.authType")}),e.jsx(H,{value:t,onChange:s,fullWidth:!0,label:l("setting.accessKey.authType"),children:d.map(o=>e.jsx(V,{value:o.value,children:e.jsxs(f,{children:[e.jsx("span",{children:o.title}),e.jsx(f,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:o.description})]})},o.value))})]})}J.propTypes={value:x.string.isRequired,onChange:x.func.isRequired};const L=()=>{const t=ie.RBAC_CONFIG.roles.filter(d=>d.passport),{inService:s}=B(),{roles:m}=$(),l=[...t,...s?m:[]];return Le(l,"name").filter(d=>d.name!==ie.ROLES.OWNER)};function X(t){const{remark:s,onCreate:m}=t,{api:l}=B(),{teamDid:d}=$(),{t:o}=D(),[k,j]=b.useState(!1),[c,h]=b.useState(null),y=L(),T=()=>{j(!1),h(null)},K=async a=>{const{remark:v,passport:r,authType:n}=a;j(!0);const u=await l.createAccessKey({input:{teamDid:d,remark:v.trim(),passport:r,expireAt:a.expireAt?new Date(a.expireAt).getTime():null,authType:n}}),{data:S}=u;m(S),h(null),j(!1)},g={title:`${o("common.create")} ${o("accessKey")}`,description:(a,v,r)=>e.jsxs(Q,{gap:3,children:[e.jsx(E,{label:o("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:a.remark,onChange:n=>{v({...a,remark:n.target.value,__disableConfirm:!a.passport||!n.target.value.trim()}),n.target.value.trim()?r(""):r(o("setting.accessKey.remarkInvalid"))}}),e.jsxs(O,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:o("setting.accessKey.passport")}),e.jsx(H,{"data-cy":"create-access-key-select-passport",value:a.passport,onChange:n=>{const u=n.target.value;r(null),v({...a,passport:u,__disableConfirm:!a.remark||!u})},fullWidth:!0,label:o("setting.accessKey.passport"),disabled:k,children:y.map(n=>e.jsx(V,{value:n.name,"data-cy":`create-access-key-passport-option-${n.name}`,children:e.jsxs(f,{children:[e.jsx("span",{children:n.title||n.name}),e.jsx(f,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:n.description})]})},n.name))})]}),e.jsx(J,{value:a.authType,onChange:n=>{v({...a,authType:n.target.value})}}),e.jsx(ue,{placeholder:o("setting.accessKey.expireTime"),value:a.expireAt,onChange:n=>{v({...a,expireAt:n,__disableConfirm:!a.passport||!a.remark||!n})}})]}),confirm:o("common.confirm"),cancel:o("common.cancel"),color:"primary",params:{remark:s,authType:"signature",__disableConfirm:!s.trim()},onConfirm:K,onCancel:T};return e.jsxs(e.Fragment,{children:[e.jsxs(z,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>h(g),className:"rule-action",children:[k?e.jsx(Be,{size:16}):e.jsx(Pe,{style:{fontSize:16}}),o("common.create")]}),c&&e.jsx(xe,{title:c.title,description:c.description,confirm:c.confirm,color:c.color,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}X.propTypes={remark:x.string,onCreate:x.func};X.defaultProps={onCreate:()=>{},remark:""};function Y(t){const{onConfirm:s,accessKeyId:m,accessKeySecret:l,hideSecret:d}=t,{t:o}=b.useContext(be),[k,j]=b.useState(!1),[c,h]=b.useState(()=>d),y=()=>{h(!c)},T=a=>{j(a.target.checked)},K=b.useMemo(()=>{var a;return d?`const Client = require('@abtnode/client');
|
|
2
2
|
|
|
3
3
|
const client = new Client(fullEndpoint);
|
|
4
4
|
client.setAuthAccessKey({
|