@abtnode/blocklet-services 1.16.44-beta-20250529-004636-15e80e20 → 1.16.44-beta-20250529-223630-10e16ac8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/assets/{access-control-eEjmzQYf.js → access-control-BhxOcGdx.js} +1 -1
  2. package/dist/assets/{add-component-core-pJP41zEE.js → add-component-core-XUReAzat.js} +1 -1
  3. package/dist/assets/{add-resource-CZeL421l.js → add-resource-C3kDcfBw.js} +1 -1
  4. package/dist/assets/{advanced-P0pT0XgG.js → advanced-hz-KSWn2.js} +1 -1
  5. package/dist/assets/{appearance-DeIbdwlo.js → appearance-ChvtVBNv.js} +1 -1
  6. package/dist/assets/{audit-logs-DdN0-QQr.js → audit-logs-DXoc97BV.js} +1 -1
  7. package/dist/assets/{authorize-C_rSdM9R.js → authorize-_fbQ19S4.js} +1 -1
  8. package/dist/assets/{branding-C6umqmKR.js → branding-DpkSF6dd.js} +2 -2
  9. package/dist/assets/{branding-HedBd6t0.js → branding-DuPWVNlC.js} +1 -1
  10. package/dist/assets/{bundle-avatar-B9he3Bf1.js → bundle-avatar-D4fwror8.js} +1 -1
  11. package/dist/assets/{complete-D7dveRTo.js → complete-C5D4D-fJ.js} +1 -1
  12. package/dist/assets/{component-cssFwqtY.js → component-CURpjZJ2.js} +1 -1
  13. package/dist/assets/{config-eQ2Et0RC.js → config-e36Xplpo.js} +1 -1
  14. package/dist/assets/config-navigation-BvjYZI_j.js +26 -0
  15. package/dist/assets/{config-space-CQ7Atb1l.js → config-space-EoSm62Er.js} +1 -1
  16. package/dist/assets/{confirm-Tue92P8p.js → confirm-Vzr2I9eM.js} +1 -1
  17. package/dist/assets/{connect-Cm-sTMiW.js → connect-B5Xr7MId.js} +1 -1
  18. package/dist/assets/{connect-PdQoyrqe.js → connect-DXOsnqkO.js} +1 -1
  19. package/dist/assets/{connect-to-FvVJBIsZ.js → connect-to-Bz9wYM04.js} +1 -1
  20. package/dist/assets/{dashboard-BhR1WNzF.js → dashboard-xUr1SbPS.js} +3 -3
  21. package/dist/assets/{delete-confirm-CHnQ2leb.js → delete-confirm-DNn4Os6R.js} +1 -1
  22. package/dist/assets/{domain-FY9-unAU.js → domain-XXgOrJDa.js} +1 -1
  23. package/dist/assets/{domain-action-card-Jvzi8kyL.js → domain-action-card-Cf1AoKOi.js} +1 -1
  24. package/dist/assets/{domains-CiBZW8yk.js → domains-DeFj6Ipl.js} +1 -1
  25. package/dist/assets/{email-z4l1k3Mi.js → email-BIVfXnpk.js} +1 -1
  26. package/dist/assets/{exchange-passport-DSoEjAA_.js → exchange-passport-C9Pvr9Da.js} +1 -1
  27. package/dist/assets/{fuel-CzrPInoR.js → fuel-Cs--pEYt.js} +1 -1
  28. package/dist/assets/{gen-access-key-BU2nGVgA.js → gen-access-key-CIzULsBE.js} +1 -1
  29. package/dist/assets/{index-D0F0qx_R.js → index-B7IOoVDF.js} +1 -1
  30. package/dist/assets/{index-C1XrZATd.js → index-BCJADuMw.js} +5 -5
  31. package/dist/assets/{index-NQMMaHuW.js → index-BU2FTGFr.js} +1 -1
  32. package/dist/assets/{index-C3le1atN.js → index-BoTgqYtV.js} +1 -1
  33. package/dist/assets/{index-5EytSaVA.js → index-C64IgZKt.js} +1 -1
  34. package/dist/assets/{index-D2a97Hdb.js → index-CsXmgylH.js} +3 -3
  35. package/dist/assets/{index-DutfRO7F.js → index-D-Lxloq5.js} +1 -1
  36. package/dist/assets/{index-P2m0RlAs.js → index-DBqLPDUh.js} +1 -1
  37. package/dist/assets/index-DDXNOodN.js +99 -0
  38. package/dist/assets/{index-B_NDUfon.js → index-DDoVX3je.js} +2 -2
  39. package/dist/assets/{index-hkk3GUEf.js → index-Drd9jydY.js} +1 -1
  40. package/dist/assets/{index-klBzz5vO.js → index-Dsd9SXVN.js} +1 -1
  41. package/dist/assets/index-DvBh35bh.js +1 -0
  42. package/dist/assets/{index-DrHUHp5S.js → index-U3mAyHwS.js} +1 -1
  43. package/dist/assets/{index-m831cH-_.js → index-W_fQ-nuf.js} +1 -1
  44. package/dist/assets/{index-ChHy6AQ7.js → index-wLX5GW2c.js} +1 -1
  45. package/dist/assets/{invitation-CGjIZ62g.js → invitation-Dsnc8lab.js} +1 -1
  46. package/dist/assets/{invite-CS_4jRwt.js → invite-CvAru4rZ.js} +1 -1
  47. package/dist/assets/{issue-passport-B6-OzJX7.js → issue-passport-CDE6vHUE.js} +1 -1
  48. package/dist/assets/{item-CuLwkmbx.js → item-rXnALS3b.js} +1 -1
  49. package/dist/assets/{layout-CNC_rrzE.js → layout-DYG0Wl7R.js} +1 -1
  50. package/dist/assets/{list-BTBbj1K4.js → list-DLMy1vVs.js} +1 -1
  51. package/dist/assets/list-b96sX5Y6.js +2 -0
  52. package/dist/assets/{log-29oTWiWO.js → log-Bwqh69bM.js} +1 -1
  53. package/dist/assets/{login-C52vMwpY.js → login-Ygmj8_J7.js} +1 -1
  54. package/dist/assets/{logo-uploader-Cir_HrSm.js → logo-uploader-CLwbDhA_.js} +2 -2
  55. package/dist/assets/{lost-passport-C2-kDXqq.js → lost-passport-CqzPSoLw.js} +1 -1
  56. package/dist/assets/{overview-BKOb0zVP.js → overview-DqabCKYi.js} +1 -1
  57. package/dist/assets/{passport-item-OEfv-Vh7.js → passport-item-C5-ZuTPM.js} +1 -1
  58. package/dist/assets/{publish-resource-DayX-x8-.js → publish-resource-ebKgw7OW.js} +1 -1
  59. package/dist/assets/{runtime-BbgMhX7n.js → runtime-B454s6Gb.js} +1 -1
  60. package/dist/assets/{security-DFHcsUZl.js → security-DCArL_za.js} +1 -1
  61. package/dist/assets/{setup-Do62jucF.js → setup-CX2pUl2y.js} +3 -3
  62. package/dist/assets/{start-B8F850CZ.js → start-Dhbx5j_D.js} +1 -1
  63. package/dist/assets/{status-D5JgbTyM.js → status-D4K-kiXO.js} +1 -1
  64. package/dist/assets/{step-actions-1pM57149.js → step-actions-CISMVGx2.js} +1 -1
  65. package/dist/assets/{traffic-Dvs1P0Re.js → traffic-BqHyn9L9.js} +1 -1
  66. package/dist/assets/{transfer-bax-fMxe.js → transfer-Bqv1gMqL.js} +1 -1
  67. package/dist/assets/{unsubscribe-DwUfpwja.js → unsubscribe-B3OLQIVA.js} +1 -1
  68. package/dist/assets/{use-blocklet-logo-BZU9LLmz.js → use-blocklet-logo-Bhkp-Zm7.js} +1 -1
  69. package/dist/assets/{user-center-DQ_Kc4sL.js → user-center-vIx28YXm.js} +1 -1
  70. package/dist/assets/{util-BiCOL9ao.js → util-Dnkhck-D.js} +1 -1
  71. package/dist/assets/{wrap-locale-0GIFYj8p.js → wrap-locale-C_UOH97U.js} +1 -1
  72. package/dist/index.html +1 -1
  73. package/dist/service-worker.js +1 -1
  74. package/package.json +21 -21
  75. package/dist/assets/config-navigation-0pU9J0da.js +0 -26
  76. package/dist/assets/index-DC3jOsuk.js +0 -99
  77. package/dist/assets/index-DQD2rqsI.js +0 -1
  78. package/dist/assets/list-BNMEncjS.js +0 -2
