@abtnode/blocklet-services 1.16.41-beta-20250319-034744-5c62f533 → 1.16.41-beta-20250319-131732-1224cca5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/api/libs/email.js +78 -58
  2. package/api/libs/open-graph/template.js +2 -3
  3. package/api/services/kyc/index.js +1 -0
  4. package/api/socket/channel/did.js +2 -1
  5. package/dist/assets/{access-control-DyHt8ppX.js → access-control-DM5bKXj8.js} +1 -1
  6. package/dist/assets/{add-component-core-DOdhiJes.js → add-component-core-BGLFE6FF.js} +1 -1
  7. package/dist/assets/{add-resource-CGPM0kPR.js → add-resource-CTONcgV6.js} +1 -1
  8. package/dist/assets/{analytics-BRjS4mY-.js → analytics-jwKnm2P5.js} +1 -1
  9. package/dist/assets/{audit-logs-D1W37Cj4.js → audit-logs-BSAndjyr.js} +1 -1
  10. package/dist/assets/{branding-DR3Jnq-d.js → branding-Ds6v3n-A.js} +2 -2
  11. package/dist/assets/{bundle-avatar-Eqwd2qUG.js → bundle-avatar-C4EBeG0M.js} +1 -1
  12. package/dist/assets/{complete-BzSPyjUA.js → complete-B5CCv5xy.js} +1 -1
  13. package/dist/assets/{component--_f-xKi7.js → component-B2RHEZO0.js} +1 -1
  14. package/dist/assets/{config-BDpdqYom.js → config-CkTkraLZ.js} +1 -1
  15. package/dist/assets/{config-navigation-BrXS6Zm4.js → config-navigation-Cy2R-qEJ.js} +3 -3
  16. package/dist/assets/{config-space-BZu4nd7t.js → config-space-BjgJ--W4.js} +1 -1
  17. package/dist/assets/{confirm-CCmbVvGp.js → confirm-BaiaCWsM.js} +1 -1
  18. package/dist/assets/{connect-Bgm2clKz.js → connect-RNS66o1f.js} +1 -1
  19. package/dist/assets/{connect-C1EdscR7.js → connect-mVRf-ABx.js} +1 -1
  20. package/dist/assets/{connect-to-CAjdR1Vi.js → connect-to-CChFecmc.js} +1 -1
  21. package/dist/assets/{dashboard-C2dbiNOp.js → dashboard-BUwFD31P.js} +3 -3
  22. package/dist/assets/{delete-confirm-CVo1ye7X.js → delete-confirm-Bh6Ch3bf.js} +1 -1
  23. package/dist/assets/{domain-BQkRhwGe.js → domain-D2juCz3R.js} +1 -1
  24. package/dist/assets/{domain-action-card-Dlgq4rsm.js → domain-action-card-C_--u5r9.js} +1 -1
  25. package/dist/assets/{domains-DaOwHgX-.js → domains-vqaJZbX-.js} +1 -1
  26. package/dist/assets/{email-BHF0jLjs.js → email-DKMhmT65.js} +1 -1
  27. package/dist/assets/{exchange-passport-C6TpmUyM.js → exchange-passport-BMfAdTZi.js} +1 -1
  28. package/dist/assets/{form-text-input-C8x5debf.js → form-text-input-BKnTJYUO.js} +1 -1
  29. package/dist/assets/{fuel-DQMzXBHQ.js → fuel-DGFl2kVF.js} +1 -1
  30. package/dist/assets/{index-D8WxMgot.js → index-B4PgdoaR.js} +3 -3
  31. package/dist/assets/{index-BVjGveR4.js → index-BlGUkC5j.js} +1 -1
  32. package/dist/assets/{index-CYdNDqQ1.js → index-C8sg0Ts_.js} +3 -3
  33. package/dist/assets/{index-Bv_udrJr.js → index-CHzM6Ehl.js} +1 -1
  34. package/dist/assets/{index-DojJOk-8.js → index-Co79YnZI.js} +1 -1
  35. package/dist/assets/{index-D2qwAqco.js → index-D-RS3D7s.js} +1 -1
  36. package/dist/assets/{index-CmyG8bip.js → index-DF1FIm9G.js} +1 -1
  37. package/dist/assets/{index-BsMTGy4m.js → index-DMqGxTc4.js} +1 -1
  38. package/dist/assets/{index-KP4WZslk.js → index-DRzvuBvI.js} +1 -1
  39. package/dist/assets/{index-Dv43WFu_.js → index-DneJ5oOQ.js} +4 -4
  40. package/dist/assets/{index-Db8S8FOW.js → index-DsfwDSo4.js} +1 -1
  41. package/dist/assets/{index-BL64rJ3g.js → index-DxtGslY8.js} +1 -1
  42. package/dist/assets/{index-Dal_0cM6.js → index-okPJPuPc.js} +1 -1
  43. package/dist/assets/{index-DJJGXGi6.js → index-wWAZioAD.js} +1 -1
  44. package/dist/assets/{invitation-CDtK_Uyv.js → invitation-3fNTl35Q.js} +1 -1
  45. package/dist/assets/{invite-DSQnWK9o.js → invite-vSXLKXaC.js} +1 -1
  46. package/dist/assets/{issue-passport-Bb_7kKPQ.js → issue-passport-iTVcPmbK.js} +1 -1
  47. package/dist/assets/{item-C1U0HVPR.js → item-BKw13HQ1.js} +1 -1
  48. package/dist/assets/{layout-Bkn9nC3f.js → layout-MdeSR5MO.js} +1 -1
  49. package/dist/assets/{list-BIXoIHH2.js → list-BYBgvMRq.js} +1 -1
  50. package/dist/assets/{log-CuiY798z.js → log-Djo2s0oZ.js} +1 -1
  51. package/dist/assets/{login-Ds2aHi-M.js → login-BqLbwYZb.js} +1 -1
  52. package/dist/assets/{logo-uploader-DQCS5qZW.js → logo-uploader-DtUHte5C.js} +2 -2
  53. package/dist/assets/{lost-passport-DdbK0_Yc.js → lost-passport-C_dlQRA5.js} +1 -1
  54. package/dist/assets/open-window-yeboX1Ru.js +1 -1
  55. package/dist/assets/{overview-DFNGZZos.js → overview-Ct6FaHVl.js} +1 -1
  56. package/dist/assets/{publish-resource-CPSJ7Gd2.js → publish-resource-wn5vCulN.js} +1 -1
  57. package/dist/assets/{relative-time-xM8Zc84I.js → relative-time-CYqHHkvJ.js} +1 -1
  58. package/dist/assets/{setup-CkUck5w6.js → setup-BDulmyU9.js} +3 -3
  59. package/dist/assets/{start-CRCAeTDI.js → start-CUVz5ZKQ.js} +1 -1
  60. package/dist/assets/{status-D8ugfvVU.js → status-i0njxvUg.js} +1 -1
  61. package/dist/assets/{step-actions-C83ykph7.js → step-actions-Zukntbkg.js} +1 -1
  62. package/dist/assets/{traffic-DjeUj5sV.js → traffic-DBvn8sNu.js} +1 -1
  63. package/dist/assets/{transfer-B_MO7Mf7.js → transfer-DLvipuQf.js} +1 -1
  64. package/dist/assets/{unsubscribe-ajBobtwD.js → unsubscribe-Nax9Uwlj.js} +1 -1
  65. package/dist/assets/{user-center-D62gRjAl.js → user-center-dlERaSQ2.js} +1 -1
  66. package/dist/assets/{util-CohOBosL.js → util-DHw5muRJ.js} +1 -1
  67. package/dist/assets/{wrap-locale-lZatlhee.js → wrap-locale-gZlt-kQa.js} +1 -1
  68. package/dist/index.html +1 -1
  69. package/dist/service-worker.js +1 -1
  70. package/package.json +21 -21
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D8WxMgot.js","assets/vendor-ux-did-connect-D75Zatzm.js","assets/vendor-react-DoD83n6N.js","assets/vendor-utils-CbeKtci8.js","assets/vendor-mui-core-O22FPGM4.js","assets/vendor-hooks-CYyfK9g3.js","assets/lottie-web-B6s7dDoL.js","assets/vendor-ux-did-connect-DhgPdlEj.css","assets/vendor-arcblock-E5QJEgSK.js","assets/index-DQKEK30u.js","assets/index-CYdNDqQ1.js","assets/index-tUQxVYYQ.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
- import{r as x,k as gt,l as tt,L as xe,u as js,h as ks,i as ct}from"./vendor-react-DoD83n6N.js";import{a1 as ke,j as e,t as Le,a3 as c,bg as vo,E as r,a4 as me,I as ce,T as N,bV as Co,D as ot,a9 as ge,as as ys,bO as Je,ac as wo,bn as Xe,bq as ht,x as se,a2 as Ye,P as So,G as Io,v as jt,$ as Do,am as To,ai as fe,ak as Rs,ab as _o,r as Po,bK as vs,K as Me,y as qo,M as oe,ad as Se,at as Cs,L as ws,z as Ss,b2 as Is,ar as $o,aq as Qe,bv as Ds,bw as Ts,bW as _s,bX as Ps,bi as ft,bj as qs,bl as $s,bz as Ls,bA as at}from"./vendor-mui-core-O22FPGM4.js";import{z as ye,C as ze,h as ue,a5 as Ns,f as lo,ad as ro}from"./index-CYdNDqQ1.js";import{r as Re,p as G,u as te,aj as As,B as Ve,a$ as Lo,R as No,aZ as Ao,am as zs,bk as Bs,a2 as kt,V,_ as Es,i as ae,bl as Ws,b4 as Os,ai as $e,ak as yt,aq as Vs}from"./vendor-ux-did-connect-D75Zatzm.js";import{h as Rt,n as Ms,q as Us,_ as zo,r as De,p as Fs}from"./vendor-arcblock-E5QJEgSK.js";import{d as Hs}from"./Error-wKO1hXtU.js";import{C as vt}from"./confirm-CCmbVvGp.js";import{u as Ue}from"./session-CD9NaM-v.js";import{W as io}from"./did-address-DIKoCoBp.js";import{E as Fe,D as co,C as ao,P as uo}from"./react-beautiful-dnd.esm-DcDZ_Ghe.js";import{B as Ct}from"./bundle-avatar-Eqwd2qUG.js";import{S as je}from"./shorten-label-DXrhdUJE.js";import{L as wt}from"./list-header-Bzt7zKtS.js";import{X as Gs,x as be,G as St,C as Bo}from"./vendor-utils-CbeKtci8.js";import{d as Js}from"./Download-DANYdeZR.js";import{C as Eo}from"./click-to-copy-Dc16fHKA.js";import{Q as Xs}from"./QuestionMarkCircle-D4HZAY1P.js";import{u as Ys}from"./vendor-hooks-CYyfK9g3.js";import{_ as Ie}from"./useSetState-BL3ktMon.js";import{c as It}from"./index-tUQxVYYQ.js";import{E as Dt}from"./index-C46rA4HG.js";import{p as Ze}from"./index-DojJOk-8.js";import"./api-CvDkueg1.js";import{d as Qs}from"./ChevronRight-Bpkf9aqI.js";import{T as Zs,a as Ks}from"./vendor-mui-x-K-9WHqhO.js";import{d as po}from"./DeleteOutline-D4DYIaUj.js";import{c as en,A as Wo,u as tn,S as on,U as sn,a as dt,b as Oo,n as nn,e as ln,f as ho,g as rn,h as cn}from"./item-C1U0HVPR.js";import{d as an}from"./ArrowDropDown-ydRfHJ2x.js";import{f as Ne}from"./format-error-LAoTjvJe.js";import{d as dn}from"./Launch-XvyEoGhF.js";import{M as un}from"./index-oXEi5lCg.js";import{r as pn}from"./index-Aq7Gmh7c.js";import{d as hn}from"./Done-B8c93MpP.js";import"./lottie-web-B6s7dDoL.js";import"./raf-schd.esm-GV-XhwE0.js";import"./delete-confirm-CVo1ye7X.js";import"./get-safe-url-BvS0hy8W.js";var Tt={},fn=ke;Object.defineProperty(Tt,"__esModule",{value:!0});var Vo=Tt.default=void 0,bn=fn(Re()),xn=e;Vo=Tt.default=(0,bn.default)((0,xn.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 _t={},mn=ke;Object.defineProperty(_t,"__esModule",{value:!0});var Mo=_t.default=void 0,gn=mn(Re()),jn=e;Mo=_t.default=(0,gn.default)((0,jn.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 Pt={},kn=ke;Object.defineProperty(Pt,"__esModule",{value:!0});var Uo=Pt.default=void 0,yn=kn(Re()),Rn=e;Uo=Pt.default=(0,yn.default)((0,Rn.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 qt({did:t,projectId:o,title:s,logo:i,describe:l}){const n=`${`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${i}`,[u,a]=x.useState(!1),h=Le(m=>m.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx(vo,{sx:{borderRadius:1},src:n}),e.jsxs(c,{children:[e.jsx(je,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:h?"primary.main":""},children:s||"/"}),e.jsx(je,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:h||u?"primary.main":"grey.700"},children:l||"/"})]})]})}qt.propTypes={projectId:r.string.isRequired,did:r.string.isRequired,title:r.string.isRequired,logo:r.string.isRequired,describe:r.string.isRequired};function $t({initUrl:t}){const o=gt(),s=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:i,locale:l}=te(),{api:d}=ye(),{api:n}=Ue(),[u,a]=x.useState(!0),{blocklet:h}=ze(),[m,S]=x.useState(null),[y,p]=x.useState(!1),f=Le(g=>g.breakpoints.down("xl")),R=Le(g=>g.breakpoints.down("md")),{componentDid:I=""}=tt(),[j,D]=x.useState(null),[k,T]=x.useState(""),L=()=>{d.getProjects({input:{did:h.meta.did,componentDid:I,tenantScope:s}}).then(g=>{const _=(g==null?void 0:g.projects)||[];a(!1),D(_)}).catch(g=>{a(!1),V.error(g.message)})},z=()=>{o(`${G.UNOWNED_DID}/create/none`,{replace:!0})},B=g=>{S(g)},v=()=>{a(!1),p(!0)},C=()=>{p(!1),S(null)},H=g=>{V.error(g.message),p(!1),S(null)},W=g=>{if(!(g!=null&&g.deleted)){V.error("Delete project failed");return}L(),p(!1),S(null)};x.useEffect(()=>{L()},[]);const b=x.useMemo(()=>{if(!k)return j;let g=k==null?void 0:k.trim();return g?(g=As.toAddress(g).toLocaleLowerCase(),j.filter(_=>_.blockletTitle.toLowerCase().includes(g)||_.blockletDid.toLowerCase().includes(g))):j},[j,k]);if(!j&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!j)return null;if(!j.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:i("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:i("blocklet.publish.createBlockletTip")}),e.jsx(Ve,{onClick:z,variant:"contained",children:i("blocklet.publish.createBlocklet")})]});const w=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:g=>{const _=j[g];return e.jsx(xe,{to:`${_.id}`,children:e.jsx(qt,{did:h.meta.did,projectId:_.id,logo:_.blockletLogo,title:_.blockletTitle,describe:_.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:g=>g?e.jsx(Lo,{type:"success",children:g}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:g=>g?e.jsx(io,{size:14,compact:!0,responsive:!1,did:g}):null}},f||I?null:{label:i("common.createdBy"),name:"createdBy",options:{customBodyRender:g=>g?e.jsx(io,{onClick:()=>{o(`/.well-known/service/admin/members?did=${g}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:g}):null}},f||I?null:{label:i("common.scope"),name:"componentDid",options:{customBodyRender:g=>{const _=(h.children||[]).find(J=>J.meta.did===g);return _?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Ct,{size:14,blocklet:_,ancestors:[h]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:_.meta.title})]},g):""}}},f||s?null:{label:i("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:g=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(je,{children:g})})}},{label:i("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:g=>e.jsx(No,{value:Number(g),locale:l})}},{label:i("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:g=>{const _=j[g];return e.jsxs(c,{display:"flex",children:[e.jsx(xe,{to:`${_.id}/new-release/${_.lastReleaseId}`,children:e.jsx(me,{title:i("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(Vo,{style:{fontSize:18}})})})}),!!_.lastReleaseId&&e.jsx(me,{title:i("blocklet.publish.viewLastRelease",{name:_.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(xe,{style:{display:"flex"},to:`${_.id}/view/${_.lastReleaseId}`,children:e.jsx(Mo,{sx:{fontSize:18}})})})}),e.jsx(me,{title:i("blocklet.publish.delete",{name:_.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>B(_),children:e.jsx(Ao,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),q=y?e.jsx(zs,{open:!0,popup:!0,onClose:C,action:"check-has-project-id",locale:l,checkFn:n.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:W,onError:H,extraParams:{projectId:m.id,did:h.meta.did,name:m.blockletTitle},messages:{title:i("blocklet.publish.deleteProject.title",{name:m.blockletTitle}),scan:i("blocklet.publish.deleteProject.scan",{name:m.blockletTitle}),confirm:i("blocklet.publish.deleteProject.confirm"),success:i("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(c,{children:[e.jsx(wt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:i("common.blockletStudio")}),e.jsx(me,{title:i("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(Uo,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(Bs,{options:{searchPlaceholder:i("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:R},search:k,searchText:k,searchTextUpdate:T,searchClose:()=>T(""),onSearchOpen:()=>{}}),e.jsxs(Ve,{onClick:z,variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),i("blocklet.publish.createBlocklet")]})]})}),e.jsx(kt,{className:"main-table",locale:l,data:b,columns:w,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]}}),m&&e.jsx(vt,{title:`${i("common.delete")} ${m.blockletTitle}`,description:i("blocklet.publish.deleteProject.description"),confirm:i("common.confirm"),onConfirm:v,onCancel:()=>S(null),children:e.jsx(c,{sx:{marginTop:2},children:[i("blocklet.publish.deleteProject.tip1"),i("blocklet.publish.deleteProject.tip2"),i("blocklet.publish.deleteProject.tip3")].map(g=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Hs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(N,{component:"span",variant:"inherit",color:"text.secondary",children:g})]}))})}),q]})}$t.propTypes={initUrl:r.object};$t.defaultProps={initUrl:null};var Lt={},vn=ke;Object.defineProperty(Lt,"__esModule",{value:!0});var Fo=Lt.default=void 0,Cn=vn(Re()),fo=e;Fo=Lt.default=(0,Cn.default)([(0,fo.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,fo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const wn=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},Ho=wn;function Sn(){var B;const{t,locale:o}=te(),{projectId:s}=tt(),{api:i}=ye(),[l,d]=x.useState(!0),{blocklet:n}=ze(),u=Le(v=>v.breakpoints.down("md")),[a,h]=x.useState(null),[m,S]=x.useState(null),[y,p]=x.useState(null),f=(B=window.env)==null?void 0:B.serverEndpoint,R=()=>{i.getReleases({input:{did:n.meta.did,projectId:s}}).then(v=>{const C=(v==null?void 0:v.releases)||[];d(!1),h(C)}).catch(v=>{d(!1),V.error(v.message)})},I=()=>{i.doBatchQuery({getProject:{input:{did:n.meta.did,projectId:s}},getReleases:{input:{did:n.meta.did,projectId:s}}}).then(v=>{S(v.getProject.project||{}),h(v.getReleases.releases||[]),d(!1)}).catch(v=>{d(!1),V.error(v.message)})};x.useEffect(()=>{I()},[]);const[j,D]=x.useState(""),k=()=>{d(!1);const v=y.id;i.deleteRelease({input:{did:n.meta.did,projectId:s,releaseId:v}}).then(()=>{d(!1),R(),V.success(t("common.removeSuccess")),p(null)}).catch(C=>{d(!1),V.error(C.message)})},T=v=>{p(v)};if(!a&&l)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!a)return null;const L=e.jsxs(Co,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(xe,{to:"..",children:t("common.blockletStudio")}),e.jsx(N,{color:"text.primary",children:e.jsx(je,{maxLength:u?6:30,children:m.blockletTitle})})]});if(!a.length)return e.jsxs(e.Fragment,{children:[L,e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),e.jsx(xe,{to:"create/none",children:e.jsx(Ve,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const z=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:v=>{const C=a[v];return e.jsx(xe,{to:`view/${C.id}`,children:e.jsx(qt,{did:n.meta.did,projectId:m.id,logo:C.blockletLogo,title:C.blockletVersion,describe:C.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:v=>{const C=a[v];return e.jsx(N,{className:"note",children:Ho(C.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:v=>e.jsx(Lo,{type:v==="published"?"success":"warning",children:v==="published"?"Released":Gs(v)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:v=>{const C=a[v];return C.status!==ue.PROJECT.RELEASE_STATUS.published?"":e.jsx(No,{value:Number(C.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:v=>{var q;const C=a[v];let H="",W="";const b=C.status==="published";if(b){const g=be(f,`/api/project/${n.meta.did}/${m.id}/${m.lastReleaseId}/release/blocklet.json`),_=new URL(f);_.pathname=be(_.pathname,"/launch-blocklet/agreement"),_.searchParams.set("blocklet_meta_url",g),H=_.href,W=be(`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${n.meta.did}/${m.id}/${m.lastReleaseId}/download/${(m.lastReleaseFiles||[])[0]}`)}const w=(q=m.blockletComponents)!=null&&q.some(g=>g.included)||C.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[b&&w==="pack"&&e.jsx(me,{title:t("blocklet.publish.install",{name:m.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:H,target:"_blank",rel:"noreferrer",children:e.jsx(Fo,{sx:{fontSize:18}})})})}),b&&e.jsx(me,{title:t("blocklet.publish.download",{name:m.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:W,children:e.jsx(Js,{sx:{fontSize:18}})})})}),e.jsx(me,{title:t("blocklet.publish.delete",{name:m.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>T(C),children:e.jsx(Ao,{sx:{fontSize:18}})})})]})}}}];return e.jsxs(In,{children:[e.jsx(wt,{sx:{mb:2},left:L,actions:e.jsxs(e.Fragment,{children:[e.jsx(Ve,{variant:"outlined",onClick:()=>{const v=be(f,`/api/project/${n.meta.did}/${s}/blocklet.json`);D(v)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(xe,{to:"new-release/none",children:e.jsxs(Ve,{variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(ot,{fullWidth:!0,maxWidth:"sm",open:j,onClose:()=>D(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(N,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(Eo,{children:j}),e.jsxs(N,{sx:{mt:2},children:[t("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:t("blocklet.publish.installResourceHelp")})]})]})}),e.jsx(kt,{className:"main-table",verticalKeyWidth:100,locale:o,data:a,columns:z,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),y&&e.jsx(vt,{title:t(`${t("common.delete")} ${y.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:k,onCancel:()=>p(null)})]})}const In=ge(c)`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B4PgdoaR.js","assets/vendor-ux-did-connect-D75Zatzm.js","assets/vendor-react-DoD83n6N.js","assets/vendor-utils-CbeKtci8.js","assets/vendor-mui-core-O22FPGM4.js","assets/vendor-hooks-CYyfK9g3.js","assets/lottie-web-B6s7dDoL.js","assets/vendor-ux-did-connect-DhgPdlEj.css","assets/vendor-arcblock-E5QJEgSK.js","assets/index-DQKEK30u.js","assets/index-C8sg0Ts_.js","assets/index-tUQxVYYQ.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
+ import{r as x,k as gt,l as tt,L as xe,u as js,h as ks,i as ct}from"./vendor-react-DoD83n6N.js";import{a1 as ke,j as e,t as Le,a3 as c,bg as vo,E as r,a4 as me,I as ce,T as N,bV as Co,D as ot,a9 as ge,as as ys,bO as Je,ac as wo,bn as Xe,bq as ht,x as se,a2 as Ye,P as So,G as Io,v as jt,$ as Do,am as To,ai as fe,ak as Rs,ab as _o,r as Po,bK as vs,K as Me,y as qo,M as oe,ad as Se,at as Cs,L as ws,z as Ss,b2 as Is,ar as $o,aq as Qe,bv as Ds,bw as Ts,bW as _s,bX as Ps,bi as ft,bj as qs,bl as $s,bz as Ls,bA as at}from"./vendor-mui-core-O22FPGM4.js";import{z as ye,C as ze,h as ue,a5 as Ns,f as lo,ad as ro}from"./index-C8sg0Ts_.js";import{r as Re,p as G,u as te,aj as As,B as Ve,a$ as Lo,R as No,aZ as Ao,am as zs,bk as Bs,a2 as kt,V,_ as Es,i as ae,bl as Ws,b4 as Os,ai as $e,ak as yt,aq as Vs}from"./vendor-ux-did-connect-D75Zatzm.js";import{h as Rt,n as Ms,q as Us,_ as zo,r as De,p as Fs}from"./vendor-arcblock-E5QJEgSK.js";import{d as Hs}from"./Error-wKO1hXtU.js";import{C as vt}from"./confirm-BaiaCWsM.js";import{u as Ue}from"./session-CD9NaM-v.js";import{W as io}from"./did-address-DIKoCoBp.js";import{E as Fe,D as co,C as ao,P as uo}from"./react-beautiful-dnd.esm-DcDZ_Ghe.js";import{B as Ct}from"./bundle-avatar-C4EBeG0M.js";import{S as je}from"./shorten-label-DXrhdUJE.js";import{L as wt}from"./list-header-Bzt7zKtS.js";import{X as Gs,x as be,G as St,C as Bo}from"./vendor-utils-CbeKtci8.js";import{d as Js}from"./Download-DANYdeZR.js";import{C as Eo}from"./click-to-copy-Dc16fHKA.js";import{Q as Xs}from"./QuestionMarkCircle-D4HZAY1P.js";import{u as Ys}from"./vendor-hooks-CYyfK9g3.js";import{_ as Ie}from"./useSetState-BL3ktMon.js";import{c as It}from"./index-tUQxVYYQ.js";import{E as Dt}from"./index-C46rA4HG.js";import{p as Ze}from"./index-Co79YnZI.js";import"./api-CvDkueg1.js";import{d as Qs}from"./ChevronRight-Bpkf9aqI.js";import{T as Zs,a as Ks}from"./vendor-mui-x-K-9WHqhO.js";import{d as po}from"./DeleteOutline-D4DYIaUj.js";import{c as en,A as Wo,u as tn,S as on,U as sn,a as dt,b as Oo,n as nn,e as ln,f as ho,g as rn,h as cn}from"./item-BKw13HQ1.js";import{d as an}from"./ArrowDropDown-ydRfHJ2x.js";import{f as Ne}from"./format-error-LAoTjvJe.js";import{d as dn}from"./Launch-XvyEoGhF.js";import{M as un}from"./index-oXEi5lCg.js";import{r as pn}from"./index-Aq7Gmh7c.js";import{d as hn}from"./Done-B8c93MpP.js";import"./lottie-web-B6s7dDoL.js";import"./raf-schd.esm-GV-XhwE0.js";import"./delete-confirm-Bh6Ch3bf.js";import"./get-safe-url-CXJBjnNj.js";var Tt={},fn=ke;Object.defineProperty(Tt,"__esModule",{value:!0});var Vo=Tt.default=void 0,bn=fn(Re()),xn=e;Vo=Tt.default=(0,bn.default)((0,xn.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 _t={},mn=ke;Object.defineProperty(_t,"__esModule",{value:!0});var Mo=_t.default=void 0,gn=mn(Re()),jn=e;Mo=_t.default=(0,gn.default)((0,jn.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 Pt={},kn=ke;Object.defineProperty(Pt,"__esModule",{value:!0});var Uo=Pt.default=void 0,yn=kn(Re()),Rn=e;Uo=Pt.default=(0,yn.default)((0,Rn.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 qt({did:t,projectId:o,title:s,logo:i,describe:l}){const n=`${`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${i}`,[u,a]=x.useState(!1),h=Le(m=>m.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx(vo,{sx:{borderRadius:1},src:n}),e.jsxs(c,{children:[e.jsx(je,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:h?"primary.main":""},children:s||"/"}),e.jsx(je,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:h||u?"primary.main":"grey.700"},children:l||"/"})]})]})}qt.propTypes={projectId:r.string.isRequired,did:r.string.isRequired,title:r.string.isRequired,logo:r.string.isRequired,describe:r.string.isRequired};function $t({initUrl:t}){const o=gt(),s=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:i,locale:l}=te(),{api:d}=ye(),{api:n}=Ue(),[u,a]=x.useState(!0),{blocklet:h}=ze(),[m,S]=x.useState(null),[y,p]=x.useState(!1),f=Le(g=>g.breakpoints.down("xl")),R=Le(g=>g.breakpoints.down("md")),{componentDid:I=""}=tt(),[j,D]=x.useState(null),[k,T]=x.useState(""),L=()=>{d.getProjects({input:{did:h.meta.did,componentDid:I,tenantScope:s}}).then(g=>{const _=(g==null?void 0:g.projects)||[];a(!1),D(_)}).catch(g=>{a(!1),V.error(g.message)})},z=()=>{o(`${G.UNOWNED_DID}/create/none`,{replace:!0})},B=g=>{S(g)},v=()=>{a(!1),p(!0)},C=()=>{p(!1),S(null)},H=g=>{V.error(g.message),p(!1),S(null)},W=g=>{if(!(g!=null&&g.deleted)){V.error("Delete project failed");return}L(),p(!1),S(null)};x.useEffect(()=>{L()},[]);const b=x.useMemo(()=>{if(!k)return j;let g=k==null?void 0:k.trim();return g?(g=As.toAddress(g).toLocaleLowerCase(),j.filter(_=>_.blockletTitle.toLowerCase().includes(g)||_.blockletDid.toLowerCase().includes(g))):j},[j,k]);if(!j&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!j)return null;if(!j.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:i("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:i("blocklet.publish.createBlockletTip")}),e.jsx(Ve,{onClick:z,variant:"contained",children:i("blocklet.publish.createBlocklet")})]});const w=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:g=>{const _=j[g];return e.jsx(xe,{to:`${_.id}`,children:e.jsx(qt,{did:h.meta.did,projectId:_.id,logo:_.blockletLogo,title:_.blockletTitle,describe:_.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:g=>g?e.jsx(Lo,{type:"success",children:g}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:g=>g?e.jsx(io,{size:14,compact:!0,responsive:!1,did:g}):null}},f||I?null:{label:i("common.createdBy"),name:"createdBy",options:{customBodyRender:g=>g?e.jsx(io,{onClick:()=>{o(`/.well-known/service/admin/members?did=${g}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:g}):null}},f||I?null:{label:i("common.scope"),name:"componentDid",options:{customBodyRender:g=>{const _=(h.children||[]).find(J=>J.meta.did===g);return _?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Ct,{size:14,blocklet:_,ancestors:[h]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:_.meta.title})]},g):""}}},f||s?null:{label:i("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:g=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(je,{children:g})})}},{label:i("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:g=>e.jsx(No,{value:Number(g),locale:l})}},{label:i("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:g=>{const _=j[g];return e.jsxs(c,{display:"flex",children:[e.jsx(xe,{to:`${_.id}/new-release/${_.lastReleaseId}`,children:e.jsx(me,{title:i("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(Vo,{style:{fontSize:18}})})})}),!!_.lastReleaseId&&e.jsx(me,{title:i("blocklet.publish.viewLastRelease",{name:_.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(xe,{style:{display:"flex"},to:`${_.id}/view/${_.lastReleaseId}`,children:e.jsx(Mo,{sx:{fontSize:18}})})})}),e.jsx(me,{title:i("blocklet.publish.delete",{name:_.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>B(_),children:e.jsx(Ao,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),q=y?e.jsx(zs,{open:!0,popup:!0,onClose:C,action:"check-has-project-id",locale:l,checkFn:n.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:W,onError:H,extraParams:{projectId:m.id,did:h.meta.did,name:m.blockletTitle},messages:{title:i("blocklet.publish.deleteProject.title",{name:m.blockletTitle}),scan:i("blocklet.publish.deleteProject.scan",{name:m.blockletTitle}),confirm:i("blocklet.publish.deleteProject.confirm"),success:i("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(c,{children:[e.jsx(wt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:i("common.blockletStudio")}),e.jsx(me,{title:i("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(Uo,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(Bs,{options:{searchPlaceholder:i("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:R},search:k,searchText:k,searchTextUpdate:T,searchClose:()=>T(""),onSearchOpen:()=>{}}),e.jsxs(Ve,{onClick:z,variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),i("blocklet.publish.createBlocklet")]})]})}),e.jsx(kt,{className:"main-table",locale:l,data:b,columns:w,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]}}),m&&e.jsx(vt,{title:`${i("common.delete")} ${m.blockletTitle}`,description:i("blocklet.publish.deleteProject.description"),confirm:i("common.confirm"),onConfirm:v,onCancel:()=>S(null),children:e.jsx(c,{sx:{marginTop:2},children:[i("blocklet.publish.deleteProject.tip1"),i("blocklet.publish.deleteProject.tip2"),i("blocklet.publish.deleteProject.tip3")].map(g=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(Hs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(N,{component:"span",variant:"inherit",color:"text.secondary",children:g})]}))})}),q]})}$t.propTypes={initUrl:r.object};$t.defaultProps={initUrl:null};var Lt={},vn=ke;Object.defineProperty(Lt,"__esModule",{value:!0});var Fo=Lt.default=void 0,Cn=vn(Re()),fo=e;Fo=Lt.default=(0,Cn.default)([(0,fo.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,fo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const wn=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},Ho=wn;function Sn(){var B;const{t,locale:o}=te(),{projectId:s}=tt(),{api:i}=ye(),[l,d]=x.useState(!0),{blocklet:n}=ze(),u=Le(v=>v.breakpoints.down("md")),[a,h]=x.useState(null),[m,S]=x.useState(null),[y,p]=x.useState(null),f=(B=window.env)==null?void 0:B.serverEndpoint,R=()=>{i.getReleases({input:{did:n.meta.did,projectId:s}}).then(v=>{const C=(v==null?void 0:v.releases)||[];d(!1),h(C)}).catch(v=>{d(!1),V.error(v.message)})},I=()=>{i.doBatchQuery({getProject:{input:{did:n.meta.did,projectId:s}},getReleases:{input:{did:n.meta.did,projectId:s}}}).then(v=>{S(v.getProject.project||{}),h(v.getReleases.releases||[]),d(!1)}).catch(v=>{d(!1),V.error(v.message)})};x.useEffect(()=>{I()},[]);const[j,D]=x.useState(""),k=()=>{d(!1);const v=y.id;i.deleteRelease({input:{did:n.meta.did,projectId:s,releaseId:v}}).then(()=>{d(!1),R(),V.success(t("common.removeSuccess")),p(null)}).catch(C=>{d(!1),V.error(C.message)})},T=v=>{p(v)};if(!a&&l)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Fe,{})});if(!a)return null;const L=e.jsxs(Co,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(xe,{to:"..",children:t("common.blockletStudio")}),e.jsx(N,{color:"text.primary",children:e.jsx(je,{maxLength:u?6:30,children:m.blockletTitle})})]});if(!a.length)return e.jsxs(e.Fragment,{children:[L,e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),e.jsx(xe,{to:"create/none",children:e.jsx(Ve,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const z=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:v=>{const C=a[v];return e.jsx(xe,{to:`view/${C.id}`,children:e.jsx(qt,{did:n.meta.did,projectId:m.id,logo:C.blockletLogo,title:C.blockletVersion,describe:C.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:v=>{const C=a[v];return e.jsx(N,{className:"note",children:Ho(C.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:v=>e.jsx(Lo,{type:v==="published"?"success":"warning",children:v==="published"?"Released":Gs(v)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:v=>{const C=a[v];return C.status!==ue.PROJECT.RELEASE_STATUS.published?"":e.jsx(No,{value:Number(C.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:v=>{var q;const C=a[v];let H="",W="";const b=C.status==="published";if(b){const g=be(f,`/api/project/${n.meta.did}/${m.id}/${m.lastReleaseId}/release/blocklet.json`),_=new URL(f);_.pathname=be(_.pathname,"/launch-blocklet/agreement"),_.searchParams.set("blocklet_meta_url",g),H=_.href,W=be(`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${n.meta.did}/${m.id}/${m.lastReleaseId}/download/${(m.lastReleaseFiles||[])[0]}`)}const w=(q=m.blockletComponents)!=null&&q.some(g=>g.included)||C.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[b&&w==="pack"&&e.jsx(me,{title:t("blocklet.publish.install",{name:m.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:H,target:"_blank",rel:"noreferrer",children:e.jsx(Fo,{sx:{fontSize:18}})})})}),b&&e.jsx(me,{title:t("blocklet.publish.download",{name:m.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:W,children:e.jsx(Js,{sx:{fontSize:18}})})})}),e.jsx(me,{title:t("blocklet.publish.delete",{name:m.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>T(C),children:e.jsx(Ao,{sx:{fontSize:18}})})})]})}}}];return e.jsxs(In,{children:[e.jsx(wt,{sx:{mb:2},left:L,actions:e.jsxs(e.Fragment,{children:[e.jsx(Ve,{variant:"outlined",onClick:()=>{const v=be(f,`/api/project/${n.meta.did}/${s}/blocklet.json`);D(v)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(xe,{to:"new-release/none",children:e.jsxs(Ve,{variant:"contained",children:[e.jsx(Rt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(ot,{fullWidth:!0,maxWidth:"sm",open:j,onClose:()=>D(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(N,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(Eo,{children:j}),e.jsxs(N,{sx:{mt:2},children:[t("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:t("blocklet.publish.installResourceHelp")})]})]})}),e.jsx(kt,{className:"main-table",verticalKeyWidth:100,locale:o,data:a,columns:z,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),y&&e.jsx(vt,{title:t(`${t("common.delete")} ${y.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:k,onCancel:()=>p(null)})]})}const In=ge(c)`
3
3
  .main-table > div:first-child {
4
4
  display: none;
5
5
  }
@@ -121,7 +121,7 @@ import{r as x,k as gt,l as tt,L as xe,u as js,h as ks,i as ct}from"./vendor-reac
121
121
  background: #fff;
122
122
  z-index: 10;
123
123
  }
124
- `;var Vt={},En=ke;Object.defineProperty(Vt,"__esModule",{value:!0});var bt=Vt.default=void 0,Wn=En(Re()),On=e;bt=Vt.default=(0,Wn.default)((0,On.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 xo="lastWantToConnectStoreId";function Vn(t){var u,a;const[o,s]=x.useState(null),{session:i}=Ue(),l=x.useCallback(h=>{s(h),localStorage.setItem(xo,h==null?void 0:h.id)},[s]),d=x.useMemo(()=>{var y,p,f,R;const h=localStorage.getItem(xo),m=h?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(I=>I.id===h):null;if(m)return m;let S=(((p=t==null?void 0:t.settings)==null?void 0:p.storeList)||[]).find(I=>{var j;return!(I.id!==G.BLOCKLET_STORE.id||I.scope&&I.scope!=="studio"&&I.scope!==((j=i==null?void 0:i.user)==null?void 0:j.did))});return S||(S=(R=(f=t==null?void 0:t.settings)==null?void 0:f.storeList)==null?void 0:R[0]),S},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=i==null?void 0:i.user)==null?void 0:a.did]);return[o||d||{},l]}const pt={};async function Qo(t,{interval:o=1e3,maxDuration:s=120*1e3,intervalFirst:i=4e3,timerKey:l=""}){pt[l]&&clearTimeout(pt[l]),await new Promise(u=>setTimeout(u,i));const d=Date.now(),n=async(u,a)=>{try{const h=await t();u(h)}catch(h){Date.now()-d>s?a(h):l?pt[l]=setTimeout(()=>n(u,a),o):setTimeout(()=>n(u,a),o)}};return new Promise(n)}function Mn(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Un(t,{did:o,projectId:s,messageId:i}){return Qo(async()=>{var d;const l=await t.getProject({input:{did:o,projectId:s,messageId:i}});if(!((d=l==null?void 0:l.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return l.project.blockletDid},{timerKey:"connect-studio"})}function Fn(t,{did:o,projectId:s,storeId:i}){return Qo(async()=>{var n,u;const l=await t.getProject({input:{did:o,projectId:s,messageId:""}});if(!((u=(n=l==null?void 0:l.project)==null?void 0:n.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!l.project.connectedStores.find(a=>a.storeId===i))throw new Error("Connected store not found")},{timerKey:`connect-store-${i}`})}const Hn=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:i})=>{var n,u;const l=t?(n=s==null?void 0:s.meta)==null?void 0:n.did:o==null?void 0:o.did;let d=t?((u=s==null?void 0:s.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===i),{teamDid:l,storeList:d}},Mt=Hn;function Ut({blocklet:t,store:o={},onChangeStore:s,onClick:i,disabled:l,loading:d,componentDid:n}){var b,w,q;const{t:u}=te(),{session:a}=Ue(),{api:h,info:m,inService:S}=ye(),y=ze(),[p,f]=x.useState(!1),R=x.useRef(null),[I,j]=x.useState(!1),[D,k]=x.useState(null),T=g=>{s(g),f(!1)},L=()=>{f(!p)},z=g=>{R.current&&R.current.contains(g.target)||f(!1)},B=()=>{j(!0)},v=()=>{j(!1)},C=async()=>{var g;if(D)try{await h.deleteBlockletStore({input:{teamDid:t.meta.did,url:D.url,projectId:"",scope:D.scope||"studio"}}),await((g=y==null?void 0:y.actions)==null?void 0:g.refreshBlocklet())}catch(_){V.error(`Remove Blocklet Store Error: ${Ne(_)}`)}finally{k(null)}},{storeList:H}=Mt({fromBlocklet:S,blocklet:t,nodeInfo:m,componentDid:n,userDid:(b=a==null?void 0:a.user)==null?void 0:b.did}),W=(w=t==null?void 0:t.meta)==null?void 0:w.did;return e.jsxs(e.Fragment,{children:[e.jsxs(ht,{disabled:l,ref:R,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(se,{onClick:i,children:[d&&e.jsx(Ye,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(se,{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:L,children:e.jsx(an,{})})]}),e.jsx(So,{sx:{zIndex:10},open:p,anchorEl:R.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:g})=>e.jsx(Io,{...g,style:{transformOrigin:"center top"},children:e.jsx(jt,{children:e.jsx(Do,{onClickAway:z,children:e.jsxs(To,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[H==null?void 0:H.map(_=>{var J;return e.jsxs(fe,{selected:_.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>T(_),children:[e.jsxs(c,{children:[e.jsx(je,{sx:{fontSize:"16px"},maxLength:24,children:_.name}),e.jsx(je,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:_.url})]}),en({store:_,userDid:(J=a==null?void 0:a.user)==null?void 0:J.did})&&e.jsx(ce,{sx:{ml:1},onClick:U=>{U.preventDefault(),U.stopPropagation(),k(_)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},_.url)}),e.jsx(Rs,{}),e.jsxs(fe,{onClick:B,children:[e.jsx(Rt,{font:!0}),e.jsx(N,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),I&&e.jsx(Wo,{hiddenChildren:!0,open:!0,onClose:v,teamDid:W,storeList:H,scope:"studio",onAdd:(q=y==null?void 0:y.actions)==null?void 0:q.refreshBlocklet}),D&&e.jsx(vt,{displayError:!0,title:`${u("common.delete")} ${D.name}`,description:u("blocklet.publish.deleteStoreTip",{name:D.name}),confirm:u("common.confirm"),onConfirm:C,onCancel:()=>k(null)})]})}Ut.propTypes={store:r.object,blocklet:r.object,onChangeStore:r.func.isRequired,onClick:r.func.isRequired,loading:r.bool.isRequired,disabled:r.bool.isRequired,componentDid:r.string.isRequired,projectType:r.string.isRequired,getData:r.func.isRequired};Ut.defaultProps={store:null,blocklet:null};const Gn=(t,o,s)=>{const i=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${i}/${t.blockletLogo}`:`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,n=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${l}/${u}`);return{logoUrl:d,screenshotUrls:n,uploadLogoPrefix:i,uploadScreenshotPrefix:l}},Zo=Gn,Jn=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function st({url:t,style:o,controls:s,modestbranding:i}){var u;const{t:l}=te(),d=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");if(d){const a=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${a}?modestbranding=${i}&controls=${s}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(n){const a=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${a}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(N,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}st.propTypes={url:r.string.isRequired,style:r.object,controls:r.number,modestbranding:r.number};st.defaultProps={style:{},controls:1,modestbranding:1};function Ko({setParams:t,onClose:o,params:s}){const{t:i}=te(),[l,d]=x.useState(""),n=l&&s.blockletVideos.includes(l),u=Jn(l),a=()=>{t(h=>{const m=[...h.blockletVideos];return m.push(l),{...h,blockletVideos:m}}),o()};return e.jsxs(ot,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(_o,{children:i("studio.videoDialogTitle")}),e.jsxs(Po,{children:[e.jsx(vs,{fullWidth:!0,value:l,onChange:h=>d(h.target.value),placeholder:i("studio.videoInputLabel"),endAdornment:l?e.jsx(Me,{position:"end",children:e.jsx(ce,{onClick:()=>d(""),children:e.jsx(Os,{})})}):null,error:n}),n&&e.jsx(N,{variant:"body2",color:"error",children:i("studio.duplicateVideo")}),e.jsx(st,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(qo,{children:[e.jsx(se,{onClick:()=>o(),children:i("studio.cancel")}),e.jsx(se,{disabled:!u||n,onClick:a,children:i("studio.confirm")})]})]})}Ko.propTypes={onClose:r.func.isRequired,params:r.object.isRequired,setParams:r.func.isRequired};function xt({errors:t,storeList:o,...s}){const{t:i}=te();return e.jsxs(c,{...s,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(N,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:i("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([l,d])=>{const n=Object.values(d),u=o.find(a=>a.url===l);return n.length>0&&e.jsxs(c,{children:[e.jsx(me,{title:l,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),n.map(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},l)})]})}xt.propTypes={errors:r.object.isRequired,storeList:r.array.isRequired};const mo=x.lazy(()=>zo(()=>import("./index-D8WxMgot.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(t=>({default:t.Uploader})));function es({projectId:t,readOnly:o,loading:s,blocklet:i,params:l,setParams:d,paramsErrTip:n,setParamsErrTip:u,warning:a,setLoading:h,initUrl:m,initLogoUrl:S,setInitLogoUrl:y,componentDid:p}){const{t:f,locale:R}=te(),{api:I}=ye(),j=gt(),D=x.useRef(null),k=x.useRef(null),[T,L]=Vn(i),[z,B]=x.useState(!1),v=tn({messageType:"connect-store-message",onOpen:()=>h(!0),onClose:()=>h(!1)}),C=async $=>{const M=setTimeout(()=>{h(!1)},2e4),F=await Un(I,$);h(!1),clearTimeout(M),window.parent.postMessage({event:"studioDialog.connected",componentDid:p},"*"),j(window.location.pathname.replace(`${G.UNOWNED_DID}/create`,`${F}/create`),{replace:!0})},H=()=>{if(!l.blockletTitle){V.error(f("blocklet.publish.errorTip.noTitle"));return}if(!(T!=null&&T.url)){V.error(f("blocklet.publish.noStoreSelected"));return}const $=Mn();v(async(M,F)=>{var Q,X,ie;try{const Y=await I.connectByStudio({input:{did:(Q=i==null?void 0:i.meta)==null?void 0:Q.did,blockletTitle:l==null?void 0:l.blockletTitle,storeUrl:T.url,storeId:T.id,storeName:T.name,type:((X=l==null?void 0:l.blockletComponents)==null?void 0:X.length)>0?"pack":"resource",componentDid:p,messageId:$,tenantScope:(m==null?void 0:m.searchParams.get("tenantScope"))||""}});if(!(Y!=null&&Y.url)){V.error("failed to connect to store");return}F(Y.url),C({did:(ie=i==null?void 0:i.meta)==null?void 0:ie.did,projectId:"",messageId:$})}catch(Y){const de=Ne(Y);V.error(de),h(!1)}})},{logoUrl:W,screenshotUrls:b,uploadLogoPrefix:w,uploadScreenshotPrefix:q}=Zo(l,i,t),{logoErrors:g,screenshotErrors:_,storeList:J,hasLogoWarning:U,hasScreenshotWarning:re}=a,K=()=>o?!1:!t||t===G.UNOWNED_DID?(V.error(f("blocklet.publish.errorTip.noFirstDid")),!1):!0,ee=$=>{if(!$.destination)return;const M=Array.from(l.blockletScreenshots),[F]=M.splice($.source.index,1);M.splice($.destination.index,0,F),d(Q=>({...Q,blockletScreenshots:M}))},Be=$=>{if(!$.destination)return;const M=Array.from(l.blockletVideos),[F]=M.splice($.source.index,1);M.splice($.destination.index,0,F),d(Q=>({...Q,blockletVideos:M}))};return e.jsxs(Xn,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.title")}`,placeholder:`Blocklet ${f("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:l.blockletTitle||"",onChange:$=>{u({blockletTitle:""}),d({blockletTitle:$.target.value})},error:!!n.blockletTitle,helperText:n.blockletTitle||""}),e.jsx(oe,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===G.UNOWNED_DID&&e.jsx(Me,{position:"end",children:e.jsx(Ut,{blocklet:i,store:T,componentDid:p,onChangeStore:L,disabled:!l.blockletTitle||o||s,loading:s,onClick:H})})},error:!!n.projectId,helperText:n.projectId||"",value:t===G.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.description")}`,placeholder:`Blocklet ${f("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletDescription||"",onChange:$=>{u({blockletDescription:""}),d({blockletDescription:$.target.value})},error:!!n.blockletDescription,helperText:n.blockletDescription||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.homepageTip")}`,placeholder:`Blocklet ${f("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletHomepage||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletHomepage:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:$.target.value})},error:!!n.blockletHomepage,helperText:n.blockletHomepage||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.community")}`,placeholder:`Blocklet ${f("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletCommunity||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletCommunity:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:$.target.value})},error:!!n.blockletCommunity,helperText:n.blockletCommunity||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.support")}`,placeholder:`Blocklet ${f("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletSupport||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test($.target.value)?u({blockletSupport:f("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:$.target.value})},error:!!n.blockletSupport,helperText:n.blockletSupport||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.repository")}`,placeholder:`Blocklet ${f("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletRepository||"",onChange:$=>{$.target.value&&!/^(git|https|svn)/.test($.target.value)?u({blockletRepository:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:$.target.value})},error:!!n.blockletRepository,helperText:n.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.logo")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(vo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:S||W,onClick:()=>{var $;K()&&(($=D.current)==null||$.open())}})})]}),U&&e.jsx(xt,{errors:g,storeList:J,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.screenshot")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:f("studio.orderTip")})]})})]})]}),e.jsx(co,{onDragEnd:o?void 0:ee,children:e.jsx(ao,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:($,M)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:M.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:M.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[b.map((F,Q)=>e.jsx(uo,{draggableId:F,index:Q,isDragDisabled:o,children:(X,ie)=>e.jsxs(c,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:F}),!o&&e.jsx(ce,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(Y=>{const de=[...Y.blockletScreenshots];return de.splice(Q,1),{...Y,blockletScreenshots:de}})},children:e.jsx(po,{})})]})},F)),$.placeholder,b.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var F;K()&&((F=k.current)==null||F.open())},children:"+"})]})})})]}),re&&e.jsx(xt,{errors:_,storeList:J}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("studio.video")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"#007ec6"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:f("studio.orderTip")})]})})]})]}),e.jsx(co,{onDragEnd:o?void 0:Be,children:e.jsx(ao,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:($,M)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:M.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:M.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[l.blockletVideos.map((F,Q)=>e.jsx(uo,{draggableId:F,index:Q,isDragDisabled:o,children:(X,ie)=>e.jsxs(c,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(st,{url:F,style:{pointerEvents:ie.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(Y=>{const de=[...Y.blockletVideos];return de.splice(Q,1),{...Y,blockletVideos:de}})},children:e.jsx(po,{})})]})},F)),$.placeholder,l.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{K()&&B(!0)},children:"+"})]})})})]})]})}),e.jsxs(x.Suspense,{fallback:e.jsx(Fe,{}),children:[e.jsx(mo,{ref:D,locale:R,popup:!0,onUploadFinish:$=>{var M;d({blockletLogo:$.data.filename}),y(""),(M=D.current)==null||M.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:w,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"),z&&e.jsx(Ko,{onClose:()=>B(!1),params:l,setParams:d}),e.jsx(mo,{ref:k,popup:!0,onUploadFinish:$=>{var M;d(F=>{var X;const Q=F.blockletScreenshots||[];return Q.push((X=$.data)==null?void 0:X.filename),{...F,blockletScreenshots:Q}}),(M=k.current)==null||M.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:q,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-b.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")]})]})}es.propTypes={projectId:r.string.isRequired,readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,warning:r.object.isRequired,loading:r.bool.isRequired,blocklet:r.object.isRequired,setLoading:r.func.isRequired,initUrl:r.object.isRequired,componentDid:r.isRequired,initLogoUrl:r.string.isRequired,setInitLogoUrl:r.func.isRequired};const Xn=ge.div`
124
+ `;var Vt={},En=ke;Object.defineProperty(Vt,"__esModule",{value:!0});var bt=Vt.default=void 0,Wn=En(Re()),On=e;bt=Vt.default=(0,Wn.default)((0,On.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 xo="lastWantToConnectStoreId";function Vn(t){var u,a;const[o,s]=x.useState(null),{session:i}=Ue(),l=x.useCallback(h=>{s(h),localStorage.setItem(xo,h==null?void 0:h.id)},[s]),d=x.useMemo(()=>{var y,p,f,R;const h=localStorage.getItem(xo),m=h?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(I=>I.id===h):null;if(m)return m;let S=(((p=t==null?void 0:t.settings)==null?void 0:p.storeList)||[]).find(I=>{var j;return!(I.id!==G.BLOCKLET_STORE.id||I.scope&&I.scope!=="studio"&&I.scope!==((j=i==null?void 0:i.user)==null?void 0:j.did))});return S||(S=(R=(f=t==null?void 0:t.settings)==null?void 0:f.storeList)==null?void 0:R[0]),S},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=i==null?void 0:i.user)==null?void 0:a.did]);return[o||d||{},l]}const pt={};async function Qo(t,{interval:o=1e3,maxDuration:s=120*1e3,intervalFirst:i=4e3,timerKey:l=""}){pt[l]&&clearTimeout(pt[l]),await new Promise(u=>setTimeout(u,i));const d=Date.now(),n=async(u,a)=>{try{const h=await t();u(h)}catch(h){Date.now()-d>s?a(h):l?pt[l]=setTimeout(()=>n(u,a),o):setTimeout(()=>n(u,a),o)}};return new Promise(n)}function Mn(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Un(t,{did:o,projectId:s,messageId:i}){return Qo(async()=>{var d;const l=await t.getProject({input:{did:o,projectId:s,messageId:i}});if(!((d=l==null?void 0:l.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return l.project.blockletDid},{timerKey:"connect-studio"})}function Fn(t,{did:o,projectId:s,storeId:i}){return Qo(async()=>{var n,u;const l=await t.getProject({input:{did:o,projectId:s,messageId:""}});if(!((u=(n=l==null?void 0:l.project)==null?void 0:n.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!l.project.connectedStores.find(a=>a.storeId===i))throw new Error("Connected store not found")},{timerKey:`connect-store-${i}`})}const Hn=({fromBlocklet:t,nodeInfo:o,blocklet:s,userDid:i})=>{var n,u;const l=t?(n=s==null?void 0:s.meta)==null?void 0:n.did:o==null?void 0:o.did;let d=t?((u=s==null?void 0:s.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===i),{teamDid:l,storeList:d}},Mt=Hn;function Ut({blocklet:t,store:o={},onChangeStore:s,onClick:i,disabled:l,loading:d,componentDid:n}){var b,w,q;const{t:u}=te(),{session:a}=Ue(),{api:h,info:m,inService:S}=ye(),y=ze(),[p,f]=x.useState(!1),R=x.useRef(null),[I,j]=x.useState(!1),[D,k]=x.useState(null),T=g=>{s(g),f(!1)},L=()=>{f(!p)},z=g=>{R.current&&R.current.contains(g.target)||f(!1)},B=()=>{j(!0)},v=()=>{j(!1)},C=async()=>{var g;if(D)try{await h.deleteBlockletStore({input:{teamDid:t.meta.did,url:D.url,projectId:"",scope:D.scope||"studio"}}),await((g=y==null?void 0:y.actions)==null?void 0:g.refreshBlocklet())}catch(_){V.error(`Remove Blocklet Store Error: ${Ne(_)}`)}finally{k(null)}},{storeList:H}=Mt({fromBlocklet:S,blocklet:t,nodeInfo:m,componentDid:n,userDid:(b=a==null?void 0:a.user)==null?void 0:b.did}),W=(w=t==null?void 0:t.meta)==null?void 0:w.did;return e.jsxs(e.Fragment,{children:[e.jsxs(ht,{disabled:l,ref:R,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(se,{onClick:i,children:[d&&e.jsx(Ye,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(se,{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:L,children:e.jsx(an,{})})]}),e.jsx(So,{sx:{zIndex:10},open:p,anchorEl:R.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:g})=>e.jsx(Io,{...g,style:{transformOrigin:"center top"},children:e.jsx(jt,{children:e.jsx(Do,{onClickAway:z,children:e.jsxs(To,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[H==null?void 0:H.map(_=>{var J;return e.jsxs(fe,{selected:_.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>T(_),children:[e.jsxs(c,{children:[e.jsx(je,{sx:{fontSize:"16px"},maxLength:24,children:_.name}),e.jsx(je,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:_.url})]}),en({store:_,userDid:(J=a==null?void 0:a.user)==null?void 0:J.did})&&e.jsx(ce,{sx:{ml:1},onClick:U=>{U.preventDefault(),U.stopPropagation(),k(_)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},_.url)}),e.jsx(Rs,{}),e.jsxs(fe,{onClick:B,children:[e.jsx(Rt,{font:!0}),e.jsx(N,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),I&&e.jsx(Wo,{hiddenChildren:!0,open:!0,onClose:v,teamDid:W,storeList:H,scope:"studio",onAdd:(q=y==null?void 0:y.actions)==null?void 0:q.refreshBlocklet}),D&&e.jsx(vt,{displayError:!0,title:`${u("common.delete")} ${D.name}`,description:u("blocklet.publish.deleteStoreTip",{name:D.name}),confirm:u("common.confirm"),onConfirm:C,onCancel:()=>k(null)})]})}Ut.propTypes={store:r.object,blocklet:r.object,onChangeStore:r.func.isRequired,onClick:r.func.isRequired,loading:r.bool.isRequired,disabled:r.bool.isRequired,componentDid:r.string.isRequired,projectType:r.string.isRequired,getData:r.func.isRequired};Ut.defaultProps={store:null,blocklet:null};const Gn=(t,o,s)=>{const i=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/logo/upload`,l=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${s}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${i}/${t.blockletLogo}`:`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,n=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${l}/${u}`);return{logoUrl:d,screenshotUrls:n,uploadLogoPrefix:i,uploadScreenshotPrefix:l}},Zo=Gn,Jn=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),s=t.includes("vimeo.com");return o||s};function st({url:t,style:o,controls:s,modestbranding:i}){var u;const{t:l}=te(),d=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");if(d){const a=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${a}?modestbranding=${i}&controls=${s}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(n){const a=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${a}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(N,{variant:"body1",sx:{opacity:.5},children:l("studio.videoDialogNoSrc")})]})})}st.propTypes={url:r.string.isRequired,style:r.object,controls:r.number,modestbranding:r.number};st.defaultProps={style:{},controls:1,modestbranding:1};function Ko({setParams:t,onClose:o,params:s}){const{t:i}=te(),[l,d]=x.useState(""),n=l&&s.blockletVideos.includes(l),u=Jn(l),a=()=>{t(h=>{const m=[...h.blockletVideos];return m.push(l),{...h,blockletVideos:m}}),o()};return e.jsxs(ot,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(_o,{children:i("studio.videoDialogTitle")}),e.jsxs(Po,{children:[e.jsx(vs,{fullWidth:!0,value:l,onChange:h=>d(h.target.value),placeholder:i("studio.videoInputLabel"),endAdornment:l?e.jsx(Me,{position:"end",children:e.jsx(ce,{onClick:()=>d(""),children:e.jsx(Os,{})})}):null,error:n}),n&&e.jsx(N,{variant:"body2",color:"error",children:i("studio.duplicateVideo")}),e.jsx(st,{url:l,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(qo,{children:[e.jsx(se,{onClick:()=>o(),children:i("studio.cancel")}),e.jsx(se,{disabled:!u||n,onClick:a,children:i("studio.confirm")})]})]})}Ko.propTypes={onClose:r.func.isRequired,params:r.object.isRequired,setParams:r.func.isRequired};function xt({errors:t,storeList:o,...s}){const{t:i}=te();return e.jsxs(c,{...s,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(N,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:i("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([l,d])=>{const n=Object.values(d),u=o.find(a=>a.url===l);return n.length>0&&e.jsxs(c,{children:[e.jsx(me,{title:l,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),n.map(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},l)})]})}xt.propTypes={errors:r.object.isRequired,storeList:r.array.isRequired};const mo=x.lazy(()=>zo(()=>import("./index-B4PgdoaR.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(t=>({default:t.Uploader})));function es({projectId:t,readOnly:o,loading:s,blocklet:i,params:l,setParams:d,paramsErrTip:n,setParamsErrTip:u,warning:a,setLoading:h,initUrl:m,initLogoUrl:S,setInitLogoUrl:y,componentDid:p}){const{t:f,locale:R}=te(),{api:I}=ye(),j=gt(),D=x.useRef(null),k=x.useRef(null),[T,L]=Vn(i),[z,B]=x.useState(!1),v=tn({messageType:"connect-store-message",onOpen:()=>h(!0),onClose:()=>h(!1)}),C=async $=>{const M=setTimeout(()=>{h(!1)},2e4),F=await Un(I,$);h(!1),clearTimeout(M),window.parent.postMessage({event:"studioDialog.connected",componentDid:p},"*"),j(window.location.pathname.replace(`${G.UNOWNED_DID}/create`,`${F}/create`),{replace:!0})},H=()=>{if(!l.blockletTitle){V.error(f("blocklet.publish.errorTip.noTitle"));return}if(!(T!=null&&T.url)){V.error(f("blocklet.publish.noStoreSelected"));return}const $=Mn();v(async(M,F)=>{var Q,X,ie;try{const Y=await I.connectByStudio({input:{did:(Q=i==null?void 0:i.meta)==null?void 0:Q.did,blockletTitle:l==null?void 0:l.blockletTitle,storeUrl:T.url,storeId:T.id,storeName:T.name,type:((X=l==null?void 0:l.blockletComponents)==null?void 0:X.length)>0?"pack":"resource",componentDid:p,messageId:$,tenantScope:(m==null?void 0:m.searchParams.get("tenantScope"))||""}});if(!(Y!=null&&Y.url)){V.error("failed to connect to store");return}F(Y.url),C({did:(ie=i==null?void 0:i.meta)==null?void 0:ie.did,projectId:"",messageId:$})}catch(Y){const de=Ne(Y);V.error(de),h(!1)}})},{logoUrl:W,screenshotUrls:b,uploadLogoPrefix:w,uploadScreenshotPrefix:q}=Zo(l,i,t),{logoErrors:g,screenshotErrors:_,storeList:J,hasLogoWarning:U,hasScreenshotWarning:re}=a,K=()=>o?!1:!t||t===G.UNOWNED_DID?(V.error(f("blocklet.publish.errorTip.noFirstDid")),!1):!0,ee=$=>{if(!$.destination)return;const M=Array.from(l.blockletScreenshots),[F]=M.splice($.source.index,1);M.splice($.destination.index,0,F),d(Q=>({...Q,blockletScreenshots:M}))},Be=$=>{if(!$.destination)return;const M=Array.from(l.blockletVideos),[F]=M.splice($.source.index,1);M.splice($.destination.index,0,F),d(Q=>({...Q,blockletVideos:M}))};return e.jsxs(Xn,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.title")}`,placeholder:`Blocklet ${f("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:l.blockletTitle||"",onChange:$=>{u({blockletTitle:""}),d({blockletTitle:$.target.value})},error:!!n.blockletTitle,helperText:n.blockletTitle||""}),e.jsx(oe,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===G.UNOWNED_DID&&e.jsx(Me,{position:"end",children:e.jsx(Ut,{blocklet:i,store:T,componentDid:p,onChangeStore:L,disabled:!l.blockletTitle||o||s,loading:s,onClick:H})})},error:!!n.projectId,helperText:n.projectId||"",value:t===G.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.description")}`,placeholder:`Blocklet ${f("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletDescription||"",onChange:$=>{u({blockletDescription:""}),d({blockletDescription:$.target.value})},error:!!n.blockletDescription,helperText:n.blockletDescription||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.homepageTip")}`,placeholder:`Blocklet ${f("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletHomepage||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletHomepage:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:$.target.value})},error:!!n.blockletHomepage,helperText:n.blockletHomepage||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.community")}`,placeholder:`Blocklet ${f("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletCommunity||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletCommunity:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:$.target.value})},error:!!n.blockletCommunity,helperText:n.blockletCommunity||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.support")}`,placeholder:`Blocklet ${f("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletSupport||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test($.target.value)?u({blockletSupport:f("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:$.target.value})},error:!!n.blockletSupport,helperText:n.blockletSupport||"",sx:{mt:3}}),e.jsx(oe,{disabled:s||o,label:`Blocklet ${f("common.repository")}`,placeholder:`Blocklet ${f("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:l.blockletRepository||"",onChange:$=>{$.target.value&&!/^(git|https|svn)/.test($.target.value)?u({blockletRepository:f("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:$.target.value})},error:!!n.blockletRepository,helperText:n.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.logo")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(vo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:S||W,onClick:()=>{var $;K()&&(($=D.current)==null||$.open())}})})]}),U&&e.jsx(xt,{errors:g,storeList:J,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("common.screenshot")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:f("studio.orderTip")})]})})]})]}),e.jsx(co,{onDragEnd:o?void 0:ee,children:e.jsx(ao,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:($,M)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:M.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:M.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[b.map((F,Q)=>e.jsx(uo,{draggableId:F,index:Q,isDragDisabled:o,children:(X,ie)=>e.jsxs(c,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:F}),!o&&e.jsx(ce,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(Y=>{const de=[...Y.blockletScreenshots];return de.splice(Q,1),{...Y,blockletScreenshots:de}})},children:e.jsx(po,{})})]})},F)),$.placeholder,b.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var F;K()&&((F=k.current)==null||F.open())},children:"+"})]})})})]}),re&&e.jsx(xt,{errors:_,storeList:J}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Se,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(N,{variant:"subtitle1",sx:{fontWeight:"bold"},children:f("studio.video")}),e.jsxs(Se,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"#007ec6"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[f("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:f("studio.orderTip")})]})})]})]}),e.jsx(co,{onDragEnd:o?void 0:Be,children:e.jsx(ao,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:($,M)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:M.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:M.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[l.blockletVideos.map((F,Q)=>e.jsx(uo,{draggableId:F,index:Q,isDragDisabled:o,children:(X,ie)=>e.jsxs(c,{ref:X.innerRef,...X.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(st,{url:F,style:{pointerEvents:ie.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...X.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(bt,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(Y=>{const de=[...Y.blockletVideos];return de.splice(Q,1),{...Y,blockletVideos:de}})},children:e.jsx(po,{})})]})},F)),$.placeholder,l.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{K()&&B(!0)},children:"+"})]})})})]})]})}),e.jsxs(x.Suspense,{fallback:e.jsx(Fe,{}),children:[e.jsx(mo,{ref:D,locale:R,popup:!0,onUploadFinish:$=>{var M;d({blockletLogo:$.data.filename}),y(""),(M=D.current)==null||M.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:w,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"),z&&e.jsx(Ko,{onClose:()=>B(!1),params:l,setParams:d}),e.jsx(mo,{ref:k,popup:!0,onUploadFinish:$=>{var M;d(F=>{var X;const Q=F.blockletScreenshots||[];return Q.push((X=$.data)==null?void 0:X.filename),{...F,blockletScreenshots:Q}}),(M=k.current)==null||M.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:q,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-b.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")]})]})}es.propTypes={projectId:r.string.isRequired,readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,warning:r.object.isRequired,loading:r.bool.isRequired,blocklet:r.object.isRequired,setLoading:r.func.isRequired,initUrl:r.object.isRequired,componentDid:r.isRequired,initLogoUrl:r.string.isRequired,setInitLogoUrl:r.func.isRequired};const Xn=ge.div`
125
125
  margin-top: 24px;
126
126
  .screenshot {
127
127
  margin-bottom: 16px;
@@ -169,7 +169,7 @@ import{r as x,k as gt,l as tt,L as xe,u as js,h as ks,i as ct}from"./vendor-reac
169
169
  padding-bottom: 12px;
170
170
  border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
171
171
  }
172
- `;function rs({text:t}){return t?e.jsx(un,{wrapperElement:{"data-color-mode":"light"},source:Fs.sanitize(t),rehypePlugins:[[pn,{target:"_blank"}]]}):e.jsx(Ae,{Icon:Dt})}rs.propTypes={text:r.string.isRequired};function is({params:t,setParams:o,paramsErrTip:s,loading:i,setParamsErrTip:l,readOnly:d}){var m;const{t:n}=te(),[u,a]=x.useState(d?"preview":"write"),h=(S,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(N,{variant:"h6",fontWeight:"bold",sx:{},children:n("common.introduction")}),e.jsxs($o,{value:u,onChange:h,"aria-label":"wrapped label tabs example",children:[e.jsx(Qe,{value:"write",label:"Write"}),e.jsx(Qe,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(oe,{disabled:i||d,sx:{border:"none"},placeholder:`Blocklet ${n("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Me,{position:"end",children:[((m=t==null?void 0:t.blockletIntroduction)==null?void 0:m.length)||0," / ",ue.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:S=>{l({blockletIntroduction:""}),o({blockletIntroduction:S.target.value.slice(0,ue.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(rs,{text:t.blockletIntroduction||""})})]})}is.propTypes={params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,readOnly:r.bool.isRequired,loading:r.bool.isRequired};var Gt={},ll=ke;Object.defineProperty(Gt,"__esModule",{value:!0});var mt=Gt.default=void 0,rl=ll(Re()),jo=e;mt=Gt.default=(0,rl.default)([(0,jo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,jo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function Jt({step:t,ok:o,active:s,error:i,warning:l}){let d="grey.500",n=t+1;return o&&(n=e.jsx(hn,{sx:{fontSize:18,margin:0},color:"white"})),i||!o&&s>t?(d="error.main",n=e.jsx(mt,{sx:{fontSize:18,margin:0},color:"white"})):l?(d="warning.main",n=e.jsx(mt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:n})}Jt.propTypes={step:r.number,ok:r.bool,active:r.number,error:r.string,warning:r.bool};Jt.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function cs({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:i,params:l,loading:d,paramsErrTip:n,warning:u,viewMode:a,projectId:h}){const{t:m}=te(),S=()=>{s(R=>R+1)},y=()=>{s(R=>R-1)},p=R=>R===0?(n==null?void 0:n.blockletTitle)||(n==null?void 0:n.projectId)||(n==null?void 0:n.blockletDescription)||(n==null?void 0:n.blockletHomepage)||(n==null?void 0:n.blockletSupport)||(n==null?void 0:n.blockletCommunity)||(n==null?void 0:n.blockletRepository):R===2?(n==null?void 0:n.blockletResource)||(n==null?void 0:n.blockletDocker)||(n==null?void 0:n.dockerImageName):R>=4?(n==null?void 0:n.blockletVersion)||(n==null?void 0:n.note):"",f=a||os({hasSelectedResources:i,params:l,projectId:h,t:m})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[e.jsx(Ds,{activeStep:o,orientation:"vertical",children:t.map((R,I)=>{const j={},D=d||!sl({hasSelectedResources:i,params:l,projectId:h,step:I,t:m}),k=d?"":p(I);return k&&(j.optional=e.jsx(N,{variant:"caption",color:"error",children:k}),j.error=!0),e.jsxs(Ts,{children:[e.jsx(_s,{icon:e.jsx(Jt,{error:k,warning:I===0?u.hasWarning:!1,active:f?99:o,step:I,ok:D}),sx:{cursor:"pointer",color:k?"error.main":"inherit"},disabled:!1,onClick:()=>s(I),...j,children:e.jsx(N,{fontSize:"14px",fontWeight:"500",color:k||!D&&o>I?"error.main":"inherit",children:R.label})}),e.jsxs(Ps,{children:[e.jsx(N,{fontSize:12,children:R.description}),!f&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[I<t.length-1&&e.jsx(se,{variant:"contained",onClick:S,sx:{mt:1,mr:1},disabled:k||!D,children:m("common.continue")}),I>0&&e.jsx(se,{disabled:I===0,onClick:y,sx:{mt:1,mr:1},children:m("common.back")})]})})]})]},R.label)})}),o>=t.length-1&&e.jsx(jt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(N,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}cs.propTypes={steps:r.array.isRequired,activeStep:r.number.isRequired,setActiveStep:r.func.isRequired,params:r.object.isRequired,viewMode:r.string.isRequired,loading:r.bool.isRequired,projectId:r.string.isRequired,hasSelectedResources:r.bool.isRequired,warning:r.object.isRequired,paramsErrTip:r.shape({projectId:r.string,blockletVersion:r.string,blockletTitle:r.string,blockletDescription:r.string,note:r.string,blockletResource:r.string,blockletHomepage:r.string,blockletSupport:r.string,blockletCommunity:r.string,blockletRepository:r.string,blockletDocker:r.object,dockerImageName:r.string}).isRequired};const il=[".zip",".gz"],cl=1024*1024*100,al=x.lazy(()=>zo(()=>import("./index-D8WxMgot.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(t=>({default:t.Uploader})));function Xt({app:t,projectId:o,readOnly:s,params:i,setParams:l,setParamsErrTip:d,error:n}){const{t:u,locale:a}=te(),h=x.useRef(null),m=()=>s?!1:!o||o===G.UNOWNED_DID?(V.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,S=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(N,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(Se,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:s?"default":"pointer"},children:[!!i.uploadedResource&&e.jsx(N,{component:"a",href:`${S}/params.uploadedResource`,children:i.uploadedResource}),!s&&e.jsx(se,{variant:"outlined",size:"small",onClick:()=>{var y;m()&&((y=h.current)==null||y.open())},children:i.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(x.Suspense,{fallback:e.jsx(Fe,{}),children:e.jsx(al,{ref:h,locale:a,popup:!0,onUploadFinish:y=>{var p;l({uploadedResource:y.data.filename}),d({blockletResource:""}),(p=h.current)==null||p.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:il,maxFileSize:cl,maxNumberOfFiles:1}}},"uploader-resource")}),!!n&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:n})]})}Xt.propTypes={app:r.object.isRequired,projectId:r.string.isRequired,readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,error:r.string.isRequired,setParamsErrTip:r.func.isRequired};Xt.defaultProps={};function Ke({readOnly:t,params:o,setParams:s,paramsErrTip:i,setParamsErrTip:l,loading:d}){var u;const{t:n}=te();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(oe,{required:!0,disabled:d||t,label:`Blocklet ${n("common.version")}`,placeholder:`Blocklet ${n("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:a=>{l({blockletVersion:""}),s({blockletVersion:a.target.value})},error:!!i.blockletVersion,helperText:i.blockletVersion||""}),e.jsx(oe,{label:n("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Me,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",ue.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:a=>{l({note:""}),s({note:a.target.value.slice(0,ue.PROJECT.MAX_NOTE_LENGTH)})},error:!!i.note,helperText:i.note||"",sx:{mt:3}})]})})}Ke.propTypes={readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,loading:r.bool.isRequired};Ke.defaultProps={};function as(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&as(t[o]);return t}function et({index:t,item:o,dockerParams:s,setDockerParams:i,dataKey:l,t:d,readOnly:n}){const u=(o==null?void 0:o.value)||"",[a,h]=x.useState(!1),m=()=>{var W;(W=s[l])==null||W.splice(t,1),i({...s,[l]:[...s[l]]})},S=(W,b)=>{var w;(w=s[l])!=null&&w[t]&&(b?(s[l][t].custom=s[l][t].value,s[l][t].value=`$${dt(o.key)}`):(s[l][t].value=s[l][t].custom||"",s[l][t].custom="")),i({...s,[l]:[...s[l]]})},y=(W,b)=>{var q;const w=((q=s[l][t])==null?void 0:q.value)||"";s[l][t]={...s[l][t],secure:b,value:b&&w===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},i({...s,[l]:[...s[l]]})},p=(W,b)=>{s[l][t]={...s[l][t],shared:b},i({...s,[l]:[...s[l]]})},f=(W,b)=>{var q;const w=((q=s[l][t])==null?void 0:q.value)||"";s[l][t]={...s[l][t],required:b,value:b&&w===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},i({...s,[l]:[...s[l]]})},R=(W,b)=>{s[l][t]={...s[l][t],value:b?ue.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},i({...s,[l]:[...s[l]]})},I=W=>{s[l][t]={...s[l][t],description:W.target.value},i({...s,[l]:[...s[l]]})},j=W=>{const b=W.target.value==="web"?"web":"docker";b==="web"&&s.dockerArgs.forEach(g=>{g.type="docker"});const q=`/${s.dockerImage.replace(/\W/g,"-")}-${t}`;s.dockerArgs[t]={...s.dockerArgs[t],type:b,path:b==="docker"?q:"/",protocol:"http",prefix:b==="docker"?q:"/",name:"publicUrl",port:"BLOCKLET_PORT"},i({...s,dockerArgs:[...s.dockerArgs]})},D=W=>{s.dockerArgs[t]={...s.dockerArgs[t],proxyBehavior:W.target.value==="direct"?"direct":"service"},i({...s,dockerArgs:[...s.dockerArgs]})},k=W=>{const b=W.target.value;s[l][t]={...s[l][t],prefix:b,path:b==="*"?"/":b},i({...s,[l]:[...s[l]]})},T=W=>{var b;(b=s[l])!=null&&b[t]&&(s[l][t].value=W.target.value),i({...s,[l]:[...s[l]]})},L=u===`$${dt(o.key)}`||o.custom,z=l==="dockerArgs"&&!Oo[o.key],B=nn[o.key],v=l==="dockerEnvs",C=o.key==="--publish";let H=o.key;return C&&o.type==="web"?H="--publish (Web)":v&&(H=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(N,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:H})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(oe,{disabled:n||L||z||o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:L?`$${dt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Me,{position:"end",sx:{zoom:.9},children:[(!(B||z)||v||C)&&e.jsx(ce,{onClick:()=>h(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!n&&e.jsx(ce,{onClick:m,color:z?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})},error:z,onChange:T}),z&&e.jsx(N,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(N,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&ln[o.key](u)&&e.jsx(N,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(yt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(v?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>h(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[B||z||v?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx(De,{disabled:n,checked:L,onChange:S,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.shared")}),e.jsx(De,{disabled:n,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.required")}),e.jsx(De,{disabled:n,checked:o.required,onChange:f,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.secure")}),e.jsx(De,{disabled:n,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx(De,{disabled:n,checked:o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:R,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.description")}),e.jsx(oe,{disabled:n,value:o.description,onChange:I,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),C&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.portType")}),e.jsxs(ft,{value:o.type||"docker",onChange:j,children:[e.jsx(fe,{value:"docker",children:"Docker"}),e.jsx(fe,{value:"web",children:"Web"})]})]}),C&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(ft,{value:o.proxyBehavior||"service",onChange:D,children:[e.jsx(fe,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(fe,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),C&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.prefix")}),e.jsx(oe,{disabled:n,value:o.prefix,onChange:k,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}et.propTypes={dockerParams:r.object.isRequired,setDockerParams:r.func.isRequired,dataKey:r.string.isRequired,item:r.object.isRequired,t:r.func.isRequired,readOnly:r.bool.isRequired,index:r.number.isRequired};et.defaultProps={};const dl=`
172
+ `;function rs({text:t}){return t?e.jsx(un,{wrapperElement:{"data-color-mode":"light"},source:Fs.sanitize(t),rehypePlugins:[[pn,{target:"_blank"}]]}):e.jsx(Ae,{Icon:Dt})}rs.propTypes={text:r.string.isRequired};function is({params:t,setParams:o,paramsErrTip:s,loading:i,setParamsErrTip:l,readOnly:d}){var m;const{t:n}=te(),[u,a]=x.useState(d?"preview":"write"),h=(S,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(N,{variant:"h6",fontWeight:"bold",sx:{},children:n("common.introduction")}),e.jsxs($o,{value:u,onChange:h,"aria-label":"wrapped label tabs example",children:[e.jsx(Qe,{value:"write",label:"Write"}),e.jsx(Qe,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(oe,{disabled:i||d,sx:{border:"none"},placeholder:`Blocklet ${n("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Me,{position:"end",children:[((m=t==null?void 0:t.blockletIntroduction)==null?void 0:m.length)||0," / ",ue.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:S=>{l({blockletIntroduction:""}),o({blockletIntroduction:S.target.value.slice(0,ue.PROJECT.MAX_INTRO_LENGTH)})},error:!!s.blockletIntroduction,helperText:s.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(rs,{text:t.blockletIntroduction||""})})]})}is.propTypes={params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,readOnly:r.bool.isRequired,loading:r.bool.isRequired};var Gt={},ll=ke;Object.defineProperty(Gt,"__esModule",{value:!0});var mt=Gt.default=void 0,rl=ll(Re()),jo=e;mt=Gt.default=(0,rl.default)([(0,jo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,jo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function Jt({step:t,ok:o,active:s,error:i,warning:l}){let d="grey.500",n=t+1;return o&&(n=e.jsx(hn,{sx:{fontSize:18,margin:0},color:"white"})),i||!o&&s>t?(d="error.main",n=e.jsx(mt,{sx:{fontSize:18,margin:0},color:"white"})):l?(d="warning.main",n=e.jsx(mt,{sx:{fontSize:18,margin:0},color:"white"})):s>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:n})}Jt.propTypes={step:r.number,ok:r.bool,active:r.number,error:r.string,warning:r.bool};Jt.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function cs({steps:t,activeStep:o,setActiveStep:s,hasSelectedResources:i,params:l,loading:d,paramsErrTip:n,warning:u,viewMode:a,projectId:h}){const{t:m}=te(),S=()=>{s(R=>R+1)},y=()=>{s(R=>R-1)},p=R=>R===0?(n==null?void 0:n.blockletTitle)||(n==null?void 0:n.projectId)||(n==null?void 0:n.blockletDescription)||(n==null?void 0:n.blockletHomepage)||(n==null?void 0:n.blockletSupport)||(n==null?void 0:n.blockletCommunity)||(n==null?void 0:n.blockletRepository):R===2?(n==null?void 0:n.blockletResource)||(n==null?void 0:n.blockletDocker)||(n==null?void 0:n.dockerImageName):R>=4?(n==null?void 0:n.blockletVersion)||(n==null?void 0:n.note):"",f=a||os({hasSelectedResources:i,params:l,projectId:h,t:m})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[e.jsx(Ds,{activeStep:o,orientation:"vertical",children:t.map((R,I)=>{const j={},D=d||!sl({hasSelectedResources:i,params:l,projectId:h,step:I,t:m}),k=d?"":p(I);return k&&(j.optional=e.jsx(N,{variant:"caption",color:"error",children:k}),j.error=!0),e.jsxs(Ts,{children:[e.jsx(_s,{icon:e.jsx(Jt,{error:k,warning:I===0?u.hasWarning:!1,active:f?99:o,step:I,ok:D}),sx:{cursor:"pointer",color:k?"error.main":"inherit"},disabled:!1,onClick:()=>s(I),...j,children:e.jsx(N,{fontSize:"14px",fontWeight:"500",color:k||!D&&o>I?"error.main":"inherit",children:R.label})}),e.jsxs(Ps,{children:[e.jsx(N,{fontSize:12,children:R.description}),!f&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[I<t.length-1&&e.jsx(se,{variant:"contained",onClick:S,sx:{mt:1,mr:1},disabled:k||!D,children:m("common.continue")}),I>0&&e.jsx(se,{disabled:I===0,onClick:y,sx:{mt:1,mr:1},children:m("common.back")})]})})]})]},R.label)})}),o>=t.length-1&&e.jsx(jt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(N,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}cs.propTypes={steps:r.array.isRequired,activeStep:r.number.isRequired,setActiveStep:r.func.isRequired,params:r.object.isRequired,viewMode:r.string.isRequired,loading:r.bool.isRequired,projectId:r.string.isRequired,hasSelectedResources:r.bool.isRequired,warning:r.object.isRequired,paramsErrTip:r.shape({projectId:r.string,blockletVersion:r.string,blockletTitle:r.string,blockletDescription:r.string,note:r.string,blockletResource:r.string,blockletHomepage:r.string,blockletSupport:r.string,blockletCommunity:r.string,blockletRepository:r.string,blockletDocker:r.object,dockerImageName:r.string}).isRequired};const il=[".zip",".gz"],cl=1024*1024*100,al=x.lazy(()=>zo(()=>import("./index-B4PgdoaR.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(t=>({default:t.Uploader})));function Xt({app:t,projectId:o,readOnly:s,params:i,setParams:l,setParamsErrTip:d,error:n}){const{t:u,locale:a}=te(),h=x.useRef(null),m=()=>s?!1:!o||o===G.UNOWNED_DID?(V.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,S=`${G.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(N,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(Se,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:s?"default":"pointer"},children:[!!i.uploadedResource&&e.jsx(N,{component:"a",href:`${S}/params.uploadedResource`,children:i.uploadedResource}),!s&&e.jsx(se,{variant:"outlined",size:"small",onClick:()=>{var y;m()&&((y=h.current)==null||y.open())},children:i.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(x.Suspense,{fallback:e.jsx(Fe,{}),children:e.jsx(al,{ref:h,locale:a,popup:!0,onUploadFinish:y=>{var p;l({uploadedResource:y.data.filename}),d({blockletResource:""}),(p=h.current)==null||p.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:il,maxFileSize:cl,maxNumberOfFiles:1}}},"uploader-resource")}),!!n&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:n})]})}Xt.propTypes={app:r.object.isRequired,projectId:r.string.isRequired,readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,error:r.string.isRequired,setParamsErrTip:r.func.isRequired};Xt.defaultProps={};function Ke({readOnly:t,params:o,setParams:s,paramsErrTip:i,setParamsErrTip:l,loading:d}){var u;const{t:n}=te();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(oe,{required:!0,disabled:d||t,label:`Blocklet ${n("common.version")}`,placeholder:`Blocklet ${n("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:a=>{l({blockletVersion:""}),s({blockletVersion:a.target.value})},error:!!i.blockletVersion,helperText:i.blockletVersion||""}),e.jsx(oe,{label:n("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Me,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",ue.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:a=>{l({note:""}),s({note:a.target.value.slice(0,ue.PROJECT.MAX_NOTE_LENGTH)})},error:!!i.note,helperText:i.note||"",sx:{mt:3}})]})})}Ke.propTypes={readOnly:r.bool.isRequired,params:r.object.isRequired,setParams:r.func.isRequired,paramsErrTip:r.object.isRequired,setParamsErrTip:r.func.isRequired,loading:r.bool.isRequired};Ke.defaultProps={};function as(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&as(t[o]);return t}function et({index:t,item:o,dockerParams:s,setDockerParams:i,dataKey:l,t:d,readOnly:n}){const u=(o==null?void 0:o.value)||"",[a,h]=x.useState(!1),m=()=>{var W;(W=s[l])==null||W.splice(t,1),i({...s,[l]:[...s[l]]})},S=(W,b)=>{var w;(w=s[l])!=null&&w[t]&&(b?(s[l][t].custom=s[l][t].value,s[l][t].value=`$${dt(o.key)}`):(s[l][t].value=s[l][t].custom||"",s[l][t].custom="")),i({...s,[l]:[...s[l]]})},y=(W,b)=>{var q;const w=((q=s[l][t])==null?void 0:q.value)||"";s[l][t]={...s[l][t],secure:b,value:b&&w===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},i({...s,[l]:[...s[l]]})},p=(W,b)=>{s[l][t]={...s[l][t],shared:b},i({...s,[l]:[...s[l]]})},f=(W,b)=>{var q;const w=((q=s[l][t])==null?void 0:q.value)||"";s[l][t]={...s[l][t],required:b,value:b&&w===ue.BLOCKLET_AUTOMATIC_ENV_VALUE?"":w},i({...s,[l]:[...s[l]]})},R=(W,b)=>{s[l][t]={...s[l][t],value:b?ue.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},i({...s,[l]:[...s[l]]})},I=W=>{s[l][t]={...s[l][t],description:W.target.value},i({...s,[l]:[...s[l]]})},j=W=>{const b=W.target.value==="web"?"web":"docker";b==="web"&&s.dockerArgs.forEach(g=>{g.type="docker"});const q=`/${s.dockerImage.replace(/\W/g,"-")}-${t}`;s.dockerArgs[t]={...s.dockerArgs[t],type:b,path:b==="docker"?q:"/",protocol:"http",prefix:b==="docker"?q:"/",name:"publicUrl",port:"BLOCKLET_PORT"},i({...s,dockerArgs:[...s.dockerArgs]})},D=W=>{s.dockerArgs[t]={...s.dockerArgs[t],proxyBehavior:W.target.value==="direct"?"direct":"service"},i({...s,dockerArgs:[...s.dockerArgs]})},k=W=>{const b=W.target.value;s[l][t]={...s[l][t],prefix:b,path:b==="*"?"/":b},i({...s,[l]:[...s[l]]})},T=W=>{var b;(b=s[l])!=null&&b[t]&&(s[l][t].value=W.target.value),i({...s,[l]:[...s[l]]})},L=u===`$${dt(o.key)}`||o.custom,z=l==="dockerArgs"&&!Oo[o.key],B=nn[o.key],v=l==="dockerEnvs",C=o.key==="--publish";let H=o.key;return C&&o.type==="web"?H="--publish (Web)":v&&(H=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(N,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:H})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(oe,{disabled:n||L||z||o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:L?`$${dt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Me,{position:"end",sx:{zoom:.9},children:[(!(B||z)||v||C)&&e.jsx(ce,{onClick:()=>h(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!n&&e.jsx(ce,{onClick:m,color:z?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})},error:z,onChange:T}),z&&e.jsx(N,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(N,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&ln[o.key](u)&&e.jsx(N,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(yt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(v?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>h(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[B||z||v?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx(De,{disabled:n,checked:L,onChange:S,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.shared")}),e.jsx(De,{disabled:n,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.required")}),e.jsx(De,{disabled:n,checked:o.required,onChange:f,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.secure")}),e.jsx(De,{disabled:n,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx(De,{disabled:n,checked:o.value===ue.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:R,sx:{zoom:.9}})]}),v&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.description")}),e.jsx(oe,{disabled:n,value:o.description,onChange:I,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),C&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.portType")}),e.jsxs(ft,{value:o.type||"docker",onChange:j,children:[e.jsx(fe,{value:"docker",children:"Docker"}),e.jsx(fe,{value:"web",children:"Web"})]})]}),C&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(ft,{value:o.proxyBehavior||"service",onChange:D,children:[e.jsx(fe,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(fe,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),C&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(N,{sx:{flex:1},children:d("blocklet.publish.docker.prefix")}),e.jsx(oe,{disabled:n,value:o.prefix,onChange:k,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}et.propTypes={dockerParams:r.object.isRequired,setDockerParams:r.func.isRequired,dataKey:r.string.isRequired,item:r.object.isRequired,t:r.func.isRequired,readOnly:r.bool.isRequired,index:r.number.isRequired};et.defaultProps={};const dl=`
173
173
  docker run --name postgrest
174
174
  -p 3000:3000
175
175
  -e PGRST_DB_URI="postgres://username:password@host:port/database"
@@ -1,4 +1,4 @@
1
- import{u as q,V as z,bK as K,i as be,X as fe,a2 as ge,bC as je}from"./vendor-ux-did-connect-D75Zatzm.js";import{w as ye,l as de,j as we}from"./vendor-hooks-CYyfK9g3.js";import{r as C,b as X}from"./vendor-react-DoD83n6N.js";import{d as Z}from"./InfoOutlined-HP5LuELQ.js";import{z as N,C as ce,G as ke}from"./index-CYdNDqQ1.js";import{u as F}from"./dashboard-C2dbiNOp.js";import{E as o,j as e,D as ve,ab as Ee,r as Ce,a3 as f,M as ie,T as S,a2 as U,ac as ee,y as Te,x as B,bn as le,bO as V,a4 as A,L as G,z as Q,bg as Se,A as O,I as _,C as Re,bl as Ie,ad as P,cG as Me,ak as Pe,bd as Y,bk as De,b1 as We,cH as ze,cI as Ae,b2 as Oe,af as $e,bS as qe,s as pe,t as Le,cJ as Be,cK as He,cL as Ne,cM as Fe,cN as Ue}from"./vendor-mui-core-O22FPGM4.js";import{u as _e,C as J}from"./index.esm-CWepf7I_.js";import{n as Ke}from"./vendor-arcblock-E5QJEgSK.js";import{d as Ve}from"./ExpandLess-BqrBuxL9.js";import{y as ue,w as Ye,x as Je}from"./vendor-utils-CbeKtci8.js";import{C as Ge}from"./confirm-CCmbVvGp.js";import{A as Qe}from"./actions-CBPbCBQc.js";import"./lottie-web-B6s7dDoL.js";import"./useLocalStorage-CtbpqE0c.js";import"./PlayArrow-DI84Lay5.js";import"./get-safe-url-BvS0hy8W.js";import"./format-error-LAoTjvJe.js";import"./index-BsMTGy4m.js";import"./session-CD9NaM-v.js";import"./useAsyncRetry-CEJwVPZ6.js";import"./useAsync-D2OhgEkV.js";import"./useSetState-BL3ktMon.js";import"./MoreHoriz-Cv3BqpRU.js";const Xe=t=>{var j,y;const[d,c]=C.useState(null),[a,b]=C.useState(!t),[R,p]=C.useState(null),{blocklet:n}=ce(),l=(y=(j=n==null?void 0:n.site)==null?void 0:j.domainAliases[0])==null?void 0:y.value,v=C.useMemo(()=>{const h={};return d&&(d.sources.forEach(r=>{h[r.did]={source:r,events:[],count:0}}),d.events.forEach(r=>{h[r.source]&&(h[r.source].events.push(r),h[r.source].count+=1)})),h},[d]),T=async()=>{try{if(b(!0),!l)return;const r=await(await fetch(`https://${l}/.well-known/service/openevent.json`)).json();c(r),p(null)}catch(h){p(h instanceof Error?h:new Error(String(h)))}finally{b(!1)}};return C.useEffect(()=>{T()},[l]),{openEvent:d,setOpenEvent:c,eventsBySource:v,loading:a,error:R,loadData:T}};function te({eventsBySource:t,selectedEvents:d,setSelectedEvents:c,error:a}){const{t:b}=q(),[R,p]=C.useState({}),n=C.useMemo(()=>{const r={};return Object.entries(t).forEach(([w,{events:g}])=>{const E=g.filter(u=>d[`${u.type}-${u.source}`]).length;r[w]=E}),r},[t,d]),l=C.useMemo(()=>Object.values(n).reduce((r,w)=>r+w,0),[n]),v=C.useMemo(()=>Object.values(t).reduce((r,{events:w})=>r+w.length,0),[t]),T=(r,w)=>{w.stopPropagation(),p({...R,[r]:!R[r]})},j=r=>{const w=`${r.type}-${r.source}`;c(g=>({...g,[w]:!g[w]}))},y=(r,w)=>{const g={};r.forEach(E=>{const u=`${E.type}-${E.source}`;g[u]=!w}),c(E=>({...E,...g}))},h=r=>{const w={};Object.values(t).forEach(({events:g})=>{g.forEach(E=>{const u=`${E.type}-${E.source}`;w[u]=r.target.checked})}),c(w)};return e.jsxs(f,{sx:{width:"100%"},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(le,{control:e.jsx(V,{onChange:h,checked:l>0&&l===v}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[b("webhookEndpoint.selectAllEvents"),e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:e.jsx(A,{title:b("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(Z,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:b("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(f,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(G,{disablePadding:!0,sx:{border:"1px solid #e0e0e0",borderRadius:"4px"},children:Object.entries(t).map(([r,{source:w,events:g,count:E}],u)=>{const M=n[r]>0,i=n[r]===g.length&&g.length>0,x=R[r];return e.jsxs(X.Fragment,{children:[e.jsx(Q,{sx:{borderBottom:u<Object.keys(t).length-1?"1px solid #f0f0f0":"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(f,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:s=>{s.target.closest(".MuiFormControlLabel-root")||T(r,s)},children:[e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:g.length>0&&e.jsx(le,{control:e.jsx(V,{checked:i,indeterminate:M&&!i,onChange:s=>{s.stopPropagation(),y(g,i)}}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[w.logo&&e.jsx(Se,{src:w.logo,sx:{width:24,height:24}}),e.jsx(f,{children:w.title||r}),M&&e.jsx(O,{label:b("webhookEndpoint.selectedCount",{count:n[r]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:s=>`${s.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(f,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:b("webhookEndpoint.eventsCount",{count:E})}),g.length>0&&e.jsx(_,{size:"small",edge:"end",children:x?e.jsx(Ve,{}):e.jsx(Ke,{})})]})]})}),g.length>0&&e.jsx(Re,{in:x,timeout:"auto",unmountOnExit:!0,children:e.jsx(G,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:g.map(s=>{const m=`${s.type}-${s.source}`,k=!!d[m];return e.jsx(Q,{dense:!0,sx:{py:.75},onClick:()=>j(s),children:e.jsxs(f,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(V,{checked:k,sx:{mr:1}}),e.jsxs(f,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer"},children:s.type}),e.jsx(S,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:s.description})]})]})},m)})})})]},r)})})}),a&&e.jsx(Ie,{error:!0,sx:{mt:1},children:a})]})}te.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};te.defaultProps={error:null};function oe({id:t,url:d,description:c,enabledEvents:a,onSubmit:b,onClose:R}){var s;const{t:p}=q(),[n,l]=C.useState({}),{teamDid:v}=F(),{api:T}=N(),{loading:j,error:y,eventsBySource:h}=Xe(),{control:r,handleSubmit:w,formState:{errors:g},reset:E,setValue:u,trigger:M}=_e({defaultValues:{url:"",description:""}});C.useEffect(()=>{const m=Object.values(n).some(k=>k);u("selectedEvents",m?"valid":""),M("selectedEvents")},[n,u,M]);const i=()=>{l({}),E(),R()},x=async m=>{const k=Object.keys(n).filter(I=>n[I]),D={url:m.url,description:m.description,enabledEvents:k.map(I=>{const[$,L]=I.split("-");return!$||!L?null:{type:$,source:L}}).filter(Boolean)};try{if(t){const I=await T.updateWebhookEndpoint({input:{teamDid:v,id:t,data:D}});z.success(`${p("webhookEndpoint.updateWebhook")} ${p("webhookEndpoint.success")}`),b(I)}else{const I=await T.createWebhookEndpoint({input:{teamDid:v,input:D}});z.success(`${p("webhookEndpoint.createWebhook")} ${p("webhookEndpoint.success")}`),b(I)}}catch(I){z.error(I==null?void 0:I.message)}i()};return C.useEffect(()=>{E({url:d,description:c}),l(a.reduce((m,k)=>(m[`${k.type}-${k.source}`]=!0,m),{}))},[E,l,d,c,a]),e.jsx(ve,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:w(x),children:[e.jsx(Ee,{children:p(t?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Ce,{children:e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(J,{name:"url",control:r,rules:{required:p("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:p("webhookEndpoint.validation.urlInvalid")}},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.url.label"),fullWidth:!0,error:!!g.url,helperText:(k=g.url)==null?void 0:k.message})}}),e.jsx(J,{name:"description",control:r,rules:{required:p("webhookEndpoint.validation.descriptionRequired")},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!g.description,helperText:(k=g.description)==null?void 0:k.message})}}),e.jsx(J,{name:"selectedEvents",control:r,rules:{required:p("webhookEndpoint.validation.eventRequired")},render:({field:m})=>e.jsx("input",{type:"hidden",...m})}),!j&&h&&Object.keys(h).length>0&&e.jsx(te,{eventsBySource:h,selectedEvents:n,setSelectedEvents:l,error:(s=g.selectedEvents)==null?void 0:s.message}),!j&&(!h||Object.keys(h).length===0)&&e.jsx(S,{color:"text.secondary",children:p("webhookEndpoint.noAvailableEvents")}),j&&e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(U,{size:20})}),y&&e.jsx(ee,{severity:"error",children:p("webhookEndpoint.loadingError",{message:y==null?void 0:y.message})})]})}),e.jsxs(Te,{sx:{p:"8px 24px 24px"},children:[e.jsx(B,{onClick:i,children:p("common.cancel")}),e.jsx(B,{type:"submit",variant:"contained",color:"primary",children:p(t?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}oe.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};oe.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function he(t){switch(t){case"enabled":return"success";case"disabled":default:return"default"}}const Ze=(t="en")=>t==="tw"?"zh":t;function H(t,d="YYYY-MM-DD HH:mm:ss",c="en"){return t?ke(t).locale(Ze(c)).format(d):"-"}function et(t){return typeof t=="number"?!1:ue(t)}function tt(t){return t>=200&&t<300}function W(t){const d=et(t.value);return e.jsxs(e.Fragment,{children:[e.jsxs(P,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[t.label,!!t.tip&&e.jsx(A,{title:t.tip,children:e.jsx(Me,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:d?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:d?"-":t.value})]}),t.divider&&e.jsx(Pe,{orientation:"vertical",flexItem:!0})]})}W.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};W.defaultProps={tip:"",divider:!1};function ne(t){return e.jsxs(P,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:t.mb,mt:t.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:t.title}),t.children]})}ne.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};ne.defaultProps={children:null,mb:1.5,mt:1.5};const ot={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6m-7 1l9-9m-5 0h5v5"/>'},nt=t=>{const d={};return t.forEach(c=>{var b;const a=new Date(c.createdAt).toLocaleDateString();d[a]||(d[a]=[]),(b=d[a])==null||b.push(c)}),d};function se({eventId:t,webhookEndpointId:d,event:c}){const{api:a}=N(),{t:b}=q(),{teamDid:R}=F(),{blocklet:p}=ce(),{data:n,loadMore:l,loadingMore:v,loading:T}=ye(u=>{const i=u?Math.ceil(u.list.length/15)+1:1;return a.getWebhookAttempts({input:{teamDid:R,input:{eventId:t,webhookId:d},paging:{page:i,pageSize:15}}})},{reloadDeps:[t,d]}),j=(n==null?void 0:n.list)||[],[y,h]=C.useState(null),r=nt(j);C.useEffect(()=>{!y&&(n!=null&&n.list.length)&&h(n.list[0])},[n==null?void 0:n.list.length,y]);const w=u=>{h(u)};if(T)return e.jsx(U,{});const g=n&&n.list.length<n.paging.total,E=u=>{var M,i,x,s,m;if(u.responseBody&&((M=u.responseBody)!=null&&M.sessionId)&&((i=u.responseBody)!=null&&i.projectId)&&((x=u.responseBody)!=null&&x.agentId)){const k=(m=(s=p==null?void 0:p.site)==null?void 0:s.domainAliases[0])==null?void 0:m.value,D=(p.children||[]).find($=>{var L;return((L=$==null?void 0:$.meta)==null?void 0:L.name)==="ai-studio"}),I=Ye(Je(`https://${k}`,(D==null?void 0:D.mountPoint)||"","projects",u.responseBody.projectId,"logs/main"),{sessionId:u.responseBody.sessionId,agentId:u.responseBody.agentId});return e.jsx(_,{sx:{fontSize:20},onClick:()=>window.open(I,"_blank"),children:e.jsx(f,{component:be,icon:ot})})}return null};return e.jsxs(Y,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(Y,{item:!0,xs:12,md:4,height:1,children:ue(Object.keys(r))?e.jsx(S,{color:"text.secondary",children:b("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(G,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(r).map(([u,M])=>e.jsxs(X.Fragment,{children:[e.jsx(De,{children:u}),M.map(i=>e.jsxs(Q,{sx:{cursor:"pointer"},onClick:()=>w(i),selected:y===i,secondaryAction:e.jsx(S,{color:"text.secondary",children:H(i.createdAt,"HH:mm:ss")}),children:[e.jsx(We,{sx:{minWidth:0,mr:1.5},children:tt(i.responseStatus)===!1?e.jsx(ze,{color:"error"}):e.jsx(Ae,{color:"success"})}),e.jsx(Oe,{primary:e.jsx(S,{color:"text.primary",children:i.event.type})})]},i.id))]},u))}),g&&e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(B,{variant:"text",type:"button",color:"inherit",onClick:l,disabled:v,sx:{color:u=>u.palette.text.disabled},children:b(v?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(Y,{item:!0,xs:12,md:8,height:1,children:[y&&e.jsxs(P,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h6",children:t?y.endpoint.url:y.event.type}),e.jsx(f,{children:E(y)})]}),e.jsxs(f,{children:[e.jsxs(S,{variant:"h6",children:[b("webhookEndpoint.response")," (",y.responseStatus,")"]}),e.jsx(K,{language:"json",children:JSON.stringify(y.responseBody,null,2)})]}),e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.request")})}),e.jsx(K,{language:"json",sx:{margin:0},children:JSON.stringify(y.event,null,2)})]})]}),(n==null?void 0:n.list.length)===0&&c&&e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.eventData")})}),e.jsx(K,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}se.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};se.defaultProps={eventId:"",webhookEndpointId:"",event:null};function xe({id:t,onClose:d}){var v,T,j,y;const{t:c}=q(),{api:a}=N(),{teamDid:b}=F(),{loading:R,error:p,data:n}=de(()=>a.getWebhookEndpoint({input:{teamDid:b,id:t}})),l=n==null?void 0:n.data;return p?e.jsx(ee,{severity:"error",children:p.message}):R||!l?e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(U,{})}):e.jsxs(st,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(f,{children:[e.jsxs(P,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(P,{flex:1,width:0,children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:l.description}),e.jsx(A,{title:l.url,children:e.jsx(Z,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(P,{direction:"row",alignItems:"center",children:e.jsx(_,{edge:"end",color:"inherit",onClick:d,children:e.jsx(qe,{})})})]}),e.jsx(f,{mt:2,children:e.jsxs(P,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},justifyContent:"flex-start",flexWrap:"wrap",sx:{pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx(W,{label:c("common.status"),value:e.jsx(O,{size:"small",variant:"filled",label:l.status,color:he(l.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(W,{label:c("webhookEndpoint.listen"),value:e.jsx(A,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:l.enabledEvents.map(h=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:h==null?void 0:h.type},h))}),children:e.jsx(O,{size:"small",variant:"filled",label:c("webhookEndpoint.eventsCount",{count:l.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(W,{label:c("webhookEndpoint.version"),value:l.apiVersion,divider:!0}),e.jsx(W,{label:c("common.createdAt"),value:H(l.createdAt),divider:!0}),e.jsx(W,{label:c("common.updatedAt"),value:H(l.updatedAt),divider:!0}),e.jsx(W,{label:c("common.createdBy"),value:e.jsx(A,{arrow:!0,title:(v=l.createUser)==null?void 0:v.did,children:e.jsx(O,{size:"small",variant:"filled",label:(T=l.createUser)==null?void 0:T.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(W,{label:c("common.updatedBy"),value:e.jsx(A,{arrow:!0,title:(j=l.updateUser)==null?void 0:j.did,children:e.jsx(O,{size:"small",variant:"filled",label:(y=l.updateUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(P,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(ne,{title:c("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(P,{height:0,flex:1,overflow:"hidden",children:e.jsx(se,{webhookEndpointId:l.id})})]})]})}xe.propTypes={id:o.string.isRequired,onClose:o.func.isRequired};const st=pe(P)``;function me({open:t,onClose:d,id:c}){return e.jsx($e,{anchor:"right",open:t,onClose:d,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(f,{sx:{height:"100vh",p:3},children:e.jsx(xe,{id:c,onClose:d})})})}me.propTypes={open:o.bool.isRequired,onClose:o.func.isRequired,id:o.string.isRequired};function ae(){return null}const re=X.memo(({options:t,columns:d,toolbar:c=!0,footer:a=!0,hasRowLink:b=!1,emptyNodeText:R="",...p})=>{const{locale:n}=q(),l=Le(j=>j.breakpoints.down("md")),v={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:l?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},T={};return c||(T.TableToolbar=ae),a||(T.TableFooter=ae),e.jsx(rt,{locale:n,options:{...v,...t},columns:(d||[]).map(j=>(j.options=j.options||{},j.options.filter=j.options.filter||!1,j.options.sort=j.options.sort||!1,j)),emptyNode:e.jsx(fe,{children:R}),...p,components:T,hasRowLink:b,isMobile:l})});re.propTypes={options:o.object,columns:o.array,toolbar:o.bool,footer:o.bool,hasRowLink:o.bool,emptyNodeText:o.node,durable:o.string,durableKeys:o.array,data:o.array,loading:o.bool,onChange:o.func,title:o.node,components:o.object};re.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const rt=pe(ge)`
1
+ import{u as q,V as z,bK as K,i as be,X as fe,a2 as ge,bC as je}from"./vendor-ux-did-connect-D75Zatzm.js";import{w as ye,l as de,j as we}from"./vendor-hooks-CYyfK9g3.js";import{r as C,b as X}from"./vendor-react-DoD83n6N.js";import{d as Z}from"./InfoOutlined-HP5LuELQ.js";import{z as N,C as ce,G as ke}from"./index-C8sg0Ts_.js";import{u as F}from"./dashboard-BUwFD31P.js";import{E as o,j as e,D as ve,ab as Ee,r as Ce,a3 as f,M as ie,T as S,a2 as U,ac as ee,y as Te,x as B,bn as le,bO as V,a4 as A,L as G,z as Q,bg as Se,A as O,I as _,C as Re,bl as Ie,ad as P,cG as Me,ak as Pe,bd as Y,bk as De,b1 as We,cH as ze,cI as Ae,b2 as Oe,af as $e,bS as qe,s as pe,t as Le,cJ as Be,cK as He,cL as Ne,cM as Fe,cN as Ue}from"./vendor-mui-core-O22FPGM4.js";import{u as _e,C as J}from"./index.esm-CWepf7I_.js";import{n as Ke}from"./vendor-arcblock-E5QJEgSK.js";import{d as Ve}from"./ExpandLess-BqrBuxL9.js";import{y as ue,w as Ye,x as Je}from"./vendor-utils-CbeKtci8.js";import{C as Ge}from"./confirm-BaiaCWsM.js";import{A as Qe}from"./actions-CBPbCBQc.js";import"./lottie-web-B6s7dDoL.js";import"./useLocalStorage-CtbpqE0c.js";import"./PlayArrow-DI84Lay5.js";import"./get-safe-url-CXJBjnNj.js";import"./format-error-LAoTjvJe.js";import"./index-DMqGxTc4.js";import"./session-CD9NaM-v.js";import"./useAsyncRetry-CEJwVPZ6.js";import"./useAsync-D2OhgEkV.js";import"./useSetState-BL3ktMon.js";import"./MoreHoriz-Cv3BqpRU.js";const Xe=t=>{var j,y;const[d,c]=C.useState(null),[a,b]=C.useState(!t),[R,p]=C.useState(null),{blocklet:n}=ce(),l=(y=(j=n==null?void 0:n.site)==null?void 0:j.domainAliases[0])==null?void 0:y.value,v=C.useMemo(()=>{const h={};return d&&(d.sources.forEach(r=>{h[r.did]={source:r,events:[],count:0}}),d.events.forEach(r=>{h[r.source]&&(h[r.source].events.push(r),h[r.source].count+=1)})),h},[d]),T=async()=>{try{if(b(!0),!l)return;const r=await(await fetch(`https://${l}/.well-known/service/openevent.json`)).json();c(r),p(null)}catch(h){p(h instanceof Error?h:new Error(String(h)))}finally{b(!1)}};return C.useEffect(()=>{T()},[l]),{openEvent:d,setOpenEvent:c,eventsBySource:v,loading:a,error:R,loadData:T}};function te({eventsBySource:t,selectedEvents:d,setSelectedEvents:c,error:a}){const{t:b}=q(),[R,p]=C.useState({}),n=C.useMemo(()=>{const r={};return Object.entries(t).forEach(([w,{events:g}])=>{const E=g.filter(u=>d[`${u.type}-${u.source}`]).length;r[w]=E}),r},[t,d]),l=C.useMemo(()=>Object.values(n).reduce((r,w)=>r+w,0),[n]),v=C.useMemo(()=>Object.values(t).reduce((r,{events:w})=>r+w.length,0),[t]),T=(r,w)=>{w.stopPropagation(),p({...R,[r]:!R[r]})},j=r=>{const w=`${r.type}-${r.source}`;c(g=>({...g,[w]:!g[w]}))},y=(r,w)=>{const g={};r.forEach(E=>{const u=`${E.type}-${E.source}`;g[u]=!w}),c(E=>({...E,...g}))},h=r=>{const w={};Object.values(t).forEach(({events:g})=>{g.forEach(E=>{const u=`${E.type}-${E.source}`;w[u]=r.target.checked})}),c(w)};return e.jsxs(f,{sx:{width:"100%"},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(le,{control:e.jsx(V,{onChange:h,checked:l>0&&l===v}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[b("webhookEndpoint.selectAllEvents"),e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:e.jsx(A,{title:b("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(Z,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:b("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(f,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(G,{disablePadding:!0,sx:{border:"1px solid #e0e0e0",borderRadius:"4px"},children:Object.entries(t).map(([r,{source:w,events:g,count:E}],u)=>{const M=n[r]>0,i=n[r]===g.length&&g.length>0,x=R[r];return e.jsxs(X.Fragment,{children:[e.jsx(Q,{sx:{borderBottom:u<Object.keys(t).length-1?"1px solid #f0f0f0":"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(f,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:s=>{s.target.closest(".MuiFormControlLabel-root")||T(r,s)},children:[e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:g.length>0&&e.jsx(le,{control:e.jsx(V,{checked:i,indeterminate:M&&!i,onChange:s=>{s.stopPropagation(),y(g,i)}}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[w.logo&&e.jsx(Se,{src:w.logo,sx:{width:24,height:24}}),e.jsx(f,{children:w.title||r}),M&&e.jsx(O,{label:b("webhookEndpoint.selectedCount",{count:n[r]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:s=>`${s.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(f,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:b("webhookEndpoint.eventsCount",{count:E})}),g.length>0&&e.jsx(_,{size:"small",edge:"end",children:x?e.jsx(Ve,{}):e.jsx(Ke,{})})]})]})}),g.length>0&&e.jsx(Re,{in:x,timeout:"auto",unmountOnExit:!0,children:e.jsx(G,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:g.map(s=>{const m=`${s.type}-${s.source}`,k=!!d[m];return e.jsx(Q,{dense:!0,sx:{py:.75},onClick:()=>j(s),children:e.jsxs(f,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(V,{checked:k,sx:{mr:1}}),e.jsxs(f,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer"},children:s.type}),e.jsx(S,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:s.description})]})]})},m)})})})]},r)})})}),a&&e.jsx(Ie,{error:!0,sx:{mt:1},children:a})]})}te.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};te.defaultProps={error:null};function oe({id:t,url:d,description:c,enabledEvents:a,onSubmit:b,onClose:R}){var s;const{t:p}=q(),[n,l]=C.useState({}),{teamDid:v}=F(),{api:T}=N(),{loading:j,error:y,eventsBySource:h}=Xe(),{control:r,handleSubmit:w,formState:{errors:g},reset:E,setValue:u,trigger:M}=_e({defaultValues:{url:"",description:""}});C.useEffect(()=>{const m=Object.values(n).some(k=>k);u("selectedEvents",m?"valid":""),M("selectedEvents")},[n,u,M]);const i=()=>{l({}),E(),R()},x=async m=>{const k=Object.keys(n).filter(I=>n[I]),D={url:m.url,description:m.description,enabledEvents:k.map(I=>{const[$,L]=I.split("-");return!$||!L?null:{type:$,source:L}}).filter(Boolean)};try{if(t){const I=await T.updateWebhookEndpoint({input:{teamDid:v,id:t,data:D}});z.success(`${p("webhookEndpoint.updateWebhook")} ${p("webhookEndpoint.success")}`),b(I)}else{const I=await T.createWebhookEndpoint({input:{teamDid:v,input:D}});z.success(`${p("webhookEndpoint.createWebhook")} ${p("webhookEndpoint.success")}`),b(I)}}catch(I){z.error(I==null?void 0:I.message)}i()};return C.useEffect(()=>{E({url:d,description:c}),l(a.reduce((m,k)=>(m[`${k.type}-${k.source}`]=!0,m),{}))},[E,l,d,c,a]),e.jsx(ve,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:w(x),children:[e.jsx(Ee,{children:p(t?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Ce,{children:e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(J,{name:"url",control:r,rules:{required:p("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:p("webhookEndpoint.validation.urlInvalid")}},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.url.label"),fullWidth:!0,error:!!g.url,helperText:(k=g.url)==null?void 0:k.message})}}),e.jsx(J,{name:"description",control:r,rules:{required:p("webhookEndpoint.validation.descriptionRequired")},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!g.description,helperText:(k=g.description)==null?void 0:k.message})}}),e.jsx(J,{name:"selectedEvents",control:r,rules:{required:p("webhookEndpoint.validation.eventRequired")},render:({field:m})=>e.jsx("input",{type:"hidden",...m})}),!j&&h&&Object.keys(h).length>0&&e.jsx(te,{eventsBySource:h,selectedEvents:n,setSelectedEvents:l,error:(s=g.selectedEvents)==null?void 0:s.message}),!j&&(!h||Object.keys(h).length===0)&&e.jsx(S,{color:"text.secondary",children:p("webhookEndpoint.noAvailableEvents")}),j&&e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(U,{size:20})}),y&&e.jsx(ee,{severity:"error",children:p("webhookEndpoint.loadingError",{message:y==null?void 0:y.message})})]})}),e.jsxs(Te,{sx:{p:"8px 24px 24px"},children:[e.jsx(B,{onClick:i,children:p("common.cancel")}),e.jsx(B,{type:"submit",variant:"contained",color:"primary",children:p(t?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}oe.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};oe.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function he(t){switch(t){case"enabled":return"success";case"disabled":default:return"default"}}const Ze=(t="en")=>t==="tw"?"zh":t;function H(t,d="YYYY-MM-DD HH:mm:ss",c="en"){return t?ke(t).locale(Ze(c)).format(d):"-"}function et(t){return typeof t=="number"?!1:ue(t)}function tt(t){return t>=200&&t<300}function W(t){const d=et(t.value);return e.jsxs(e.Fragment,{children:[e.jsxs(P,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[t.label,!!t.tip&&e.jsx(A,{title:t.tip,children:e.jsx(Me,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:d?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:d?"-":t.value})]}),t.divider&&e.jsx(Pe,{orientation:"vertical",flexItem:!0})]})}W.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};W.defaultProps={tip:"",divider:!1};function ne(t){return e.jsxs(P,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:t.mb,mt:t.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:t.title}),t.children]})}ne.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};ne.defaultProps={children:null,mb:1.5,mt:1.5};const ot={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6m-7 1l9-9m-5 0h5v5"/>'},nt=t=>{const d={};return t.forEach(c=>{var b;const a=new Date(c.createdAt).toLocaleDateString();d[a]||(d[a]=[]),(b=d[a])==null||b.push(c)}),d};function se({eventId:t,webhookEndpointId:d,event:c}){const{api:a}=N(),{t:b}=q(),{teamDid:R}=F(),{blocklet:p}=ce(),{data:n,loadMore:l,loadingMore:v,loading:T}=ye(u=>{const i=u?Math.ceil(u.list.length/15)+1:1;return a.getWebhookAttempts({input:{teamDid:R,input:{eventId:t,webhookId:d},paging:{page:i,pageSize:15}}})},{reloadDeps:[t,d]}),j=(n==null?void 0:n.list)||[],[y,h]=C.useState(null),r=nt(j);C.useEffect(()=>{!y&&(n!=null&&n.list.length)&&h(n.list[0])},[n==null?void 0:n.list.length,y]);const w=u=>{h(u)};if(T)return e.jsx(U,{});const g=n&&n.list.length<n.paging.total,E=u=>{var M,i,x,s,m;if(u.responseBody&&((M=u.responseBody)!=null&&M.sessionId)&&((i=u.responseBody)!=null&&i.projectId)&&((x=u.responseBody)!=null&&x.agentId)){const k=(m=(s=p==null?void 0:p.site)==null?void 0:s.domainAliases[0])==null?void 0:m.value,D=(p.children||[]).find($=>{var L;return((L=$==null?void 0:$.meta)==null?void 0:L.name)==="ai-studio"}),I=Ye(Je(`https://${k}`,(D==null?void 0:D.mountPoint)||"","projects",u.responseBody.projectId,"logs/main"),{sessionId:u.responseBody.sessionId,agentId:u.responseBody.agentId});return e.jsx(_,{sx:{fontSize:20},onClick:()=>window.open(I,"_blank"),children:e.jsx(f,{component:be,icon:ot})})}return null};return e.jsxs(Y,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(Y,{item:!0,xs:12,md:4,height:1,children:ue(Object.keys(r))?e.jsx(S,{color:"text.secondary",children:b("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(G,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(r).map(([u,M])=>e.jsxs(X.Fragment,{children:[e.jsx(De,{children:u}),M.map(i=>e.jsxs(Q,{sx:{cursor:"pointer"},onClick:()=>w(i),selected:y===i,secondaryAction:e.jsx(S,{color:"text.secondary",children:H(i.createdAt,"HH:mm:ss")}),children:[e.jsx(We,{sx:{minWidth:0,mr:1.5},children:tt(i.responseStatus)===!1?e.jsx(ze,{color:"error"}):e.jsx(Ae,{color:"success"})}),e.jsx(Oe,{primary:e.jsx(S,{color:"text.primary",children:i.event.type})})]},i.id))]},u))}),g&&e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(B,{variant:"text",type:"button",color:"inherit",onClick:l,disabled:v,sx:{color:u=>u.palette.text.disabled},children:b(v?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(Y,{item:!0,xs:12,md:8,height:1,children:[y&&e.jsxs(P,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h6",children:t?y.endpoint.url:y.event.type}),e.jsx(f,{children:E(y)})]}),e.jsxs(f,{children:[e.jsxs(S,{variant:"h6",children:[b("webhookEndpoint.response")," (",y.responseStatus,")"]}),e.jsx(K,{language:"json",children:JSON.stringify(y.responseBody,null,2)})]}),e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.request")})}),e.jsx(K,{language:"json",sx:{margin:0},children:JSON.stringify(y.event,null,2)})]})]}),(n==null?void 0:n.list.length)===0&&c&&e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.eventData")})}),e.jsx(K,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}se.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};se.defaultProps={eventId:"",webhookEndpointId:"",event:null};function xe({id:t,onClose:d}){var v,T,j,y;const{t:c}=q(),{api:a}=N(),{teamDid:b}=F(),{loading:R,error:p,data:n}=de(()=>a.getWebhookEndpoint({input:{teamDid:b,id:t}})),l=n==null?void 0:n.data;return p?e.jsx(ee,{severity:"error",children:p.message}):R||!l?e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(U,{})}):e.jsxs(st,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(f,{children:[e.jsxs(P,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(P,{flex:1,width:0,children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:l.description}),e.jsx(A,{title:l.url,children:e.jsx(Z,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(P,{direction:"row",alignItems:"center",children:e.jsx(_,{edge:"end",color:"inherit",onClick:d,children:e.jsx(qe,{})})})]}),e.jsx(f,{mt:2,children:e.jsxs(P,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},justifyContent:"flex-start",flexWrap:"wrap",sx:{pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx(W,{label:c("common.status"),value:e.jsx(O,{size:"small",variant:"filled",label:l.status,color:he(l.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(W,{label:c("webhookEndpoint.listen"),value:e.jsx(A,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:l.enabledEvents.map(h=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:h==null?void 0:h.type},h))}),children:e.jsx(O,{size:"small",variant:"filled",label:c("webhookEndpoint.eventsCount",{count:l.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(W,{label:c("webhookEndpoint.version"),value:l.apiVersion,divider:!0}),e.jsx(W,{label:c("common.createdAt"),value:H(l.createdAt),divider:!0}),e.jsx(W,{label:c("common.updatedAt"),value:H(l.updatedAt),divider:!0}),e.jsx(W,{label:c("common.createdBy"),value:e.jsx(A,{arrow:!0,title:(v=l.createUser)==null?void 0:v.did,children:e.jsx(O,{size:"small",variant:"filled",label:(T=l.createUser)==null?void 0:T.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(W,{label:c("common.updatedBy"),value:e.jsx(A,{arrow:!0,title:(j=l.updateUser)==null?void 0:j.did,children:e.jsx(O,{size:"small",variant:"filled",label:(y=l.updateUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(P,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(ne,{title:c("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(P,{height:0,flex:1,overflow:"hidden",children:e.jsx(se,{webhookEndpointId:l.id})})]})]})}xe.propTypes={id:o.string.isRequired,onClose:o.func.isRequired};const st=pe(P)``;function me({open:t,onClose:d,id:c}){return e.jsx($e,{anchor:"right",open:t,onClose:d,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(f,{sx:{height:"100vh",p:3},children:e.jsx(xe,{id:c,onClose:d})})})}me.propTypes={open:o.bool.isRequired,onClose:o.func.isRequired,id:o.string.isRequired};function ae(){return null}const re=X.memo(({options:t,columns:d,toolbar:c=!0,footer:a=!0,hasRowLink:b=!1,emptyNodeText:R="",...p})=>{const{locale:n}=q(),l=Le(j=>j.breakpoints.down("md")),v={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:l?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},T={};return c||(T.TableToolbar=ae),a||(T.TableFooter=ae),e.jsx(rt,{locale:n,options:{...v,...t},columns:(d||[]).map(j=>(j.options=j.options||{},j.options.filter=j.options.filter||!1,j.options.sort=j.options.sort||!1,j)),emptyNode:e.jsx(fe,{children:R}),...p,components:T,hasRowLink:b,isMobile:l})});re.propTypes={options:o.object,columns:o.array,toolbar:o.bool,footer:o.bool,hasRowLink:o.bool,emptyNodeText:o.node,durable:o.string,durableKeys:o.array,data:o.array,loading:o.bool,onChange:o.func,title:o.node,components:o.object};re.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const rt=pe(ge)`
2
2
  .MuiPaper-root {
3
3
  border-radius: 8px;
4
4
  overflow: hidden;
@@ -1,4 +1,4 @@
1
- import{r as d}from"./vendor-react-DoD83n6N.js";import{E as l,j as r,a3 as g,aj as G,M as H,I as O,a2 as U,bT as Y,a9 as J}from"./vendor-mui-core-O22FPGM4.js";import{aX as Q,f as Z}from"./vendor-ux-did-connect-D75Zatzm.js";import{d as v}from"./Done-B8c93MpP.js";import{C as ee}from"./Google-CBPWeaVC.js";import{aa as te,f as re}from"./index-CYdNDqQ1.js";import{l as ne}from"./vendor-arcblock-E5QJEgSK.js";import{R as oe,F as se,L as ie}from"./logo-uploader-DQCS5qZW.js";const S={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 T({editing:n,value:o,onChange:a}){const[c,u]=d.useState(!1),m=d.useRef(),p=d.useRef(o);d.useEffect(()=>{let s=null;return n&&(s=setTimeout(()=>{u(!0)},50)),()=>{clearTimeout(s)}},[n]);const k=s=>{p.current=s,a(s)},C=()=>{u(!1),a(p.current)},b=r.jsx(g,{className:"form-item-input slot",px:1,children:r.jsxs(g,{display:"flex",alignItems:"center",children:[o,o!=="auto"&&r.jsx("div",{style:{marginLeft:4,backgroundColor:o,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),f=r.jsxs(g,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:C,children:[r.jsx(g,{display:"flex",alignItems:"center",onClick:()=>u(!0),children:r.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"}})}),r.jsx(G,{open:c,anchorEl:m.current,onClose:()=>u(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:r.jsx(ee,{color:o,onChange:s=>k(s.hex)})})]});return n?f:b}T.propTypes=S;function _({editing:n,description:o,value:a,onChange:c,componentProps:u,...m}){const{placeholder:p}=u,k=d.useRef(a),{t:C}=d.useContext(Q),b=s=>{s.key==="Enter"&&c(k.current,"confirm")},f=s=>{k.current=s,c(s)};return n?r.jsx(H,{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:b,...m}):r.jsx(g,{px:1,className:"form-item-input slot",children:a||r.jsx("span",{className:"placeholder",children:C("common.requiredInputPlaceholder",{name:o||p})})})}_.propTypes=S;_.defaultProps={componentProps:{}};function D({editing:n,value:o,onChange:a,componentProps:c,...u}){const{blocklet:m}=c,p=o==="auto"?ne.getPassportColorFromDid(m.appDid):o;return r.jsxs(g,{display:"flex",alignItems:"center",children:[r.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:te({title:"Owner",issuer:re.getDisplayName(m),issuerDid:m.appDid,ownerName:"Your Name",ownerDid:m.appDid,preferredColor:o||"auto"})}}),r.jsx(T,{...u,editing:n,value:n?p:o,onChange:a,componentProps:c})]})}D.propTypes={...S,componentProps:l.shape({blocklet:l.object.isRequired}).isRequired};D.defaultProps={};const ae=Y`
1
+ import{r as d}from"./vendor-react-DoD83n6N.js";import{E as l,j as r,a3 as g,aj as G,M as H,I as O,a2 as U,bT as Y,a9 as J}from"./vendor-mui-core-O22FPGM4.js";import{aX as Q,f as Z}from"./vendor-ux-did-connect-D75Zatzm.js";import{d as v}from"./Done-B8c93MpP.js";import{C as ee}from"./Google-CBPWeaVC.js";import{aa as te,f as re}from"./index-C8sg0Ts_.js";import{l as ne}from"./vendor-arcblock-E5QJEgSK.js";import{R as oe,F as se,L as ie}from"./logo-uploader-DtUHte5C.js";const S={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 T({editing:n,value:o,onChange:a}){const[c,u]=d.useState(!1),m=d.useRef(),p=d.useRef(o);d.useEffect(()=>{let s=null;return n&&(s=setTimeout(()=>{u(!0)},50)),()=>{clearTimeout(s)}},[n]);const k=s=>{p.current=s,a(s)},C=()=>{u(!1),a(p.current)},b=r.jsx(g,{className:"form-item-input slot",px:1,children:r.jsxs(g,{display:"flex",alignItems:"center",children:[o,o!=="auto"&&r.jsx("div",{style:{marginLeft:4,backgroundColor:o,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),f=r.jsxs(g,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:C,children:[r.jsx(g,{display:"flex",alignItems:"center",onClick:()=>u(!0),children:r.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"}})}),r.jsx(G,{open:c,anchorEl:m.current,onClose:()=>u(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:r.jsx(ee,{color:o,onChange:s=>k(s.hex)})})]});return n?f:b}T.propTypes=S;function _({editing:n,description:o,value:a,onChange:c,componentProps:u,...m}){const{placeholder:p}=u,k=d.useRef(a),{t:C}=d.useContext(Q),b=s=>{s.key==="Enter"&&c(k.current,"confirm")},f=s=>{k.current=s,c(s)};return n?r.jsx(H,{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:b,...m}):r.jsx(g,{px:1,className:"form-item-input slot",children:a||r.jsx("span",{className:"placeholder",children:C("common.requiredInputPlaceholder",{name:o||p})})})}_.propTypes=S;_.defaultProps={componentProps:{}};function D({editing:n,value:o,onChange:a,componentProps:c,...u}){const{blocklet:m}=c,p=o==="auto"?ne.getPassportColorFromDid(m.appDid):o;return r.jsxs(g,{display:"flex",alignItems:"center",children:[r.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:te({title:"Owner",issuer:re.getDisplayName(m),issuerDid:m.appDid,ownerName:"Your Name",ownerDid:m.appDid,preferredColor:o||"auto"})}}),r.jsx(T,{...u,editing:n,value:n?p:o,onChange:a,componentProps:c})]})}D.propTypes={...S,componentProps:l.shape({blocklet:l.object.isRequired}).isRequired};D.defaultProps={};const ae=Y`
2
2
  0%, 100% {
3
3
  transform: scale(1) translateX(0);
4
4
  }
@@ -1,4 +1,4 @@
1
- import{j as t,a2 as h,a3 as c,E as d,a9 as g}from"./vendor-mui-core-O22FPGM4.js";import{r as y}from"./vendor-react-DoD83n6N.js";import{aX as v,C as w,B as m}from"./vendor-ux-did-connect-D75Zatzm.js";import{P}from"./page-header-DyeTxe1U.js";import{C as E}from"./index-CYdNDqQ1.js";import{u as T}from"./config-space-BZu4nd7t.js";import{C as B,D,a as N}from"./connect-to-CAjdR1Vi.js";import{S as u}from"./step-actions-C83ykph7.js";import{S as b}from"./layout-Bkn9nC3f.js";import"./vendor-utils-CbeKtci8.js";import"./vendor-hooks-CYyfK9g3.js";import"./lottie-web-B6s7dDoL.js";import"./vendor-arcblock-E5QJEgSK.js";import"./api-CvDkueg1.js";import"./DeleteOutline-D4DYIaUj.js";import"./format-error-LAoTjvJe.js";import"./content-layout--DV54O6i.js";function l({onNext:a,onPrevious:x}){var n,r,p;const{t:i}=y.useContext(v),{blocklet:e}=E(),{spaceGateway:f,settingStorageEndpoint:C,updateSpaceGateway:j,hasStorageEndpoint:S,loading:o,storageEndpoint:s}=T();return o?t.jsx(w,{relative:"parent",children:t.jsx(h,{})}):t.jsxs(G,{children:[t.jsx("div",{className:"header",children:t.jsx(P,{title:i("setup.didSpace.title"),subTitle:i("setup.didSpace.subTitle"),onClickBack:x})}),t.jsx(c,{sx:{width:"100%",maxWidth:"720px"},children:S?t.jsx(B,{spaceGateway:f,settingStorageEndpoint:C}):t.jsx(D,{})}),((n=e==null?void 0:e.capabilities)==null?void 0:n.didSpace)&&t.jsx(c,{display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"24px",children:t.jsx(N,{onConnect:j,storageEndpoint:s})}),((r=e==null?void 0:e.capabilities)==null?void 0:r.didSpace)==="required"&&t.jsx(u,{mt:8,children:t.jsx(m,{loading:o,variant:"contained",disabled:o||!s,onClick:()=>a(),children:i("setup.continue")})}),((p=e==null?void 0:e.capabilities)==null?void 0:p.didSpace)==="optional"&&t.jsx(u,{blocklet:e,onStartNow:()=>a("complete"),children:t.jsx(m,{className:"start-now",loading:o,variant:"contained",disabled:o,onClick:()=>a(),children:i(s?"setup.continue":"setup.skip")})})]})}l.propTypes={onNext:d.func,onPrevious:d.func};l.defaultProps={onNext:()=>{},onPrevious:()=>{}};const G=g(b)`
1
+ import{j as t,a2 as h,a3 as c,E as d,a9 as g}from"./vendor-mui-core-O22FPGM4.js";import{r as y}from"./vendor-react-DoD83n6N.js";import{aX as v,C as w,B as m}from"./vendor-ux-did-connect-D75Zatzm.js";import{P}from"./page-header-DyeTxe1U.js";import{C as E}from"./index-C8sg0Ts_.js";import{u as T}from"./config-space-BjgJ--W4.js";import{C as B,D,a as N}from"./connect-to-CChFecmc.js";import{S as u}from"./step-actions-Zukntbkg.js";import{S as b}from"./layout-MdeSR5MO.js";import"./vendor-utils-CbeKtci8.js";import"./vendor-hooks-CYyfK9g3.js";import"./lottie-web-B6s7dDoL.js";import"./vendor-arcblock-E5QJEgSK.js";import"./api-CvDkueg1.js";import"./DeleteOutline-D4DYIaUj.js";import"./format-error-LAoTjvJe.js";import"./content-layout--DV54O6i.js";function l({onNext:a,onPrevious:x}){var n,r,p;const{t:i}=y.useContext(v),{blocklet:e}=E(),{spaceGateway:f,settingStorageEndpoint:C,updateSpaceGateway:j,hasStorageEndpoint:S,loading:o,storageEndpoint:s}=T();return o?t.jsx(w,{relative:"parent",children:t.jsx(h,{})}):t.jsxs(G,{children:[t.jsx("div",{className:"header",children:t.jsx(P,{title:i("setup.didSpace.title"),subTitle:i("setup.didSpace.subTitle"),onClickBack:x})}),t.jsx(c,{sx:{width:"100%",maxWidth:"720px"},children:S?t.jsx(B,{spaceGateway:f,settingStorageEndpoint:C}):t.jsx(D,{})}),((n=e==null?void 0:e.capabilities)==null?void 0:n.didSpace)&&t.jsx(c,{display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"24px",children:t.jsx(N,{onConnect:j,storageEndpoint:s})}),((r=e==null?void 0:e.capabilities)==null?void 0:r.didSpace)==="required"&&t.jsx(u,{mt:8,children:t.jsx(m,{loading:o,variant:"contained",disabled:o||!s,onClick:()=>a(),children:i("setup.continue")})}),((p=e==null?void 0:e.capabilities)==null?void 0:p.didSpace)==="optional"&&t.jsx(u,{blocklet:e,onStartNow:()=>a("complete"),children:t.jsx(m,{className:"start-now",loading:o,variant:"contained",disabled:o,onClick:()=>a(),children:i(s?"setup.continue":"setup.skip")})})]})}l.propTypes={onNext:d.func,onPrevious:d.func};l.defaultProps={onNext:()=>{},onPrevious:()=>{}};const G=g(b)`
2
2
  height: 100%;
3
3
  overflow-y: auto;
4
4
  `;export{l as default};
@@ -1,4 +1,4 @@
1
- import{r as U,e as Tt,g as Dn,a as Xe,f as Ma}from"./vendor-react-DoD83n6N.js";import{a1 as Y,j as h,E as H,a9 as kr,P as Ca,b$ as ps,bP as Sa,M as Q,a3 as F,A as En,I as Ge,a2 as _t,bl as ji,x as Ke,T as at,bn as ue,bO as Gt,br as ka,ac as Oa,ad as dt,K as Ri,ak as Nr,bd as bt,bo as it,bj as ae,c0 as $a,e as Yt,Z as Mi,a4 as Ve,c1 as Pa,c2 as Ta,c3 as Aa,c4 as et,bU as ot,c5 as Ci,c6 as Ln,c7 as Bn,c8 as Ia,c9 as Si,ca as qa,cb as Da,b0 as ht,cc as Ea,cd as La,ce as Ba,cf as Na,cg as Fa,ch as za,ci as Wa,cj as Ha,ck as Ua,cl as Va,cm as Ka,cn as Fr,bE as Ja,C as Ga,bM as Za,bz as ki,bA as Oi}from"./vendor-mui-core-O22FPGM4.js";import{I as Ya}from"./iframe-C0FAfo1V.js";import{r as Xa,as as Qa,G as wt,w as eo,x as Mr,a0 as to,c as ms,A as Zt,n as Ye,at as ro,y as no,O as zr,au as so,av as gs,K as $i,F as xt,J as Pi}from"./vendor-utils-CbeKtci8.js";import{r as pt,f as vs,u as Ue,B as de,V as Z,am as Ti,n as io,ak as Rt,bE as ao,a as oo,aj as ft,p as pe,P as ys,aX as lt,a1 as Xt,X as Ai,aq as Nn,bF as lo,bG as co,j as Dr,i as be,bH as uo,bI as fo,a8 as ho,a9 as po,a7 as mo,aZ as bs,bJ as $n,bK as go,bL as vo,a2 as Wr,_ as yo}from"./vendor-ux-did-connect-D75Zatzm.js";import{t as Ii,a as rt,u as z,f as jt,c as bo,l as Cr,k as qi}from"./vendor-hooks-CYyfK9g3.js";import{A as Di,d as xs}from"./config-C3tQWDAE.js";import{F as xo,d as _o}from"./form-text-input-C8x5debf.js";import{d as _s}from"./ChevronRight-Bpkf9aqI.js";import{y as Ei,z as wo,B as jo,C as Ro,i as ws,h as js,r as Mo,n as Rs}from"./vendor-arcblock-E5QJEgSK.js";import{z as De,C as Je,f as Li,av as Co,m as So,au as ko,v as Ms,h as He,O as Oo,Q as $o}from"./index-CYdNDqQ1.js";import{B as Po}from"./bundle-avatar-Eqwd2qUG.js";import{u as To,B as Ao}from"./index-BsMTGy4m.js";import{d as Io}from"./Done-B8c93MpP.js";import{F as qo,R as Do,L as Et}from"./logo-uploader-DQCS5qZW.js";import{w as Bi,P as Eo}from"./permission-ZvUR5Tj-.js";import{C as Fn}from"./confirm-CCmbVvGp.js";import{f as Sr}from"./format-error-LAoTjvJe.js";import{_ as Lo}from"./useSetState-BL3ktMon.js";import{u as Ni}from"./session-CD9NaM-v.js";import{C as Bo}from"./click-to-copy-Dc16fHKA.js";import{u as Hr,a as No}from"./dashboard-C2dbiNOp.js";import{I as Fi}from"./index-D5rqbUOM.js";import{W as Fo}from"./did-address-DIKoCoBp.js";import{V as zo,K as Wo}from"./status-D8ugfvVU.js";import{u as ct,C as G,a as Cs}from"./index.esm-CWepf7I_.js";import{S as Ur}from"./switch-control-CJ1duVKM.js";import{b as Ho}from"./base32-gJJTbpiB.js";import{S as hn}from"./simple-select-ZyzPurqn.js";import"./lottie-web-B6s7dDoL.js";import"./EditIcon-SYuT6kHe.js";import"./ArrowDropDown-ydRfHJ2x.js";import"./index-tUQxVYYQ.js";import"./useLocalStorage-CtbpqE0c.js";import"./PlayArrow-DI84Lay5.js";import"./get-safe-url-BvS0hy8W.js";import"./useAsyncRetry-CEJwVPZ6.js";import"./useAsync-D2OhgEkV.js";import"./InfoOutlined-HP5LuELQ.js";import"./omit-DVwO9e3E.js";var zn={},Uo=Y;Object.defineProperty(zn,"__esModule",{value:!0});var zi=zn.default=void 0,Vo=Uo(pt()),Ko=h;zi=zn.default=(0,Vo.default)((0,Ko.jsx)("path",{d:"M3 18c0 .55.45 1 1 1h5v-2H4c-.55 0-1 .45-1 1M3 6c0 .55.45 1 1 1h9V5H4c-.55 0-1 .45-1 1m10 14v-1h7c.55 0 1-.45 1-1s-.45-1-1-1h-7v-1c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1s1-.45 1-1M7 10v1H4c-.55 0-1 .45-1 1s.45 1 1 1h3v1c0 .55.45 1 1 1s1-.45 1-1v-4c0-.55-.45-1-1-1s-1 .45-1 1m14 2c0-.55-.45-1-1-1h-9v2h9c.55 0 1-.45 1-1m-5-3c.55 0 1-.45 1-1V7h3c.55 0 1-.45 1-1s-.45-1-1-1h-3V4c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1"}),"TuneRounded");var Wn={},Jo=Y;Object.defineProperty(Wn,"__esModule",{value:!0});var Wi=Wn.default=void 0,Go=Jo(pt()),Zo=h;Wi=Wn.default=(0,Go.default)((0,Zo.jsx)("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3"}),"Key");var Hn={},Yo=Y;Object.defineProperty(Hn,"__esModule",{value:!0});var Hi=Hn.default=void 0,Xo=Yo(pt()),Qo=h;Hi=Hn.default=(0,Xo.default)((0,Qo.jsx)("path",{d:"M11 7 9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8z"}),"Login");var Un={},el=Y;Object.defineProperty(Un,"__esModule",{value:!0});var Ui=Un.default=void 0,tl=el(pt()),rl=h;Ui=Un.default=(0,tl.default)((0,rl.jsx)("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2m6-6v-5c0-3.07-1.63-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.64 5.36 6 7.92 6 11v5l-2 2v1h16v-1zm-2 1H8v-6c0-2.48 1.51-4.5 4-4.5s4 2.02 4 4.5z"}),"NotificationsNone");const nl={width:24,height:24,body:'<path fill="currentColor" d="M4.975 15q-.425 0-.7-.288T4 14q0-.425.288-.713T5 13h14.025q.425 0 .7.288T20 14q0 .425-.288.713T19 15H4.975Zm0 4q-.425 0-.7-.288T4 18q0-.425.288-.713T5 17h14.025q.425 0 .7.288T20 18q0 .425-.288.713T19 19H4.975Zm0-8q-.425 0-.7-.288T4 10q0-.425.288-.713T5 9h14.025q.425 0 .7.288T20 10q0 .425-.288.713T19 11H4.975Zm0-4q-.425 0-.7-.288T4 6q0-.425.288-.713T5 5h14.025q.425 0 .7.288T20 6q0 .425-.288.713T19 7H4.975Z"/>'},sl=nl;var Vn={},il=Y;Object.defineProperty(Vn,"__esModule",{value:!0});var Vi=Vn.default=void 0,al=il(pt()),ol=h;Vi=Vn.default=(0,al.default)((0,ol.jsx)("path",{d:"M16 13c3.09-2.81 6-5.44 6-7.7C22 3.45 20.55 2 18.7 2c-1.04 0-2.05.49-2.7 1.25C15.34 2.49 14.34 2 13.3 2 11.45 2 10 3.45 10 5.3c0 2.26 2.91 4.89 6 7.7m-2.7-9c.44 0 .89.21 1.18.55L16 6.34l1.52-1.79c.29-.34.74-.55 1.18-.55.74 0 1.3.56 1.3 1.3 0 1.12-2.04 3.17-4 4.99-1.96-1.82-4-3.88-4-4.99 0-.74.56-1.3 1.3-1.3M19 16h-2c0-1.2-.75-2.28-1.87-2.7L8.97 11H1v11h6v-1.44l7 1.94 8-2.5v-1c0-1.66-1.34-3-3-3M3 20v-7h2v7zm10.97.41L7 18.48V13h1.61l5.82 2.17c.34.13.57.46.57.83 0 0-1.99-.05-2.3-.15l-2.38-.79-.63 1.9 2.38.79c.51.17 1.04.26 1.58.26H19c.39 0 .74.23.9.56z"}),"VolunteerActivismOutlined");var Kn={},ll=Y;Object.defineProperty(Kn,"__esModule",{value:!0});var Jn=Kn.default=void 0,cl=ll(pt()),Ss=h;Jn=Kn.default=(0,cl.default)([(0,Ss.jsx)("path",{d:"M21 7.28V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-2.28c.59-.35 1-.98 1-1.72V9c0-.74-.41-1.37-1-1.72M20 9v6h-7V9zM5 19V5h14v2h-6c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h6v2z"},"0"),(0,Ss.jsx)("circle",{cx:"16",cy:"12",r:"1.5"},"1")],"AccountBalanceWalletOutlined");function Gn({label:v,disabled:T,required:O,initialValue:S,onChange:P,style:u,onSubmit:R,triggers:r,options:g,formatterBeforeSubmit:m,helperText:f,placeholder:e,renderImage:n,renderLabel:a,filterKeys:i,noEmpty:s,...p}){const[o,t]=U.useState(!1),[c,y]=U.useState(!1),[x,C]=U.useState(""),M=U.useRef(null),[d,b]=U.useState(S),[_,A]=U.useState(d),N=U.useMemo(()=>{if(!g)return{};const D={};return g.forEach(L=>{D[L.code]=L}),D},[g]),$=()=>{if(!g)return[];if(!x)return g.map(L=>L.code);const D=new RegExp(x.toLowerCase());return g.filter(L=>{var B;for(let I=0;I<i.length;I++){const j=i[I];if(D.test((B=L[j])==null?void 0:B.toLowerCase()))return!0}return!1}).map(L=>L.code)},l=async()=>{y(!0);try{await R(typeof m=="function"?m(_):_)===!1?A(d):s&&!_.length?(A(S),b(S)):(A(_),b(_))}catch{A(d)}finally{y(!1),t(!1)}},w=(D,L)=>{if(!Array.isArray(L)){A([]),P([]);return}const B=L.filter(I=>N[I]);if(!B.length){A([]),P([]);return}A(B),P(B)},k=D=>{D.stopPropagation(),t(!0),setTimeout(()=>{if(M.current){const L=M.current.querySelector("input");L&&L.focus()}},500)},q=o?h.jsx(Sa,{ref:M,options:g,value:_,onChange:w,inputValue:x,onInputChange:(D,L)=>{C(L)},PopperComponent:dl,fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:$,getOptionLabel:D=>{var L;return(L=N[D])==null?void 0:L.name},renderInput:D=>h.jsx(Q,{...D,label:"",placeholder:e}),renderOption:(D,L)=>{var I;const B=_.indexOf(L)!==-1;return U.createElement(ul,{component:"li",...D,key:L},n(N[L]||{}),h.jsx(F,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:B?"700":"normal"},children:a(L,N[L])||((I=N[L])==null?void 0:I.name)}),h.jsx(F,{component:vs,sx:{opacity:.5,width:18,height:18},style:{visibility:B?"visible":"hidden"}}))},...p}):h.jsx(F,{px:1,className:"form-item-input slot",onClick:k,style:{whiteSpace:"pre-wrap",cursor:"text"},children:_.filter(D=>g.some(L=>L.code===D)).map(D=>h.jsx(En,{label:g.find(L=>L.code===D).name,style:{marginRight:8},size:"small"},D))});return h.jsx(qo,{className:"form",style:u,children:h.jsxs(F,{className:"form-item",children:[h.jsxs(F,{className:"form-item-label",children:[v,O&&h.jsx(Do,{})]}),h.jsxs(F,{className:"form-item-body",children:[h.jsx(F,{className:"form-item-input",children:q}),h.jsx(F,{className:"form-item-action",children:o?h.jsxs(h.Fragment,{children:[h.jsx(Ge,{"data-cy":"schema-form-item-confirm",onClick:l,disabled:T||c,size:"large",children:c?h.jsx(_t,{size:24}):h.jsx(Io,{})}),h.jsx(Ge,{"data-cy":"schema-form-item-cancel",onClick:()=>{A(d),t(!1)},disabled:T||c,size:"large",children:h.jsx(vs,{})})]}):null})]}),o&&f&&h.jsx(ji,{children:f})]})})}Gn.propTypes={style:H.object,onSubmit:H.func,onChange:H.func,label:H.string,initialValue:H.string,required:H.bool,disabled:H.bool,triggers:H.array,options:H.array,helperText:H.string,formatterBeforeSubmit:H.func,placeholder:H.string,renderImage:H.func,filterKeys:H.arrayOf(H.string),noEmpty:H.bool,renderLabel:H.func};Gn.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",required:!1,disabled:!1,triggers:[],options:[],helperText:"",formatterBeforeSubmit:v=>v.join(","),placeholder:"",filterKeys:["name"],renderImage:()=>null,renderLabel:(v,T)=>"",noEmpty:!1};const ul=kr.div`
1
+ import{r as U,e as Tt,g as Dn,a as Xe,f as Ma}from"./vendor-react-DoD83n6N.js";import{a1 as Y,j as h,E as H,a9 as kr,P as Ca,b$ as ps,bP as Sa,M as Q,a3 as F,A as En,I as Ge,a2 as _t,bl as ji,x as Ke,T as at,bn as ue,bO as Gt,br as ka,ac as Oa,ad as dt,K as Ri,ak as Nr,bd as bt,bo as it,bj as ae,c0 as $a,e as Yt,Z as Mi,a4 as Ve,c1 as Pa,c2 as Ta,c3 as Aa,c4 as et,bU as ot,c5 as Ci,c6 as Ln,c7 as Bn,c8 as Ia,c9 as Si,ca as qa,cb as Da,b0 as ht,cc as Ea,cd as La,ce as Ba,cf as Na,cg as Fa,ch as za,ci as Wa,cj as Ha,ck as Ua,cl as Va,cm as Ka,cn as Fr,bE as Ja,C as Ga,bM as Za,bz as ki,bA as Oi}from"./vendor-mui-core-O22FPGM4.js";import{I as Ya}from"./iframe-C0FAfo1V.js";import{r as Xa,as as Qa,G as wt,w as eo,x as Mr,a0 as to,c as ms,A as Zt,n as Ye,at as ro,y as no,O as zr,au as so,av as gs,K as $i,F as xt,J as Pi}from"./vendor-utils-CbeKtci8.js";import{r as pt,f as vs,u as Ue,B as de,V as Z,am as Ti,n as io,ak as Rt,bE as ao,a as oo,aj as ft,p as pe,P as ys,aX as lt,a1 as Xt,X as Ai,aq as Nn,bF as lo,bG as co,j as Dr,i as be,bH as uo,bI as fo,a8 as ho,a9 as po,a7 as mo,aZ as bs,bJ as $n,bK as go,bL as vo,a2 as Wr,_ as yo}from"./vendor-ux-did-connect-D75Zatzm.js";import{t as Ii,a as rt,u as z,f as jt,c as bo,l as Cr,k as qi}from"./vendor-hooks-CYyfK9g3.js";import{A as Di,d as xs}from"./config-C3tQWDAE.js";import{F as xo,d as _o}from"./form-text-input-BKnTJYUO.js";import{d as _s}from"./ChevronRight-Bpkf9aqI.js";import{y as Ei,z as wo,B as jo,C as Ro,i as ws,h as js,r as Mo,n as Rs}from"./vendor-arcblock-E5QJEgSK.js";import{z as De,C as Je,f as Li,av as Co,m as So,au as ko,v as Ms,h as He,O as Oo,Q as $o}from"./index-C8sg0Ts_.js";import{B as Po}from"./bundle-avatar-C4EBeG0M.js";import{u as To,B as Ao}from"./index-DMqGxTc4.js";import{d as Io}from"./Done-B8c93MpP.js";import{F as qo,R as Do,L as Et}from"./logo-uploader-DtUHte5C.js";import{w as Bi,P as Eo}from"./permission-ZvUR5Tj-.js";import{C as Fn}from"./confirm-BaiaCWsM.js";import{f as Sr}from"./format-error-LAoTjvJe.js";import{_ as Lo}from"./useSetState-BL3ktMon.js";import{u as Ni}from"./session-CD9NaM-v.js";import{C as Bo}from"./click-to-copy-Dc16fHKA.js";import{u as Hr,a as No}from"./dashboard-BUwFD31P.js";import{I as Fi}from"./index-D5rqbUOM.js";import{W as Fo}from"./did-address-DIKoCoBp.js";import{V as zo,K as Wo}from"./status-i0njxvUg.js";import{u as ct,C as G,a as Cs}from"./index.esm-CWepf7I_.js";import{S as Ur}from"./switch-control-CJ1duVKM.js";import{b as Ho}from"./base32-gJJTbpiB.js";import{S as hn}from"./simple-select-ZyzPurqn.js";import"./lottie-web-B6s7dDoL.js";import"./EditIcon-SYuT6kHe.js";import"./ArrowDropDown-ydRfHJ2x.js";import"./index-tUQxVYYQ.js";import"./useLocalStorage-CtbpqE0c.js";import"./PlayArrow-DI84Lay5.js";import"./get-safe-url-CXJBjnNj.js";import"./useAsyncRetry-CEJwVPZ6.js";import"./useAsync-D2OhgEkV.js";import"./InfoOutlined-HP5LuELQ.js";import"./omit-DVwO9e3E.js";var zn={},Uo=Y;Object.defineProperty(zn,"__esModule",{value:!0});var zi=zn.default=void 0,Vo=Uo(pt()),Ko=h;zi=zn.default=(0,Vo.default)((0,Ko.jsx)("path",{d:"M3 18c0 .55.45 1 1 1h5v-2H4c-.55 0-1 .45-1 1M3 6c0 .55.45 1 1 1h9V5H4c-.55 0-1 .45-1 1m10 14v-1h7c.55 0 1-.45 1-1s-.45-1-1-1h-7v-1c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1s1-.45 1-1M7 10v1H4c-.55 0-1 .45-1 1s.45 1 1 1h3v1c0 .55.45 1 1 1s1-.45 1-1v-4c0-.55-.45-1-1-1s-1 .45-1 1m14 2c0-.55-.45-1-1-1h-9v2h9c.55 0 1-.45 1-1m-5-3c.55 0 1-.45 1-1V7h3c.55 0 1-.45 1-1s-.45-1-1-1h-3V4c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1"}),"TuneRounded");var Wn={},Jo=Y;Object.defineProperty(Wn,"__esModule",{value:!0});var Wi=Wn.default=void 0,Go=Jo(pt()),Zo=h;Wi=Wn.default=(0,Go.default)((0,Zo.jsx)("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3"}),"Key");var Hn={},Yo=Y;Object.defineProperty(Hn,"__esModule",{value:!0});var Hi=Hn.default=void 0,Xo=Yo(pt()),Qo=h;Hi=Hn.default=(0,Xo.default)((0,Qo.jsx)("path",{d:"M11 7 9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8z"}),"Login");var Un={},el=Y;Object.defineProperty(Un,"__esModule",{value:!0});var Ui=Un.default=void 0,tl=el(pt()),rl=h;Ui=Un.default=(0,tl.default)((0,rl.jsx)("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2m6-6v-5c0-3.07-1.63-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.64 5.36 6 7.92 6 11v5l-2 2v1h16v-1zm-2 1H8v-6c0-2.48 1.51-4.5 4-4.5s4 2.02 4 4.5z"}),"NotificationsNone");const nl={width:24,height:24,body:'<path fill="currentColor" d="M4.975 15q-.425 0-.7-.288T4 14q0-.425.288-.713T5 13h14.025q.425 0 .7.288T20 14q0 .425-.288.713T19 15H4.975Zm0 4q-.425 0-.7-.288T4 18q0-.425.288-.713T5 17h14.025q.425 0 .7.288T20 18q0 .425-.288.713T19 19H4.975Zm0-8q-.425 0-.7-.288T4 10q0-.425.288-.713T5 9h14.025q.425 0 .7.288T20 10q0 .425-.288.713T19 11H4.975Zm0-4q-.425 0-.7-.288T4 6q0-.425.288-.713T5 5h14.025q.425 0 .7.288T20 6q0 .425-.288.713T19 7H4.975Z"/>'},sl=nl;var Vn={},il=Y;Object.defineProperty(Vn,"__esModule",{value:!0});var Vi=Vn.default=void 0,al=il(pt()),ol=h;Vi=Vn.default=(0,al.default)((0,ol.jsx)("path",{d:"M16 13c3.09-2.81 6-5.44 6-7.7C22 3.45 20.55 2 18.7 2c-1.04 0-2.05.49-2.7 1.25C15.34 2.49 14.34 2 13.3 2 11.45 2 10 3.45 10 5.3c0 2.26 2.91 4.89 6 7.7m-2.7-9c.44 0 .89.21 1.18.55L16 6.34l1.52-1.79c.29-.34.74-.55 1.18-.55.74 0 1.3.56 1.3 1.3 0 1.12-2.04 3.17-4 4.99-1.96-1.82-4-3.88-4-4.99 0-.74.56-1.3 1.3-1.3M19 16h-2c0-1.2-.75-2.28-1.87-2.7L8.97 11H1v11h6v-1.44l7 1.94 8-2.5v-1c0-1.66-1.34-3-3-3M3 20v-7h2v7zm10.97.41L7 18.48V13h1.61l5.82 2.17c.34.13.57.46.57.83 0 0-1.99-.05-2.3-.15l-2.38-.79-.63 1.9 2.38.79c.51.17 1.04.26 1.58.26H19c.39 0 .74.23.9.56z"}),"VolunteerActivismOutlined");var Kn={},ll=Y;Object.defineProperty(Kn,"__esModule",{value:!0});var Jn=Kn.default=void 0,cl=ll(pt()),Ss=h;Jn=Kn.default=(0,cl.default)([(0,Ss.jsx)("path",{d:"M21 7.28V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-2.28c.59-.35 1-.98 1-1.72V9c0-.74-.41-1.37-1-1.72M20 9v6h-7V9zM5 19V5h14v2h-6c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h6v2z"},"0"),(0,Ss.jsx)("circle",{cx:"16",cy:"12",r:"1.5"},"1")],"AccountBalanceWalletOutlined");function Gn({label:v,disabled:T,required:O,initialValue:S,onChange:P,style:u,onSubmit:R,triggers:r,options:g,formatterBeforeSubmit:m,helperText:f,placeholder:e,renderImage:n,renderLabel:a,filterKeys:i,noEmpty:s,...p}){const[o,t]=U.useState(!1),[c,y]=U.useState(!1),[x,C]=U.useState(""),M=U.useRef(null),[d,b]=U.useState(S),[_,A]=U.useState(d),N=U.useMemo(()=>{if(!g)return{};const D={};return g.forEach(L=>{D[L.code]=L}),D},[g]),$=()=>{if(!g)return[];if(!x)return g.map(L=>L.code);const D=new RegExp(x.toLowerCase());return g.filter(L=>{var B;for(let I=0;I<i.length;I++){const j=i[I];if(D.test((B=L[j])==null?void 0:B.toLowerCase()))return!0}return!1}).map(L=>L.code)},l=async()=>{y(!0);try{await R(typeof m=="function"?m(_):_)===!1?A(d):s&&!_.length?(A(S),b(S)):(A(_),b(_))}catch{A(d)}finally{y(!1),t(!1)}},w=(D,L)=>{if(!Array.isArray(L)){A([]),P([]);return}const B=L.filter(I=>N[I]);if(!B.length){A([]),P([]);return}A(B),P(B)},k=D=>{D.stopPropagation(),t(!0),setTimeout(()=>{if(M.current){const L=M.current.querySelector("input");L&&L.focus()}},500)},q=o?h.jsx(Sa,{ref:M,options:g,value:_,onChange:w,inputValue:x,onInputChange:(D,L)=>{C(L)},PopperComponent:dl,fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:$,getOptionLabel:D=>{var L;return(L=N[D])==null?void 0:L.name},renderInput:D=>h.jsx(Q,{...D,label:"",placeholder:e}),renderOption:(D,L)=>{var I;const B=_.indexOf(L)!==-1;return U.createElement(ul,{component:"li",...D,key:L},n(N[L]||{}),h.jsx(F,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:B?"700":"normal"},children:a(L,N[L])||((I=N[L])==null?void 0:I.name)}),h.jsx(F,{component:vs,sx:{opacity:.5,width:18,height:18},style:{visibility:B?"visible":"hidden"}}))},...p}):h.jsx(F,{px:1,className:"form-item-input slot",onClick:k,style:{whiteSpace:"pre-wrap",cursor:"text"},children:_.filter(D=>g.some(L=>L.code===D)).map(D=>h.jsx(En,{label:g.find(L=>L.code===D).name,style:{marginRight:8},size:"small"},D))});return h.jsx(qo,{className:"form",style:u,children:h.jsxs(F,{className:"form-item",children:[h.jsxs(F,{className:"form-item-label",children:[v,O&&h.jsx(Do,{})]}),h.jsxs(F,{className:"form-item-body",children:[h.jsx(F,{className:"form-item-input",children:q}),h.jsx(F,{className:"form-item-action",children:o?h.jsxs(h.Fragment,{children:[h.jsx(Ge,{"data-cy":"schema-form-item-confirm",onClick:l,disabled:T||c,size:"large",children:c?h.jsx(_t,{size:24}):h.jsx(Io,{})}),h.jsx(Ge,{"data-cy":"schema-form-item-cancel",onClick:()=>{A(d),t(!1)},disabled:T||c,size:"large",children:h.jsx(vs,{})})]}):null})]}),o&&f&&h.jsx(ji,{children:f})]})})}Gn.propTypes={style:H.object,onSubmit:H.func,onChange:H.func,label:H.string,initialValue:H.string,required:H.bool,disabled:H.bool,triggers:H.array,options:H.array,helperText:H.string,formatterBeforeSubmit:H.func,placeholder:H.string,renderImage:H.func,filterKeys:H.arrayOf(H.string),noEmpty:H.bool,renderLabel:H.func};Gn.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",required:!1,disabled:!1,triggers:[],options:[],helperText:"",formatterBeforeSubmit:v=>v.join(","),placeholder:"",filterKeys:["name"],renderImage:()=>null,renderLabel:(v,T)=>"",noEmpty:!1};const ul=kr.div`
2
2
  display: flex;
3
3
  justify-content: space-between;
4
4
  align-items: center;
@@ -1,4 +1,4 @@
1
- import{E as r,a9 as f,j as i,by as T,a3 as S,a2 as D}from"./vendor-mui-core-O22FPGM4.js";import{a as $,k as E,u as P,l as U}from"./vendor-hooks-CYyfK9g3.js";import{N as q,R as F}from"./vendor-arcblock-E5QJEgSK.js";import{r as m}from"./vendor-react-DoD83n6N.js";import{aX as M,ak as H,u as j,aL as O,p as B,aY as I,U as W}from"./vendor-ux-did-connect-D75Zatzm.js";import{x as X}from"./vendor-utils-CbeKtci8.js";import{v as V,w as L,x as z}from"./index-CYdNDqQ1.js";import{u as Y}from"./use-passport-id-B-b-_oYF.js";import{u as J}from"./session-CD9NaM-v.js";import{b as K}from"./sdk-CVa22Xgm.js";import{d as G}from"./CheckCircle-DgSwRUf8.js";import{w as Q}from"./wrap-locale-lZatlhee.js";function k({invitation:e,createPassportSvg:a,passportColor:c}){const[p,n]=m.useState(!1),{t}=m.useContext(M),l=m.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),u=m.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c}),[e,l]),x=m.useCallback(()=>{n(!0)},[]),s=m.useCallback(()=>{n(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(Z,{children:i.jsxs("div",{className:"invite-passport__card",onClick:x,children:[!!e.display&&i.jsx(q,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:u}})]})}),i.jsx(H,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:s,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(o=>i.jsx("li",{style:{listStyle:"circle"},children:o.description},o.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx(T,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:t("invite.emptyPermission")})]})})]})}k.propTypes={invitation:r.object.isRequired,createPassportSvg:r.func.isRequired,passportColor:r.string};k.defaultProps={passportColor:"auto"};const Z=f.div`
1
+ import{E as r,a9 as f,j as i,by as T,a3 as S,a2 as D}from"./vendor-mui-core-O22FPGM4.js";import{a as $,k as E,u as P,l as U}from"./vendor-hooks-CYyfK9g3.js";import{N as q,R as F}from"./vendor-arcblock-E5QJEgSK.js";import{r as m}from"./vendor-react-DoD83n6N.js";import{aX as M,ak as H,u as j,aL as O,p as B,aY as I,U as W}from"./vendor-ux-did-connect-D75Zatzm.js";import{x as X}from"./vendor-utils-CbeKtci8.js";import{v as V,w as L,x as z}from"./index-C8sg0Ts_.js";import{u as Y}from"./use-passport-id-B-b-_oYF.js";import{u as J}from"./session-CD9NaM-v.js";import{b as K}from"./sdk-CVa22Xgm.js";import{d as G}from"./CheckCircle-DgSwRUf8.js";import{w as Q}from"./wrap-locale-gZlt-kQa.js";function k({invitation:e,createPassportSvg:a,passportColor:c}){const[p,n]=m.useState(!1),{t}=m.useContext(M),l=m.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),u=m.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c}),[e,l]),x=m.useCallback(()=>{n(!0)},[]),s=m.useCallback(()=>{n(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(Z,{children:i.jsxs("div",{className:"invite-passport__card",onClick:x,children:[!!e.display&&i.jsx(q,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:u}})]})}),i.jsx(H,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:s,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(o=>i.jsx("li",{style:{listStyle:"circle"},children:o.description},o.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx(T,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:t("invite.emptyPermission")})]})})]})}k.propTypes={invitation:r.object.isRequired,createPassportSvg:r.func.isRequired,passportColor:r.string};k.defaultProps={passportColor:"auto"};const Z=f.div`
2
2
  display: flex;
3
3
  max-width: 350px;
4
4
  margin: 30px auto;
@@ -1 +1 @@
1
- import{j as i,a3 as x}from"./vendor-mui-core-O22FPGM4.js";import{k as g,r as u}from"./vendor-react-DoD83n6N.js";import{u as v}from"./vendor-hooks-CYyfK9g3.js";import{I as w}from"./invitation-CDtK_Uyv.js";import{F as I}from"./fullpage-kiX9qo3H.js";import{u as k,aN as S,p as T}from"./vendor-ux-did-connect-D75Zatzm.js";import{H as j}from"./vendor-arcblock-E5QJEgSK.js";import{g as E}from"./get-safe-url-CXJBjnNj.js";import{u as P,d as F,c as R,s as W,a as C}from"./index-CYdNDqQ1.js";import"./vendor-utils-CbeKtci8.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CD9NaM-v.js";import"./sdk-CVa22Xgm.js";import"./CheckCircle-DgSwRUf8.js";import"./wrap-locale-lZatlhee.js";import"./lottie-web-B6s7dDoL.js";function y(c){var r;const m=g(),{searchParams:s}=new URL(window.location.href),{api:p,session:d}=P(),{t:f}=k(),a=s.get("inviteId"),n=s.get("redirect"),h=u.useCallback(async()=>{const{data:t}=await F.get("invitation",{params:{inviteId:a}});return t},[a]),l=v(async(t,o=e=>e)=>{t&&(W(o(t.sessionToken)),C(o(t.refreshToken)),t.visitorId&&S(o(t.visitorId))),await d.refresh(),setTimeout(()=>{if(n){const e=decodeURIComponent(n);e.startsWith(T.WELLKNOWN_SERVICE_PATH_PREFIX)?m(e,{replace:!0}):window.location.href=E(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(I,{did:(r=window.blocklet)==null?void 0:r.appPid,children:[i.jsx(j,{children:i.jsx("title",{children:f("pageTitle.invite")})}),i.jsx(x,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...c,getDataFn:h,checkFn:p.get,createPassportSvg:R,onLoginSuccess:l,inService:!0})})]})}export{y as default};
1
+ import{j as i,a3 as x}from"./vendor-mui-core-O22FPGM4.js";import{k as g,r as u}from"./vendor-react-DoD83n6N.js";import{u as v}from"./vendor-hooks-CYyfK9g3.js";import{I as w}from"./invitation-3fNTl35Q.js";import{F as I}from"./fullpage-kiX9qo3H.js";import{u as k,aN as S,p as T}from"./vendor-ux-did-connect-D75Zatzm.js";import{H as j}from"./vendor-arcblock-E5QJEgSK.js";import{g as E}from"./get-safe-url-BvS0hy8W.js";import{u as P,d as F,c as R,s as W,a as C}from"./index-C8sg0Ts_.js";import"./vendor-utils-CbeKtci8.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CD9NaM-v.js";import"./sdk-CVa22Xgm.js";import"./CheckCircle-DgSwRUf8.js";import"./wrap-locale-gZlt-kQa.js";import"./lottie-web-B6s7dDoL.js";function y(c){var r;const m=g(),{searchParams:s}=new URL(window.location.href),{api:p,session:d}=P(),{t:f}=k(),a=s.get("inviteId"),n=s.get("redirect"),h=u.useCallback(async()=>{const{data:t}=await F.get("invitation",{params:{inviteId:a}});return t},[a]),l=v(async(t,o=e=>e)=>{t&&(W(o(t.sessionToken)),C(o(t.refreshToken)),t.visitorId&&S(o(t.visitorId))),await d.refresh(),setTimeout(()=>{if(n){const e=decodeURIComponent(n);e.startsWith(T.WELLKNOWN_SERVICE_PATH_PREFIX)?m(e,{replace:!0}):window.location.href=E(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(I,{did:(r=window.blocklet)==null?void 0:r.appPid,children:[i.jsx(j,{children:i.jsx("title",{children:f("pageTitle.invite")})}),i.jsx(x,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...c,getDataFn:h,checkFn:p.get,createPassportSvg:R,onLoginSuccess:l,inService:!0})})]})}export{y as default};
@@ -1 +1 @@
1
- import{j as e,a2 as w,a3 as v}from"./vendor-mui-core-O22FPGM4.js";import{a as I,l as P,u as m}from"./vendor-hooks-CYyfK9g3.js";import{I as T}from"./invitation-CDtK_Uyv.js";import{F as k}from"./fullpage-kiX9qo3H.js";import{u as j,aN as R,p as S}from"./vendor-ux-did-connect-D75Zatzm.js";import{H as E}from"./vendor-arcblock-E5QJEgSK.js";import{g as F}from"./get-safe-url-CXJBjnNj.js";import{u as C,c as L,s as N,a as W}from"./index-CYdNDqQ1.js";import{k as H}from"./vendor-react-DoD83n6N.js";import"./vendor-utils-CbeKtci8.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CD9NaM-v.js";import"./sdk-CVa22Xgm.js";import"./CheckCircle-DgSwRUf8.js";import"./wrap-locale-lZatlhee.js";import"./lottie-web-B6s7dDoL.js";function Q(f){var p;const{searchParams:a}=new URL(window.location.href),{api:r,session:d}=C(),u=H(),{t:h}=j(),n=a.get("id"),c=a.get("redirect"),l=I({state:""}),s=P(async()=>{if(!n)return null;const{data:t}=await r.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),g=m(()=>{if(s.error)throw s.error;return s==null?void 0:s.data}),x=m(async(t,i=o=>o)=>{t&&(t.sessionToken&&N(i(t.sessionToken)),t.refreshToken&&W(i(t.refreshToken)),t.visitorId&&R(i(t.visitorId)),await d.refresh()),setTimeout(()=>{if(c){const o=decodeURIComponent(c);o.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?u(o,{replace:!0}):window.location.href=F(o)}else window.location.href=window.env.pathPrefix||"/"},50)});return s.loading?e.jsx(w,{}):e.jsxs(k,{did:(p=window.blocklet)==null?void 0:p.appPid,children:[e.jsx(E,{children:e.jsx("title",{children:h("pageTitle.issuePassport")})}),e.jsx(v,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(T,{...f,action:"issue-passport",getDataFn:g,checkFn:r.get,createPassportSvg:L,onLoginSuccess:x,inService:!0,status:l.state})})]})}export{Q as default};
1
+ import{j as e,a2 as w,a3 as v}from"./vendor-mui-core-O22FPGM4.js";import{a as I,l as P,u as m}from"./vendor-hooks-CYyfK9g3.js";import{I as T}from"./invitation-3fNTl35Q.js";import{F as k}from"./fullpage-kiX9qo3H.js";import{u as j,aN as R,p as S}from"./vendor-ux-did-connect-D75Zatzm.js";import{H as E}from"./vendor-arcblock-E5QJEgSK.js";import{g as F}from"./get-safe-url-BvS0hy8W.js";import{u as C,c as L,s as N,a as W}from"./index-C8sg0Ts_.js";import{k as H}from"./vendor-react-DoD83n6N.js";import"./vendor-utils-CbeKtci8.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CD9NaM-v.js";import"./sdk-CVa22Xgm.js";import"./CheckCircle-DgSwRUf8.js";import"./wrap-locale-gZlt-kQa.js";import"./lottie-web-B6s7dDoL.js";function Q(f){var p;const{searchParams:a}=new URL(window.location.href),{api:r,session:d}=C(),u=H(),{t:h}=j(),n=a.get("id"),c=a.get("redirect"),l=I({state:""}),s=P(async()=>{if(!n)return null;const{data:t}=await r.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),g=m(()=>{if(s.error)throw s.error;return s==null?void 0:s.data}),x=m(async(t,i=o=>o)=>{t&&(t.sessionToken&&N(i(t.sessionToken)),t.refreshToken&&W(i(t.refreshToken)),t.visitorId&&R(i(t.visitorId)),await d.refresh()),setTimeout(()=>{if(c){const o=decodeURIComponent(c);o.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?u(o,{replace:!0}):window.location.href=F(o)}else window.location.href=window.env.pathPrefix||"/"},50)});return s.loading?e.jsx(w,{}):e.jsxs(k,{did:(p=window.blocklet)==null?void 0:p.appPid,children:[e.jsx(E,{children:e.jsx("title",{children:h("pageTitle.issuePassport")})}),e.jsx(v,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(T,{...f,action:"issue-passport",getDataFn:g,checkFn:r.get,createPassportSvg:L,onLoginSuccess:x,inService:!0,status:l.state})})]})}export{Q as default};