@abtnode/blocklet-services 1.16.52-beta-20250909-073849-4e392ab1 → 1.16.52-beta-20250911-023851-d988be85

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 (126) hide show
  1. package/api/emails/_components/footer.js +7 -2
  2. package/api/libs/email.js +5 -1
  3. package/api/routes/user.js +52 -2
  4. package/api/services/auth/connect/verify-destroy.js +42 -9
  5. package/api/socket/util.js +4 -1
  6. package/api/util/utm.js +241 -0
  7. package/dist/assets/{access-control-D09br-Cx.js → access-control-DTQ50N6V.js} +1 -1
  8. package/dist/assets/{add-component-core-BCbsNEyt.js → add-component-core-BrVCLSN6.js} +1 -1
  9. package/dist/assets/{add-resource-DBuTqFch.js → add-resource-c90mXjXe.js} +1 -1
  10. package/dist/assets/{addon-2U31yyFl.js → addon-CxluIuPz.js} +1 -1
  11. package/dist/assets/{advanced-DVAtlRsh.js → advanced-DFALg-CZ.js} +1 -1
  12. package/dist/assets/{aigne-CmfV21Mm.js → aigne-C4_yXAUg.js} +1 -1
  13. package/dist/assets/{appearance-EmfiaxOZ.js → appearance-DKolOYs4.js} +1 -1
  14. package/dist/assets/{arrow-down.svg-Gif3Qlbk.js → arrow-down.svg-CGgLriRk.js} +1 -1
  15. package/dist/assets/{audit-logs-C5x9wWcD.js → audit-logs-numMr61S.js} +1 -1
  16. package/dist/assets/{authorize-YaX9nvjo.js → authorize-Cs-nLZVa.js} +1 -1
  17. package/dist/assets/{base32-DyHKL8vT.js → base32-2BTO5zmk.js} +1 -1
  18. package/dist/assets/{bind-account-BnNXFevx.js → bind-account-DATlcjGM.js} +1 -1
  19. package/dist/assets/{branding-BNYDI8rS.js → branding-ChMkwmNu.js} +1 -1
  20. package/dist/assets/{branding-Bv9eQfQk.js → branding-CpqfcsE-.js} +1 -1
  21. package/dist/assets/{branding-BlOjZ4LN.js → branding-Dv6FvDLK.js} +2 -2
  22. package/dist/assets/{bundle-avatar-D7OAJcb0.js → bundle-avatar-CfoJFi5J.js} +1 -1
  23. package/dist/assets/{complete-B0a8dWfz.js → complete-CshVhiET.js} +1 -1
  24. package/dist/assets/{component-6jLWJQG9.js → component-B1O9WT7z.js} +3 -3
  25. package/dist/assets/{config-BEgT9FgV.js → config-Bmq4DJl0.js} +1 -1
  26. package/dist/assets/{config-CXDgD6Am.js → config-CmIvwzmQ.js} +1 -1
  27. package/dist/assets/{config-navigation-DNtDnJ9O.js → config-navigation-R4T6jiU3.js} +3 -3
  28. package/dist/assets/{config-space-D-KJ_Zvk.js → config-space-BVAKDgsX.js} +1 -1
  29. package/dist/assets/{config-MLIXNVND.js → config-vTUk_Yfk.js} +1 -1
  30. package/dist/assets/{confirm-C969ZG_F.js → confirm-DV4YCyEc.js} +1 -1
  31. package/dist/assets/{connect-BYQGcjsx.js → connect-C9A-I8R8.js} +1 -1
  32. package/dist/assets/{connect-to-CtmxY5oP.js → connect-to-CtS-ZsP9.js} +1 -1
  33. package/dist/assets/{connect-DdSQXSfp.js → connect-vQygM1gc.js} +1 -1
  34. package/dist/assets/{dashboard-BpRwSCeh.js → dashboard-CzGF4PYs.js} +3 -3
  35. package/dist/assets/{delete-confirm-CGjwwcqY.js → delete-confirm-ad8t0UXs.js} +1 -1
  36. package/dist/assets/{domain-BV8HnqtN.js → domain-D-3zw7uG.js} +1 -1
  37. package/dist/assets/{domain-action-card-Bz_-Xazt.js → domain-action-card-wBZ8YZ_K.js} +1 -1
  38. package/dist/assets/{domains-NDWqWGFH.js → domains-BjPU8dXK.js} +1 -1
  39. package/dist/assets/{email-mSK2XoU_.js → email-DCapsREm.js} +1 -1
  40. package/dist/assets/engine-CRVby1S4.js +1 -0
  41. package/dist/assets/{exchange-passport-hHgDgdxw.js → exchange-passport-CuSVCQpP.js} +1 -1
  42. package/dist/assets/{form-BV7lGmay.js → form-2mrhORLa.js} +1 -1
  43. package/dist/assets/{fuel-DjNr8IWY.js → fuel-DHo_QvBk.js} +1 -1
  44. package/dist/assets/{gen-access-key-DLCb_M09.js → gen-access-key-D3bzBUlQ.js} +1 -1
  45. package/dist/assets/{gen-simple-access-key-Cg4jKiTS.js → gen-simple-access-key-BKkuz2Fk.js} +1 -1
  46. package/dist/assets/{get-safe-url-DJ5I-iKX.js → get-safe-url-D4-uUwWa.js} +1 -1
  47. package/dist/assets/{hdkey-BJATMZk2.js → hdkey-CZt5k06-.js} +1 -1
  48. package/dist/assets/{home-PQ364yRa.js → home-DgBfnhbE.js} +1 -1
  49. package/dist/assets/{iframe-CQuSp4d_.js → iframe-amFSSPgY.js} +1 -1
  50. package/dist/assets/{index-C1b11Gor.js → index-B0DwBoe3.js} +1 -1
  51. package/dist/assets/{index-lscqrS5Z.js → index-B2EmOTH7.js} +59 -59
  52. package/dist/assets/{index-BHQHhcdx.js → index-BFQzptXM.js} +1 -1
  53. package/dist/assets/{index-C61enzfv.js → index-BNWq4zK7.js} +1 -1
  54. package/dist/assets/{index-DFGqK9ZQ.js → index-BV5aEWS1.js} +1 -1
  55. package/dist/assets/{index-BI5OO07e.js → index-BWhAMS1Q.js} +1 -1
  56. package/dist/assets/{index-CfB_bXYI.js → index-BmPcC1s0.js} +1 -1
  57. package/dist/assets/{index-DtI2e8-p.js → index-C1-AZbYf.js} +1 -1
  58. package/dist/assets/{index-CXDyHIY4.js → index-C1pPU9qq.js} +1 -1
  59. package/dist/assets/{index-Cik3nAZb.js → index-CBP6lyxa.js} +1 -1
  60. package/dist/assets/{index-VN_RpImI.js → index-CZYE2JtK.js} +4 -4
  61. package/dist/assets/{index-DSFB8WaL.js → index-Ca0DgcTh.js} +1 -1
  62. package/dist/assets/{index-B6ucEBWQ.js → index-Cgvk2QQ_.js} +1 -1
  63. package/dist/assets/{index-C_MKoY4B.js → index-DBhVhw1v.js} +1 -1
  64. package/dist/assets/{index-jhEes964.js → index-DVMWAhrt.js} +1 -1
  65. package/dist/assets/{index-tt5ea0-c.js → index-DkTLhY6N.js} +1 -1
  66. package/dist/assets/{index-nwknV05O.js → index-FBIc-uda.js} +1 -1
  67. package/dist/assets/{index-B9b-a_Uj.js → index-HB59rGor.js} +3 -3
  68. package/dist/assets/index-LTZrTPAZ.js +113 -0
  69. package/dist/assets/{index-Chtj9VuG.js → index-S5gZ547W.js} +1 -1
  70. package/dist/assets/{index-Dm-MhWfc.js → index-Vdt8KS2l.js} +1 -1
  71. package/dist/assets/{index-DSddfOC9.js → index-ub2vI299.js} +1 -1
  72. package/dist/assets/{index-Cl62IadO.js → index-zmlRlLsp.js} +1 -1
  73. package/dist/assets/{invitation-DjO59W1C.js → invitation-CsaolrG3.js} +1 -1
  74. package/dist/assets/{invite-t79Nm2Zx.js → invite-Bz_emQWL.js} +1 -1
  75. package/dist/assets/{isURL-Bx60otHf.js → isURL-DviHJNBO.js} +1 -1
  76. package/dist/assets/{issue-passport-CXTkBSWc.js → issue-passport-ZQsWd3Dr.js} +1 -1
  77. package/dist/assets/{item-ZVdS__zd.js → item-vw_cuyBZ.js} +1 -1
  78. package/dist/assets/{landing-page-oOptuves.js → landing-page-CVL3NbvQ.js} +1 -1
  79. package/dist/assets/{layout-i3qPT3h9.js → layout-BKp8C5F-.js} +1 -1
  80. package/dist/assets/{list-oKgOsN2z.js → list-CY0v9mkZ.js} +1 -1
  81. package/dist/assets/{list-BxMbz6k1.js → list-zVgARuTW.js} +3 -3
  82. package/dist/assets/{localization-COWn2xkt.js → localization-UoEVomCp.js} +1 -1
  83. package/dist/assets/{log-Bi6PHqUs.js → log-CuQWYZCB.js} +1 -1
  84. package/dist/assets/{login-DDdmbVzv.js → login-1ZsKClLU.js} +1 -1
  85. package/dist/assets/{login-oauth-callback-D39cBDZP.js → login-oauth-callback-YZd7R3pO.js} +1 -1
  86. package/dist/assets/{logo-uploader-DRWtRqku.js → logo-uploader-DuDo-4bO.js} +2 -2
  87. package/dist/assets/{lost-passport-B1R7WTbU.js → lost-passport-Dx86JuPR.js} +1 -1
  88. package/dist/assets/{open-window-DTzdbnUT.js → open-window-DnjhXMUE.js} +1 -1
  89. package/dist/assets/{over-due-invoice-payment-BkmmmYAi.js → over-due-invoice-payment-Dam76xor.js} +1 -1
  90. package/dist/assets/{overview-BxARj22l.js → overview-DiuRZ10x.js} +1 -1
  91. package/dist/assets/{passport-item-DgPDBerJ.js → passport-item-CwFxbGyQ.js} +1 -1
  92. package/dist/assets/{permission-D42aYR9e.js → permission-DwyNIiFn.js} +1 -1
  93. package/dist/assets/{preferences-BcDy0kQP.js → preferences-D93Xc9AW.js} +1 -1
  94. package/dist/assets/{profile-embed-DOdWPLKA.js → profile-embed-C7ST7lEr.js} +1 -1
  95. package/dist/assets/{publish-resource-B0NiskVq.js → publish-resource-DU3M6kAz.js} +1 -1
  96. package/dist/assets/{runtime-2fPExSHG.js → runtime-Cp_2Mkns.js} +1 -1
  97. package/dist/assets/sdk-j_z17Rma.js +1 -0
  98. package/dist/assets/{security-Bv7TZuHo.js → security-DNzyYn22.js} +1 -1
  99. package/dist/assets/{session-sOrWgMPW.js → session-DGj-_oAZ.js} +1 -1
  100. package/dist/assets/{setup-rvCY-r6K.js → setup-IfocPlKr.js} +1 -1
  101. package/dist/assets/{spaces-BCmMWVI9.js → spaces-CoMtZGNH.js} +1 -1
  102. package/dist/assets/{start-B0m4kfc8.js → start-CtfSNTEq.js} +1 -1
  103. package/dist/assets/{status-CUW3huRP.js → status-DYzeHwu5.js} +1 -1
  104. package/dist/assets/{step-actions-DF1OO2xv.js → step-actions-CJGBq_RL.js} +1 -1
  105. package/dist/assets/{studio-Xl6uVEBK.js → studio-cTiQkJ_r.js} +1 -1
  106. package/dist/assets/{team-DXp2kdu1.js → team-B8B1ZhIQ.js} +1 -1
  107. package/dist/assets/{traffic-5td870d8.js → traffic-DqTwvxdl.js} +1 -1
  108. package/dist/assets/{transfer-BtDVmVUd.js → transfer-Yhxjz3He.js} +1 -1
  109. package/dist/assets/{unsubscribe-BRrYNDWq.js → unsubscribe-D98i3Dcl.js} +1 -1
  110. package/dist/assets/{use-app-logo-mu7QCMiy.js → use-app-logo-wJojGoX8.js} +1 -1
  111. package/dist/assets/{user-center-CU9t4WoO.js → user-center-4QiBEXkz.js} +3 -3
  112. package/dist/assets/{user-follower-CZumNR6l.js → user-follower-daqBbJjL.js} +1 -1
  113. package/dist/assets/{user-sessions-BcCJ6YmQ.js → user-sessions-gPGe7NTf.js} +1 -1
  114. package/dist/assets/{util-Dffdnd4E.js → util-6fgrHxDz.js} +1 -1
  115. package/dist/assets/{util-RS7QU94f.js → util-BkJCSJXb.js} +1 -1
  116. package/dist/assets/{wait-connect-D_jGn7lY.js → wait-connect-D0ORg2Ga.js} +1 -1
  117. package/dist/assets/{wizard-BZlSlN9j.js → wizard-C7eP8Bda.js} +1 -1
  118. package/dist/assets/{wizard-components-CI8Erh9Q.js → wizard-components-CXkOVy_c.js} +2 -2
  119. package/dist/assets/{wrap-locale-YgVg0_fN.js → wrap-locale-BARiwFz6.js} +1 -1
  120. package/dist/assets/{zh-BRHJ9MGq.js → zh-D04z7ZNH.js} +1 -1
  121. package/dist/index.html +1 -1
  122. package/dist/service-worker.js +1 -1
  123. package/package.json +23 -23
  124. package/dist/assets/engine-c0Vv0qOe.js +0 -1
  125. package/dist/assets/index-DP3uANMf.js +0 -113
  126. package/dist/assets/sdk-BeAqfHTz.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B9b-a_Uj.js","assets/index-lscqrS5Z.js","assets/vendor-mui-core-Bq_sfmbr.js","assets/vendor-react-Dvs43sk9.js","assets/vendor-ux-DnuP69h2.js","assets/vendor-utils-DQK0pEML.js","assets/vendor-hooks-DLNZ8kxG.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-CzdgnaKl.js","assets/index-DrVXX4fX.css","assets/index-BPy8_fa2.js","assets/index-DRYJ0xIl.js","assets/index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