@@ -1,4 +1,4 @@
1
- import{a as se,a0 as U,c6 as Me,c7 as Ve,I as K,c4 as $e,c5 as Ne,af as He,ae as Je,c8 as Ke,b6 as Ce,j as he,r as Ae,b4 as G,c9 as xe,ao as ge,B as z,bT as Ge,a8 as Ze,ca as Ye,a9 as Xe,a5 as Qe,a2 as et,au as De}from"./vendor-ux-did-connect-2jRoUb28.js";import{u as p,a as ae,f as te,c as tt}from"./vendor-hooks-BgUTpb6X.js";import{r as P}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bs as W,bo as E,O,y as $,H,T as ne,I as oe,X as ie,ah as Oe,al as V,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{a3 as rt,B as qe,M as ot,c as it}from"./vendor-arcblock-BlrkGjK9.js";import{J as X,a8 as lt,c as Fe,D as ct,n as Y,aJ as dt,A as ut,b as mt}from"./vendor-utils-rHXShPKm.js";import{D as J,G as N,aB as re,aC as L,aK as Re}from"./index-B_NDUfon.js";import{S as le}from"./switch-control-CpCSorUo.js";import{S as C}from"./section-Ccxg0x_Y.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-BUHyq-oP.js";import{b as xt}from"./base32-WurN0cIW.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:X(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(C,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:r})=>e.jsx(W,{control:e.jsx(le,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(C,{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(C,{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(C,{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($,{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:X(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(C,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(le,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{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(C,{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($,{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:X(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(C,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(le,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{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(C,{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($,{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:X(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})}}),A=Object.assign({...me},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(A),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(C,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:a})=>e.jsx(W,{control:e.jsx(le,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(C,{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(C,{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(C,{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(C,{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(C,{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($,{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]=P.useState(t),l=P.useRef(null),d=P.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,A=i.getClientOffset().y-a.top;r<T&&A<m||r>T&&A>m||(w(r,T),S.index=T)}}),[{isDragging:x},g]=Ve({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($e,{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 _(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:X(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:A}=await j.updateAppSessionConfig({input:{did:n,config:ct(pe(m,!0),["phone"])}}),M=Object.assign({},Z,X(((R=A==null?void 0:A.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(pe(M)),U.success(l("common.configSuccess"))}catch(A){U.error(A.message)}});return e.jsx(It,{onSubmit:w(T),children:e.jsxs(V,{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(V,{gap:2,children:[e.jsx(C,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(_,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(_,{disabled:!0,checked:!0})})}),e.jsx(C,{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(_,{...m,checked:m.value})})})}),d&&e.jsxs(V,{direction:"column",ml:2,children:[e.jsx(C,{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(W,{sx:{mt:1},control:e.jsx(_,{...m,checked:m.value})})})})}),e.jsx(C,{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(W,{sx:{mt:1},control:e.jsx(_,{...m,checked:m.value})})})})}),e.jsx(C,{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(W,{sx:{mt:1},control:e.jsx(_,{...m,checked:m.value})})})})}),e.jsx(C,{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(W,{sx:{mt:1},control:e.jsx(_,{...m,checked:m.value})})})})}),I&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainBlackList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>v(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(C,{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(W,{sx:{mt:1},control:e.jsx(_,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainWhiteList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>r(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(C,{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(W,{sx:{mt:1},control:e.jsx(_,{...m,checked:m.value})})})})}),k&&e.jsxs(V,{direction:"column",ml:2,mt:1,children:[e.jsx(C,{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(W,{control:e.jsx(_,{...m,checked:m.value})})})})}),e.jsx(C,{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(W,{control:e.jsx(_,{...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(V,{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(C,{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($,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const It=Oe.form`
1
+ import{a as se,a0 as U,c6 as Me,c7 as Ve,I as K,c4 as $e,c5 as Ne,af as He,ae as Je,c8 as Ke,b6 as Ce,j as he,r as Ae,b4 as G,c9 as xe,ao as ge,B as z,bT as Ge,a8 as Ze,ca as Ye,a9 as Xe,a5 as Qe,a2 as et,au as De}from"./vendor-ux-did-connect-2jRoUb28.js";import{u as p,a as ae,f as te,c as tt}from"./vendor-hooks-BgUTpb6X.js";import{r as P}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bs as W,bo as E,O,y as $,H,T as ne,I as oe,X as ie,ah as Oe,al as V,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{a3 as rt,B as qe,M as ot,c as it}from"./vendor-arcblock-BlrkGjK9.js";import{J as X,a8 as lt,c as Fe,D as ct,n as Y,aJ as dt,A as ut,b as mt}from"./vendor-utils-rHXShPKm.js";import{D as J,G as N,aB as re,aC as L,aK as Re}from"./index-DDoVX3je.js";import{S as le}from"./switch-control-CpCSorUo.js";import{S as C}from"./section-Ccxg0x_Y.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-BUHyq-oP.js";import{b as xt}from"./base32-WurN0cIW.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:X(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(C,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:r})=>e.jsx(W,{control:e.jsx(le,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(C,{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(C,{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(C,{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($,{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:X(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(C,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(le,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{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(C,{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($,{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:X(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(C,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(le,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{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(C,{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($,{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:X(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})}}),A=Object.assign({...me},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(A),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(C,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(L,{name:"enabled",control:f,render:({field:a})=>e.jsx(W,{control:e.jsx(le,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(C,{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(C,{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(C,{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(C,{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(C,{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($,{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]=P.useState(t),l=P.useRef(null),d=P.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,A=i.getClientOffset().y-a.top;r<T&&A<m||r>T&&A>m||(w(r,T),S.index=T)}}),[{isDragging:x},g]=Ve({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($e,{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 _(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:X(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:A}=await j.updateAppSessionConfig({input:{did:n,config:ct(pe(m,!0),["phone"])}}),M=Object.assign({},Z,X(((R=A==null?void 0:A.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(pe(M)),U.success(l("common.configSuccess"))}catch(A){U.error(A.message)}});return e.jsx(It,{onSubmit:w(T),children:e.jsxs(V,{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(V,{gap:2,children:[e.jsx(C,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(_,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(_,{disabled:!0,checked:!0})})}),e.jsx(C,{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(_,{...m,checked:m.value})})})}),d&&e.jsxs(V,{direction:"column",ml:2,children:[e.jsx(C,{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(W,{sx:{mt:1},control:e.jsx(_,{...m,checked:m.value})})})})}),e.jsx(C,{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(W,{sx:{mt:1},control:e.jsx(_,{...m,checked:m.value})})})})}),e.jsx(C,{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(W,{sx:{mt:1},control:e.jsx(_,{...m,checked:m.value})})})})}),e.jsx(C,{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(W,{sx:{mt:1},control:e.jsx(_,{...m,checked:m.value})})})})}),I&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainBlackList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>v(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(C,{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(W,{sx:{mt:1},control:e.jsx(_,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(L,{name:`email.domainWhiteList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(oe,{onClick:()=>r(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(C,{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(W,{sx:{mt:1},control:e.jsx(_,{...m,checked:m.value})})})})}),k&&e.jsxs(V,{direction:"column",ml:2,mt:1,children:[e.jsx(C,{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(W,{control:e.jsx(_,{...m,checked:m.value})})})})}),e.jsx(C,{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(W,{control:e.jsx(_,{...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(V,{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(C,{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($,{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 +1 @@
1
- import{r as m}from"./vendor-react-DEoibe3W.js";import{a as k,$ as I,au as M,bT as P,j as R}from"./vendor-ux-did-connect-2jRoUb28.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-Dz9mQnYC.js";import{a as U}from"./api-BjteVZFg.js";import{T as K}from"./table-tips-BfSSGl9N.js";import{D as w}from"./index-B_NDUfon.js";import{u as G}from"./dashboard-BhR1WNzF.js";import"./vendor-utils-rHXShPKm.js";import"./lottie-web-jYmAQWuC.js";import"./InfoOutlined-D3XnF0Vg.js";import"./use-mobile-BAa0wi8o.js";import"./vendor-arcblock-BlrkGjK9.js";import"./useLocalStorage-D6gvgmEW.js";import"./index-8eXqqyHQ.js";import"./confirm-Tue92P8p.js";import"./PlayArrow-CDOOUxMp.js";import"./get-safe-url-c4iAcpvA.js";import"./session-C_8V_o-O.js";import"./use-blocklet-logo-BZU9LLmz.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.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}=G(),{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 T=`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 T;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(I,{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
+ import{r as m}from"./vendor-react-DEoibe3W.js";import{a as k,$ as I,au as M,bT as P,j as R}from"./vendor-ux-did-connect-2jRoUb28.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-Dz9mQnYC.js";import{a as U}from"./api-BjteVZFg.js";import{T as K}from"./table-tips-BfSSGl9N.js";import{D as w}from"./index-DDoVX3je.js";import{u as G}from"./dashboard-xUr1SbPS.js";import"./vendor-utils-rHXShPKm.js";import"./lottie-web-jYmAQWuC.js";import"./InfoOutlined-D3XnF0Vg.js";import"./use-mobile-BAa0wi8o.js";import"./vendor-arcblock-BlrkGjK9.js";import"./useLocalStorage-D6gvgmEW.js";import"./index-8eXqqyHQ.js";import"./confirm-Vzr2I9eM.js";import"./PlayArrow-CDOOUxMp.js";import"./get-safe-url-c4iAcpvA.js";import"./session-C_8V_o-O.js";import"./use-blocklet-logo-Bhkp-Zm7.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.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}=G(),{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 T=`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 T;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(I,{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};