@abtnode/blocklet-services 1.16.44-beta-20250512-155818-937e465d → 1.16.44-beta-20250513-030435-c2d99062

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 (83) hide show
  1. package/dist/assets/{access-control-CCSlKYYz.js → access-control-Din7doVd.js} +1 -1
  2. package/dist/assets/{add-component-core-C7-Epxoj.js → add-component-core-5x4gTem5.js} +1 -1
  3. package/dist/assets/{add-resource-CJHw7ea0.js → add-resource-BrZnm53f.js} +1 -1
  4. package/dist/assets/{advanced-tG5IRVhQ.js → advanced-CN6mCSES.js} +1 -1
  5. package/dist/assets/{appearance-bRLsRDs2.js → appearance-Bowm1Shj.js} +1 -1
  6. package/dist/assets/{audit-logs-B3-Fo3nR.js → audit-logs-DczjqamJ.js} +1 -1
  7. package/dist/assets/{authorize-DNTNbUhI.js → authorize-D2LCmekq.js} +1 -1
  8. package/dist/assets/{branding-By8KDk5Q.js → branding-B6AmOMI6.js} +1 -1
  9. package/dist/assets/{branding-hDeNkLC2.js → branding-CwhhJRKu.js} +2 -2
  10. package/dist/assets/{bundle-avatar-DYTLzqlT.js → bundle-avatar-CDJRatFg.js} +1 -1
  11. package/dist/assets/{complete-6R-n_Ra9.js → complete-CKhw9u_z.js} +1 -1
  12. package/dist/assets/{component-Blsql2u0.js → component-Cb3m5qUw.js} +1 -1
  13. package/dist/assets/{config-D6r2ZAFY.js → config-kGXJEkFJ.js} +1 -1
  14. package/dist/assets/{config-navigation-B0nu0al4.js → config-navigation-CKVyFhfH.js} +3 -3
  15. package/dist/assets/{config-space-d34Deg7R.js → config-space-CogRdhoQ.js} +1 -1
  16. package/dist/assets/{confirm-DjTZImyg.js → confirm-SdqBW-ti.js} +1 -1
  17. package/dist/assets/{connect-Cu2Ssv5A.js → connect-BMn4CxDk.js} +1 -1
  18. package/dist/assets/connect-HAC-YfHh.js +5 -0
  19. package/dist/assets/{connect-to-BG15Vnyg.js → connect-to-eNQDY2rc.js} +1 -1
  20. package/dist/assets/{dashboard-BIOpvfj3.js → dashboard-BYxl5V9e.js} +3 -3
  21. package/dist/assets/{delete-confirm-BzuBR6TW.js → delete-confirm-CKF_eljP.js} +1 -1
  22. package/dist/assets/domain-DotN6lCb.js +9 -0
  23. package/dist/assets/{domain-action-card-Bcs_GWxq.js → domain-action-card-DHH9PLRG.js} +1 -1
  24. package/dist/assets/domains-BV2pykxi.js +1 -0
  25. package/dist/assets/dot-BA3EvSrh.js +7 -0
  26. package/dist/assets/{email-BZVu6WP-.js → email-CHR0EOis.js} +1 -1
  27. package/dist/assets/{exchange-passport-8jdiPDph.js → exchange-passport-D0iIXJxD.js} +1 -1
  28. package/dist/assets/{fuel-Dx_cnsCl.js → fuel-nMTHNcy-.js} +1 -1
  29. package/dist/assets/{gen-access-key-CqKmmKML.js → gen-access-key-DH4wNzRm.js} +1 -1
  30. package/dist/assets/{index-Dyl-XQ73.js → index-B54lTbup.js} +1 -1
  31. package/dist/assets/{index-SzdSxpkq.js → index-BA8C83iz.js} +1 -1
  32. package/dist/assets/{index-C-A13dEh.js → index-BCNchyGN.js} +1 -1
  33. package/dist/assets/{index-C5SsKJ2n.js → index-BCtmnJeV.js} +1 -1
  34. package/dist/assets/{index-B9nvthxv.js → index-BJxv6GA4.js} +1 -1
  35. package/dist/assets/{index-Jnk92KZC.js → index-BLGGjT7N.js} +5 -5
  36. package/dist/assets/{index-Btl_rz0J.js → index-B_-kynzD.js} +3 -3
  37. package/dist/assets/{index-Bju4sfVL.js → index-BuXc3Oag.js} +1 -1
  38. package/dist/assets/{index-DefO2n6z.js → index-CIkPfxzG.js} +2 -2
  39. package/dist/assets/{index-ioZVVJtg.js → index-CYeNo51G.js} +1 -1
  40. package/dist/assets/{index-Cc-e6lxg.js → index-CfxcUIhC.js} +1 -1
  41. package/dist/assets/{index-USO5zFMh.js → index-Ctzl9JDw.js} +1 -1
  42. package/dist/assets/{index-HU4yqI-9.js → index-CxwBhS0_.js} +1 -1
  43. package/dist/assets/{index-DjEDWgGs.js → index-D7eC9ptO.js} +1 -1
  44. package/dist/assets/{index-Du38Vjy4.js → index-D9KfgDPN.js} +4 -4
  45. package/dist/assets/{invitation-1bsb30Yz.js → invitation-DzT9Qa0A.js} +1 -1
  46. package/dist/assets/{invite-CALl83Zc.js → invite-CQPeUOT4.js} +1 -1
  47. package/dist/assets/{issue-passport-BcStTsbv.js → issue-passport-BYhvmLsl.js} +1 -1
  48. package/dist/assets/{item-Bk_1JLeG.js → item-D942q-4T.js} +1 -1
  49. package/dist/assets/{layout-D93HKT6w.js → layout-BcLfVSqs.js} +1 -1
  50. package/dist/assets/{list-rt6nku1-.js → list-BiJWMg_P.js} +1 -1
  51. package/dist/assets/{list-D96_O-GY.js → list-DKUSPdB6.js} +2 -2
  52. package/dist/assets/{log--AX8zo75.js → log-Iko0jLNA.js} +1 -1
  53. package/dist/assets/{login-WRcteY7r.js → login-4Yq_pPSw.js} +1 -1
  54. package/dist/assets/{logo-uploader-CQCy6MG3.js → logo-uploader-Cnkdgyfv.js} +2 -2
  55. package/dist/assets/{lost-passport-kJX7pEJj.js → lost-passport-D5jMtgH_.js} +1 -1
  56. package/dist/assets/open-window--2G6Qjbq.js +1 -1
  57. package/dist/assets/{overview-CpKMiGEK.js → overview-CaQ-tV1t.js} +1 -1
  58. package/dist/assets/{passport-item-CIvCqz_R.js → passport-item-DH3_49G1.js} +1 -1
  59. package/dist/assets/{publish-resource-CCa5xfwz.js → publish-resource-BtFRgv4P.js} +1 -1
  60. package/dist/assets/{runtime-eXYlg9Cz.js → runtime-B0207zk1.js} +1 -1
  61. package/dist/assets/{security-DM8MeY05.js → security-CX01lhxW.js} +1 -1
  62. package/dist/assets/setup-DIAgbS7c.js +30 -0
  63. package/dist/assets/{start-CIjuDAiX.js → start-CMRQU8Px.js} +1 -1
  64. package/dist/assets/{status-CUMJd-nJ.js → status-DSQPLYSp.js} +1 -1
  65. package/dist/assets/{step-actions-CeJCmiCS.js → step-actions-BfGTFkaB.js} +1 -1
  66. package/dist/assets/{traffic-B5x_6GvF.js → traffic-ClE631in.js} +1 -1
  67. package/dist/assets/{transfer-CTEHVklh.js → transfer-BnR8fjLW.js} +1 -1
  68. package/dist/assets/{unsubscribe-Bi2IV-2n.js → unsubscribe-rUE2LcLN.js} +1 -1
  69. package/dist/assets/{use-blocklet-logo-BEy8Tnso.js → use-blocklet-logo-Phq7jasP.js} +1 -1
  70. package/dist/assets/useAsync-DV3NyLhI.js +1 -0
  71. package/dist/assets/{user-center-DcXdjtRX.js → user-center-D25Vw-wP.js} +1 -1
  72. package/dist/assets/{util-MKllNgBs.js → util-Btd7aQEC.js} +1 -1
  73. package/dist/assets/{wrap-locale-B9TkXFQe.js → wrap-locale-CPW6a0PM.js} +1 -1
  74. package/dist/index.html +1 -1
  75. package/dist/service-worker.js +1 -1
  76. package/package.json +21 -21
  77. package/dist/assets/connect-K4ZmMu4L.js +0 -5
  78. package/dist/assets/domain-wh85yL2O.js +0 -9
  79. package/dist/assets/domains-bzKFbARj.js +0 -1
  80. package/dist/assets/dot-C4hULxc0.js +0 -7
  81. package/dist/assets/setup-BEsU41BB.js +0 -30
  82. package/dist/assets/useAsync-C8ydfEEr.js +0 -1
  83. package/dist/assets/useAsync-CMWsznMW.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Btl_rz0J.js","assets/vendor-ux-did-connect-DHrruicZ.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-rHXShPKm.js","assets/vendor-mui-core-D_bnq77o.js","assets/vendor-hooks-rDgu5KV9.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-uz9DVywv.js","assets/index-Bs1kxR8_.js","assets/index-DefO2n6z.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
