@abtnode/blocklet-services 1.16.38-beta-20250110-003414-d3c1bfbd → 1.16.38-beta-20250114-011103-277f0108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/libs/connect/session.js +47 -9
- package/api/libs/open-graph/template.js +15 -12
- package/api/routes/oauth.js +5 -7
- package/api/routes/user.js +6 -8
- package/dist/assets/{access-control-DcliPEX2.js → access-control-DYH-J6hX.js} +1 -1
- package/dist/assets/{add-component-core-DSlHbXth.js → add-component-core-BWkCzqAe.js} +1 -1
- package/dist/assets/{add-resource-B9SUcn9b.js → add-resource-gJH8Kf-h.js} +1 -1
- package/dist/assets/{analytics-BVmtToBr.js → analytics-Bv-kTIMo.js} +1 -1
- package/dist/assets/{audit-logs-DOpEhbRi.js → audit-logs-1KlkVb5T.js} +1 -1
- package/dist/assets/{branding-BIbnR-Yt.js → branding-CKhye1G1.js} +2 -2
- package/dist/assets/{bundle-avatar-DqROxHMq.js → bundle-avatar-B19h7IBb.js} +1 -1
- package/dist/assets/{complete-B_C_fwut.js → complete-XH7CJJ1E.js} +1 -1
- package/dist/assets/{component-eAmweIYL.js → component-B4nl0OGh.js} +1 -1
- package/dist/assets/{config-CWoxBu0J.js → config-B8mAOrZA.js} +1 -1
- package/dist/assets/{config-navigation-jKhcoDId.js → config-navigation-Y__TwRFz.js} +3 -3
- package/dist/assets/{config-space-Dofzrh5m.js → config-space-DJZf5rEq.js} +1 -1
- package/dist/assets/{confirm-C0rryr4e.js → confirm-CucPiuHr.js} +1 -1
- package/dist/assets/{connect-Wiz0Gw9I.js → connect-CPSe4Vws.js} +1 -1
- package/dist/assets/{connect-CfWNBUY4.js → connect-DH0hj2CX.js} +1 -1
- package/dist/assets/{connect-to-Dsq1ST9l.js → connect-to-DfzH7XJt.js} +1 -1
- package/dist/assets/{dashboard-Ca8O6iHB.js → dashboard-D7XqaqMa.js} +3 -3
- package/dist/assets/{domain-DJyjDPmO.js → domain-D80mBbZ5.js} +1 -1
- package/dist/assets/{domain-list-BEjAE8hh.js → domain-list-DGgkgu6r.js} +1 -1
- package/dist/assets/{email-C3ggDSGp.js → email-C1ha_p9W.js} +1 -1
- package/dist/assets/{exchange-passport-4QuzoW2F.js → exchange-passport-4uu5i0rP.js} +1 -1
- package/dist/assets/{form-text-input-CT57jMfW.js → form-text-input-DB90dWTR.js} +1 -1
- package/dist/assets/{fuel-CJ-CsgDu.js → fuel-PiarpzYg.js} +1 -1
- package/dist/assets/{index-CQT4qLcx.js → index-8ktBk2aq.js} +1 -1
- package/dist/assets/{index-CrvlY8Z5.js → index-B5PaGLoo.js} +1 -1
- package/dist/assets/{index-CqPx8QUY.js → index-BCUhK2IK.js} +1 -1
- package/dist/assets/{index-l4yaELph.js → index-BPFeU32W.js} +1 -1
- package/dist/assets/{index-BZnWmdZ0.js → index-BdipdMDv.js} +1 -1
- package/dist/assets/{index-BPF3oif7.js → index-CYcUSW9Y.js} +5 -5
- package/dist/assets/{index-IdPbsC-k.js → index-Cn9hlGXz.js} +1 -1
- package/dist/assets/{index-DMelUylN.js → index-D97FQw7_.js} +3 -3
- package/dist/assets/{index-BQxL3qXG.js → index-DDHKg1sP.js} +1 -1
- package/dist/assets/{index-wG4Kh8A_.js → index-DgZ1ypbb.js} +3 -3
- package/dist/assets/{index-Bxg1LKG8.js → index-N-iuMUsJ.js} +1 -1
- package/dist/assets/{index-ROkOEO9F.js → index-PIIZTXU1.js} +1 -1
- package/dist/assets/{invitation-Dn2JFqk3.js → invitation-D0h9V7Yr.js} +1 -1
- package/dist/assets/{invite-k-THgUaE.js → invite-CLadQHSg.js} +1 -1
- package/dist/assets/{issue-passport-Cp0z7zOC.js → issue-passport-DOvL3-GM.js} +1 -1
- package/dist/assets/{item-DqTNLhw3.js → item-BKMUYpdp.js} +1 -1
- package/dist/assets/{layout-BRN0uPvp.js → layout-Bb4get3W.js} +1 -1
- package/dist/assets/{log-D1ShKaDY.js → log-r4HRH3tf.js} +1 -1
- package/dist/assets/{login-D9awP98G.js → login-IiYHalJQ.js} +1 -1
- package/dist/assets/{logo-uploader-BA8U554_.js → logo-uploader-C1-XCCMv.js} +3 -3
- package/dist/assets/{lost-passport-kJqVsdV1.js → lost-passport-EcYlR7v6.js} +1 -1
- package/dist/assets/{overview-4bff7RWe.js → overview-Bc6RN_5G.js} +1 -1
- package/dist/assets/{publish-resource-BhQQlAPL.js → publish-resource-cSMHC1nt.js} +1 -1
- package/dist/assets/{relative-time-BXb5Mt72.js → relative-time-BzZIQh7e.js} +1 -1
- package/dist/assets/{setup-DTQXAoXZ.js → setup-CdCyHLLn.js} +3 -3
- package/dist/assets/{start-DNpygdxp.js → start-owo1aKq8.js} +1 -1
- package/dist/assets/{step-actions-ClTz1KhK.js → step-actions-DnckX9Zh.js} +1 -1
- package/dist/assets/{transfer-A_yTwCWw.js → transfer-De5_Rua8.js} +1 -1
- package/dist/assets/{unsubscribe-uaBnibKD.js → unsubscribe-B0kFTEaS.js} +1 -1
- package/dist/assets/{user-center-B3stHKHJ.js → user-center-B9_0ML8Q.js} +1 -1
- package/dist/assets/{util-ao8gSgii.js → util-Ci0WMGC4.js} +1 -1
- package/dist/assets/{wrap-locale-DNve09jN.js → wrap-locale-D_rplmnG.js} +1 -1
- package/dist/images/og-image.jpg +0 -0
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/dist/share/shared-service-worker.js +60 -2
- package/package.json +21 -21
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{r as S,k as Tt,l as it,L as re,f as Gn,h as Xn,i as ft}from"./vendor-react-D-afvo_7.js";import{a1 as fe,j as t,t as Me,a3 as u,aM as Fo,E as d,a4 as ae,I as ne,T as A,bT as Uo,aa as ie,aE as Jn,bJ as Ge,ad as Ho,aN as Xe,aR as kt,x as K,a2 as et,P as Go,G as Xo,v as Pt,$ as Jo,ar as Qo,al as de,ah as Qn,D as _t,ab as Yo,r as Zo,bH as Yn,K as Oe,y as Ko,M as Q,ac as je,aL as Zn,L as Kn,z as es,bq as ts,aA as en,az as tt,bt as os,bu as ns,bU as ss,bV as rs,aP as tn,bE as ls,bM as is,bx as cs,by as ht}from"./vendor-mui-core-BlX2BJoA.js";import{y as he,B as De,h as ke,aa as as,f as bo,_ as on,ac as xo}from"./index-wG4Kh8A_.js";import{ad as me,d as H,g as Y,ag as ot,aq as nn,by as sn,ao as rn,ab as ds,bz as Lt,z as W,E as us,bm as ps,bA as qt,bB as fs,bC as hs,aa as ms,b2 as se,bD as bs,aO as xs,bh as Ce,al as $t,bE as Se,aL as gs,aG as js}from"./vendor-arcblock-CiLB_TiI.js";import{d as Nt}from"./Add-2VCvBnGd.js";import{d as ks}from"./Error-CpAOVH8t.js";import{C as Et}from"./confirm-C0rryr4e.js";import{u as ct}from"./session-ocxAyn6f.js";import{W as go}from"./did-address-49U3oRW2.js";import{E as Be,D as jo,C as ko,P as yo}from"./react-beautiful-dnd.esm-C8vTtkBe.js";import{B as At}from"./bundle-avatar-DqROxHMq.js";import{S as ue}from"./shorten-label-BnvWOC_s.js";import{j as le,a as Je}from"./vendor-utils-DCpRgzMR.js";import{d as ys}from"./Download-BJmwtO6i.js";import{d as vs}from"./QuestionMarkCircle-gL_QM35Z.js";import{u as ws}from"./vendor-hooks-CLzfFpO7.js";import{_ as Re}from"./useSetState-Crt4S51m.js";import{c as zt}from"./index-DoZ2YM4T.js";import{E as Mt}from"./index-DQSF6ElG.js";import{p as nt}from"./index-Bxg1LKG8.js";import"./api-C0C4sDJA.js";import{d as Rs}from"./ChevronRight-B8pf890W.js";import{T as Ss,a as Cs}from"./vendor-mui-x-Bq1FyQ7S.js";import{d as vo}from"./DeleteOutline-VzoIEqow.js";import{c as Is,A as ln,u as Ds,S as Ts,U as Ps,a as mt,b as cn,n as _s,e as Ls,f as wo,g as qs}from"./item-DqTNLhw3.js";import{d as $s}from"./ArrowDropDown-BdHlAt9a.js";import{f as Ie}from"./format-error-C0Ke3VXF.js";import{C as Ns}from"./click-to-copy-DNu8CktB.js";import{d as Es}from"./Launch-BOCFiYoz.js";import{M as As}from"./index-Bi1xb9O8.js";import{r as zs}from"./index-D7mJIWyJ.js";import{d as Ms}from"./Done-BCESxXX2.js";import"./raf-schd.esm-Cxhj8umC.js";import"./get-safe-url-CVhAz4Qr.js";var Ot={},Os=fe;Object.defineProperty(Ot,"__esModule",{value:!0});var an=Ot.default=void 0,Bs=Os(me()),Ws=t;an=Ot.default=(0,Bs.default)((0,Ws.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 Bt={},Vs=fe;Object.defineProperty(Bt,"__esModule",{value:!0});var dn=Bt.default=void 0,Fs=Vs(me()),Us=t;dn=Bt.default=(0,Fs.default)((0,Us.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 Wt={},Hs=fe;Object.defineProperty(Wt,"__esModule",{value:!0});var un=Wt.default=void 0,Gs=Hs(me()),Xs=t;un=Wt.default=(0,Gs.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 Vt({did:e,projectId:o,title:n,logo:r,describe:s}){const l=`${`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e}/${o}/logo/upload`}/${r}`,[a,c]=S.useState(!1),f=Me(h=>h.breakpoints.down("md"));return t.jsxs(u,{sx:{display:"flex",flexDirection:"row",color:a?"primary.main":"grey.900",gap:1},onPointerEnter:()=>c(!0),onPointerLeave:()=>c(!1),children:[t.jsx(Fo,{sx:{borderRadius:1},src:l}),t.jsxs(u,{children:[t.jsx(ue,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),t.jsx(ue,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||a?"primary.main":"grey.700"},children:s||"/"})]})]})}Vt.propTypes={projectId:d.string.isRequired,did:d.string.isRequired,title:d.string.isRequired,logo:d.string.isRequired,describe:d.string.isRequired};function Ft({initUrl:e}){const o=Tt(),n=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:r,locale:s}=Y(),{api:i}=he(),{api:l}=ct(),[a,c]=S.useState(!0),{blocklet:f}=De(),[h,g]=S.useState(null),[x,p]=S.useState(!1),y=Me(m=>m.breakpoints.down("xl")),{componentDid:w=""}=it(),[D,j]=S.useState(null),b=()=>{i.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:n}}).then(m=>{const P=(m==null?void 0:m.projects)||[];c(!1),j(P)}).catch(m=>{c(!1),W.error(m.message)})},T=()=>{o(`${H.UNOWNED_DID}/create/none`,{replace:!0})},L=m=>{g(m)},I=()=>{c(!1),p(!0)},k=()=>{p(!1),g(null)},_=m=>{W.error(m.message),p(!1),g(null)},$=m=>{if(!(m!=null&&m.deleted)){W.error("Delete project failed");return}b(),p(!1),g(null)},B=(m,P,M)=>{let F=m==null?void 0:m.trim();return F?(F=us.toAddress(F).toLocaleLowerCase(),M.some((v,E)=>{const q=P[E];return q&&v.searchable&&v.display!=="excluded"&&v.display!=="false"&&q.toLocaleLowerCase().includes(F)})):!0};if(S.useEffect(()=>{b()},[]),!D&&a)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Be,{})});if(!D)return null;if(!D.length)return t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),t.jsx(ot,{onClick:T,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const R=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:m=>{const P=D[m];return t.jsx(re,{to:`${P.id}`,children:t.jsx(Vt,{did:f.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:m=>m?t.jsx(nn,{type:"success",children:m}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:m=>m?t.jsx(go,{size:14,compact:!0,responsive:!1,did:m}):null}},y||w?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:m=>m?t.jsx(go,{onClick:()=>{o(`/.well-known/service/admin/members?did=${m}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:m}):null}},y||w?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:m=>{const P=(f.children||[]).find(M=>M.meta.did===m);return P?t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(At,{size:14,blocklet:P,ancestors:[f]}),t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},m):""}}},y||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:m=>t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:t.jsx(ue,{children:m})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:m=>t.jsx(sn,{value:Number(m),locale:s})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:m=>{const P=D[m];return t.jsxs(u,{display:"flex",children:[t.jsx(re,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:t.jsx(ae,{title:r("blocklet.publish.createRelease"),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"create",children:t.jsx(an,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&t.jsx(ae,{title:r("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"secondary","aria-label":"create",children:t.jsx(re,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:t.jsx(dn,{sx:{fontSize:18}})})})}),t.jsx(ae,{title:r("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"delete",onClick:()=>L(P),children:t.jsx(rn,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),C=x?t.jsx(ds,{open:!0,popup:!0,onClose:k,action:"check-has-project-id",locale:s,checkFn:l.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:$,onError:_,extraParams:{projectId:h.id,did:f.meta.did,name:h.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:h.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:h.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return t.jsxs(u,{children:[t.jsxs(u,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(u,{display:"flex",flexDirection:"row",alignItems:"center",children:[t.jsx(u,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),t.jsx(ae,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:t.jsx(un,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),t.jsxs(ot,{onClick:T,variant:"contained",children:[t.jsx(Nt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]}),t.jsx(Lt,{className:"main-table",locale:s,data:D,columns:R,options:{sort:!1,download:!1,filter:!1,print:!1,search:!0,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100],searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:400,customSearch:B}}),h&&t.jsx(Et,{title:`${r("common.delete")} ${h.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:I,onCancel:()=>g(null),children:t.jsx(u,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(m=>t.jsxs(u,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[t.jsx(ks,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),t.jsx(A,{component:"span",variant:"inherit",color:"text.secondary",children:m})]}))})}),C]})}Ft.propTypes={initUrl:d.object};Ft.defaultProps={initUrl:null};var Ut={},Js=fe;Object.defineProperty(Ut,"__esModule",{value:!0});var pn=Ut.default=void 0,Qs=Js(me()),Ro=t;pn=Ut.default=(0,Qs.default)([(0,Ro.jsx)("path",{d:"M20 17H4V5h8V3H4c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h4v2h8v-2h4c1.1 0 2-.9 2-2v-3h-2z"},"0"),(0,Ro.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");function Ys(){var I;const{t:e,locale:o}=Y(),{projectId:n}=it(),{api:r}=he(),[s,i]=S.useState(!0),{blocklet:l}=De(),a=Me(k=>k.breakpoints.down("md")),[c,f]=S.useState(null),[h,g]=S.useState(null),[x,p]=S.useState(null),y=(I=window.env)==null?void 0:I.serverEndpoint,w=()=>{r.getReleases({input:{did:l.meta.did,projectId:n}}).then(k=>{const _=(k==null?void 0:k.releases)||[];i(!1),f(_)}).catch(k=>{i(!1),W.error(k.message)})},D=()=>{r.doBatchQuery({getProject:{input:{did:l.meta.did,projectId:n}},getReleases:{input:{did:l.meta.did,projectId:n}}}).then(k=>{g(k.getProject.project||{}),f(k.getReleases.releases||[]),i(!1)}).catch(k=>{i(!1),W.error(k.message)})};S.useEffect(()=>{D()},[]);const j=()=>{i(!1);const k=x.id;r.deleteRelease({input:{did:l.meta.did,projectId:n,releaseId:k}}).then(()=>{i(!1),w(),W.success(e("common.removeSuccess")),p(null)}).catch(_=>{i(!1),W.error(_.message)})},b=k=>{p(k)};if(!c&&s)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Be,{})});if(!c)return null;const T=t.jsxs(Uo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(re,{to:"..",children:e("common.blockletStudio")}),t.jsx(A,{color:"text.primary",children:t.jsx(ue,{maxLength:a?6:30,children:h.blockletTitle})})]});if(!c.length)return t.jsxs(t.Fragment,{children:[T,t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:e("blocklet.publish.releaseEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:e("blocklet.publish.createReleaseTip")}),t.jsx(re,{to:"create/none",children:t.jsx(ot,{variant:"contained",children:e("blocklet.publish.createRelease")})})]})]});const L=[{label:e("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:k=>{const _=c[k];return t.jsx(re,{to:`view/${_.id}`,children:t.jsx(Vt,{did:l.meta.did,projectId:h.id,logo:_.blockletLogo,title:_.blockletVersion,describe:_.blockletTitle})})}}},{label:e("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:k=>{const _=c[k];return t.jsx(A,{className:"note",children:_.note||""})}}},{label:e("common.status"),name:"status",options:{customBodyRender:k=>t.jsx(nn,{type:k==="published"?"success":"warning",children:k==="published"?"Released":ps(k)})}},{label:e("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:k=>{const _=c[k];return _.status!==ke.PROJECT.RELEASE_STATUS.published?"":t.jsx(sn,{value:Number(_.updatedAt),locale:o})}}},{label:e("common.actions"),name:"actions",options:{customBodyRenderLite:k=>{var m;const _=c[k];let $="",B="";const R=_.status==="published";if(R){const P=le(y,`/api/project/${l.meta.did}/${h.id}/${h.lastReleaseId}/release/blocklet.json`),M=new URL(y);M.pathname=le(M.pathname,"/launch-blocklet/agreement"),M.searchParams.set("blocklet_meta_url",P),$=M.href,B=le(`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${l.meta.did}/${h.id}/${h.lastReleaseId}/download/${(h.lastReleaseFiles||[])[0]}`)}const C=(m=h.blockletComponents)!=null&&m.some(P=>P.included)||_.uploadedResource?"pack":"resource";return t.jsxs(u,{display:"flex",alignItems:"center",children:[R&&C==="pack"&&t.jsx(ae,{title:e("blocklet.publish.install",{name:h.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"secondary","aria-label":"create",children:t.jsx("a",{style:{display:"flex"},href:$,target:"_blank",rel:"noreferrer",children:t.jsx(pn,{sx:{fontSize:18}})})})}),R&&t.jsx(ae,{title:e("blocklet.publish.download",{name:h.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"download",children:t.jsx("a",{style:{display:"flex"},href:B,children:t.jsx(ys,{sx:{fontSize:18}})})})}),t.jsx(ae,{title:e("blocklet.publish.delete",{name:h.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"delete",onClick:()=>b(_),children:t.jsx(rn,{sx:{fontSize:18}})})})]})}}}];return t.jsxs(Zs,{children:[t.jsxs(u,{className:"header",children:[T,t.jsx(re,{to:"new-release/none",children:t.jsxs(ot,{variant:"contained",children:[t.jsx(Nt,{style:{fontSize:"1.3em",marginRight:4}}),e("blocklet.publish.createRelease")]})})]}),t.jsx(Lt,{className:"main-table",verticalKeyWidth:100,locale:o,data:c,columns:L,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),x&&t.jsx(Et,{title:e(`${e("common.delete")} ${x.blockletVersion}`),description:e("blocklet.publish.deleteReleaseTip"),confirm:e("common.confirm"),onConfirm:j,onCancel:()=>p(null)})]})}const Zs=ie(u)`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D97FQw7_.js","assets/vendor-arcblock-CiLB_TiI.js","assets/vendor-react-D-afvo_7.js","assets/vendor-utils-DCpRgzMR.js","assets/vendor-hooks-CLzfFpO7.js","assets/vendor-mui-core-BlX2BJoA.js","assets/vendor-arcblock-DhgPdlEj.css","assets/index-BGO2DsWz.js","assets/index-DgZ1ypbb.js","assets/_createAggregator-B4i0o6gy.js","assets/index-DoZ2YM4T.js","assets/toUpper-BQrWudMF.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as S,k as Tt,l as it,L as re,f as Gn,h as Xn,i as ft}from"./vendor-react-D-afvo_7.js";import{a1 as fe,j as t,t as Me,a3 as u,aM as Fo,E as d,a4 as ae,I as ne,T as A,bT as Uo,aa as ie,aE as Jn,bJ as Ge,ad as Ho,aN as Xe,aR as kt,x as K,a2 as et,P as Go,G as Xo,v as Pt,$ as Jo,ar as Qo,al as de,ah as Qn,D as _t,ab as Yo,r as Zo,bH as Yn,K as Oe,y as Ko,M as Q,ac as je,aL as Zn,L as Kn,z as es,bq as ts,aA as en,az as tt,bt as os,bu as ns,bU as ss,bV as rs,aP as tn,bE as ls,bM as is,bx as cs,by as ht}from"./vendor-mui-core-BlX2BJoA.js";import{y as he,B as De,h as ke,aa as as,f as bo,_ as on,ac as xo}from"./index-DgZ1ypbb.js";import{ad as me,d as H,g as Y,ag as ot,aq as nn,by as sn,ao as rn,ab as ds,bz as Lt,z as W,E as us,bm as ps,bA as qt,bB as fs,bC as hs,aa as ms,b2 as se,bD as bs,aO as xs,bh as Ce,al as $t,bE as Se,aL as gs,aG as js}from"./vendor-arcblock-CiLB_TiI.js";import{d as Nt}from"./Add-2VCvBnGd.js";import{d as ks}from"./Error-CpAOVH8t.js";import{C as Et}from"./confirm-CucPiuHr.js";import{u as ct}from"./session-ocxAyn6f.js";import{W as go}from"./did-address-49U3oRW2.js";import{E as Be,D as jo,C as ko,P as yo}from"./react-beautiful-dnd.esm-C8vTtkBe.js";import{B as At}from"./bundle-avatar-B19h7IBb.js";import{S as ue}from"./shorten-label-BnvWOC_s.js";import{j as le,a as Je}from"./vendor-utils-DCpRgzMR.js";import{d as ys}from"./Download-BJmwtO6i.js";import{d as vs}from"./QuestionMarkCircle-gL_QM35Z.js";import{u as ws}from"./vendor-hooks-CLzfFpO7.js";import{_ as Re}from"./useSetState-Crt4S51m.js";import{c as zt}from"./index-DoZ2YM4T.js";import{E as Mt}from"./index-DQSF6ElG.js";import{p as nt}from"./index-N-iuMUsJ.js";import"./api-C0C4sDJA.js";import{d as Rs}from"./ChevronRight-B8pf890W.js";import{T as Ss,a as Cs}from"./vendor-mui-x-Bq1FyQ7S.js";import{d as vo}from"./DeleteOutline-VzoIEqow.js";import{c as Is,A as ln,u as Ds,S as Ts,U as Ps,a as mt,b as cn,n as _s,e as Ls,f as wo,g as qs}from"./item-BKMUYpdp.js";import{d as $s}from"./ArrowDropDown-BdHlAt9a.js";import{f as Ie}from"./format-error-C0Ke3VXF.js";import{C as Ns}from"./click-to-copy-DNu8CktB.js";import{d as Es}from"./Launch-BOCFiYoz.js";import{M as As}from"./index-Bi1xb9O8.js";import{r as zs}from"./index-D7mJIWyJ.js";import{d as Ms}from"./Done-BCESxXX2.js";import"./raf-schd.esm-Cxhj8umC.js";import"./get-safe-url-CVhAz4Qr.js";var Ot={},Os=fe;Object.defineProperty(Ot,"__esModule",{value:!0});var an=Ot.default=void 0,Bs=Os(me()),Ws=t;an=Ot.default=(0,Bs.default)((0,Ws.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 Bt={},Vs=fe;Object.defineProperty(Bt,"__esModule",{value:!0});var dn=Bt.default=void 0,Fs=Vs(me()),Us=t;dn=Bt.default=(0,Fs.default)((0,Us.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 Wt={},Hs=fe;Object.defineProperty(Wt,"__esModule",{value:!0});var un=Wt.default=void 0,Gs=Hs(me()),Xs=t;un=Wt.default=(0,Gs.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 Vt({did:e,projectId:o,title:n,logo:r,describe:s}){const l=`${`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e}/${o}/logo/upload`}/${r}`,[a,c]=S.useState(!1),f=Me(h=>h.breakpoints.down("md"));return t.jsxs(u,{sx:{display:"flex",flexDirection:"row",color:a?"primary.main":"grey.900",gap:1},onPointerEnter:()=>c(!0),onPointerLeave:()=>c(!1),children:[t.jsx(Fo,{sx:{borderRadius:1},src:l}),t.jsxs(u,{children:[t.jsx(ue,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),t.jsx(ue,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||a?"primary.main":"grey.700"},children:s||"/"})]})]})}Vt.propTypes={projectId:d.string.isRequired,did:d.string.isRequired,title:d.string.isRequired,logo:d.string.isRequired,describe:d.string.isRequired};function Ft({initUrl:e}){const o=Tt(),n=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:r,locale:s}=Y(),{api:i}=he(),{api:l}=ct(),[a,c]=S.useState(!0),{blocklet:f}=De(),[h,g]=S.useState(null),[x,p]=S.useState(!1),y=Me(m=>m.breakpoints.down("xl")),{componentDid:w=""}=it(),[D,j]=S.useState(null),b=()=>{i.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:n}}).then(m=>{const P=(m==null?void 0:m.projects)||[];c(!1),j(P)}).catch(m=>{c(!1),W.error(m.message)})},T=()=>{o(`${H.UNOWNED_DID}/create/none`,{replace:!0})},L=m=>{g(m)},I=()=>{c(!1),p(!0)},k=()=>{p(!1),g(null)},_=m=>{W.error(m.message),p(!1),g(null)},$=m=>{if(!(m!=null&&m.deleted)){W.error("Delete project failed");return}b(),p(!1),g(null)},B=(m,P,M)=>{let F=m==null?void 0:m.trim();return F?(F=us.toAddress(F).toLocaleLowerCase(),M.some((v,E)=>{const q=P[E];return q&&v.searchable&&v.display!=="excluded"&&v.display!=="false"&&q.toLocaleLowerCase().includes(F)})):!0};if(S.useEffect(()=>{b()},[]),!D&&a)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Be,{})});if(!D)return null;if(!D.length)return t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),t.jsx(ot,{onClick:T,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const R=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:m=>{const P=D[m];return t.jsx(re,{to:`${P.id}`,children:t.jsx(Vt,{did:f.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:m=>m?t.jsx(nn,{type:"success",children:m}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:m=>m?t.jsx(go,{size:14,compact:!0,responsive:!1,did:m}):null}},y||w?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:m=>m?t.jsx(go,{onClick:()=>{o(`/.well-known/service/admin/members?did=${m}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:m}):null}},y||w?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:m=>{const P=(f.children||[]).find(M=>M.meta.did===m);return P?t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(At,{size:14,blocklet:P,ancestors:[f]}),t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},m):""}}},y||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:m=>t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:t.jsx(ue,{children:m})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:m=>t.jsx(sn,{value:Number(m),locale:s})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:m=>{const P=D[m];return t.jsxs(u,{display:"flex",children:[t.jsx(re,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:t.jsx(ae,{title:r("blocklet.publish.createRelease"),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"create",children:t.jsx(an,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&t.jsx(ae,{title:r("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"secondary","aria-label":"create",children:t.jsx(re,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:t.jsx(dn,{sx:{fontSize:18}})})})}),t.jsx(ae,{title:r("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"delete",onClick:()=>L(P),children:t.jsx(rn,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),C=x?t.jsx(ds,{open:!0,popup:!0,onClose:k,action:"check-has-project-id",locale:s,checkFn:l.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:$,onError:_,extraParams:{projectId:h.id,did:f.meta.did,name:h.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:h.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:h.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return t.jsxs(u,{children:[t.jsxs(u,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(u,{display:"flex",flexDirection:"row",alignItems:"center",children:[t.jsx(u,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),t.jsx(ae,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:t.jsx(un,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),t.jsxs(ot,{onClick:T,variant:"contained",children:[t.jsx(Nt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]}),t.jsx(Lt,{className:"main-table",locale:s,data:D,columns:R,options:{sort:!1,download:!1,filter:!1,print:!1,search:!0,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100],searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:400,customSearch:B}}),h&&t.jsx(Et,{title:`${r("common.delete")} ${h.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:I,onCancel:()=>g(null),children:t.jsx(u,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(m=>t.jsxs(u,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[t.jsx(ks,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),t.jsx(A,{component:"span",variant:"inherit",color:"text.secondary",children:m})]}))})}),C]})}Ft.propTypes={initUrl:d.object};Ft.defaultProps={initUrl:null};var Ut={},Js=fe;Object.defineProperty(Ut,"__esModule",{value:!0});var pn=Ut.default=void 0,Qs=Js(me()),Ro=t;pn=Ut.default=(0,Qs.default)([(0,Ro.jsx)("path",{d:"M20 17H4V5h8V3H4c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h4v2h8v-2h4c1.1 0 2-.9 2-2v-3h-2z"},"0"),(0,Ro.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");function Ys(){var I;const{t:e,locale:o}=Y(),{projectId:n}=it(),{api:r}=he(),[s,i]=S.useState(!0),{blocklet:l}=De(),a=Me(k=>k.breakpoints.down("md")),[c,f]=S.useState(null),[h,g]=S.useState(null),[x,p]=S.useState(null),y=(I=window.env)==null?void 0:I.serverEndpoint,w=()=>{r.getReleases({input:{did:l.meta.did,projectId:n}}).then(k=>{const _=(k==null?void 0:k.releases)||[];i(!1),f(_)}).catch(k=>{i(!1),W.error(k.message)})},D=()=>{r.doBatchQuery({getProject:{input:{did:l.meta.did,projectId:n}},getReleases:{input:{did:l.meta.did,projectId:n}}}).then(k=>{g(k.getProject.project||{}),f(k.getReleases.releases||[]),i(!1)}).catch(k=>{i(!1),W.error(k.message)})};S.useEffect(()=>{D()},[]);const j=()=>{i(!1);const k=x.id;r.deleteRelease({input:{did:l.meta.did,projectId:n,releaseId:k}}).then(()=>{i(!1),w(),W.success(e("common.removeSuccess")),p(null)}).catch(_=>{i(!1),W.error(_.message)})},b=k=>{p(k)};if(!c&&s)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Be,{})});if(!c)return null;const T=t.jsxs(Uo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(re,{to:"..",children:e("common.blockletStudio")}),t.jsx(A,{color:"text.primary",children:t.jsx(ue,{maxLength:a?6:30,children:h.blockletTitle})})]});if(!c.length)return t.jsxs(t.Fragment,{children:[T,t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:e("blocklet.publish.releaseEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:e("blocklet.publish.createReleaseTip")}),t.jsx(re,{to:"create/none",children:t.jsx(ot,{variant:"contained",children:e("blocklet.publish.createRelease")})})]})]});const L=[{label:e("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:k=>{const _=c[k];return t.jsx(re,{to:`view/${_.id}`,children:t.jsx(Vt,{did:l.meta.did,projectId:h.id,logo:_.blockletLogo,title:_.blockletVersion,describe:_.blockletTitle})})}}},{label:e("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:k=>{const _=c[k];return t.jsx(A,{className:"note",children:_.note||""})}}},{label:e("common.status"),name:"status",options:{customBodyRender:k=>t.jsx(nn,{type:k==="published"?"success":"warning",children:k==="published"?"Released":ps(k)})}},{label:e("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:k=>{const _=c[k];return _.status!==ke.PROJECT.RELEASE_STATUS.published?"":t.jsx(sn,{value:Number(_.updatedAt),locale:o})}}},{label:e("common.actions"),name:"actions",options:{customBodyRenderLite:k=>{var m;const _=c[k];let $="",B="";const R=_.status==="published";if(R){const P=le(y,`/api/project/${l.meta.did}/${h.id}/${h.lastReleaseId}/release/blocklet.json`),M=new URL(y);M.pathname=le(M.pathname,"/launch-blocklet/agreement"),M.searchParams.set("blocklet_meta_url",P),$=M.href,B=le(`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${l.meta.did}/${h.id}/${h.lastReleaseId}/download/${(h.lastReleaseFiles||[])[0]}`)}const C=(m=h.blockletComponents)!=null&&m.some(P=>P.included)||_.uploadedResource?"pack":"resource";return t.jsxs(u,{display:"flex",alignItems:"center",children:[R&&C==="pack"&&t.jsx(ae,{title:e("blocklet.publish.install",{name:h.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"secondary","aria-label":"create",children:t.jsx("a",{style:{display:"flex"},href:$,target:"_blank",rel:"noreferrer",children:t.jsx(pn,{sx:{fontSize:18}})})})}),R&&t.jsx(ae,{title:e("blocklet.publish.download",{name:h.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"download",children:t.jsx("a",{style:{display:"flex"},href:B,children:t.jsx(ys,{sx:{fontSize:18}})})})}),t.jsx(ae,{title:e("blocklet.publish.delete",{name:h.blockletTitle}),placement:"top",children:t.jsx(ne,{color:"primary","aria-label":"delete",onClick:()=>b(_),children:t.jsx(rn,{sx:{fontSize:18}})})})]})}}}];return t.jsxs(Zs,{children:[t.jsxs(u,{className:"header",children:[T,t.jsx(re,{to:"new-release/none",children:t.jsxs(ot,{variant:"contained",children:[t.jsx(Nt,{style:{fontSize:"1.3em",marginRight:4}}),e("blocklet.publish.createRelease")]})})]}),t.jsx(Lt,{className:"main-table",verticalKeyWidth:100,locale:o,data:c,columns:L,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),x&&t.jsx(Et,{title:e(`${e("common.delete")} ${x.blockletVersion}`),description:e("blocklet.publish.deleteReleaseTip"),confirm:e("common.confirm"),onConfirm:j,onCancel:()=>p(null)})]})}const Zs=ie(u)`
|
|
3
3
|
.header {
|
|
4
4
|
display: flex;
|
|
5
5
|
align-items: center;
|
|
@@ -129,7 +129,7 @@ import{r as S,k as Tt,l as it,L as re,f as Gn,h as Xn,i as ft}from"./vendor-reac
|
|
|
129
129
|
background: #fff;
|
|
130
130
|
z-index: 10;
|
|
131
131
|
}
|
|
132
|
-
`;var Zt={},ar=fe;Object.defineProperty(Zt,"__esModule",{value:!0});var yt=Zt.default=void 0,dr=ar(me()),ur=t;yt=Zt.default=(0,dr.default)((0,ur.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 So="lastWantToConnectStoreId";function pr(e){var a,c;const[o,n]=S.useState(null),{session:r}=ct(),s=S.useCallback(f=>{n(f),localStorage.setItem(So,f==null?void 0:f.id)},[n]),i=S.useMemo(()=>{var x,p,y,w;const f=localStorage.getItem(So),h=f?(((x=e==null?void 0:e.settings)==null?void 0:x.storeList)||[]).find(D=>D.id===f):null;if(h)return h;let g=(((p=e==null?void 0:e.settings)==null?void 0:p.storeList)||[]).find(D=>{var j;return!(D.id!==H.BLOCKLET_STORE.id||D.scope&&D.scope!=="studio"&&D.scope!==((j=r==null?void 0:r.user)==null?void 0:j.did))});return g||(g=(w=(y=e==null?void 0:e.settings)==null?void 0:y.storeList)==null?void 0:w[0]),g},[(a=e==null?void 0:e.settings)==null?void 0:a.storeList,(c=r==null?void 0:r.user)==null?void 0:c.did]);return[o||i||{},s]}const xt={};async function hn(e,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:s=""}){xt[s]&&clearTimeout(xt[s]),await new Promise(a=>setTimeout(a,r));const i=Date.now(),l=async(a,c)=>{try{const f=await e();a(f)}catch(f){Date.now()-i>n?c(f):s?xt[s]=setTimeout(()=>l(a,c),o):setTimeout(()=>l(a,c),o)}};return new Promise(l)}function fr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function hr(e,{did:o,projectId:n,messageId:r}){return hn(async()=>{var i;const s=await e.getProject({input:{did:o,projectId:n,messageId:r}});if(!((i=s==null?void 0:s.project)!=null&&i.blockletDid))throw new Error("Connected store not found");return s.project.blockletDid},{timerKey:"connect-studio"})}function mr(e,{did:o,projectId:n,storeId:r}){return hn(async()=>{var l,a;const s=await e.getProject({input:{did:o,projectId:n,messageId:""}});if(!((a=(l=s==null?void 0:s.project)==null?void 0:l.connectedStores)!=null&&a.length))throw new Error("Connected store not found");if(!s.project.connectedStores.find(c=>c.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}const mn=({fromBlocklet:e,nodeInfo:o,blocklet:n,userDid:r})=>{var l,a;const s=e?(l=n==null?void 0:n.meta)==null?void 0:l.did:o==null?void 0:o.did;let i=e?((a=n==null?void 0:n.settings)==null?void 0:a.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(i)||(i=[]),i=i.filter(c=>c.protected||!c.scope||c.scope==="studio"||c.scope===r),{teamDid:s,storeList:i}};function Kt({blocklet:e,store:o={},onChangeStore:n,onClick:r,disabled:s,loading:i,componentDid:l}){var m,P,M;const{t:a}=Y(),{session:c}=ct(),{api:f,info:h,inService:g}=he(),x=De(),[p,y]=S.useState(!1),w=S.useRef(null),[D,j]=S.useState(!1),[b,T]=S.useState(null),L=F=>{n(F),y(!1)},I=()=>{y(!p)},k=F=>{w.current&&w.current.contains(F.target)||y(!1)},_=()=>{j(!0)},$=()=>{j(!1)},B=async()=>{var F;if(b)try{await f.deleteBlockletStore({input:{teamDid:e.meta.did,url:b.url,projectId:"",scope:b.scope||"studio"}}),await((F=x==null?void 0:x.actions)==null?void 0:F.refreshBlocklet())}catch(v){W.error(`Remove Blocklet Store Error: ${Ie(v)}`)}finally{T(null)}},{storeList:R}=mn({fromBlocklet:g,blocklet:e,nodeInfo:h,componentDid:l,userDid:(m=c==null?void 0:c.user)==null?void 0:m.did}),C=(P=e==null?void 0:e.meta)==null?void 0:P.did;return t.jsxs(t.Fragment,{children:[t.jsxs(kt,{disabled:s,ref:w,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[t.jsxs(K,{onClick:r,children:[i&&t.jsx(et,{size:14,sx:{mr:.5}}),`${a("common.connect")} ${o.name||""}`]}),t.jsx(K,{size:"small","aria-controls":p?"split-button-menu":void 0,"aria-expanded":p?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:I,children:t.jsx($s,{})})]}),t.jsx(Go,{sx:{zIndex:10},open:p,anchorEl:w.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:F})=>t.jsx(Xo,{...F,style:{transformOrigin:"center top"},children:t.jsx(Pt,{children:t.jsx(Jo,{onClickAway:k,children:t.jsxs(Qo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[R==null?void 0:R.map(v=>{var E;return t.jsxs(de,{selected:v.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>L(v),children:[t.jsxs(u,{children:[t.jsx(ue,{sx:{fontSize:"16px"},maxLength:24,children:v.name}),t.jsx(ue,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:v.url})]}),Is({store:v,userDid:(E=c==null?void 0:c.user)==null?void 0:E.did})&&t.jsx(ne,{sx:{ml:1},onClick:q=>{q.preventDefault(),q.stopPropagation(),T(v)},children:t.jsx(se,{icon:"ic:outline-delete"})})]},v.url)}),t.jsx(Qn,{}),t.jsxs(de,{onClick:_,children:[t.jsx(Nt,{font:!0}),t.jsx(A,{variant:"inherit",children:a("store.blockletRegistry.addRegistry")})]})]})})})})}),D&&t.jsx(ln,{hiddenChildren:!0,open:!0,onClose:$,teamDid:C,storeList:R,scope:"studio",onAdd:(M=x==null?void 0:x.actions)==null?void 0:M.refreshBlocklet}),b&&t.jsx(Et,{displayError:!0,title:`${a("common.delete")} ${b.name}`,description:a("blocklet.publish.deleteStoreTip",{name:b.name}),confirm:a("common.confirm"),onConfirm:B,onCancel:()=>T(null)})]})}Kt.propTypes={store:d.object,blocklet:d.object,onChangeStore:d.func.isRequired,onClick:d.func.isRequired,loading:d.bool.isRequired,disabled:d.bool.isRequired,componentDid:d.string.isRequired,projectType:d.string.isRequired,getData:d.func.isRequired};Kt.defaultProps={store:null,blocklet:null};var pe=S;const Ne=/^[a-z0-9]+(-[a-z0-9]+)*$/,at=(e,o,n,r="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const a=s.pop(),c=s.pop(),f={provider:s.length>0?s[0]:r,prefix:c,name:a};return o&&!Ze(f)?null:f}const i=s[0],l=i.split("-");if(l.length>1){const a={provider:r,prefix:l.shift(),name:l.join("-")};return o&&!Ze(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:i};return o&&!Ze(a,n)?null:a}return null},Ze=(e,o)=>e?!!((e.provider===""||e.provider.match(Ne))&&(o&&e.prefix===""||e.prefix.match(Ne))&&e.name.match(Ne)):!1,bn=Object.freeze({left:0,top:0,width:16,height:16}),st=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),eo=Object.freeze({...bn,...st}),vt=Object.freeze({...eo,body:"",hidden:!1});function br(e,o){const n={};!e.hFlip!=!o.hFlip&&(n.hFlip=!0),!e.vFlip!=!o.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(o.rotate||0))%4;return r&&(n.rotate=r),n}function Co(e,o){const n=br(e,o);for(const r in vt)r in st?r in e&&!(r in n)&&(n[r]=st[r]):r in o?n[r]=o[r]:r in e&&(n[r]=e[r]);return n}function xr(e,o){const n=e.icons,r=e.aliases||Object.create(null),s=Object.create(null);function i(l){if(n[l])return s[l]=[];if(!(l in s)){s[l]=null;const a=r[l]&&r[l].parent,c=a&&i(a);c&&(s[l]=[a].concat(c))}return s[l]}return Object.keys(n).concat(Object.keys(r)).forEach(i),s}function gr(e,o,n){const r=e.icons,s=e.aliases||Object.create(null);let i={};function l(a){i=Co(r[a]||s[a],i)}return l(o),n.forEach(l),Co(e,i)}function xn(e,o){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(s=>{o(s,null),n.push(s)});const r=xr(e);for(const s in r){const i=r[s];i&&(o(s,gr(e,s,i)),n.push(s))}return n}const jr={provider:"",aliases:{},not_found:{},...bn};function gt(e,o){for(const n in o)if(n in e&&typeof e[n]!=typeof o[n])return!1;return!0}function gn(e){if(typeof e!="object"||e===null)return null;const o=e;if(typeof o.prefix!="string"||!e.icons||typeof e.icons!="object"||!gt(e,jr))return null;const n=o.icons;for(const s in n){const i=n[s];if(!s.match(Ne)||typeof i.body!="string"||!gt(i,vt))return null}const r=o.aliases||Object.create(null);for(const s in r){const i=r[s],l=i.parent;if(!s.match(Ne)||typeof l!="string"||!n[l]&&!r[l]||!gt(i,vt))return null}return o}const Io=Object.create(null);function kr(e,o){return{provider:e,prefix:o,icons:Object.create(null),missing:new Set}}function ve(e,o){const n=Io[e]||(Io[e]=Object.create(null));return n[o]||(n[o]=kr(e,o))}function to(e,o){return gn(o)?xn(o,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function yr(e,o,n){try{if(typeof n.body=="string")return e.icons[o]={...n},!0}catch{}return!1}let Ae=!1;function jn(e){return typeof e=="boolean"&&(Ae=e),Ae}function vr(e){const o=typeof e=="string"?at(e,!0,Ae):e;if(o){const n=ve(o.provider,o.prefix),r=o.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function wr(e,o){const n=at(e,!0,Ae);if(!n)return!1;const r=ve(n.provider,n.prefix);return yr(r,n.name,o)}function Rr(e,o){if(typeof e!="object")return!1;if(typeof o!="string"&&(o=e.provider||""),Ae&&!o&&!e.prefix){let s=!1;return gn(e)&&(e.prefix="",xn(e,(i,l)=>{l&&wr(i,l)&&(s=!0)})),s}const n=e.prefix;if(!Ze({provider:o,prefix:n,name:"a"}))return!1;const r=ve(o,n);return!!to(r,e)}const kn=Object.freeze({width:null,height:null}),yn=Object.freeze({...kn,...st}),Sr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Cr=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Do(e,o,n){if(o===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*o*n)/n;if(typeof e!="string")return e;const r=e.split(Sr);if(r===null||!r.length)return e;const s=[];let i=r.shift(),l=Cr.test(i);for(;;){if(l){const a=parseFloat(i);isNaN(a)?s.push(i):s.push(Math.ceil(a*o*n)/n)}else s.push(i);if(i=r.shift(),i===void 0)return s.join("");l=!l}}const Ir=e=>e==="unset"||e==="undefined"||e==="none";function Dr(e,o){const n={...eo,...e},r={...yn,...o},s={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,r].forEach(y=>{const w=[],D=y.hFlip,j=y.vFlip;let b=y.rotate;D?j?b+=2:(w.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),w.push("scale(-1 1)"),s.top=s.left=0):j&&(w.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),w.push("scale(1 -1)"),s.top=s.left=0);let T;switch(b<0&&(b-=Math.floor(b/4)*4),b=b%4,b){case 1:T=s.height/2+s.top,w.unshift("rotate(90 "+T.toString()+" "+T.toString()+")");break;case 2:w.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:T=s.width/2+s.left,w.unshift("rotate(-90 "+T.toString()+" "+T.toString()+")");break}b%2===1&&(s.left!==s.top&&(T=s.left,s.left=s.top,s.top=T),s.width!==s.height&&(T=s.width,s.width=s.height,s.height=T)),w.length&&(i='<g transform="'+w.join(" ")+'">'+i+"</g>")});const l=r.width,a=r.height,c=s.width,f=s.height;let h,g;l===null?(g=a===null?"1em":a==="auto"?f:a,h=Do(g,c/f)):(h=l==="auto"?c:l,g=a===null?Do(h,f/c):a==="auto"?f:a);const x={},p=(y,w)=>{Ir(w)||(x[y]=w.toString())};return p("width",h),p("height",g),x.viewBox=s.left.toString()+" "+s.top.toString()+" "+c.toString()+" "+f.toString(),{attributes:x,body:i}}const Tr=/\sid="(\S+)"/g,Pr="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let _r=0;function Lr(e,o=Pr){const n=[];let r;for(;r=Tr.exec(e);)n.push(r[1]);if(!n.length)return e;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(i=>{const l=typeof o=="function"?o(i):o+(_r++).toString(),a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+l+s+"$3")}),e=e.replace(new RegExp(s,"g"),""),e}const wt=Object.create(null);function qr(e,o){wt[e]=o}function Rt(e){return wt[e]||wt[""]}function oo(e){let o;if(typeof e.resources=="string")o=[e.resources];else if(o=e.resources,!(o instanceof Array)||!o.length)return null;return{resources:o,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const no=Object.create(null),$e=["https://api.simplesvg.com","https://api.unisvg.com"],Ke=[];for(;$e.length>0;)$e.length===1||Math.random()>.5?Ke.push($e.shift()):Ke.push($e.pop());no[""]=oo({resources:["https://api.iconify.design"].concat(Ke)});function $r(e,o){const n=oo(o);return n===null?!1:(no[e]=n,!0)}function so(e){return no[e]}const Nr=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let To=Nr();function Er(e,o){const n=so(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let s=0;n.resources.forEach(l=>{s=Math.max(s,l.length)});const i=o+".json?icons=";r=n.maxURL-s-n.path.length-i.length}return r}function Ar(e){return e===404}const zr=(e,o,n)=>{const r=[],s=Er(e,o),i="icons";let l={type:i,provider:e,prefix:o,icons:[]},a=0;return n.forEach((c,f)=>{a+=c.length+1,a>=s&&f>0&&(r.push(l),l={type:i,provider:e,prefix:o,icons:[]},a=c.length),l.icons.push(c)}),r.push(l),r};function Mr(e){if(typeof e=="string"){const o=so(e);if(o)return o.path}return"/"}const Or=(e,o,n)=>{if(!To){n("abort",424);return}let r=Mr(o.provider);switch(o.type){case"icons":{const i=o.prefix,a=o.icons.join(","),c=new URLSearchParams({icons:a});r+=i+".json?"+c.toString();break}case"custom":{const i=o.uri;r+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n("abort",400);return}let s=503;To(e+r).then(i=>{const l=i.status;if(l!==200){setTimeout(()=>{n(Ar(l)?"abort":"next",l)});return}return s=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?n("abort",i):n("next",s)});return}setTimeout(()=>{n("success",i)})}).catch(()=>{n("next",s)})},Br={prepare:zr,send:Or};function Wr(e){const o={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((s,i)=>s.provider!==i.provider?s.provider.localeCompare(i.provider):s.prefix!==i.prefix?s.prefix.localeCompare(i.prefix):s.name.localeCompare(i.name));let r={provider:"",prefix:"",name:""};return e.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const i=s.provider,l=s.prefix,a=s.name,c=n[i]||(n[i]=Object.create(null)),f=c[l]||(c[l]=ve(i,l));let h;a in f.icons?h=o.loaded:l===""||f.missing.has(a)?h=o.missing:h=o.pending;const g={provider:i,prefix:l,name:a};h.push(g)}),o}function vn(e,o){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(s=>s.id!==o))})}function Vr(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const o=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!o.length)return;let n=!1;const r=e.provider,s=e.prefix;o.forEach(i=>{const l=i.icons,a=l.pending.length;l.pending=l.pending.filter(c=>{if(c.prefix!==s)return!0;const f=c.name;if(e.icons[f])l.loaded.push({provider:r,prefix:s,name:f});else if(e.missing.has(f))l.missing.push({provider:r,prefix:s,name:f});else return n=!0,!0;return!1}),l.pending.length!==a&&(n||vn([e],i.id),i.callback(l.loaded.slice(0),l.missing.slice(0),l.pending.slice(0),i.abort))})}))}let Fr=0;function Ur(e,o,n){const r=Fr++,s=vn.bind(null,n,r);if(!o.pending.length)return s;const i={id:r,icons:o,callback:e,abort:s};return n.forEach(l=>{(l.loaderCallbacks||(l.loaderCallbacks=[])).push(i)}),s}function Hr(e,o=!0,n=!1){const r=[];return e.forEach(s=>{const i=typeof s=="string"?at(s,o,n):s;i&&r.push(i)}),r}var Gr={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Xr(e,o,n,r){const s=e.resources.length,i=e.random?Math.floor(Math.random()*s):e.index;let l;if(e.random){let k=e.resources.slice(0);for(l=[];k.length>1;){const _=Math.floor(Math.random()*k.length);l.push(k[_]),k=k.slice(0,_).concat(k.slice(_+1))}l=l.concat(k)}else l=e.resources.slice(i).concat(e.resources.slice(0,i));const a=Date.now();let c="pending",f=0,h,g=null,x=[],p=[];typeof r=="function"&&p.push(r);function y(){g&&(clearTimeout(g),g=null)}function w(){c==="pending"&&(c="aborted"),y(),x.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),x=[]}function D(k,_){_&&(p=[]),typeof k=="function"&&p.push(k)}function j(){return{startTime:a,payload:o,status:c,queriesSent:f,queriesPending:x.length,subscribe:D,abort:w}}function b(){c="failed",p.forEach(k=>{k(void 0,h)})}function T(){x.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),x=[]}function L(k,_,$){const B=_!=="success";switch(x=x.filter(R=>R!==k),c){case"pending":break;case"failed":if(B||!e.dataAfterTimeout)return;break;default:return}if(_==="abort"){h=$,b();return}if(B){h=$,x.length||(l.length?I():b());return}if(y(),T(),!e.random){const R=e.resources.indexOf(k.resource);R!==-1&&R!==e.index&&(e.index=R)}c="completed",p.forEach(R=>{R($)})}function I(){if(c!=="pending")return;y();const k=l.shift();if(k===void 0){if(x.length){g=setTimeout(()=>{y(),c==="pending"&&(T(),b())},e.timeout);return}b();return}const _={status:"pending",resource:k,callback:($,B)=>{L(_,$,B)}};x.push(_),f++,g=setTimeout(I,e.rotate),n(k,o,_.callback)}return setTimeout(I),j}function wn(e){const o={...Gr,...e};let n=[];function r(){n=n.filter(a=>a().status==="pending")}function s(a,c,f){const h=Xr(o,a,c,(g,x)=>{r(),f&&f(g,x)});return n.push(h),h}function i(a){return n.find(c=>a(c))||null}return{query:s,find:i,setIndex:a=>{o.index=a},getIndex:()=>o.index,cleanup:r}}function Po(){}const jt=Object.create(null);function Jr(e){if(!jt[e]){const o=so(e);if(!o)return;const n=wn(o),r={config:o,redundancy:n};jt[e]=r}return jt[e]}function Qr(e,o,n){let r,s;if(typeof e=="string"){const i=Rt(e);if(!i)return n(void 0,424),Po;s=i.send;const l=Jr(e);l&&(r=l.redundancy)}else{const i=oo(e);if(i){r=wn(i);const l=e.resources?e.resources[0]:"",a=Rt(l);a&&(s=a.send)}}return!r||!s?(n(void 0,424),Po):r.query(o,s,n)().abort}const _o="iconify2",ze="iconify",Rn=ze+"-count",Lo=ze+"-version",Sn=36e5,Yr=168;function St(e,o){try{return e.getItem(o)}catch{}}function ro(e,o,n){try{return e.setItem(o,n),!0}catch{}}function qo(e,o){try{e.removeItem(o)}catch{}}function Ct(e,o){return ro(e,Rn,o.toString())}function It(e){return parseInt(St(e,Rn))||0}const dt={local:!0,session:!0},Cn={local:new Set,session:new Set};let lo=!1;function Zr(e){lo=e}let He=typeof window>"u"?{}:window;function In(e){const o=e+"Storage";try{if(He&&He[o]&&typeof He[o].length=="number")return He[o]}catch{}dt[e]=!1}function Dn(e,o){const n=In(e);if(!n)return;const r=St(n,Lo);if(r!==_o){if(r){const a=It(n);for(let c=0;c<a;c++)qo(n,ze+c.toString())}ro(n,Lo,_o),Ct(n,0);return}const s=Math.floor(Date.now()/Sn)-Yr,i=a=>{const c=ze+a.toString(),f=St(n,c);if(typeof f=="string"){try{const h=JSON.parse(f);if(typeof h=="object"&&typeof h.cached=="number"&&h.cached>s&&typeof h.provider=="string"&&typeof h.data=="object"&&typeof h.data.prefix=="string"&&o(h,a))return!0}catch{}qo(n,c)}};let l=It(n);for(let a=l-1;a>=0;a--)i(a)||(a===l-1?(l--,Ct(n,l)):Cn[e].add(a))}function Tn(){if(!lo){Zr(!0);for(const e in dt)Dn(e,o=>{const n=o.data,r=o.provider,s=n.prefix,i=ve(r,s);if(!to(i,n).length)return!1;const l=n.lastModified||-1;return i.lastModifiedCached=i.lastModifiedCached?Math.min(i.lastModifiedCached,l):l,!0})}}function Kr(e,o){const n=e.lastModifiedCached;if(n&&n>=o)return n===o;if(e.lastModifiedCached=o,n)for(const r in dt)Dn(r,s=>{const i=s.data;return s.provider!==e.provider||i.prefix!==e.prefix||i.lastModified===o});return!0}function el(e,o){lo||Tn();function n(r){let s;if(!dt[r]||!(s=In(r)))return;const i=Cn[r];let l;if(i.size)i.delete(l=Array.from(i).shift());else if(l=It(s),!Ct(s,l+1))return;const a={cached:Math.floor(Date.now()/Sn),provider:e.provider,data:o};return ro(s,ze+l.toString(),JSON.stringify(a))}o.lastModified&&!Kr(e,o.lastModified)||Object.keys(o.icons).length&&(o.not_found&&(o=Object.assign({},o),delete o.not_found),n("local")||n("session"))}function $o(){}function tl(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Vr(e)}))}function ol(e,o){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(o).sort():e.iconsToLoad=o,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:r}=e,s=e.iconsToLoad;delete e.iconsToLoad;let i;if(!s||!(i=Rt(n)))return;i.prepare(n,r,s).forEach(a=>{Qr(n,a,c=>{if(typeof c!="object")a.icons.forEach(f=>{e.missing.add(f)});else try{const f=to(e,c);if(!f.length)return;const h=e.pendingIcons;h&&f.forEach(g=>{h.delete(g)}),el(e,c)}catch(f){console.error(f)}tl(e)})})}))}const nl=(e,o)=>{const n=Hr(e,!0,jn()),r=Wr(n);if(!r.pending.length){let c=!0;return o&&setTimeout(()=>{c&&o(r.loaded,r.missing,r.pending,$o)}),()=>{c=!1}}const s=Object.create(null),i=[];let l,a;return r.pending.forEach(c=>{const{provider:f,prefix:h}=c;if(h===a&&f===l)return;l=f,a=h,i.push(ve(f,h));const g=s[f]||(s[f]=Object.create(null));g[h]||(g[h]=[])}),r.pending.forEach(c=>{const{provider:f,prefix:h,name:g}=c,x=ve(f,h),p=x.pendingIcons||(x.pendingIcons=new Set);p.has(g)||(p.add(g),s[f][h].push(g))}),i.forEach(c=>{const{provider:f,prefix:h}=c;s[f][h].length&&ol(c,s[f][h])}),o?Ur(o,r,i):$o};function sl(e,o){const n={...e};for(const r in o){const s=o[r],i=typeof s;r in kn?(s===null||s&&(i==="string"||i==="number"))&&(n[r]=s):i===typeof n[r]&&(n[r]=r==="rotate"?s%4:s)}return n}const rl=/[\s,]+/;function ll(e,o){o.split(rl).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function il(e,o=0){const n=e.replace(/^-?[0-9.]*/,"");function r(s){for(;s<0;)s+=4;return s%4}if(n===""){const s=parseInt(e);return isNaN(s)?0:r(s)}else if(n!==e){let s=0;switch(n){case"%":s=25;break;case"deg":s=90}if(s){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i=i/s,i%1===0?r(i):0)}}return o}function cl(e,o){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in o)n+=" "+r+'="'+o[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function al(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function dl(e){return"data:image/svg+xml,"+al(e)}function ul(e){return'url("'+dl(e)+'")'}let Ee;function pl(){try{Ee=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Ee=null}}function fl(e){return Ee===void 0&&pl(),Ee?Ee.createHTML(e):e}const Pn={...yn,inline:!1},hl={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},ml={display:"inline-block"},Dt={backgroundColor:"currentColor"},_n={backgroundColor:"transparent"},No={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Eo={WebkitMask:Dt,mask:Dt,background:_n};for(const e in Eo){const o=Eo[e];for(const n in No)o[e+n]=No[n]}const bl={...Pn,inline:!0};function Ao(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const xl=(e,o,n,r)=>{const s=n?bl:Pn,i=sl(s,o),l=o.mode||"svg",a={},c=o.style||{},f={...l==="svg"?hl:{},ref:r};for(let j in o){const b=o[j];if(b!==void 0)switch(j){case"icon":case"style":case"children":case"onLoad":case"mode":case"_ref":case"_inline":break;case"inline":case"hFlip":case"vFlip":i[j]=b===!0||b==="true"||b===1;break;case"flip":typeof b=="string"&&ll(i,b);break;case"color":a.color=b;break;case"rotate":typeof b=="string"?i[j]=il(b):typeof b=="number"&&(i[j]=b);break;case"ariaHidden":case"aria-hidden":b!==!0&&b!=="true"&&delete f["aria-hidden"];break;default:s[j]===void 0&&(f[j]=b)}}const h=Dr(e,i),g=h.attributes;if(i.inline&&(a.verticalAlign="-0.125em"),l==="svg"){f.style={...a,...c},Object.assign(f,g);let j=0,b=o.id;return typeof b=="string"&&(b=b.replace(/-/g,"_")),f.dangerouslySetInnerHTML={__html:fl(Lr(h.body,b?()=>b+"ID"+j++:"iconifyReact"))},pe.createElement("svg",f)}const{body:x,width:p,height:y}=e,w=l==="mask"||(l==="bg"?!1:x.indexOf("currentColor")!==-1),D=cl(x,{...g,width:p+"",height:y+""});return f.style={...a,"--svg":ul(D),width:Ao(g.width),height:Ao(g.height),...ml,...w?Dt:_n,...c},pe.createElement("span",f)};jn(!0);qr("",Br);if(typeof document<"u"&&typeof window<"u"){Tn();const e=window;if(e.IconifyPreload!==void 0){const o=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof o=="object"&&o!==null&&(o instanceof Array?o:[o]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!Rr(r))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const o=e.IconifyProviders;if(typeof o=="object"&&o!==null)for(let n in o){const r="IconifyProviders["+n+"] is invalid.";try{const s=o[n];if(typeof s!="object"||!s||s.resources===void 0)continue;$r(n,s)||console.error(r)}catch{console.error(r)}}}}class Ln extends pe.Component{constructor(o){super(o),this.state={icon:null}}_abortLoading(){this._loading&&(this._loading.abort(),this._loading=null)}_setData(o){this.state.icon!==o&&this.setState({icon:o})}_checkIcon(o){const n=this.state,r=this.props.icon;if(typeof r=="object"&&r!==null&&typeof r.body=="string"){this._icon="",this._abortLoading(),(o||n.icon===null)&&this._setData({data:r});return}let s;if(typeof r!="string"||(s=at(r,!1,!0))===null){this._abortLoading(),this._setData(null);return}const i=vr(s);if(!i){(!this._loading||this._loading.name!==r)&&(this._abortLoading(),this._icon="",this._setData(null),i!==null&&(this._loading={name:r,abort:nl([s],this._checkIcon.bind(this,!1))}));return}if(this._icon!==r||n.icon===null){this._abortLoading(),this._icon=r;const l=["iconify"];s.prefix!==""&&l.push("iconify--"+s.prefix),s.provider!==""&&l.push("iconify--"+s.provider),this._setData({data:i,classes:l}),this.props.onLoad&&this.props.onLoad(r)}}componentDidMount(){this._checkIcon(!1)}componentDidUpdate(o){o.icon!==this.props.icon&&this._checkIcon(!0)}componentWillUnmount(){this._abortLoading()}render(){const o=this.props,n=this.state.icon;if(n===null)return o.children?o.children:pe.createElement("span",{});let r=o;return n.classes&&(r={...o,className:(typeof o.className=="string"?o.className+" ":"")+n.classes.join(" ")}),xl({...eo,...n.data},r,o._inline,o._ref)}}const gl=pe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!1};return pe.createElement(Ln,r)});pe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!0};return pe.createElement(Ln,r)});var jl=gl;const kl=e=>{const o=e.includes("youtube.com")||e.includes("youtu.be"),n=e.includes("vimeo.com");return o||n};function ut({url:e,style:o,controls:n,modestbranding:r}){var a;const{t:s}=Y(),i=e.includes("youtube.com")||e.includes("youtu.be"),l=e.includes("vimeo.com");if(i){const c=((a=e.split("v=")[1])==null?void 0:a.split("&")[0])||e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:t.jsx("iframe",{src:`https://www.youtube.com/embed/${c}?modestbranding=${r}&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(l){const c=e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:t.jsx("iframe",{src:`https://player.vimeo.com/video/${c}`,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 t.jsx(u,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:t.jsxs(u,{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:[t.jsx(jl,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),t.jsx(A,{variant:"body1",sx:{opacity:.5},children:s("studio.videoDialogNoSrc")})]})})}ut.propTypes={url:d.string.isRequired,style:d.object,controls:d.number,modestbranding:d.number};ut.defaultProps={style:{},controls:1,modestbranding:1};function qn({setParams:e,onClose:o,params:n}){const{t:r}=Y(),[s,i]=S.useState(""),l=s&&n.blockletVideos.includes(s),a=kl(s),c=()=>{e(f=>{const h=[...f.blockletVideos];return h.push(s),{...f,blockletVideos:h}}),o()};return t.jsxs(_t,{open:!0,fullWidth:!0,maxWidth:"sm",children:[t.jsx(Yo,{children:r("studio.videoDialogTitle")}),t.jsxs(Zo,{children:[t.jsx(Yn,{fullWidth:!0,value:s,onChange:f=>i(f.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:s?t.jsx(Oe,{position:"end",children:t.jsx(ne,{onClick:()=>i(""),children:t.jsx(xs,{})})}):null,error:l}),l&&t.jsx(A,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),t.jsx(ut,{url:s,style:{marginTop:"20px",borderRadius:"4px"}})]}),t.jsxs(Ko,{children:[t.jsx(K,{onClick:()=>o(),children:r("studio.cancel")}),t.jsx(K,{disabled:!a||l,onClick:c,children:r("studio.confirm")})]})]})}qn.propTypes={onClose:d.func.isRequired,params:d.object.isRequired,setParams:d.func.isRequired};const zo=S.lazy(()=>on(()=>import("./index-DMelUylN.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(e=>({default:e.Uploader})));function $n({projectId:e,readOnly:o,loading:n,blocklet:r,params:s,setParams:i,paramsErrTip:l,setParamsErrTip:a,setLoading:c,initUrl:f,initLogoUrl:h,setInitLogoUrl:g,componentDid:x}){const{t:p}=Y(),{api:y}=he(),w=Tt(),D=S.useRef(null),j=S.useRef(null),[b,T]=pr(r),[L,I]=S.useState(!1),k=Ds({messageType:"connect-store-message",onOpen:()=>c(!0),onClose:()=>c(!1)}),_=async v=>{const E=setTimeout(()=>{c(!1)},2e4),q=await hr(y,v);c(!1),clearTimeout(E),window.parent.postMessage({event:"studioDialog.connected",componentDid:x},"*"),w(window.location.pathname.replace(`${H.UNOWNED_DID}/create`,`${q}/create`),{replace:!0})},$=()=>{if(!s.blockletTitle){W.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(b!=null&&b.url)){W.error(p("blocklet.publish.noStoreSelected"));return}const v=fr();k(async(E,q)=>{var V,G,te;try{const J=await y.connectByStudio({input:{did:(V=r==null?void 0:r.meta)==null?void 0:V.did,blockletTitle:s==null?void 0:s.blockletTitle,storeUrl:b.url,storeId:b.id,storeName:b.name,type:((G=s==null?void 0:s.blockletComponents)==null?void 0:G.length)>0?"pack":"resource",componentDid:x,messageId:v,tenantScope:(f==null?void 0:f.searchParams.get("tenantScope"))||""}});if(!(J!=null&&J.url)){W.error("failed to connect to store");return}q(J.url),_({did:(te=r==null?void 0:r.meta)==null?void 0:te.did,projectId:"",messageId:v})}catch(J){const Z=Ie(J);W.error(Z),c(!1)}})},B=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/logo/upload`,R=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/screenshot/upload`,C=s!=null&&s.blockletLogo?`${B}/${s.blockletLogo}`:`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,m=((s==null?void 0:s.blockletScreenshots)||[]).filter(Boolean).map(v=>`${R}/${v}`),P=()=>o?!1:!e||e===H.UNOWNED_DID?(W.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,M=v=>{if(!v.destination)return;const E=Array.from(s.blockletScreenshots),[q]=E.splice(v.source.index,1);E.splice(v.destination.index,0,q),i(V=>({...V,blockletScreenshots:E}))},F=v=>{if(!v.destination)return;const E=Array.from(s.blockletVideos),[q]=E.splice(v.source.index,1);E.splice(v.destination.index,0,q),i(V=>({...V,blockletVideos:E}))};return t.jsxs(yl,{children:[t.jsx(u,{display:"flex",className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Q,{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:s.blockletTitle||"",onChange:v=>{a({blockletTitle:""}),i({blockletTitle:v.target.value})},error:!!l.blockletTitle,helperText:l.blockletTitle||""}),t.jsx(Q,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:e===H.UNOWNED_DID&&t.jsx(Oe,{position:"end",children:t.jsx(Kt,{blocklet:r,store:b,componentDid:x,onChangeStore:T,disabled:!s.blockletTitle||o||n,loading:n,onClick:$})})},error:!!l.projectId,helperText:l.projectId||"",value:e===H.UNOWNED_DID?"":`did:abt:${e}`,sx:{mt:3}}),t.jsx(Q,{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:s.blockletDescription||"",onChange:v=>{a({blockletDescription:""}),i({blockletDescription:v.target.value})},error:!!l.blockletDescription,helperText:l.blockletDescription||"",sx:{mt:3}}),t.jsx(Q,{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:s.blockletHomepage||"",onChange:v=>{v.target.value&&!/^(http|https):\/\//.test(v.target.value)?a({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletHomepage:""}),i({blockletHomepage:v.target.value})},error:!!l.blockletHomepage,helperText:l.blockletHomepage||"",sx:{mt:3}}),t.jsx(Q,{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:s.blockletCommunity||"",onChange:v=>{v.target.value&&!/^(http|https):\/\//.test(v.target.value)?a({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletCommunity:""}),i({blockletCommunity:v.target.value})},error:!!l.blockletCommunity,helperText:l.blockletCommunity||"",sx:{mt:3}}),t.jsx(Q,{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:s.blockletSupport||"",onChange:v=>{v.target.value&&!/^(http|https):\/\//.test(v.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(v.target.value)?a({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):a({blockletSupport:""}),i({blockletSupport:v.target.value})},error:!!l.blockletSupport,helperText:l.blockletSupport||"",sx:{mt:3}}),t.jsx(Q,{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:s.blockletRepository||"",onChange:v=>{v.target.value&&!/^(git|https|svn)/.test(v.target.value)?a({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletRepository:""}),i({blockletRepository:v.target.value})},error:!!l.blockletRepository,helperText:l.blockletRepository||"",sx:{mt:3}})]})}),t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(u,{sx:{flex:1},children:[t.jsxs(u,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.type"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),t.jsx(u,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:t.jsx(Fo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:h||C,onClick:()=>{var v;P()&&((v=D.current)==null||v.open())}})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{sx:{border:"none"},variant:"outlined",size:"small",children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(jo,{onDragEnd:o?void 0:M,children:t.jsx(ko,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(v,E)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:E.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:E.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:v.innerRef,...v.droppableProps,children:[m.map((q,V)=>t.jsx(yo,{draggableId:q,index:V,isDragDisabled:o,children:(G,te)=>t.jsxs(u,{ref:G.innerRef,...G.draggableProps,className:"screenshot",sx:{transform:te.isDragging?"scale(1.05)":"none",boxShadow:te.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx("img",{alt:"screenshot",src:q}),!o&&t.jsx(ne,{...G.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(yt,{})}),!o&&t.jsx(ne,{className:"action",onClick:()=>{i(J=>{const Z=[...J.blockletScreenshots];return Z.splice(V,1),{...J,blockletScreenshots:Z}})},children:t.jsx(vo,{})})]})},q)),v.placeholder,m.length<5&&t.jsx(u,{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 q;P()&&((q=j.current)==null||q.open())},children:"+"})]})})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.videoType"),":"," "]}),t.jsxs(u,{component:"span",sx:{color:"#007ec6"},children:[t.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",t.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(jo,{onDragEnd:o?void 0:F,children:t.jsx(ko,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(v,E)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:E.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:E.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:v.innerRef,...v.droppableProps,children:[s.blockletVideos.map((q,V)=>t.jsx(yo,{draggableId:q,index:V,isDragDisabled:o,children:(G,te)=>t.jsxs(u,{ref:G.innerRef,...G.draggableProps,className:"screenshot",sx:{transform:te.isDragging?"scale(1.05)":"none",boxShadow:te.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx(ut,{url:q,style:{pointerEvents:te.isDragging?"none":"auto"}}),!o&&t.jsx(ne,{...G.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(yt,{})}),!o&&t.jsx(ne,{className:"action",onClick:()=>{i(J=>{const Z=[...J.blockletVideos];return Z.splice(V,1),{...J,blockletVideos:Z}})},children:t.jsx(vo,{})})]})},q)),v.placeholder,s.blockletVideos.length<3&&t.jsx(u,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{P()&&I(!0)},children:"+"})]})})})]})]})}),t.jsxs(S.Suspense,{fallback:t.jsx(Be,{}),children:[t.jsx(zo,{ref:D,popup:!0,onUploadFinish:v=>{var E;i({blockletLogo:v.data.filename}),g(""),(E=D.current)==null||E.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:B,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","application/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"),L&&t.jsx(qn,{onClose:()=>I(!1),params:s,setParams:i}),t.jsx(zo,{ref:j,popup:!0,onUploadFinish:v=>{var E;i(q=>{var G;const V=q.blockletScreenshots||[];return V.push((G=v.data)==null?void 0:G.filename),{...q,blockletScreenshots:V}}),(E=j.current)==null||E.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:R,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-m.length}},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,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}$n.propTypes={projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired,blocklet:d.object.isRequired,setLoading:d.func.isRequired,initUrl:d.object.isRequired,componentDid:d.isRequired,initLogoUrl:d.string.isRequired,setInitLogoUrl:d.func.isRequired};const yl=ie.div`
|
|
132
|
+
`;var Zt={},ar=fe;Object.defineProperty(Zt,"__esModule",{value:!0});var yt=Zt.default=void 0,dr=ar(me()),ur=t;yt=Zt.default=(0,dr.default)((0,ur.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 So="lastWantToConnectStoreId";function pr(e){var a,c;const[o,n]=S.useState(null),{session:r}=ct(),s=S.useCallback(f=>{n(f),localStorage.setItem(So,f==null?void 0:f.id)},[n]),i=S.useMemo(()=>{var x,p,y,w;const f=localStorage.getItem(So),h=f?(((x=e==null?void 0:e.settings)==null?void 0:x.storeList)||[]).find(D=>D.id===f):null;if(h)return h;let g=(((p=e==null?void 0:e.settings)==null?void 0:p.storeList)||[]).find(D=>{var j;return!(D.id!==H.BLOCKLET_STORE.id||D.scope&&D.scope!=="studio"&&D.scope!==((j=r==null?void 0:r.user)==null?void 0:j.did))});return g||(g=(w=(y=e==null?void 0:e.settings)==null?void 0:y.storeList)==null?void 0:w[0]),g},[(a=e==null?void 0:e.settings)==null?void 0:a.storeList,(c=r==null?void 0:r.user)==null?void 0:c.did]);return[o||i||{},s]}const xt={};async function hn(e,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:s=""}){xt[s]&&clearTimeout(xt[s]),await new Promise(a=>setTimeout(a,r));const i=Date.now(),l=async(a,c)=>{try{const f=await e();a(f)}catch(f){Date.now()-i>n?c(f):s?xt[s]=setTimeout(()=>l(a,c),o):setTimeout(()=>l(a,c),o)}};return new Promise(l)}function fr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function hr(e,{did:o,projectId:n,messageId:r}){return hn(async()=>{var i;const s=await e.getProject({input:{did:o,projectId:n,messageId:r}});if(!((i=s==null?void 0:s.project)!=null&&i.blockletDid))throw new Error("Connected store not found");return s.project.blockletDid},{timerKey:"connect-studio"})}function mr(e,{did:o,projectId:n,storeId:r}){return hn(async()=>{var l,a;const s=await e.getProject({input:{did:o,projectId:n,messageId:""}});if(!((a=(l=s==null?void 0:s.project)==null?void 0:l.connectedStores)!=null&&a.length))throw new Error("Connected store not found");if(!s.project.connectedStores.find(c=>c.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}const mn=({fromBlocklet:e,nodeInfo:o,blocklet:n,userDid:r})=>{var l,a;const s=e?(l=n==null?void 0:n.meta)==null?void 0:l.did:o==null?void 0:o.did;let i=e?((a=n==null?void 0:n.settings)==null?void 0:a.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(i)||(i=[]),i=i.filter(c=>c.protected||!c.scope||c.scope==="studio"||c.scope===r),{teamDid:s,storeList:i}};function Kt({blocklet:e,store:o={},onChangeStore:n,onClick:r,disabled:s,loading:i,componentDid:l}){var m,P,M;const{t:a}=Y(),{session:c}=ct(),{api:f,info:h,inService:g}=he(),x=De(),[p,y]=S.useState(!1),w=S.useRef(null),[D,j]=S.useState(!1),[b,T]=S.useState(null),L=F=>{n(F),y(!1)},I=()=>{y(!p)},k=F=>{w.current&&w.current.contains(F.target)||y(!1)},_=()=>{j(!0)},$=()=>{j(!1)},B=async()=>{var F;if(b)try{await f.deleteBlockletStore({input:{teamDid:e.meta.did,url:b.url,projectId:"",scope:b.scope||"studio"}}),await((F=x==null?void 0:x.actions)==null?void 0:F.refreshBlocklet())}catch(v){W.error(`Remove Blocklet Store Error: ${Ie(v)}`)}finally{T(null)}},{storeList:R}=mn({fromBlocklet:g,blocklet:e,nodeInfo:h,componentDid:l,userDid:(m=c==null?void 0:c.user)==null?void 0:m.did}),C=(P=e==null?void 0:e.meta)==null?void 0:P.did;return t.jsxs(t.Fragment,{children:[t.jsxs(kt,{disabled:s,ref:w,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[t.jsxs(K,{onClick:r,children:[i&&t.jsx(et,{size:14,sx:{mr:.5}}),`${a("common.connect")} ${o.name||""}`]}),t.jsx(K,{size:"small","aria-controls":p?"split-button-menu":void 0,"aria-expanded":p?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:I,children:t.jsx($s,{})})]}),t.jsx(Go,{sx:{zIndex:10},open:p,anchorEl:w.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:F})=>t.jsx(Xo,{...F,style:{transformOrigin:"center top"},children:t.jsx(Pt,{children:t.jsx(Jo,{onClickAway:k,children:t.jsxs(Qo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[R==null?void 0:R.map(v=>{var E;return t.jsxs(de,{selected:v.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>L(v),children:[t.jsxs(u,{children:[t.jsx(ue,{sx:{fontSize:"16px"},maxLength:24,children:v.name}),t.jsx(ue,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:v.url})]}),Is({store:v,userDid:(E=c==null?void 0:c.user)==null?void 0:E.did})&&t.jsx(ne,{sx:{ml:1},onClick:q=>{q.preventDefault(),q.stopPropagation(),T(v)},children:t.jsx(se,{icon:"ic:outline-delete"})})]},v.url)}),t.jsx(Qn,{}),t.jsxs(de,{onClick:_,children:[t.jsx(Nt,{font:!0}),t.jsx(A,{variant:"inherit",children:a("store.blockletRegistry.addRegistry")})]})]})})})})}),D&&t.jsx(ln,{hiddenChildren:!0,open:!0,onClose:$,teamDid:C,storeList:R,scope:"studio",onAdd:(M=x==null?void 0:x.actions)==null?void 0:M.refreshBlocklet}),b&&t.jsx(Et,{displayError:!0,title:`${a("common.delete")} ${b.name}`,description:a("blocklet.publish.deleteStoreTip",{name:b.name}),confirm:a("common.confirm"),onConfirm:B,onCancel:()=>T(null)})]})}Kt.propTypes={store:d.object,blocklet:d.object,onChangeStore:d.func.isRequired,onClick:d.func.isRequired,loading:d.bool.isRequired,disabled:d.bool.isRequired,componentDid:d.string.isRequired,projectType:d.string.isRequired,getData:d.func.isRequired};Kt.defaultProps={store:null,blocklet:null};var pe=S;const Ne=/^[a-z0-9]+(-[a-z0-9]+)*$/,at=(e,o,n,r="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const a=s.pop(),c=s.pop(),f={provider:s.length>0?s[0]:r,prefix:c,name:a};return o&&!Ze(f)?null:f}const i=s[0],l=i.split("-");if(l.length>1){const a={provider:r,prefix:l.shift(),name:l.join("-")};return o&&!Ze(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:i};return o&&!Ze(a,n)?null:a}return null},Ze=(e,o)=>e?!!((e.provider===""||e.provider.match(Ne))&&(o&&e.prefix===""||e.prefix.match(Ne))&&e.name.match(Ne)):!1,bn=Object.freeze({left:0,top:0,width:16,height:16}),st=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),eo=Object.freeze({...bn,...st}),vt=Object.freeze({...eo,body:"",hidden:!1});function br(e,o){const n={};!e.hFlip!=!o.hFlip&&(n.hFlip=!0),!e.vFlip!=!o.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(o.rotate||0))%4;return r&&(n.rotate=r),n}function Co(e,o){const n=br(e,o);for(const r in vt)r in st?r in e&&!(r in n)&&(n[r]=st[r]):r in o?n[r]=o[r]:r in e&&(n[r]=e[r]);return n}function xr(e,o){const n=e.icons,r=e.aliases||Object.create(null),s=Object.create(null);function i(l){if(n[l])return s[l]=[];if(!(l in s)){s[l]=null;const a=r[l]&&r[l].parent,c=a&&i(a);c&&(s[l]=[a].concat(c))}return s[l]}return Object.keys(n).concat(Object.keys(r)).forEach(i),s}function gr(e,o,n){const r=e.icons,s=e.aliases||Object.create(null);let i={};function l(a){i=Co(r[a]||s[a],i)}return l(o),n.forEach(l),Co(e,i)}function xn(e,o){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(s=>{o(s,null),n.push(s)});const r=xr(e);for(const s in r){const i=r[s];i&&(o(s,gr(e,s,i)),n.push(s))}return n}const jr={provider:"",aliases:{},not_found:{},...bn};function gt(e,o){for(const n in o)if(n in e&&typeof e[n]!=typeof o[n])return!1;return!0}function gn(e){if(typeof e!="object"||e===null)return null;const o=e;if(typeof o.prefix!="string"||!e.icons||typeof e.icons!="object"||!gt(e,jr))return null;const n=o.icons;for(const s in n){const i=n[s];if(!s.match(Ne)||typeof i.body!="string"||!gt(i,vt))return null}const r=o.aliases||Object.create(null);for(const s in r){const i=r[s],l=i.parent;if(!s.match(Ne)||typeof l!="string"||!n[l]&&!r[l]||!gt(i,vt))return null}return o}const Io=Object.create(null);function kr(e,o){return{provider:e,prefix:o,icons:Object.create(null),missing:new Set}}function ve(e,o){const n=Io[e]||(Io[e]=Object.create(null));return n[o]||(n[o]=kr(e,o))}function to(e,o){return gn(o)?xn(o,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function yr(e,o,n){try{if(typeof n.body=="string")return e.icons[o]={...n},!0}catch{}return!1}let Ae=!1;function jn(e){return typeof e=="boolean"&&(Ae=e),Ae}function vr(e){const o=typeof e=="string"?at(e,!0,Ae):e;if(o){const n=ve(o.provider,o.prefix),r=o.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function wr(e,o){const n=at(e,!0,Ae);if(!n)return!1;const r=ve(n.provider,n.prefix);return yr(r,n.name,o)}function Rr(e,o){if(typeof e!="object")return!1;if(typeof o!="string"&&(o=e.provider||""),Ae&&!o&&!e.prefix){let s=!1;return gn(e)&&(e.prefix="",xn(e,(i,l)=>{l&&wr(i,l)&&(s=!0)})),s}const n=e.prefix;if(!Ze({provider:o,prefix:n,name:"a"}))return!1;const r=ve(o,n);return!!to(r,e)}const kn=Object.freeze({width:null,height:null}),yn=Object.freeze({...kn,...st}),Sr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Cr=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Do(e,o,n){if(o===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*o*n)/n;if(typeof e!="string")return e;const r=e.split(Sr);if(r===null||!r.length)return e;const s=[];let i=r.shift(),l=Cr.test(i);for(;;){if(l){const a=parseFloat(i);isNaN(a)?s.push(i):s.push(Math.ceil(a*o*n)/n)}else s.push(i);if(i=r.shift(),i===void 0)return s.join("");l=!l}}const Ir=e=>e==="unset"||e==="undefined"||e==="none";function Dr(e,o){const n={...eo,...e},r={...yn,...o},s={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,r].forEach(y=>{const w=[],D=y.hFlip,j=y.vFlip;let b=y.rotate;D?j?b+=2:(w.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),w.push("scale(-1 1)"),s.top=s.left=0):j&&(w.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),w.push("scale(1 -1)"),s.top=s.left=0);let T;switch(b<0&&(b-=Math.floor(b/4)*4),b=b%4,b){case 1:T=s.height/2+s.top,w.unshift("rotate(90 "+T.toString()+" "+T.toString()+")");break;case 2:w.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:T=s.width/2+s.left,w.unshift("rotate(-90 "+T.toString()+" "+T.toString()+")");break}b%2===1&&(s.left!==s.top&&(T=s.left,s.left=s.top,s.top=T),s.width!==s.height&&(T=s.width,s.width=s.height,s.height=T)),w.length&&(i='<g transform="'+w.join(" ")+'">'+i+"</g>")});const l=r.width,a=r.height,c=s.width,f=s.height;let h,g;l===null?(g=a===null?"1em":a==="auto"?f:a,h=Do(g,c/f)):(h=l==="auto"?c:l,g=a===null?Do(h,f/c):a==="auto"?f:a);const x={},p=(y,w)=>{Ir(w)||(x[y]=w.toString())};return p("width",h),p("height",g),x.viewBox=s.left.toString()+" "+s.top.toString()+" "+c.toString()+" "+f.toString(),{attributes:x,body:i}}const Tr=/\sid="(\S+)"/g,Pr="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let _r=0;function Lr(e,o=Pr){const n=[];let r;for(;r=Tr.exec(e);)n.push(r[1]);if(!n.length)return e;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(i=>{const l=typeof o=="function"?o(i):o+(_r++).toString(),a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+l+s+"$3")}),e=e.replace(new RegExp(s,"g"),""),e}const wt=Object.create(null);function qr(e,o){wt[e]=o}function Rt(e){return wt[e]||wt[""]}function oo(e){let o;if(typeof e.resources=="string")o=[e.resources];else if(o=e.resources,!(o instanceof Array)||!o.length)return null;return{resources:o,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const no=Object.create(null),$e=["https://api.simplesvg.com","https://api.unisvg.com"],Ke=[];for(;$e.length>0;)$e.length===1||Math.random()>.5?Ke.push($e.shift()):Ke.push($e.pop());no[""]=oo({resources:["https://api.iconify.design"].concat(Ke)});function $r(e,o){const n=oo(o);return n===null?!1:(no[e]=n,!0)}function so(e){return no[e]}const Nr=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let To=Nr();function Er(e,o){const n=so(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let s=0;n.resources.forEach(l=>{s=Math.max(s,l.length)});const i=o+".json?icons=";r=n.maxURL-s-n.path.length-i.length}return r}function Ar(e){return e===404}const zr=(e,o,n)=>{const r=[],s=Er(e,o),i="icons";let l={type:i,provider:e,prefix:o,icons:[]},a=0;return n.forEach((c,f)=>{a+=c.length+1,a>=s&&f>0&&(r.push(l),l={type:i,provider:e,prefix:o,icons:[]},a=c.length),l.icons.push(c)}),r.push(l),r};function Mr(e){if(typeof e=="string"){const o=so(e);if(o)return o.path}return"/"}const Or=(e,o,n)=>{if(!To){n("abort",424);return}let r=Mr(o.provider);switch(o.type){case"icons":{const i=o.prefix,a=o.icons.join(","),c=new URLSearchParams({icons:a});r+=i+".json?"+c.toString();break}case"custom":{const i=o.uri;r+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n("abort",400);return}let s=503;To(e+r).then(i=>{const l=i.status;if(l!==200){setTimeout(()=>{n(Ar(l)?"abort":"next",l)});return}return s=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?n("abort",i):n("next",s)});return}setTimeout(()=>{n("success",i)})}).catch(()=>{n("next",s)})},Br={prepare:zr,send:Or};function Wr(e){const o={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((s,i)=>s.provider!==i.provider?s.provider.localeCompare(i.provider):s.prefix!==i.prefix?s.prefix.localeCompare(i.prefix):s.name.localeCompare(i.name));let r={provider:"",prefix:"",name:""};return e.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const i=s.provider,l=s.prefix,a=s.name,c=n[i]||(n[i]=Object.create(null)),f=c[l]||(c[l]=ve(i,l));let h;a in f.icons?h=o.loaded:l===""||f.missing.has(a)?h=o.missing:h=o.pending;const g={provider:i,prefix:l,name:a};h.push(g)}),o}function vn(e,o){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(s=>s.id!==o))})}function Vr(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const o=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!o.length)return;let n=!1;const r=e.provider,s=e.prefix;o.forEach(i=>{const l=i.icons,a=l.pending.length;l.pending=l.pending.filter(c=>{if(c.prefix!==s)return!0;const f=c.name;if(e.icons[f])l.loaded.push({provider:r,prefix:s,name:f});else if(e.missing.has(f))l.missing.push({provider:r,prefix:s,name:f});else return n=!0,!0;return!1}),l.pending.length!==a&&(n||vn([e],i.id),i.callback(l.loaded.slice(0),l.missing.slice(0),l.pending.slice(0),i.abort))})}))}let Fr=0;function Ur(e,o,n){const r=Fr++,s=vn.bind(null,n,r);if(!o.pending.length)return s;const i={id:r,icons:o,callback:e,abort:s};return n.forEach(l=>{(l.loaderCallbacks||(l.loaderCallbacks=[])).push(i)}),s}function Hr(e,o=!0,n=!1){const r=[];return e.forEach(s=>{const i=typeof s=="string"?at(s,o,n):s;i&&r.push(i)}),r}var Gr={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Xr(e,o,n,r){const s=e.resources.length,i=e.random?Math.floor(Math.random()*s):e.index;let l;if(e.random){let k=e.resources.slice(0);for(l=[];k.length>1;){const _=Math.floor(Math.random()*k.length);l.push(k[_]),k=k.slice(0,_).concat(k.slice(_+1))}l=l.concat(k)}else l=e.resources.slice(i).concat(e.resources.slice(0,i));const a=Date.now();let c="pending",f=0,h,g=null,x=[],p=[];typeof r=="function"&&p.push(r);function y(){g&&(clearTimeout(g),g=null)}function w(){c==="pending"&&(c="aborted"),y(),x.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),x=[]}function D(k,_){_&&(p=[]),typeof k=="function"&&p.push(k)}function j(){return{startTime:a,payload:o,status:c,queriesSent:f,queriesPending:x.length,subscribe:D,abort:w}}function b(){c="failed",p.forEach(k=>{k(void 0,h)})}function T(){x.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),x=[]}function L(k,_,$){const B=_!=="success";switch(x=x.filter(R=>R!==k),c){case"pending":break;case"failed":if(B||!e.dataAfterTimeout)return;break;default:return}if(_==="abort"){h=$,b();return}if(B){h=$,x.length||(l.length?I():b());return}if(y(),T(),!e.random){const R=e.resources.indexOf(k.resource);R!==-1&&R!==e.index&&(e.index=R)}c="completed",p.forEach(R=>{R($)})}function I(){if(c!=="pending")return;y();const k=l.shift();if(k===void 0){if(x.length){g=setTimeout(()=>{y(),c==="pending"&&(T(),b())},e.timeout);return}b();return}const _={status:"pending",resource:k,callback:($,B)=>{L(_,$,B)}};x.push(_),f++,g=setTimeout(I,e.rotate),n(k,o,_.callback)}return setTimeout(I),j}function wn(e){const o={...Gr,...e};let n=[];function r(){n=n.filter(a=>a().status==="pending")}function s(a,c,f){const h=Xr(o,a,c,(g,x)=>{r(),f&&f(g,x)});return n.push(h),h}function i(a){return n.find(c=>a(c))||null}return{query:s,find:i,setIndex:a=>{o.index=a},getIndex:()=>o.index,cleanup:r}}function Po(){}const jt=Object.create(null);function Jr(e){if(!jt[e]){const o=so(e);if(!o)return;const n=wn(o),r={config:o,redundancy:n};jt[e]=r}return jt[e]}function Qr(e,o,n){let r,s;if(typeof e=="string"){const i=Rt(e);if(!i)return n(void 0,424),Po;s=i.send;const l=Jr(e);l&&(r=l.redundancy)}else{const i=oo(e);if(i){r=wn(i);const l=e.resources?e.resources[0]:"",a=Rt(l);a&&(s=a.send)}}return!r||!s?(n(void 0,424),Po):r.query(o,s,n)().abort}const _o="iconify2",ze="iconify",Rn=ze+"-count",Lo=ze+"-version",Sn=36e5,Yr=168;function St(e,o){try{return e.getItem(o)}catch{}}function ro(e,o,n){try{return e.setItem(o,n),!0}catch{}}function qo(e,o){try{e.removeItem(o)}catch{}}function Ct(e,o){return ro(e,Rn,o.toString())}function It(e){return parseInt(St(e,Rn))||0}const dt={local:!0,session:!0},Cn={local:new Set,session:new Set};let lo=!1;function Zr(e){lo=e}let He=typeof window>"u"?{}:window;function In(e){const o=e+"Storage";try{if(He&&He[o]&&typeof He[o].length=="number")return He[o]}catch{}dt[e]=!1}function Dn(e,o){const n=In(e);if(!n)return;const r=St(n,Lo);if(r!==_o){if(r){const a=It(n);for(let c=0;c<a;c++)qo(n,ze+c.toString())}ro(n,Lo,_o),Ct(n,0);return}const s=Math.floor(Date.now()/Sn)-Yr,i=a=>{const c=ze+a.toString(),f=St(n,c);if(typeof f=="string"){try{const h=JSON.parse(f);if(typeof h=="object"&&typeof h.cached=="number"&&h.cached>s&&typeof h.provider=="string"&&typeof h.data=="object"&&typeof h.data.prefix=="string"&&o(h,a))return!0}catch{}qo(n,c)}};let l=It(n);for(let a=l-1;a>=0;a--)i(a)||(a===l-1?(l--,Ct(n,l)):Cn[e].add(a))}function Tn(){if(!lo){Zr(!0);for(const e in dt)Dn(e,o=>{const n=o.data,r=o.provider,s=n.prefix,i=ve(r,s);if(!to(i,n).length)return!1;const l=n.lastModified||-1;return i.lastModifiedCached=i.lastModifiedCached?Math.min(i.lastModifiedCached,l):l,!0})}}function Kr(e,o){const n=e.lastModifiedCached;if(n&&n>=o)return n===o;if(e.lastModifiedCached=o,n)for(const r in dt)Dn(r,s=>{const i=s.data;return s.provider!==e.provider||i.prefix!==e.prefix||i.lastModified===o});return!0}function el(e,o){lo||Tn();function n(r){let s;if(!dt[r]||!(s=In(r)))return;const i=Cn[r];let l;if(i.size)i.delete(l=Array.from(i).shift());else if(l=It(s),!Ct(s,l+1))return;const a={cached:Math.floor(Date.now()/Sn),provider:e.provider,data:o};return ro(s,ze+l.toString(),JSON.stringify(a))}o.lastModified&&!Kr(e,o.lastModified)||Object.keys(o.icons).length&&(o.not_found&&(o=Object.assign({},o),delete o.not_found),n("local")||n("session"))}function $o(){}function tl(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Vr(e)}))}function ol(e,o){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(o).sort():e.iconsToLoad=o,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:r}=e,s=e.iconsToLoad;delete e.iconsToLoad;let i;if(!s||!(i=Rt(n)))return;i.prepare(n,r,s).forEach(a=>{Qr(n,a,c=>{if(typeof c!="object")a.icons.forEach(f=>{e.missing.add(f)});else try{const f=to(e,c);if(!f.length)return;const h=e.pendingIcons;h&&f.forEach(g=>{h.delete(g)}),el(e,c)}catch(f){console.error(f)}tl(e)})})}))}const nl=(e,o)=>{const n=Hr(e,!0,jn()),r=Wr(n);if(!r.pending.length){let c=!0;return o&&setTimeout(()=>{c&&o(r.loaded,r.missing,r.pending,$o)}),()=>{c=!1}}const s=Object.create(null),i=[];let l,a;return r.pending.forEach(c=>{const{provider:f,prefix:h}=c;if(h===a&&f===l)return;l=f,a=h,i.push(ve(f,h));const g=s[f]||(s[f]=Object.create(null));g[h]||(g[h]=[])}),r.pending.forEach(c=>{const{provider:f,prefix:h,name:g}=c,x=ve(f,h),p=x.pendingIcons||(x.pendingIcons=new Set);p.has(g)||(p.add(g),s[f][h].push(g))}),i.forEach(c=>{const{provider:f,prefix:h}=c;s[f][h].length&&ol(c,s[f][h])}),o?Ur(o,r,i):$o};function sl(e,o){const n={...e};for(const r in o){const s=o[r],i=typeof s;r in kn?(s===null||s&&(i==="string"||i==="number"))&&(n[r]=s):i===typeof n[r]&&(n[r]=r==="rotate"?s%4:s)}return n}const rl=/[\s,]+/;function ll(e,o){o.split(rl).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function il(e,o=0){const n=e.replace(/^-?[0-9.]*/,"");function r(s){for(;s<0;)s+=4;return s%4}if(n===""){const s=parseInt(e);return isNaN(s)?0:r(s)}else if(n!==e){let s=0;switch(n){case"%":s=25;break;case"deg":s=90}if(s){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i=i/s,i%1===0?r(i):0)}}return o}function cl(e,o){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in o)n+=" "+r+'="'+o[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function al(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function dl(e){return"data:image/svg+xml,"+al(e)}function ul(e){return'url("'+dl(e)+'")'}let Ee;function pl(){try{Ee=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Ee=null}}function fl(e){return Ee===void 0&&pl(),Ee?Ee.createHTML(e):e}const Pn={...yn,inline:!1},hl={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},ml={display:"inline-block"},Dt={backgroundColor:"currentColor"},_n={backgroundColor:"transparent"},No={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Eo={WebkitMask:Dt,mask:Dt,background:_n};for(const e in Eo){const o=Eo[e];for(const n in No)o[e+n]=No[n]}const bl={...Pn,inline:!0};function Ao(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const xl=(e,o,n,r)=>{const s=n?bl:Pn,i=sl(s,o),l=o.mode||"svg",a={},c=o.style||{},f={...l==="svg"?hl:{},ref:r};for(let j in o){const b=o[j];if(b!==void 0)switch(j){case"icon":case"style":case"children":case"onLoad":case"mode":case"_ref":case"_inline":break;case"inline":case"hFlip":case"vFlip":i[j]=b===!0||b==="true"||b===1;break;case"flip":typeof b=="string"&&ll(i,b);break;case"color":a.color=b;break;case"rotate":typeof b=="string"?i[j]=il(b):typeof b=="number"&&(i[j]=b);break;case"ariaHidden":case"aria-hidden":b!==!0&&b!=="true"&&delete f["aria-hidden"];break;default:s[j]===void 0&&(f[j]=b)}}const h=Dr(e,i),g=h.attributes;if(i.inline&&(a.verticalAlign="-0.125em"),l==="svg"){f.style={...a,...c},Object.assign(f,g);let j=0,b=o.id;return typeof b=="string"&&(b=b.replace(/-/g,"_")),f.dangerouslySetInnerHTML={__html:fl(Lr(h.body,b?()=>b+"ID"+j++:"iconifyReact"))},pe.createElement("svg",f)}const{body:x,width:p,height:y}=e,w=l==="mask"||(l==="bg"?!1:x.indexOf("currentColor")!==-1),D=cl(x,{...g,width:p+"",height:y+""});return f.style={...a,"--svg":ul(D),width:Ao(g.width),height:Ao(g.height),...ml,...w?Dt:_n,...c},pe.createElement("span",f)};jn(!0);qr("",Br);if(typeof document<"u"&&typeof window<"u"){Tn();const e=window;if(e.IconifyPreload!==void 0){const o=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof o=="object"&&o!==null&&(o instanceof Array?o:[o]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!Rr(r))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const o=e.IconifyProviders;if(typeof o=="object"&&o!==null)for(let n in o){const r="IconifyProviders["+n+"] is invalid.";try{const s=o[n];if(typeof s!="object"||!s||s.resources===void 0)continue;$r(n,s)||console.error(r)}catch{console.error(r)}}}}class Ln extends pe.Component{constructor(o){super(o),this.state={icon:null}}_abortLoading(){this._loading&&(this._loading.abort(),this._loading=null)}_setData(o){this.state.icon!==o&&this.setState({icon:o})}_checkIcon(o){const n=this.state,r=this.props.icon;if(typeof r=="object"&&r!==null&&typeof r.body=="string"){this._icon="",this._abortLoading(),(o||n.icon===null)&&this._setData({data:r});return}let s;if(typeof r!="string"||(s=at(r,!1,!0))===null){this._abortLoading(),this._setData(null);return}const i=vr(s);if(!i){(!this._loading||this._loading.name!==r)&&(this._abortLoading(),this._icon="",this._setData(null),i!==null&&(this._loading={name:r,abort:nl([s],this._checkIcon.bind(this,!1))}));return}if(this._icon!==r||n.icon===null){this._abortLoading(),this._icon=r;const l=["iconify"];s.prefix!==""&&l.push("iconify--"+s.prefix),s.provider!==""&&l.push("iconify--"+s.provider),this._setData({data:i,classes:l}),this.props.onLoad&&this.props.onLoad(r)}}componentDidMount(){this._checkIcon(!1)}componentDidUpdate(o){o.icon!==this.props.icon&&this._checkIcon(!0)}componentWillUnmount(){this._abortLoading()}render(){const o=this.props,n=this.state.icon;if(n===null)return o.children?o.children:pe.createElement("span",{});let r=o;return n.classes&&(r={...o,className:(typeof o.className=="string"?o.className+" ":"")+n.classes.join(" ")}),xl({...eo,...n.data},r,o._inline,o._ref)}}const gl=pe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!1};return pe.createElement(Ln,r)});pe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!0};return pe.createElement(Ln,r)});var jl=gl;const kl=e=>{const o=e.includes("youtube.com")||e.includes("youtu.be"),n=e.includes("vimeo.com");return o||n};function ut({url:e,style:o,controls:n,modestbranding:r}){var a;const{t:s}=Y(),i=e.includes("youtube.com")||e.includes("youtu.be"),l=e.includes("vimeo.com");if(i){const c=((a=e.split("v=")[1])==null?void 0:a.split("&")[0])||e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:t.jsx("iframe",{src:`https://www.youtube.com/embed/${c}?modestbranding=${r}&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(l){const c=e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:t.jsx("iframe",{src:`https://player.vimeo.com/video/${c}`,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 t.jsx(u,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:t.jsxs(u,{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:[t.jsx(jl,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),t.jsx(A,{variant:"body1",sx:{opacity:.5},children:s("studio.videoDialogNoSrc")})]})})}ut.propTypes={url:d.string.isRequired,style:d.object,controls:d.number,modestbranding:d.number};ut.defaultProps={style:{},controls:1,modestbranding:1};function qn({setParams:e,onClose:o,params:n}){const{t:r}=Y(),[s,i]=S.useState(""),l=s&&n.blockletVideos.includes(s),a=kl(s),c=()=>{e(f=>{const h=[...f.blockletVideos];return h.push(s),{...f,blockletVideos:h}}),o()};return t.jsxs(_t,{open:!0,fullWidth:!0,maxWidth:"sm",children:[t.jsx(Yo,{children:r("studio.videoDialogTitle")}),t.jsxs(Zo,{children:[t.jsx(Yn,{fullWidth:!0,value:s,onChange:f=>i(f.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:s?t.jsx(Oe,{position:"end",children:t.jsx(ne,{onClick:()=>i(""),children:t.jsx(xs,{})})}):null,error:l}),l&&t.jsx(A,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),t.jsx(ut,{url:s,style:{marginTop:"20px",borderRadius:"4px"}})]}),t.jsxs(Ko,{children:[t.jsx(K,{onClick:()=>o(),children:r("studio.cancel")}),t.jsx(K,{disabled:!a||l,onClick:c,children:r("studio.confirm")})]})]})}qn.propTypes={onClose:d.func.isRequired,params:d.object.isRequired,setParams:d.func.isRequired};const zo=S.lazy(()=>on(()=>import("./index-D97FQw7_.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(e=>({default:e.Uploader})));function $n({projectId:e,readOnly:o,loading:n,blocklet:r,params:s,setParams:i,paramsErrTip:l,setParamsErrTip:a,setLoading:c,initUrl:f,initLogoUrl:h,setInitLogoUrl:g,componentDid:x}){const{t:p}=Y(),{api:y}=he(),w=Tt(),D=S.useRef(null),j=S.useRef(null),[b,T]=pr(r),[L,I]=S.useState(!1),k=Ds({messageType:"connect-store-message",onOpen:()=>c(!0),onClose:()=>c(!1)}),_=async v=>{const E=setTimeout(()=>{c(!1)},2e4),q=await hr(y,v);c(!1),clearTimeout(E),window.parent.postMessage({event:"studioDialog.connected",componentDid:x},"*"),w(window.location.pathname.replace(`${H.UNOWNED_DID}/create`,`${q}/create`),{replace:!0})},$=()=>{if(!s.blockletTitle){W.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(b!=null&&b.url)){W.error(p("blocklet.publish.noStoreSelected"));return}const v=fr();k(async(E,q)=>{var V,G,te;try{const J=await y.connectByStudio({input:{did:(V=r==null?void 0:r.meta)==null?void 0:V.did,blockletTitle:s==null?void 0:s.blockletTitle,storeUrl:b.url,storeId:b.id,storeName:b.name,type:((G=s==null?void 0:s.blockletComponents)==null?void 0:G.length)>0?"pack":"resource",componentDid:x,messageId:v,tenantScope:(f==null?void 0:f.searchParams.get("tenantScope"))||""}});if(!(J!=null&&J.url)){W.error("failed to connect to store");return}q(J.url),_({did:(te=r==null?void 0:r.meta)==null?void 0:te.did,projectId:"",messageId:v})}catch(J){const Z=Ie(J);W.error(Z),c(!1)}})},B=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/logo/upload`,R=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/screenshot/upload`,C=s!=null&&s.blockletLogo?`${B}/${s.blockletLogo}`:`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,m=((s==null?void 0:s.blockletScreenshots)||[]).filter(Boolean).map(v=>`${R}/${v}`),P=()=>o?!1:!e||e===H.UNOWNED_DID?(W.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,M=v=>{if(!v.destination)return;const E=Array.from(s.blockletScreenshots),[q]=E.splice(v.source.index,1);E.splice(v.destination.index,0,q),i(V=>({...V,blockletScreenshots:E}))},F=v=>{if(!v.destination)return;const E=Array.from(s.blockletVideos),[q]=E.splice(v.source.index,1);E.splice(v.destination.index,0,q),i(V=>({...V,blockletVideos:E}))};return t.jsxs(yl,{children:[t.jsx(u,{display:"flex",className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Q,{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:s.blockletTitle||"",onChange:v=>{a({blockletTitle:""}),i({blockletTitle:v.target.value})},error:!!l.blockletTitle,helperText:l.blockletTitle||""}),t.jsx(Q,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:e===H.UNOWNED_DID&&t.jsx(Oe,{position:"end",children:t.jsx(Kt,{blocklet:r,store:b,componentDid:x,onChangeStore:T,disabled:!s.blockletTitle||o||n,loading:n,onClick:$})})},error:!!l.projectId,helperText:l.projectId||"",value:e===H.UNOWNED_DID?"":`did:abt:${e}`,sx:{mt:3}}),t.jsx(Q,{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:s.blockletDescription||"",onChange:v=>{a({blockletDescription:""}),i({blockletDescription:v.target.value})},error:!!l.blockletDescription,helperText:l.blockletDescription||"",sx:{mt:3}}),t.jsx(Q,{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:s.blockletHomepage||"",onChange:v=>{v.target.value&&!/^(http|https):\/\//.test(v.target.value)?a({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletHomepage:""}),i({blockletHomepage:v.target.value})},error:!!l.blockletHomepage,helperText:l.blockletHomepage||"",sx:{mt:3}}),t.jsx(Q,{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:s.blockletCommunity||"",onChange:v=>{v.target.value&&!/^(http|https):\/\//.test(v.target.value)?a({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletCommunity:""}),i({blockletCommunity:v.target.value})},error:!!l.blockletCommunity,helperText:l.blockletCommunity||"",sx:{mt:3}}),t.jsx(Q,{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:s.blockletSupport||"",onChange:v=>{v.target.value&&!/^(http|https):\/\//.test(v.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(v.target.value)?a({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):a({blockletSupport:""}),i({blockletSupport:v.target.value})},error:!!l.blockletSupport,helperText:l.blockletSupport||"",sx:{mt:3}}),t.jsx(Q,{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:s.blockletRepository||"",onChange:v=>{v.target.value&&!/^(git|https|svn)/.test(v.target.value)?a({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletRepository:""}),i({blockletRepository:v.target.value})},error:!!l.blockletRepository,helperText:l.blockletRepository||"",sx:{mt:3}})]})}),t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(u,{sx:{flex:1},children:[t.jsxs(u,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.type"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),t.jsx(u,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:t.jsx(Fo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:h||C,onClick:()=>{var v;P()&&((v=D.current)==null||v.open())}})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{sx:{border:"none"},variant:"outlined",size:"small",children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(jo,{onDragEnd:o?void 0:M,children:t.jsx(ko,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(v,E)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:E.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:E.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:v.innerRef,...v.droppableProps,children:[m.map((q,V)=>t.jsx(yo,{draggableId:q,index:V,isDragDisabled:o,children:(G,te)=>t.jsxs(u,{ref:G.innerRef,...G.draggableProps,className:"screenshot",sx:{transform:te.isDragging?"scale(1.05)":"none",boxShadow:te.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx("img",{alt:"screenshot",src:q}),!o&&t.jsx(ne,{...G.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(yt,{})}),!o&&t.jsx(ne,{className:"action",onClick:()=>{i(J=>{const Z=[...J.blockletScreenshots];return Z.splice(V,1),{...J,blockletScreenshots:Z}})},children:t.jsx(vo,{})})]})},q)),v.placeholder,m.length<5&&t.jsx(u,{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 q;P()&&((q=j.current)==null||q.open())},children:"+"})]})})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.videoType"),":"," "]}),t.jsxs(u,{component:"span",sx:{color:"#007ec6"},children:[t.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",t.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(jo,{onDragEnd:o?void 0:F,children:t.jsx(ko,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(v,E)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:E.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:E.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:v.innerRef,...v.droppableProps,children:[s.blockletVideos.map((q,V)=>t.jsx(yo,{draggableId:q,index:V,isDragDisabled:o,children:(G,te)=>t.jsxs(u,{ref:G.innerRef,...G.draggableProps,className:"screenshot",sx:{transform:te.isDragging?"scale(1.05)":"none",boxShadow:te.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx(ut,{url:q,style:{pointerEvents:te.isDragging?"none":"auto"}}),!o&&t.jsx(ne,{...G.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(yt,{})}),!o&&t.jsx(ne,{className:"action",onClick:()=>{i(J=>{const Z=[...J.blockletVideos];return Z.splice(V,1),{...J,blockletVideos:Z}})},children:t.jsx(vo,{})})]})},q)),v.placeholder,s.blockletVideos.length<3&&t.jsx(u,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{P()&&I(!0)},children:"+"})]})})})]})]})}),t.jsxs(S.Suspense,{fallback:t.jsx(Be,{}),children:[t.jsx(zo,{ref:D,popup:!0,onUploadFinish:v=>{var E;i({blockletLogo:v.data.filename}),g(""),(E=D.current)==null||E.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:B,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","application/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"),L&&t.jsx(qn,{onClose:()=>I(!1),params:s,setParams:i}),t.jsx(zo,{ref:j,popup:!0,onUploadFinish:v=>{var E;i(q=>{var G;const V=q.blockletScreenshots||[];return V.push((G=v.data)==null?void 0:G.filename),{...q,blockletScreenshots:V}}),(E=j.current)==null||E.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:R,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-m.length}},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,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}$n.propTypes={projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired,blocklet:d.object.isRequired,setLoading:d.func.isRequired,initUrl:d.object.isRequired,componentDid:d.isRequired,initLogoUrl:d.string.isRequired,setInitLogoUrl:d.func.isRequired};const yl=ie.div`
|
|
133
133
|
margin-top: 24px;
|
|
134
134
|
.screenshot {
|
|
135
135
|
margin-bottom: 16px;
|
|
@@ -177,14 +177,14 @@ import{r as S,k as Tt,l as it,L as re,f as Gn,h as Xn,i as ft}from"./vendor-reac
|
|
|
177
177
|
padding-bottom: 12px;
|
|
178
178
|
border-bottom: ${({theme:e})=>`1px solid ${e.palette.divider}`};
|
|
179
179
|
}
|
|
180
|
-
`;function On({text:e}){return e?t.jsx(As,{wrapperElement:{"data-color-mode":"light"},source:gs.sanitize(e),rehypePlugins:[[zs,{target:"_blank"}]]}):t.jsx(ye,{Icon:Mt})}On.propTypes={text:d.string.isRequired};function Bn({params:e,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:s,readOnly:i}){var h;const{t:l}=Y(),[a,c]=S.useState(i?"preview":"write"),f=(g,x)=>{c(x)};return t.jsxs(u,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[t.jsxs(u,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[t.jsx(A,{variant:"h6",fontWeight:"bold",sx:{},children:l("common.introduction")}),t.jsxs(en,{value:a,onChange:f,"aria-label":"wrapped label tabs example",children:[t.jsx(tt,{value:"write",label:"Write"}),t.jsx(tt,{value:"preview",label:"Preview"})]})]}),t.jsx(u,{display:a==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:t.jsx(Q,{disabled:r||i,sx:{border:"none"},placeholder:`Blocklet ${l("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:i,endAdornment:t.jsxs(Oe,{position:"end",children:[((h=e==null?void 0:e.blockletIntroduction)==null?void 0:h.length)||0," / ",ke.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:e.blockletIntroduction||"",onChange:g=>{s({blockletIntroduction:""}),o({blockletIntroduction:g.target.value.slice(0,ke.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),t.jsx(u,{display:a==="preview"?"block":"none",mt:3,children:t.jsx(On,{text:e.blockletIntroduction||""})})]})}Bn.propTypes={params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,readOnly:d.bool.isRequired,loading:d.bool.isRequired};var ao={},_l=fe;Object.defineProperty(ao,"__esModule",{value:!0});var Wn=ao.default=void 0,Ll=_l(me()),Oo=t;Wn=ao.default=(0,Ll.default)([(0,Oo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Oo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function uo({step:e,ok:o,active:n,error:r}){let s="grey.500",i=e+1;return o&&(i=t.jsx(Ms,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>e?(s="error.main",i=t.jsx(Wn,{sx:{fontSize:18,margin:0},color:"white"})):n>=e&&(s="primary.main"),t.jsx(u,{width:24,height:24,bgcolor:s,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:i})}uo.propTypes={step:d.number,ok:d.bool,active:d.number,error:d.string};uo.defaultProps={step:0,ok:!1,active:0,error:""};function Vn({steps:e,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:s,loading:i,paramsErrTip:l,viewMode:a,projectId:c}){const{t:f}=Y(),h=()=>{n(y=>y+1)},g=()=>{n(y=>y-1)},x=y=>y===0?(l==null?void 0:l.blockletTitle)||(l==null?void 0:l.projectId)||(l==null?void 0:l.blockletDescription)||(l==null?void 0:l.blockletHomepage)||(l==null?void 0:l.blockletSupport)||(l==null?void 0:l.blockletCommunity)||(l==null?void 0:l.blockletRepository):y===2?(l==null?void 0:l.blockletResource)||(l==null?void 0:l.blockletDocker)||(l==null?void 0:l.dockerImageName):y>=4?(l==null?void 0:l.blockletVersion)||(l==null?void 0:l.note):"",p=a||En({hasSelectedResources:r,params:s,projectId:c,t:f})===null;return t.jsxs(u,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[t.jsx(os,{activeStep:o,orientation:"vertical",children:e.map((y,w)=>{const D={},j=i||!Tl({hasSelectedResources:r,params:s,projectId:c,step:w,t:f}),b=i?"":x(w);return b&&(D.optional=t.jsx(A,{variant:"caption",color:"error",children:b}),D.error=!0),t.jsxs(ns,{children:[t.jsx(ss,{icon:t.jsx(uo,{error:b,active:p?99:o,step:w,ok:j}),sx:{cursor:"pointer",color:b?"error.main":"inherit"},disabled:!1,onClick:()=>n(w),...D,children:t.jsx(A,{fontSize:"14px",fontWeight:"500",color:b||!j&&o>w?"error.main":"inherit",children:y.label})}),t.jsxs(rs,{children:[t.jsx(A,{fontSize:12,children:y.description}),!p&&t.jsx(u,{sx:{mb:2},children:t.jsxs("div",{children:[w<e.length-1&&t.jsx(K,{variant:"contained",onClick:h,sx:{mt:1,mr:1},disabled:b||!j,children:f("common.continue")}),w>0&&t.jsx(K,{disabled:w===0,onClick:g,sx:{mt:1,mr:1},children:f("common.back")})]})})]})]},y.label)})}),o>=e.length-1&&t.jsx(Pt,{square:!0,elevation:0,sx:{p:3},children:t.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}Vn.propTypes={steps:d.array.isRequired,activeStep:d.number.isRequired,setActiveStep:d.func.isRequired,params:d.object.isRequired,viewMode:d.string.isRequired,loading:d.bool.isRequired,projectId:d.string.isRequired,hasSelectedResources:d.bool.isRequired,paramsErrTip:d.shape({projectId:d.string,blockletVersion:d.string,blockletTitle:d.string,blockletDescription:d.string,note:d.string,blockletResource:d.string,blockletHomepage:d.string,blockletSupport:d.string,blockletCommunity:d.string,blockletRepository:d.string,blockletDocker:d.object,dockerImageName:d.string}).isRequired};const ql=[".zip",".gz"],$l=1024*1024*100,Nl=S.lazy(()=>on(()=>import("./index-DMelUylN.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(e=>({default:e.Uploader})));function po({app:e,projectId:o,readOnly:n,params:r,setParams:s,setParamsErrTip:i,error:l}){const{t:a}=Y(),c=S.useRef(null),f=()=>n?!1:!o||o===H.UNOWNED_DID?(W.error(a("blocklet.publish.errorTip.noFirstDid")),!1):!0,h=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e.meta.did}/${o}/resource/upload`;return t.jsxs(u,{sx:{mt:3},children:[t.jsx(A,{gutterBottom:!0,children:a("blocklet.publish.resourceUpload")}),t.jsxs(je,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&t.jsx(A,{component:"a",href:`${h}/params.uploadedResource`,children:r.uploadedResource}),!n&&t.jsx(K,{variant:"outlined",size:"small",onClick:()=>{var g;f()&&((g=c.current)==null||g.open())},children:r.uploadedResource?a("common.change"):a("common.upload")})]}),t.jsx(S.Suspense,{fallback:t.jsx(Be,{}),children:t.jsx(Nl,{ref:c,popup:!0,onUploadFinish:g=>{var x;s({uploadedResource:g.data.filename}),i({blockletResource:""}),(x=c.current)==null||x.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:h,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:ql,maxFileSize:$l,maxNumberOfFiles:1}}},"uploader-resource")}),!!l&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:l})]})}po.propTypes={app:d.object.isRequired,projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,error:d.string.isRequired,setParamsErrTip:d.func.isRequired};po.defaultProps={};function rt({readOnly:e,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:s,loading:i}){var a;const{t:l}=Y();return t.jsx(u,{display:"flex",mt:3,className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Q,{required:!0,disabled:i||e,label:`Blocklet ${l("common.version")}`,placeholder:`Blocklet ${l("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:c=>{s({blockletVersion:""}),n({blockletVersion:c.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||""}),t.jsx(Q,{label:l("blocklet.publish.releaseNote"),autoComplete:"off",disabled:i||e,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:e,endAdornment:t.jsxs(Oe,{position:"end",children:[((a=o==null?void 0:o.note)==null?void 0:a.length)||0," / ",ke.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:c=>{s({note:""}),n({note:c.target.value.slice(0,ke.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}rt.propTypes={readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired};rt.defaultProps={};function Fn(e){for(const o in e)typeof e[o]=="string"?e[o]=e[o].replace(/\\\\/g,"\\"):typeof e[o]=="object"&&e[o]!==null&&Fn(e[o]);return e}function lt({index:e,item:o,dockerParams:n,setDockerParams:r,dataKey:s,t:i,readOnly:l}){const a=(o==null?void 0:o.value)||"",[c,f]=S.useState(!1),h=()=>{var C;(C=n[s])==null||C.splice(e,1),r({...n,[s]:[...n[s]]})},g=(C,m)=>{var P;(P=n[s])!=null&&P[e]&&(m?(n[s][e].custom=n[s][e].value,n[s][e].value=`$${mt(o.key)}`):(n[s][e].value=n[s][e].custom||"",n[s][e].custom="")),r({...n,[s]:[...n[s]]})},x=(C,m)=>{n[s][e]={...n[s][e],secure:m},r({...n,[s]:[...n[s]]})},p=(C,m)=>{n[s][e]={...n[s][e],shared:m},r({...n,[s]:[...n[s]]})},y=(C,m)=>{n[s][e]={...n[s][e],required:m},r({...n,[s]:[...n[s]]})},w=C=>{n[s][e]={...n[s][e],description:C.target.value},r({...n,[s]:[...n[s]]})},D=C=>{n[s][e]={...n[s][e],path:C.target.value},r({...n,[s]:[...n[s]]})},j=C=>{n[s][e]={...n[s][e],prefix:C.target.value},r({...n,[s]:[...n[s]]})},b=C=>{const m=C.target.value==="web"?"web":"docker";m==="web"&&n.dockerArgs.forEach(P=>{P.type="docker"}),n.dockerArgs[e]={...n.dockerArgs[e],type:m,path:"/",protocol:"http",prefix:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},T=C=>{var m;(m=n[s])!=null&&m[e]&&(n[s][e].name=C.target.value),r({...n,[s]:[...n[s]]})},L=C=>{var m;(m=n[s])!=null&&m[e]&&(n[s][e].value=C.target.value),r({...n,[s]:[...n[s]]})},I=a===`$${mt(o.key)}`||o.custom,k=s==="dockerArgs"&&!cn[o.key],_=_s[o.key],$=s==="dockerEnvs",B=o.key==="--publish";let R=o.key;return B&&o.type==="web"?R="--publish (Web)":$&&(R=`--env ${o.key}`),t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{width:250},children:t.jsx(A,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:R})}),t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[t.jsx(Q,{disabled:l||I||k,placeholder:"",value:I?`$${mt(o.key)}`:a,sx:{flex:1},InputProps:{endAdornment:t.jsxs(Oe,{position:"end",sx:{zoom:.9},children:[(!(_||k)||$||B)&&t.jsx(ne,{onClick:()=>f(!0),children:t.jsx(se,{icon:"icon-park-outline:setting-config"})}),!l&&t.jsx(ne,{onClick:h,color:k?"error":"default",children:t.jsx(se,{icon:"ic:round-delete"})})]})},error:k,onChange:L}),k&&t.jsx(A,{variant:"caption",color:"error",children:i("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&t.jsx(A,{variant:"caption",color:"text.secondary",children:i("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Ls[o.key](a)&&t.jsx(A,{variant:"caption",color:"error",children:i("blocklet.publish.docker.volumeTips")})]}),c&&t.jsx($t,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:i($?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[_||k||$?null:t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:i("blocklet.publish.docker.needCustomInput")}),t.jsx(Se,{disabled:l,checked:I,onChange:g,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:i("blocklet.publish.docker.secure")}),t.jsx(Se,{disabled:l,checked:o.secure,onChange:x,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:i("blocklet.publish.docker.shared")}),t.jsx(Se,{disabled:l,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:i("blocklet.publish.docker.required")}),t.jsx(Se,{disabled:l,checked:o.required,onChange:y,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:i("blocklet.publish.docker.description")}),t.jsx(Q,{disabled:l,value:o.description,onChange:w,sx:{flex:1},label:i("blocklet.publish.docker.description")})]}),B&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:i("blocklet.publish.docker.portType")}),t.jsxs(tn,{value:o.type||"docker",onChange:b,children:[t.jsx(de,{value:"docker",children:"Docker"}),t.jsx(de,{value:"web",children:"Web"})]})]}),B&&o.type==="web"&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:i("blocklet.publish.docker.path")}),t.jsx(Q,{disabled:l,value:o.path,onChange:D,sx:{flex:1},label:i("blocklet.publish.docker.path")})]}),B&&o.type==="web"&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:i("blocklet.publish.docker.name")}),t.jsx(Q,{disabled:l,value:o.name,onChange:T,sx:{flex:1},label:i("blocklet.publish.docker.name")})]}),B&&o.type==="web"&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:i("blocklet.publish.docker.prefix")}),t.jsx(Q,{disabled:l,value:o.prefix,onChange:j,sx:{flex:1},label:i("blocklet.publish.docker.prefix")})]})]})})]})}lt.propTypes={dockerParams:d.object.isRequired,setDockerParams:d.func.isRequired,dataKey:d.string.isRequired,item:d.object.isRequired,t:d.func.isRequired,readOnly:d.bool.isRequired,index:d.number.isRequired};lt.defaultProps={};const El=`
|
|
180
|
+
`;function On({text:e}){return e?t.jsx(As,{wrapperElement:{"data-color-mode":"light"},source:gs.sanitize(e),rehypePlugins:[[zs,{target:"_blank"}]]}):t.jsx(ye,{Icon:Mt})}On.propTypes={text:d.string.isRequired};function Bn({params:e,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:s,readOnly:i}){var h;const{t:l}=Y(),[a,c]=S.useState(i?"preview":"write"),f=(g,x)=>{c(x)};return t.jsxs(u,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[t.jsxs(u,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[t.jsx(A,{variant:"h6",fontWeight:"bold",sx:{},children:l("common.introduction")}),t.jsxs(en,{value:a,onChange:f,"aria-label":"wrapped label tabs example",children:[t.jsx(tt,{value:"write",label:"Write"}),t.jsx(tt,{value:"preview",label:"Preview"})]})]}),t.jsx(u,{display:a==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:t.jsx(Q,{disabled:r||i,sx:{border:"none"},placeholder:`Blocklet ${l("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:i,endAdornment:t.jsxs(Oe,{position:"end",children:[((h=e==null?void 0:e.blockletIntroduction)==null?void 0:h.length)||0," / ",ke.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:e.blockletIntroduction||"",onChange:g=>{s({blockletIntroduction:""}),o({blockletIntroduction:g.target.value.slice(0,ke.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),t.jsx(u,{display:a==="preview"?"block":"none",mt:3,children:t.jsx(On,{text:e.blockletIntroduction||""})})]})}Bn.propTypes={params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,readOnly:d.bool.isRequired,loading:d.bool.isRequired};var ao={},_l=fe;Object.defineProperty(ao,"__esModule",{value:!0});var Wn=ao.default=void 0,Ll=_l(me()),Oo=t;Wn=ao.default=(0,Ll.default)([(0,Oo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Oo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function uo({step:e,ok:o,active:n,error:r}){let s="grey.500",i=e+1;return o&&(i=t.jsx(Ms,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>e?(s="error.main",i=t.jsx(Wn,{sx:{fontSize:18,margin:0},color:"white"})):n>=e&&(s="primary.main"),t.jsx(u,{width:24,height:24,bgcolor:s,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:i})}uo.propTypes={step:d.number,ok:d.bool,active:d.number,error:d.string};uo.defaultProps={step:0,ok:!1,active:0,error:""};function Vn({steps:e,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:s,loading:i,paramsErrTip:l,viewMode:a,projectId:c}){const{t:f}=Y(),h=()=>{n(y=>y+1)},g=()=>{n(y=>y-1)},x=y=>y===0?(l==null?void 0:l.blockletTitle)||(l==null?void 0:l.projectId)||(l==null?void 0:l.blockletDescription)||(l==null?void 0:l.blockletHomepage)||(l==null?void 0:l.blockletSupport)||(l==null?void 0:l.blockletCommunity)||(l==null?void 0:l.blockletRepository):y===2?(l==null?void 0:l.blockletResource)||(l==null?void 0:l.blockletDocker)||(l==null?void 0:l.dockerImageName):y>=4?(l==null?void 0:l.blockletVersion)||(l==null?void 0:l.note):"",p=a||En({hasSelectedResources:r,params:s,projectId:c,t:f})===null;return t.jsxs(u,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[t.jsx(os,{activeStep:o,orientation:"vertical",children:e.map((y,w)=>{const D={},j=i||!Tl({hasSelectedResources:r,params:s,projectId:c,step:w,t:f}),b=i?"":x(w);return b&&(D.optional=t.jsx(A,{variant:"caption",color:"error",children:b}),D.error=!0),t.jsxs(ns,{children:[t.jsx(ss,{icon:t.jsx(uo,{error:b,active:p?99:o,step:w,ok:j}),sx:{cursor:"pointer",color:b?"error.main":"inherit"},disabled:!1,onClick:()=>n(w),...D,children:t.jsx(A,{fontSize:"14px",fontWeight:"500",color:b||!j&&o>w?"error.main":"inherit",children:y.label})}),t.jsxs(rs,{children:[t.jsx(A,{fontSize:12,children:y.description}),!p&&t.jsx(u,{sx:{mb:2},children:t.jsxs("div",{children:[w<e.length-1&&t.jsx(K,{variant:"contained",onClick:h,sx:{mt:1,mr:1},disabled:b||!j,children:f("common.continue")}),w>0&&t.jsx(K,{disabled:w===0,onClick:g,sx:{mt:1,mr:1},children:f("common.back")})]})})]})]},y.label)})}),o>=e.length-1&&t.jsx(Pt,{square:!0,elevation:0,sx:{p:3},children:t.jsx(A,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}Vn.propTypes={steps:d.array.isRequired,activeStep:d.number.isRequired,setActiveStep:d.func.isRequired,params:d.object.isRequired,viewMode:d.string.isRequired,loading:d.bool.isRequired,projectId:d.string.isRequired,hasSelectedResources:d.bool.isRequired,paramsErrTip:d.shape({projectId:d.string,blockletVersion:d.string,blockletTitle:d.string,blockletDescription:d.string,note:d.string,blockletResource:d.string,blockletHomepage:d.string,blockletSupport:d.string,blockletCommunity:d.string,blockletRepository:d.string,blockletDocker:d.object,dockerImageName:d.string}).isRequired};const ql=[".zip",".gz"],$l=1024*1024*100,Nl=S.lazy(()=>on(()=>import("./index-D97FQw7_.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(e=>({default:e.Uploader})));function po({app:e,projectId:o,readOnly:n,params:r,setParams:s,setParamsErrTip:i,error:l}){const{t:a}=Y(),c=S.useRef(null),f=()=>n?!1:!o||o===H.UNOWNED_DID?(W.error(a("blocklet.publish.errorTip.noFirstDid")),!1):!0,h=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e.meta.did}/${o}/resource/upload`;return t.jsxs(u,{sx:{mt:3},children:[t.jsx(A,{gutterBottom:!0,children:a("blocklet.publish.resourceUpload")}),t.jsxs(je,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&t.jsx(A,{component:"a",href:`${h}/params.uploadedResource`,children:r.uploadedResource}),!n&&t.jsx(K,{variant:"outlined",size:"small",onClick:()=>{var g;f()&&((g=c.current)==null||g.open())},children:r.uploadedResource?a("common.change"):a("common.upload")})]}),t.jsx(S.Suspense,{fallback:t.jsx(Be,{}),children:t.jsx(Nl,{ref:c,popup:!0,onUploadFinish:g=>{var x;s({uploadedResource:g.data.filename}),i({blockletResource:""}),(x=c.current)==null||x.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:h,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:ql,maxFileSize:$l,maxNumberOfFiles:1}}},"uploader-resource")}),!!l&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:l})]})}po.propTypes={app:d.object.isRequired,projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,error:d.string.isRequired,setParamsErrTip:d.func.isRequired};po.defaultProps={};function rt({readOnly:e,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:s,loading:i}){var a;const{t:l}=Y();return t.jsx(u,{display:"flex",mt:3,className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Q,{required:!0,disabled:i||e,label:`Blocklet ${l("common.version")}`,placeholder:`Blocklet ${l("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:c=>{s({blockletVersion:""}),n({blockletVersion:c.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||""}),t.jsx(Q,{label:l("blocklet.publish.releaseNote"),autoComplete:"off",disabled:i||e,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:e,endAdornment:t.jsxs(Oe,{position:"end",children:[((a=o==null?void 0:o.note)==null?void 0:a.length)||0," / ",ke.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:c=>{s({note:""}),n({note:c.target.value.slice(0,ke.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}rt.propTypes={readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired};rt.defaultProps={};function Fn(e){for(const o in e)typeof e[o]=="string"?e[o]=e[o].replace(/\\\\/g,"\\"):typeof e[o]=="object"&&e[o]!==null&&Fn(e[o]);return e}function lt({index:e,item:o,dockerParams:n,setDockerParams:r,dataKey:s,t:i,readOnly:l}){const a=(o==null?void 0:o.value)||"",[c,f]=S.useState(!1),h=()=>{var C;(C=n[s])==null||C.splice(e,1),r({...n,[s]:[...n[s]]})},g=(C,m)=>{var P;(P=n[s])!=null&&P[e]&&(m?(n[s][e].custom=n[s][e].value,n[s][e].value=`$${mt(o.key)}`):(n[s][e].value=n[s][e].custom||"",n[s][e].custom="")),r({...n,[s]:[...n[s]]})},x=(C,m)=>{n[s][e]={...n[s][e],secure:m},r({...n,[s]:[...n[s]]})},p=(C,m)=>{n[s][e]={...n[s][e],shared:m},r({...n,[s]:[...n[s]]})},y=(C,m)=>{n[s][e]={...n[s][e],required:m},r({...n,[s]:[...n[s]]})},w=C=>{n[s][e]={...n[s][e],description:C.target.value},r({...n,[s]:[...n[s]]})},D=C=>{n[s][e]={...n[s][e],path:C.target.value},r({...n,[s]:[...n[s]]})},j=C=>{n[s][e]={...n[s][e],prefix:C.target.value},r({...n,[s]:[...n[s]]})},b=C=>{const m=C.target.value==="web"?"web":"docker";m==="web"&&n.dockerArgs.forEach(P=>{P.type="docker"}),n.dockerArgs[e]={...n.dockerArgs[e],type:m,path:"/",protocol:"http",prefix:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},T=C=>{var m;(m=n[s])!=null&&m[e]&&(n[s][e].name=C.target.value),r({...n,[s]:[...n[s]]})},L=C=>{var m;(m=n[s])!=null&&m[e]&&(n[s][e].value=C.target.value),r({...n,[s]:[...n[s]]})},I=a===`$${mt(o.key)}`||o.custom,k=s==="dockerArgs"&&!cn[o.key],_=_s[o.key],$=s==="dockerEnvs",B=o.key==="--publish";let R=o.key;return B&&o.type==="web"?R="--publish (Web)":$&&(R=`--env ${o.key}`),t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{width:250},children:t.jsx(A,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:R})}),t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[t.jsx(Q,{disabled:l||I||k,placeholder:"",value:I?`$${mt(o.key)}`:a,sx:{flex:1},InputProps:{endAdornment:t.jsxs(Oe,{position:"end",sx:{zoom:.9},children:[(!(_||k)||$||B)&&t.jsx(ne,{onClick:()=>f(!0),children:t.jsx(se,{icon:"icon-park-outline:setting-config"})}),!l&&t.jsx(ne,{onClick:h,color:k?"error":"default",children:t.jsx(se,{icon:"ic:round-delete"})})]})},error:k,onChange:L}),k&&t.jsx(A,{variant:"caption",color:"error",children:i("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&t.jsx(A,{variant:"caption",color:"text.secondary",children:i("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Ls[o.key](a)&&t.jsx(A,{variant:"caption",color:"error",children:i("blocklet.publish.docker.volumeTips")})]}),c&&t.jsx($t,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:i($?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[_||k||$?null:t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:i("blocklet.publish.docker.needCustomInput")}),t.jsx(Se,{disabled:l,checked:I,onChange:g,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:i("blocklet.publish.docker.secure")}),t.jsx(Se,{disabled:l,checked:o.secure,onChange:x,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:i("blocklet.publish.docker.shared")}),t.jsx(Se,{disabled:l,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{children:i("blocklet.publish.docker.required")}),t.jsx(Se,{disabled:l,checked:o.required,onChange:y,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:i("blocklet.publish.docker.description")}),t.jsx(Q,{disabled:l,value:o.description,onChange:w,sx:{flex:1},label:i("blocklet.publish.docker.description")})]}),B&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:i("blocklet.publish.docker.portType")}),t.jsxs(tn,{value:o.type||"docker",onChange:b,children:[t.jsx(de,{value:"docker",children:"Docker"}),t.jsx(de,{value:"web",children:"Web"})]})]}),B&&o.type==="web"&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:i("blocklet.publish.docker.path")}),t.jsx(Q,{disabled:l,value:o.path,onChange:D,sx:{flex:1},label:i("blocklet.publish.docker.path")})]}),B&&o.type==="web"&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:i("blocklet.publish.docker.name")}),t.jsx(Q,{disabled:l,value:o.name,onChange:T,sx:{flex:1},label:i("blocklet.publish.docker.name")})]}),B&&o.type==="web"&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(A,{sx:{flex:1},children:i("blocklet.publish.docker.prefix")}),t.jsx(Q,{disabled:l,value:o.prefix,onChange:j,sx:{flex:1},label:i("blocklet.publish.docker.prefix")})]})]})})]})}lt.propTypes={dockerParams:d.object.isRequired,setDockerParams:d.func.isRequired,dataKey:d.string.isRequired,item:d.object.isRequired,t:d.func.isRequired,readOnly:d.bool.isRequired,index:d.number.isRequired};lt.defaultProps={};const El=`
|
|
181
181
|
docker run --name postgrest
|
|
182
182
|
-p 3000:3000
|
|
183
183
|
-e PGRST_DB_URI="postgres://username:password@host:port/database"
|
|
184
184
|
-e PGRST_DB_SCHEMA="public"
|
|
185
185
|
-e PGRST_DB_ANON_ROLE="anon"
|
|
186
186
|
postgrest/postgrest
|
|
187
|
-
`.trim();function fo({readOnly:e,paramsErrTip:o,setParamsErrTip:n,error:r,params:s,setParams:i}){const{t:l}=Y(),[a,c]=S.useState("dockerParams"),[f,h]=S.useState(""),[g,x]=S.useState(!1),[p,y]=S.useState("--volume"),[w,D]=S.useState(""),[j,b]=S.useState(wo(f)),T=j.dockerArgs||[],L=j.dockerEnvs||[],I=j.dockerImage||"",k=C=>{const{value:m}=C.target;h(m)};S.useEffect(()=>{s.blockletDocker&&s.blockletDocker.dockerImage&&!I&&b(s.blockletDocker)},[s,I,b]);const _=C=>{const m=wo(C.target.value);b(P=>{let M,F=!1;return m.dockerArgs.forEach(v=>{const E=P.dockerArgs.find(q=>q.key===v.key);E&&(Object.entries(E).forEach(([q,V])=>{V!=null&&q!=="value"&&(v[q]=V)}),v.type==="web"&&(v.path="/",v.protocol="http",v.prefix="/",v.name="publicUrl",v.port="BLOCKLET_PORT",F=!0),!M&&v.key==="--publish"&&(M=v))}),!F&&M&&(M.type="web",M.path="/",M.protocol="http",M.prefix="/",M.name="publicUrl",M.port="BLOCKLET_PORT"),m.dockerEnvs.forEach(v=>{const E=P.dockerEnvs.find(q=>q.key===v.key);E&&Object.entries(E).forEach(([q,V])=>{V!=null&&q!=="value"&&(v[q]=V)})}),m})},$=()=>{if(x(!1),p==="--env"){b({...j,dockerEnvs:[...L,{key:w,value:"",custom:"",secure:!1,shared:!1,required:!1,description:w}]}),D("");return}b({...j,dockerArgs:[...T,{key:p,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},B=()=>{x(!1),D("")},R=C=>{const{value:m}=C.target;b({...j,dockerImage:m}),m.indexOf(" ")>-1?n({...o,dockerImageName:l("blocklet.publish.docker.dockerImageNameError")}):n({...o,dockerImageName:""})};return S.useEffect(()=>{a==="dockerCommand"&&h(qs(j))},[j,a]),S.useEffect(()=>{i(C=>({...C,blockletDocker:{dockerImage:j.dockerImage,dockerArgs:j.dockerArgs,dockerEnvs:j.dockerEnvs}}))},[j,i]),t.jsxs(u,{sx:{mt:3},children:[t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[t.jsx(u,{sx:{borderBottom:1,borderColor:"divider",mb:2},children:t.jsxs(en,{value:a,onChange:(C,m)=>c(m),children:[t.jsx(tt,{value:"dockerParams",label:l("blocklet.publish.docker.dockerParams")}),t.jsx(tt,{value:"dockerCommand",label:l("blocklet.publish.docker.dockerCommand")})]})}),a==="dockerCommand"&&t.jsx(Q,{disabled:e,label:l("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:El,InputProps:{"data-cy":"blocklet-docker-command",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,spellCheck:!1,minRows:10,value:f,onChange:k,onBlur:_}),a==="dockerParams"&&t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:2},children:[t.jsx(Q,{disabled:e,label:l("blocklet.publish.docker.dockerImageName"),placeholder:l("blocklet.publish.docker.dockerImageName"),value:I,sx:{flex:1},color:o.dockerImageName?"error":"primary",error:!!o.dockerImageName,helperText:o.dockerImageName||"",onChange:R}),t.jsx(A,{variant:"caption",color:"text.secondary",children:"Example: docker.io/postgrest/postgrest:latest"}),t.jsx(u,{sx:{height:4}}),T.map((C,m)=>t.jsx(lt,{index:m,item:C,dockerParams:j,setDockerParams:b,dataKey:"dockerArgs",t:l,readOnly:e},`${C.key}-${m}`)),L.map((C,m)=>t.jsx(lt,{index:m,item:C,dockerParams:j,setDockerParams:b,dataKey:"dockerEnvs",t:l,readOnly:e},`${C.key}-${m}`)),!e&&t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{flex:1}}),t.jsx(K,{onClick:()=>x(!0),children:l("blocklet.publish.docker.addItem")})]})]})]}),!!r&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:r}),g&&t.jsxs(_t,{fullWidth:!0,open:!0,children:[t.jsx(Yo,{children:l("blocklet.publish.docker.addItem")}),t.jsx(Zo,{children:t.jsxs(ls,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[t.jsx(tn,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:p,sx:{width:"100%"},onChange:C=>y(C.target.value),children:Object.keys(cn).map(C=>t.jsx(de,{value:C,children:C}))}),p==="--publish"&&t.jsx(A,{variant:"caption",color:"text.secondary",children:l("blocklet.publish.docker.publishTips")}),p==="--volume"&&t.jsx(A,{variant:"caption",color:"text.secondary",children:l("blocklet.publish.docker.volumeTips")}),p==="--env"&&t.jsxs(u,{sx:{mt:3,width:"100%"},children:[t.jsx(Q,{value:w,onChange:C=>D(C.target.value),sx:{width:"100%"},label:l("blocklet.publish.docker.envKey")}),t.jsx(is,{children:l("blocklet.publish.docker.dockerArgValue")})]})]})}),t.jsxs(Ko,{children:[t.jsx(K,{onClick:B,children:l("common.cancel")}),t.jsx(K,{onClick:$,children:l("common.confirm")})]})]})]})}fo.propTypes={readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,error:d.string.isRequired,setParamsErrTip:d.func.isRequired,paramsErrTip:d.func.isRequired};fo.defaultProps={};const Al=({tabs:e,blocklet:o,ancestors:n=[]})=>{const r=o.meta.did;e.push({label:t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(At,{size:24,blocklet:o,ancestors:n}),t.jsx(u,{ml:"4px",className:"text",children:t.jsx(u,{children:o.meta.title})})]},r),value:r})},Bo=(e,o)=>{const n=qt(e,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletVideos","blockletScreenshots","blockletResourceType","blockletSupport","blockletHomepage","blockletCommunity","blockletRepository","blockletDocker","contentType","connectedStores","blockletComponents","lastReleaseId","uploadedResource","autoUpload","possibleSameStore","note"]);return n.blockletComponents?n.blockletComponents=n.blockletComponents.map(r=>({...r,included:!0})):n.blockletComponents=(o.children||[]).map(r=>({did:r.meta.did,included:!1,required:!1})),n},zl={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},Wo={branding:0,introduction:1,resources:2,blocklets:3,version:4};function ho({initUrl:e,...o}){var mo;const{projectId:n,mode:r,releaseId:s,componentDid:i=""}=it(),{t:l}=Y(),{blocklet:a}=De(),[c,f]=Re({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}}),[h,g]=Re({}),[x,p]=S.useState(!1),[y,w]=Re(null),{api:D}=he(),j=Me(N=>N.breakpoints.down("md")),[b,T]=S.useState({}),[L,I]=S.useState(!1),k=S.useRef({}),[_,$]=Re({}),[B,R]=S.useState(""),[C,m]=Re({}),P=e==null?void 0:e.searchParams.get("dependentComponentsMode"),M=P==="readonly",F=S.useMemo(()=>{const N={};return Object.keys(C).forEach(z=>{const ge=C[z];ge&&ge.forEach(Hn=>{N[Hn]=!0})}),N},[C]),v=S.useCallback(N=>{M&&f({blockletComponents:[]}),m(N)},[M,m,f]),E=S.useCallback((...N)=>{$(...N),g({blockletResource:"",blockletDocker:""})},[]),q=s==="none"?(c==null?void 0:c.lastReleaseId)||"":s,[V,G]=S.useState(r==="new-release"?4:0);S.useEffect(()=>{n&&g({projectId:""})},[n,g]);const te=S.useMemo(()=>{var N;return(c==null?void 0:c.blockletResourceType)==="resource"?"resource":(N=c==null?void 0:c.blockletComponents)!=null&&N.some(z=>z.included)||Object.keys(F).length||c!=null&&c.uploadedResource?"pack":"resource"},[c==null?void 0:c.blockletComponents,c==null?void 0:c.uploadedResource,F,c==null?void 0:c.blockletResourceType]),J=[],Z=((a==null?void 0:a.children)||[]).filter(N=>{var z;return(z=N.meta.resource)==null?void 0:z.exportApi}).filter(N=>!i||N.meta.did===i);Z.forEach(N=>{Al({tabs:J,blocklet:N,t:l,ancestors:[a]})});const[Te,We]=S.useState((mo=J[0])==null?void 0:mo.value),be=!L&&(y==null?void 0:y.status)==="published",oe=be,Pe=ws(()=>{if(!e)return;R(e.searchParams.get("logo")),f(z=>{var ge;return{...z,blockletTitle:(z==null?void 0:z.blockletTitle)||e.searchParams.get("title"),blockletDescription:(z==null?void 0:z.blockletDescription)||e.searchParams.get("description"),blockletIntroduction:(z==null?void 0:z.blockletIntroduction)||e.searchParams.get("introduction")||e.searchParams.get("description"),blockletComponents:(ge=z==null?void 0:z.blockletComponents)!=null&&ge.length?z==null?void 0:z.blockletComponents:JSON.parse(e.searchParams.get("components")||"[]"),note:(z==null?void 0:z.note)||e.searchParams.get("note")||"No note"}});const N=e.searchParams.get("resources");try{const z=JSON.parse(N);T(z)}catch{}}),we=async()=>{if(q)try{const N=await D.getRelease({input:{did:a.meta.did,projectId:n,releaseId:q}});if(p(!1),!N.release){W.error("Release not found");return}N.release=Fn(N.release),r!=="view"&&(N.release.note=""),f(z=>Bo({...z,...N.release,blockletVersion:r==="create"||r==="new-release"?Ce.inc(N.release.blockletVersion,"patch"):N.release.blockletVersion},a)),w(N.release)}catch(N){p(!1),W.error(Ie(N))}},ee=async()=>{if(n===H.UNOWNED_DID){f({blockletVersion:"1.0.0",blockletTitle:""});return}if(!n){W.error(l("blocklet.publish.errorTip.noDid"));return}try{const z=(await D.getProject({input:{did:a.meta.did,projectId:n}})).project||{};z.blockletVersion?(r==="create"||r==="new-release")&&Ce.valid(z.blockletVersion)&&(z.blockletVersion=Ce.inc(z.blockletVersion,"patch")):z.blockletVersion="1.0.0";const ge=Bo(z,a);f(ge),z.lastReleaseId||Pe()}catch(N){W.error(Ie(N))}},ce=S.useCallback(async()=>{p(!0);try{if(r==="view"){if(!q){W.error("Empty release id");return}await ee(),await we();return}await ee(),q&&(I(!0),await we())}finally{p(!1)}},[r,q]),O=N=>{f({blockletComponents:N})},Ve=N=>{f({blockletResourceType:N})};S.useEffect(()=>{ce()},[ce]),S.useEffect(()=>{n===H.UNOWNED_DID&&(r==="create"||r==="new-release")&&e&&Pe()},[n,e,r,Pe]),S.useEffect(()=>{c.contentType==="docker"?f({resourceFromSelect:!1}):c.contentType==="blocklet"?f({resourceFromSelect:!0}):c.contentType==="upload"&&f({resourceFromSelect:!1})},[c.contentType,f]);const _e=S.useMemo(()=>!!Object.keys(_).find(N=>!!_[N].length),[_]);if(!c&&x)return t.jsx(Be,{});if(!c)return null;const Le=Z.find(N=>N.meta.did===Te);if(Z.every(N=>N.status!=="running")&&(Z!=null&&Z.length))return t.jsx(ye,{children:l("blocklet.publish.allComponentsNotRunning")});const Fe=N=>{We(N)},qe=e==null?void 0:e.searchParams.get("resourcesTitle"),U=e==null?void 0:e.searchParams.get("componentsTitle"),X=[{label:l("blocklet.publish.branding"),description:l("blocklet.publish.steps.branding")},{label:l("common.introduction"),description:l("blocklet.publish.steps.introduction")},{label:qe||l("blocklet.publish.resourceTitle"),description:l("blocklet.publish.steps.resources")},{label:U||l("common.components"),description:l("blocklet.publish.steps.blocklets")},{label:l("blocklet.publish.versionTitle"),description:l("blocklet.publish.steps.version")}],Ue=X[V]||X[X.length-1],xe=zl[V];return t.jsxs(Ml,{...o,children:[t.jsx(Mn,{blocklet:a,release:y,getData:ce,getRelease:we,mode:r,params:c,setParams:f,setParamsErrTip:g,readOnly:oe,isPublished:be,loading:x,setLoading:p,initLogoUrl:B,releaseId:q,projectId:n,projectType:te,resourceComponents:Z,resourceComponentsMap:C,resourceRelateComponents:F,resourceItem:Le,saveSelectedEventsRef:k,hasSelectedResources:_e,releaseUsedLast:L,setReleaseUsedLast:I,setRelease:w,paramsErrTip:h}),t.jsxs(u,{display:"flex",flexDirection:"column",sx:{width:"100%"},children:[t.jsx(u,{pt:3}),t.jsxs(u,{sx:{gap:3},display:"flex",flexDirection:j?"column":"row",children:[!j&&t.jsx(Vn,{steps:X,loading:x,viewMode:r==="view",params:c,hasSelectedResources:_e||c.uploadedResource,paramsErrTip:h,activeStep:V,setActiveStep:G,projectId:n,resourcesUrlTitle:qe,componentsUrlTitle:U}),t.jsxs(u,{flex:"1",maxWidth:"720px",children:[!j&&xe!=="introduction"&&t.jsxs(A,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[Ue.label,xe==="branding"&&t.jsx(ae,{title:l("blocklet.publish.brandingHelp"),placement:"right",children:t.jsx(u,{component:"a",target:"_blank",href:"https://www.arcblock.io/docs/blocklet-store/en/blocklet-detail-page",sx:{paddingTop:1,marginLeft:1},style:{color:"gray"},children:t.jsx(vs,{})})})]}),(j||xe==="branding")&&t.jsx(u,{flexDirection:"column",children:t.jsx($n,{projectId:n,setParams:f,setParamsErrTip:g,params:c,componentDid:i,blocklet:a,initUrl:e,loading:x,setLoading:p,paramsErrTip:h,readOnly:oe,initLogoUrl:B,setInitLogoUrl:R})}),j&&t.jsx(u,{flexDirection:"column",children:t.jsx(rt,{loading:x,params:c,paramsErrTip:h,setParams:f,setParamsErrTip:g,readOnly:oe})}),(j||xe==="introduction")&&t.jsx(u,{display:"flex",flexDirection:"column",sx:{mt:j?5:0,width:"100%"},children:t.jsx(Bn,{loading:x,readOnly:oe,params:c,setParams:f,paramsErrTip:h,setParamsErrTip:g})}),j&&t.jsx(A,{variant:"h6",fontWeight:"bold",mt:5,children:X[Wo.resources].label}),t.jsx(u,{display:j||xe==="resources"?"flex":"none",sx:{maxWidth:720},flexDirection:"column",children:t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(u,{sx:{flex:1},children:[t.jsxs(cs,{onChange:N=>f({contentType:N.target.value}),children:[t.jsx(Xe,{value:"blocklet",disabled:oe,control:t.jsx(ht,{size:"small",checked:c.contentType==="blocklet"}),label:l("blocklet.publish.resourceSelect")}),t.jsx(Xe,{value:"upload",disabled:oe,control:t.jsx(ht,{size:"small",checked:c.contentType==="upload"}),label:l("blocklet.publish.resourceUpload")}),t.jsx(Xe,{value:"docker",disabled:oe,control:t.jsx(ht,{size:"small",checked:c.contentType==="docker"}),label:l("blocklet.publish.resourceDocker")})]}),c.contentType==="blocklet"&&t.jsxs(t.Fragment,{children:[!i&&t.jsx(js,{tabs:J,current:Te,onChange:Fe,sx:{ml:-2,mt:2,maxWidth:j?window.innerWidth-24:"100%"}}),t.jsx(Yt,{loading:x,initialResources:b,saveSelectedEventsRef:k,selectedResourceIds:_,setSelectedResourceIds:E,setResourceComponentsMap:v,error:h.blockletResource,app:a,readOnly:oe,component:Le,componentDid:i,initUrl:e,params:c,setParams:f,projectId:n===H.UNOWNED_DID?"":n,releaseUsedLast:L,release:{...y,id:q}})]}),c.contentType==="upload"&&t.jsx(po,{app:a,readOnly:oe,projectId:n===H.UNOWNED_DID?"":n,params:c,error:h.blockletResource,setParams:f,setParamsErrTip:g}),c.contentType==="docker"&&t.jsx(fo,{app:a,readOnly:oe,projectId:n===H.UNOWNED_DID?"":n,params:c,error:h.blockletResource,setParams:f,setParamsErrTip:g,paramsErrTip:h})]})})}),j&&t.jsx(A,{variant:"h6",fontWeight:"bold",mt:5,children:X[Wo.blocklets].label}),(j||xe==="blocklets")&&t.jsx(u,{flexDirection:"column",children:t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsx(u,{sx:{flex:1},children:t.jsx(Gt,{projectType:te,disabled:x||oe,app:a,value:(c==null?void 0:c.blockletComponents)||[],blockletResourceType:(c==null?void 0:c.blockletResourceType)||"",onChange:O,onChangeBlockletResourceType:Ve,resourceRelateComponents:F,dependentComponentsMode:P})})})}),!j&&xe==="version"&&t.jsx(u,{flexDirection:"column",children:t.jsx(rt,{loading:x,params:c,paramsErrTip:h,setParams:f,setParamsErrTip:g,readOnly:oe})})]})]})]})]})}ho.propTypes={initUrl:d.object};ho.defaultProps={initUrl:null};const Ml=ie.div`
|
|
187
|
+
`.trim();function fo({readOnly:e,paramsErrTip:o,setParamsErrTip:n,error:r,params:s,setParams:i}){const{t:l}=Y(),[a,c]=S.useState("dockerParams"),[f,h]=S.useState(""),[g,x]=S.useState(!1),[p,y]=S.useState("--volume"),[w,D]=S.useState(""),[j,b]=S.useState(wo(f)),T=j.dockerArgs||[],L=j.dockerEnvs||[],I=j.dockerImage||"",k=C=>{const{value:m}=C.target;h(m)};S.useEffect(()=>{s.blockletDocker&&s.blockletDocker.dockerImage&&!I&&b(s.blockletDocker)},[s,I,b]);const _=C=>{const m=wo(C.target.value);b(P=>{let M,F=!1;return m.dockerArgs.forEach(v=>{const E=P.dockerArgs.find(q=>q.key===v.key);E&&(Object.entries(E).forEach(([q,V])=>{V!=null&&q!=="value"&&(v[q]=V)}),v.type==="web"&&(v.path="/",v.protocol="http",v.prefix="/",v.name="publicUrl",v.port="BLOCKLET_PORT",F=!0),!M&&v.key==="--publish"&&(M=v))}),!F&&M&&(M.type="web",M.path="/",M.protocol="http",M.prefix="/",M.name="publicUrl",M.port="BLOCKLET_PORT"),m.dockerEnvs.forEach(v=>{const E=P.dockerEnvs.find(q=>q.key===v.key);E&&Object.entries(E).forEach(([q,V])=>{V!=null&&q!=="value"&&(v[q]=V)})}),m})},$=()=>{if(x(!1),p==="--env"){b({...j,dockerEnvs:[...L,{key:w,value:"",custom:"",secure:!1,shared:!1,required:!1,description:w}]}),D("");return}b({...j,dockerArgs:[...T,{key:p,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},B=()=>{x(!1),D("")},R=C=>{const{value:m}=C.target;b({...j,dockerImage:m}),m.indexOf(" ")>-1?n({...o,dockerImageName:l("blocklet.publish.docker.dockerImageNameError")}):n({...o,dockerImageName:""})};return S.useEffect(()=>{a==="dockerCommand"&&h(qs(j))},[j,a]),S.useEffect(()=>{i(C=>({...C,blockletDocker:{dockerImage:j.dockerImage,dockerArgs:j.dockerArgs,dockerEnvs:j.dockerEnvs}}))},[j,i]),t.jsxs(u,{sx:{mt:3},children:[t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[t.jsx(u,{sx:{borderBottom:1,borderColor:"divider",mb:2},children:t.jsxs(en,{value:a,onChange:(C,m)=>c(m),children:[t.jsx(tt,{value:"dockerParams",label:l("blocklet.publish.docker.dockerParams")}),t.jsx(tt,{value:"dockerCommand",label:l("blocklet.publish.docker.dockerCommand")})]})}),a==="dockerCommand"&&t.jsx(Q,{disabled:e,label:l("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:El,InputProps:{"data-cy":"blocklet-docker-command",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,spellCheck:!1,minRows:10,value:f,onChange:k,onBlur:_}),a==="dockerParams"&&t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:2},children:[t.jsx(Q,{disabled:e,label:l("blocklet.publish.docker.dockerImageName"),placeholder:l("blocklet.publish.docker.dockerImageName"),value:I,sx:{flex:1},color:o.dockerImageName?"error":"primary",error:!!o.dockerImageName,helperText:o.dockerImageName||"",onChange:R}),t.jsx(A,{variant:"caption",color:"text.secondary",children:"Example: docker.io/postgrest/postgrest:latest"}),t.jsx(u,{sx:{height:4}}),T.map((C,m)=>t.jsx(lt,{index:m,item:C,dockerParams:j,setDockerParams:b,dataKey:"dockerArgs",t:l,readOnly:e},`${C.key}-${m}`)),L.map((C,m)=>t.jsx(lt,{index:m,item:C,dockerParams:j,setDockerParams:b,dataKey:"dockerEnvs",t:l,readOnly:e},`${C.key}-${m}`)),!e&&t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{flex:1}}),t.jsx(K,{onClick:()=>x(!0),children:l("blocklet.publish.docker.addItem")})]})]})]}),!!r&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:r}),g&&t.jsxs(_t,{fullWidth:!0,open:!0,children:[t.jsx(Yo,{children:l("blocklet.publish.docker.addItem")}),t.jsx(Zo,{children:t.jsxs(ls,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[t.jsx(tn,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:p,sx:{width:"100%"},onChange:C=>y(C.target.value),children:Object.keys(cn).map(C=>t.jsx(de,{value:C,children:C}))}),p==="--publish"&&t.jsx(A,{variant:"caption",color:"text.secondary",children:l("blocklet.publish.docker.publishTips")}),p==="--volume"&&t.jsx(A,{variant:"caption",color:"text.secondary",children:l("blocklet.publish.docker.volumeTips")}),p==="--env"&&t.jsxs(u,{sx:{mt:3,width:"100%"},children:[t.jsx(Q,{value:w,onChange:C=>D(C.target.value),sx:{width:"100%"},label:l("blocklet.publish.docker.envKey")}),t.jsx(is,{children:l("blocklet.publish.docker.dockerArgValue")})]})]})}),t.jsxs(Ko,{children:[t.jsx(K,{onClick:B,children:l("common.cancel")}),t.jsx(K,{onClick:$,children:l("common.confirm")})]})]})]})}fo.propTypes={readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,error:d.string.isRequired,setParamsErrTip:d.func.isRequired,paramsErrTip:d.func.isRequired};fo.defaultProps={};const Al=({tabs:e,blocklet:o,ancestors:n=[]})=>{const r=o.meta.did;e.push({label:t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(At,{size:24,blocklet:o,ancestors:n}),t.jsx(u,{ml:"4px",className:"text",children:t.jsx(u,{children:o.meta.title})})]},r),value:r})},Bo=(e,o)=>{const n=qt(e,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletVideos","blockletScreenshots","blockletResourceType","blockletSupport","blockletHomepage","blockletCommunity","blockletRepository","blockletDocker","contentType","connectedStores","blockletComponents","lastReleaseId","uploadedResource","autoUpload","possibleSameStore","note"]);return n.blockletComponents?n.blockletComponents=n.blockletComponents.map(r=>({...r,included:!0})):n.blockletComponents=(o.children||[]).map(r=>({did:r.meta.did,included:!1,required:!1})),n},zl={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},Wo={branding:0,introduction:1,resources:2,blocklets:3,version:4};function ho({initUrl:e,...o}){var mo;const{projectId:n,mode:r,releaseId:s,componentDid:i=""}=it(),{t:l}=Y(),{blocklet:a}=De(),[c,f]=Re({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}}),[h,g]=Re({}),[x,p]=S.useState(!1),[y,w]=Re(null),{api:D}=he(),j=Me(N=>N.breakpoints.down("md")),[b,T]=S.useState({}),[L,I]=S.useState(!1),k=S.useRef({}),[_,$]=Re({}),[B,R]=S.useState(""),[C,m]=Re({}),P=e==null?void 0:e.searchParams.get("dependentComponentsMode"),M=P==="readonly",F=S.useMemo(()=>{const N={};return Object.keys(C).forEach(z=>{const ge=C[z];ge&&ge.forEach(Hn=>{N[Hn]=!0})}),N},[C]),v=S.useCallback(N=>{M&&f({blockletComponents:[]}),m(N)},[M,m,f]),E=S.useCallback((...N)=>{$(...N),g({blockletResource:"",blockletDocker:""})},[]),q=s==="none"?(c==null?void 0:c.lastReleaseId)||"":s,[V,G]=S.useState(r==="new-release"?4:0);S.useEffect(()=>{n&&g({projectId:""})},[n,g]);const te=S.useMemo(()=>{var N;return(c==null?void 0:c.blockletResourceType)==="resource"?"resource":(N=c==null?void 0:c.blockletComponents)!=null&&N.some(z=>z.included)||Object.keys(F).length||c!=null&&c.uploadedResource?"pack":"resource"},[c==null?void 0:c.blockletComponents,c==null?void 0:c.uploadedResource,F,c==null?void 0:c.blockletResourceType]),J=[],Z=((a==null?void 0:a.children)||[]).filter(N=>{var z;return(z=N.meta.resource)==null?void 0:z.exportApi}).filter(N=>!i||N.meta.did===i);Z.forEach(N=>{Al({tabs:J,blocklet:N,t:l,ancestors:[a]})});const[Te,We]=S.useState((mo=J[0])==null?void 0:mo.value),be=!L&&(y==null?void 0:y.status)==="published",oe=be,Pe=ws(()=>{if(!e)return;R(e.searchParams.get("logo")),f(z=>{var ge;return{...z,blockletTitle:(z==null?void 0:z.blockletTitle)||e.searchParams.get("title"),blockletDescription:(z==null?void 0:z.blockletDescription)||e.searchParams.get("description"),blockletIntroduction:(z==null?void 0:z.blockletIntroduction)||e.searchParams.get("introduction")||e.searchParams.get("description"),blockletComponents:(ge=z==null?void 0:z.blockletComponents)!=null&&ge.length?z==null?void 0:z.blockletComponents:JSON.parse(e.searchParams.get("components")||"[]"),note:(z==null?void 0:z.note)||e.searchParams.get("note")||"No note"}});const N=e.searchParams.get("resources");try{const z=JSON.parse(N);T(z)}catch{}}),we=async()=>{if(q)try{const N=await D.getRelease({input:{did:a.meta.did,projectId:n,releaseId:q}});if(p(!1),!N.release){W.error("Release not found");return}N.release=Fn(N.release),r!=="view"&&(N.release.note=""),f(z=>Bo({...z,...N.release,blockletVersion:r==="create"||r==="new-release"?Ce.inc(N.release.blockletVersion,"patch"):N.release.blockletVersion},a)),w(N.release)}catch(N){p(!1),W.error(Ie(N))}},ee=async()=>{if(n===H.UNOWNED_DID){f({blockletVersion:"0.0.1",blockletTitle:""});return}if(!n){W.error(l("blocklet.publish.errorTip.noDid"));return}try{const z=(await D.getProject({input:{did:a.meta.did,projectId:n}})).project||{};z.blockletVersion?(r==="create"||r==="new-release")&&Ce.valid(z.blockletVersion)&&(z.blockletVersion=Ce.inc(z.blockletVersion,"patch")):z.blockletVersion="0.0.1";const ge=Bo(z,a);f(ge),z.lastReleaseId||Pe()}catch(N){W.error(Ie(N))}},ce=S.useCallback(async()=>{p(!0);try{if(r==="view"){if(!q){W.error("Empty release id");return}await ee(),await we();return}await ee(),q&&(I(!0),await we())}finally{p(!1)}},[r,q]),O=N=>{f({blockletComponents:N})},Ve=N=>{f({blockletResourceType:N})};S.useEffect(()=>{ce()},[ce]),S.useEffect(()=>{n===H.UNOWNED_DID&&(r==="create"||r==="new-release")&&e&&Pe()},[n,e,r,Pe]),S.useEffect(()=>{c.contentType==="docker"?f({resourceFromSelect:!1}):c.contentType==="blocklet"?f({resourceFromSelect:!0}):c.contentType==="upload"&&f({resourceFromSelect:!1})},[c.contentType,f]);const _e=S.useMemo(()=>!!Object.keys(_).find(N=>!!_[N].length),[_]);if(!c&&x)return t.jsx(Be,{});if(!c)return null;const Le=Z.find(N=>N.meta.did===Te);if(Z.every(N=>N.status!=="running")&&(Z!=null&&Z.length))return t.jsx(ye,{children:l("blocklet.publish.allComponentsNotRunning")});const Fe=N=>{We(N)},qe=e==null?void 0:e.searchParams.get("resourcesTitle"),U=e==null?void 0:e.searchParams.get("componentsTitle"),X=[{label:l("blocklet.publish.branding"),description:l("blocklet.publish.steps.branding")},{label:l("common.introduction"),description:l("blocklet.publish.steps.introduction")},{label:qe||l("blocklet.publish.resourceTitle"),description:l("blocklet.publish.steps.resources")},{label:U||l("common.components"),description:l("blocklet.publish.steps.blocklets")},{label:l("blocklet.publish.versionTitle"),description:l("blocklet.publish.steps.version")}],Ue=X[V]||X[X.length-1],xe=zl[V];return t.jsxs(Ml,{...o,children:[t.jsx(Mn,{blocklet:a,release:y,getData:ce,getRelease:we,mode:r,params:c,setParams:f,setParamsErrTip:g,readOnly:oe,isPublished:be,loading:x,setLoading:p,initLogoUrl:B,releaseId:q,projectId:n,projectType:te,resourceComponents:Z,resourceComponentsMap:C,resourceRelateComponents:F,resourceItem:Le,saveSelectedEventsRef:k,hasSelectedResources:_e,releaseUsedLast:L,setReleaseUsedLast:I,setRelease:w,paramsErrTip:h}),t.jsxs(u,{display:"flex",flexDirection:"column",sx:{width:"100%"},children:[t.jsx(u,{pt:3}),t.jsxs(u,{sx:{gap:3},display:"flex",flexDirection:j?"column":"row",children:[!j&&t.jsx(Vn,{steps:X,loading:x,viewMode:r==="view",params:c,hasSelectedResources:_e||c.uploadedResource,paramsErrTip:h,activeStep:V,setActiveStep:G,projectId:n,resourcesUrlTitle:qe,componentsUrlTitle:U}),t.jsxs(u,{flex:"1",maxWidth:"720px",children:[!j&&xe!=="introduction"&&t.jsxs(A,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[Ue.label,xe==="branding"&&t.jsx(ae,{title:l("blocklet.publish.brandingHelp"),placement:"right",children:t.jsx(u,{component:"a",target:"_blank",href:"https://www.arcblock.io/docs/blocklet-store/en/blocklet-detail-page",sx:{paddingTop:1,marginLeft:1},style:{color:"gray"},children:t.jsx(vs,{})})})]}),(j||xe==="branding")&&t.jsx(u,{flexDirection:"column",children:t.jsx($n,{projectId:n,setParams:f,setParamsErrTip:g,params:c,componentDid:i,blocklet:a,initUrl:e,loading:x,setLoading:p,paramsErrTip:h,readOnly:oe,initLogoUrl:B,setInitLogoUrl:R})}),j&&t.jsx(u,{flexDirection:"column",children:t.jsx(rt,{loading:x,params:c,paramsErrTip:h,setParams:f,setParamsErrTip:g,readOnly:oe})}),(j||xe==="introduction")&&t.jsx(u,{display:"flex",flexDirection:"column",sx:{mt:j?5:0,width:"100%"},children:t.jsx(Bn,{loading:x,readOnly:oe,params:c,setParams:f,paramsErrTip:h,setParamsErrTip:g})}),j&&t.jsx(A,{variant:"h6",fontWeight:"bold",mt:5,children:X[Wo.resources].label}),t.jsx(u,{display:j||xe==="resources"?"flex":"none",sx:{maxWidth:720},flexDirection:"column",children:t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(u,{sx:{flex:1},children:[t.jsxs(cs,{onChange:N=>f({contentType:N.target.value}),children:[t.jsx(Xe,{value:"blocklet",disabled:oe,control:t.jsx(ht,{size:"small",checked:c.contentType==="blocklet"}),label:l("blocklet.publish.resourceSelect")}),t.jsx(Xe,{value:"upload",disabled:oe,control:t.jsx(ht,{size:"small",checked:c.contentType==="upload"}),label:l("blocklet.publish.resourceUpload")}),t.jsx(Xe,{value:"docker",disabled:oe,control:t.jsx(ht,{size:"small",checked:c.contentType==="docker"}),label:l("blocklet.publish.resourceDocker")})]}),c.contentType==="blocklet"&&t.jsxs(t.Fragment,{children:[!i&&t.jsx(js,{tabs:J,current:Te,onChange:Fe,sx:{ml:-2,mt:2,maxWidth:j?window.innerWidth-24:"100%"}}),t.jsx(Yt,{loading:x,initialResources:b,saveSelectedEventsRef:k,selectedResourceIds:_,setSelectedResourceIds:E,setResourceComponentsMap:v,error:h.blockletResource,app:a,readOnly:oe,component:Le,componentDid:i,initUrl:e,params:c,setParams:f,projectId:n===H.UNOWNED_DID?"":n,releaseUsedLast:L,release:{...y,id:q}})]}),c.contentType==="upload"&&t.jsx(po,{app:a,readOnly:oe,projectId:n===H.UNOWNED_DID?"":n,params:c,error:h.blockletResource,setParams:f,setParamsErrTip:g}),c.contentType==="docker"&&t.jsx(fo,{app:a,readOnly:oe,projectId:n===H.UNOWNED_DID?"":n,params:c,error:h.blockletResource,setParams:f,setParamsErrTip:g,paramsErrTip:h})]})})}),j&&t.jsx(A,{variant:"h6",fontWeight:"bold",mt:5,children:X[Wo.blocklets].label}),(j||xe==="blocklets")&&t.jsx(u,{flexDirection:"column",children:t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsx(u,{sx:{flex:1},children:t.jsx(Gt,{projectType:te,disabled:x||oe,app:a,value:(c==null?void 0:c.blockletComponents)||[],blockletResourceType:(c==null?void 0:c.blockletResourceType)||"",onChange:O,onChangeBlockletResourceType:Ve,resourceRelateComponents:F,dependentComponentsMode:P})})})}),!j&&xe==="version"&&t.jsx(u,{flexDirection:"column",children:t.jsx(rt,{loading:x,params:c,paramsErrTip:h,setParams:f,setParamsErrTip:g,readOnly:oe})})]})]})]})]})}ho.propTypes={initUrl:d.object};ho.defaultProps={initUrl:null};const Ml=ie.div`
|
|
188
188
|
.section {
|
|
189
189
|
&.full-width {
|
|
190
190
|
max-width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as d}from"./vendor-react-D-afvo_7.js";import{E as l,j as n,a3 as g,aj as A,M as G,I as L,a2 as H,bR as J,aa as U}from"./vendor-mui-core-BlX2BJoA.js";import{af as Y,J as Q,bc as Z}from"./vendor-arcblock-CiLB_TiI.js";import{d as v}from"./Done-BCESxXX2.js";import{C as ee}from"./Google-rxW6OGq8.js";import{a8 as te,f as ne}from"./index-
|
|
1
|
+
import{r as d}from"./vendor-react-D-afvo_7.js";import{E as l,j as n,a3 as g,aj as A,M as G,I as L,a2 as H,bR as J,aa as U}from"./vendor-mui-core-BlX2BJoA.js";import{af as Y,J as Q,bc as Z}from"./vendor-arcblock-CiLB_TiI.js";import{d as v}from"./Done-BCESxXX2.js";import{C as ee}from"./Google-rxW6OGq8.js";import{a8 as te,f as ne}from"./index-DgZ1ypbb.js";import{R as re,F as oe,L as se}from"./logo-uploader-C1-XCCMv.js";const N={description:l.string,editing:l.bool,onChange:l.func,required:l.bool,value:l.any,componentProps:l.object,render:l.func,renderFormItem:l.func};function S({editing:r,value:o,onChange:a}){const[c,u]=d.useState(!1),m=d.useRef(),p=d.useRef(o);d.useEffect(()=>{let s=null;return r&&(s=setTimeout(()=>{u(!0)},50)),()=>{clearTimeout(s)}},[r]);const k=s=>{p.current=s,a(s)},b=()=>{u(!1),a(p.current)},I=n.jsx(g,{className:"form-item-input slot",px:1,children:n.jsxs(g,{display:"flex",alignItems:"center",children:[o,o!=="auto"&&n.jsx("div",{style:{marginLeft:4,backgroundColor:o,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),f=n.jsxs(g,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:b,children:[n.jsx(g,{display:"flex",alignItems:"center",onClick:()=>u(!0),children:n.jsx("div",{ref:m,style:{flexShrink:0,marginLeft:"8px",backgroundColor:o,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:o==="auto"?"default":"pointer"}})}),n.jsx(A,{open:c,anchorEl:m.current,onClose:()=>u(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:n.jsx(ee,{color:o,onChange:s=>k(s.hex)})})]});return r?f:I}S.propTypes=N;function _({editing:r,description:o,value:a,onChange:c,componentProps:u,...m}){const{placeholder:p}=u,k=d.useRef(a),{t:b}=d.useContext(Y),I=s=>{s.key==="Enter"&&c(k.current,"confirm")},f=s=>{k.current=s,c(s)};return r?n.jsx(G,{style:{flex:1},fullWidth:!0,value:a,onChange:s=>{s.persist(),f(s.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:o||p,onKeyDown:I,...m}):n.jsx(g,{px:1,className:"form-item-input slot",children:a||n.jsx("span",{className:"placeholder",children:b("common.requiredInputPlaceholder",{name:o||p})})})}_.propTypes=N;_.defaultProps={componentProps:{}};function T({editing:r,value:o,onChange:a,componentProps:c,...u}){const{blocklet:m}=c,p=o==="auto"?Q.getPassportColorFromDid(m.appDid):o;return n.jsxs(g,{display:"flex",alignItems:"center",children:[n.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:te({title:"Owner",issuer:ne.getDisplayName(m),issuerDid:m.appDid,ownerName:"Your Name",ownerDid:m.appDid,preferredColor:o||"auto"})}}),n.jsx(S,{...u,editing:r,value:r?p:o,onChange:a,componentProps:c})]})}T.propTypes={...N,componentProps:l.shape({blocklet:l.object.isRequired}).isRequired};T.defaultProps={};const ie=J`
|
|
2
2
|
0%, 100% {
|
|
3
3
|
transform: scale(1) translateX(0);
|
|
4
4
|
}
|