2
- import{r as k,i as It,j as rt,L as we,g as fo,k as As,l as qs,m as bt}from"./vendor-react-Dvs43sk9.js";import{J as Oe,j as e,ak as a,b4 as Et,W as n,am as ke,I as ce,dv as Ns,dw as _s,ch as xo,cf as nt,dx as Ws,a_ as Os,T as A,s as go,dy as ko,dz as zs,cK as Bs,Y as lt,at as ve,av as Vs,dA as Us,a5 as Ze,aX as it,bc as Pt,c6 as Ms,bf as Fs,b6 as Ye,cS as Hs,bg as et,Q as G,a6 as Se,bD as Js,O as jo,K as yo,P as Lt,ai as wo,o as vo,M as be,a3 as Xs,bB as Co,$ as Ro,bv as Gs,A as He,aJ as Ks,R as So,z as ne,b1 as Re,dB as Xt,bW as tt,dC as To,V as Do,S as $t,aP as Io,bC as Zs,D as Eo,cp as Ys,aQ as Qs,aR as er,cq as tr,cr as or,bE as Po,aq as sr,dD as rr,a1 as Lo,a0 as ot,bi as Gt,bH as nr,bI as lr,dE as ir,dF as cr,bb as vt,y as ar,F as dr,bp as ur,bq as ft}from"./vendor-mui-core-Bq_sfmbr.js";import{c as F,Z as ge,a8 as De,be as pr,v as hr,X as me,bZ as mr,Y as br,f as Kt,b_ as fr,au as Zt,ba as xr,bD as gr,b$ as kr,c0 as jr,c1 as yr}from"./index-lscqrS5Z.js";import{T as X,ai as $o,D as $e,al as Ao,a6 as qo,aa as wr,ac as At,H as W,P as qt,aZ as Nt,ab as ae,_ as No,a7 as We,F as ct,L as _o}from"./vendor-ux-DnuP69h2.js";import{C as at}from"./confirm-C969ZG_F.js";import{u as ze}from"./session-sOrWgMPW.js";import{W as Ct}from"./did-address-4KKI5Z_V.js";import{E as Je}from"./empty-spinner-DYg7efl9.js";import{B as _t}from"./bundle-avatar-D7OAJcb0.js";import{S as Te}from"./shorten-label-BYntTWDs.js";import{L as Wt}from"./list-header-DELs3iEf.js";import{K as vr,C as ue,A as Ot,D as Wo,a0 as Cr}from"./vendor-utils-DQK0pEML.js";import{C as Oo}from"./click-to-copy-CH3FJWJo.js";import{t as Rr}from"./question-mark-circle.svg-B4stD6SS.js";import{l as Sr,b as Tr}from"./vendor-hooks-DLNZ8kxG.js";import{u as Me}from"./useSetState-DFuQZPPV.js";import{e as Dr}from"./engine-c0Vv0qOe.js";import"./api-sewNv0AE.js";import{T as Ir,S as Er}from"./vendor-mui-x-BbwECMfi.js";import{D as Yt,C as Qt,P as eo}from"./react-beautiful-dnd.esm-DFIGUIPG.js";import{u as zo,c as Pr,w as Lr,a as $r,b as Ar}from"./wait-connect-D_jGn7lY.js";import{f as xe}from"./index-DBs9Ljax.js";import{c as qr,A as Bo,S as Nr,U as _r,r as Wr}from"./item-ZVdS__zd.js";import{D as Or}from"./delete-confirm-CGjwwcqY.js";import{g as Vo}from"./get-safe-url-DJ5I-iKX.js";import{u as Le}from"./index-BjLb1HBo.js";import{M as zr}from"./index-DdXpn59U.js";import{r as Br}from"./index-CZyIUWF0.js";import"./vendor-arcblock-CzdgnaKl.js";import"./lottie-web-4koyQiv_.js";import"./raf-schd.esm-CHNehTG3.js";function zt({did:t,projectId:o,title:s,logo:r,describe:l}){const i=`${`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${r}`,[d,u]=k.useState(!1),x=Oe(p=>p.breakpoints.down("md"));return e.jsxs(a,{sx:{display:"flex",flexDirection:"row",color:d?"primary.main":"grey.900",gap:1},onPointerEnter:()=>u(!0),onPointerLeave:()=>u(!1),children:[e.jsx(Et,{sx:{borderRadius:1},src:i}),e.jsxs(a,{children:[e.jsx(Te,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:x?"primary.main":""},children:s||"/"}),e.jsx(Te,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:x||d?"primary.main":"grey.700"},children:l||"/"})]})]})}zt.propTypes={projectId:n.string.isRequired,did:n.string.isRequired,title:n.string.isRequired,logo:n.string.isRequired,describe:n.string.isRequired};function Uo({initUrl:t=null}){const o=It(),s=t?.searchParams.get("tenantScope")||"",{t:r,locale:l}=X(),{api:c}=ge(),{api:i}=ze(),[d,u]=k.useState(!0),{blocklet:x}=De(),[p,m]=k.useState(null),[f,b]=k.useState(!1),h=Oe(E=>E.breakpoints.down("xl")),j=Oe(E=>E.breakpoints.down("md")),{componentDid:v=""}=rt(),[g,C]=k.useState(null),D=`publish-${x.meta.did}`,R=$o(D),[y,T]=k.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),O=()=>{c.getProjects({input:{did:x.meta.did,componentDid:v,tenantScope:s}}).then(E=>{const I=E?.projects||[];u(!1),C(I)}).catch(E=>{u(!1),W.error(E.message)})},N=()=>{o(`${F.UNOWNED_DID}/create/none/0.0.0`,{replace:!0})},z=E=>{m(E)},K=()=>{u(!1),b(!0)},P=()=>{b(!1),m(null)},L=E=>{W.error(E.message),b(!1),m(null)},w=E=>{if(!E?.deleted){W.error("Delete project failed");return}O(),b(!1),m(null)};k.useEffect(()=>{O()},[]);const S=k.useMemo(()=>{if(!y.searchText)return g;let E=y.searchText?.trim();return E?(E=pr.toAddress(E).toLocaleLowerCase(),g.filter(I=>I.blockletTitle.toLowerCase().includes(E)||I.blockletDid.toLowerCase().includes(E))):g},[g,y.searchText]);if(!g&&d)return e.jsx(a,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Je,{})});if(!g)return null;if(!g.length)return e.jsxs(a,{sx:{display:"flex",flexDirection:"column",alignItems:"center",pt:10},children:[e.jsx(a,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),e.jsx(a,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),e.jsx($e,{onClick:N,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const Y=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:E=>{const I=g[E];return e.jsx(we,{to:`${I.id}`,children:e.jsx(zt,{did:x.meta.did,projectId:I.id,logo:I.blockletLogo,title:I.blockletTitle,describe:I.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:E=>E?e.jsx(Ao,{type:"success",children:E}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:E=>E?e.jsx(Ct,{size:14,compact:!0,responsive:!1,did:E}):null}},h||v?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:E=>E?e.jsx(Ct,{onClick:()=>{o(`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/members?did=${E}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:E}):null}},h||v?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:E=>{const I=(x.children||[]).find(V=>V.meta.did===E);return I?e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[e.jsx(_t,{size:14,blocklet:I,ancestors:[x]}),e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:I.meta.title})]},E):""}}},h||s?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:E=>e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Te,{children:E})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:E=>e.jsx(qo,{value:Number(E),locale:l})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:E=>{const I=g[E];return e.jsxs(a,{sx:{display:"flex"},children:[e.jsx(we,{to:`${I.id}/new-release/none/${I.lastReleaseId}`,children:e.jsx(ke,{title:r("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(Ns,{style:{fontSize:18}})})})}),!!I.lastReleaseId&&e.jsx(ke,{title:r("blocklet.publish.viewLastRelease",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(we,{style:{display:"flex"},to:`${I.id}/view/${I.lastReleaseId}/${I.blockletVersion}`,children:e.jsx(_s,{sx:{fontSize:18}})})})}),e.jsx(ke,{title:r("blocklet.publish.delete",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>z(I),children:e.jsx(xo,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),H=({page:E,rowsPerPage:I,searchText:V})=>{y.pageSize!==I?T(U=>({...U,searchText:"",pageSize:I,page:1})):y.page!==E+1?T(U=>({...U,searchText:"",page:E+1})):y.searchText!==V&&T(U=>({...U,searchText:V,page:1}))},Q=f?e.jsx(hr,{open:!0,popup:!0,onClose:P,action:"check-has-project-id",locale:l,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:w,onError:L,extraParams:{projectId:p.id,did:x.meta.did,name:p.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:p.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:p.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(Vr,{children:[e.jsx(Wt,{sx:{mb:2},left:e.jsxs(a,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(a,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),e.jsx(ke,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(Ws,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(wr,{options:{searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:j},search:y.searchText,searchText:y.searchText,searchTextUpdate:E=>T(I=>({...I,searchText:E})),searchClose:()=>T(E=>({...E,searchText:""})),onSearchOpen:()=>{}}),e.jsxs($e,{onClick:N,variant:"contained",children:[e.jsx(nt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]})}),e.jsx(At,{className:"main-table",locale:l,data:S,columns:Y,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:D,onChange:H}),p&&e.jsx(at,{title:`${r("common.delete")} ${p.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:K,onCancel:()=>m(null),children:e.jsx(a,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(E=>e.jsxs(a,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Os,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(A,{component:"span",variant:"inherit",sx:{color:"text.secondary"},children:E})]}))})}),Q]})}const Vr=go(a)`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-HB59rGor.js","assets/index-B2EmOTH7.js","assets/vendor-mui-core-Bq_sfmbr.js","assets/vendor-react-Dvs43sk9.js","assets/vendor-ux-DnuP69h2.js","assets/vendor-utils-DQK0pEML.js","assets/vendor-hooks-DLNZ8kxG.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-CzdgnaKl.js","assets/index-DrVXX4fX.css","assets/index-BPy8_fa2.js","assets/index-DRYJ0xIl.js","assets/index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
2
+ import{r as k,i as It,j as rt,L as we,g as fo,k as As,l as qs,m as bt}from"./vendor-react-Dvs43sk9.js";import{J as Oe,j as e,ak as a,b4 as Et,W as n,am as ke,I as ce,dv as Ns,dw as _s,ch as xo,cf as nt,dx as Ws,a_ as Os,T as A,s as go,dy as ko,dz as zs,cK as Bs,Y as lt,at as ve,av as Vs,dA as Us,a5 as Ze,aX as it,bc as Pt,c6 as Ms,bf as Fs,b6 as Ye,cS as Hs,bg as et,Q as G,a6 as Se,bD as Js,O as jo,K as yo,P as Lt,ai as wo,o as vo,M as be,a3 as Xs,bB as Co,$ as Ro,bv as Gs,A as He,aJ as Ks,R as So,z as ne,b1 as Re,dB as Xt,bW as tt,dC as To,V as Do,S as $t,aP as Io,bC as Zs,D as Eo,cp as Ys,aQ as Qs,aR as er,cq as tr,cr as or,bE as Po,aq as sr,dD as rr,a1 as Lo,a0 as ot,bi as Gt,bH as nr,bI as lr,dE as ir,dF as cr,bb as vt,y as ar,F as dr,bp as ur,bq as ft}from"./vendor-mui-core-Bq_sfmbr.js";import{c as F,Z as ge,a8 as De,be as pr,v as hr,X as me,bZ as mr,Y as br,f as Kt,b_ as fr,au as Zt,ba as xr,bD as gr,b$ as kr,c0 as jr,c1 as yr}from"./index-B2EmOTH7.js";import{T as X,ai as $o,D as $e,al as Ao,a6 as qo,aa as wr,ac as At,H as W,P as qt,aZ as Nt,ab as ae,_ as No,a7 as We,F as ct,L as _o}from"./vendor-ux-DnuP69h2.js";import{C as at}from"./confirm-DV4YCyEc.js";import{u as ze}from"./session-DGj-_oAZ.js";import{W as Ct}from"./did-address-4KKI5Z_V.js";import{E as Je}from"./empty-spinner-DYg7efl9.js";import{B as _t}from"./bundle-avatar-CfoJFi5J.js";import{S as Te}from"./shorten-label-BYntTWDs.js";import{L as Wt}from"./list-header-DELs3iEf.js";import{K as vr,C as ue,A as Ot,D as Wo,a0 as Cr}from"./vendor-utils-DQK0pEML.js";import{C as Oo}from"./click-to-copy-CH3FJWJo.js";import{t as Rr}from"./question-mark-circle.svg-B4stD6SS.js";import{l as Sr,b as Tr}from"./vendor-hooks-DLNZ8kxG.js";import{u as Me}from"./useSetState-DFuQZPPV.js";import{e as Dr}from"./engine-CRVby1S4.js";import"./api-sewNv0AE.js";import{T as Ir,S as Er}from"./vendor-mui-x-BbwECMfi.js";import{D as Yt,C as Qt,P as eo}from"./react-beautiful-dnd.esm-DFIGUIPG.js";import{u as zo,c as Pr,w as Lr,a as $r,b as Ar}from"./wait-connect-D0ORg2Ga.js";import{f as xe}from"./index-DBs9Ljax.js";import{c as qr,A as Bo,S as Nr,U as _r,r as Wr}from"./item-vw_cuyBZ.js";import{D as Or}from"./delete-confirm-ad8t0UXs.js";import{g as Vo}from"./get-safe-url-D4-uUwWa.js";import{u as Le}from"./index-BjLb1HBo.js";import{M as zr}from"./index-DdXpn59U.js";import{r as Br}from"./index-CZyIUWF0.js";import"./vendor-arcblock-CzdgnaKl.js";import"./lottie-web-4koyQiv_.js";import"./raf-schd.esm-CHNehTG3.js";function zt({did:t,projectId:o,title:s,logo:r,describe:l}){const i=`${`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${r}`,[d,u]=k.useState(!1),x=Oe(p=>p.breakpoints.down("md"));return e.jsxs(a,{sx:{display:"flex",flexDirection:"row",color:d?"primary.main":"grey.900",gap:1},onPointerEnter:()=>u(!0),onPointerLeave:()=>u(!1),children:[e.jsx(Et,{sx:{borderRadius:1},src:i}),e.jsxs(a,{children:[e.jsx(Te,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:x?"primary.main":""},children:s||"/"}),e.jsx(Te,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:x||d?"primary.main":"grey.700"},children:l||"/"})]})]})}zt.propTypes={projectId:n.string.isRequired,did:n.string.isRequired,title:n.string.isRequired,logo:n.string.isRequired,describe:n.string.isRequired};function Uo({initUrl:t=null}){const o=It(),s=t?.searchParams.get("tenantScope")||"",{t:r,locale:l}=X(),{api:c}=ge(),{api:i}=ze(),[d,u]=k.useState(!0),{blocklet:x}=De(),[p,m]=k.useState(null),[f,b]=k.useState(!1),h=Oe(E=>E.breakpoints.down("xl")),j=Oe(E=>E.breakpoints.down("md")),{componentDid:v=""}=rt(),[g,C]=k.useState(null),D=`publish-${x.meta.did}`,R=$o(D),[y,T]=k.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),O=()=>{c.getProjects({input:{did:x.meta.did,componentDid:v,tenantScope:s}}).then(E=>{const I=E?.projects||[];u(!1),C(I)}).catch(E=>{u(!1),W.error(E.message)})},N=()=>{o(`${F.UNOWNED_DID}/create/none/0.0.0`,{replace:!0})},z=E=>{m(E)},K=()=>{u(!1),b(!0)},P=()=>{b(!1),m(null)},L=E=>{W.error(E.message),b(!1),m(null)},w=E=>{if(!E?.deleted){W.error("Delete project failed");return}O(),b(!1),m(null)};k.useEffect(()=>{O()},[]);const S=k.useMemo(()=>{if(!y.searchText)return g;let E=y.searchText?.trim();return E?(E=pr.toAddress(E).toLocaleLowerCase(),g.filter(I=>I.blockletTitle.toLowerCase().includes(E)||I.blockletDid.toLowerCase().includes(E))):g},[g,y.searchText]);if(!g&&d)return e.jsx(a,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Je,{})});if(!g)return null;if(!g.length)return e.jsxs(a,{sx:{display:"flex",flexDirection:"column",alignItems:"center",pt:10},children:[e.jsx(a,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),e.jsx(a,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),e.jsx($e,{onClick:N,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const Y=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:E=>{const I=g[E];return e.jsx(we,{to:`${I.id}`,children:e.jsx(zt,{did:x.meta.did,projectId:I.id,logo:I.blockletLogo,title:I.blockletTitle,describe:I.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:E=>E?e.jsx(Ao,{type:"success",children:E}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:E=>E?e.jsx(Ct,{size:14,compact:!0,responsive:!1,did:E}):null}},h||v?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:E=>E?e.jsx(Ct,{onClick:()=>{o(`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/members?did=${E}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:E}):null}},h||v?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:E=>{const I=(x.children||[]).find(V=>V.meta.did===E);return I?e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[e.jsx(_t,{size:14,blocklet:I,ancestors:[x]}),e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:I.meta.title})]},E):""}}},h||s?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:E=>e.jsx(a,{sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Te,{children:E})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:E=>e.jsx(qo,{value:Number(E),locale:l})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:E=>{const I=g[E];return e.jsxs(a,{sx:{display:"flex"},children:[e.jsx(we,{to:`${I.id}/new-release/none/${I.lastReleaseId}`,children:e.jsx(ke,{title:r("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(Ns,{style:{fontSize:18}})})})}),!!I.lastReleaseId&&e.jsx(ke,{title:r("blocklet.publish.viewLastRelease",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(we,{style:{display:"flex"},to:`${I.id}/view/${I.lastReleaseId}/${I.blockletVersion}`,children:e.jsx(_s,{sx:{fontSize:18}})})})}),e.jsx(ke,{title:r("blocklet.publish.delete",{name:I.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>z(I),children:e.jsx(xo,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),H=({page:E,rowsPerPage:I,searchText:V})=>{y.pageSize!==I?T(U=>({...U,searchText:"",pageSize:I,page:1})):y.page!==E+1?T(U=>({...U,searchText:"",page:E+1})):y.searchText!==V&&T(U=>({...U,searchText:V,page:1}))},Q=f?e.jsx(hr,{open:!0,popup:!0,onClose:P,action:"check-has-project-id",locale:l,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:w,onError:L,extraParams:{projectId:p.id,did:x.meta.did,name:p.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:p.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:p.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(Vr,{children:[e.jsx(Wt,{sx:{mb:2},left:e.jsxs(a,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(a,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),e.jsx(ke,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(Ws,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(wr,{options:{searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:j},search:y.searchText,searchText:y.searchText,searchTextUpdate:E=>T(I=>({...I,searchText:E})),searchClose:()=>T(E=>({...E,searchText:""})),onSearchOpen:()=>{}}),e.jsxs($e,{onClick:N,variant:"contained",children:[e.jsx(nt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]})}),e.jsx(At,{className:"main-table",locale:l,data:S,columns:Y,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:D,onChange:H}),p&&e.jsx(at,{title:`${r("common.delete")} ${p.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:K,onCancel:()=>m(null),children:e.jsx(a,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(E=>e.jsxs(a,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Os,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(A,{component:"span",variant:"inherit",sx:{color:"text.secondary"},children:E})]}))})}),Q]})}const Vr=go(a)`
3
3
  ${({theme:t})=>t.breakpoints.down("md")} {
4
4
  .MuiTableRow-root {
5
5
  border-color: ${({theme:t})=>t.palette.divider};
@@ -142,7 +142,7 @@ import{r as k,i as It,j as rt,L as we,g as fo,k as As,l as qs,m as bt}from"./ven
142
142
  background: #fff;
143
143
  z-index: 10;
144
144
  }
145
- `,io="lastWantToConnectStoreId";function rn(t){const[o,s]=k.useState(null),{session:r}=ze(),l=k.useCallback(d=>{s(d),localStorage.setItem(io,d?.id)},[s]),c=k.useMemo(()=>{const d=localStorage.getItem(io),u=d?(t?.settings?.storeList||[]).find(p=>p.id===d):null;if(u)return u;let x=(t?.settings?.storeList||[]).find(p=>!(p.id!==F.BLOCKLET_STORE.id||p.scope&&p.scope!=="studio"&&p.scope!==r?.user?.did));return x||(x=t?.settings?.storeList?.[0]),x},[t?.settings?.storeList,r?.user?.did]);return[o||c||{},l]}const Bt=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:r})=>{const l=t?s?.meta?.did:o?.did;let c=t?s?.settings?.storeList||[]:o?.blockletRegistryList||[];return Array.isArray(c)||(c=[]),c=c.filter(i=>i.protected||Cr(i.scope)||i.scope==="studio"||i.scope===r),{teamDid:l,storeList:c}};function es({blocklet:t=null,store:o=null,onChangeStore:s,onClick:r,disabled:l,loading:c,componentDid:i}){const{t:d}=X(),{session:u}=ze(),{api:x,info:p,inService:m}=ge(),f=De(),[b,h]=k.useState(!1),j=k.useRef(null),[v,g]=k.useState(!1),[C,D]=k.useState(null),R=L=>{s(L),h(!1)},y=()=>{h(!b)},T=L=>{j.current&&j.current.contains(L.target)||h(!1)},O=()=>{g(!0)},N=()=>{g(!1)},z=async()=>{if(C)try{await x.deleteBlockletStore({input:{teamDid:t.meta.did,url:C.url,projectId:"",scope:C.scope||"studio"}}),await f?.actions?.refreshBlocklet()}catch(L){W.error(`Remove Blocklet Store Error: ${xe(L)}`)}finally{D(null)}},{storeList:K}=Bt({fromBlocklet:m,blocklet:t,nodeInfo:p,userDid:u?.user?.did}),P=t?.meta?.did;return e.jsxs(e.Fragment,{children:[e.jsxs(et,{disabled:l,ref:j,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(G,{onClick:r,children:[c&&e.jsx(Se,{size:14,sx:{mr:.5}}),`${d("common.connect")} ${o.name||""}`]}),e.jsx(G,{size:"small","aria-controls":b?"split-button-menu":void 0,"aria-expanded":b?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:y,children:e.jsx(Js,{})})]}),e.jsx(jo,{sx:{zIndex:10},open:b,anchorEl:j.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:L})=>e.jsx(yo,{...L,style:{transformOrigin:"center top"},children:e.jsx(Lt,{children:e.jsx(wo,{onClickAway:T,children:e.jsxs(vo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[K?.map(w=>e.jsxs(be,{selected:w.id===o?.id,sx:{height:56},onClick:()=>R(w),children:[e.jsxs(a,{children:[e.jsx(Te,{sx:{fontSize:"16px"},maxLength:24,children:w.name}),e.jsx(Te,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:w.url})]}),qr({store:w,userDid:u?.user?.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),D(w)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},w.url)),e.jsx(Xs,{}),e.jsxs(be,{onClick:O,children:[e.jsx(nt,{font:!0}),e.jsx(A,{variant:"inherit",children:d("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(Bo,{hiddenChildren:!0,open:!0,onClose:N,teamDid:P,storeList:K,scope:"studio",onAdd:f?.actions?.refreshBlocklet}),C&&e.jsx(at,{displayError:!0,title:`${d("common.delete")} ${C.name}`,description:d("blocklet.publish.deleteStoreTip",{name:C.name}),confirm:d("common.confirm"),onConfirm:z,onCancel:()=>D(null)})]})}es.propTypes={store:n.object,blocklet:n.object,onChangeStore:n.func.isRequired,onClick:n.func.isRequired,loading:n.bool.isRequired,disabled:n.bool.isRequired,componentDid:n.string.isRequired,projectType:n.string.isRequired,getData:n.func.isRequired};const ts=(t,o,s)=>{const r=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,c=t?.blockletLogo?`${r}/${t.blockletLogo}`:`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,i=(t?.blockletScreenshots||[]).filter(Boolean).map(d=>`${l}/${d}`);return{logoUrl:c,screenshotUrls:i,uploadLogoPrefix:r,uploadScreenshotPrefix:l}},nn=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function Vt({url:t,style:o={},controls:s=1,modestbranding:r=1}){const{t:l}=X(),c=t.includes("youtube.com")||t.includes("youtu.be"),i=t.includes("vimeo.com");if(c){const d=t.split("v=")[1]?.split("&")[0]||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o?.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${d}?modestbranding=${r}&controls=${s}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(i){const d=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${d}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(a,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(a,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(A,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}Vt.propTypes={url:n.string.isRequired,style:n.object,controls:n.number,modestbranding:n.number};function os({setParams:t,onClose:o,params:s}){const{t:r}=X(),[l,c]=k.useState(""),i=l&&s.blockletVideos.includes(l),d=nn(l),u=()=>{t(x=>{const p=[...x.blockletVideos];return p.push(l),{...x,blockletVideos:p}}),o()};return e.jsxs(lt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Co,{children:r("studio.videoDialogTitle")}),e.jsxs(Ro,{children:[e.jsx(Gs,{fullWidth:!0,value:l,onChange:x=>c(x.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:l?e.jsx(He,{position:"end",children:e.jsx(ce,{onClick:()=>c(""),children:e.jsx(Ks,{})})}):null,error:i}),i&&e.jsx(A,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(Vt,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(So,{children:[e.jsx(G,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(G,{disabled:!d||i,onClick:u,children:r("studio.confirm")})]})]})}os.propTypes={onClose:n.func.isRequired,params:n.object.isRequired,setParams:n.func.isRequired};function Rt({errors:t,storeList:o,...s}){const{t:r}=X();return e.jsxs(a,{...s,sx:[{color:"warning.main",fontSize:"14px",border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},...Array.isArray(s.sx)?s.sx:[s.sx]],children:[e.jsx(A,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:r("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([l,c])=>{const i=Object.values(c),d=o.find(u=>u.url===l);return i.length>0&&e.jsxs(a,{children:[e.jsx(ke,{title:l,children:e.jsx(a,{component:"span",sx:{cursor:"pointer"},children:d.name})}),i.map(u=>e.jsx(a,{component:"li",sx:{ml:2,wordBreak:!0},children:u},u))]},l)})]})}Rt.propTypes={errors:n.object.isRequired,storeList:n.array.isRequired};const co=k.lazy(()=>No(()=>import("./index-B9b-a_Uj.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ss({projectId:t,readOnly:o,loading:s,blocklet:r,params:l,setParams:c,paramsErrTip:i,setParamsErrTip:d,warning:u,setLoading:x,initUrl:p=null,initLogoUrl:m,setInitLogoUrl:f,componentDid:b=""}){const{t:h,locale:j}=X(),{api:v}=ge(),g=It(),C=k.useRef(null),D=k.useRef(null),[R,y]=rn(r),[T,O]=k.useState(!1),N=zo({messageType:"connect-store-message",onOpen:()=>x(!0),onClose:()=>x(!1)}),z=async q=>{const Z=setTimeout(()=>{x(!1)},2e4),J=await Lr(v,q);x(!1),clearTimeout(Z),window.parent.postMessage({event:"studioDialog.connected",componentDid:b},"*"),g(window.location.pathname.replace(`${F.UNOWNED_DID}/create`,`${J}/create`),{replace:!0})},K=()=>{if(!l.blockletTitle){W.error(h("blocklet.publish.errorTip.noTitle"));return}if(!R?.url){W.error(h("blocklet.publish.noStoreSelected"));return}const q=Pr();N(async(Z,J)=>{try{const se=await v.connectByStudio({input:{did:r?.meta?.did,blockletTitle:l?.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:l?.blockletComponents?.length>0?"pack":"resource",componentDid:b,messageId:q,tenantScope:p?.searchParams.get("tenantScope")||""}});if(!se?.url){W.error("failed to connect to store");return}J(se.url),z({did:r?.meta?.did,projectId:"",messageId:q})}catch(se){const de=xe(se);W.error(de),x(!1)}})},{logoUrl:P,screenshotUrls:L,uploadLogoPrefix:w,uploadScreenshotPrefix:S}=ts(l,r,t),{logoErrors:Y,screenshotErrors:H,storeList:Q,hasLogoWarning:E,hasScreenshotWarning:I}=u,V=()=>o?!1:!t||t===F.UNOWNED_DID?(W.error(h("blocklet.publish.errorTip.noFirstDid")),!1):!0,U=q=>{if(!q.destination)return;const Z=Array.from(l.blockletScreenshots),[J]=Z.splice(q.source.index,1);Z.splice(q.destination.index,0,J),c(se=>({...se,blockletScreenshots:Z}))},ee=q=>{if(!q.destination)return;const Z=Array.from(l.blockletVideos),[J]=Z.splice(q.source.index,1);Z.splice(q.destination.index,0,J),c(se=>({...se,blockletVideos:Z}))};return e.jsxs(ln,{children:[e.jsx(a,{className:"section",sx:{display:"flex"},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.title")}`,placeholder:`Blocklet ${h("common.title")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:l.blockletTitle||"",onChange:q=>{d({blockletTitle:""}),c({blockletTitle:q.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||"",slotProps:{input:{"data-cy":"blocklet-title",readOnly:o}}}),e.jsx(ne,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",error:!!i.projectId,helperText:i.projectId||"",value:t===F.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3},slotProps:{input:{"data-cy":"export-blocklet-did",endAdornment:t===F.UNOWNED_DID&&e.jsx(He,{position:"end",children:e.jsx(es,{blocklet:r,store:R,componentDid:b,onChangeStore:y,disabled:!l.blockletTitle||o||s,loading:s,onClick:K})})}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.description")}`,placeholder:`Blocklet ${h("common.description")}`,required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletDescription||"",onChange:q=>{d({blockletDescription:""}),c({blockletDescription:q.target.value.slice(0,159)})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-description",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.homepageTip")}`,placeholder:`Blocklet ${h("common.homepageTip")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletHomepage||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletHomepage:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletHomepage:""}),c({blockletHomepage:q.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-homepage",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.community")}`,placeholder:`Blocklet ${h("common.community")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletCommunity||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletCommunity:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletCommunity:""}),c({blockletCommunity:q.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-community",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.support")}`,placeholder:`Blocklet ${h("common.support")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletSupport||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(q.target.value)?d({blockletSupport:h("blocklet.publish.errorTip.invalidUrlOrEmail")}):d({blockletSupport:""}),c({blockletSupport:q.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-support",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.repository")}`,placeholder:`Blocklet ${h("common.repository")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletRepository||"",onChange:q=>{q.target.value&&!/^(git|https|svn)/.test(q.target.value)?d({blockletRepository:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletRepository:""}),c({blockletRepository:q.target.value})},error:!!i.blockletRepository,helperText:i.blockletRepository||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-repository",readOnly:o}}})]})}),e.jsx(a,{className:"section full-width",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.logo")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.type"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(a,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Et,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:m||P,onClick:()=>{V()&&C.current?.open()}})})]}),E&&e.jsx(Rt,{errors:Y,storeList:Q,mt:3}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.screenshot")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(Yt,{onDragEnd:o?void 0:U,children:e.jsx(Qt,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(q,Z)=>e.jsxs(a,{ref:q.innerRef,...q.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Z.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:Z.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[L.map((J,se)=>e.jsx(eo,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:J}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletScreenshots];return he.splice(se,1),{...pe,blockletScreenshots:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,L.length<5&&e.jsx(a,{onClick:()=>{V()&&D.current?.open()},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]}),I&&e.jsx(Rt,{errors:H,storeList:Q}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("studio.video")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.videoType"),":"," "]}),e.jsxs(a,{component:"span",sx:{color:"secondary.main"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(Yt,{onDragEnd:o?void 0:ee,children:e.jsx(Qt,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(q,Z)=>e.jsxs(a,{ref:q.innerRef,...q.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Z.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:Z.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[l.blockletVideos.map((J,se)=>e.jsx(eo,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(Vt,{url:J,style:{pointerEvents:le.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletVideos];return he.splice(se,1),{...pe,blockletVideos:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,l.blockletVideos.length<3&&e.jsx(a,{onClick:()=>{V()&&O(!0)},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]})]})}),e.jsxs(k.Suspense,{fallback:e.jsx(Je,{}),children:[e.jsx(co,{ref:C,locale:j,popup:!0,onUploadFinish:q=>{c({blockletLogo:q.data.filename}),f(""),C.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:w,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),T&&e.jsx(os,{onClose:()=>O(!1),params:l,setParams:c}),e.jsx(co,{ref:D,locale:j,popup:!0,onUploadFinish:q=>{c(Z=>{const J=Z.blockletScreenshots||[];return J.push(q.data?.filename),{...Z,blockletScreenshots:J}}),D.current?.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-L.length}},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}ss.propTypes={projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,warning:n.object.isRequired,loading:n.bool.isRequired,blocklet:n.object.isRequired,setLoading:n.func.isRequired,initUrl:n.object,componentDid:n.string,initLogoUrl:n.string.isRequired,setInitLogoUrl:n.func.isRequired};const ln=ve.div`
145
+ `,io="lastWantToConnectStoreId";function rn(t){const[o,s]=k.useState(null),{session:r}=ze(),l=k.useCallback(d=>{s(d),localStorage.setItem(io,d?.id)},[s]),c=k.useMemo(()=>{const d=localStorage.getItem(io),u=d?(t?.settings?.storeList||[]).find(p=>p.id===d):null;if(u)return u;let x=(t?.settings?.storeList||[]).find(p=>!(p.id!==F.BLOCKLET_STORE.id||p.scope&&p.scope!=="studio"&&p.scope!==r?.user?.did));return x||(x=t?.settings?.storeList?.[0]),x},[t?.settings?.storeList,r?.user?.did]);return[o||c||{},l]}const Bt=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:r})=>{const l=t?s?.meta?.did:o?.did;let c=t?s?.settings?.storeList||[]:o?.blockletRegistryList||[];return Array.isArray(c)||(c=[]),c=c.filter(i=>i.protected||Cr(i.scope)||i.scope==="studio"||i.scope===r),{teamDid:l,storeList:c}};function es({blocklet:t=null,store:o=null,onChangeStore:s,onClick:r,disabled:l,loading:c,componentDid:i}){const{t:d}=X(),{session:u}=ze(),{api:x,info:p,inService:m}=ge(),f=De(),[b,h]=k.useState(!1),j=k.useRef(null),[v,g]=k.useState(!1),[C,D]=k.useState(null),R=L=>{s(L),h(!1)},y=()=>{h(!b)},T=L=>{j.current&&j.current.contains(L.target)||h(!1)},O=()=>{g(!0)},N=()=>{g(!1)},z=async()=>{if(C)try{await x.deleteBlockletStore({input:{teamDid:t.meta.did,url:C.url,projectId:"",scope:C.scope||"studio"}}),await f?.actions?.refreshBlocklet()}catch(L){W.error(`Remove Blocklet Store Error: ${xe(L)}`)}finally{D(null)}},{storeList:K}=Bt({fromBlocklet:m,blocklet:t,nodeInfo:p,userDid:u?.user?.did}),P=t?.meta?.did;return e.jsxs(e.Fragment,{children:[e.jsxs(et,{disabled:l,ref:j,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(G,{onClick:r,children:[c&&e.jsx(Se,{size:14,sx:{mr:.5}}),`${d("common.connect")} ${o.name||""}`]}),e.jsx(G,{size:"small","aria-controls":b?"split-button-menu":void 0,"aria-expanded":b?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:y,children:e.jsx(Js,{})})]}),e.jsx(jo,{sx:{zIndex:10},open:b,anchorEl:j.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:L})=>e.jsx(yo,{...L,style:{transformOrigin:"center top"},children:e.jsx(Lt,{children:e.jsx(wo,{onClickAway:T,children:e.jsxs(vo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[K?.map(w=>e.jsxs(be,{selected:w.id===o?.id,sx:{height:56},onClick:()=>R(w),children:[e.jsxs(a,{children:[e.jsx(Te,{sx:{fontSize:"16px"},maxLength:24,children:w.name}),e.jsx(Te,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:w.url})]}),qr({store:w,userDid:u?.user?.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),D(w)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},w.url)),e.jsx(Xs,{}),e.jsxs(be,{onClick:O,children:[e.jsx(nt,{font:!0}),e.jsx(A,{variant:"inherit",children:d("store.blockletRegistry.addRegistry")})]})]})})})})}),v&&e.jsx(Bo,{hiddenChildren:!0,open:!0,onClose:N,teamDid:P,storeList:K,scope:"studio",onAdd:f?.actions?.refreshBlocklet}),C&&e.jsx(at,{displayError:!0,title:`${d("common.delete")} ${C.name}`,description:d("blocklet.publish.deleteStoreTip",{name:C.name}),confirm:d("common.confirm"),onConfirm:z,onCancel:()=>D(null)})]})}es.propTypes={store:n.object,blocklet:n.object,onChangeStore:n.func.isRequired,onClick:n.func.isRequired,loading:n.bool.isRequired,disabled:n.bool.isRequired,componentDid:n.string.isRequired,projectType:n.string.isRequired,getData:n.func.isRequired};const ts=(t,o,s)=>{const r=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,c=t?.blockletLogo?`${r}/${t.blockletLogo}`:`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,i=(t?.blockletScreenshots||[]).filter(Boolean).map(d=>`${l}/${d}`);return{logoUrl:c,screenshotUrls:i,uploadLogoPrefix:r,uploadScreenshotPrefix:l}},nn=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function Vt({url:t,style:o={},controls:s=1,modestbranding:r=1}){const{t:l}=X(),c=t.includes("youtube.com")||t.includes("youtu.be"),i=t.includes("vimeo.com");if(c){const d=t.split("v=")[1]?.split("&")[0]||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o?.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${d}?modestbranding=${r}&controls=${s}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(i){const d=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${d}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(a,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(a,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(A,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}Vt.propTypes={url:n.string.isRequired,style:n.object,controls:n.number,modestbranding:n.number};function os({setParams:t,onClose:o,params:s}){const{t:r}=X(),[l,c]=k.useState(""),i=l&&s.blockletVideos.includes(l),d=nn(l),u=()=>{t(x=>{const p=[...x.blockletVideos];return p.push(l),{...x,blockletVideos:p}}),o()};return e.jsxs(lt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Co,{children:r("studio.videoDialogTitle")}),e.jsxs(Ro,{children:[e.jsx(Gs,{fullWidth:!0,value:l,onChange:x=>c(x.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:l?e.jsx(He,{position:"end",children:e.jsx(ce,{onClick:()=>c(""),children:e.jsx(Ks,{})})}):null,error:i}),i&&e.jsx(A,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(Vt,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(So,{children:[e.jsx(G,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(G,{disabled:!d||i,onClick:u,children:r("studio.confirm")})]})]})}os.propTypes={onClose:n.func.isRequired,params:n.object.isRequired,setParams:n.func.isRequired};function Rt({errors:t,storeList:o,...s}){const{t:r}=X();return e.jsxs(a,{...s,sx:[{color:"warning.main",fontSize:"14px",border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},...Array.isArray(s.sx)?s.sx:[s.sx]],children:[e.jsx(A,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:r("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([l,c])=>{const i=Object.values(c),d=o.find(u=>u.url===l);return i.length>0&&e.jsxs(a,{children:[e.jsx(ke,{title:l,children:e.jsx(a,{component:"span",sx:{cursor:"pointer"},children:d.name})}),i.map(u=>e.jsx(a,{component:"li",sx:{ml:2,wordBreak:!0},children:u},u))]},l)})]})}Rt.propTypes={errors:n.object.isRequired,storeList:n.array.isRequired};const co=k.lazy(()=>No(()=>import("./index-HB59rGor.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ss({projectId:t,readOnly:o,loading:s,blocklet:r,params:l,setParams:c,paramsErrTip:i,setParamsErrTip:d,warning:u,setLoading:x,initUrl:p=null,initLogoUrl:m,setInitLogoUrl:f,componentDid:b=""}){const{t:h,locale:j}=X(),{api:v}=ge(),g=It(),C=k.useRef(null),D=k.useRef(null),[R,y]=rn(r),[T,O]=k.useState(!1),N=zo({messageType:"connect-store-message",onOpen:()=>x(!0),onClose:()=>x(!1)}),z=async q=>{const Z=setTimeout(()=>{x(!1)},2e4),J=await Lr(v,q);x(!1),clearTimeout(Z),window.parent.postMessage({event:"studioDialog.connected",componentDid:b},"*"),g(window.location.pathname.replace(`${F.UNOWNED_DID}/create`,`${J}/create`),{replace:!0})},K=()=>{if(!l.blockletTitle){W.error(h("blocklet.publish.errorTip.noTitle"));return}if(!R?.url){W.error(h("blocklet.publish.noStoreSelected"));return}const q=Pr();N(async(Z,J)=>{try{const se=await v.connectByStudio({input:{did:r?.meta?.did,blockletTitle:l?.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:l?.blockletComponents?.length>0?"pack":"resource",componentDid:b,messageId:q,tenantScope:p?.searchParams.get("tenantScope")||""}});if(!se?.url){W.error("failed to connect to store");return}J(se.url),z({did:r?.meta?.did,projectId:"",messageId:q})}catch(se){const de=xe(se);W.error(de),x(!1)}})},{logoUrl:P,screenshotUrls:L,uploadLogoPrefix:w,uploadScreenshotPrefix:S}=ts(l,r,t),{logoErrors:Y,screenshotErrors:H,storeList:Q,hasLogoWarning:E,hasScreenshotWarning:I}=u,V=()=>o?!1:!t||t===F.UNOWNED_DID?(W.error(h("blocklet.publish.errorTip.noFirstDid")),!1):!0,U=q=>{if(!q.destination)return;const Z=Array.from(l.blockletScreenshots),[J]=Z.splice(q.source.index,1);Z.splice(q.destination.index,0,J),c(se=>({...se,blockletScreenshots:Z}))},ee=q=>{if(!q.destination)return;const Z=Array.from(l.blockletVideos),[J]=Z.splice(q.source.index,1);Z.splice(q.destination.index,0,J),c(se=>({...se,blockletVideos:Z}))};return e.jsxs(ln,{children:[e.jsx(a,{className:"section",sx:{display:"flex"},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.title")}`,placeholder:`Blocklet ${h("common.title")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:l.blockletTitle||"",onChange:q=>{d({blockletTitle:""}),c({blockletTitle:q.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||"",slotProps:{input:{"data-cy":"blocklet-title",readOnly:o}}}),e.jsx(ne,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",error:!!i.projectId,helperText:i.projectId||"",value:t===F.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3},slotProps:{input:{"data-cy":"export-blocklet-did",endAdornment:t===F.UNOWNED_DID&&e.jsx(He,{position:"end",children:e.jsx(es,{blocklet:r,store:R,componentDid:b,onChangeStore:y,disabled:!l.blockletTitle||o||s,loading:s,onClick:K})})}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.description")}`,placeholder:`Blocklet ${h("common.description")}`,required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletDescription||"",onChange:q=>{d({blockletDescription:""}),c({blockletDescription:q.target.value.slice(0,159)})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-description",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.homepageTip")}`,placeholder:`Blocklet ${h("common.homepageTip")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletHomepage||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletHomepage:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletHomepage:""}),c({blockletHomepage:q.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-homepage",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.community")}`,placeholder:`Blocklet ${h("common.community")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletCommunity||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?d({blockletCommunity:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletCommunity:""}),c({blockletCommunity:q.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-community",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.support")}`,placeholder:`Blocklet ${h("common.support")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletSupport||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(q.target.value)?d({blockletSupport:h("blocklet.publish.errorTip.invalidUrlOrEmail")}):d({blockletSupport:""}),c({blockletSupport:q.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-support",readOnly:o}}}),e.jsx(ne,{disabled:s||o,label:`Blocklet ${h("common.repository")}`,placeholder:`Blocklet ${h("common.repository")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletRepository||"",onChange:q=>{q.target.value&&!/^(git|https|svn)/.test(q.target.value)?d({blockletRepository:h("blocklet.publish.errorTip.invalidUrl")}):d({blockletRepository:""}),c({blockletRepository:q.target.value})},error:!!i.blockletRepository,helperText:i.blockletRepository||"",sx:{mt:3},slotProps:{input:{"data-cy":"blocklet-repository",readOnly:o}}})]})}),e.jsx(a,{className:"section full-width",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.logo")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.type"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(a,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Et,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:m||P,onClick:()=>{V()&&C.current?.open()}})})]}),E&&e.jsx(Rt,{errors:Y,storeList:Q,mt:3}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("common.screenshot")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.ratio"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.size"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(Yt,{onDragEnd:o?void 0:U,children:e.jsx(Qt,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(q,Z)=>e.jsxs(a,{ref:q.innerRef,...q.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Z.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:Z.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[L.map((J,se)=>e.jsx(eo,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:J}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletScreenshots];return he.splice(se,1),{...pe,blockletScreenshots:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,L.length<5&&e.jsx(a,{onClick:()=>{V()&&D.current?.open()},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]}),I&&e.jsx(Rt,{errors:H,storeList:Q}),e.jsxs(a,{sx:{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap"},children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("studio.video")}),e.jsxs(Re,{direction:"column",spacing:1,sx:{alignItems:"flex-start",opacity:.8,fontSize:"12px"},children:[e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.videoType"),":"," "]}),e.jsxs(a,{component:"span",sx:{color:"secondary.main"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.count"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(a,{children:e.jsxs(a,{component:"span",children:[e.jsxs(a,{component:"span",sx:{color:"text.secondary"},children:[h("studio.order"),":"," "]}),e.jsx(a,{component:"span",sx:{color:"secondary.main"},children:h("studio.orderTip")})]})})]})]}),e.jsx(Yt,{onDragEnd:o?void 0:ee,children:e.jsx(Qt,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(q,Z)=>e.jsxs(a,{ref:q.innerRef,...q.droppableProps,sx:{display:"flex",alignItems:"center",flex:1,flexWrap:"wrap",minHeight:160,background:Z.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:Z.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},children:[l.blockletVideos.map((J,se)=>e.jsx(eo,{draggableId:J,index:se,isDragDisabled:o,children:(de,le)=>e.jsxs(a,{ref:de.innerRef,...de.draggableProps,className:"screenshot",sx:{transform:le.isDragging?"scale(1.05)":"none",boxShadow:le.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(Vt,{url:J,style:{pointerEvents:le.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...de.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(Xt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{c(pe=>{const he=[...pe.blockletVideos];return he.splice(se,1),{...pe,blockletVideos:he}})},children:e.jsx(tt,{})})]})},J)),q.placeholder,l.blockletVideos.length<3&&e.jsx(a,{onClick:()=>{V()&&O(!0)},sx:{display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},children:"+"})]})})})]})]})}),e.jsxs(k.Suspense,{fallback:e.jsx(Je,{}),children:[e.jsx(co,{ref:C,locale:j,popup:!0,onUploadFinish:q=>{c({blockletLogo:q.data.filename}),f(""),C.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:w,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),T&&e.jsx(os,{onClose:()=>O(!1),params:l,setParams:c}),e.jsx(co,{ref:D,locale:j,popup:!0,onUploadFinish:q=>{c(Z=>{const J=Z.blockletScreenshots||[];return J.push(q.data?.filename),{...Z,blockletScreenshots:J}}),D.current?.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-L.length}},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}ss.propTypes={projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,warning:n.object.isRequired,loading:n.bool.isRequired,blocklet:n.object.isRequired,setLoading:n.func.isRequired,initUrl:n.object,componentDid:n.string,initLogoUrl:n.string.isRequired,setInitLogoUrl:n.func.isRequired};const ln=ve.div`
146
146
  margin-top: 24px;
147
147
  .screenshot {
148
148
  margin-bottom: 16px;
@@ -190,7 +190,7 @@ import{r as k,i as It,j as rt,L as we,g as fo,k as As,l as qs,m as bt}from"./ven
190
190
  padding-bottom: 12px;
191
191
  border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
192
192
  }
193
- `;function bs({text:t}){const{palette:o}=Eo();return t?e.jsx(zr,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:gr.sanitize(t),rehypePlugins:[[Br,{target:"_blank"}]]}):e.jsx(Fe,{Icon:Nt})}bs.propTypes={text:n.string.isRequired};function fs({params:t,setParams:o,paramsErrTip:s,loading:r,setParamsErrTip:l,readOnly:c}){const{t:i}=X(),[d,u]=k.useState(c?"preview":"write"),x=(p,m)=>{u(m)};return e.jsxs(a,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(A,{variant:"h6",sx:{fontWeight:"bold"},children:i("common.introduction")}),e.jsxs(Lo,{value:d,onChange:x,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(a,{sx:{display:d==="write"?"block":"none",width:"100%",marginTop:3},children:e.jsx(ne,{disabled:r||c,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:p=>{l({blockletIntroduction:""}),o({blockletIntroduction:p.target.value.slice(0,me.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||"",slotProps:{input:{"data-cy":"export-blocklet-introduction",readOnly:c,endAdornment:e.jsxs(He,{position:"end",children:[t?.blockletIntroduction?.length||0," / ",me.PROJECT.MAX_INTRO_LENGTH]})}}})}),e.jsx(a,{sx:{display:d==="preview"?"block":"none",mt:3},children:e.jsx(bs,{text:t.blockletIntroduction||""})})]})}fs.propTypes={params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,readOnly:n.bool.isRequired,loading:n.bool.isRequired};function xs({step:t=0,ok:o=!1,active:s=0,error:r="",warning:l=!1}){let c="grey.500",i=t+1;return o&&(i=e.jsx(Po,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&s>t?(c="error.main",i=e.jsx(Gt,{sx:{fontSize:18,margin:0},color:"white"})):l?(c="warning.main",i=e.jsx(Gt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(c="primary.main"),e.jsx(a,{sx:{width:24,height:24,bgcolor:c,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center"},children:i})}xs.propTypes={step:n.number,ok:n.bool,active:n.number,error:n.string,warning:n.bool};function gs({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:r=!1,params:l,loading:c,paramsErrTip:i,warning:d,viewMode:u="",projectId:x}){const{t:p}=X(),m=()=>{s(j=>j+1)},f=()=>{s(j=>j-1)},b=j=>j===0?i?.blockletTitle||i?.projectId||i?.blockletDescription||i?.blockletHomepage||i?.blockletSupport||i?.blockletCommunity||i?.blockletRepository:j===2?i?.blockletResource||i?.blockletDocker||i?.dockerImageName:j>=4?i?.blockletVersion||i?.note:"",h=u||rs({params:l,projectId:x,t:p})===null;return e.jsxs(a,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(nr,{activeStep:o,orientation:"vertical",children:t.map((j,v)=>{const g={},C=c||!pn({params:l,projectId:x,step:v,t:p}),D=c?"":b(v);return D&&(g.optional=e.jsx(A,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:D}),g.error=!0),e.jsxs(lr,{children:[e.jsx(ir,{icon:e.jsx(xs,{error:D,warning:v===0?d.hasWarning:!1,active:h?99:o,step:v,ok:C}),sx:{cursor:"pointer",color:D?"error.main":"inherit"},disabled:!1,onClick:()=>s(v),...g,children:e.jsx(A,{fontSize:"14px",fontWeight:"500",color:D||!C&&o>v?"error.main":"inherit",children:j.label})}),e.jsxs(cr,{children:[e.jsx(A,{fontSize:12,children:j.description}),!h&&e.jsx(a,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(G,{variant:"contained",onClick:m,sx:{mt:1,mr:1},disabled:D||!C,children:p("common.continue")}),v>0&&e.jsx(G,{disabled:v===0,onClick:f,sx:{mt:1,mr:1},children:p("common.back")})]})})]})]},j.label)})}),o>=t.length-1&&e.jsx(Lt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}gs.propTypes={steps:n.array.isRequired,activeStep:n.number.isRequired,setActiveStep:n.func.isRequired,params:n.object.isRequired,viewMode:n.oneOfType([n.string,n.bool]),loading:n.bool.isRequired,projectId:n.string.isRequired,hasSelectedResources:n.oneOfType([n.string,n.bool]),warning:n.object.isRequired,paramsErrTip:n.shape({projectId:n.string,blockletVersion:n.string,blockletTitle:n.string,blockletDescription:n.string,note:n.string,blockletResource:n.string,blockletHomepage:n.string,blockletSupport:n.string,blockletCommunity:n.string,blockletRepository:n.string,blockletDocker:n.object,dockerImageName:n.string}).isRequired};const mn=[".zip",".gz"],bn=1024*1024*100,fn=k.lazy(()=>No(()=>import("./index-B9b-a_Uj.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ks({app:t,projectId:o,readOnly:s,params:r,setParams:l,setParamsErrTip:c,error:i}){const{t:d,locale:u}=X(),x=k.useRef(null),p=()=>s?!1:!o||o===F.UNOWNED_DID?(W.error(d("blocklet.publish.errorTip.noFirstDid")),!1):!0,m=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(a,{sx:{mt:3},children:[e.jsx(A,{gutterBottom:!0,children:d("blocklet.publish.resourceUpload")}),e.jsxs(Re,{direction:"row",spacing:1,sx:{alignItems:"center",flex:1,cursor:s?"default":"pointer"},children:[!!r.uploadedResource&&e.jsx(A,{component:"a",href:`${m}/params.uploadedResource`,children:r.uploadedResource}),!s&&e.jsx(G,{variant:"outlined",size:"small",onClick:()=>{p()&&x.current?.open()},children:r.uploadedResource?d("common.change"):d("common.upload")})]}),e.jsx(k.Suspense,{fallback:e.jsx(Je,{}),children:e.jsx(fn,{ref:x,locale:u,popup:!0,onUploadFinish:f=>{l({uploadedResource:f.data.filename}),c({blockletResource:""}),x.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:m,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:mn,maxFileSize:bn,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&e.jsx(a,{sx:{color:"error.main",mt:1,fontSize:14},children:i})]})}ks.propTypes={app:n.object.isRequired,projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,error:n.string.isRequired,setParamsErrTip:n.func.isRequired};function Tt({readOnly:t,params:o,setParams:s,paramsErrTip:r,setParamsErrTip:l,loading:c}){const{t:i}=X();return e.jsx(a,{className:"section",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:c||t,label:`Blocklet ${i("common.version")}`,placeholder:`Blocklet ${i("common.version")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{l({blockletVersion:""}),s({blockletVersion:d.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||"",slotProps:{input:{"data-cy":"blocklet-version",readOnly:t}}}),e.jsx(ne,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:c||t,variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{l({note:""}),s({note:d.target.value.slice(0,me.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3},slotProps:{input:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(He,{position:"end",children:[o?.note?.length||0," / ",me.PROJECT.MAX_NOTE_LENGTH]})}}})]})})}Tt.propTypes={readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,loading:n.bool.isRequired};function js(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&js(t[o]);return t}var xn=Wr();const oe=fo(xn),gn={"-a":"--attach","-d":"--detach","-e":"--env","-h":"--hostname","-i":"--interactive","-it":"-it","-rm":"-rm","-m":"--memory","-p":"--publish","-P":"--publish-all","-l":"--label","-n":"--name","-q":"--quiet","-x":"--x-registry","-t":"--tty","-u":"--user","-v":"--volume","-w":"--workdir","-cgroupns":"--cgroupns","-cpus":"--cpus","-g":"--gpus","-ip6":"--ip6","--read-only":"--read-only","--add-host":"--add-host","--attach":"--attach","--blkio-weight":"--blkio-weight","--blkio-weight-device":"--blkio-weight-device","--cap-add":"--cap-add","--cap-drop":"--cap-drop","--cgroup-parent":"--cgroup-parent","--cidfile":"--cidfile","--cpu-period":"--cpu-period","--cpu-quota":"--cpu-quota","--cpu-rt-period":"--cpu-rt-period","--cpu-rt-runtime":"--cpu-rt-runtime","--cpu-shares":"--cpu-shares","--cpus":"--cpus","--cpuset-cpus":"--cpuset-cpus","--cpuset-mems":"--cpuset-mems","--detach":"--detach","--detach-keys":"--detach-keys","--device":"--device","--device-cgroup-rule":"--device-cgroup-rule","--device-read-bps":"--device-read-bps","--device-read-iops":"--device-read-iops","--device-write-bps":"--device-write-bps","--device-write-iops":"--device-write-iops","--disable-content-trust":"--disable-content-trust","--dns":"--dns","--dns-opt":"--dns-opt","--dns-search":"--dns-search","--domainname":"--domainname","--entrypoint":"--entrypoint","--env":"--env","--env-file":"--env-file","--expose":"--expose","--gpus":"--gpus","--group-add":"--group-add","--health-cmd":"--health-cmd","--health-interval":"--health-interval","--health-retries":"--health-retries","--health-start-period":"--health-start-period","--health-timeout":"--health-timeout","--help":"--help","--hostname":"--hostname","--init":"--init","--interactive":"--interactive","--ip":"--ip","--ip6":"--ip6","--ipc":"--ipc","--isolation":"--isolation","--kernel-memory":"--kernel-memory","--label":"--label","--label-file":"--label-file","--link":"--link","--link-local-ip":"--link-local-ip","--log-driver":"--log-driver","--log-opt":"--log-opt","--mac-address":"--mac-address","--memory":"--memory","--memory-reservation":"--memory-reservation","--memory-swap":"--memory-swap","--memory-swappiness":"--memory-swappiness","--mount":"--mount","--name":"--name","--network":"--network","--network-alias":"--network-alias","--no-healthcheck":"--no-healthcheck","--oom-kill-disable":"--oom-kill-disable","--oom-score-adj":"--oom-score-adj","--pid":"--pid","--pids-limit":"--pids-limit","--platform":"--platform","--privileged":"--privileged","--publish":"--publish","--publish-all":"--publish-all","--pull":"--pull","--restart":"--restart","--rm":"--rm","--runtime":"--runtime","--security-opt":"--security-opt","--shm-size":"--shm-size","--stop-signal":"--stop-signal","--stop-timeout":"--stop-timeout","--storage-opt":"--storage-opt","--sysctl":"--sysctl","--tmpfs":"--tmpfs","--tty":"--tty","--ulimit":"--ulimit","--user":"--user","--userns":"--userns","--uts":"--uts","--volume":"--volume","--volume-driver":"--volume-driver","--volumes-from":"--volumes-from","--workdir":"--workdir"},Ut={"--env":!0,"--publish":!0,"--volume":!0,"--attach":!0,"--quiet":!0,"--entrypoint":!0,"--workdir":!0,"--cidfile":!0,"--detach-keys":!0,"--disable-content-trust":!0,"--domainname":!0,"--expose":!0,"--ip":!0,"--link-local-ip":!0,"--platform":!0},kn={"--volume":!0,"--publish":!0},jn=new Set(["--publish","--volume"]),ys=t=>{const[o]=t.split(":");return o?.startsWith("/")||o?.startsWith("./")||o?.startsWith("../")||o?.startsWith("~")||o?.startsWith("$BLOCKLET")};function yn(t){return t.map(o=>{if(o.key!=="--volume"||o.value.startsWith("$BLOCKLET_APP_DIR/")||o.value.startsWith("$BLOCKLET_DATA_DIR/"))return o;const[s,...r]=o.value.split(":");if(!s||!ys(o.value))return o;const l=s.startsWith("/")?`$BLOCKLET_DATA_DIR${s}`:`$BLOCKLET_DATA_DIR/${s}`;return{...o,value:[l,...r].join(":")}})}function wn(t){let o=!0;return t.find(r=>r.key==="--publish"&&r.type==="web")?t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"docker":r.type};return o=r.type==="web",l}return r}):t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"web":"docker"};return o=!1,l}return r})}function po(t){if(!t)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};if(t=t.trim(),t.startsWith("$ docker run")&&(t=t.replace("$ docker run","docker run")),!t.startsWith("docker run"))return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const s=t.replace(/\\\n/g,"").replace(/\n/g," ").trim().match(/(?:[^\s"']+|'[^']*'|"[^"]*")+/g);if(!s)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const r=[],l=[];let c=0,i="",d="";const u=[];for(;c<s.length;){const p=s[c];if(!p){c++;continue}if(p==="docker"||p==="run"){c++;continue}if((p==="-e"||p==="--env")&&c+1<s.length){const m=s[c+1]||"",[f,...b]=m.split("=");if(f){const h=b.join("=").replace(/^['"]|['"]$/g,"");l.push({key:f,value:h})}c+=2;continue}if(p.startsWith("-")&&u.length===0){const m=p.indexOf("=");let f=p,b=null;m!==-1&&(f=p.substring(0,m),b=p.substring(m+1).replace(/^['"]|['"]$/g,""));const h=gn[f];if(!h){c+=2;continue}if(h==="--publish"){let j="";if(b)j=b,r.push({key:h,value:j});else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){j=(s[c+1]||"").replace(/^['"]|['"]$/g,""),r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}c++;continue}if(b!==null){r.push({key:h,value:b}),c++;continue}else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){const j=(s[c+1]||"").replace(/^['"]|['"]$/g,"");r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}}u.push(p),c++}i=u[0]||"",d=u.slice(1).join(" ");const x=[];for(const p of r)p.name="",p.path="",p.prefix="",p.protocol="",p.proxyBehavior="service",p.type="docker",!(jn.has(p.key)&&p.value==="true")&&x.push(p);for(const p of l)p.custom="",p.description="",p.secure=!1,p.shared=!1,p.required=!1;return{dockerArgs:wn(yn(x)),dockerEnvs:l,dockerImage:i,dockerCommand:d}}function vn({dockerArgs:t,dockerEnvs:o,dockerImage:s,dockerCommand:r}){if(t.length===0&&o.length===0&&!s)return"";const l=["docker run \\"],c=new Set(["--publish","--volume","--expose","--device","--mount","--label","--cap-add","--cap-drop","--add-host","--dns","--network-alias","--sysctl","--ulimit","--network"]);for(const i of t){const{key:d,value:u}=i;if(c.has(d))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}else if(!l.some(x=>x.startsWith(` ${d}`)))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}}for(const i of o){const{key:d,value:u}=i,x=/["']/g.test(u)?u:`"${u}"`;l.push(` -e ${d}=${x} \\`)}return s&&l.push(` ${s} \\`),r&&l.push(` ${r} \\`),l[l.length-1]?.endsWith(" \\")&&(l[l.length-1]=(l[l.length-1]||"").slice(0,-2)),l.join(`
193
+ `;function bs({text:t}){const{palette:o}=Eo();return t?e.jsx(zr,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:gr.sanitize(t),rehypePlugins:[[Br,{target:"_blank"}]]}):e.jsx(Fe,{Icon:Nt})}bs.propTypes={text:n.string.isRequired};function fs({params:t,setParams:o,paramsErrTip:s,loading:r,setParamsErrTip:l,readOnly:c}){const{t:i}=X(),[d,u]=k.useState(c?"preview":"write"),x=(p,m)=>{u(m)};return e.jsxs(a,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(a,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(A,{variant:"h6",sx:{fontWeight:"bold"},children:i("common.introduction")}),e.jsxs(Lo,{value:d,onChange:x,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(a,{sx:{display:d==="write"?"block":"none",width:"100%",marginTop:3},children:e.jsx(ne,{disabled:r||c,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:p=>{l({blockletIntroduction:""}),o({blockletIntroduction:p.target.value.slice(0,me.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||"",slotProps:{input:{"data-cy":"export-blocklet-introduction",readOnly:c,endAdornment:e.jsxs(He,{position:"end",children:[t?.blockletIntroduction?.length||0," / ",me.PROJECT.MAX_INTRO_LENGTH]})}}})}),e.jsx(a,{sx:{display:d==="preview"?"block":"none",mt:3},children:e.jsx(bs,{text:t.blockletIntroduction||""})})]})}fs.propTypes={params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,readOnly:n.bool.isRequired,loading:n.bool.isRequired};function xs({step:t=0,ok:o=!1,active:s=0,error:r="",warning:l=!1}){let c="grey.500",i=t+1;return o&&(i=e.jsx(Po,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&s>t?(c="error.main",i=e.jsx(Gt,{sx:{fontSize:18,margin:0},color:"white"})):l?(c="warning.main",i=e.jsx(Gt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(c="primary.main"),e.jsx(a,{sx:{width:24,height:24,bgcolor:c,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center"},children:i})}xs.propTypes={step:n.number,ok:n.bool,active:n.number,error:n.string,warning:n.bool};function gs({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:r=!1,params:l,loading:c,paramsErrTip:i,warning:d,viewMode:u="",projectId:x}){const{t:p}=X(),m=()=>{s(j=>j+1)},f=()=>{s(j=>j-1)},b=j=>j===0?i?.blockletTitle||i?.projectId||i?.blockletDescription||i?.blockletHomepage||i?.blockletSupport||i?.blockletCommunity||i?.blockletRepository:j===2?i?.blockletResource||i?.blockletDocker||i?.dockerImageName:j>=4?i?.blockletVersion||i?.note:"",h=u||rs({params:l,projectId:x,t:p})===null;return e.jsxs(a,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(nr,{activeStep:o,orientation:"vertical",children:t.map((j,v)=>{const g={},C=c||!pn({params:l,projectId:x,step:v,t:p}),D=c?"":b(v);return D&&(g.optional=e.jsx(A,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:D}),g.error=!0),e.jsxs(lr,{children:[e.jsx(ir,{icon:e.jsx(xs,{error:D,warning:v===0?d.hasWarning:!1,active:h?99:o,step:v,ok:C}),sx:{cursor:"pointer",color:D?"error.main":"inherit"},disabled:!1,onClick:()=>s(v),...g,children:e.jsx(A,{fontSize:"14px",fontWeight:"500",color:D||!C&&o>v?"error.main":"inherit",children:j.label})}),e.jsxs(cr,{children:[e.jsx(A,{fontSize:12,children:j.description}),!h&&e.jsx(a,{sx:{mb:2},children:e.jsxs("div",{children:[v<t.length-1&&e.jsx(G,{variant:"contained",onClick:m,sx:{mt:1,mr:1},disabled:D||!C,children:p("common.continue")}),v>0&&e.jsx(G,{disabled:v===0,onClick:f,sx:{mt:1,mr:1},children:p("common.back")})]})})]})]},j.label)})}),o>=t.length-1&&e.jsx(Lt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}gs.propTypes={steps:n.array.isRequired,activeStep:n.number.isRequired,setActiveStep:n.func.isRequired,params:n.object.isRequired,viewMode:n.oneOfType([n.string,n.bool]),loading:n.bool.isRequired,projectId:n.string.isRequired,hasSelectedResources:n.oneOfType([n.string,n.bool]),warning:n.object.isRequired,paramsErrTip:n.shape({projectId:n.string,blockletVersion:n.string,blockletTitle:n.string,blockletDescription:n.string,note:n.string,blockletResource:n.string,blockletHomepage:n.string,blockletSupport:n.string,blockletCommunity:n.string,blockletRepository:n.string,blockletDocker:n.object,dockerImageName:n.string}).isRequired};const mn=[".zip",".gz"],bn=1024*1024*100,fn=k.lazy(()=>No(()=>import("./index-HB59rGor.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ks({app:t,projectId:o,readOnly:s,params:r,setParams:l,setParamsErrTip:c,error:i}){const{t:d,locale:u}=X(),x=k.useRef(null),p=()=>s?!1:!o||o===F.UNOWNED_DID?(W.error(d("blocklet.publish.errorTip.noFirstDid")),!1):!0,m=`${F.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(a,{sx:{mt:3},children:[e.jsx(A,{gutterBottom:!0,children:d("blocklet.publish.resourceUpload")}),e.jsxs(Re,{direction:"row",spacing:1,sx:{alignItems:"center",flex:1,cursor:s?"default":"pointer"},children:[!!r.uploadedResource&&e.jsx(A,{component:"a",href:`${m}/params.uploadedResource`,children:r.uploadedResource}),!s&&e.jsx(G,{variant:"outlined",size:"small",onClick:()=>{p()&&x.current?.open()},children:r.uploadedResource?d("common.change"):d("common.upload")})]}),e.jsx(k.Suspense,{fallback:e.jsx(Je,{}),children:e.jsx(fn,{ref:x,locale:u,popup:!0,onUploadFinish:f=>{l({uploadedResource:f.data.filename}),c({blockletResource:""}),x.current?.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:m,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:mn,maxFileSize:bn,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&e.jsx(a,{sx:{color:"error.main",mt:1,fontSize:14},children:i})]})}ks.propTypes={app:n.object.isRequired,projectId:n.string.isRequired,readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,error:n.string.isRequired,setParamsErrTip:n.func.isRequired};function Tt({readOnly:t,params:o,setParams:s,paramsErrTip:r,setParamsErrTip:l,loading:c}){const{t:i}=X();return e.jsx(a,{className:"section",sx:{display:"flex",mt:3},children:e.jsxs(a,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:c||t,label:`Blocklet ${i("common.version")}`,placeholder:`Blocklet ${i("common.version")}`,autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:d=>{l({blockletVersion:""}),s({blockletVersion:d.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||"",slotProps:{input:{"data-cy":"blocklet-version",readOnly:t}}}),e.jsx(ne,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:c||t,variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:d=>{l({note:""}),s({note:d.target.value.slice(0,me.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3},slotProps:{input:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(He,{position:"end",children:[o?.note?.length||0," / ",me.PROJECT.MAX_NOTE_LENGTH]})}}})]})})}Tt.propTypes={readOnly:n.bool.isRequired,params:n.object.isRequired,setParams:n.func.isRequired,paramsErrTip:n.object.isRequired,setParamsErrTip:n.func.isRequired,loading:n.bool.isRequired};function js(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&js(t[o]);return t}var xn=Wr();const oe=fo(xn),gn={"-a":"--attach","-d":"--detach","-e":"--env","-h":"--hostname","-i":"--interactive","-it":"-it","-rm":"-rm","-m":"--memory","-p":"--publish","-P":"--publish-all","-l":"--label","-n":"--name","-q":"--quiet","-x":"--x-registry","-t":"--tty","-u":"--user","-v":"--volume","-w":"--workdir","-cgroupns":"--cgroupns","-cpus":"--cpus","-g":"--gpus","-ip6":"--ip6","--read-only":"--read-only","--add-host":"--add-host","--attach":"--attach","--blkio-weight":"--blkio-weight","--blkio-weight-device":"--blkio-weight-device","--cap-add":"--cap-add","--cap-drop":"--cap-drop","--cgroup-parent":"--cgroup-parent","--cidfile":"--cidfile","--cpu-period":"--cpu-period","--cpu-quota":"--cpu-quota","--cpu-rt-period":"--cpu-rt-period","--cpu-rt-runtime":"--cpu-rt-runtime","--cpu-shares":"--cpu-shares","--cpus":"--cpus","--cpuset-cpus":"--cpuset-cpus","--cpuset-mems":"--cpuset-mems","--detach":"--detach","--detach-keys":"--detach-keys","--device":"--device","--device-cgroup-rule":"--device-cgroup-rule","--device-read-bps":"--device-read-bps","--device-read-iops":"--device-read-iops","--device-write-bps":"--device-write-bps","--device-write-iops":"--device-write-iops","--disable-content-trust":"--disable-content-trust","--dns":"--dns","--dns-opt":"--dns-opt","--dns-search":"--dns-search","--domainname":"--domainname","--entrypoint":"--entrypoint","--env":"--env","--env-file":"--env-file","--expose":"--expose","--gpus":"--gpus","--group-add":"--group-add","--health-cmd":"--health-cmd","--health-interval":"--health-interval","--health-retries":"--health-retries","--health-start-period":"--health-start-period","--health-timeout":"--health-timeout","--help":"--help","--hostname":"--hostname","--init":"--init","--interactive":"--interactive","--ip":"--ip","--ip6":"--ip6","--ipc":"--ipc","--isolation":"--isolation","--kernel-memory":"--kernel-memory","--label":"--label","--label-file":"--label-file","--link":"--link","--link-local-ip":"--link-local-ip","--log-driver":"--log-driver","--log-opt":"--log-opt","--mac-address":"--mac-address","--memory":"--memory","--memory-reservation":"--memory-reservation","--memory-swap":"--memory-swap","--memory-swappiness":"--memory-swappiness","--mount":"--mount","--name":"--name","--network":"--network","--network-alias":"--network-alias","--no-healthcheck":"--no-healthcheck","--oom-kill-disable":"--oom-kill-disable","--oom-score-adj":"--oom-score-adj","--pid":"--pid","--pids-limit":"--pids-limit","--platform":"--platform","--privileged":"--privileged","--publish":"--publish","--publish-all":"--publish-all","--pull":"--pull","--restart":"--restart","--rm":"--rm","--runtime":"--runtime","--security-opt":"--security-opt","--shm-size":"--shm-size","--stop-signal":"--stop-signal","--stop-timeout":"--stop-timeout","--storage-opt":"--storage-opt","--sysctl":"--sysctl","--tmpfs":"--tmpfs","--tty":"--tty","--ulimit":"--ulimit","--user":"--user","--userns":"--userns","--uts":"--uts","--volume":"--volume","--volume-driver":"--volume-driver","--volumes-from":"--volumes-from","--workdir":"--workdir"},Ut={"--env":!0,"--publish":!0,"--volume":!0,"--attach":!0,"--quiet":!0,"--entrypoint":!0,"--workdir":!0,"--cidfile":!0,"--detach-keys":!0,"--disable-content-trust":!0,"--domainname":!0,"--expose":!0,"--ip":!0,"--link-local-ip":!0,"--platform":!0},kn={"--volume":!0,"--publish":!0},jn=new Set(["--publish","--volume"]),ys=t=>{const[o]=t.split(":");return o?.startsWith("/")||o?.startsWith("./")||o?.startsWith("../")||o?.startsWith("~")||o?.startsWith("$BLOCKLET")};function yn(t){return t.map(o=>{if(o.key!=="--volume"||o.value.startsWith("$BLOCKLET_APP_DIR/")||o.value.startsWith("$BLOCKLET_DATA_DIR/"))return o;const[s,...r]=o.value.split(":");if(!s||!ys(o.value))return o;const l=s.startsWith("/")?`$BLOCKLET_DATA_DIR${s}`:`$BLOCKLET_DATA_DIR/${s}`;return{...o,value:[l,...r].join(":")}})}function wn(t){let o=!0;return t.find(r=>r.key==="--publish"&&r.type==="web")?t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"docker":r.type};return o=r.type==="web",l}return r}):t.map(r=>{if(r.key==="--publish"){const l={...r,type:o?"web":"docker"};return o=!1,l}return r})}function po(t){if(!t)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};if(t=t.trim(),t.startsWith("$ docker run")&&(t=t.replace("$ docker run","docker run")),!t.startsWith("docker run"))return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const s=t.replace(/\\\n/g,"").replace(/\n/g," ").trim().match(/(?:[^\s"']+|'[^']*'|"[^"]*")+/g);if(!s)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const r=[],l=[];let c=0,i="",d="";const u=[];for(;c<s.length;){const p=s[c];if(!p){c++;continue}if(p==="docker"||p==="run"){c++;continue}if((p==="-e"||p==="--env")&&c+1<s.length){const m=s[c+1]||"",[f,...b]=m.split("=");if(f){const h=b.join("=").replace(/^['"]|['"]$/g,"");l.push({key:f,value:h})}c+=2;continue}if(p.startsWith("-")&&u.length===0){const m=p.indexOf("=");let f=p,b=null;m!==-1&&(f=p.substring(0,m),b=p.substring(m+1).replace(/^['"]|['"]$/g,""));const h=gn[f];if(!h){c+=2;continue}if(h==="--publish"){let j="";if(b)j=b,r.push({key:h,value:j});else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){j=(s[c+1]||"").replace(/^['"]|['"]$/g,""),r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}c++;continue}if(b!==null){r.push({key:h,value:b}),c++;continue}else if(c+1<s.length&&!(s[c+1]||"").startsWith("-")){const j=(s[c+1]||"").replace(/^['"]|['"]$/g,"");r.push({key:h,value:j}),c+=2;continue}else{r.push({key:h,value:"true"}),c++;continue}}u.push(p),c++}i=u[0]||"",d=u.slice(1).join(" ");const x=[];for(const p of r)p.name="",p.path="",p.prefix="",p.protocol="",p.proxyBehavior="service",p.type="docker",!(jn.has(p.key)&&p.value==="true")&&x.push(p);for(const p of l)p.custom="",p.description="",p.secure=!1,p.shared=!1,p.required=!1;return{dockerArgs:wn(yn(x)),dockerEnvs:l,dockerImage:i,dockerCommand:d}}function vn({dockerArgs:t,dockerEnvs:o,dockerImage:s,dockerCommand:r}){if(t.length===0&&o.length===0&&!s)return"";const l=["docker run \\"],c=new Set(["--publish","--volume","--expose","--device","--mount","--label","--cap-add","--cap-drop","--add-host","--dns","--network-alias","--sysctl","--ulimit","--network"]);for(const i of t){const{key:d,value:u}=i;if(c.has(d))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}else if(!l.some(x=>x.startsWith(` ${d}`)))if(u==="true")l.push(` ${d} \\`);else{const x=/[\s"']/g.test(u)?`"${u}"`:u;l.push(` ${d} ${x} \\`)}}for(const i of o){const{key:d,value:u}=i,x=/["']/g.test(u)?u:`"${u}"`;l.push(` -e ${d}=${x} \\`)}return s&&l.push(` ${s} \\`),r&&l.push(` ${r} \\`),l[l.length-1]?.endsWith(" \\")&&(l[l.length-1]=(l[l.length-1]||"").slice(0,-2)),l.join(`
194
194
  `)}const ws={"--volume":t=>{const[o]=t.split(":");return o?ys(t)&&!t.startsWith("$BLOCKLET_APP_DIR/")&&!t.startsWith("$BLOCKLET_DATA_DIR/")?"Volume must start with $BLOCKLET_APP_DIR or $BLOCKLET_DATA_DIR":t.indexOf("..")>-1?'Volume cannot contain ".."':"":"Volume must start with key:value"}},Qe=t=>t.replace(/^[-]+/,"").replace(/-([a-z])/g,(r,l)=>l.toUpperCase()),Cn=t=>`--${t.replace(/([A-Z])/g,"-$1").toLowerCase()}`,Rn=[" -- ","~","&","|",">","<","{","}","[","]",";","$","!","*","%","&&","||",","],Sn=["rm ","sudo "];function vs(t){if(t==="")return;if(/(\n|\\n|\\\n|\t|\\t|\\\t)/.test(t))throw new Error("Docker CMD is invalid");const s=t.toLocaleLowerCase();if(Sn.some(l=>s.indexOf(l)!==-1))throw new Error("Docker CMD is invalid");if(Rn.some(l=>t.indexOf(l)!==-1))throw new Error("Docker CMD is invalid");if(!/^(?:(?:[a-zA-Z0-9\-_.\/:=\s]+)|(?:\@{1,2}[a-zA-Z_][a-zA-Z0-9_]*))+$/.test(t))throw new Error("Docker CMD is invalid")}const Tn=Array.from(new Set(Object.keys(Ut).map(Qe))),Dn=["publish","volume"];oe.object({workdir:oe.string().trim().optional(),image:oe.string().trim().regex(/^[^\s]+$/).optional(),shell:oe.string().trim().optional(),volumes:oe.array().items(oe.string().trim()).optional(),script:oe.string().trim().optional(),installNodeModules:oe.boolean().optional(),skipWrapDockerfile:oe.boolean().optional(),command:oe.string().allow("").default("").optional().custom((t,o)=>{try{return vs(t),t}catch(s){return o.error("any.invalid",{message:s.message})}},"Docker CMD validation"),runBaseScript:oe.boolean().optional(),...Tn.reduce((t,o)=>{const s=ws[Cn(o)];return Dn.includes(o)?(t[o]=oe.array().items(oe.string().trim()).optional(),s?t[o]=oe.array().items(oe.string().trim().custom((r,l)=>{const c=s(r);return c?l.message(c):r})).optional():t[o]=oe.array().items(oe.string().trim()).optional(),t):(s?t[o]=oe.string().trim().custom((r,l)=>{const c=s(r);return c?l.message(c):r}).optional():t[o]=oe.string().trim().optional(),t)},{})}).optional();function Dt({index:t,item:o,dockerParams:s,setDockerParams:r,dataKey:l,t:c,readOnly:i}){const d=o?.value||"",[u,x]=k.useState(!1),p=()=>{s[l]?.splice(t,1),r({...s,[l]:[...s[l]]})},m=(P,L)=>{s[l]?.[t]&&(L?(s[l][t].custom=s[l][t].value,s[l][t].value=`$${Qe(o.key)}`):(s[l][t].value=s[l][t].custom||"",s[l][t].custom="")),r({...s,[l]:[...s[l]]})},f=(P,L)=>{const w=s[l][t]?.value||"";s[l][t]={...s[l][t],secure:L,value:L&&w===me.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},r({...s,[l]:[...s[l]]})},b=(P,L)=>{s[l][t]={...s[l][t],shared:L},r({...s,[l]:[...s[l]]})},h=(P,L)=>{const w=s[l][t]?.value||"";s[l][t]={...s[l][t],required:L,value:L&&w===me.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},r({...s,[l]:[...s[l]]})},j=(P,L)=>{s[l][t]={...s[l][t],value:L?me.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...s,[l]:[...s[l]]})},v=P=>{s[l][t]={...s[l][t],description:P.target.value},r({...s,[l]:[...s[l]]})},g=P=>{const L=P.target.value==="web"?"web":"docker";L==="web"&&s.dockerArgs.forEach(Y=>{Y.type="docker"});const S=`/${s.dockerImage.replace(/\W/g,"-")}-${t}`;s.dockerArgs[t]={...s.dockerArgs[t],type:L,path:L==="docker"?S:"/",protocol:"http",prefix:L==="docker"?S:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...s,dockerArgs:[...s.dockerArgs]})},C=P=>{s.dockerArgs[t]={...s.dockerArgs[t],proxyBehavior:P.target.value==="direct"?"direct":"service"},r({...s,dockerArgs:[...s.dockerArgs]})},D=P=>{const L=P.target.value;s[l][t]={...s[l][t],prefix:L,path:L==="*"?"/":L},r({...s,[l]:[...s[l]]})},R=P=>{s[l]?.[t]&&(s[l][t].value=P.target.value),r({...s,[l]:[...s[l]]})},y=d===`$${Qe(o.key)}`||o.custom,T=l==="dockerArgs"&&!Ut[o.key],O=kn[o.key],N=l==="dockerEnvs",z=o.key==="--publish";let K=o.key;return z&&o.type==="web"?K="--publish (Web)":N&&(K=`--env ${o.key}`),e.jsxs(a,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(a,{sx:{width:250},children:e.jsx(A,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:K})}),e.jsxs(a,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(ne,{disabled:i||y||T||o.value===me.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:y?`$${Qe(o.key)}`:d,sx:{flex:1},error:T,onChange:R,slotProps:{input:{endAdornment:e.jsxs(He,{position:"end",sx:{zoom:.9},children:[(!(O||T)||N||z)&&e.jsx(ce,{onClick:()=>x(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!i&&e.jsx(ce,{onClick:p,color:T?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})}}}),T&&e.jsx(A,{variant:"caption",color:"error",children:c("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(A,{variant:"caption",sx:{color:"text.secondary"},children:c("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&ws[o.key](d)&&e.jsx(A,{variant:"caption",color:"error",children:c("blocklet.publish.docker.volumeTips")})]}),u&&e.jsx(ct,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:c(N?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>x(!1),children:e.jsxs(a,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[O||T||N?null:e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.needCustomInput")}),e.jsx(Le,{disabled:i,checked:y,onChange:m,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.shared")}),e.jsx(Le,{disabled:i,checked:o.shared,onChange:b,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.required")}),e.jsx(Le,{disabled:i,checked:o.required,onChange:h,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.secure")}),e.jsx(Le,{disabled:i,checked:o.secure,onChange:f,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{children:c("blocklet.publish.docker.autoGenerated")}),e.jsx(Le,{disabled:i,checked:o.value===me.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:j,sx:{zoom:.9}})]}),N&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:c("blocklet.publish.docker.description")}),e.jsx(ne,{disabled:i,value:o.description,onChange:v,sx:{flex:1},label:c("blocklet.publish.docker.description")})]}),z&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:c("blocklet.publish.docker.portType")}),e.jsxs(vt,{value:o.type||"docker",onChange:g,children:[e.jsx(be,{value:"docker",children:"Docker"}),e.jsx(be,{value:"web",children:"Web"})]})]}),z&&o.type==="web"&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:c("blocklet.publish.docker.proxyBehavior")}),e.jsxs(vt,{value:o.proxyBehavior||"service",onChange:C,children:[e.jsx(be,{value:"service",children:c("blocklet.publish.docker.serviceProxy")}),e.jsx(be,{value:"direct",children:c("blocklet.publish.docker.directProxy")})]})]}),z&&o.type==="web"&&e.jsxs(a,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(A,{sx:{flex:1},children:c("blocklet.publish.docker.prefix")}),e.jsx(ne,{disabled:i,value:o.prefix,onChange:D,sx:{flex:1},label:c("blocklet.publish.docker.prefix")})]})]})})]})}Dt.propTypes={dockerParams:n.object.isRequired,setDockerParams:n.func.isRequired,dataKey:n.string.isRequired,item:n.object.isRequired,t:n.func.isRequired,readOnly:n.bool.isRequired,index:n.number.isRequired};const In=`
195
195
  docker run --name postgrest
196
196
  -p 3000:3000
@@ -1,4 +1,4 @@
1
- import{r as b}from"./vendor-react-Dvs43sk9.js";import{j as e,y as V,x as G,bb as X,M as Q,ak as d,W as u,a6 as ve,cf as ke,b1 as Z,z as U,b6 as we,a5 as Te,at as P,T as N,cg as Ae,ch as Ke,aX as Re}from"./vendor-mui-core-Bq_sfmbr.js";import{T as D,a6 as B,D as F,G as De,F as ie,N as H,H as Se,ai as Ie,C as Be,aj as $e,ac as Ee,O as Ne}from"./vendor-ux-DnuP69h2.js";import{f as _e}from"./index-DBs9Ljax.js";import{B as ae,o as re,l as ce}from"./index-BI5OO07e.js";import{r as le}from"./passport-item-DgPDBerJ.js";import{c as L,Z as I,p as Pe,aE as We,a8 as Le,K as z,f as ze}from"./index-lscqrS5Z.js";import{u as W}from"./team-DXp2kdu1.js";import{T as de}from"./index-CXDyHIY4.js";import{C as pe}from"./confirm-C969ZG_F.js";import{R as qe,C as _}from"./vendor-utils-DQK0pEML.js";import{u as Me}from"./session-sOrWgMPW.js";import{C as O}from"./click-to-copy-CH3FJWJo.js";import{f as Ue}from"./index-BojVbZw0.js";import{D as Fe}from"./delete-confirm-CGjwwcqY.js";import{P as He}from"./permission-D42aYR9e.js";import{B as Oe}from"./bundle-avatar-D7OAJcb0.js";import{W as Ve}from"./did-address-4KKI5Z_V.js";import{A as Ge}from"./actions-Cqn-jwqV.js";import{u as Xe}from"./use-mobile-D2h0sedv.js";import{T as oe}from"./table-tips-1QxzlCjR.js";import{s as Qe}from"./vendor-hooks-DLNZ8kxG.js";import"./lottie-web-4koyQiv_.js";import"./util-RS7QU94f.js";import"./base32-DyHKL8vT.js";import"./vendor-arcblock-CzdgnaKl.js";import"./isURL-Bx60otHf.js";import"./use-app-logo-mu7QCMiy.js";import"./arrow-down.svg-Gif3Qlbk.js";import"./vendor-mui-x-BbwECMfi.js";import"./AdapterDayjs-CKA_54eZ.js";function J({value:s}){const{t,locale:n}=D(),i=new Date;return new Date(s)<i?e.jsxs("span",{style:{color:"red"},children:[e.jsx(B,{value:s,locale:n}),`${t("setting.accessKey.expired",{time:""})}`]}):e.jsx(B,{mode:"daysLeft",value:s,locale:n,type:"all"})}J.propTypes={value:u.string.isRequired};function Y({value:s,onChange:t,...n}){const{t:i}=D(),o=b.useMemo(()=>[{value:"signature",title:i("setting.accessKey.signature"),description:i("setting.accessKey.signatureDesc")},{value:"simple",title:i("setting.accessKey.simple"),description:i("setting.accessKey.simpleDesc")}],[i]);return e.jsxs(V,{style:{width:"100%"},variant:"outlined",...n,children:[e.jsx(G,{children:i("setting.accessKey.authType")}),e.jsx(X,{value:s,onChange:t,fullWidth:!0,label:i("setting.accessKey.authType"),children:o.map(c=>e.jsx(Q,{value:c.value,children:e.jsxs(d,{children:[e.jsx("span",{children:c.title}),e.jsx(d,{sx:{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal"},children:c.description})]})},c.value))})]})}Y.propTypes={value:u.string.isRequired,onChange:u.func.isRequired};const ee=()=>{const s=L.RBAC_CONFIG.roles.filter(o=>o.passport),{inService:t}=I(),{roles:n}=W(),i=[...s,...t?n:[]];return qe(i,"name").filter(o=>o.name!==L.ROLES.OWNER)};function me(){const{session:s}=Me(),t=ee();return b.useMemo(()=>{if(!s?.user?.role)return[];if(["owner","admin"].includes(s.user.role))return t;const i=t.filter(c=>c.name==="guest");return[...t.filter(c=>c.name!=="guest").filter(c=>s.user.passports.find(g=>g.role===c.name)),...i]},[t,s?.user?.passports,s?.user?.role])}function ue({onCreate:s=()=>{},remark:t=""}){const{api:n}=I(),{teamDid:i}=W(),{t:o}=D(),[c,g]=b.useState(!1),[x,k]=b.useState(null),p=me(),K=()=>{g(!1),k(null)},h=async l=>{const{remark:C,passport:y,authType:a}=l;g(!0);const w=await n.createAccessKey({input:{teamDid:i,remark:C.trim(),passport:y,expireAt:l.expireAt?new Date(l.expireAt).getTime():null,authType:a}}),{data:R}=w;s(R),k(null),g(!1)},m={title:`${o("common.create")} ${o("accessKey")}`,description:(l,C,y)=>e.jsxs(Z,{sx:{gap:3},children:[e.jsx(U,{label:o("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,margin:"dense",value:l.remark,onChange:a=>{C({...l,remark:a.target.value,__disableConfirm:!l.passport||!a.target.value.trim()}),a.target.value.trim()?y(""):y(o("setting.accessKey.remarkInvalid"))},slotProps:{htmlInput:{"data-cy":"remark-input"}}}),e.jsxs(V,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:o("setting.accessKey.passport")}),e.jsx(X,{"data-cy":"create-access-key-select-passport",value:l.passport,onChange:a=>{const w=a.target.value;y(null),C({...l,passport:w,__disableConfirm:!l.remark||!w})},fullWidth:!0,label:o("setting.accessKey.passport"),disabled:c,children:p.map(a=>e.jsx(Q,{value:a.name,"data-cy":`create-access-key-passport-option-${a.name}`,children:e.jsxs(d,{children:[e.jsx("span",{children:a.title||a.name}),e.jsx(d,{sx:{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify"},children:a.description})]})},a.name))})]}),e.jsx(Y,{value:l.authType,onChange:a=>{C({...l,authType:a.target.value})}}),e.jsx(de,{placeholder:o("setting.accessKey.expireTime"),value:l.expireAt,onChange:a=>{C({...l,expireAt:a,__disableConfirm:!l.passport||!l.remark||!a})}})]}),confirm:o("common.confirm"),cancel:o("common.cancel"),color:"primary",params:{remark:t,authType:"signature",__disableConfirm:!t.trim()},onConfirm:h,onCancel:K};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>k(m),className:"rule-action",children:[c?e.jsx(ve,{size:16}):e.jsx(ke,{style:{fontSize:16}}),o("common.create")]}),x&&e.jsx(pe,{title:x.title,description:x.description,confirm:x.confirm,color:x.color,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}ue.propTypes={remark:u.string,onCreate:u.func};function xe({onConfirm:s=()=>{},accessKeyId:t,accessKeySecret:n,hideSecret:i=!0}){const{t:o}=b.useContext(De),[c,g]=b.useState(!1),[x,k]=b.useState(()=>i),p=I(),K=()=>{k(!x)},h=y=>{g(y.target.checked)},m=_(window.location.origin,p?.info?.routing?.adminPath),l=b.useMemo(()=>i?`const Client = require('@blocklet/server-js');
1
+ import{r as b}from"./vendor-react-Dvs43sk9.js";import{j as e,y as V,x as G,bb as X,M as Q,ak as d,W as u,a6 as ve,cf as ke,b1 as Z,z as U,b6 as we,a5 as Te,at as P,T as N,cg as Ae,ch as Ke,aX as Re}from"./vendor-mui-core-Bq_sfmbr.js";import{T as D,a6 as B,D as F,G as De,F as ie,N as H,H as Se,ai as Ie,C as Be,aj as $e,ac as Ee,O as Ne}from"./vendor-ux-DnuP69h2.js";import{f as _e}from"./index-DBs9Ljax.js";import{B as ae,o as re,l as ce}from"./index-BWhAMS1Q.js";import{r as le}from"./passport-item-CwFxbGyQ.js";import{c as L,Z as I,p as Pe,aE as We,a8 as Le,K as z,f as ze}from"./index-B2EmOTH7.js";import{u as W}from"./team-B8B1ZhIQ.js";import{T as de}from"./index-C1pPU9qq.js";import{C as pe}from"./confirm-DV4YCyEc.js";import{R as qe,C as _}from"./vendor-utils-DQK0pEML.js";import{u as Me}from"./session-DGj-_oAZ.js";import{C as O}from"./click-to-copy-CH3FJWJo.js";import{f as Ue}from"./index-BojVbZw0.js";import{D as Fe}from"./delete-confirm-ad8t0UXs.js";import{P as He}from"./permission-DwyNIiFn.js";import{B as Oe}from"./bundle-avatar-CfoJFi5J.js";import{W as Ve}from"./did-address-4KKI5Z_V.js";import{A as Ge}from"./actions-Cqn-jwqV.js";import{u as Xe}from"./use-mobile-D2h0sedv.js";import{T as oe}from"./table-tips-1QxzlCjR.js";import{s as Qe}from"./vendor-hooks-DLNZ8kxG.js";import"./lottie-web-4koyQiv_.js";import"./util-BkJCSJXb.js";import"./base32-2BTO5zmk.js";import"./vendor-arcblock-CzdgnaKl.js";import"./isURL-DviHJNBO.js";import"./use-app-logo-wJojGoX8.js";import"./arrow-down.svg-CGgLriRk.js";import"./vendor-mui-x-BbwECMfi.js";import"./AdapterDayjs-CKA_54eZ.js";function J({value:s}){const{t,locale:n}=D(),i=new Date;return new Date(s)<i?e.jsxs("span",{style:{color:"red"},children:[e.jsx(B,{value:s,locale:n}),`${t("setting.accessKey.expired",{time:""})}`]}):e.jsx(B,{mode:"daysLeft",value:s,locale:n,type:"all"})}J.propTypes={value:u.string.isRequired};function Y({value:s,onChange:t,...n}){const{t:i}=D(),o=b.useMemo(()=>[{value:"signature",title:i("setting.accessKey.signature"),description:i("setting.accessKey.signatureDesc")},{value:"simple",title:i("setting.accessKey.simple"),description:i("setting.accessKey.simpleDesc")}],[i]);return e.jsxs(V,{style:{width:"100%"},variant:"outlined",...n,children:[e.jsx(G,{children:i("setting.accessKey.authType")}),e.jsx(X,{value:s,onChange:t,fullWidth:!0,label:i("setting.accessKey.authType"),children:o.map(c=>e.jsx(Q,{value:c.value,children:e.jsxs(d,{children:[e.jsx("span",{children:c.title}),e.jsx(d,{sx:{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal"},children:c.description})]})},c.value))})]})}Y.propTypes={value:u.string.isRequired,onChange:u.func.isRequired};const ee=()=>{const s=L.RBAC_CONFIG.roles.filter(o=>o.passport),{inService:t}=I(),{roles:n}=W(),i=[...s,...t?n:[]];return qe(i,"name").filter(o=>o.name!==L.ROLES.OWNER)};function me(){const{session:s}=Me(),t=ee();return b.useMemo(()=>{if(!s?.user?.role)return[];if(["owner","admin"].includes(s.user.role))return t;const i=t.filter(c=>c.name==="guest");return[...t.filter(c=>c.name!=="guest").filter(c=>s.user.passports.find(g=>g.role===c.name)),...i]},[t,s?.user?.passports,s?.user?.role])}function ue({onCreate:s=()=>{},remark:t=""}){const{api:n}=I(),{teamDid:i}=W(),{t:o}=D(),[c,g]=b.useState(!1),[x,k]=b.useState(null),p=me(),K=()=>{g(!1),k(null)},h=async l=>{const{remark:C,passport:y,authType:a}=l;g(!0);const w=await n.createAccessKey({input:{teamDid:i,remark:C.trim(),passport:y,expireAt:l.expireAt?new Date(l.expireAt).getTime():null,authType:a}}),{data:R}=w;s(R),k(null),g(!1)},m={title:`${o("common.create")} ${o("accessKey")}`,description:(l,C,y)=>e.jsxs(Z,{sx:{gap:3},children:[e.jsx(U,{label:o("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,margin:"dense",value:l.remark,onChange:a=>{C({...l,remark:a.target.value,__disableConfirm:!l.passport||!a.target.value.trim()}),a.target.value.trim()?y(""):y(o("setting.accessKey.remarkInvalid"))},slotProps:{htmlInput:{"data-cy":"remark-input"}}}),e.jsxs(V,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:o("setting.accessKey.passport")}),e.jsx(X,{"data-cy":"create-access-key-select-passport",value:l.passport,onChange:a=>{const w=a.target.value;y(null),C({...l,passport:w,__disableConfirm:!l.remark||!w})},fullWidth:!0,label:o("setting.accessKey.passport"),disabled:c,children:p.map(a=>e.jsx(Q,{value:a.name,"data-cy":`create-access-key-passport-option-${a.name}`,children:e.jsxs(d,{children:[e.jsx("span",{children:a.title||a.name}),e.jsx(d,{sx:{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify"},children:a.description})]})},a.name))})]}),e.jsx(Y,{value:l.authType,onChange:a=>{C({...l,authType:a.target.value})}}),e.jsx(de,{placeholder:o("setting.accessKey.expireTime"),value:l.expireAt,onChange:a=>{C({...l,expireAt:a,__disableConfirm:!l.passport||!l.remark||!a})}})]}),confirm:o("common.confirm"),cancel:o("common.cancel"),color:"primary",params:{remark:t,authType:"signature",__disableConfirm:!t.trim()},onConfirm:h,onCancel:K};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>k(m),className:"rule-action",children:[c?e.jsx(ve,{size:16}):e.jsx(ke,{style:{fontSize:16}}),o("common.create")]}),x&&e.jsx(pe,{title:x.title,description:x.description,confirm:x.confirm,color:x.color,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}ue.propTypes={remark:u.string,onCreate:u.func};function xe({onConfirm:s=()=>{},accessKeyId:t,accessKeySecret:n,hideSecret:i=!0}){const{t:o}=b.useContext(De),[c,g]=b.useState(!1),[x,k]=b.useState(()=>i),p=I(),K=()=>{k(!x)},h=y=>{g(y.target.checked)},m=_(window.location.origin,p?.info?.routing?.adminPath),l=b.useMemo(()=>i?`const Client = require('@blocklet/server-js');
2
2
  const ensureServerEndpoint = require('@abtnode/util/lib/ensure-server-endpoint');
3
3
  const { joinURL } = require('ufo');
4
4
 
@@ -1,4 +1,4 @@
1
- import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k as re}from"./vendor-hooks-DLNZ8kxG.js";import{j as e,ak as g,at as q,b1 as ee,a6 as M,aX as _e,am as Y,cs as ft,U as xt,T as E,a3 as ht,W as T,z as $,M as ae,I as W,cC as $e,cf as me,A as gt,x as Oe,c2 as We,c3 as X,bv as qe,F as He,bC as yt,b6 as jt,a5 as vt,J as Ct,Q as bt,bb as St,s as Tt}from"./vendor-mui-core-Bq_sfmbr.js";import{T as F,F as H,L as wt,ac as fe,a6 as le,H as R,D as L,O as xe,aa as Ue,al as Dt,E as Ie,a9 as It,ai as Pt}from"./vendor-ux-DnuP69h2.js";import{Z as k,p as Rt,ap as Ge,c as U,B as J,a8 as kt,aK as At,f as Ft,X as Nt,ar as se,be as Ve,bf as Lt,bi as Ke}from"./index-lscqrS5Z.js";import{W as he}from"./did-address-4KKI5Z_V.js";import{u as _}from"./team-DXp2kdu1.js";import{r as ge,a as ye,b as je,c as Ye,d as ne,e as Bt,u as zt,f as Et}from"./passport-item-DgPDBerJ.js";import{p as Ze}from"./util-RS7QU94f.js";import{u as Mt}from"./use-mobile-D2h0sedv.js";import{v as Q}from"./index-C4j3gH0o.js";import{w as G,P as Je}from"./permission-D42aYR9e.js";import{C as _t}from"./Google-DzJt8j2p.js";import{A as $t}from"./vendor-arcblock-CzdgnaKl.js";import{G as Z,$ as Ot,H as Wt}from"./vendor-utils-DQK0pEML.js";import{e as oe}from"./edit.svg-DycWG9v3.js";import{C as ve}from"./confirm-C969ZG_F.js";import{L as Qe}from"./list-header-DELs3iEf.js";import{f as te}from"./index-DBs9Ljax.js";import{u as qt}from"./useSetState-DFuQZPPV.js";import{C as Ht}from"./lock.svg-COUP8tyO.js";import"./lottie-web-4koyQiv_.js";import"./session-sOrWgMPW.js";import"./isURL-Bx60otHf.js";import"./use-app-logo-mu7QCMiy.js";import"./index-BI5OO07e.js";import"./base32-DyHKL8vT.js";import"./cloneDeep-sSKmkjV3.js";const ie=u=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...u},C.createElement("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})),Pe="info";function Xe({createPassportSvg:u,passport:o,onCancel:i,onSwitchPassport:p=()=>{}}){const{t:m}=F(),l=mt({tab:Pe}),h={info:{label:m("common.basicInfo"),value:Pe,component:()=>e.jsx(et,{passport:o,createPassportSvg:u})},logs:{label:m("common.logs"),value:"logs",component:()=>e.jsx(rt,{passport:o})},related:{label:m("team.passport.related"),value:"related",component:()=>e.jsx(at,{passport:o,onSwitchPassport:p})}},a=Object.values(h).map(({label:r,value:t})=>({label:r,value:t})).filter(r=>r.value==="related"?o.parentDid:!0),f=h[l.tab]||h.info,s=r=>{l.tab=r};return e.jsx(H,{title:m("common.passport"),onClose:i,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ut,{children:[e.jsx(g,{className:"tabs",children:e.jsx(wt,{tabs:a,current:l.tab,onChange:s,scrollButtons:"auto"})}),e.jsx(g,{className:"body",children:e.jsx(f.component,{})})]})})}Xe.propTypes={createPassportSvg:T.func.isRequired,passport:T.object.isRequired,onCancel:T.func.isRequired,onSwitchPassport:T.func};const Ut=q(g)`
1
+ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k as re}from"./vendor-hooks-DLNZ8kxG.js";import{j as e,ak as g,at as q,b1 as ee,a6 as M,aX as _e,am as Y,cs as ft,U as xt,T as E,a3 as ht,W as T,z as $,M as ae,I as W,cC as $e,cf as me,A as gt,x as Oe,c2 as We,c3 as X,bv as qe,F as He,bC as yt,b6 as jt,a5 as vt,J as Ct,Q as bt,bb as St,s as Tt}from"./vendor-mui-core-Bq_sfmbr.js";import{T as F,F as H,L as wt,ac as fe,a6 as le,H as R,D as L,O as xe,aa as Ue,al as Dt,E as Ie,a9 as It,ai as Pt}from"./vendor-ux-DnuP69h2.js";import{Z as k,p as Rt,ap as Ge,c as U,B as J,a8 as kt,aK as At,f as Ft,X as Nt,ar as se,be as Ve,bf as Lt,bi as Ke}from"./index-B2EmOTH7.js";import{W as he}from"./did-address-4KKI5Z_V.js";import{u as _}from"./team-B8B1ZhIQ.js";import{r as ge,a as ye,b as je,c as Ye,d as ne,e as Bt,u as zt,f as Et}from"./passport-item-CwFxbGyQ.js";import{p as Ze}from"./util-BkJCSJXb.js";import{u as Mt}from"./use-mobile-D2h0sedv.js";import{v as Q}from"./index-C4j3gH0o.js";import{w as G,P as Je}from"./permission-DwyNIiFn.js";import{C as _t}from"./Google-DzJt8j2p.js";import{A as $t}from"./vendor-arcblock-CzdgnaKl.js";import{G as Z,$ as Ot,H as Wt}from"./vendor-utils-DQK0pEML.js";import{e as oe}from"./edit.svg-DycWG9v3.js";import{C as ve}from"./confirm-DV4YCyEc.js";import{L as Qe}from"./list-header-DELs3iEf.js";import{f as te}from"./index-DBs9Ljax.js";import{u as qt}from"./useSetState-DFuQZPPV.js";import{C as Ht}from"./lock.svg-COUP8tyO.js";import"./lottie-web-4koyQiv_.js";import"./session-DGj-_oAZ.js";import"./isURL-DviHJNBO.js";import"./use-app-logo-wJojGoX8.js";import"./index-BWhAMS1Q.js";import"./base32-2BTO5zmk.js";import"./cloneDeep-sSKmkjV3.js";const ie=u=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...u},C.createElement("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})),Pe="info";function Xe({createPassportSvg:u,passport:o,onCancel:i,onSwitchPassport:p=()=>{}}){const{t:m}=F(),l=mt({tab:Pe}),h={info:{label:m("common.basicInfo"),value:Pe,component:()=>e.jsx(et,{passport:o,createPassportSvg:u})},logs:{label:m("common.logs"),value:"logs",component:()=>e.jsx(rt,{passport:o})},related:{label:m("team.passport.related"),value:"related",component:()=>e.jsx(at,{passport:o,onSwitchPassport:p})}},a=Object.values(h).map(({label:r,value:t})=>({label:r,value:t})).filter(r=>r.value==="related"?o.parentDid:!0),f=h[l.tab]||h.info,s=r=>{l.tab=r};return e.jsx(H,{title:m("common.passport"),onClose:i,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ut,{children:[e.jsx(g,{className:"tabs",children:e.jsx(wt,{tabs:a,current:l.tab,onChange:s,scrollButtons:"auto"})}),e.jsx(g,{className:"body",children:e.jsx(f.component,{})})]})})}Xe.propTypes={createPassportSvg:T.func.isRequired,passport:T.object.isRequired,onCancel:T.func.isRequired,onSwitchPassport:T.func};const Ut=q(g)`
2
2
  margin-top: -16px;
3
3
 
4
4
  .tabs {
@@ -1,4 +1,4 @@
1
- import{j as e,y as Pt,bb as Re,M as ae,ak as f,Q as q,W as u,J as xe,c0 as Rt,I as D,aN as It,T,aj as Tt,b5 as Be,P as We,b6 as J,a5 as Oe,z as Ze,A as Je,ci as At,bf as Mt,U as Ce,d5 as zt,d6 as Et,at as te,d7 as Lt,a6 as V,n as le,D as Bt,d8 as Wt,ar as Ne,b1 as Ie,d9 as Ot,aX as Nt,ai as Dt,am as X,bp as $t,bq as ve,a$ as Ut,cS as Ft}from"./vendor-mui-core-Bq_sfmbr.js";import{r as b,a as _t,u as qt,j as Ht}from"./vendor-react-Dvs43sk9.js";import{t as Xe,Y as Gt,a6 as Kt,R as De,D as Yt,C as ce,n as Y,A as Vt}from"./vendor-utils-DQK0pEML.js";import{a as Qt,G as Zt,bw as Jt,c as Te,d as Xt,Y as er,bx as tr,aZ as Ae,W as fe,bh as rr,by as nr,a5 as or,a$ as sr,a6 as ir,bz as ar}from"./index-lscqrS5Z.js";import{a as I,h as et,k as re,g as H,b as E,j as lr}from"./vendor-hooks-DLNZ8kxG.js";import{l as tt}from"./arrow-down.svg-Gif3Qlbk.js";import{G as Me,ab as N,T as O,aM as cr,O as rt,aN as dr,H as _,aO as ur,aP as pr,aQ as $e,J as xr,D as nt,I as ze,aR as fr,aS as M,a2 as hr,a1 as gr,$ as ot,aT as mr,aU as br,a0 as yr,C as de,a6 as Ue,ac as vr,aj as Fe}from"./vendor-ux-DnuP69h2.js";import{N as wr}from"./list-oKgOsN2z.js";import{d as jr}from"./search-4YYphs0l.js";import{B as _e}from"./bundle-avatar-D7OAJcb0.js";import{h as qe,T as Cr}from"./team-DXp2kdu1.js";import{b as Sr,d as kr,a as Pr,c as Rr,e as Ir,f as Tr,_ as Ar}from"./user-center-CU9t4WoO.js";import{N as st,U as it}from"./index-jhEes964.js";import{u as Q}from"./use-mobile-C8UweHoJ.js";import Mr from"./index-nwknV05O.js";import{f as ee}from"./index-DBs9Ljax.js";import{u as Se}from"./index-BjLb1HBo.js";import{U as we}from"./user-sessions-BcCJ6YmQ.js";import zr from"./index-DSFB8WaL.js";import{o as Er}from"./vendor-arcblock-CzdgnaKl.js";import{c as Lr,b as ue,a as Br,S as Wr}from"./index-DFGqK9ZQ.js";import"./index-C4j3gH0o.js";import"./index-BojVbZw0.js";import{U as Or}from"./user-follower-CZumNR6l.js";import"./lottie-web-4koyQiv_.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-BI5OO07e.js";import"./util-RS7QU94f.js";import"./base32-DyHKL8vT.js";import"./session-sOrWgMPW.js";import"./isURL-Bx60otHf.js";import"./use-app-logo-mu7QCMiy.js";import"./index-CfB_bXYI.js";import"./api-sewNv0AE.js";import"./table-tips-1QxzlCjR.js";import"./use-mobile-D2h0sedv.js";import"./passport-item-DgPDBerJ.js";import"./did-address-4KKI5Z_V.js";import"./index-CXDyHIY4.js";import"./vendor-mui-x-BbwECMfi.js";import"./AdapterDayjs-CKA_54eZ.js";import"./confirm-C969ZG_F.js";import"./click-to-copy-CH3FJWJo.js";import"./delete-confirm-CGjwwcqY.js";import"./permission-D42aYR9e.js";import"./actions-Cqn-jwqV.js";import"./index-DRYJ0xIl.js";function Nr(){let t=new Map;function o({root:s,rootMargin:n,threshold:a}){let i=t.get(s);i||(i=new Map,t.set(s,i));let l=JSON.stringify({rootMargin:n,threshold:a}),p=i.get(l);if(!p){let r=new Map;p={observer:new IntersectionObserver(x=>{x.forEach(m=>{r.get(m.target)?.(m)})},{root:s,rootMargin:n,threshold:a}),entryCallbacks:r},i.set(l,p)}return{observe:(r,x)=>{p.entryCallbacks.set(r,x),p.observer.observe(r)},unobserve:r=>{p.entryCallbacks.delete(r),p.observer.unobserve(r)}}}return{getObserver:o}}var Dr="0px",$r=[0],Ur=Nr();function Fr(t){let o=t?.rootMargin??Dr,s=t?.threshold??$r,n=b.useRef(null),a=b.useRef(null),i=b.useRef(null),[l,p]=b.useState(),r=b.useCallback(()=>{let C=n.current;if(!C){p(void 0);return}let v=Ur.getObserver({root:a.current,rootMargin:o,threshold:s});v.observe(C,c=>{p(c)}),i.current=v},[o,s]),x=b.useCallback(()=>{let C=i.current,v=n.current;v&&C?.unobserve(v),i.current=null},[]),m=b.useCallback(C=>{x(),n.current=C,r()},[r,x]),h=b.useCallback(C=>{x(),a.current=C,r()},[r,x]);return[m,{entry:l,rootRef:h}]}var _r=Fr;function qr(t){let[o,s]=_r(t),n=!!s.entry?.isIntersecting,[a,i]=b.useState(n);return n&&!a&&i(!0),[o,{...s,isVisible:n,wasEverVisible:a}]}var Hr=qr,Gr=100;function Kr({loading:t,hasNextPage:o,onLoadMore:s,rootMargin:n,disabled:a,delayInMs:i=Gr}){let l=b.useRef(s),[p,{rootRef:r,isVisible:x}]=Hr({rootMargin:n});b.useEffect(()=>{l.current=s},[s]);let m=!a&&!t&&x&&o;return b.useEffect(()=>{if(m){let h=setTimeout(()=>{l.current()},i);return()=>{clearTimeout(h)}}},[m,i]),[p,{rootRef:r}]}var Yr=Kr;const je={info:"#3B82F6",success:"#10B981",warning:"#F59E0B",error:"#EF4444"};pe.propTypes={severity:u.oneOf(["info","success","warning","error",""]).isRequired,size:u.number};function pe({severity:t,size:o=8}){return je[t]?e.jsx(f,{component:"span",sx:{display:"inline-block",width:o,height:o,borderRadius:"50%",backgroundColor:je[t]||je.info}}):null}at.propTypes={theme:u.string,type:u.oneOf(["button","line","select"]),onSelectType:u.func,extra:u.node,loading:u.bool,currentTab:u.oneOf(["info","success","warning","error",""])};function at({theme:t="dark",type:o="button",onSelectType:s,extra:n=void 0,currentTab:a="",loading:i=!1,...l}){const{t:p}=b.useContext(Me),r=[{label:p("notification.allSeverity"),value:""},{label:p("notification.severityType.info"),value:"info"},{label:p("notification.severityType.success"),value:"success"},{label:p("notification.severityType.warning"),value:"warning"},{label:p("notification.severityType.error"),value:"error"}],x=g=>{(g!==a||!i)&&s(g)},m=b.useMemo(()=>{const g={width:"100%",bgcolor:t==="dark"?"#F9FAFB":"",overflowY:"auto",paddingTop:o==="select"?"0":"5px",whiteSpace:"nowrap",borderRadius:0,display:"flex",justifyContent:"space-between",alignItems:"flex-end",flexWrap:"wrap",gap:"8px"};return o==="line"?Object.assign(g,{}):g},[o,t]),h=(g,k,R)=>e.jsx(q,{disabled:i,onClick:()=>x(g.value),className:`profile-button ${k?"active":""}`,...l,children:g.label},g.value||R),C=(g,k,R)=>e.jsx(q,{variant:"text",disabled:i,onClick:()=>x(g.value),className:`profile-line-button ${k?"active":""}`,...l,children:g.label},g.value||R),v=()=>r?.map((g,k)=>{const R=a===g?.value;return o==="line"?e.jsx(b.Fragment,{children:C(g,R,k)},g.value||k):e.jsx(b.Fragment,{children:h(g,R,k)},g.value||k)}),c=g=>{const{value:k}=g.target;x(k==="all"?"":k)};return o==="select"?e.jsx(Pt,{sx:{maxWidth:300},children:e.jsx(Re,{value:a||"all",onChange:c,size:"small",label:"Severity",IconComponent:g=>e.jsx(tt,{...g,width:20,height:20}),MenuProps:{autoFocus:!1,PaperProps:{style:{maxHeight:400,overflowY:"auto",borderRadius:"8px",boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},variant:"outlined",sx:{fieldset:{border:"none"}},children:r.map((g,k)=>e.jsx(ae,{value:g.value||"all",children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(pe,{severity:g.value}),g.label]})},g.value||k))})}):e.jsxs(f,{className:"severity-tabs",sx:m,children:[e.jsx(f,{sx:{...o==="line"?{flex:1,borderBottom:"1px solid",borderColor:"grey.200"}:{display:"flex",gap:"24px"}},children:v()}),n]})}lt.propTypes={paging:u.objectOf(u.any).isRequired,loading:u.bool.isRequired,onChange:u.func.isRequired};function lt({loading:t,paging:o,onChange:s}){const{t:n}=b.useContext(Me),a=xe(r=>r.breakpoints.down("md"));if(o.pageCount<=0||a)return null;const i=(r,x)=>{s({page:x+1})},l=r=>{const x=Number(r.target.value);s({page:1,pageSize:x})},p=o.page-1<=0?0:o.page-1;return e.jsx(f,{className:"notification-pagination",sx:{mt:2,display:"flex",justifyContent:"flex-end"},children:e.jsx(Rt,{component:"div",disabled:t,count:o.total,page:p,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:n("pagination.rowsPerPage"),labelDisplayedRows:({from:r,to:x,count:m})=>`${r}–${x} / ${m!==-1?m:`${n()}more than ${x}`}`,rowsPerPage:o.pageSize,onPageChange:i,onRowsPerPageChange:l})})}const Vr=b.memo(lt),Qr={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4h16v2.172a2 2 0 0 1-.586 1.414L15 12v7l-6 2v-8.5L4.52 7.572A2 2 0 0 1 4 6.227V4z"/>'},He=6,Ge={"& .MuiCheckbox-root":{padding:"4px"},"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"1.35rem"},"& .MuiCheckbox-root:not(.Mui-checked)":{color:"divider"},"& .MuiCheckbox-root.Mui-checked":{color:"primary.main"},"& .MuiCheckbox-root .css-i4bv87-MuiSvgIcon-root":{width:"1.1em",height:"1.1em"},"& .MuiCheckbox-root svg":{stroke:"divider",strokeWidth:.7}},Zr={border:"1px solid",borderColor:"divider",borderRadius:1,overflow:"hidden",backgroundColor:"background.paper",backgroundImage:"none",transition:"all 0.2s ease-in-out"},Ke=()=>({...Zr,width:"calc(50% - 8px)"});ct.propTypes={loading:u.bool,type:u.oneOf(["server","service"]),onFilterChange:u.func,blockletMap:u.object,filterType:u.oneOf(["component","entity"]),selectedId:u.array,severity:u.array,enableMarkAllAsRead:u.bool,unReadCount:u.number,onReadFilterChange:u.func,currentReadFilter:u.string};function ct({onFilterChange:t=()=>{},loading:o=!1,type:s="service",blockletMap:n={},filterType:a="component",selectedId:i=[],severity:l=[],enableMarkAllAsRead:p=!0,unReadCount:r=0,onReadFilterChange:x=()=>{},currentReadFilter:m="all"}){const{t:h}=b.useContext(Me),[C,v]=b.useState(null),c=!!C,[g,k]=b.useState(i),[R,P]=b.useState(l),[y,z]=b.useState(!1),[L,U]=b.useState(""),[j,S]=b.useState([]);b.useEffect(()=>{k(i),P(l)},[i,l]);const B=[{label:h("notification.filterType.all"),value:"all"},{label:h("notification.filterType.unread"),value:"unread"}],G=d=>{(d!==m||!o)&&x(d)},Z=[{label:h("notification.severityType.info"),value:"info"},{label:h("notification.severityType.success"),value:"success"},{label:h("notification.severityType.warning"),value:"warning"},{label:h("notification.severityType.error"),value:"error"}],ne=d=>{v(d.currentTarget),U(""),z(!1)},ge=()=>{v(null)},oe=d=>{const w=g.includes(d)?g.filter(A=>A!==d):[...g,d];k(w),t({id:w,severity:R})},se=d=>{const w=R.includes(d)?R.filter(A=>A!==d):[...R,d];P(w),t({severity:w,id:g})},me=d=>{U(d.target.value)},be=()=>{z(!y)},K=_t.useMemo(()=>{if(!n.size)return[];const d=[];return a==="component"&&d.push({label:h("notification.system"),id:"system"}),Array.from(n).forEach(([,w])=>{const A=w.did||w.meta?.did,W=w.title||w.meta?.title||"",F=w.appPid||w.appDid;(a==="component"&&F!==A||a==="entity"&&F===A)&&d.push({label:W,id:A,blocklet:w,ancestors:w.ancestors})}),d},[n,a,h]);b.useEffect(()=>{if(L.trim()==="")S(K);else{const d=L.toLowerCase(),w=K.filter(A=>A.label.toLowerCase().includes(d));S(w)}},[L,K]);const ye=L.trim()!==""||y?j:j.slice(0,He);return e.jsxs(f,{children:[e.jsxs(f,{sx:{display:"flex",justifyContent:p?"space-between":"flex-end",alignItems:"flex-start",flexWrap:"wrap",gap:1},children:[p&&e.jsx(f,{sx:{display:"flex",gap:1.5},children:B.map(d=>e.jsxs(q,{disabled:o,onClick:()=>G(d.value),className:`profile-button ${m===d.value?"active":""}`,sx:{...s==="service"&&m===d.value?{color:"secondary.main"}:{},color:"red",fontWeight:m===d.value?"bold":"normal"},children:[d.label,d.value==="unread"&&r>0&&` (${r})`]},d.value))}),e.jsxs(f,{sx:{display:"flex",justifyContent:"flex-end",gap:2},children:[e.jsx(D,{size:"small",onClick:ne,disabled:o,sx:{minWidth:"auto",borderRadius:1,border:"1px solid",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:e.jsx(N,{icon:Qr,hFlip:!0})}),e.jsx(It,{open:c,anchorEl:C,onClose:ge,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{p:3,width:450,maxHeight:500,overflowY:"auto",backgroundColor:"background.paper",backgroundImage:"none",borderRadius:1,boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},children:e.jsxs(f,{children:[e.jsxs(f,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,height:"28px"},children:[e.jsx(T,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("notification.severity")}),e.jsx(f,{sx:{minWidth:"60px",display:"flex",justifyContent:"flex-end"},children:(g.length>0||R.length>0)&&e.jsx(q,{size:"small",onClick:()=>{k([]),P([]),t({severity:[],id:[]})},startIcon:e.jsx(Tt,{fontSize:"small"}),sx:{color:"text.secondary",textTransform:"none",minWidth:"auto","&:hover":{backgroundColor:"transparent"},"& .MuiButton-startIcon":{marginRight:"2px"}},children:h("notification.clear")})})]}),e.jsx(f,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(Be,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,flex:1},children:Z.map(d=>e.jsx(We,{elevation:0,sx:Ke(R.includes(d.value)),children:e.jsx(J,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{display:"flex",alignItems:"center",gap:1,fontSize:"0.875rem"},...Ge},control:e.jsx(Oe,{checked:R.includes(d.value),onChange:()=>se(d.value),disabled:o,size:"small"}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5},children:[e.jsx(pe,{severity:d.value}),d.label]})})},d.value))})}),e.jsxs(f,{sx:{mb:2},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:1.5},children:[e.jsx(T,{variant:"subtitle1",sx:{fontWeight:"bold",width:"calc(100% - 36px)"},children:h("notification.from")}),e.jsx(f,{sx:{display:"flex",alignItems:"center",width:"calc(100% - 36px)"},children:e.jsx(Ze,{size:"small",placeholder:"search",value:L,onChange:me,sx:{width:"100%","& .MuiOutlinedInput-input":{padding:"6px 4px 6px 0"},".MuiOutlinedInput-root":{"&:hover":{fieldset:{borderColor:"divider"}},"&.Mui-focused":{fieldset:{borderColor:"divider"}}},fieldset:{borderColor:"divider"}},slotProps:{input:{size:"small",startAdornment:e.jsx(Je,{position:"start",sx:{marginRight:"2px"},children:e.jsx(N,{icon:jr})})}}})})]}),e.jsx(Be,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2},children:ye.map(d=>e.jsx(We,{elevation:0,sx:Ke(g.includes(d.id)),children:e.jsx(J,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{fontSize:"0.875rem",width:"calc(100% - 36px)"},...Ge},control:e.jsx(Oe,{checked:g.includes(d.id),onChange:()=>oe(d.id),disabled:o,size:"small"}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,minWidth:0,width:"100%"},children:[d.blocklet&&e.jsx(_e,{size:20,blocklet:d.blocklet,ancestors:d.ancestors,style:{borderRadius:4,flexShrink:0}}),e.jsx(T,{noWrap:!0,variant:"body2",component:"span",title:d.label,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:d.label})]})})},d.id))}),j.length>He&&L.trim()===""&&e.jsx(q,{fullWidth:!0,size:"small",onClick:be,sx:{mt:1},endIcon:y?e.jsx(At,{}):e.jsx(Mt,{})})]})]})})]})]}),g.length>0||R.length>0?e.jsxs(f,{className:"notification-filter-content",sx:{display:"flex",flexWrap:"wrap",gap:1,mt:2},children:[R.map(d=>{const w=Z.find(A=>A.value===d);return e.jsx(Ce,{label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(pe,{severity:d}),w?w.label:d]}),onDelete:()=>se(d),size:"small",variant:"outlined",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`severity-${d}`)}),g.map(d=>{const w=K.find(A=>A.id===d);return e.jsx(Ce,{label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:.5},children:[w?.blocklet&&e.jsx(_e,{size:16,blocklet:w.blocklet,ancestors:w.ancestors,style:{borderRadius:4,flexShrink:0}}),w?w.label:d]}),variant:"outlined",onDelete:()=>oe(d),size:"small",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`component-${d}`)})]}):null]})}const Jr=te(Lt)`
1
+ import{j as e,y as Pt,bb as Re,M as ae,ak as f,Q as q,W as u,J as xe,c0 as Rt,I as D,aN as It,T,aj as Tt,b5 as Be,P as We,b6 as J,a5 as Oe,z as Ze,A as Je,ci as At,bf as Mt,U as Ce,d5 as zt,d6 as Et,at as te,d7 as Lt,a6 as V,n as le,D as Bt,d8 as Wt,ar as Ne,b1 as Ie,d9 as Ot,aX as Nt,ai as Dt,am as X,bp as $t,bq as ve,a$ as Ut,cS as Ft}from"./vendor-mui-core-Bq_sfmbr.js";import{r as b,a as _t,u as qt,j as Ht}from"./vendor-react-Dvs43sk9.js";import{t as Xe,Y as Gt,a6 as Kt,R as De,D as Yt,C as ce,n as Y,A as Vt}from"./vendor-utils-DQK0pEML.js";import{a as Qt,G as Zt,bw as Jt,c as Te,d as Xt,Y as er,bx as tr,aZ as Ae,W as fe,bh as rr,by as nr,a5 as or,a$ as sr,a6 as ir,bz as ar}from"./index-B2EmOTH7.js";import{a as I,h as et,k as re,g as H,b as E,j as lr}from"./vendor-hooks-DLNZ8kxG.js";import{l as tt}from"./arrow-down.svg-CGgLriRk.js";import{G as Me,ab as N,T as O,aM as cr,O as rt,aN as dr,H as _,aO as ur,aP as pr,aQ as $e,J as xr,D as nt,I as ze,aR as fr,aS as M,a2 as hr,a1 as gr,$ as ot,aT as mr,aU as br,a0 as yr,C as de,a6 as Ue,ac as vr,aj as Fe}from"./vendor-ux-DnuP69h2.js";import{N as wr}from"./list-CY0v9mkZ.js";import{d as jr}from"./search-4YYphs0l.js";import{B as _e}from"./bundle-avatar-CfoJFi5J.js";import{h as qe,T as Cr}from"./team-B8B1ZhIQ.js";import{b as Sr,d as kr,a as Pr,c as Rr,e as Ir,f as Tr,_ as Ar}from"./user-center-4QiBEXkz.js";import{N as st,U as it}from"./index-DVMWAhrt.js";import{u as Q}from"./use-mobile-C8UweHoJ.js";import Mr from"./index-FBIc-uda.js";import{f as ee}from"./index-DBs9Ljax.js";import{u as Se}from"./index-BjLb1HBo.js";import{U as we}from"./user-sessions-gPGe7NTf.js";import zr from"./index-Ca0DgcTh.js";import{o as Er}from"./vendor-arcblock-CzdgnaKl.js";import{c as Lr,b as ue,a as Br,S as Wr}from"./index-BV5aEWS1.js";import"./index-C4j3gH0o.js";import"./index-BojVbZw0.js";import{U as Or}from"./user-follower-daqBbJjL.js";import"./lottie-web-4koyQiv_.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-BWhAMS1Q.js";import"./util-BkJCSJXb.js";import"./base32-2BTO5zmk.js";import"./session-DGj-_oAZ.js";import"./isURL-DviHJNBO.js";import"./use-app-logo-wJojGoX8.js";import"./index-BmPcC1s0.js";import"./api-sewNv0AE.js";import"./table-tips-1QxzlCjR.js";import"./use-mobile-D2h0sedv.js";import"./passport-item-CwFxbGyQ.js";import"./did-address-4KKI5Z_V.js";import"./index-C1pPU9qq.js";import"./vendor-mui-x-BbwECMfi.js";import"./AdapterDayjs-CKA_54eZ.js";import"./confirm-DV4YCyEc.js";import"./click-to-copy-CH3FJWJo.js";import"./delete-confirm-ad8t0UXs.js";import"./permission-DwyNIiFn.js";import"./actions-Cqn-jwqV.js";import"./index-DRYJ0xIl.js";function Nr(){let t=new Map;function o({root:s,rootMargin:n,threshold:a}){let i=t.get(s);i||(i=new Map,t.set(s,i));let l=JSON.stringify({rootMargin:n,threshold:a}),p=i.get(l);if(!p){let r=new Map;p={observer:new IntersectionObserver(x=>{x.forEach(m=>{r.get(m.target)?.(m)})},{root:s,rootMargin:n,threshold:a}),entryCallbacks:r},i.set(l,p)}return{observe:(r,x)=>{p.entryCallbacks.set(r,x),p.observer.observe(r)},unobserve:r=>{p.entryCallbacks.delete(r),p.observer.unobserve(r)}}}return{getObserver:o}}var Dr="0px",$r=[0],Ur=Nr();function Fr(t){let o=t?.rootMargin??Dr,s=t?.threshold??$r,n=b.useRef(null),a=b.useRef(null),i=b.useRef(null),[l,p]=b.useState(),r=b.useCallback(()=>{let C=n.current;if(!C){p(void 0);return}let v=Ur.getObserver({root:a.current,rootMargin:o,threshold:s});v.observe(C,c=>{p(c)}),i.current=v},[o,s]),x=b.useCallback(()=>{let C=i.current,v=n.current;v&&C?.unobserve(v),i.current=null},[]),m=b.useCallback(C=>{x(),n.current=C,r()},[r,x]),h=b.useCallback(C=>{x(),a.current=C,r()},[r,x]);return[m,{entry:l,rootRef:h}]}var _r=Fr;function qr(t){let[o,s]=_r(t),n=!!s.entry?.isIntersecting,[a,i]=b.useState(n);return n&&!a&&i(!0),[o,{...s,isVisible:n,wasEverVisible:a}]}var Hr=qr,Gr=100;function Kr({loading:t,hasNextPage:o,onLoadMore:s,rootMargin:n,disabled:a,delayInMs:i=Gr}){let l=b.useRef(s),[p,{rootRef:r,isVisible:x}]=Hr({rootMargin:n});b.useEffect(()=>{l.current=s},[s]);let m=!a&&!t&&x&&o;return b.useEffect(()=>{if(m){let h=setTimeout(()=>{l.current()},i);return()=>{clearTimeout(h)}}},[m,i]),[p,{rootRef:r}]}var Yr=Kr;const je={info:"#3B82F6",success:"#10B981",warning:"#F59E0B",error:"#EF4444"};pe.propTypes={severity:u.oneOf(["info","success","warning","error",""]).isRequired,size:u.number};function pe({severity:t,size:o=8}){return je[t]?e.jsx(f,{component:"span",sx:{display:"inline-block",width:o,height:o,borderRadius:"50%",backgroundColor:je[t]||je.info}}):null}at.propTypes={theme:u.string,type:u.oneOf(["button","line","select"]),onSelectType:u.func,extra:u.node,loading:u.bool,currentTab:u.oneOf(["info","success","warning","error",""])};function at({theme:t="dark",type:o="button",onSelectType:s,extra:n=void 0,currentTab:a="",loading:i=!1,...l}){const{t:p}=b.useContext(Me),r=[{label:p("notification.allSeverity"),value:""},{label:p("notification.severityType.info"),value:"info"},{label:p("notification.severityType.success"),value:"success"},{label:p("notification.severityType.warning"),value:"warning"},{label:p("notification.severityType.error"),value:"error"}],x=g=>{(g!==a||!i)&&s(g)},m=b.useMemo(()=>{const g={width:"100%",bgcolor:t==="dark"?"#F9FAFB":"",overflowY:"auto",paddingTop:o==="select"?"0":"5px",whiteSpace:"nowrap",borderRadius:0,display:"flex",justifyContent:"space-between",alignItems:"flex-end",flexWrap:"wrap",gap:"8px"};return o==="line"?Object.assign(g,{}):g},[o,t]),h=(g,k,R)=>e.jsx(q,{disabled:i,onClick:()=>x(g.value),className:`profile-button ${k?"active":""}`,...l,children:g.label},g.value||R),C=(g,k,R)=>e.jsx(q,{variant:"text",disabled:i,onClick:()=>x(g.value),className:`profile-line-button ${k?"active":""}`,...l,children:g.label},g.value||R),v=()=>r?.map((g,k)=>{const R=a===g?.value;return o==="line"?e.jsx(b.Fragment,{children:C(g,R,k)},g.value||k):e.jsx(b.Fragment,{children:h(g,R,k)},g.value||k)}),c=g=>{const{value:k}=g.target;x(k==="all"?"":k)};return o==="select"?e.jsx(Pt,{sx:{maxWidth:300},children:e.jsx(Re,{value:a||"all",onChange:c,size:"small",label:"Severity",IconComponent:g=>e.jsx(tt,{...g,width:20,height:20}),MenuProps:{autoFocus:!1,PaperProps:{style:{maxHeight:400,overflowY:"auto",borderRadius:"8px",boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},variant:"outlined",sx:{fieldset:{border:"none"}},children:r.map((g,k)=>e.jsx(ae,{value:g.value||"all",children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(pe,{severity:g.value}),g.label]})},g.value||k))})}):e.jsxs(f,{className:"severity-tabs",sx:m,children:[e.jsx(f,{sx:{...o==="line"?{flex:1,borderBottom:"1px solid",borderColor:"grey.200"}:{display:"flex",gap:"24px"}},children:v()}),n]})}lt.propTypes={paging:u.objectOf(u.any).isRequired,loading:u.bool.isRequired,onChange:u.func.isRequired};function lt({loading:t,paging:o,onChange:s}){const{t:n}=b.useContext(Me),a=xe(r=>r.breakpoints.down("md"));if(o.pageCount<=0||a)return null;const i=(r,x)=>{s({page:x+1})},l=r=>{const x=Number(r.target.value);s({page:1,pageSize:x})},p=o.page-1<=0?0:o.page-1;return e.jsx(f,{className:"notification-pagination",sx:{mt:2,display:"flex",justifyContent:"flex-end"},children:e.jsx(Rt,{component:"div",disabled:t,count:o.total,page:p,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:n("pagination.rowsPerPage"),labelDisplayedRows:({from:r,to:x,count:m})=>`${r}–${x} / ${m!==-1?m:`${n()}more than ${x}`}`,rowsPerPage:o.pageSize,onPageChange:i,onRowsPerPageChange:l})})}const Vr=b.memo(lt),Qr={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4h16v2.172a2 2 0 0 1-.586 1.414L15 12v7l-6 2v-8.5L4.52 7.572A2 2 0 0 1 4 6.227V4z"/>'},He=6,Ge={"& .MuiCheckbox-root":{padding:"4px"},"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"1.35rem"},"& .MuiCheckbox-root:not(.Mui-checked)":{color:"divider"},"& .MuiCheckbox-root.Mui-checked":{color:"primary.main"},"& .MuiCheckbox-root .css-i4bv87-MuiSvgIcon-root":{width:"1.1em",height:"1.1em"},"& .MuiCheckbox-root svg":{stroke:"divider",strokeWidth:.7}},Zr={border:"1px solid",borderColor:"divider",borderRadius:1,overflow:"hidden",backgroundColor:"background.paper",backgroundImage:"none",transition:"all 0.2s ease-in-out"},Ke=()=>({...Zr,width:"calc(50% - 8px)"});ct.propTypes={loading:u.bool,type:u.oneOf(["server","service"]),onFilterChange:u.func,blockletMap:u.object,filterType:u.oneOf(["component","entity"]),selectedId:u.array,severity:u.array,enableMarkAllAsRead:u.bool,unReadCount:u.number,onReadFilterChange:u.func,currentReadFilter:u.string};function ct({onFilterChange:t=()=>{},loading:o=!1,type:s="service",blockletMap:n={},filterType:a="component",selectedId:i=[],severity:l=[],enableMarkAllAsRead:p=!0,unReadCount:r=0,onReadFilterChange:x=()=>{},currentReadFilter:m="all"}){const{t:h}=b.useContext(Me),[C,v]=b.useState(null),c=!!C,[g,k]=b.useState(i),[R,P]=b.useState(l),[y,z]=b.useState(!1),[L,U]=b.useState(""),[j,S]=b.useState([]);b.useEffect(()=>{k(i),P(l)},[i,l]);const B=[{label:h("notification.filterType.all"),value:"all"},{label:h("notification.filterType.unread"),value:"unread"}],G=d=>{(d!==m||!o)&&x(d)},Z=[{label:h("notification.severityType.info"),value:"info"},{label:h("notification.severityType.success"),value:"success"},{label:h("notification.severityType.warning"),value:"warning"},{label:h("notification.severityType.error"),value:"error"}],ne=d=>{v(d.currentTarget),U(""),z(!1)},ge=()=>{v(null)},oe=d=>{const w=g.includes(d)?g.filter(A=>A!==d):[...g,d];k(w),t({id:w,severity:R})},se=d=>{const w=R.includes(d)?R.filter(A=>A!==d):[...R,d];P(w),t({severity:w,id:g})},me=d=>{U(d.target.value)},be=()=>{z(!y)},K=_t.useMemo(()=>{if(!n.size)return[];const d=[];return a==="component"&&d.push({label:h("notification.system"),id:"system"}),Array.from(n).forEach(([,w])=>{const A=w.did||w.meta?.did,W=w.title||w.meta?.title||"",F=w.appPid||w.appDid;(a==="component"&&F!==A||a==="entity"&&F===A)&&d.push({label:W,id:A,blocklet:w,ancestors:w.ancestors})}),d},[n,a,h]);b.useEffect(()=>{if(L.trim()==="")S(K);else{const d=L.toLowerCase(),w=K.filter(A=>A.label.toLowerCase().includes(d));S(w)}},[L,K]);const ye=L.trim()!==""||y?j:j.slice(0,He);return e.jsxs(f,{children:[e.jsxs(f,{sx:{display:"flex",justifyContent:p?"space-between":"flex-end",alignItems:"flex-start",flexWrap:"wrap",gap:1},children:[p&&e.jsx(f,{sx:{display:"flex",gap:1.5},children:B.map(d=>e.jsxs(q,{disabled:o,onClick:()=>G(d.value),className:`profile-button ${m===d.value?"active":""}`,sx:{...s==="service"&&m===d.value?{color:"secondary.main"}:{},color:"red",fontWeight:m===d.value?"bold":"normal"},children:[d.label,d.value==="unread"&&r>0&&` (${r})`]},d.value))}),e.jsxs(f,{sx:{display:"flex",justifyContent:"flex-end",gap:2},children:[e.jsx(D,{size:"small",onClick:ne,disabled:o,sx:{minWidth:"auto",borderRadius:1,border:"1px solid",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:e.jsx(N,{icon:Qr,hFlip:!0})}),e.jsx(It,{open:c,anchorEl:C,onClose:ge,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{p:3,width:450,maxHeight:500,overflowY:"auto",backgroundColor:"background.paper",backgroundImage:"none",borderRadius:1,boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},children:e.jsxs(f,{children:[e.jsxs(f,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,height:"28px"},children:[e.jsx(T,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("notification.severity")}),e.jsx(f,{sx:{minWidth:"60px",display:"flex",justifyContent:"flex-end"},children:(g.length>0||R.length>0)&&e.jsx(q,{size:"small",onClick:()=>{k([]),P([]),t({severity:[],id:[]})},startIcon:e.jsx(Tt,{fontSize:"small"}),sx:{color:"text.secondary",textTransform:"none",minWidth:"auto","&:hover":{backgroundColor:"transparent"},"& .MuiButton-startIcon":{marginRight:"2px"}},children:h("notification.clear")})})]}),e.jsx(f,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(Be,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,flex:1},children:Z.map(d=>e.jsx(We,{elevation:0,sx:Ke(R.includes(d.value)),children:e.jsx(J,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{display:"flex",alignItems:"center",gap:1,fontSize:"0.875rem"},...Ge},control:e.jsx(Oe,{checked:R.includes(d.value),onChange:()=>se(d.value),disabled:o,size:"small"}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5},children:[e.jsx(pe,{severity:d.value}),d.label]})})},d.value))})}),e.jsxs(f,{sx:{mb:2},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:1.5},children:[e.jsx(T,{variant:"subtitle1",sx:{fontWeight:"bold",width:"calc(100% - 36px)"},children:h("notification.from")}),e.jsx(f,{sx:{display:"flex",alignItems:"center",width:"calc(100% - 36px)"},children:e.jsx(Ze,{size:"small",placeholder:"search",value:L,onChange:me,sx:{width:"100%","& .MuiOutlinedInput-input":{padding:"6px 4px 6px 0"},".MuiOutlinedInput-root":{"&:hover":{fieldset:{borderColor:"divider"}},"&.Mui-focused":{fieldset:{borderColor:"divider"}}},fieldset:{borderColor:"divider"}},slotProps:{input:{size:"small",startAdornment:e.jsx(Je,{position:"start",sx:{marginRight:"2px"},children:e.jsx(N,{icon:jr})})}}})})]}),e.jsx(Be,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2},children:ye.map(d=>e.jsx(We,{elevation:0,sx:Ke(g.includes(d.id)),children:e.jsx(J,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{fontSize:"0.875rem",width:"calc(100% - 36px)"},...Ge},control:e.jsx(Oe,{checked:g.includes(d.id),onChange:()=>oe(d.id),disabled:o,size:"small"}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,minWidth:0,width:"100%"},children:[d.blocklet&&e.jsx(_e,{size:20,blocklet:d.blocklet,ancestors:d.ancestors,style:{borderRadius:4,flexShrink:0}}),e.jsx(T,{noWrap:!0,variant:"body2",component:"span",title:d.label,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:d.label})]})})},d.id))}),j.length>He&&L.trim()===""&&e.jsx(q,{fullWidth:!0,size:"small",onClick:be,sx:{mt:1},endIcon:y?e.jsx(At,{}):e.jsx(Mt,{})})]})]})})]})]}),g.length>0||R.length>0?e.jsxs(f,{className:"notification-filter-content",sx:{display:"flex",flexWrap:"wrap",gap:1,mt:2},children:[R.map(d=>{const w=Z.find(A=>A.value===d);return e.jsx(Ce,{label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(pe,{severity:d}),w?w.label:d]}),onDelete:()=>se(d),size:"small",variant:"outlined",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`severity-${d}`)}),g.map(d=>{const w=K.find(A=>A.id===d);return e.jsx(Ce,{label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:.5},children:[w?.blocklet&&e.jsx(_e,{size:16,blocklet:w.blocklet,ancestors:w.ancestors,style:{borderRadius:4,flexShrink:0}}),w?w.label:d]}),variant:"outlined",onDelete:()=>oe(d),size:"small",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`component-${d}`)})]}):null]})}const Jr=te(Lt)`
2
2
  position: fixed;
3
3
  bottom: 20px;
4
4
  right: 20px;