- import{r as x,f as Tt,l as ct,L as ye,g as Mn,u as Un,i as Vn,j as jt}from"./vendor-react-DEoibe3W.js";import{a9 as Se,j as e,v as Be,aa as c,bd as $t,H as s,ad as ke,I as ae,T as L,s as Fn,c7 as Oo,D as at,ah as ve,au as Hn,bS as Ke,ak as dt,bt as et,bx as tt,y as K,ab as we,P as Wo,G as Bo,w as Pt,a7 as Mo,M as Uo,q as be,X as Gn,aj as Vo,t as Fo,bV as Jn,N as Je,z as Ho,O as ne,al as Re,at as Go,L as Jo,A as _t,b6 as Xo,bK as Yo,by as Xn,e as Qo,aq as Yn,b$ as Qn,af as Zn,U as Zo,W as ot,bF as Kn,bG as es,c8 as ts,c9 as os,bo as wt,bp as ns,br as ss,bv as rs,bw as kt}from"./vendor-mui-core-D_bnq77o.js";import{z as je,C as De,ad as ls,a5 as is,f as yo,ae as vo,a9 as cs}from"./index-DefO2n6z.js";import{r as Ie,j as Y,u as Q,bu as Ko,h as as,B as qe,b7 as en,X as tn,b4 as on,ao as ds,bv as us,a7 as qt,_ as M,a3 as ps,I as de,bw as hs,ba as fs,a as We,am as ut,b5 as bs,as as nn}from"./vendor-ux-did-connect-DHrruicZ.js";import{M as pt,c as fe,j as ms,Q as xs,_ as sn,T as _e,p as gs}from"./vendor-arcblock-uz9DVywv.js";import{d as js}from"./Error-jEHdDLNk.js";import{C as ht}from"./confirm-DjTZImyg.js";import{u as Ue}from"./session-CHdTc1We.js";import{W as Ct}from"./did-address-DjwPl1uy.js";import{E as Xe}from"./empty-spinner-n0_Ehns5.js";import{B as Et}from"./bundle-avatar-DYTLzqlT.js";import{S as Ce}from"./shorten-label-Cng55547.js";import{L as Lt}from"./list-header-HqBQs1yn.js";import{$ as ks,A as ue,J as Nt,E as rn}from"./vendor-utils-rHXShPKm.js";import{d as ys}from"./Download-C_LRKzbG.js";import{C as ln}from"./click-to-copy-CFiGx48J.js";import{Q as vs}from"./QuestionMarkCircle-BPVDAm8U.js";import{u as Rs}from"./vendor-hooks-rDgu5KV9.js";import{_ as Pe}from"./useSetState-CWq0AVWn.js";import{c as At}from"./index-DVQCgvFb.js";import{E as zt}from"./index-BYCeMwoO.js";import"./api-BjteVZFg.js";import{d as ws}from"./ChevronRight-a_2_x6Ew.js";import{T as Cs,a as Ss}from"./vendor-mui-x-R-0SFz4c.js";import{d as nt}from"./DeleteOutline-CFN4r-OG.js";import{D as Ro,C as wo,P as Co}from"./react-beautiful-dnd.esm-7PS2VwOi.js";import{c as Ds,A as cn,u as an,S as Is,a as Ts,b as $s,e as Ps,U as _s,f as yt,g as dn,n as qs,h as Es,i as So,k as Ls,l as Ns}from"./item-Bk_1JLeG.js";import{d as As}from"./ArrowDropDown-BrO-zDlb.js";import{f as ge}from"./format-error-BrmqJs5a.js";import{d as un}from"./Launch-B-2Jomi6.js";import{d as pn}from"./Done-DqSE6KPe.js";import{D as zs}from"./delete-confirm-BzuBR6TW.js";import{g as hn}from"./get-safe-url-Bk6PlU7n.js";import{M as Os}from"./index-B8r-LrrM.js";import{r as Ws}from"./index-BDYaw77z.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ot={},Bs=Se;Object.defineProperty(Ot,"__esModule",{value:!0});var fn=Ot.default=void 0,Ms=Bs(Ie()),Us=e;fn=Ot.default=(0,Ms.default)((0,Us.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var Wt={},Vs=Se;Object.defineProperty(Wt,"__esModule",{value:!0});var bn=Wt.default=void 0,Fs=Vs(Ie()),Hs=e;bn=Wt.default=(0,Fs.default)((0,Hs.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Bt={},Gs=Se;Object.defineProperty(Bt,"__esModule",{value:!0});var mn=Bt.default=void 0,Js=Gs(Ie()),Xs=e;mn=Bt.default=(0,Js.default)((0,Xs.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Mt({did:t,projectId:o,title:n,logo:l,describe:i}){const r=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${l}`,[u,a]=x.useState(!1),f=Be(m=>m.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx($t,{sx:{borderRadius:1},src:r}),e.jsxs(c,{children:[e.jsx(Ce,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),e.jsx(Ce,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||u?"primary.main":"grey.700"},children:i||"/"})]})]})}Mt.propTypes={projectId:s.string.isRequired,did:s.string.isRequired,title:s.string.isRequired,logo:s.string.isRequired,describe:s.string.isRequired};function Ut({initUrl:t}){const o=Tt(),n=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:l,locale:i}=Q(),{api:d}=je(),{api:r}=Ue(),[u,a]=x.useState(!0),{blocklet:f}=De(),[m,j]=x.useState(null),[y,h]=x.useState(!1),p=Be(T=>T.breakpoints.down("xl")),v=Be(T=>T.breakpoints.down("md")),{componentDid:w=""}=ct(),[b,k]=x.useState(null),C=`publish-${f.meta.did}`,I=Ko(C),[$,D]=x.useState({searchText:I.searchText||"",pageSize:I.rowsPerPage||10,page:1}),N=()=>{d.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:n}}).then(T=>{const P=(T==null?void 0:T.projects)||[];a(!1),k(P)}).catch(T=>{a(!1),M.error(T.message)})},z=()=>{o(`${Y.UNOWNED_DID}/create/none`,{replace:!0})},E=T=>{j(T)},Z=()=>{a(!1),h(!0)},U=()=>{h(!1),j(null)},R=T=>{M.error(T.message),h(!1),j(null)},g=T=>{if(!(T!=null&&T.deleted)){M.error("Delete project failed");return}N(),h(!1),j(null)};x.useEffect(()=>{N()},[]);const S=x.useMemo(()=>{var P;if(!$.searchText)return b;let T=(P=$.searchText)==null?void 0:P.trim();return T?(T=as.toAddress(T).toLocaleLowerCase(),b.filter(H=>H.blockletTitle.toLowerCase().includes(T)||H.blockletDid.toLowerCase().includes(T))):b},[b,$.searchText]);if(!b&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!b)return null;if(!b.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:l("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:l("blocklet.publish.createBlockletTip")}),e.jsx(qe,{onClick:z,variant:"contained",children:l("blocklet.publish.createBlocklet")})]});const W=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:T=>{const P=b[T];return e.jsx(ye,{to:`${P.id}`,children:e.jsx(Mt,{did:f.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:T=>T?e.jsx(en,{type:"success",children:T}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:T=>T?e.jsx(Ct,{size:14,compact:!0,responsive:!1,did:T}):null}},p||w?null:{label:l("common.createdBy"),name:"createdBy",options:{customBodyRender:T=>T?e.jsx(Ct,{onClick:()=>{o(`/.well-known/service/admin/members?did=${T}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:T}):null}},p||w?null:{label:l("common.scope"),name:"componentDid",options:{customBodyRender:T=>{const P=(f.children||[]).find(H=>H.meta.did===T);return P?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Et,{size:14,blocklet:P,ancestors:[f]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},T):""}}},p||n?null:{label:l("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:T=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Ce,{children:T})})}},{label:l("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:T=>e.jsx(tn,{value:Number(T),locale:i})}},{label:l("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:T=>{const P=b[T];return e.jsxs(c,{display:"flex",children:[e.jsx(ye,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:e.jsx(ke,{title:l("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ae,{color:"primary","aria-label":"create",children:e.jsx(fn,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&e.jsx(ke,{title:l("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:e.jsx(ae,{color:"secondary","aria-label":"create",children:e.jsx(ye,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:e.jsx(bn,{sx:{fontSize:18}})})})}),e.jsx(ke,{title:l("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:e.jsx(ae,{color:"primary","aria-label":"delete",onClick:()=>E(P),children:e.jsx(on,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),B=({page:T,rowsPerPage:P,searchText:H})=>{$.pageSize!==P?D(V=>({...V,searchText:"",pageSize:P,page:1})):$.page!==T+1?D(V=>({...V,searchText:"",page:T+1})):$.searchText!==H&&D(V=>({...V,searchText:H,page:1}))},J=y?e.jsx(ds,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:r.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:g,onError:R,extraParams:{projectId:m.id,did:f.meta.did,name:m.blockletTitle},messages:{title:l("blocklet.publish.deleteProject.title",{name:m.blockletTitle}),scan:l("blocklet.publish.deleteProject.scan",{name:m.blockletTitle}),confirm:l("blocklet.publish.deleteProject.confirm"),success:l("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(Ys,{children:[e.jsx(Lt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:l("common.blockletStudio")}),e.jsx(ke,{title:l("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(mn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(us,{options:{searchPlaceholder:l("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:v},search:$.searchText,searchText:$.searchText,searchTextUpdate:T=>D(P=>({...P,searchText:T})),searchClose:()=>D(T=>({...T,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(qe,{onClick:z,variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),l("blocklet.publish.createBlocklet")]})]})}),e.jsx(qt,{className:"main-table",locale:i,data:S,columns:W,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:C,onChange:B}),m&&e.jsx(ht,{title:`${l("common.delete")} ${m.blockletTitle}`,description:l("blocklet.publish.deleteProject.description"),confirm:l("common.confirm"),onConfirm:Z,onCancel:()=>j(null),children:e.jsx(c,{sx:{marginTop:2},children:[l("blocklet.publish.deleteProject.tip1"),l("blocklet.publish.deleteProject.tip2"),l("blocklet.publish.deleteProject.tip3")].map(T=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(js,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(L,{component:"span",variant:"inherit",color:"text.secondary",children:T})]}))})}),J]})}const Ys=Fn(c)`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B_-kynzD.js","assets/vendor-ux-did-connect-DHrruicZ.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-rHXShPKm.js","assets/vendor-mui-core-D_bnq77o.js","assets/vendor-hooks-rDgu5KV9.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-uz9DVywv.js","assets/index-Bs1kxR8_.js","assets/index-CIkPfxzG.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
+ import{r as x,f as Tt,l as ct,L as ye,g as Mn,u as Un,i as Vn,j as jt}from"./vendor-react-DEoibe3W.js";import{a9 as Se,j as e,v as Be,aa as c,bd as $t,H as s,ad as ke,I as ae,T as L,s as Fn,c7 as Oo,D as at,ah as ve,au as Hn,bS as Ke,ak as dt,bt as et,bx as tt,y as K,ab as we,P as Wo,G as Bo,w as Pt,a7 as Mo,M as Uo,q as be,X as Gn,aj as Vo,t as Fo,bV as Jn,N as Je,z as Ho,O as ne,al as Re,at as Go,L as Jo,A as _t,b6 as Xo,bK as Yo,by as Xn,e as Qo,aq as Yn,b$ as Qn,af as Zn,U as Zo,W as ot,bF as Kn,bG as es,c8 as ts,c9 as os,bo as wt,bp as ns,br as ss,bv as rs,bw as kt}from"./vendor-mui-core-D_bnq77o.js";import{z as je,C as De,ad as ls,a5 as is,f as yo,ae as vo,a9 as cs}from"./index-CIkPfxzG.js";import{r as Ie,j as Y,u as Q,bu as Ko,h as as,B as qe,b7 as en,X as tn,b4 as on,ao as ds,bv as us,a7 as qt,_ as M,a3 as ps,I as de,bw as hs,ba as fs,a as We,am as ut,b5 as bs,as as nn}from"./vendor-ux-did-connect-DHrruicZ.js";import{M as pt,c as fe,j as ms,Q as xs,_ as sn,T as _e,p as gs}from"./vendor-arcblock-uz9DVywv.js";import{d as js}from"./Error-jEHdDLNk.js";import{C as ht}from"./confirm-SdqBW-ti.js";import{u as Ue}from"./session-CHdTc1We.js";import{W as Ct}from"./did-address-DjwPl1uy.js";import{E as Xe}from"./empty-spinner-n0_Ehns5.js";import{B as Et}from"./bundle-avatar-CDJRatFg.js";import{S as Ce}from"./shorten-label-Cng55547.js";import{L as Lt}from"./list-header-HqBQs1yn.js";import{$ as ks,A as ue,J as Nt,E as rn}from"./vendor-utils-rHXShPKm.js";import{d as ys}from"./Download-C_LRKzbG.js";import{C as ln}from"./click-to-copy-CFiGx48J.js";import{Q as vs}from"./QuestionMarkCircle-BPVDAm8U.js";import{u as Rs}from"./vendor-hooks-rDgu5KV9.js";import{_ as Pe}from"./useSetState-CWq0AVWn.js";import{c as At}from"./index-DVQCgvFb.js";import{E as zt}from"./index-BYCeMwoO.js";import"./api-BjteVZFg.js";import{d as ws}from"./ChevronRight-a_2_x6Ew.js";import{T as Cs,a as Ss}from"./vendor-mui-x-R-0SFz4c.js";import{d as nt}from"./DeleteOutline-CFN4r-OG.js";import{D as Ro,C as wo,P as Co}from"./react-beautiful-dnd.esm-7PS2VwOi.js";import{c as Ds,A as cn,u as an,S as Is,a as Ts,b as $s,e as Ps,U as _s,f as yt,g as dn,n as qs,h as Es,i as So,k as Ls,l as Ns}from"./item-D942q-4T.js";import{d as As}from"./ArrowDropDown-BrO-zDlb.js";import{f as ge}from"./format-error-BrmqJs5a.js";import{d as un}from"./Launch-B-2Jomi6.js";import{d as pn}from"./Done-DqSE6KPe.js";import{D as zs}from"./delete-confirm-CKF_eljP.js";import{g as hn}from"./get-safe-url-B5RJTMjC.js";import{M as Os}from"./index-B8r-LrrM.js";import{r as Ws}from"./index-BDYaw77z.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ot={},Bs=Se;Object.defineProperty(Ot,"__esModule",{value:!0});var fn=Ot.default=void 0,Ms=Bs(Ie()),Us=e;fn=Ot.default=(0,Ms.default)((0,Us.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var Wt={},Vs=Se;Object.defineProperty(Wt,"__esModule",{value:!0});var bn=Wt.default=void 0,Fs=Vs(Ie()),Hs=e;bn=Wt.default=(0,Fs.default)((0,Hs.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Bt={},Gs=Se;Object.defineProperty(Bt,"__esModule",{value:!0});var mn=Bt.default=void 0,Js=Gs(Ie()),Xs=e;mn=Bt.default=(0,Js.default)((0,Xs.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Mt({did:t,projectId:o,title:n,logo:l,describe:i}){const r=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${l}`,[u,a]=x.useState(!1),f=Be(m=>m.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx($t,{sx:{borderRadius:1},src:r}),e.jsxs(c,{children:[e.jsx(Ce,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),e.jsx(Ce,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||u?"primary.main":"grey.700"},children:i||"/"})]})]})}Mt.propTypes={projectId:s.string.isRequired,did:s.string.isRequired,title:s.string.isRequired,logo:s.string.isRequired,describe:s.string.isRequired};function Ut({initUrl:t}){const o=Tt(),n=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:l,locale:i}=Q(),{api:d}=je(),{api:r}=Ue(),[u,a]=x.useState(!0),{blocklet:f}=De(),[m,j]=x.useState(null),[y,h]=x.useState(!1),p=Be(T=>T.breakpoints.down("xl")),v=Be(T=>T.breakpoints.down("md")),{componentDid:w=""}=ct(),[b,k]=x.useState(null),C=`publish-${f.meta.did}`,I=Ko(C),[$,D]=x.useState({searchText:I.searchText||"",pageSize:I.rowsPerPage||10,page:1}),N=()=>{d.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:n}}).then(T=>{const P=(T==null?void 0:T.projects)||[];a(!1),k(P)}).catch(T=>{a(!1),M.error(T.message)})},z=()=>{o(`${Y.UNOWNED_DID}/create/none`,{replace:!0})},E=T=>{j(T)},Z=()=>{a(!1),h(!0)},U=()=>{h(!1),j(null)},R=T=>{M.error(T.message),h(!1),j(null)},g=T=>{if(!(T!=null&&T.deleted)){M.error("Delete project failed");return}N(),h(!1),j(null)};x.useEffect(()=>{N()},[]);const S=x.useMemo(()=>{var P;if(!$.searchText)return b;let T=(P=$.searchText)==null?void 0:P.trim();return T?(T=as.toAddress(T).toLocaleLowerCase(),b.filter(H=>H.blockletTitle.toLowerCase().includes(T)||H.blockletDid.toLowerCase().includes(T))):b},[b,$.searchText]);if(!b&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!b)return null;if(!b.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:l("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:l("blocklet.publish.createBlockletTip")}),e.jsx(qe,{onClick:z,variant:"contained",children:l("blocklet.publish.createBlocklet")})]});const W=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:T=>{const P=b[T];return e.jsx(ye,{to:`${P.id}`,children:e.jsx(Mt,{did:f.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:T=>T?e.jsx(en,{type:"success",children:T}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:T=>T?e.jsx(Ct,{size:14,compact:!0,responsive:!1,did:T}):null}},p||w?null:{label:l("common.createdBy"),name:"createdBy",options:{customBodyRender:T=>T?e.jsx(Ct,{onClick:()=>{o(`/.well-known/service/admin/members?did=${T}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:T}):null}},p||w?null:{label:l("common.scope"),name:"componentDid",options:{customBodyRender:T=>{const P=(f.children||[]).find(H=>H.meta.did===T);return P?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Et,{size:14,blocklet:P,ancestors:[f]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},T):""}}},p||n?null:{label:l("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:T=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Ce,{children:T})})}},{label:l("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:T=>e.jsx(tn,{value:Number(T),locale:i})}},{label:l("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:T=>{const P=b[T];return e.jsxs(c,{display:"flex",children:[e.jsx(ye,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:e.jsx(ke,{title:l("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ae,{color:"primary","aria-label":"create",children:e.jsx(fn,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&e.jsx(ke,{title:l("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:e.jsx(ae,{color:"secondary","aria-label":"create",children:e.jsx(ye,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:e.jsx(bn,{sx:{fontSize:18}})})})}),e.jsx(ke,{title:l("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:e.jsx(ae,{color:"primary","aria-label":"delete",onClick:()=>E(P),children:e.jsx(on,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),B=({page:T,rowsPerPage:P,searchText:H})=>{$.pageSize!==P?D(V=>({...V,searchText:"",pageSize:P,page:1})):$.page!==T+1?D(V=>({...V,searchText:"",page:T+1})):$.searchText!==H&&D(V=>({...V,searchText:H,page:1}))},J=y?e.jsx(ds,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:r.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:g,onError:R,extraParams:{projectId:m.id,did:f.meta.did,name:m.blockletTitle},messages:{title:l("blocklet.publish.deleteProject.title",{name:m.blockletTitle}),scan:l("blocklet.publish.deleteProject.scan",{name:m.blockletTitle}),confirm:l("blocklet.publish.deleteProject.confirm"),success:l("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(Ys,{children:[e.jsx(Lt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:l("common.blockletStudio")}),e.jsx(ke,{title:l("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(mn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(us,{options:{searchPlaceholder:l("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:v},search:$.searchText,searchText:$.searchText,searchTextUpdate:T=>D(P=>({...P,searchText:T})),searchClose:()=>D(T=>({...T,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(qe,{onClick:z,variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),l("blocklet.publish.createBlocklet")]})]})}),e.jsx(qt,{className:"main-table",locale:i,data:S,columns:W,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:C,onChange:B}),m&&e.jsx(ht,{title:`${l("common.delete")} ${m.blockletTitle}`,description:l("blocklet.publish.deleteProject.description"),confirm:l("common.confirm"),onConfirm:Z,onCancel:()=>j(null),children:e.jsx(c,{sx:{marginTop:2},children:[l("blocklet.publish.deleteProject.tip1"),l("blocklet.publish.deleteProject.tip2"),l("blocklet.publish.deleteProject.tip3")].map(T=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(js,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(L,{component:"span",variant:"inherit",color:"text.secondary",children:T})]}))})}),J]})}const Ys=Fn(c)`
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 x,f as Tt,l as ct,L as ye,g as Mn,u as Un,i as Vn,j as jt}from"./ven
142
142
  background: #fff;
143
143
  z-index: 10;
144
144
  }
145
- `;var Zt={},Sr=Se;Object.defineProperty(Zt,"__esModule",{value:!0});var St=Zt.default=void 0,Dr=Sr(Ie()),Ir=e;St=Zt.default=(0,Dr.default)((0,Ir.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");const Po="lastWantToConnectStoreId";function Tr(t){var u,a;const[o,n]=x.useState(null),{session:l}=Ue(),i=x.useCallback(f=>{n(f),localStorage.setItem(Po,f==null?void 0:f.id)},[n]),d=x.useMemo(()=>{var y,h,p,v;const f=localStorage.getItem(Po),m=f?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(w=>w.id===f):null;if(m)return m;let j=(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(w=>{var b;return!(w.id!==Y.BLOCKLET_STORE.id||w.scope&&w.scope!=="studio"&&w.scope!==((b=l==null?void 0:l.user)==null?void 0:b.did))});return j||(j=(v=(p=t==null?void 0:t.settings)==null?void 0:p.storeList)==null?void 0:v[0]),j},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=l==null?void 0:l.user)==null?void 0:a.did]);return[o||d||{},i]}const Rt={};async function Kt(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:l=4e3,timerKey:i=""}){Rt[i]&&clearTimeout(Rt[i]),await new Promise(u=>setTimeout(u,l));const d=Date.now(),r=async(u,a)=>{try{const f=await t();u(f)}catch(f){Date.now()-d>n?a(f):i?Rt[i]=setTimeout(()=>r(u,a),o):setTimeout(()=>r(u,a),o)}};return new Promise(r)}function $r(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Pr(t,{did:o,projectId:n,messageId:l}){return Kt(async()=>{var d;const i=await t.getProject({input:{did:o,projectId:n,messageId:l}});if(!((d=i==null?void 0:i.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return i.project.blockletDid},{timerKey:"connect-studio"})}function _r(t,{did:o,projectId:n,storeId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(a=>a.storeId===l))throw new Error("Connected store not found")},{timerKey:`connect-store-${l}`})}function qr(t,{did:o,projectId:n,endpointId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(a=>a.endpointId===l))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${l}`})}const Er=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:l})=>{var r,u;const i=t?(r=n==null?void 0:n.meta)==null?void 0:r.did:o==null?void 0:o.did;let d=t?((u=n==null?void 0:n.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===l),{teamDid:i,storeList:d}},eo=Er;function to({blocklet:t,store:o={},onChangeStore:n,onClick:l,disabled:i,loading:d,componentDid:r}){var R,g,S;const{t:u}=Q(),{session:a}=Ue(),{api:f,info:m,inService:j}=je(),y=De(),[h,p]=x.useState(!1),v=x.useRef(null),[w,b]=x.useState(!1),[k,C]=x.useState(null),I=W=>{n(W),p(!1)},$=()=>{p(!h)},D=W=>{v.current&&v.current.contains(W.target)||p(!1)},N=()=>{b(!0)},z=()=>{b(!1)},E=async()=>{var W;if(k)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:k.url,projectId:"",scope:k.scope||"studio"}}),await((W=y==null?void 0:y.actions)==null?void 0:W.refreshBlocklet())}catch(B){M.error(`Remove Blocklet Store Error: ${ge(B)}`)}finally{C(null)}},{storeList:Z}=eo({fromBlocklet:j,blocklet:t,nodeInfo:m,componentDid:r,userDid:(R=a==null?void 0:a.user)==null?void 0:R.did}),U=(g=t==null?void 0:t.meta)==null?void 0:g.did;return e.jsxs(e.Fragment,{children:[e.jsxs(tt,{disabled:i,ref:v,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(K,{onClick:l,children:[d&&e.jsx(we,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(K,{size:"small","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:$,children:e.jsx(As,{})})]}),e.jsx(Wo,{sx:{zIndex:10},open:h,anchorEl:v.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:W})=>e.jsx(Bo,{...W,style:{transformOrigin:"center top"},children:e.jsx(Pt,{children:e.jsx(Mo,{onClickAway:D,children:e.jsxs(Uo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[Z==null?void 0:Z.map(B=>{var J;return e.jsxs(be,{selected:B.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>I(B),children:[e.jsxs(c,{children:[e.jsx(Ce,{sx:{fontSize:"16px"},maxLength:24,children:B.name}),e.jsx(Ce,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:B.url})]}),Ds({store:B,userDid:(J=a==null?void 0:a.user)==null?void 0:J.did})&&e.jsx(ae,{sx:{ml:1},onClick:T=>{T.preventDefault(),T.stopPropagation(),C(B)},children:e.jsx(de,{icon:"ic:outline-delete"})})]},B.url)}),e.jsx(Gn,{}),e.jsxs(be,{onClick:N,children:[e.jsx(pt,{font:!0}),e.jsx(L,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),w&&e.jsx(cn,{hiddenChildren:!0,open:!0,onClose:z,teamDid:U,storeList:Z,scope:"studio",onAdd:(S=y==null?void 0:y.actions)==null?void 0:S.refreshBlocklet}),k&&e.jsx(ht,{displayError:!0,title:`${u("common.delete")} ${k.name}`,description:u("blocklet.publish.deleteStoreTip",{name:k.name}),confirm:u("common.confirm"),onConfirm:E,onCancel:()=>C(null)})]})}to.propTypes={store:s.object,blocklet:s.object,onChangeStore:s.func.isRequired,onClick:s.func.isRequired,loading:s.bool.isRequired,disabled:s.bool.isRequired,componentDid:s.string.isRequired,projectType:s.string.isRequired,getData:s.func.isRequired};to.defaultProps={store:null,blocklet:null};const Lr=(t,o,n)=>{const l=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${l}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,r=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:d,screenshotUrls:r,uploadLogoPrefix:l,uploadScreenshotPrefix:i}},Rn=Lr,Nr=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");return o||n};function ft({url:t,style:o,controls:n,modestbranding:l}){var u;const{t:i}=Q(),d=t.includes("youtube.com")||t.includes("youtu.be"),r=t.includes("vimeo.com");if(d){const a=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${a}?modestbranding=${l}&controls=${n}&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(r){const a=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/${a}`,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(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{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(de,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(L,{variant:"body1",sx:{opacity:.5},children:i("studio.videoDialogNoSrc")})]})})}ft.propTypes={url:s.string.isRequired,style:s.object,controls:s.number,modestbranding:s.number};ft.defaultProps={style:{},controls:1,modestbranding:1};function wn({setParams:t,onClose:o,params:n}){const{t:l}=Q(),[i,d]=x.useState(""),r=i&&n.blockletVideos.includes(i),u=Nr(i),a=()=>{t(f=>{const m=[...f.blockletVideos];return m.push(i),{...f,blockletVideos:m}}),o()};return e.jsxs(at,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Vo,{children:l("studio.videoDialogTitle")}),e.jsxs(Fo,{children:[e.jsx(Jn,{fullWidth:!0,value:i,onChange:f=>d(f.target.value),placeholder:l("studio.videoInputLabel"),endAdornment:i?e.jsx(Je,{position:"end",children:e.jsx(ae,{onClick:()=>d(""),children:e.jsx(fs,{})})}):null,error:r}),r&&e.jsx(L,{variant:"body2",color:"error",children:l("studio.duplicateVideo")}),e.jsx(ft,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Ho,{children:[e.jsx(K,{onClick:()=>o(),children:l("studio.cancel")}),e.jsx(K,{disabled:!u||r,onClick:a,children:l("studio.confirm")})]})]})}wn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Dt({errors:t,storeList:o,...n}){const{t:l}=Q();return e.jsxs(c,{...n,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(L,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:l("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([i,d])=>{const r=Object.values(d),u=o.find(a=>a.url===i);return r.length>0&&e.jsxs(c,{children:[e.jsx(ke,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),r.map(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},i)})]})}Dt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const _o=x.lazy(()=>sn(()=>import("./index-Btl_rz0J.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function Cn({projectId:t,readOnly:o,loading:n,blocklet:l,params:i,setParams:d,paramsErrTip:r,setParamsErrTip:u,warning:a,setLoading:f,initUrl:m,initLogoUrl:j,setInitLogoUrl:y,componentDid:h}){const{t:p,locale:v}=Q(),{api:w}=je(),b=Tt(),k=x.useRef(null),C=x.useRef(null),[I,$]=Tr(l),[D,N]=x.useState(!1),z=an({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),E=async q=>{const F=setTimeout(()=>{f(!1)},2e4),X=await Pr(w,q);f(!1),clearTimeout(F),window.parent.postMessage({event:"studioDialog.connected",componentDid:h},"*"),b(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},Z=()=>{if(!i.blockletTitle){M.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(I!=null&&I.url)){M.error(p("blocklet.publish.noStoreSelected"));return}const q=$r();z(async(F,X)=>{var te,oe,ce;try{const ee=await w.connectByStudio({input:{did:(te=l==null?void 0:l.meta)==null?void 0:te.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:I.url,storeId:I.id,storeName:I.name,type:((oe=i==null?void 0:i.blockletComponents)==null?void 0:oe.length)>0?"pack":"resource",componentDid:h,messageId:q,tenantScope:(m==null?void 0:m.searchParams.get("tenantScope"))||""}});if(!(ee!=null&&ee.url)){M.error("failed to connect to store");return}X(ee.url),E({did:(ce=l==null?void 0:l.meta)==null?void 0:ce.did,projectId:"",messageId:q})}catch(ee){const pe=ge(ee);M.error(pe),f(!1)}})},{logoUrl:U,screenshotUrls:R,uploadLogoPrefix:g,uploadScreenshotPrefix:S}=Rn(i,l,t),{logoErrors:W,screenshotErrors:B,storeList:J,hasLogoWarning:T,hasScreenshotWarning:P}=a,H=()=>o?!1:!t||t===Y.UNOWNED_DID?(M.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,V=q=>{if(!q.destination)return;const F=Array.from(i.blockletScreenshots),[X]=F.splice(q.source.index,1);F.splice(q.destination.index,0,X),d(te=>({...te,blockletScreenshots:F}))},le=q=>{if(!q.destination)return;const F=Array.from(i.blockletVideos),[X]=F.splice(q.source.index,1);F.splice(q.destination.index,0,X),d(te=>({...te,blockletVideos:F}))};return e.jsxs(Ar,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:i.blockletTitle||"",onChange:q=>{u({blockletTitle:""}),d({blockletTitle:q.target.value})},error:!!r.blockletTitle,helperText:r.blockletTitle||""}),e.jsx(ne,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===Y.UNOWNED_DID&&e.jsx(Je,{position:"end",children:e.jsx(to,{blocklet:l,store:I,componentDid:h,onChangeStore:$,disabled:!i.blockletTitle||o||n,loading:n,onClick:Z})})},error:!!r.projectId,helperText:r.projectId||"",value:t===Y.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletDescription||"",onChange:q=>{u({blockletDescription:""}),d({blockletDescription:q.target.value})},error:!!r.blockletDescription,helperText:r.blockletDescription||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletHomepage||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?u({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:q.target.value})},error:!!r.blockletHomepage,helperText:r.blockletHomepage||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletCommunity||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?u({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:q.target.value})},error:!!r.blockletCommunity,helperText:r.blockletCommunity||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.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)?u({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:q.target.value})},error:!!r.blockletSupport,helperText:r.blockletSupport||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletRepository||"",onChange:q=>{q.target.value&&!/^(git|https|svn)/.test(q.target.value)?u({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:q.target.value})},error:!!r.blockletRepository,helperText:r.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),e.jsxs(Re,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx($t,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:j||U,onClick:()=>{var q;H()&&((q=k.current)==null||q.open())}})})]}),T&&e.jsx(Dt,{errors:W,storeList:J,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),e.jsxs(Re,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:V,children:e.jsx(wo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(q,F)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:F.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:F.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:q.innerRef,...q.droppableProps,children:[R.map((X,te)=>e.jsx(Co,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ce)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ce.isDragging?"scale(1.05)":"none",boxShadow:ce.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:X}),!o&&e.jsx(ae,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ae,{className:"action",onClick:()=>{d(ee=>{const pe=[...ee.blockletScreenshots];return pe.splice(te,1),{...ee,blockletScreenshots:pe}})},children:e.jsx(nt,{})})]})},X)),q.placeholder,R.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var X;H()&&((X=C.current)==null||X.open())},children:"+"})]})})})]}),P&&e.jsx(Dt,{errors:B,storeList:J}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),e.jsxs(Re,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.videoType"),":"," "]}),e.jsxs(c,{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(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:le,children:e.jsx(wo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(q,F)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:F.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:F.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:q.innerRef,...q.droppableProps,children:[i.blockletVideos.map((X,te)=>e.jsx(Co,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ce)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ce.isDragging?"scale(1.05)":"none",boxShadow:ce.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(ft,{url:X,style:{pointerEvents:ce.isDragging?"none":"auto"}}),!o&&e.jsx(ae,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ae,{className:"action",onClick:()=>{d(ee=>{const pe=[...ee.blockletVideos];return pe.splice(te,1),{...ee,blockletVideos:pe}})},children:e.jsx(nt,{})})]})},X)),q.placeholder,i.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{H()&&N(!0)},children:"+"})]})})})]})]})}),e.jsxs(x.Suspense,{fallback:e.jsx(Xe,{}),children:[e.jsx(_o,{ref:k,locale:v,popup:!0,onUploadFinish:q=>{var F;d({blockletLogo:q.data.filename}),y(""),(F=k.current)==null||F.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:g,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"),D&&e.jsx(wn,{onClose:()=>N(!1),params:i,setParams:d}),e.jsx(_o,{ref:C,locale:v,popup:!0,onUploadFinish:q=>{var F;d(X=>{var oe;const te=X.blockletScreenshots||[];return te.push((oe=q.data)==null?void 0:oe.filename),{...X,blockletScreenshots:te}}),(F=C.current)==null||F.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-R.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")]})]})}Cn.propTypes={projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,setLoading:s.func.isRequired,initUrl:s.object.isRequired,componentDid:s.isRequired,initLogoUrl:s.string.isRequired,setInitLogoUrl:s.func.isRequired};const Ar=ve.div`
145
+ `;var Zt={},Sr=Se;Object.defineProperty(Zt,"__esModule",{value:!0});var St=Zt.default=void 0,Dr=Sr(Ie()),Ir=e;St=Zt.default=(0,Dr.default)((0,Ir.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");const Po="lastWantToConnectStoreId";function Tr(t){var u,a;const[o,n]=x.useState(null),{session:l}=Ue(),i=x.useCallback(f=>{n(f),localStorage.setItem(Po,f==null?void 0:f.id)},[n]),d=x.useMemo(()=>{var y,h,p,v;const f=localStorage.getItem(Po),m=f?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(w=>w.id===f):null;if(m)return m;let j=(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(w=>{var b;return!(w.id!==Y.BLOCKLET_STORE.id||w.scope&&w.scope!=="studio"&&w.scope!==((b=l==null?void 0:l.user)==null?void 0:b.did))});return j||(j=(v=(p=t==null?void 0:t.settings)==null?void 0:p.storeList)==null?void 0:v[0]),j},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=l==null?void 0:l.user)==null?void 0:a.did]);return[o||d||{},i]}const Rt={};async function Kt(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:l=4e3,timerKey:i=""}){Rt[i]&&clearTimeout(Rt[i]),await new Promise(u=>setTimeout(u,l));const d=Date.now(),r=async(u,a)=>{try{const f=await t();u(f)}catch(f){Date.now()-d>n?a(f):i?Rt[i]=setTimeout(()=>r(u,a),o):setTimeout(()=>r(u,a),o)}};return new Promise(r)}function $r(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Pr(t,{did:o,projectId:n,messageId:l}){return Kt(async()=>{var d;const i=await t.getProject({input:{did:o,projectId:n,messageId:l}});if(!((d=i==null?void 0:i.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return i.project.blockletDid},{timerKey:"connect-studio"})}function _r(t,{did:o,projectId:n,storeId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(a=>a.storeId===l))throw new Error("Connected store not found")},{timerKey:`connect-store-${l}`})}function qr(t,{did:o,projectId:n,endpointId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(a=>a.endpointId===l))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${l}`})}const Er=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:l})=>{var r,u;const i=t?(r=n==null?void 0:n.meta)==null?void 0:r.did:o==null?void 0:o.did;let d=t?((u=n==null?void 0:n.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===l),{teamDid:i,storeList:d}},eo=Er;function to({blocklet:t,store:o={},onChangeStore:n,onClick:l,disabled:i,loading:d,componentDid:r}){var R,g,S;const{t:u}=Q(),{session:a}=Ue(),{api:f,info:m,inService:j}=je(),y=De(),[h,p]=x.useState(!1),v=x.useRef(null),[w,b]=x.useState(!1),[k,C]=x.useState(null),I=W=>{n(W),p(!1)},$=()=>{p(!h)},D=W=>{v.current&&v.current.contains(W.target)||p(!1)},N=()=>{b(!0)},z=()=>{b(!1)},E=async()=>{var W;if(k)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:k.url,projectId:"",scope:k.scope||"studio"}}),await((W=y==null?void 0:y.actions)==null?void 0:W.refreshBlocklet())}catch(B){M.error(`Remove Blocklet Store Error: ${ge(B)}`)}finally{C(null)}},{storeList:Z}=eo({fromBlocklet:j,blocklet:t,nodeInfo:m,componentDid:r,userDid:(R=a==null?void 0:a.user)==null?void 0:R.did}),U=(g=t==null?void 0:t.meta)==null?void 0:g.did;return e.jsxs(e.Fragment,{children:[e.jsxs(tt,{disabled:i,ref:v,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(K,{onClick:l,children:[d&&e.jsx(we,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(K,{size:"small","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:$,children:e.jsx(As,{})})]}),e.jsx(Wo,{sx:{zIndex:10},open:h,anchorEl:v.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:W})=>e.jsx(Bo,{...W,style:{transformOrigin:"center top"},children:e.jsx(Pt,{children:e.jsx(Mo,{onClickAway:D,children:e.jsxs(Uo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[Z==null?void 0:Z.map(B=>{var J;return e.jsxs(be,{selected:B.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>I(B),children:[e.jsxs(c,{children:[e.jsx(Ce,{sx:{fontSize:"16px"},maxLength:24,children:B.name}),e.jsx(Ce,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:B.url})]}),Ds({store:B,userDid:(J=a==null?void 0:a.user)==null?void 0:J.did})&&e.jsx(ae,{sx:{ml:1},onClick:T=>{T.preventDefault(),T.stopPropagation(),C(B)},children:e.jsx(de,{icon:"ic:outline-delete"})})]},B.url)}),e.jsx(Gn,{}),e.jsxs(be,{onClick:N,children:[e.jsx(pt,{font:!0}),e.jsx(L,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),w&&e.jsx(cn,{hiddenChildren:!0,open:!0,onClose:z,teamDid:U,storeList:Z,scope:"studio",onAdd:(S=y==null?void 0:y.actions)==null?void 0:S.refreshBlocklet}),k&&e.jsx(ht,{displayError:!0,title:`${u("common.delete")} ${k.name}`,description:u("blocklet.publish.deleteStoreTip",{name:k.name}),confirm:u("common.confirm"),onConfirm:E,onCancel:()=>C(null)})]})}to.propTypes={store:s.object,blocklet:s.object,onChangeStore:s.func.isRequired,onClick:s.func.isRequired,loading:s.bool.isRequired,disabled:s.bool.isRequired,componentDid:s.string.isRequired,projectType:s.string.isRequired,getData:s.func.isRequired};to.defaultProps={store:null,blocklet:null};const Lr=(t,o,n)=>{const l=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${l}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,r=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:d,screenshotUrls:r,uploadLogoPrefix:l,uploadScreenshotPrefix:i}},Rn=Lr,Nr=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");return o||n};function ft({url:t,style:o,controls:n,modestbranding:l}){var u;const{t:i}=Q(),d=t.includes("youtube.com")||t.includes("youtu.be"),r=t.includes("vimeo.com");if(d){const a=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${a}?modestbranding=${l}&controls=${n}&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(r){const a=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/${a}`,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(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{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(de,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(L,{variant:"body1",sx:{opacity:.5},children:i("studio.videoDialogNoSrc")})]})})}ft.propTypes={url:s.string.isRequired,style:s.object,controls:s.number,modestbranding:s.number};ft.defaultProps={style:{},controls:1,modestbranding:1};function wn({setParams:t,onClose:o,params:n}){const{t:l}=Q(),[i,d]=x.useState(""),r=i&&n.blockletVideos.includes(i),u=Nr(i),a=()=>{t(f=>{const m=[...f.blockletVideos];return m.push(i),{...f,blockletVideos:m}}),o()};return e.jsxs(at,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Vo,{children:l("studio.videoDialogTitle")}),e.jsxs(Fo,{children:[e.jsx(Jn,{fullWidth:!0,value:i,onChange:f=>d(f.target.value),placeholder:l("studio.videoInputLabel"),endAdornment:i?e.jsx(Je,{position:"end",children:e.jsx(ae,{onClick:()=>d(""),children:e.jsx(fs,{})})}):null,error:r}),r&&e.jsx(L,{variant:"body2",color:"error",children:l("studio.duplicateVideo")}),e.jsx(ft,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Ho,{children:[e.jsx(K,{onClick:()=>o(),children:l("studio.cancel")}),e.jsx(K,{disabled:!u||r,onClick:a,children:l("studio.confirm")})]})]})}wn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Dt({errors:t,storeList:o,...n}){const{t:l}=Q();return e.jsxs(c,{...n,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(L,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:l("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([i,d])=>{const r=Object.values(d),u=o.find(a=>a.url===i);return r.length>0&&e.jsxs(c,{children:[e.jsx(ke,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),r.map(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},i)})]})}Dt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const _o=x.lazy(()=>sn(()=>import("./index-B_-kynzD.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function Cn({projectId:t,readOnly:o,loading:n,blocklet:l,params:i,setParams:d,paramsErrTip:r,setParamsErrTip:u,warning:a,setLoading:f,initUrl:m,initLogoUrl:j,setInitLogoUrl:y,componentDid:h}){const{t:p,locale:v}=Q(),{api:w}=je(),b=Tt(),k=x.useRef(null),C=x.useRef(null),[I,$]=Tr(l),[D,N]=x.useState(!1),z=an({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),E=async q=>{const F=setTimeout(()=>{f(!1)},2e4),X=await Pr(w,q);f(!1),clearTimeout(F),window.parent.postMessage({event:"studioDialog.connected",componentDid:h},"*"),b(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},Z=()=>{if(!i.blockletTitle){M.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(I!=null&&I.url)){M.error(p("blocklet.publish.noStoreSelected"));return}const q=$r();z(async(F,X)=>{var te,oe,ce;try{const ee=await w.connectByStudio({input:{did:(te=l==null?void 0:l.meta)==null?void 0:te.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:I.url,storeId:I.id,storeName:I.name,type:((oe=i==null?void 0:i.blockletComponents)==null?void 0:oe.length)>0?"pack":"resource",componentDid:h,messageId:q,tenantScope:(m==null?void 0:m.searchParams.get("tenantScope"))||""}});if(!(ee!=null&&ee.url)){M.error("failed to connect to store");return}X(ee.url),E({did:(ce=l==null?void 0:l.meta)==null?void 0:ce.did,projectId:"",messageId:q})}catch(ee){const pe=ge(ee);M.error(pe),f(!1)}})},{logoUrl:U,screenshotUrls:R,uploadLogoPrefix:g,uploadScreenshotPrefix:S}=Rn(i,l,t),{logoErrors:W,screenshotErrors:B,storeList:J,hasLogoWarning:T,hasScreenshotWarning:P}=a,H=()=>o?!1:!t||t===Y.UNOWNED_DID?(M.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,V=q=>{if(!q.destination)return;const F=Array.from(i.blockletScreenshots),[X]=F.splice(q.source.index,1);F.splice(q.destination.index,0,X),d(te=>({...te,blockletScreenshots:F}))},le=q=>{if(!q.destination)return;const F=Array.from(i.blockletVideos),[X]=F.splice(q.source.index,1);F.splice(q.destination.index,0,X),d(te=>({...te,blockletVideos:F}))};return e.jsxs(Ar,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:i.blockletTitle||"",onChange:q=>{u({blockletTitle:""}),d({blockletTitle:q.target.value})},error:!!r.blockletTitle,helperText:r.blockletTitle||""}),e.jsx(ne,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===Y.UNOWNED_DID&&e.jsx(Je,{position:"end",children:e.jsx(to,{blocklet:l,store:I,componentDid:h,onChangeStore:$,disabled:!i.blockletTitle||o||n,loading:n,onClick:Z})})},error:!!r.projectId,helperText:r.projectId||"",value:t===Y.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletDescription||"",onChange:q=>{u({blockletDescription:""}),d({blockletDescription:q.target.value})},error:!!r.blockletDescription,helperText:r.blockletDescription||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletHomepage||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?u({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:q.target.value})},error:!!r.blockletHomepage,helperText:r.blockletHomepage||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletCommunity||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?u({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:q.target.value})},error:!!r.blockletCommunity,helperText:r.blockletCommunity||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.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)?u({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:q.target.value})},error:!!r.blockletSupport,helperText:r.blockletSupport||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletRepository||"",onChange:q=>{q.target.value&&!/^(git|https|svn)/.test(q.target.value)?u({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:q.target.value})},error:!!r.blockletRepository,helperText:r.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),e.jsxs(Re,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx($t,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:j||U,onClick:()=>{var q;H()&&((q=k.current)==null||q.open())}})})]}),T&&e.jsx(Dt,{errors:W,storeList:J,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),e.jsxs(Re,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:V,children:e.jsx(wo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(q,F)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:F.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:F.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:q.innerRef,...q.droppableProps,children:[R.map((X,te)=>e.jsx(Co,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ce)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ce.isDragging?"scale(1.05)":"none",boxShadow:ce.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:X}),!o&&e.jsx(ae,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ae,{className:"action",onClick:()=>{d(ee=>{const pe=[...ee.blockletScreenshots];return pe.splice(te,1),{...ee,blockletScreenshots:pe}})},children:e.jsx(nt,{})})]})},X)),q.placeholder,R.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var X;H()&&((X=C.current)==null||X.open())},children:"+"})]})})})]}),P&&e.jsx(Dt,{errors:B,storeList:J}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),e.jsxs(Re,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.videoType"),":"," "]}),e.jsxs(c,{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(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:le,children:e.jsx(wo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(q,F)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:F.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:F.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:q.innerRef,...q.droppableProps,children:[i.blockletVideos.map((X,te)=>e.jsx(Co,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ce)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ce.isDragging?"scale(1.05)":"none",boxShadow:ce.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(ft,{url:X,style:{pointerEvents:ce.isDragging?"none":"auto"}}),!o&&e.jsx(ae,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ae,{className:"action",onClick:()=>{d(ee=>{const pe=[...ee.blockletVideos];return pe.splice(te,1),{...ee,blockletVideos:pe}})},children:e.jsx(nt,{})})]})},X)),q.placeholder,i.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{H()&&N(!0)},children:"+"})]})})})]})]})}),e.jsxs(x.Suspense,{fallback:e.jsx(Xe,{}),children:[e.jsx(_o,{ref:k,locale:v,popup:!0,onUploadFinish:q=>{var F;d({blockletLogo:q.data.filename}),y(""),(F=k.current)==null||F.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:g,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"),D&&e.jsx(wn,{onClose:()=>N(!1),params:i,setParams:d}),e.jsx(_o,{ref:C,locale:v,popup:!0,onUploadFinish:q=>{var F;d(X=>{var oe;const te=X.blockletScreenshots||[];return te.push((oe=q.data)==null?void 0:oe.filename),{...X,blockletScreenshots:te}}),(F=C.current)==null||F.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-R.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")]})]})}Cn.propTypes={projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,setLoading:s.func.isRequired,initUrl:s.object.isRequired,componentDid:s.isRequired,initLogoUrl:s.string.isRequired,setInitLogoUrl:s.func.isRequired};const Ar=ve.div`
146
146
  margin-top: 24px;
147
147
  .screenshot {
148
148
  margin-bottom: 16px;
@@ -190,7 +190,7 @@ import{r as x,f as Tt,l as ct,L as ye,g as Mn,u as Un,i as Vn,j as jt}from"./ven
190
190
  padding-bottom: 12px;
191
191
  border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
192
192
  }
193
- `;function Pn({text:t}){const{palette:o}=Qo();return t?e.jsx(Os,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:gs.sanitize(t),rehypePlugins:[[Ws,{target:"_blank"}]]}):e.jsx(Me,{Icon:zt})}Pn.propTypes={text:s.string.isRequired};function _n({params:t,setParams:o,paramsErrTip:n,loading:l,setParamsErrTip:i,readOnly:d}){var m;const{t:r}=Q(),[u,a]=x.useState(d?"preview":"write"),f=(j,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(L,{variant:"h6",fontWeight:"bold",sx:{},children:r("common.introduction")}),e.jsxs(Zo,{value:u,onChange:f,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(ne,{disabled:l||d,sx:{border:"none"},placeholder:`Blocklet ${r("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Je,{position:"end",children:[((m=t==null?void 0:t.blockletIntroduction)==null?void 0:m.length)||0," / ",fe.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:j=>{i({blockletIntroduction:""}),o({blockletIntroduction:j.target.value.slice(0,fe.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(Pn,{text:t.blockletIntroduction||""})})]})}_n.propTypes={params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired};var uo={},Xr=Se;Object.defineProperty(uo,"__esModule",{value:!0});var It=uo.default=void 0,Yr=Xr(Ie()),Lo=e;It=uo.default=(0,Yr.default)([(0,Lo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Lo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function po({step:t,ok:o,active:n,error:l,warning:i}){let d="grey.500",r=t+1;return o&&(r=e.jsx(pn,{sx:{fontSize:18,margin:0},color:"white"})),l||!o&&n>t?(d="error.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):i?(d="warning.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):n>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:r})}po.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};po.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function qn({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:l,params:i,loading:d,paramsErrTip:r,warning:u,viewMode:a,projectId:f}){const{t:m}=Q(),j=()=>{n(v=>v+1)},y=()=>{n(v=>v-1)},h=v=>v===0?(r==null?void 0:r.blockletTitle)||(r==null?void 0:r.projectId)||(r==null?void 0:r.blockletDescription)||(r==null?void 0:r.blockletHomepage)||(r==null?void 0:r.blockletSupport)||(r==null?void 0:r.blockletCommunity)||(r==null?void 0:r.blockletRepository):v===2?(r==null?void 0:r.blockletResource)||(r==null?void 0:r.blockletDocker)||(r==null?void 0:r.dockerImageName):v>=4?(r==null?void 0:r.blockletVersion)||(r==null?void 0:r.note):"",p=a||Dn({hasSelectedResources:l,params:i,projectId:f,t:m})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(Kn,{activeStep:o,orientation:"vertical",children:t.map((v,w)=>{const b={},k=d||!Fr({hasSelectedResources:l,params:i,projectId:f,step:w,t:m}),C=d?"":h(w);return C&&(b.optional=e.jsx(L,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:C}),b.error=!0),e.jsxs(es,{children:[e.jsx(ts,{icon:e.jsx(po,{error:C,warning:w===0?u.hasWarning:!1,active:p?99:o,step:w,ok:k}),sx:{cursor:"pointer",color:C?"error.main":"inherit"},disabled:!1,onClick:()=>n(w),...b,children:e.jsx(L,{fontSize:"14px",fontWeight:"500",color:C||!k&&o>w?"error.main":"inherit",children:v.label})}),e.jsxs(os,{children:[e.jsx(L,{fontSize:12,children:v.description}),!p&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[w<t.length-1&&e.jsx(K,{variant:"contained",onClick:j,sx:{mt:1,mr:1},disabled:C||!k,children:m("common.continue")}),w>0&&e.jsx(K,{disabled:w===0,onClick:y,sx:{mt:1,mr:1},children:m("common.back")})]})})]})]},v.label)})}),o>=t.length-1&&e.jsx(Pt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(L,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}qn.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.string.isRequired,loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.bool.isRequired,warning:s.object.isRequired,paramsErrTip:s.shape({projectId:s.string,blockletVersion:s.string,blockletTitle:s.string,blockletDescription:s.string,note:s.string,blockletResource:s.string,blockletHomepage:s.string,blockletSupport:s.string,blockletCommunity:s.string,blockletRepository:s.string,blockletDocker:s.object,dockerImageName:s.string}).isRequired};const Qr=[".zip",".gz"],Zr=1024*1024*100,Kr=x.lazy(()=>sn(()=>import("./index-Btl_rz0J.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ho({app:t,projectId:o,readOnly:n,params:l,setParams:i,setParamsErrTip:d,error:r}){const{t:u,locale:a}=Q(),f=x.useRef(null),m=()=>n?!1:!o||o===Y.UNOWNED_DID?(M.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,j=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(L,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(Re,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!l.uploadedResource&&e.jsx(L,{component:"a",href:`${j}/params.uploadedResource`,children:l.uploadedResource}),!n&&e.jsx(K,{variant:"outlined",size:"small",onClick:()=>{var y;m()&&((y=f.current)==null||y.open())},children:l.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(x.Suspense,{fallback:e.jsx(Xe,{}),children:e.jsx(Kr,{ref:f,locale:a,popup:!0,onUploadFinish:y=>{var h;i({uploadedResource:y.data.filename}),d({blockletResource:""}),(h=f.current)==null||h.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:j,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Qr,maxFileSize:Zr,maxNumberOfFiles:1}}},"uploader-resource")}),!!r&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:r})]})}ho.propTypes={app:s.object.isRequired,projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired};ho.defaultProps={};function lt({readOnly:t,params:o,setParams:n,paramsErrTip:l,setParamsErrTip:i,loading:d}){var u;const{t:r}=Q();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:d||t,label:`Blocklet ${r("common.version")}`,placeholder:`Blocklet ${r("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:a=>{i({blockletVersion:""}),n({blockletVersion:a.target.value})},error:!!l.blockletVersion,helperText:l.blockletVersion||""}),e.jsx(ne,{label:r("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Je,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",fe.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:a=>{i({note:""}),n({note:a.target.value.slice(0,fe.PROJECT.MAX_NOTE_LENGTH)})},error:!!l.note,helperText:l.note||"",sx:{mt:3}})]})})}lt.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,loading:s.bool.isRequired};lt.defaultProps={};function En(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&En(t[o]);return t}function it({index:t,item:o,dockerParams:n,setDockerParams:l,dataKey:i,t:d,readOnly:r}){const u=(o==null?void 0:o.value)||"",[a,f]=x.useState(!1),m=()=>{var U;(U=n[i])==null||U.splice(t,1),l({...n,[i]:[...n[i]]})},j=(U,R)=>{var g;(g=n[i])!=null&&g[t]&&(R?(n[i][t].custom=n[i][t].value,n[i][t].value=`$${yt(o.key)}`):(n[i][t].value=n[i][t].custom||"",n[i][t].custom="")),l({...n,[i]:[...n[i]]})},y=(U,R)=>{var S;const g=((S=n[i][t])==null?void 0:S.value)||"";n[i][t]={...n[i][t],secure:R,value:R&&g===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},h=(U,R)=>{n[i][t]={...n[i][t],shared:R},l({...n,[i]:[...n[i]]})},p=(U,R)=>{var S;const g=((S=n[i][t])==null?void 0:S.value)||"";n[i][t]={...n[i][t],required:R,value:R&&g===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},v=(U,R)=>{n[i][t]={...n[i][t],value:R?fe.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},l({...n,[i]:[...n[i]]})},w=U=>{n[i][t]={...n[i][t],description:U.target.value},l({...n,[i]:[...n[i]]})},b=U=>{const R=U.target.value==="web"?"web":"docker";R==="web"&&n.dockerArgs.forEach(W=>{W.type="docker"});const S=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:R,path:R==="docker"?S:"/",protocol:"http",prefix:R==="docker"?S:"/",name:"publicUrl",port:"BLOCKLET_PORT"},l({...n,dockerArgs:[...n.dockerArgs]})},k=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},l({...n,dockerArgs:[...n.dockerArgs]})},C=U=>{const R=U.target.value;n[i][t]={...n[i][t],prefix:R,path:R==="*"?"/":R},l({...n,[i]:[...n[i]]})},I=U=>{var R;(R=n[i])!=null&&R[t]&&(n[i][t].value=U.target.value),l({...n,[i]:[...n[i]]})},$=u===`$${yt(o.key)}`||o.custom,D=i==="dockerArgs"&&!dn[o.key],N=qs[o.key],z=i==="dockerEnvs",E=o.key==="--publish";let Z=o.key;return E&&o.type==="web"?Z="--publish (Web)":z&&(Z=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(L,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:Z})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(ne,{disabled:r||$||D||o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:$?`$${yt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Je,{position:"end",sx:{zoom:.9},children:[(!(N||D)||z||E)&&e.jsx(ae,{onClick:()=>f(!0),children:e.jsx(de,{icon:"icon-park-outline:setting-config"})}),!r&&e.jsx(ae,{onClick:m,color:D?"error":"default",children:e.jsx(de,{icon:"ic:round-delete"})})]})},error:D,onChange:I}),D&&e.jsx(L,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Es[o.key](u)&&e.jsx(L,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(ut,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(z?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[N||D||z?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx(_e,{disabled:r,checked:$,onChange:j,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.shared")}),e.jsx(_e,{disabled:r,checked:o.shared,onChange:h,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.required")}),e.jsx(_e,{disabled:r,checked:o.required,onChange:p,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.secure")}),e.jsx(_e,{disabled:r,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx(_e,{disabled:r,checked:o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:v,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:d("blocklet.publish.docker.description")}),e.jsx(ne,{disabled:r,value:o.description,onChange:w,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),E&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:d("blocklet.publish.docker.portType")}),e.jsxs(wt,{value:o.type||"docker",onChange:b,children:[e.jsx(be,{value:"docker",children:"Docker"}),e.jsx(be,{value:"web",children:"Web"})]})]}),E&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(wt,{value:o.proxyBehavior||"service",onChange:k,children:[e.jsx(be,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(be,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),E&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:d("blocklet.publish.docker.prefix")}),e.jsx(ne,{disabled:r,value:o.prefix,onChange:C,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}it.propTypes={dockerParams:s.object.isRequired,setDockerParams:s.func.isRequired,dataKey:s.string.isRequired,item:s.object.isRequired,t:s.func.isRequired,readOnly:s.bool.isRequired,index:s.number.isRequired};it.defaultProps={};const el=`
193
+ `;function Pn({text:t}){const{palette:o}=Qo();return t?e.jsx(Os,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:gs.sanitize(t),rehypePlugins:[[Ws,{target:"_blank"}]]}):e.jsx(Me,{Icon:zt})}Pn.propTypes={text:s.string.isRequired};function _n({params:t,setParams:o,paramsErrTip:n,loading:l,setParamsErrTip:i,readOnly:d}){var m;const{t:r}=Q(),[u,a]=x.useState(d?"preview":"write"),f=(j,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(L,{variant:"h6",fontWeight:"bold",sx:{},children:r("common.introduction")}),e.jsxs(Zo,{value:u,onChange:f,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(ne,{disabled:l||d,sx:{border:"none"},placeholder:`Blocklet ${r("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Je,{position:"end",children:[((m=t==null?void 0:t.blockletIntroduction)==null?void 0:m.length)||0," / ",fe.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:j=>{i({blockletIntroduction:""}),o({blockletIntroduction:j.target.value.slice(0,fe.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(Pn,{text:t.blockletIntroduction||""})})]})}_n.propTypes={params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired};var uo={},Xr=Se;Object.defineProperty(uo,"__esModule",{value:!0});var It=uo.default=void 0,Yr=Xr(Ie()),Lo=e;It=uo.default=(0,Yr.default)([(0,Lo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Lo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function po({step:t,ok:o,active:n,error:l,warning:i}){let d="grey.500",r=t+1;return o&&(r=e.jsx(pn,{sx:{fontSize:18,margin:0},color:"white"})),l||!o&&n>t?(d="error.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):i?(d="warning.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):n>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:r})}po.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};po.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function qn({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:l,params:i,loading:d,paramsErrTip:r,warning:u,viewMode:a,projectId:f}){const{t:m}=Q(),j=()=>{n(v=>v+1)},y=()=>{n(v=>v-1)},h=v=>v===0?(r==null?void 0:r.blockletTitle)||(r==null?void 0:r.projectId)||(r==null?void 0:r.blockletDescription)||(r==null?void 0:r.blockletHomepage)||(r==null?void 0:r.blockletSupport)||(r==null?void 0:r.blockletCommunity)||(r==null?void 0:r.blockletRepository):v===2?(r==null?void 0:r.blockletResource)||(r==null?void 0:r.blockletDocker)||(r==null?void 0:r.dockerImageName):v>=4?(r==null?void 0:r.blockletVersion)||(r==null?void 0:r.note):"",p=a||Dn({hasSelectedResources:l,params:i,projectId:f,t:m})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(Kn,{activeStep:o,orientation:"vertical",children:t.map((v,w)=>{const b={},k=d||!Fr({hasSelectedResources:l,params:i,projectId:f,step:w,t:m}),C=d?"":h(w);return C&&(b.optional=e.jsx(L,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:C}),b.error=!0),e.jsxs(es,{children:[e.jsx(ts,{icon:e.jsx(po,{error:C,warning:w===0?u.hasWarning:!1,active:p?99:o,step:w,ok:k}),sx:{cursor:"pointer",color:C?"error.main":"inherit"},disabled:!1,onClick:()=>n(w),...b,children:e.jsx(L,{fontSize:"14px",fontWeight:"500",color:C||!k&&o>w?"error.main":"inherit",children:v.label})}),e.jsxs(os,{children:[e.jsx(L,{fontSize:12,children:v.description}),!p&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[w<t.length-1&&e.jsx(K,{variant:"contained",onClick:j,sx:{mt:1,mr:1},disabled:C||!k,children:m("common.continue")}),w>0&&e.jsx(K,{disabled:w===0,onClick:y,sx:{mt:1,mr:1},children:m("common.back")})]})})]})]},v.label)})}),o>=t.length-1&&e.jsx(Pt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(L,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}qn.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.string.isRequired,loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.bool.isRequired,warning:s.object.isRequired,paramsErrTip:s.shape({projectId:s.string,blockletVersion:s.string,blockletTitle:s.string,blockletDescription:s.string,note:s.string,blockletResource:s.string,blockletHomepage:s.string,blockletSupport:s.string,blockletCommunity:s.string,blockletRepository:s.string,blockletDocker:s.object,dockerImageName:s.string}).isRequired};const Qr=[".zip",".gz"],Zr=1024*1024*100,Kr=x.lazy(()=>sn(()=>import("./index-B_-kynzD.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ho({app:t,projectId:o,readOnly:n,params:l,setParams:i,setParamsErrTip:d,error:r}){const{t:u,locale:a}=Q(),f=x.useRef(null),m=()=>n?!1:!o||o===Y.UNOWNED_DID?(M.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,j=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(L,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(Re,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!l.uploadedResource&&e.jsx(L,{component:"a",href:`${j}/params.uploadedResource`,children:l.uploadedResource}),!n&&e.jsx(K,{variant:"outlined",size:"small",onClick:()=>{var y;m()&&((y=f.current)==null||y.open())},children:l.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(x.Suspense,{fallback:e.jsx(Xe,{}),children:e.jsx(Kr,{ref:f,locale:a,popup:!0,onUploadFinish:y=>{var h;i({uploadedResource:y.data.filename}),d({blockletResource:""}),(h=f.current)==null||h.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:j,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Qr,maxFileSize:Zr,maxNumberOfFiles:1}}},"uploader-resource")}),!!r&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:r})]})}ho.propTypes={app:s.object.isRequired,projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired};ho.defaultProps={};function lt({readOnly:t,params:o,setParams:n,paramsErrTip:l,setParamsErrTip:i,loading:d}){var u;const{t:r}=Q();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:d||t,label:`Blocklet ${r("common.version")}`,placeholder:`Blocklet ${r("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:a=>{i({blockletVersion:""}),n({blockletVersion:a.target.value})},error:!!l.blockletVersion,helperText:l.blockletVersion||""}),e.jsx(ne,{label:r("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Je,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",fe.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:a=>{i({note:""}),n({note:a.target.value.slice(0,fe.PROJECT.MAX_NOTE_LENGTH)})},error:!!l.note,helperText:l.note||"",sx:{mt:3}})]})})}lt.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,loading:s.bool.isRequired};lt.defaultProps={};function En(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&En(t[o]);return t}function it({index:t,item:o,dockerParams:n,setDockerParams:l,dataKey:i,t:d,readOnly:r}){const u=(o==null?void 0:o.value)||"",[a,f]=x.useState(!1),m=()=>{var U;(U=n[i])==null||U.splice(t,1),l({...n,[i]:[...n[i]]})},j=(U,R)=>{var g;(g=n[i])!=null&&g[t]&&(R?(n[i][t].custom=n[i][t].value,n[i][t].value=`$${yt(o.key)}`):(n[i][t].value=n[i][t].custom||"",n[i][t].custom="")),l({...n,[i]:[...n[i]]})},y=(U,R)=>{var S;const g=((S=n[i][t])==null?void 0:S.value)||"";n[i][t]={...n[i][t],secure:R,value:R&&g===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},h=(U,R)=>{n[i][t]={...n[i][t],shared:R},l({...n,[i]:[...n[i]]})},p=(U,R)=>{var S;const g=((S=n[i][t])==null?void 0:S.value)||"";n[i][t]={...n[i][t],required:R,value:R&&g===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},v=(U,R)=>{n[i][t]={...n[i][t],value:R?fe.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},l({...n,[i]:[...n[i]]})},w=U=>{n[i][t]={...n[i][t],description:U.target.value},l({...n,[i]:[...n[i]]})},b=U=>{const R=U.target.value==="web"?"web":"docker";R==="web"&&n.dockerArgs.forEach(W=>{W.type="docker"});const S=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:R,path:R==="docker"?S:"/",protocol:"http",prefix:R==="docker"?S:"/",name:"publicUrl",port:"BLOCKLET_PORT"},l({...n,dockerArgs:[...n.dockerArgs]})},k=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},l({...n,dockerArgs:[...n.dockerArgs]})},C=U=>{const R=U.target.value;n[i][t]={...n[i][t],prefix:R,path:R==="*"?"/":R},l({...n,[i]:[...n[i]]})},I=U=>{var R;(R=n[i])!=null&&R[t]&&(n[i][t].value=U.target.value),l({...n,[i]:[...n[i]]})},$=u===`$${yt(o.key)}`||o.custom,D=i==="dockerArgs"&&!dn[o.key],N=qs[o.key],z=i==="dockerEnvs",E=o.key==="--publish";let Z=o.key;return E&&o.type==="web"?Z="--publish (Web)":z&&(Z=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(L,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:Z})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(ne,{disabled:r||$||D||o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:$?`$${yt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Je,{position:"end",sx:{zoom:.9},children:[(!(N||D)||z||E)&&e.jsx(ae,{onClick:()=>f(!0),children:e.jsx(de,{icon:"icon-park-outline:setting-config"})}),!r&&e.jsx(ae,{onClick:m,color:D?"error":"default",children:e.jsx(de,{icon:"ic:round-delete"})})]})},error:D,onChange:I}),D&&e.jsx(L,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Es[o.key](u)&&e.jsx(L,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(ut,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(z?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[N||D||z?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx(_e,{disabled:r,checked:$,onChange:j,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.shared")}),e.jsx(_e,{disabled:r,checked:o.shared,onChange:h,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.required")}),e.jsx(_e,{disabled:r,checked:o.required,onChange:p,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.secure")}),e.jsx(_e,{disabled:r,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx(_e,{disabled:r,checked:o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:v,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:d("blocklet.publish.docker.description")}),e.jsx(ne,{disabled:r,value:o.description,onChange:w,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),E&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:d("blocklet.publish.docker.portType")}),e.jsxs(wt,{value:o.type||"docker",onChange:b,children:[e.jsx(be,{value:"docker",children:"Docker"}),e.jsx(be,{value:"web",children:"Web"})]})]}),E&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(wt,{value:o.proxyBehavior||"service",onChange:k,children:[e.jsx(be,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(be,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),E&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:d("blocklet.publish.docker.prefix")}),e.jsx(ne,{disabled:r,value:o.prefix,onChange:C,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}it.propTypes={dockerParams:s.object.isRequired,setDockerParams:s.func.isRequired,dataKey:s.string.isRequired,item:s.object.isRequired,t:s.func.isRequired,readOnly:s.bool.isRequired,index:s.number.isRequired};it.defaultProps={};const el=`
194
194
  docker run --name postgrest
195
195
  -p 3000:3000
196
196
  -e PGRST_DB_URI="postgres://username:password@host:port/database"
@@ -1,4 +1,4 @@
1
- import{H as i,ah as v,j as s,bI as A,aa as N,ab as D,s as E}from"./vendor-mui-core-D_bnq77o.js";import{a as $,l as M,u as b,m as q}from"./vendor-hooks-rDgu5KV9.js";import{a as F,R as H}from"./vendor-arcblock-uz9DVywv.js";import{r as m}from"./vendor-react-DEoibe3W.js";import{b2 as U,am as B,u as j,aR as O,j as Y,b3 as S,Z as W}from"./vendor-ux-did-connect-DHrruicZ.js";import{t as V,v as X,w as L,x as z}from"./index-DefO2n6z.js";import{A as J}from"./vendor-utils-rHXShPKm.js";import{u as K}from"./use-passport-id-B-b-_oYF.js";import{u as Z}from"./session-CHdTc1We.js";import{b as G}from"./sdk-9eXJSWHG.js";import{d as Q}from"./CheckCircle-Ds4QI0ey.js";import{w as ee}from"./wrap-locale-B9TkXFQe.js";function P({invitation:e,createPassportSvg:a,passportColor:c}){const[p,n]=m.useState(!1),{t}=m.useContext(U),l=m.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),u=m.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c,extra:e.passportExpireTime?{key:"Exp",value:V(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,l]),x=m.useCallback(()=>{n(!0)},[]),r=m.useCallback(()=>{n(!1)},[]);return s.jsxs(s.Fragment,{children:[s.jsx(se,{children:s.jsxs("div",{className:"invite-passport__card",onClick:x,children:[!!e.display&&s.jsx(F,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&s.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:u}})]})}),s.jsx(B,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:r,children:e.role.permissions&&e.role.permissions.length>0?s.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(o=>s.jsx("li",{style:{listStyle:"circle"},children:o.description},o.name))}):s.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[s.jsx(A,{style:{width:"30px",height:"30px"}}),s.jsx("div",{children:t("invite.emptyPermission")})]})})]})}P.propTypes={invitation:i.object.isRequired,createPassportSvg:i.func.isRequired,passportColor:i.string};P.defaultProps={passportColor:"auto"};const se=v.div`
1
+ import{H as i,ah as v,j as s,bI as A,aa as N,ab as D,s as E}from"./vendor-mui-core-D_bnq77o.js";import{a as $,l as M,u as b,m as q}from"./vendor-hooks-rDgu5KV9.js";import{a as F,R as H}from"./vendor-arcblock-uz9DVywv.js";import{r as m}from"./vendor-react-DEoibe3W.js";import{b2 as U,am as B,u as j,aR as O,j as Y,b3 as S,Z as W}from"./vendor-ux-did-connect-DHrruicZ.js";import{t as V,v as X,w as L,x as z}from"./index-CIkPfxzG.js";import{A as J}from"./vendor-utils-rHXShPKm.js";import{u as K}from"./use-passport-id-B-b-_oYF.js";import{u as Z}from"./session-CHdTc1We.js";import{b as G}from"./sdk-9eXJSWHG.js";import{d as Q}from"./CheckCircle-Ds4QI0ey.js";import{w as ee}from"./wrap-locale-CPW6a0PM.js";function P({invitation:e,createPassportSvg:a,passportColor:c}){const[p,n]=m.useState(!1),{t}=m.useContext(U),l=m.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),u=m.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c,extra:e.passportExpireTime?{key:"Exp",value:V(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,l]),x=m.useCallback(()=>{n(!0)},[]),r=m.useCallback(()=>{n(!1)},[]);return s.jsxs(s.Fragment,{children:[s.jsx(se,{children:s.jsxs("div",{className:"invite-passport__card",onClick:x,children:[!!e.display&&s.jsx(F,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&s.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:u}})]})}),s.jsx(B,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:r,children:e.role.permissions&&e.role.permissions.length>0?s.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(o=>s.jsx("li",{style:{listStyle:"circle"},children:o.description},o.name))}):s.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[s.jsx(A,{style:{width:"30px",height:"30px"}}),s.jsx("div",{children:t("invite.emptyPermission")})]})})]})}P.propTypes={invitation:i.object.isRequired,createPassportSvg:i.func.isRequired,passportColor:i.string};P.defaultProps={passportColor:"auto"};const se=v.div`
2
2
  display: flex;
3
3
  max-width: 350px;
4
4
  margin: 30px auto;
@@ -1 +1 @@
1
- import{j as i,aa as g}from"./vendor-mui-core-D_bnq77o.js";import{f as x,r as u}from"./vendor-react-DEoibe3W.js";import{u as v}from"./vendor-hooks-rDgu5KV9.js";import{I as w}from"./invitation-1bsb30Yz.js";import{L as I}from"./landing-page-Due4o1uF.js";import{u as S,aT as T,j}from"./vendor-ux-did-connect-DHrruicZ.js";import{H as P}from"./vendor-arcblock-uz9DVywv.js";import{g as k}from"./get-safe-url-B5RJTMjC.js";import{u as E,d as L,c as R,s as W,a as C}from"./index-DefO2n6z.js";import"./vendor-utils-rHXShPKm.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CHdTc1We.js";import"./sdk-9eXJSWHG.js";import"./CheckCircle-Ds4QI0ey.js";import"./wrap-locale-B9TkXFQe.js";import"./lottie-web-jYmAQWuC.js";function y(c){var r;const m=x(),{searchParams:s}=new URL(window.location.href),{api:p,session:d}=E(),{t:f}=S(),a=s.get("inviteId"),n=s.get("redirect"),h=u.useCallback(async()=>{const{data:t}=await L.get("invitation",{params:{inviteId:a}});return t},[a]),l=v(async(t,o=e=>e)=>{t&&(W(o(t.sessionToken)),C(o(t.refreshToken)),t.visitorId&&T(o(t.visitorId))),await d.refresh(),setTimeout(()=>{if(n){const e=decodeURIComponent(n);e.startsWith(j.WELLKNOWN_SERVICE_PATH_PREFIX)?m(e,{replace:!0}):window.location.href=k(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(I,{did:(r=window.blocklet)==null?void 0:r.appPid,children:[i.jsx(P,{children:i.jsx("title",{children:f("pageTitle.invite")})}),i.jsx(g,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...c,getDataFn:h,checkFn:p.get,createPassportSvg:t=>R({...t}),onLoginSuccess:l,inService:!0})})]})}export{y as default};
1
+ import{j as i,aa as g}from"./vendor-mui-core-D_bnq77o.js";import{f as x,r as u}from"./vendor-react-DEoibe3W.js";import{u as v}from"./vendor-hooks-rDgu5KV9.js";import{I as w}from"./invitation-DzT9Qa0A.js";import{L as I}from"./landing-page-Due4o1uF.js";import{u as S,aT as T,j}from"./vendor-ux-did-connect-DHrruicZ.js";import{H as P}from"./vendor-arcblock-uz9DVywv.js";import{g as k}from"./get-safe-url-Bk6PlU7n.js";import{u as E,d as L,c as R,s as W,a as C}from"./index-CIkPfxzG.js";import"./vendor-utils-rHXShPKm.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CHdTc1We.js";import"./sdk-9eXJSWHG.js";import"./CheckCircle-Ds4QI0ey.js";import"./wrap-locale-CPW6a0PM.js";import"./lottie-web-jYmAQWuC.js";function y(c){var r;const m=x(),{searchParams:s}=new URL(window.location.href),{api:p,session:d}=E(),{t:f}=S(),a=s.get("inviteId"),n=s.get("redirect"),h=u.useCallback(async()=>{const{data:t}=await L.get("invitation",{params:{inviteId:a}});return t},[a]),l=v(async(t,o=e=>e)=>{t&&(W(o(t.sessionToken)),C(o(t.refreshToken)),t.visitorId&&T(o(t.visitorId))),await d.refresh(),setTimeout(()=>{if(n){const e=decodeURIComponent(n);e.startsWith(j.WELLKNOWN_SERVICE_PATH_PREFIX)?m(e,{replace:!0}):window.location.href=k(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(I,{did:(r=window.blocklet)==null?void 0:r.appPid,children:[i.jsx(P,{children:i.jsx("title",{children:f("pageTitle.invite")})}),i.jsx(g,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...c,getDataFn:h,checkFn:p.get,createPassportSvg:t=>R({...t}),onLoginSuccess:l,inService:!0})})]})}export{y as default};
@@ -1 +1 @@
1
- import{j as e,ab as w,aa as v}from"./vendor-mui-core-D_bnq77o.js";import{a as T,m as I,u as p}from"./vendor-hooks-rDgu5KV9.js";import{I as P}from"./invitation-1bsb30Yz.js";import{L as j}from"./landing-page-Due4o1uF.js";import{u as k,aT as R,j as S}from"./vendor-ux-did-connect-DHrruicZ.js";import{H as L}from"./vendor-arcblock-uz9DVywv.js";import{g as E}from"./get-safe-url-B5RJTMjC.js";import{u as C,c as W,s as F,a as N}from"./index-DefO2n6z.js";import{f as H}from"./vendor-react-DEoibe3W.js";import"./vendor-utils-rHXShPKm.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CHdTc1We.js";import"./sdk-9eXJSWHG.js";import"./CheckCircle-Ds4QI0ey.js";import"./wrap-locale-B9TkXFQe.js";import"./lottie-web-jYmAQWuC.js";function Q(f){var m;const{searchParams:a}=new URL(window.location.href),{api:r,session:d}=C(),u=H(),{t:h}=k(),n=a.get("id"),c=a.get("redirect"),g=T({state:""}),s=I(async()=>{if(!n)return null;const{data:t}=await r.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),l=p(()=>{if(s.error)throw s.error;return s==null?void 0:s.data}),x=p(async(t,i=o=>o)=>{t&&(t.sessionToken&&F(i(t.sessionToken)),t.refreshToken&&N(i(t.refreshToken)),t.visitorId&&R(i(t.visitorId)),await d.refresh()),setTimeout(()=>{if(c){const o=decodeURIComponent(c);o.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?u(o,{replace:!0}):window.location.href=E(o)}else window.location.href=window.env.pathPrefix||"/"},50)});return s.loading?e.jsx(w,{}):e.jsxs(j,{did:(m=window.blocklet)==null?void 0:m.appPid,children:[e.jsx(L,{children:e.jsx("title",{children:h("pageTitle.issuePassport")})}),e.jsx(v,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(P,{...f,action:"issue-passport",getDataFn:l,checkFn:r.get,createPassportSvg:W,onLoginSuccess:x,inService:!0,status:g.state})})]})}export{Q as default};
1
+ import{j as e,ab as w,aa as v}from"./vendor-mui-core-D_bnq77o.js";import{a as T,m as I,u as p}from"./vendor-hooks-rDgu5KV9.js";import{I as P}from"./invitation-DzT9Qa0A.js";import{L as j}from"./landing-page-Due4o1uF.js";import{u as k,aT as R,j as S}from"./vendor-ux-did-connect-DHrruicZ.js";import{H as L}from"./vendor-arcblock-uz9DVywv.js";import{g as E}from"./get-safe-url-Bk6PlU7n.js";import{u as C,c as W,s as F,a as N}from"./index-CIkPfxzG.js";import{f as H}from"./vendor-react-DEoibe3W.js";import"./vendor-utils-rHXShPKm.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CHdTc1We.js";import"./sdk-9eXJSWHG.js";import"./CheckCircle-Ds4QI0ey.js";import"./wrap-locale-CPW6a0PM.js";import"./lottie-web-jYmAQWuC.js";function Q(f){var m;const{searchParams:a}=new URL(window.location.href),{api:r,session:d}=C(),u=H(),{t:h}=k(),n=a.get("id"),c=a.get("redirect"),g=T({state:""}),s=I(async()=>{if(!n)return null;const{data:t}=await r.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),l=p(()=>{if(s.error)throw s.error;return s==null?void 0:s.data}),x=p(async(t,i=o=>o)=>{t&&(t.sessionToken&&F(i(t.sessionToken)),t.refreshToken&&N(i(t.refreshToken)),t.visitorId&&R(i(t.visitorId)),await d.refresh()),setTimeout(()=>{if(c){const o=decodeURIComponent(c);o.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?u(o,{replace:!0}):window.location.href=E(o)}else window.location.href=window.env.pathPrefix||"/"},50)});return s.loading?e.jsx(w,{}):e.jsxs(j,{did:(m=window.blocklet)==null?void 0:m.appPid,children:[e.jsx(L,{children:e.jsx("title",{children:h("pageTitle.issuePassport")})}),e.jsx(v,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(P,{...f,action:"issue-passport",getDataFn:l,checkFn:r.get,createPassportSvg:W,onLoginSuccess:x,inService:!0,status:g.state})})]})}export{Q as default};