@abtnode/blocklet-services 1.16.39-beta-20250221-133434-22e84449 → 1.16.39-beta-20250224-112738-14340cd6

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 (121) hide show
  1. package/README.md +5 -1
  2. package/api/index.js +3 -0
  3. package/api/libs/auth/adapters/apple.js +2 -2
  4. package/api/routes/openevent.js +90 -0
  5. package/api/services/notification/index.js +31 -63
  6. package/api/socket/channel/eventbus.js +66 -0
  7. package/api/socket/channel/hooks.js +4 -0
  8. package/api/socket/util.js +0 -3
  9. package/api/util/attach-shared-utils.js +3 -0
  10. package/api/util/index.js +0 -3
  11. package/dist/assets/{Add-udgpbcQ-.js → Add-D5aJYF-w.js} +1 -1
  12. package/dist/assets/{ArrowDropDown-CP8sFDTn.js → ArrowDropDown-Cl8c24xY.js} +1 -1
  13. package/dist/assets/{CheckCircle-CL1MZKeF.js → CheckCircle-C8i0xLNv.js} +1 -1
  14. package/dist/assets/{ChevronLeft-Dxe-8OAb.js → ChevronLeft-BCqszL0Z.js} +1 -1
  15. package/dist/assets/{ChevronRight-Jj-tneRk.js → ChevronRight-B-QUfWQJ.js} +1 -1
  16. package/dist/assets/{DeleteOutline-B2EIRfvm.js → DeleteOutline-CRGsqlBB.js} +1 -1
  17. package/dist/assets/{Done-BmN-n4Md.js → Done-JsgXq87T.js} +1 -1
  18. package/dist/assets/{Download-T0esN2Wf.js → Download-D8FYfZjb.js} +1 -1
  19. package/dist/assets/{Error-DxGYBrX_.js → Error-CBK0TIhk.js} +1 -1
  20. package/dist/assets/{Google-C8v_Y3AW.js → Google-B-PtsEiN.js} +1 -1
  21. package/dist/assets/{InfoOutlined-BoujVod4.js → InfoOutlined-DXbe7-Vo.js} +1 -1
  22. package/dist/assets/{Launch-mtPFLcSN.js → Launch-C0WU9j27.js} +1 -1
  23. package/dist/assets/{LaunchOutlined-BqUlBjUr.js → LaunchOutlined-BqIvI1Me.js} +1 -1
  24. package/dist/assets/{Loop-Cxat_C59.js → Loop-BQEttF_G.js} +1 -1
  25. package/dist/assets/{MoreHoriz-DVyDe-n2.js → MoreHoriz-B7JSMM__.js} +1 -1
  26. package/dist/assets/{PlayArrow-CbK5B-2U.js → PlayArrow-DisvYm5k.js} +1 -1
  27. package/dist/assets/{ViewList-B-1WiukK.js → ViewList-BXtBGGyL.js} +1 -1
  28. package/dist/assets/{access-control-DFyNDuUU.js → access-control-C6iI_BSH.js} +1 -1
  29. package/dist/assets/{actions-DHK1GfXI.js → actions-1ozfktYK.js} +1 -1
  30. package/dist/assets/{add-component-core-vkvnRJpn.js → add-component-core-CujaPoRK.js} +34 -34
  31. package/dist/assets/{add-resource-CTeUMZhV.js → add-resource-BfW3Tf00.js} +1 -1
  32. package/dist/assets/{addon-DrUHZbxW.js → addon-Crm5Vlr1.js} +1 -1
  33. package/dist/assets/{analytics-BnE3HnyH.js → analytics-9vRpjYB7.js} +1 -1
  34. package/dist/assets/{audit-logs-DDZXYPO2.js → audit-logs-BEepuwWL.js} +1 -1
  35. package/dist/assets/{base32-Bg7zWLHM.js → base32-Gx8S-X9Y.js} +1 -1
  36. package/dist/assets/{branding-GXnswdtg.js → branding-DbkAuVBM.js} +2 -2
  37. package/dist/assets/{bundle-avatar-kmTWjmMZ.js → bundle-avatar-qG-4JjJF.js} +1 -1
  38. package/dist/assets/{button-CImZba-M.js → button-DklX5vfm.js} +1 -1
  39. package/dist/assets/{click-to-copy-SPoXGjhb.js → click-to-copy-D4eMUY2Y.js} +1 -1
  40. package/dist/assets/{complete-DCu0ecH1.js → complete-DhQ9_ymq.js} +1 -1
  41. package/dist/assets/{component-D9VIwsjz.js → component-CcT5MhpU.js} +1 -1
  42. package/dist/assets/{config-BqevGx2X.js → config-BLMVw_7t.js} +1 -1
  43. package/dist/assets/{config-BQu2I3z_.js → config-CMsIpXp1.js} +1 -1
  44. package/dist/assets/{config-navigation-C6p-GCJ-.js → config-navigation-5LslndaJ.js} +3 -3
  45. package/dist/assets/{config-space-BVsaPZS_.js → config-space-B1zQHigK.js} +1 -1
  46. package/dist/assets/{confirm-BckBMOcL.js → confirm-ZDAjMdiD.js} +1 -1
  47. package/dist/assets/{connect-Bk35jyN7.js → connect-B7HU4Cw8.js} +1 -1
  48. package/dist/assets/{connect-D0XKtcMb.js → connect-Du3JCAoP.js} +1 -1
  49. package/dist/assets/{connect-to-BWpqHCU5.js → connect-to-DhZp6DK1.js} +1 -1
  50. package/dist/assets/{dashboard-DJwyQ0IN.js → dashboard-B2P35pBD.js} +3 -3
  51. package/dist/assets/{delete-confirm-C4GbidLm.js → delete-confirm-CPFtEtys.js} +1 -1
  52. package/dist/assets/{did-address-DsaXravU.js → did-address-C1Gnyot5.js} +1 -1
  53. package/dist/assets/{domain-B6CfBBp6.js → domain-DRIbYtPI.js} +1 -1
  54. package/dist/assets/{domain-action-card-B8cJWHEv.js → domain-action-card-D1C_-Aw9.js} +1 -1
  55. package/dist/assets/domains-Bpj312un.js +1 -0
  56. package/dist/assets/{email-CK1jC5WM.js → email-gqysQ7lL.js} +1 -1
  57. package/dist/assets/{exchange-passport-D6VbniS0.js → exchange-passport-DiGLznhF.js} +1 -1
  58. package/dist/assets/{form-text-input-DFFNKfWp.js → form-text-input-Z94PwI5N.js} +1 -1
  59. package/dist/assets/{fuel-Co3GBMd3.js → fuel-ZF3h7p3O.js} +1 -1
  60. package/dist/assets/{fullpage-DmUrgaXO.js → fullpage-YYyCExL1.js} +1 -1
  61. package/dist/assets/{get-safe-url-B9KuIPHY.js → get-safe-url-BUeJ9nhL.js} +1 -1
  62. package/dist/assets/{get-safe-url-Dg8FOTjG.js → get-safe-url-uAWmJaE7.js} +1 -1
  63. package/dist/assets/{home-BgCLYfoO.js → home-dPt3qe4k.js} +1 -1
  64. package/dist/assets/{iframe-BfCk9odl.js → iframe-DJUrVJrV.js} +1 -1
  65. package/dist/assets/{index-C2h3b3qO.js → index-B0KY0nDh.js} +1 -1
  66. package/dist/assets/{index-B_f-vCCz.js → index-Bh1ysd6q.js} +1 -1
  67. package/dist/assets/{index-CmBEz5CL.js → index-BhCl1uU6.js} +3 -3
  68. package/dist/assets/{index-sLkJpR5o.js → index-C6lBrZrv.js} +1 -1
  69. package/dist/assets/{index-DkbuxwZE.js → index-CBo47o-g.js} +1 -1
  70. package/dist/assets/{index-dSbx-_M8.js → index-CdGu-lpw.js} +1 -1
  71. package/dist/assets/{index-Cj538gfs.js → index-Ckmi2jMH.js} +1 -1
  72. package/dist/assets/{index--F_W58cR.js → index-DK51_zct.js} +1 -1
  73. package/dist/assets/{index-3h3nnFcB.js → index-DQ_gp9FQ.js} +1 -1
  74. package/dist/assets/{index-8MMKiUTa.js → index-DUi2HTAL.js} +4 -4
  75. package/dist/assets/{index-Bf_1EkYS.js → index-Decruq-8.js} +1 -1
  76. package/dist/assets/{index-rP3b0CME.js → index-DmmQuK-x.js} +1 -1
  77. package/dist/assets/{index-QGwREoo6.js → index-EWFwC-1m.js} +29 -29
  78. package/dist/assets/{index-BNAfDqcG.js → index-Y1AIvXW-.js} +1 -1
  79. package/dist/assets/{index-EgZ4xTuy.js → index-l5RFxAv2.js} +1 -1
  80. package/dist/assets/{invitation-Bfoc9rG-.js → invitation-skVshq4G.js} +1 -1
  81. package/dist/assets/{invite-B4jXTxxv.js → invite-DsHKHvio.js} +1 -1
  82. package/dist/assets/{issue-passport-CVA5upUB.js → issue-passport-CACmjxGN.js} +1 -1
  83. package/dist/assets/{item-0J8MTdrM.js → item-BDFtgG3F.js} +1 -1
  84. package/dist/assets/{layout-C7WJ00Ek.js → layout-swjOWugq.js} +1 -1
  85. package/dist/assets/{list-C8W2Ztkh.js → list-DLHeHUuz.js} +1 -1
  86. package/dist/assets/{list-header-uzHBSbhH.js → list-header-Cb6_-8qZ.js} +1 -1
  87. package/dist/assets/{localization-BwFYCZgc.js → localization-eKoK3nKh.js} +1 -1
  88. package/dist/assets/{log-ByF4DLgp.js → log-DeXPDuQB.js} +1 -1
  89. package/dist/assets/{login-D6E1Agab.js → login-7gCoEUdz.js} +1 -1
  90. package/dist/assets/{login-oauth-callback-DWJMHw0r.js → login-oauth-callback-BfA4R326.js} +1 -1
  91. package/dist/assets/{logo-uploader-C3tOoZU0.js → logo-uploader-CVabFvXd.js} +3 -3
  92. package/dist/assets/{lost-passport-DZ3RaG1P.js → lost-passport-BmAVta0r.js} +1 -1
  93. package/dist/assets/{open-window-C8DmGGiK.js → open-window-DSwWREEC.js} +1 -1
  94. package/dist/assets/{overview-B-qeY9_9.js → overview-BAT-McY_.js} +1 -1
  95. package/dist/assets/{page-header-DPKBfrCy.js → page-header-Bb6Nvnno.js} +1 -1
  96. package/dist/assets/{permission-BY2FbqNx.js → permission-BOXdugm0.js} +1 -1
  97. package/dist/assets/{preferences-jbp_hJW_.js → preferences-BYn4pHhY.js} +1 -1
  98. package/dist/assets/{publish-resource-CbEvZdTB.js → publish-resource-DOJRxK5w.js} +1 -1
  99. package/dist/assets/{react-beautiful-dnd.esm-CKGqjrko.js → react-beautiful-dnd.esm-B29sb4Ur.js} +1 -1
  100. package/dist/assets/{relative-time-B24G13wp.js → relative-time-CXKwoBm5.js} +1 -1
  101. package/dist/assets/sdk-CzVXemwI.js +1 -0
  102. package/dist/assets/{session-CXP_o5z6.js → session-Cbe0QivC.js} +1 -1
  103. package/dist/assets/{setup-D5Yfz51I.js → setup-CL4plW9s.js} +3 -3
  104. package/dist/assets/{start-BWeZ83st.js → start-Ct8WCtQB.js} +1 -1
  105. package/dist/assets/{step-actions-CQPEoZDr.js → step-actions-DCH7RaSc.js} +1 -1
  106. package/dist/assets/{studio-Bm45YPri.js → studio-ByYBPBMO.js} +1 -1
  107. package/dist/assets/{switch-control-0xvudC3P.js → switch-control-DsmPki3h.js} +1 -1
  108. package/dist/assets/{traffic-C3au13Oz.js → traffic-Bd81vPt8.js} +1 -1
  109. package/dist/assets/{transfer-D-pSYMoH.js → transfer-BCWJqvK6.js} +1 -1
  110. package/dist/assets/{unsubscribe-CHbAL1If.js → unsubscribe-tVSlxjZ_.js} +1 -1
  111. package/dist/assets/{useLocalStorage-grucDLLp.js → useLocalStorage-C6K1MfKS.js} +1 -1
  112. package/dist/assets/{user-center-DzUOMtVD.js → user-center-ChTqwApH.js} +1 -1
  113. package/dist/assets/{util-DUNQVVoO.js → util-Da-T3L5G.js} +1 -1
  114. package/dist/assets/{util-DB9FK0S1.js → util-OT81aO9n.js} +1 -1
  115. package/dist/assets/{vendor-arcblock-BCYov1AG.js → vendor-arcblock-MU05F41R.js} +111 -111
  116. package/dist/assets/{wrap-locale-cIg_86o_.js → wrap-locale-BWadJPI7.js} +1 -1
  117. package/dist/index.html +2 -2
  118. package/dist/service-worker.js +1 -1
  119. package/package.json +29 -29
  120. package/dist/assets/domains-C5wVrtkN.js +0 -1
  121. package/dist/assets/sdk-CdIjci-y.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CmBEz5CL.js","assets/vendor-arcblock-BCYov1AG.js","assets/vendor-react-D-afvo_7.js","assets/vendor-utils-5TjOM6td.js","assets/vendor-mui-core-BWT1QT-d.js","assets/vendor-hooks-ZnvK17j8.js","assets/vendor-arcblock-DhgPdlEj.css","assets/index-C2fPoxDR.js","assets/index-QGwREoo6.js","assets/index-DoZ2YM4T.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
- import{r as w,k as St,l as st,L as ce,f as Qn,h as Yn,i as dt}from"./vendor-react-D-afvo_7.js";import{a1 as he,j as t,t as Be,a3 as u,aM as Vo,E as d,a4 as de,I as oe,T as O,bU as Wo,D as rt,aa as ae,ax as Zn,bL as Xe,ad as Uo,aN as Je,bq as xt,x as Z,a2 as Ze,P as Fo,G as Ho,v as It,$ as Go,ar as Xo,al as ue,ah as Kn,ab as Jo,r as Qo,bK as es,K as Ve,y as Yo,M as Y,ac as je,aL as ts,L as os,z as ns,bn as ss,aC as Zo,aB as Ke,bt as rs,bu as ls,bV as is,bW as cs,aP as Ko,bH as as,bN as ds,bx as us,by as ut}from"./vendor-mui-core-BWT1QT-d.js";import{z as me,C as _e,h as re,a6 as ps,f as fo,_ as en,ae as ho}from"./index-QGwREoo6.js";import{a0 as be,b as X,e as Q,a3 as Ae,ad as tn,aW as on,ab as nn,_ as fs,aX as Dt,j as U,n as hs,aY as ms,aZ as bs,z as xs,aE as ne,a_ as gs,aq as ks,aO as Ie,a8 as Tt,a$ as ye,aj as js,ao as ys}from"./vendor-arcblock-BCYov1AG.js";import{d as _t}from"./Add-udgpbcQ-.js";import{d as vs}from"./Error-DxGYBrX_.js";import{C as Pt}from"./confirm-BckBMOcL.js";import{u as lt}from"./session-CXP_o5z6.js";import{W as mo}from"./did-address-DsaXravU.js";import{E as We,D as bo,C as xo,P as go}from"./react-beautiful-dnd.esm-CKGqjrko.js";import{B as Lt}from"./bundle-avatar-kmTWjmMZ.js";import{S as pe}from"./shorten-label-CRTt8ftG.js";import{T as ws,x as ie,G as qt,C as sn}from"./vendor-utils-5TjOM6td.js";import{d as Cs}from"./Download-T0esN2Wf.js";import{C as rn}from"./click-to-copy-SPoXGjhb.js";import{d as Rs}from"./QuestionMarkCircle-CVX4b3Jp.js";import{u as Ss}from"./vendor-hooks-ZnvK17j8.js";import{_ as Se}from"./useSetState-Crt4S51m.js";import{c as $t}from"./index-DoZ2YM4T.js";import{E as Nt}from"./index-CV3ZYUK0.js";import{p as et}from"./index-DkbuxwZE.js";import"./api-K65cLqol.js";import{d as Is}from"./ChevronRight-Jj-tneRk.js";import{T as Ds,a as Ts}from"./vendor-mui-x-VJmvJUkN.js";import{d as ko}from"./DeleteOutline-B2EIRfvm.js";import{c as _s,A as ln,u as Ps,S as Ls,U as qs,a as pt,b as cn,n as $s,e as Ns,f as jo,g as As,h as Es}from"./item-0J8MTdrM.js";import{d as Ms}from"./ArrowDropDown-CP8sFDTn.js";import{f as De}from"./format-error-C0Ke3VXF.js";import{d as Os}from"./Launch-mtPFLcSN.js";import{M as zs}from"./index-DdqHlWJ9.js";import{r as Bs}from"./index-B33NNRC0.js";import{d as Vs}from"./Done-BmN-n4Md.js";import"./raf-schd.esm-Cxhj8umC.js";import"./delete-confirm-C4GbidLm.js";import"./get-safe-url-B9KuIPHY.js";var At={},Ws=he;Object.defineProperty(At,"__esModule",{value:!0});var an=At.default=void 0,Us=Ws(be()),Fs=t;an=At.default=(0,Us.default)((0,Fs.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 Et={},Hs=he;Object.defineProperty(Et,"__esModule",{value:!0});var dn=Et.default=void 0,Gs=Hs(be()),Xs=t;dn=Et.default=(0,Gs.default)((0,Xs.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 Mt={},Js=he;Object.defineProperty(Mt,"__esModule",{value:!0});var un=Mt.default=void 0,Qs=Js(be()),Ys=t;un=Mt.default=(0,Qs.default)((0,Ys.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 Ot({did:e,projectId:o,title:n,logo:r,describe:s}){const l=`${`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e}/${o}/logo/upload`}/${r}`,[a,c]=w.useState(!1),f=Be(h=>h.breakpoints.down("md"));return t.jsxs(u,{sx:{display:"flex",flexDirection:"row",color:a?"primary.main":"grey.900",gap:1},onPointerEnter:()=>c(!0),onPointerLeave:()=>c(!1),children:[t.jsx(Vo,{sx:{borderRadius:1},src:l}),t.jsxs(u,{children:[t.jsx(pe,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),t.jsx(pe,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||a?"primary.main":"grey.700"},children:s||"/"})]})]})}Ot.propTypes={projectId:d.string.isRequired,did:d.string.isRequired,title:d.string.isRequired,logo:d.string.isRequired,describe:d.string.isRequired};function zt({initUrl:e}){const o=St(),n=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:r,locale:s}=Q(),{api:i}=me(),{api:l}=lt(),[a,c]=w.useState(!0),{blocklet:f}=_e(),[h,k]=w.useState(null),[x,p]=w.useState(!1),j=Be(m=>m.breakpoints.down("xl")),{componentDid:v=""}=st(),[I,g]=w.useState(null),b=()=>{i.getProjects({input:{did:f.meta.did,componentDid:v,tenantScope:n}}).then(m=>{const y=(m==null?void 0:m.projects)||[];c(!1),g(y)}).catch(m=>{c(!1),U.error(m.message)})},C=()=>{o(`${X.UNOWNED_DID}/create/none`,{replace:!0})},_=m=>{k(m)},T=()=>{c(!1),p(!0)},D=()=>{p(!1),k(null)},$=m=>{U.error(m.message),p(!1),k(null)},R=m=>{if(!(m!=null&&m.deleted)){U.error("Delete project failed");return}b(),p(!1),k(null)},A=(m,y,L)=>{let z=m==null?void 0:m.trim();return z?(z=hs.toAddress(z).toLocaleLowerCase(),L.some((B,S)=>{const P=y[S];return P&&B.searchable&&B.display!=="excluded"&&B.display!=="false"&&P.toLocaleLowerCase().includes(z)})):!0};if(w.useEffect(()=>{b()},[]),!I&&a)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(We,{})});if(!I)return null;if(!I.length)return t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),t.jsx(Ae,{onClick:C,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const q=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:m=>{const y=I[m];return t.jsx(ce,{to:`${y.id}`,children:t.jsx(Ot,{did:f.meta.did,projectId:y.id,logo:y.blockletLogo,title:y.blockletTitle,describe:y.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:m=>m?t.jsx(tn,{type:"success",children:m}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:m=>m?t.jsx(mo,{size:14,compact:!0,responsive:!1,did:m}):null}},j||v?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:m=>m?t.jsx(mo,{onClick:()=>{o(`/.well-known/service/admin/members?did=${m}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:m}):null}},j||v?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:m=>{const y=(f.children||[]).find(L=>L.meta.did===m);return y?t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Lt,{size:14,blocklet:y,ancestors:[f]}),t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:y.meta.title})]},m):""}}},j||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:m=>t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:t.jsx(pe,{children:m})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:m=>t.jsx(on,{value:Number(m),locale:s})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:m=>{const y=I[m];return t.jsxs(u,{display:"flex",children:[t.jsx(ce,{to:`${y.id}/new-release/${y.lastReleaseId}`,children:t.jsx(de,{title:r("blocklet.publish.createRelease"),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"create",children:t.jsx(an,{style:{fontSize:18}})})})}),!!y.lastReleaseId&&t.jsx(de,{title:r("blocklet.publish.viewLastRelease",{name:y.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"secondary","aria-label":"create",children:t.jsx(ce,{style:{display:"flex"},to:`${y.id}/view/${y.lastReleaseId}`,children:t.jsx(dn,{sx:{fontSize:18}})})})}),t.jsx(de,{title:r("blocklet.publish.delete",{name:y.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"delete",onClick:()=>_(y),children:t.jsx(nn,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),E=x?t.jsx(fs,{open:!0,popup:!0,onClose:D,action:"check-has-project-id",locale:s,checkFn:l.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:R,onError:$,extraParams:{projectId:h.id,did:f.meta.did,name:h.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:h.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:h.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return t.jsxs(u,{children:[t.jsxs(u,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(u,{display:"flex",flexDirection:"row",alignItems:"center",children:[t.jsx(u,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),t.jsx(de,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:t.jsx(un,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),t.jsxs(Ae,{onClick:C,variant:"contained",children:[t.jsx(_t,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]}),t.jsx(Dt,{className:"main-table",locale:s,data:I,columns:q,options:{sort:!1,download:!1,filter:!1,print:!1,search:!0,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100],searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:400,customSearch:A}}),h&&t.jsx(Pt,{title:`${r("common.delete")} ${h.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:T,onCancel:()=>k(null),children:t.jsx(u,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(m=>t.jsxs(u,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[t.jsx(vs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),t.jsx(O,{component:"span",variant:"inherit",color:"text.secondary",children:m})]}))})}),E]})}zt.propTypes={initUrl:d.object};zt.defaultProps={initUrl:null};var Bt={},Zs=he;Object.defineProperty(Bt,"__esModule",{value:!0});var pn=Bt.default=void 0,Ks=Zs(be()),yo=t;pn=Bt.default=(0,Ks.default)([(0,yo.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,yo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");function er(){var $;const{t:e,locale:o}=Q(),{projectId:n}=st(),{api:r}=me(),[s,i]=w.useState(!0),{blocklet:l}=_e(),a=Be(R=>R.breakpoints.down("md")),[c,f]=w.useState(null),[h,k]=w.useState(null),[x,p]=w.useState(null),j=($=window.env)==null?void 0:$.serverEndpoint,v=()=>{r.getReleases({input:{did:l.meta.did,projectId:n}}).then(R=>{const A=(R==null?void 0:R.releases)||[];i(!1),f(A)}).catch(R=>{i(!1),U.error(R.message)})},I=()=>{r.doBatchQuery({getProject:{input:{did:l.meta.did,projectId:n}},getReleases:{input:{did:l.meta.did,projectId:n}}}).then(R=>{k(R.getProject.project||{}),f(R.getReleases.releases||[]),i(!1)}).catch(R=>{i(!1),U.error(R.message)})};w.useEffect(()=>{I()},[]);const[g,b]=w.useState(""),C=()=>{i(!1);const R=x.id;r.deleteRelease({input:{did:l.meta.did,projectId:n,releaseId:R}}).then(()=>{i(!1),v(),U.success(e("common.removeSuccess")),p(null)}).catch(A=>{i(!1),U.error(A.message)})},_=R=>{p(R)};if(!c&&s)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(We,{})});if(!c)return null;const T=t.jsxs(Wo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(ce,{to:"..",children:e("common.blockletStudio")}),t.jsx(O,{color:"text.primary",children:t.jsx(pe,{maxLength:a?6:30,children:h.blockletTitle})})]});if(!c.length)return t.jsxs(t.Fragment,{children:[T,t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:e("blocklet.publish.releaseEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:e("blocklet.publish.createReleaseTip")}),t.jsx(ce,{to:"create/none",children:t.jsx(Ae,{variant:"contained",children:e("blocklet.publish.createRelease")})})]})]});const D=[{label:e("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:R=>{const A=c[R];return t.jsx(ce,{to:`view/${A.id}`,children:t.jsx(Ot,{did:l.meta.did,projectId:h.id,logo:A.blockletLogo,title:A.blockletVersion,describe:A.blockletTitle})})}}},{label:e("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:R=>{const A=c[R];return t.jsx(O,{className:"note",children:A.note||""})}}},{label:e("common.status"),name:"status",options:{customBodyRender:R=>t.jsx(tn,{type:R==="published"?"success":"warning",children:R==="published"?"Released":ws(R)})}},{label:e("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:R=>{const A=c[R];return A.status!==re.PROJECT.RELEASE_STATUS.published?"":t.jsx(on,{value:Number(A.updatedAt),locale:o})}}},{label:e("common.actions"),name:"actions",options:{customBodyRenderLite:R=>{var L;const A=c[R];let q="",E="";const m=A.status==="published";if(m){const z=ie(j,`/api/project/${l.meta.did}/${h.id}/${h.lastReleaseId}/release/blocklet.json`),B=new URL(j);B.pathname=ie(B.pathname,"/launch-blocklet/agreement"),B.searchParams.set("blocklet_meta_url",z),q=B.href,E=ie(`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${l.meta.did}/${h.id}/${h.lastReleaseId}/download/${(h.lastReleaseFiles||[])[0]}`)}const y=(L=h.blockletComponents)!=null&&L.some(z=>z.included)||A.uploadedResource?"pack":"resource";return t.jsxs(u,{display:"flex",alignItems:"center",children:[m&&y==="pack"&&t.jsx(de,{title:e("blocklet.publish.install",{name:h.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"secondary","aria-label":"create",children:t.jsx("a",{style:{display:"flex"},href:q,target:"_blank",rel:"noreferrer",children:t.jsx(pn,{sx:{fontSize:18}})})})}),m&&t.jsx(de,{title:e("blocklet.publish.download",{name:h.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"download",children:t.jsx("a",{style:{display:"flex"},href:E,children:t.jsx(Cs,{sx:{fontSize:18}})})})}),t.jsx(de,{title:e("blocklet.publish.delete",{name:h.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"delete",onClick:()=>_(A),children:t.jsx(nn,{sx:{fontSize:18}})})})]})}}}];return t.jsxs(tr,{children:[t.jsxs(u,{className:"header",children:[T,t.jsxs(u,{display:"flex",alignItems:"center",gap:1,children:[t.jsx(Ae,{variant:"outlined",onClick:()=>{const R=ie(j,`/api/project/${l.meta.did}/${n}/blocklet.json`);b(R)},children:e("blocklet.publish.copyInstallUrl")}),t.jsx(ce,{to:"new-release/none",children:t.jsxs(Ae,{variant:"contained",children:[t.jsx(_t,{style:{fontSize:"1.3em",marginRight:4}}),e("blocklet.publish.createRelease")]})})]})]}),t.jsx(rt,{fullWidth:!0,maxWidth:"sm",open:g,onClose:()=>b(""),children:t.jsxs(u,{sx:{py:5,px:4,wordBreak:"break-all"},children:[t.jsx(O,{variant:"h6",sx:{mb:2},children:e("blocklet.publish.installResourceTip")}),t.jsx(rn,{children:g}),t.jsxs(O,{sx:{mt:2},children:[e("blocklet.publish.installResourceTip2"),t.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:e("blocklet.publish.installResourceHelp")})]})]})}),t.jsx(Dt,{className:"main-table",verticalKeyWidth:100,locale:o,data:c,columns:D,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),x&&t.jsx(Pt,{title:e(`${e("common.delete")} ${x.blockletVersion}`),description:e("blocklet.publish.deleteReleaseTip"),confirm:e("common.confirm"),onConfirm:C,onCancel:()=>p(null)})]})}const tr=ae(u)`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BhCl1uU6.js","assets/vendor-arcblock-MU05F41R.js","assets/vendor-react-D-afvo_7.js","assets/vendor-utils-5TjOM6td.js","assets/vendor-mui-core-BWT1QT-d.js","assets/vendor-hooks-ZnvK17j8.js","assets/vendor-arcblock-DhgPdlEj.css","assets/index-C2fPoxDR.js","assets/index-EWFwC-1m.js","assets/index-DoZ2YM4T.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
+ import{r as w,k as St,l as st,L as ce,f as Qn,h as Yn,i as dt}from"./vendor-react-D-afvo_7.js";import{a1 as he,j as t,t as Be,a3 as u,aM as Vo,E as d,a4 as de,I as oe,T as O,bU as Wo,D as rt,aa as ae,ax as Zn,bL as Xe,ad as Uo,aN as Je,bq as xt,x as Z,a2 as Ze,P as Fo,G as Ho,v as It,$ as Go,ar as Xo,al as ue,ah as Kn,ab as Jo,r as Qo,bK as es,K as Ve,y as Yo,M as Y,ac as je,aL as ts,L as os,z as ns,bn as ss,aC as Zo,aB as Ke,bt as rs,bu as ls,bV as is,bW as cs,aP as Ko,bH as as,bN as ds,bx as us,by as ut}from"./vendor-mui-core-BWT1QT-d.js";import{z as me,C as _e,h as re,a6 as ps,f as fo,_ as en,ae as ho}from"./index-EWFwC-1m.js";import{a0 as be,b as X,e as Q,a3 as Ae,ad as tn,aW as on,ab as nn,_ as fs,aX as Dt,j as U,n as hs,aY as ms,aZ as bs,z as xs,aE as ne,a_ as gs,aq as ks,aO as Ie,a8 as Tt,a$ as ye,aj as js,ao as ys}from"./vendor-arcblock-MU05F41R.js";import{d as _t}from"./Add-D5aJYF-w.js";import{d as vs}from"./Error-CBK0TIhk.js";import{C as Pt}from"./confirm-ZDAjMdiD.js";import{u as lt}from"./session-Cbe0QivC.js";import{W as mo}from"./did-address-C1Gnyot5.js";import{E as We,D as bo,C as xo,P as go}from"./react-beautiful-dnd.esm-B29sb4Ur.js";import{B as Lt}from"./bundle-avatar-qG-4JjJF.js";import{S as pe}from"./shorten-label-CRTt8ftG.js";import{T as ws,x as ie,G as qt,C as sn}from"./vendor-utils-5TjOM6td.js";import{d as Cs}from"./Download-D8FYfZjb.js";import{C as rn}from"./click-to-copy-D4eMUY2Y.js";import{d as Rs}from"./QuestionMarkCircle-CVX4b3Jp.js";import{u as Ss}from"./vendor-hooks-ZnvK17j8.js";import{_ as Se}from"./useSetState-Crt4S51m.js";import{c as $t}from"./index-DoZ2YM4T.js";import{E as Nt}from"./index-CV3ZYUK0.js";import{p as et}from"./index-CBo47o-g.js";import"./api-K65cLqol.js";import{d as Is}from"./ChevronRight-B-QUfWQJ.js";import{T as Ds,a as Ts}from"./vendor-mui-x-VJmvJUkN.js";import{d as ko}from"./DeleteOutline-CRGsqlBB.js";import{c as _s,A as ln,u as Ps,S as Ls,U as qs,a as pt,b as cn,n as $s,e as Ns,f as jo,g as As,h as Es}from"./item-BDFtgG3F.js";import{d as Ms}from"./ArrowDropDown-Cl8c24xY.js";import{f as De}from"./format-error-C0Ke3VXF.js";import{d as Os}from"./Launch-C0WU9j27.js";import{M as zs}from"./index-DdqHlWJ9.js";import{r as Bs}from"./index-B33NNRC0.js";import{d as Vs}from"./Done-JsgXq87T.js";import"./raf-schd.esm-Cxhj8umC.js";import"./delete-confirm-CPFtEtys.js";import"./get-safe-url-BUeJ9nhL.js";var At={},Ws=he;Object.defineProperty(At,"__esModule",{value:!0});var an=At.default=void 0,Us=Ws(be()),Fs=t;an=At.default=(0,Us.default)((0,Fs.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 Et={},Hs=he;Object.defineProperty(Et,"__esModule",{value:!0});var dn=Et.default=void 0,Gs=Hs(be()),Xs=t;dn=Et.default=(0,Gs.default)((0,Xs.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 Mt={},Js=he;Object.defineProperty(Mt,"__esModule",{value:!0});var un=Mt.default=void 0,Qs=Js(be()),Ys=t;un=Mt.default=(0,Qs.default)((0,Ys.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 Ot({did:e,projectId:o,title:n,logo:r,describe:s}){const l=`${`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e}/${o}/logo/upload`}/${r}`,[a,c]=w.useState(!1),f=Be(h=>h.breakpoints.down("md"));return t.jsxs(u,{sx:{display:"flex",flexDirection:"row",color:a?"primary.main":"grey.900",gap:1},onPointerEnter:()=>c(!0),onPointerLeave:()=>c(!1),children:[t.jsx(Vo,{sx:{borderRadius:1},src:l}),t.jsxs(u,{children:[t.jsx(pe,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),t.jsx(pe,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||a?"primary.main":"grey.700"},children:s||"/"})]})]})}Ot.propTypes={projectId:d.string.isRequired,did:d.string.isRequired,title:d.string.isRequired,logo:d.string.isRequired,describe:d.string.isRequired};function zt({initUrl:e}){const o=St(),n=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:r,locale:s}=Q(),{api:i}=me(),{api:l}=lt(),[a,c]=w.useState(!0),{blocklet:f}=_e(),[h,k]=w.useState(null),[x,p]=w.useState(!1),j=Be(m=>m.breakpoints.down("xl")),{componentDid:v=""}=st(),[I,g]=w.useState(null),b=()=>{i.getProjects({input:{did:f.meta.did,componentDid:v,tenantScope:n}}).then(m=>{const y=(m==null?void 0:m.projects)||[];c(!1),g(y)}).catch(m=>{c(!1),U.error(m.message)})},C=()=>{o(`${X.UNOWNED_DID}/create/none`,{replace:!0})},_=m=>{k(m)},T=()=>{c(!1),p(!0)},D=()=>{p(!1),k(null)},$=m=>{U.error(m.message),p(!1),k(null)},R=m=>{if(!(m!=null&&m.deleted)){U.error("Delete project failed");return}b(),p(!1),k(null)},A=(m,y,L)=>{let z=m==null?void 0:m.trim();return z?(z=hs.toAddress(z).toLocaleLowerCase(),L.some((B,S)=>{const P=y[S];return P&&B.searchable&&B.display!=="excluded"&&B.display!=="false"&&P.toLocaleLowerCase().includes(z)})):!0};if(w.useEffect(()=>{b()},[]),!I&&a)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(We,{})});if(!I)return null;if(!I.length)return t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),t.jsx(Ae,{onClick:C,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const q=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:m=>{const y=I[m];return t.jsx(ce,{to:`${y.id}`,children:t.jsx(Ot,{did:f.meta.did,projectId:y.id,logo:y.blockletLogo,title:y.blockletTitle,describe:y.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:m=>m?t.jsx(tn,{type:"success",children:m}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:m=>m?t.jsx(mo,{size:14,compact:!0,responsive:!1,did:m}):null}},j||v?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:m=>m?t.jsx(mo,{onClick:()=>{o(`/.well-known/service/admin/members?did=${m}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:m}):null}},j||v?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:m=>{const y=(f.children||[]).find(L=>L.meta.did===m);return y?t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Lt,{size:14,blocklet:y,ancestors:[f]}),t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:y.meta.title})]},m):""}}},j||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:m=>t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:t.jsx(pe,{children:m})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:m=>t.jsx(on,{value:Number(m),locale:s})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:m=>{const y=I[m];return t.jsxs(u,{display:"flex",children:[t.jsx(ce,{to:`${y.id}/new-release/${y.lastReleaseId}`,children:t.jsx(de,{title:r("blocklet.publish.createRelease"),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"create",children:t.jsx(an,{style:{fontSize:18}})})})}),!!y.lastReleaseId&&t.jsx(de,{title:r("blocklet.publish.viewLastRelease",{name:y.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"secondary","aria-label":"create",children:t.jsx(ce,{style:{display:"flex"},to:`${y.id}/view/${y.lastReleaseId}`,children:t.jsx(dn,{sx:{fontSize:18}})})})}),t.jsx(de,{title:r("blocklet.publish.delete",{name:y.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"delete",onClick:()=>_(y),children:t.jsx(nn,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),E=x?t.jsx(fs,{open:!0,popup:!0,onClose:D,action:"check-has-project-id",locale:s,checkFn:l.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:R,onError:$,extraParams:{projectId:h.id,did:f.meta.did,name:h.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:h.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:h.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return t.jsxs(u,{children:[t.jsxs(u,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(u,{display:"flex",flexDirection:"row",alignItems:"center",children:[t.jsx(u,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),t.jsx(de,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:t.jsx(un,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),t.jsxs(Ae,{onClick:C,variant:"contained",children:[t.jsx(_t,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]}),t.jsx(Dt,{className:"main-table",locale:s,data:I,columns:q,options:{sort:!1,download:!1,filter:!1,print:!1,search:!0,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100],searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:400,customSearch:A}}),h&&t.jsx(Pt,{title:`${r("common.delete")} ${h.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:T,onCancel:()=>k(null),children:t.jsx(u,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(m=>t.jsxs(u,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[t.jsx(vs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),t.jsx(O,{component:"span",variant:"inherit",color:"text.secondary",children:m})]}))})}),E]})}zt.propTypes={initUrl:d.object};zt.defaultProps={initUrl:null};var Bt={},Zs=he;Object.defineProperty(Bt,"__esModule",{value:!0});var pn=Bt.default=void 0,Ks=Zs(be()),yo=t;pn=Bt.default=(0,Ks.default)([(0,yo.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,yo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");function er(){var $;const{t:e,locale:o}=Q(),{projectId:n}=st(),{api:r}=me(),[s,i]=w.useState(!0),{blocklet:l}=_e(),a=Be(R=>R.breakpoints.down("md")),[c,f]=w.useState(null),[h,k]=w.useState(null),[x,p]=w.useState(null),j=($=window.env)==null?void 0:$.serverEndpoint,v=()=>{r.getReleases({input:{did:l.meta.did,projectId:n}}).then(R=>{const A=(R==null?void 0:R.releases)||[];i(!1),f(A)}).catch(R=>{i(!1),U.error(R.message)})},I=()=>{r.doBatchQuery({getProject:{input:{did:l.meta.did,projectId:n}},getReleases:{input:{did:l.meta.did,projectId:n}}}).then(R=>{k(R.getProject.project||{}),f(R.getReleases.releases||[]),i(!1)}).catch(R=>{i(!1),U.error(R.message)})};w.useEffect(()=>{I()},[]);const[g,b]=w.useState(""),C=()=>{i(!1);const R=x.id;r.deleteRelease({input:{did:l.meta.did,projectId:n,releaseId:R}}).then(()=>{i(!1),v(),U.success(e("common.removeSuccess")),p(null)}).catch(A=>{i(!1),U.error(A.message)})},_=R=>{p(R)};if(!c&&s)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(We,{})});if(!c)return null;const T=t.jsxs(Wo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(ce,{to:"..",children:e("common.blockletStudio")}),t.jsx(O,{color:"text.primary",children:t.jsx(pe,{maxLength:a?6:30,children:h.blockletTitle})})]});if(!c.length)return t.jsxs(t.Fragment,{children:[T,t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:e("blocklet.publish.releaseEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:e("blocklet.publish.createReleaseTip")}),t.jsx(ce,{to:"create/none",children:t.jsx(Ae,{variant:"contained",children:e("blocklet.publish.createRelease")})})]})]});const D=[{label:e("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:R=>{const A=c[R];return t.jsx(ce,{to:`view/${A.id}`,children:t.jsx(Ot,{did:l.meta.did,projectId:h.id,logo:A.blockletLogo,title:A.blockletVersion,describe:A.blockletTitle})})}}},{label:e("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:R=>{const A=c[R];return t.jsx(O,{className:"note",children:A.note||""})}}},{label:e("common.status"),name:"status",options:{customBodyRender:R=>t.jsx(tn,{type:R==="published"?"success":"warning",children:R==="published"?"Released":ws(R)})}},{label:e("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:R=>{const A=c[R];return A.status!==re.PROJECT.RELEASE_STATUS.published?"":t.jsx(on,{value:Number(A.updatedAt),locale:o})}}},{label:e("common.actions"),name:"actions",options:{customBodyRenderLite:R=>{var L;const A=c[R];let q="",E="";const m=A.status==="published";if(m){const z=ie(j,`/api/project/${l.meta.did}/${h.id}/${h.lastReleaseId}/release/blocklet.json`),B=new URL(j);B.pathname=ie(B.pathname,"/launch-blocklet/agreement"),B.searchParams.set("blocklet_meta_url",z),q=B.href,E=ie(`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${l.meta.did}/${h.id}/${h.lastReleaseId}/download/${(h.lastReleaseFiles||[])[0]}`)}const y=(L=h.blockletComponents)!=null&&L.some(z=>z.included)||A.uploadedResource?"pack":"resource";return t.jsxs(u,{display:"flex",alignItems:"center",children:[m&&y==="pack"&&t.jsx(de,{title:e("blocklet.publish.install",{name:h.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"secondary","aria-label":"create",children:t.jsx("a",{style:{display:"flex"},href:q,target:"_blank",rel:"noreferrer",children:t.jsx(pn,{sx:{fontSize:18}})})})}),m&&t.jsx(de,{title:e("blocklet.publish.download",{name:h.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"download",children:t.jsx("a",{style:{display:"flex"},href:E,children:t.jsx(Cs,{sx:{fontSize:18}})})})}),t.jsx(de,{title:e("blocklet.publish.delete",{name:h.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"delete",onClick:()=>_(A),children:t.jsx(nn,{sx:{fontSize:18}})})})]})}}}];return t.jsxs(tr,{children:[t.jsxs(u,{className:"header",children:[T,t.jsxs(u,{display:"flex",alignItems:"center",gap:1,children:[t.jsx(Ae,{variant:"outlined",onClick:()=>{const R=ie(j,`/api/project/${l.meta.did}/${n}/blocklet.json`);b(R)},children:e("blocklet.publish.copyInstallUrl")}),t.jsx(ce,{to:"new-release/none",children:t.jsxs(Ae,{variant:"contained",children:[t.jsx(_t,{style:{fontSize:"1.3em",marginRight:4}}),e("blocklet.publish.createRelease")]})})]})]}),t.jsx(rt,{fullWidth:!0,maxWidth:"sm",open:g,onClose:()=>b(""),children:t.jsxs(u,{sx:{py:5,px:4,wordBreak:"break-all"},children:[t.jsx(O,{variant:"h6",sx:{mb:2},children:e("blocklet.publish.installResourceTip")}),t.jsx(rn,{children:g}),t.jsxs(O,{sx:{mt:2},children:[e("blocklet.publish.installResourceTip2"),t.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:e("blocklet.publish.installResourceHelp")})]})]})}),t.jsx(Dt,{className:"main-table",verticalKeyWidth:100,locale:o,data:c,columns:D,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),x&&t.jsx(Pt,{title:e(`${e("common.delete")} ${x.blockletVersion}`),description:e("blocklet.publish.deleteReleaseTip"),confirm:e("common.confirm"),onConfirm:C,onCancel:()=>p(null)})]})}const tr=ae(u)`
3
3
  .header {
4
4
  display: flex;
5
5
  align-items: center;
@@ -129,7 +129,7 @@ import{r as w,k as St,l as st,L as ce,f as Qn,h as Yn,i as dt}from"./vendor-reac
129
129
  background: #fff;
130
130
  z-index: 10;
131
131
  }
132
- `;var Jt={},fr=he;Object.defineProperty(Jt,"__esModule",{value:!0});var gt=Jt.default=void 0,hr=fr(be()),mr=t;gt=Jt.default=(0,hr.default)((0,mr.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 wo="lastWantToConnectStoreId";function br(e){var a,c;const[o,n]=w.useState(null),{session:r}=lt(),s=w.useCallback(f=>{n(f),localStorage.setItem(wo,f==null?void 0:f.id)},[n]),i=w.useMemo(()=>{var x,p,j,v;const f=localStorage.getItem(wo),h=f?(((x=e==null?void 0:e.settings)==null?void 0:x.storeList)||[]).find(I=>I.id===f):null;if(h)return h;let k=(((p=e==null?void 0:e.settings)==null?void 0:p.storeList)||[]).find(I=>{var g;return!(I.id!==X.BLOCKLET_STORE.id||I.scope&&I.scope!=="studio"&&I.scope!==((g=r==null?void 0:r.user)==null?void 0:g.did))});return k||(k=(v=(j=e==null?void 0:e.settings)==null?void 0:j.storeList)==null?void 0:v[0]),k},[(a=e==null?void 0:e.settings)==null?void 0:a.storeList,(c=r==null?void 0:r.user)==null?void 0:c.did]);return[o||i||{},s]}const ht={};async function xn(e,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:s=""}){ht[s]&&clearTimeout(ht[s]),await new Promise(a=>setTimeout(a,r));const i=Date.now(),l=async(a,c)=>{try{const f=await e();a(f)}catch(f){Date.now()-i>n?c(f):s?ht[s]=setTimeout(()=>l(a,c),o):setTimeout(()=>l(a,c),o)}};return new Promise(l)}function xr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function gr(e,{did:o,projectId:n,messageId:r}){return xn(async()=>{var i;const s=await e.getProject({input:{did:o,projectId:n,messageId:r}});if(!((i=s==null?void 0:s.project)!=null&&i.blockletDid))throw new Error("Connected store not found");return s.project.blockletDid},{timerKey:"connect-studio"})}function kr(e,{did:o,projectId:n,storeId:r}){return xn(async()=>{var l,a;const s=await e.getProject({input:{did:o,projectId:n,messageId:""}});if(!((a=(l=s==null?void 0:s.project)==null?void 0:l.connectedStores)!=null&&a.length))throw new Error("Connected store not found");if(!s.project.connectedStores.find(c=>c.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}const gn=({fromBlocklet:e,nodeInfo:o,blocklet:n,userDid:r})=>{var l,a;const s=e?(l=n==null?void 0:n.meta)==null?void 0:l.did:o==null?void 0:o.did;let i=e?((a=n==null?void 0:n.settings)==null?void 0:a.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(i)||(i=[]),i=i.filter(c=>c.protected||!c.scope||c.scope==="studio"||c.scope===r),{teamDid:s,storeList:i}};function Qt({blocklet:e,store:o={},onChangeStore:n,onClick:r,disabled:s,loading:i,componentDid:l}){var m,y,L;const{t:a}=Q(),{session:c}=lt(),{api:f,info:h,inService:k}=me(),x=_e(),[p,j]=w.useState(!1),v=w.useRef(null),[I,g]=w.useState(!1),[b,C]=w.useState(null),_=z=>{n(z),j(!1)},T=()=>{j(!p)},D=z=>{v.current&&v.current.contains(z.target)||j(!1)},$=()=>{g(!0)},R=()=>{g(!1)},A=async()=>{var z;if(b)try{await f.deleteBlockletStore({input:{teamDid:e.meta.did,url:b.url,projectId:"",scope:b.scope||"studio"}}),await((z=x==null?void 0:x.actions)==null?void 0:z.refreshBlocklet())}catch(B){U.error(`Remove Blocklet Store Error: ${De(B)}`)}finally{C(null)}},{storeList:q}=gn({fromBlocklet:k,blocklet:e,nodeInfo:h,componentDid:l,userDid:(m=c==null?void 0:c.user)==null?void 0:m.did}),E=(y=e==null?void 0:e.meta)==null?void 0:y.did;return t.jsxs(t.Fragment,{children:[t.jsxs(xt,{disabled:s,ref:v,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[t.jsxs(Z,{onClick:r,children:[i&&t.jsx(Ze,{size:14,sx:{mr:.5}}),`${a("common.connect")} ${o.name||""}`]}),t.jsx(Z,{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:T,children:t.jsx(Ms,{})})]}),t.jsx(Fo,{sx:{zIndex:10},open:p,anchorEl:v.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:z})=>t.jsx(Ho,{...z,style:{transformOrigin:"center top"},children:t.jsx(It,{children:t.jsx(Go,{onClickAway:D,children:t.jsxs(Xo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[q==null?void 0:q.map(B=>{var S;return t.jsxs(ue,{selected:B.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>_(B),children:[t.jsxs(u,{children:[t.jsx(pe,{sx:{fontSize:"16px"},maxLength:24,children:B.name}),t.jsx(pe,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:B.url})]}),_s({store:B,userDid:(S=c==null?void 0:c.user)==null?void 0:S.did})&&t.jsx(oe,{sx:{ml:1},onClick:P=>{P.preventDefault(),P.stopPropagation(),C(B)},children:t.jsx(ne,{icon:"ic:outline-delete"})})]},B.url)}),t.jsx(Kn,{}),t.jsxs(ue,{onClick:$,children:[t.jsx(_t,{font:!0}),t.jsx(O,{variant:"inherit",children:a("store.blockletRegistry.addRegistry")})]})]})})})})}),I&&t.jsx(ln,{hiddenChildren:!0,open:!0,onClose:R,teamDid:E,storeList:q,scope:"studio",onAdd:(L=x==null?void 0:x.actions)==null?void 0:L.refreshBlocklet}),b&&t.jsx(Pt,{displayError:!0,title:`${a("common.delete")} ${b.name}`,description:a("blocklet.publish.deleteStoreTip",{name:b.name}),confirm:a("common.confirm"),onConfirm:A,onCancel:()=>C(null)})]})}Qt.propTypes={store:d.object,blocklet:d.object,onChangeStore:d.func.isRequired,onClick:d.func.isRequired,loading:d.bool.isRequired,disabled:d.bool.isRequired,componentDid:d.string.isRequired,projectType:d.string.isRequired,getData:d.func.isRequired};Qt.defaultProps={store:null,blocklet:null};var fe=w;const Ee=/^[a-z0-9]+(-[a-z0-9]+)*$/,it=(e,o,n,r="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const a=s.pop(),c=s.pop(),f={provider:s.length>0?s[0]:r,prefix:c,name:a};return o&&!Qe(f)?null:f}const i=s[0],l=i.split("-");if(l.length>1){const a={provider:r,prefix:l.shift(),name:l.join("-")};return o&&!Qe(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:i};return o&&!Qe(a,n)?null:a}return null},Qe=(e,o)=>e?!!((e.provider===""||e.provider.match(Ee))&&(o&&e.prefix===""||e.prefix.match(Ee))&&e.name.match(Ee)):!1,kn=Object.freeze({left:0,top:0,width:16,height:16}),tt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Yt=Object.freeze({...kn,...tt}),kt=Object.freeze({...Yt,body:"",hidden:!1});function jr(e,o){const n={};!e.hFlip!=!o.hFlip&&(n.hFlip=!0),!e.vFlip!=!o.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(o.rotate||0))%4;return r&&(n.rotate=r),n}function Co(e,o){const n=jr(e,o);for(const r in kt)r in tt?r in e&&!(r in n)&&(n[r]=tt[r]):r in o?n[r]=o[r]:r in e&&(n[r]=e[r]);return n}function yr(e,o){const n=e.icons,r=e.aliases||Object.create(null),s=Object.create(null);function i(l){if(n[l])return s[l]=[];if(!(l in s)){s[l]=null;const a=r[l]&&r[l].parent,c=a&&i(a);c&&(s[l]=[a].concat(c))}return s[l]}return Object.keys(n).concat(Object.keys(r)).forEach(i),s}function vr(e,o,n){const r=e.icons,s=e.aliases||Object.create(null);let i={};function l(a){i=Co(r[a]||s[a],i)}return l(o),n.forEach(l),Co(e,i)}function jn(e,o){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(s=>{o(s,null),n.push(s)});const r=yr(e);for(const s in r){const i=r[s];i&&(o(s,vr(e,s,i)),n.push(s))}return n}const wr={provider:"",aliases:{},not_found:{},...kn};function mt(e,o){for(const n in o)if(n in e&&typeof e[n]!=typeof o[n])return!1;return!0}function yn(e){if(typeof e!="object"||e===null)return null;const o=e;if(typeof o.prefix!="string"||!e.icons||typeof e.icons!="object"||!mt(e,wr))return null;const n=o.icons;for(const s in n){const i=n[s];if(!s.match(Ee)||typeof i.body!="string"||!mt(i,kt))return null}const r=o.aliases||Object.create(null);for(const s in r){const i=r[s],l=i.parent;if(!s.match(Ee)||typeof l!="string"||!n[l]&&!r[l]||!mt(i,kt))return null}return o}const Ro=Object.create(null);function Cr(e,o){return{provider:e,prefix:o,icons:Object.create(null),missing:new Set}}function ve(e,o){const n=Ro[e]||(Ro[e]=Object.create(null));return n[o]||(n[o]=Cr(e,o))}function Zt(e,o){return yn(o)?jn(o,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function Rr(e,o,n){try{if(typeof n.body=="string")return e.icons[o]={...n},!0}catch{}return!1}let Oe=!1;function vn(e){return typeof e=="boolean"&&(Oe=e),Oe}function Sr(e){const o=typeof e=="string"?it(e,!0,Oe):e;if(o){const n=ve(o.provider,o.prefix),r=o.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function Ir(e,o){const n=it(e,!0,Oe);if(!n)return!1;const r=ve(n.provider,n.prefix);return Rr(r,n.name,o)}function Dr(e,o){if(typeof e!="object")return!1;if(typeof o!="string"&&(o=e.provider||""),Oe&&!o&&!e.prefix){let s=!1;return yn(e)&&(e.prefix="",jn(e,(i,l)=>{l&&Ir(i,l)&&(s=!0)})),s}const n=e.prefix;if(!Qe({provider:o,prefix:n,name:"a"}))return!1;const r=ve(o,n);return!!Zt(r,e)}const wn=Object.freeze({width:null,height:null}),Cn=Object.freeze({...wn,...tt}),Tr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,_r=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function So(e,o,n){if(o===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*o*n)/n;if(typeof e!="string")return e;const r=e.split(Tr);if(r===null||!r.length)return e;const s=[];let i=r.shift(),l=_r.test(i);for(;;){if(l){const a=parseFloat(i);isNaN(a)?s.push(i):s.push(Math.ceil(a*o*n)/n)}else s.push(i);if(i=r.shift(),i===void 0)return s.join("");l=!l}}const Pr=e=>e==="unset"||e==="undefined"||e==="none";function Lr(e,o){const n={...Yt,...e},r={...Cn,...o},s={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,r].forEach(j=>{const v=[],I=j.hFlip,g=j.vFlip;let b=j.rotate;I?g?b+=2:(v.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),v.push("scale(-1 1)"),s.top=s.left=0):g&&(v.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),v.push("scale(1 -1)"),s.top=s.left=0);let C;switch(b<0&&(b-=Math.floor(b/4)*4),b=b%4,b){case 1:C=s.height/2+s.top,v.unshift("rotate(90 "+C.toString()+" "+C.toString()+")");break;case 2:v.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:C=s.width/2+s.left,v.unshift("rotate(-90 "+C.toString()+" "+C.toString()+")");break}b%2===1&&(s.left!==s.top&&(C=s.left,s.left=s.top,s.top=C),s.width!==s.height&&(C=s.width,s.width=s.height,s.height=C)),v.length&&(i='<g transform="'+v.join(" ")+'">'+i+"</g>")});const l=r.width,a=r.height,c=s.width,f=s.height;let h,k;l===null?(k=a===null?"1em":a==="auto"?f:a,h=So(k,c/f)):(h=l==="auto"?c:l,k=a===null?So(h,f/c):a==="auto"?f:a);const x={},p=(j,v)=>{Pr(v)||(x[j]=v.toString())};return p("width",h),p("height",k),x.viewBox=s.left.toString()+" "+s.top.toString()+" "+c.toString()+" "+f.toString(),{attributes:x,body:i}}const qr=/\sid="(\S+)"/g,$r="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Nr=0;function Ar(e,o=$r){const n=[];let r;for(;r=qr.exec(e);)n.push(r[1]);if(!n.length)return e;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(i=>{const l=typeof o=="function"?o(i):o+(Nr++).toString(),a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+l+s+"$3")}),e=e.replace(new RegExp(s,"g"),""),e}const jt=Object.create(null);function Er(e,o){jt[e]=o}function yt(e){return jt[e]||jt[""]}function Kt(e){let o;if(typeof e.resources=="string")o=[e.resources];else if(o=e.resources,!(o instanceof Array)||!o.length)return null;return{resources:o,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const eo=Object.create(null),Ne=["https://api.simplesvg.com","https://api.unisvg.com"],Ye=[];for(;Ne.length>0;)Ne.length===1||Math.random()>.5?Ye.push(Ne.shift()):Ye.push(Ne.pop());eo[""]=Kt({resources:["https://api.iconify.design"].concat(Ye)});function Mr(e,o){const n=Kt(o);return n===null?!1:(eo[e]=n,!0)}function to(e){return eo[e]}const Or=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Io=Or();function zr(e,o){const n=to(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let s=0;n.resources.forEach(l=>{s=Math.max(s,l.length)});const i=o+".json?icons=";r=n.maxURL-s-n.path.length-i.length}return r}function Br(e){return e===404}const Vr=(e,o,n)=>{const r=[],s=zr(e,o),i="icons";let l={type:i,provider:e,prefix:o,icons:[]},a=0;return n.forEach((c,f)=>{a+=c.length+1,a>=s&&f>0&&(r.push(l),l={type:i,provider:e,prefix:o,icons:[]},a=c.length),l.icons.push(c)}),r.push(l),r};function Wr(e){if(typeof e=="string"){const o=to(e);if(o)return o.path}return"/"}const Ur=(e,o,n)=>{if(!Io){n("abort",424);return}let r=Wr(o.provider);switch(o.type){case"icons":{const i=o.prefix,a=o.icons.join(","),c=new URLSearchParams({icons:a});r+=i+".json?"+c.toString();break}case"custom":{const i=o.uri;r+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n("abort",400);return}let s=503;Io(e+r).then(i=>{const l=i.status;if(l!==200){setTimeout(()=>{n(Br(l)?"abort":"next",l)});return}return s=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?n("abort",i):n("next",s)});return}setTimeout(()=>{n("success",i)})}).catch(()=>{n("next",s)})},Fr={prepare:Vr,send:Ur};function Hr(e){const o={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((s,i)=>s.provider!==i.provider?s.provider.localeCompare(i.provider):s.prefix!==i.prefix?s.prefix.localeCompare(i.prefix):s.name.localeCompare(i.name));let r={provider:"",prefix:"",name:""};return e.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const i=s.provider,l=s.prefix,a=s.name,c=n[i]||(n[i]=Object.create(null)),f=c[l]||(c[l]=ve(i,l));let h;a in f.icons?h=o.loaded:l===""||f.missing.has(a)?h=o.missing:h=o.pending;const k={provider:i,prefix:l,name:a};h.push(k)}),o}function Rn(e,o){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(s=>s.id!==o))})}function Gr(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const o=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!o.length)return;let n=!1;const r=e.provider,s=e.prefix;o.forEach(i=>{const l=i.icons,a=l.pending.length;l.pending=l.pending.filter(c=>{if(c.prefix!==s)return!0;const f=c.name;if(e.icons[f])l.loaded.push({provider:r,prefix:s,name:f});else if(e.missing.has(f))l.missing.push({provider:r,prefix:s,name:f});else return n=!0,!0;return!1}),l.pending.length!==a&&(n||Rn([e],i.id),i.callback(l.loaded.slice(0),l.missing.slice(0),l.pending.slice(0),i.abort))})}))}let Xr=0;function Jr(e,o,n){const r=Xr++,s=Rn.bind(null,n,r);if(!o.pending.length)return s;const i={id:r,icons:o,callback:e,abort:s};return n.forEach(l=>{(l.loaderCallbacks||(l.loaderCallbacks=[])).push(i)}),s}function Qr(e,o=!0,n=!1){const r=[];return e.forEach(s=>{const i=typeof s=="string"?it(s,o,n):s;i&&r.push(i)}),r}var Yr={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Zr(e,o,n,r){const s=e.resources.length,i=e.random?Math.floor(Math.random()*s):e.index;let l;if(e.random){let D=e.resources.slice(0);for(l=[];D.length>1;){const $=Math.floor(Math.random()*D.length);l.push(D[$]),D=D.slice(0,$).concat(D.slice($+1))}l=l.concat(D)}else l=e.resources.slice(i).concat(e.resources.slice(0,i));const a=Date.now();let c="pending",f=0,h,k=null,x=[],p=[];typeof r=="function"&&p.push(r);function j(){k&&(clearTimeout(k),k=null)}function v(){c==="pending"&&(c="aborted"),j(),x.forEach(D=>{D.status==="pending"&&(D.status="aborted")}),x=[]}function I(D,$){$&&(p=[]),typeof D=="function"&&p.push(D)}function g(){return{startTime:a,payload:o,status:c,queriesSent:f,queriesPending:x.length,subscribe:I,abort:v}}function b(){c="failed",p.forEach(D=>{D(void 0,h)})}function C(){x.forEach(D=>{D.status==="pending"&&(D.status="aborted")}),x=[]}function _(D,$,R){const A=$!=="success";switch(x=x.filter(q=>q!==D),c){case"pending":break;case"failed":if(A||!e.dataAfterTimeout)return;break;default:return}if($==="abort"){h=R,b();return}if(A){h=R,x.length||(l.length?T():b());return}if(j(),C(),!e.random){const q=e.resources.indexOf(D.resource);q!==-1&&q!==e.index&&(e.index=q)}c="completed",p.forEach(q=>{q(R)})}function T(){if(c!=="pending")return;j();const D=l.shift();if(D===void 0){if(x.length){k=setTimeout(()=>{j(),c==="pending"&&(C(),b())},e.timeout);return}b();return}const $={status:"pending",resource:D,callback:(R,A)=>{_($,R,A)}};x.push($),f++,k=setTimeout(T,e.rotate),n(D,o,$.callback)}return setTimeout(T),g}function Sn(e){const o={...Yr,...e};let n=[];function r(){n=n.filter(a=>a().status==="pending")}function s(a,c,f){const h=Zr(o,a,c,(k,x)=>{r(),f&&f(k,x)});return n.push(h),h}function i(a){return n.find(c=>a(c))||null}return{query:s,find:i,setIndex:a=>{o.index=a},getIndex:()=>o.index,cleanup:r}}function Do(){}const bt=Object.create(null);function Kr(e){if(!bt[e]){const o=to(e);if(!o)return;const n=Sn(o),r={config:o,redundancy:n};bt[e]=r}return bt[e]}function el(e,o,n){let r,s;if(typeof e=="string"){const i=yt(e);if(!i)return n(void 0,424),Do;s=i.send;const l=Kr(e);l&&(r=l.redundancy)}else{const i=Kt(e);if(i){r=Sn(i);const l=e.resources?e.resources[0]:"",a=yt(l);a&&(s=a.send)}}return!r||!s?(n(void 0,424),Do):r.query(o,s,n)().abort}const To="iconify2",ze="iconify",In=ze+"-count",_o=ze+"-version",Dn=36e5,tl=168;function vt(e,o){try{return e.getItem(o)}catch{}}function oo(e,o,n){try{return e.setItem(o,n),!0}catch{}}function Po(e,o){try{e.removeItem(o)}catch{}}function wt(e,o){return oo(e,In,o.toString())}function Ct(e){return parseInt(vt(e,In))||0}const ct={local:!0,session:!0},Tn={local:new Set,session:new Set};let no=!1;function ol(e){no=e}let Ge=typeof window>"u"?{}:window;function _n(e){const o=e+"Storage";try{if(Ge&&Ge[o]&&typeof Ge[o].length=="number")return Ge[o]}catch{}ct[e]=!1}function Pn(e,o){const n=_n(e);if(!n)return;const r=vt(n,_o);if(r!==To){if(r){const a=Ct(n);for(let c=0;c<a;c++)Po(n,ze+c.toString())}oo(n,_o,To),wt(n,0);return}const s=Math.floor(Date.now()/Dn)-tl,i=a=>{const c=ze+a.toString(),f=vt(n,c);if(typeof f=="string"){try{const h=JSON.parse(f);if(typeof h=="object"&&typeof h.cached=="number"&&h.cached>s&&typeof h.provider=="string"&&typeof h.data=="object"&&typeof h.data.prefix=="string"&&o(h,a))return!0}catch{}Po(n,c)}};let l=Ct(n);for(let a=l-1;a>=0;a--)i(a)||(a===l-1?(l--,wt(n,l)):Tn[e].add(a))}function Ln(){if(!no){ol(!0);for(const e in ct)Pn(e,o=>{const n=o.data,r=o.provider,s=n.prefix,i=ve(r,s);if(!Zt(i,n).length)return!1;const l=n.lastModified||-1;return i.lastModifiedCached=i.lastModifiedCached?Math.min(i.lastModifiedCached,l):l,!0})}}function nl(e,o){const n=e.lastModifiedCached;if(n&&n>=o)return n===o;if(e.lastModifiedCached=o,n)for(const r in ct)Pn(r,s=>{const i=s.data;return s.provider!==e.provider||i.prefix!==e.prefix||i.lastModified===o});return!0}function sl(e,o){no||Ln();function n(r){let s;if(!ct[r]||!(s=_n(r)))return;const i=Tn[r];let l;if(i.size)i.delete(l=Array.from(i).shift());else if(l=Ct(s),!wt(s,l+1))return;const a={cached:Math.floor(Date.now()/Dn),provider:e.provider,data:o};return oo(s,ze+l.toString(),JSON.stringify(a))}o.lastModified&&!nl(e,o.lastModified)||Object.keys(o.icons).length&&(o.not_found&&(o=Object.assign({},o),delete o.not_found),n("local")||n("session"))}function Lo(){}function rl(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Gr(e)}))}function ll(e,o){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(o).sort():e.iconsToLoad=o,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:r}=e,s=e.iconsToLoad;delete e.iconsToLoad;let i;if(!s||!(i=yt(n)))return;i.prepare(n,r,s).forEach(a=>{el(n,a,c=>{if(typeof c!="object")a.icons.forEach(f=>{e.missing.add(f)});else try{const f=Zt(e,c);if(!f.length)return;const h=e.pendingIcons;h&&f.forEach(k=>{h.delete(k)}),sl(e,c)}catch(f){console.error(f)}rl(e)})})}))}const il=(e,o)=>{const n=Qr(e,!0,vn()),r=Hr(n);if(!r.pending.length){let c=!0;return o&&setTimeout(()=>{c&&o(r.loaded,r.missing,r.pending,Lo)}),()=>{c=!1}}const s=Object.create(null),i=[];let l,a;return r.pending.forEach(c=>{const{provider:f,prefix:h}=c;if(h===a&&f===l)return;l=f,a=h,i.push(ve(f,h));const k=s[f]||(s[f]=Object.create(null));k[h]||(k[h]=[])}),r.pending.forEach(c=>{const{provider:f,prefix:h,name:k}=c,x=ve(f,h),p=x.pendingIcons||(x.pendingIcons=new Set);p.has(k)||(p.add(k),s[f][h].push(k))}),i.forEach(c=>{const{provider:f,prefix:h}=c;s[f][h].length&&ll(c,s[f][h])}),o?Jr(o,r,i):Lo};function cl(e,o){const n={...e};for(const r in o){const s=o[r],i=typeof s;r in wn?(s===null||s&&(i==="string"||i==="number"))&&(n[r]=s):i===typeof n[r]&&(n[r]=r==="rotate"?s%4:s)}return n}const al=/[\s,]+/;function dl(e,o){o.split(al).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function ul(e,o=0){const n=e.replace(/^-?[0-9.]*/,"");function r(s){for(;s<0;)s+=4;return s%4}if(n===""){const s=parseInt(e);return isNaN(s)?0:r(s)}else if(n!==e){let s=0;switch(n){case"%":s=25;break;case"deg":s=90}if(s){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i=i/s,i%1===0?r(i):0)}}return o}function pl(e,o){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in o)n+=" "+r+'="'+o[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function fl(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function hl(e){return"data:image/svg+xml,"+fl(e)}function ml(e){return'url("'+hl(e)+'")'}let Me;function bl(){try{Me=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Me=null}}function xl(e){return Me===void 0&&bl(),Me?Me.createHTML(e):e}const qn={...Cn,inline:!1},gl={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},kl={display:"inline-block"},Rt={backgroundColor:"currentColor"},$n={backgroundColor:"transparent"},qo={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},$o={WebkitMask:Rt,mask:Rt,background:$n};for(const e in $o){const o=$o[e];for(const n in qo)o[e+n]=qo[n]}const jl={...qn,inline:!0};function No(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const yl=(e,o,n,r)=>{const s=n?jl:qn,i=cl(s,o),l=o.mode||"svg",a={},c=o.style||{},f={...l==="svg"?gl:{},ref:r};for(let g in o){const b=o[g];if(b!==void 0)switch(g){case"icon":case"style":case"children":case"onLoad":case"mode":case"_ref":case"_inline":break;case"inline":case"hFlip":case"vFlip":i[g]=b===!0||b==="true"||b===1;break;case"flip":typeof b=="string"&&dl(i,b);break;case"color":a.color=b;break;case"rotate":typeof b=="string"?i[g]=ul(b):typeof b=="number"&&(i[g]=b);break;case"ariaHidden":case"aria-hidden":b!==!0&&b!=="true"&&delete f["aria-hidden"];break;default:s[g]===void 0&&(f[g]=b)}}const h=Lr(e,i),k=h.attributes;if(i.inline&&(a.verticalAlign="-0.125em"),l==="svg"){f.style={...a,...c},Object.assign(f,k);let g=0,b=o.id;return typeof b=="string"&&(b=b.replace(/-/g,"_")),f.dangerouslySetInnerHTML={__html:xl(Ar(h.body,b?()=>b+"ID"+g++:"iconifyReact"))},fe.createElement("svg",f)}const{body:x,width:p,height:j}=e,v=l==="mask"||(l==="bg"?!1:x.indexOf("currentColor")!==-1),I=pl(x,{...k,width:p+"",height:j+""});return f.style={...a,"--svg":ml(I),width:No(k.width),height:No(k.height),...kl,...v?Rt:$n,...c},fe.createElement("span",f)};vn(!0);Er("",Fr);if(typeof document<"u"&&typeof window<"u"){Ln();const e=window;if(e.IconifyPreload!==void 0){const o=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof o=="object"&&o!==null&&(o instanceof Array?o:[o]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!Dr(r))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const o=e.IconifyProviders;if(typeof o=="object"&&o!==null)for(let n in o){const r="IconifyProviders["+n+"] is invalid.";try{const s=o[n];if(typeof s!="object"||!s||s.resources===void 0)continue;Mr(n,s)||console.error(r)}catch{console.error(r)}}}}class Nn extends fe.Component{constructor(o){super(o),this.state={icon:null}}_abortLoading(){this._loading&&(this._loading.abort(),this._loading=null)}_setData(o){this.state.icon!==o&&this.setState({icon:o})}_checkIcon(o){const n=this.state,r=this.props.icon;if(typeof r=="object"&&r!==null&&typeof r.body=="string"){this._icon="",this._abortLoading(),(o||n.icon===null)&&this._setData({data:r});return}let s;if(typeof r!="string"||(s=it(r,!1,!0))===null){this._abortLoading(),this._setData(null);return}const i=Sr(s);if(!i){(!this._loading||this._loading.name!==r)&&(this._abortLoading(),this._icon="",this._setData(null),i!==null&&(this._loading={name:r,abort:il([s],this._checkIcon.bind(this,!1))}));return}if(this._icon!==r||n.icon===null){this._abortLoading(),this._icon=r;const l=["iconify"];s.prefix!==""&&l.push("iconify--"+s.prefix),s.provider!==""&&l.push("iconify--"+s.provider),this._setData({data:i,classes:l}),this.props.onLoad&&this.props.onLoad(r)}}componentDidMount(){this._checkIcon(!1)}componentDidUpdate(o){o.icon!==this.props.icon&&this._checkIcon(!0)}componentWillUnmount(){this._abortLoading()}render(){const o=this.props,n=this.state.icon;if(n===null)return o.children?o.children:fe.createElement("span",{});let r=o;return n.classes&&(r={...o,className:(typeof o.className=="string"?o.className+" ":"")+n.classes.join(" ")}),yl({...Yt,...n.data},r,o._inline,o._ref)}}const vl=fe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!1};return fe.createElement(Nn,r)});fe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!0};return fe.createElement(Nn,r)});var wl=vl;const Cl=e=>{const o=e.includes("youtube.com")||e.includes("youtu.be"),n=e.includes("vimeo.com");return o||n};function at({url:e,style:o,controls:n,modestbranding:r}){var a;const{t:s}=Q(),i=e.includes("youtube.com")||e.includes("youtu.be"),l=e.includes("vimeo.com");if(i){const c=((a=e.split("v=")[1])==null?void 0:a.split("&")[0])||e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:t.jsx("iframe",{src:`https://www.youtube.com/embed/${c}?modestbranding=${r}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(l){const c=e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:t.jsx("iframe",{src:`https://player.vimeo.com/video/${c}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return t.jsx(u,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:t.jsxs(u,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[t.jsx(wl,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),t.jsx(O,{variant:"body1",sx:{opacity:.5},children:s("studio.videoDialogNoSrc")})]})})}at.propTypes={url:d.string.isRequired,style:d.object,controls:d.number,modestbranding:d.number};at.defaultProps={style:{},controls:1,modestbranding:1};function An({setParams:e,onClose:o,params:n}){const{t:r}=Q(),[s,i]=w.useState(""),l=s&&n.blockletVideos.includes(s),a=Cl(s),c=()=>{e(f=>{const h=[...f.blockletVideos];return h.push(s),{...f,blockletVideos:h}}),o()};return t.jsxs(rt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[t.jsx(Jo,{children:r("studio.videoDialogTitle")}),t.jsxs(Qo,{children:[t.jsx(es,{fullWidth:!0,value:s,onChange:f=>i(f.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:s?t.jsx(Ve,{position:"end",children:t.jsx(oe,{onClick:()=>i(""),children:t.jsx(ks,{})})}):null,error:l}),l&&t.jsx(O,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),t.jsx(at,{url:s,style:{marginTop:"20px",borderRadius:"4px"}})]}),t.jsxs(Yo,{children:[t.jsx(Z,{onClick:()=>o(),children:r("studio.cancel")}),t.jsx(Z,{disabled:!a||l,onClick:c,children:r("studio.confirm")})]})]})}An.propTypes={onClose:d.func.isRequired,params:d.object.isRequired,setParams:d.func.isRequired};const Ao=w.lazy(()=>en(()=>import("./index-CmBEz5CL.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.Uploader})));function En({projectId:e,readOnly:o,loading:n,blocklet:r,params:s,setParams:i,paramsErrTip:l,setParamsErrTip:a,setLoading:c,initUrl:f,initLogoUrl:h,setInitLogoUrl:k,componentDid:x}){const{t:p,locale:j}=Q(),{api:v}=me(),I=St(),g=w.useRef(null),b=w.useRef(null),[C,_]=br(r),[T,D]=w.useState(!1),$=Ps({messageType:"connect-store-message",onOpen:()=>c(!0),onClose:()=>c(!1)}),R=async S=>{const P=setTimeout(()=>{c(!1)},2e4),W=await gr(v,S);c(!1),clearTimeout(P),window.parent.postMessage({event:"studioDialog.connected",componentDid:x},"*"),I(window.location.pathname.replace(`${X.UNOWNED_DID}/create`,`${W}/create`),{replace:!0})},A=()=>{if(!s.blockletTitle){U.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(C!=null&&C.url)){U.error(p("blocklet.publish.noStoreSelected"));return}const S=xr();$(async(P,W)=>{var F,G,ee;try{const J=await v.connectByStudio({input:{did:(F=r==null?void 0:r.meta)==null?void 0:F.did,blockletTitle:s==null?void 0:s.blockletTitle,storeUrl:C.url,storeId:C.id,storeName:C.name,type:((G=s==null?void 0:s.blockletComponents)==null?void 0:G.length)>0?"pack":"resource",componentDid:x,messageId:S,tenantScope:(f==null?void 0:f.searchParams.get("tenantScope"))||""}});if(!(J!=null&&J.url)){U.error("failed to connect to store");return}W(J.url),R({did:(ee=r==null?void 0:r.meta)==null?void 0:ee.did,projectId:"",messageId:S})}catch(J){const se=De(J);U.error(se),c(!1)}})},q=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/logo/upload`,E=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/screenshot/upload`,m=s!=null&&s.blockletLogo?`${q}/${s.blockletLogo}`:`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,y=((s==null?void 0:s.blockletScreenshots)||[]).filter(Boolean).map(S=>`${E}/${S}`),L=()=>o?!1:!e||e===X.UNOWNED_DID?(U.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,z=S=>{if(!S.destination)return;const P=Array.from(s.blockletScreenshots),[W]=P.splice(S.source.index,1);P.splice(S.destination.index,0,W),i(F=>({...F,blockletScreenshots:P}))},B=S=>{if(!S.destination)return;const P=Array.from(s.blockletVideos),[W]=P.splice(S.source.index,1);P.splice(S.destination.index,0,W),i(F=>({...F,blockletVideos:P}))};return t.jsxs(Rl,{children:[t.jsx(u,{display:"flex",className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:s.blockletTitle||"",onChange:S=>{a({blockletTitle:""}),i({blockletTitle:S.target.value})},error:!!l.blockletTitle,helperText:l.blockletTitle||""}),t.jsx(Y,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:e===X.UNOWNED_DID&&t.jsx(Ve,{position:"end",children:t.jsx(Qt,{blocklet:r,store:C,componentDid:x,onChangeStore:_,disabled:!s.blockletTitle||o||n,loading:n,onClick:A})})},error:!!l.projectId,helperText:l.projectId||"",value:e===X.UNOWNED_DID?"":`did:abt:${e}`,sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletDescription||"",onChange:S=>{a({blockletDescription:""}),i({blockletDescription:S.target.value})},error:!!l.blockletDescription,helperText:l.blockletDescription||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletHomepage||"",onChange:S=>{S.target.value&&!/^(http|https):\/\//.test(S.target.value)?a({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletHomepage:""}),i({blockletHomepage:S.target.value})},error:!!l.blockletHomepage,helperText:l.blockletHomepage||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletCommunity||"",onChange:S=>{S.target.value&&!/^(http|https):\/\//.test(S.target.value)?a({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletCommunity:""}),i({blockletCommunity:S.target.value})},error:!!l.blockletCommunity,helperText:l.blockletCommunity||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletSupport||"",onChange:S=>{S.target.value&&!/^(http|https):\/\//.test(S.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(S.target.value)?a({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):a({blockletSupport:""}),i({blockletSupport:S.target.value})},error:!!l.blockletSupport,helperText:l.blockletSupport||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletRepository||"",onChange:S=>{S.target.value&&!/^(git|https|svn)/.test(S.target.value)?a({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletRepository:""}),i({blockletRepository:S.target.value})},error:!!l.blockletRepository,helperText:l.blockletRepository||"",sx:{mt:3}})]})}),t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(u,{sx:{flex:1},children:[t.jsxs(u,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(O,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.type"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),t.jsx(u,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:t.jsx(Vo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:h||m,onClick:()=>{var S;L()&&((S=g.current)==null||S.open())}})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(O,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{sx:{border:"none"},variant:"outlined",size:"small",children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(bo,{onDragEnd:o?void 0:z,children:t.jsx(xo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(S,P)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:P.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:P.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:S.innerRef,...S.droppableProps,children:[y.map((W,F)=>t.jsx(go,{draggableId:W,index:F,isDragDisabled:o,children:(G,ee)=>t.jsxs(u,{ref:G.innerRef,...G.draggableProps,className:"screenshot",sx:{transform:ee.isDragging?"scale(1.05)":"none",boxShadow:ee.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx("img",{alt:"screenshot",src:W}),!o&&t.jsx(oe,{...G.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(gt,{})}),!o&&t.jsx(oe,{className:"action",onClick:()=>{i(J=>{const se=[...J.blockletScreenshots];return se.splice(F,1),{...J,blockletScreenshots:se}})},children:t.jsx(ko,{})})]})},W)),S.placeholder,y.length<5&&t.jsx(u,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var W;L()&&((W=b.current)==null||W.open())},children:"+"})]})})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(O,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.videoType"),":"," "]}),t.jsxs(u,{component:"span",sx:{color:"#007ec6"},children:[t.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",t.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(bo,{onDragEnd:o?void 0:B,children:t.jsx(xo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(S,P)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:P.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:P.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:S.innerRef,...S.droppableProps,children:[s.blockletVideos.map((W,F)=>t.jsx(go,{draggableId:W,index:F,isDragDisabled:o,children:(G,ee)=>t.jsxs(u,{ref:G.innerRef,...G.draggableProps,className:"screenshot",sx:{transform:ee.isDragging?"scale(1.05)":"none",boxShadow:ee.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx(at,{url:W,style:{pointerEvents:ee.isDragging?"none":"auto"}}),!o&&t.jsx(oe,{...G.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(gt,{})}),!o&&t.jsx(oe,{className:"action",onClick:()=>{i(J=>{const se=[...J.blockletVideos];return se.splice(F,1),{...J,blockletVideos:se}})},children:t.jsx(ko,{})})]})},W)),S.placeholder,s.blockletVideos.length<3&&t.jsx(u,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{L()&&D(!0)},children:"+"})]})})})]})]})}),t.jsxs(w.Suspense,{fallback:t.jsx(We,{}),children:[t.jsx(Ao,{ref:g,locale:j,popup:!0,onUploadFinish:S=>{var P;i({blockletLogo:S.data.filename}),k(""),(P=g.current)==null||P.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:q,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"),T&&t.jsx(An,{onClose:()=>D(!1),params:s,setParams:i}),t.jsx(Ao,{ref:b,popup:!0,onUploadFinish:S=>{var P;i(W=>{var G;const F=W.blockletScreenshots||[];return F.push((G=S.data)==null?void 0:G.filename),{...W,blockletScreenshots:F}}),(P=b.current)==null||P.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:E,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-y.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")]})]})}En.propTypes={projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired,blocklet:d.object.isRequired,setLoading:d.func.isRequired,initUrl:d.object.isRequired,componentDid:d.isRequired,initLogoUrl:d.string.isRequired,setInitLogoUrl:d.func.isRequired};const Rl=ae.div`
132
+ `;var Jt={},fr=he;Object.defineProperty(Jt,"__esModule",{value:!0});var gt=Jt.default=void 0,hr=fr(be()),mr=t;gt=Jt.default=(0,hr.default)((0,mr.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 wo="lastWantToConnectStoreId";function br(e){var a,c;const[o,n]=w.useState(null),{session:r}=lt(),s=w.useCallback(f=>{n(f),localStorage.setItem(wo,f==null?void 0:f.id)},[n]),i=w.useMemo(()=>{var x,p,j,v;const f=localStorage.getItem(wo),h=f?(((x=e==null?void 0:e.settings)==null?void 0:x.storeList)||[]).find(I=>I.id===f):null;if(h)return h;let k=(((p=e==null?void 0:e.settings)==null?void 0:p.storeList)||[]).find(I=>{var g;return!(I.id!==X.BLOCKLET_STORE.id||I.scope&&I.scope!=="studio"&&I.scope!==((g=r==null?void 0:r.user)==null?void 0:g.did))});return k||(k=(v=(j=e==null?void 0:e.settings)==null?void 0:j.storeList)==null?void 0:v[0]),k},[(a=e==null?void 0:e.settings)==null?void 0:a.storeList,(c=r==null?void 0:r.user)==null?void 0:c.did]);return[o||i||{},s]}const ht={};async function xn(e,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:s=""}){ht[s]&&clearTimeout(ht[s]),await new Promise(a=>setTimeout(a,r));const i=Date.now(),l=async(a,c)=>{try{const f=await e();a(f)}catch(f){Date.now()-i>n?c(f):s?ht[s]=setTimeout(()=>l(a,c),o):setTimeout(()=>l(a,c),o)}};return new Promise(l)}function xr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function gr(e,{did:o,projectId:n,messageId:r}){return xn(async()=>{var i;const s=await e.getProject({input:{did:o,projectId:n,messageId:r}});if(!((i=s==null?void 0:s.project)!=null&&i.blockletDid))throw new Error("Connected store not found");return s.project.blockletDid},{timerKey:"connect-studio"})}function kr(e,{did:o,projectId:n,storeId:r}){return xn(async()=>{var l,a;const s=await e.getProject({input:{did:o,projectId:n,messageId:""}});if(!((a=(l=s==null?void 0:s.project)==null?void 0:l.connectedStores)!=null&&a.length))throw new Error("Connected store not found");if(!s.project.connectedStores.find(c=>c.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}const gn=({fromBlocklet:e,nodeInfo:o,blocklet:n,userDid:r})=>{var l,a;const s=e?(l=n==null?void 0:n.meta)==null?void 0:l.did:o==null?void 0:o.did;let i=e?((a=n==null?void 0:n.settings)==null?void 0:a.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(i)||(i=[]),i=i.filter(c=>c.protected||!c.scope||c.scope==="studio"||c.scope===r),{teamDid:s,storeList:i}};function Qt({blocklet:e,store:o={},onChangeStore:n,onClick:r,disabled:s,loading:i,componentDid:l}){var m,y,L;const{t:a}=Q(),{session:c}=lt(),{api:f,info:h,inService:k}=me(),x=_e(),[p,j]=w.useState(!1),v=w.useRef(null),[I,g]=w.useState(!1),[b,C]=w.useState(null),_=z=>{n(z),j(!1)},T=()=>{j(!p)},D=z=>{v.current&&v.current.contains(z.target)||j(!1)},$=()=>{g(!0)},R=()=>{g(!1)},A=async()=>{var z;if(b)try{await f.deleteBlockletStore({input:{teamDid:e.meta.did,url:b.url,projectId:"",scope:b.scope||"studio"}}),await((z=x==null?void 0:x.actions)==null?void 0:z.refreshBlocklet())}catch(B){U.error(`Remove Blocklet Store Error: ${De(B)}`)}finally{C(null)}},{storeList:q}=gn({fromBlocklet:k,blocklet:e,nodeInfo:h,componentDid:l,userDid:(m=c==null?void 0:c.user)==null?void 0:m.did}),E=(y=e==null?void 0:e.meta)==null?void 0:y.did;return t.jsxs(t.Fragment,{children:[t.jsxs(xt,{disabled:s,ref:v,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[t.jsxs(Z,{onClick:r,children:[i&&t.jsx(Ze,{size:14,sx:{mr:.5}}),`${a("common.connect")} ${o.name||""}`]}),t.jsx(Z,{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:T,children:t.jsx(Ms,{})})]}),t.jsx(Fo,{sx:{zIndex:10},open:p,anchorEl:v.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:z})=>t.jsx(Ho,{...z,style:{transformOrigin:"center top"},children:t.jsx(It,{children:t.jsx(Go,{onClickAway:D,children:t.jsxs(Xo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[q==null?void 0:q.map(B=>{var S;return t.jsxs(ue,{selected:B.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>_(B),children:[t.jsxs(u,{children:[t.jsx(pe,{sx:{fontSize:"16px"},maxLength:24,children:B.name}),t.jsx(pe,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:B.url})]}),_s({store:B,userDid:(S=c==null?void 0:c.user)==null?void 0:S.did})&&t.jsx(oe,{sx:{ml:1},onClick:P=>{P.preventDefault(),P.stopPropagation(),C(B)},children:t.jsx(ne,{icon:"ic:outline-delete"})})]},B.url)}),t.jsx(Kn,{}),t.jsxs(ue,{onClick:$,children:[t.jsx(_t,{font:!0}),t.jsx(O,{variant:"inherit",children:a("store.blockletRegistry.addRegistry")})]})]})})})})}),I&&t.jsx(ln,{hiddenChildren:!0,open:!0,onClose:R,teamDid:E,storeList:q,scope:"studio",onAdd:(L=x==null?void 0:x.actions)==null?void 0:L.refreshBlocklet}),b&&t.jsx(Pt,{displayError:!0,title:`${a("common.delete")} ${b.name}`,description:a("blocklet.publish.deleteStoreTip",{name:b.name}),confirm:a("common.confirm"),onConfirm:A,onCancel:()=>C(null)})]})}Qt.propTypes={store:d.object,blocklet:d.object,onChangeStore:d.func.isRequired,onClick:d.func.isRequired,loading:d.bool.isRequired,disabled:d.bool.isRequired,componentDid:d.string.isRequired,projectType:d.string.isRequired,getData:d.func.isRequired};Qt.defaultProps={store:null,blocklet:null};var fe=w;const Ee=/^[a-z0-9]+(-[a-z0-9]+)*$/,it=(e,o,n,r="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const a=s.pop(),c=s.pop(),f={provider:s.length>0?s[0]:r,prefix:c,name:a};return o&&!Qe(f)?null:f}const i=s[0],l=i.split("-");if(l.length>1){const a={provider:r,prefix:l.shift(),name:l.join("-")};return o&&!Qe(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:i};return o&&!Qe(a,n)?null:a}return null},Qe=(e,o)=>e?!!((e.provider===""||e.provider.match(Ee))&&(o&&e.prefix===""||e.prefix.match(Ee))&&e.name.match(Ee)):!1,kn=Object.freeze({left:0,top:0,width:16,height:16}),tt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Yt=Object.freeze({...kn,...tt}),kt=Object.freeze({...Yt,body:"",hidden:!1});function jr(e,o){const n={};!e.hFlip!=!o.hFlip&&(n.hFlip=!0),!e.vFlip!=!o.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(o.rotate||0))%4;return r&&(n.rotate=r),n}function Co(e,o){const n=jr(e,o);for(const r in kt)r in tt?r in e&&!(r in n)&&(n[r]=tt[r]):r in o?n[r]=o[r]:r in e&&(n[r]=e[r]);return n}function yr(e,o){const n=e.icons,r=e.aliases||Object.create(null),s=Object.create(null);function i(l){if(n[l])return s[l]=[];if(!(l in s)){s[l]=null;const a=r[l]&&r[l].parent,c=a&&i(a);c&&(s[l]=[a].concat(c))}return s[l]}return Object.keys(n).concat(Object.keys(r)).forEach(i),s}function vr(e,o,n){const r=e.icons,s=e.aliases||Object.create(null);let i={};function l(a){i=Co(r[a]||s[a],i)}return l(o),n.forEach(l),Co(e,i)}function jn(e,o){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(s=>{o(s,null),n.push(s)});const r=yr(e);for(const s in r){const i=r[s];i&&(o(s,vr(e,s,i)),n.push(s))}return n}const wr={provider:"",aliases:{},not_found:{},...kn};function mt(e,o){for(const n in o)if(n in e&&typeof e[n]!=typeof o[n])return!1;return!0}function yn(e){if(typeof e!="object"||e===null)return null;const o=e;if(typeof o.prefix!="string"||!e.icons||typeof e.icons!="object"||!mt(e,wr))return null;const n=o.icons;for(const s in n){const i=n[s];if(!s.match(Ee)||typeof i.body!="string"||!mt(i,kt))return null}const r=o.aliases||Object.create(null);for(const s in r){const i=r[s],l=i.parent;if(!s.match(Ee)||typeof l!="string"||!n[l]&&!r[l]||!mt(i,kt))return null}return o}const Ro=Object.create(null);function Cr(e,o){return{provider:e,prefix:o,icons:Object.create(null),missing:new Set}}function ve(e,o){const n=Ro[e]||(Ro[e]=Object.create(null));return n[o]||(n[o]=Cr(e,o))}function Zt(e,o){return yn(o)?jn(o,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function Rr(e,o,n){try{if(typeof n.body=="string")return e.icons[o]={...n},!0}catch{}return!1}let Oe=!1;function vn(e){return typeof e=="boolean"&&(Oe=e),Oe}function Sr(e){const o=typeof e=="string"?it(e,!0,Oe):e;if(o){const n=ve(o.provider,o.prefix),r=o.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function Ir(e,o){const n=it(e,!0,Oe);if(!n)return!1;const r=ve(n.provider,n.prefix);return Rr(r,n.name,o)}function Dr(e,o){if(typeof e!="object")return!1;if(typeof o!="string"&&(o=e.provider||""),Oe&&!o&&!e.prefix){let s=!1;return yn(e)&&(e.prefix="",jn(e,(i,l)=>{l&&Ir(i,l)&&(s=!0)})),s}const n=e.prefix;if(!Qe({provider:o,prefix:n,name:"a"}))return!1;const r=ve(o,n);return!!Zt(r,e)}const wn=Object.freeze({width:null,height:null}),Cn=Object.freeze({...wn,...tt}),Tr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,_r=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function So(e,o,n){if(o===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*o*n)/n;if(typeof e!="string")return e;const r=e.split(Tr);if(r===null||!r.length)return e;const s=[];let i=r.shift(),l=_r.test(i);for(;;){if(l){const a=parseFloat(i);isNaN(a)?s.push(i):s.push(Math.ceil(a*o*n)/n)}else s.push(i);if(i=r.shift(),i===void 0)return s.join("");l=!l}}const Pr=e=>e==="unset"||e==="undefined"||e==="none";function Lr(e,o){const n={...Yt,...e},r={...Cn,...o},s={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,r].forEach(j=>{const v=[],I=j.hFlip,g=j.vFlip;let b=j.rotate;I?g?b+=2:(v.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),v.push("scale(-1 1)"),s.top=s.left=0):g&&(v.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),v.push("scale(1 -1)"),s.top=s.left=0);let C;switch(b<0&&(b-=Math.floor(b/4)*4),b=b%4,b){case 1:C=s.height/2+s.top,v.unshift("rotate(90 "+C.toString()+" "+C.toString()+")");break;case 2:v.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:C=s.width/2+s.left,v.unshift("rotate(-90 "+C.toString()+" "+C.toString()+")");break}b%2===1&&(s.left!==s.top&&(C=s.left,s.left=s.top,s.top=C),s.width!==s.height&&(C=s.width,s.width=s.height,s.height=C)),v.length&&(i='<g transform="'+v.join(" ")+'">'+i+"</g>")});const l=r.width,a=r.height,c=s.width,f=s.height;let h,k;l===null?(k=a===null?"1em":a==="auto"?f:a,h=So(k,c/f)):(h=l==="auto"?c:l,k=a===null?So(h,f/c):a==="auto"?f:a);const x={},p=(j,v)=>{Pr(v)||(x[j]=v.toString())};return p("width",h),p("height",k),x.viewBox=s.left.toString()+" "+s.top.toString()+" "+c.toString()+" "+f.toString(),{attributes:x,body:i}}const qr=/\sid="(\S+)"/g,$r="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Nr=0;function Ar(e,o=$r){const n=[];let r;for(;r=qr.exec(e);)n.push(r[1]);if(!n.length)return e;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(i=>{const l=typeof o=="function"?o(i):o+(Nr++).toString(),a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+l+s+"$3")}),e=e.replace(new RegExp(s,"g"),""),e}const jt=Object.create(null);function Er(e,o){jt[e]=o}function yt(e){return jt[e]||jt[""]}function Kt(e){let o;if(typeof e.resources=="string")o=[e.resources];else if(o=e.resources,!(o instanceof Array)||!o.length)return null;return{resources:o,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const eo=Object.create(null),Ne=["https://api.simplesvg.com","https://api.unisvg.com"],Ye=[];for(;Ne.length>0;)Ne.length===1||Math.random()>.5?Ye.push(Ne.shift()):Ye.push(Ne.pop());eo[""]=Kt({resources:["https://api.iconify.design"].concat(Ye)});function Mr(e,o){const n=Kt(o);return n===null?!1:(eo[e]=n,!0)}function to(e){return eo[e]}const Or=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Io=Or();function zr(e,o){const n=to(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let s=0;n.resources.forEach(l=>{s=Math.max(s,l.length)});const i=o+".json?icons=";r=n.maxURL-s-n.path.length-i.length}return r}function Br(e){return e===404}const Vr=(e,o,n)=>{const r=[],s=zr(e,o),i="icons";let l={type:i,provider:e,prefix:o,icons:[]},a=0;return n.forEach((c,f)=>{a+=c.length+1,a>=s&&f>0&&(r.push(l),l={type:i,provider:e,prefix:o,icons:[]},a=c.length),l.icons.push(c)}),r.push(l),r};function Wr(e){if(typeof e=="string"){const o=to(e);if(o)return o.path}return"/"}const Ur=(e,o,n)=>{if(!Io){n("abort",424);return}let r=Wr(o.provider);switch(o.type){case"icons":{const i=o.prefix,a=o.icons.join(","),c=new URLSearchParams({icons:a});r+=i+".json?"+c.toString();break}case"custom":{const i=o.uri;r+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n("abort",400);return}let s=503;Io(e+r).then(i=>{const l=i.status;if(l!==200){setTimeout(()=>{n(Br(l)?"abort":"next",l)});return}return s=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?n("abort",i):n("next",s)});return}setTimeout(()=>{n("success",i)})}).catch(()=>{n("next",s)})},Fr={prepare:Vr,send:Ur};function Hr(e){const o={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((s,i)=>s.provider!==i.provider?s.provider.localeCompare(i.provider):s.prefix!==i.prefix?s.prefix.localeCompare(i.prefix):s.name.localeCompare(i.name));let r={provider:"",prefix:"",name:""};return e.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const i=s.provider,l=s.prefix,a=s.name,c=n[i]||(n[i]=Object.create(null)),f=c[l]||(c[l]=ve(i,l));let h;a in f.icons?h=o.loaded:l===""||f.missing.has(a)?h=o.missing:h=o.pending;const k={provider:i,prefix:l,name:a};h.push(k)}),o}function Rn(e,o){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(s=>s.id!==o))})}function Gr(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const o=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!o.length)return;let n=!1;const r=e.provider,s=e.prefix;o.forEach(i=>{const l=i.icons,a=l.pending.length;l.pending=l.pending.filter(c=>{if(c.prefix!==s)return!0;const f=c.name;if(e.icons[f])l.loaded.push({provider:r,prefix:s,name:f});else if(e.missing.has(f))l.missing.push({provider:r,prefix:s,name:f});else return n=!0,!0;return!1}),l.pending.length!==a&&(n||Rn([e],i.id),i.callback(l.loaded.slice(0),l.missing.slice(0),l.pending.slice(0),i.abort))})}))}let Xr=0;function Jr(e,o,n){const r=Xr++,s=Rn.bind(null,n,r);if(!o.pending.length)return s;const i={id:r,icons:o,callback:e,abort:s};return n.forEach(l=>{(l.loaderCallbacks||(l.loaderCallbacks=[])).push(i)}),s}function Qr(e,o=!0,n=!1){const r=[];return e.forEach(s=>{const i=typeof s=="string"?it(s,o,n):s;i&&r.push(i)}),r}var Yr={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Zr(e,o,n,r){const s=e.resources.length,i=e.random?Math.floor(Math.random()*s):e.index;let l;if(e.random){let D=e.resources.slice(0);for(l=[];D.length>1;){const $=Math.floor(Math.random()*D.length);l.push(D[$]),D=D.slice(0,$).concat(D.slice($+1))}l=l.concat(D)}else l=e.resources.slice(i).concat(e.resources.slice(0,i));const a=Date.now();let c="pending",f=0,h,k=null,x=[],p=[];typeof r=="function"&&p.push(r);function j(){k&&(clearTimeout(k),k=null)}function v(){c==="pending"&&(c="aborted"),j(),x.forEach(D=>{D.status==="pending"&&(D.status="aborted")}),x=[]}function I(D,$){$&&(p=[]),typeof D=="function"&&p.push(D)}function g(){return{startTime:a,payload:o,status:c,queriesSent:f,queriesPending:x.length,subscribe:I,abort:v}}function b(){c="failed",p.forEach(D=>{D(void 0,h)})}function C(){x.forEach(D=>{D.status==="pending"&&(D.status="aborted")}),x=[]}function _(D,$,R){const A=$!=="success";switch(x=x.filter(q=>q!==D),c){case"pending":break;case"failed":if(A||!e.dataAfterTimeout)return;break;default:return}if($==="abort"){h=R,b();return}if(A){h=R,x.length||(l.length?T():b());return}if(j(),C(),!e.random){const q=e.resources.indexOf(D.resource);q!==-1&&q!==e.index&&(e.index=q)}c="completed",p.forEach(q=>{q(R)})}function T(){if(c!=="pending")return;j();const D=l.shift();if(D===void 0){if(x.length){k=setTimeout(()=>{j(),c==="pending"&&(C(),b())},e.timeout);return}b();return}const $={status:"pending",resource:D,callback:(R,A)=>{_($,R,A)}};x.push($),f++,k=setTimeout(T,e.rotate),n(D,o,$.callback)}return setTimeout(T),g}function Sn(e){const o={...Yr,...e};let n=[];function r(){n=n.filter(a=>a().status==="pending")}function s(a,c,f){const h=Zr(o,a,c,(k,x)=>{r(),f&&f(k,x)});return n.push(h),h}function i(a){return n.find(c=>a(c))||null}return{query:s,find:i,setIndex:a=>{o.index=a},getIndex:()=>o.index,cleanup:r}}function Do(){}const bt=Object.create(null);function Kr(e){if(!bt[e]){const o=to(e);if(!o)return;const n=Sn(o),r={config:o,redundancy:n};bt[e]=r}return bt[e]}function el(e,o,n){let r,s;if(typeof e=="string"){const i=yt(e);if(!i)return n(void 0,424),Do;s=i.send;const l=Kr(e);l&&(r=l.redundancy)}else{const i=Kt(e);if(i){r=Sn(i);const l=e.resources?e.resources[0]:"",a=yt(l);a&&(s=a.send)}}return!r||!s?(n(void 0,424),Do):r.query(o,s,n)().abort}const To="iconify2",ze="iconify",In=ze+"-count",_o=ze+"-version",Dn=36e5,tl=168;function vt(e,o){try{return e.getItem(o)}catch{}}function oo(e,o,n){try{return e.setItem(o,n),!0}catch{}}function Po(e,o){try{e.removeItem(o)}catch{}}function wt(e,o){return oo(e,In,o.toString())}function Ct(e){return parseInt(vt(e,In))||0}const ct={local:!0,session:!0},Tn={local:new Set,session:new Set};let no=!1;function ol(e){no=e}let Ge=typeof window>"u"?{}:window;function _n(e){const o=e+"Storage";try{if(Ge&&Ge[o]&&typeof Ge[o].length=="number")return Ge[o]}catch{}ct[e]=!1}function Pn(e,o){const n=_n(e);if(!n)return;const r=vt(n,_o);if(r!==To){if(r){const a=Ct(n);for(let c=0;c<a;c++)Po(n,ze+c.toString())}oo(n,_o,To),wt(n,0);return}const s=Math.floor(Date.now()/Dn)-tl,i=a=>{const c=ze+a.toString(),f=vt(n,c);if(typeof f=="string"){try{const h=JSON.parse(f);if(typeof h=="object"&&typeof h.cached=="number"&&h.cached>s&&typeof h.provider=="string"&&typeof h.data=="object"&&typeof h.data.prefix=="string"&&o(h,a))return!0}catch{}Po(n,c)}};let l=Ct(n);for(let a=l-1;a>=0;a--)i(a)||(a===l-1?(l--,wt(n,l)):Tn[e].add(a))}function Ln(){if(!no){ol(!0);for(const e in ct)Pn(e,o=>{const n=o.data,r=o.provider,s=n.prefix,i=ve(r,s);if(!Zt(i,n).length)return!1;const l=n.lastModified||-1;return i.lastModifiedCached=i.lastModifiedCached?Math.min(i.lastModifiedCached,l):l,!0})}}function nl(e,o){const n=e.lastModifiedCached;if(n&&n>=o)return n===o;if(e.lastModifiedCached=o,n)for(const r in ct)Pn(r,s=>{const i=s.data;return s.provider!==e.provider||i.prefix!==e.prefix||i.lastModified===o});return!0}function sl(e,o){no||Ln();function n(r){let s;if(!ct[r]||!(s=_n(r)))return;const i=Tn[r];let l;if(i.size)i.delete(l=Array.from(i).shift());else if(l=Ct(s),!wt(s,l+1))return;const a={cached:Math.floor(Date.now()/Dn),provider:e.provider,data:o};return oo(s,ze+l.toString(),JSON.stringify(a))}o.lastModified&&!nl(e,o.lastModified)||Object.keys(o.icons).length&&(o.not_found&&(o=Object.assign({},o),delete o.not_found),n("local")||n("session"))}function Lo(){}function rl(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Gr(e)}))}function ll(e,o){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(o).sort():e.iconsToLoad=o,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:r}=e,s=e.iconsToLoad;delete e.iconsToLoad;let i;if(!s||!(i=yt(n)))return;i.prepare(n,r,s).forEach(a=>{el(n,a,c=>{if(typeof c!="object")a.icons.forEach(f=>{e.missing.add(f)});else try{const f=Zt(e,c);if(!f.length)return;const h=e.pendingIcons;h&&f.forEach(k=>{h.delete(k)}),sl(e,c)}catch(f){console.error(f)}rl(e)})})}))}const il=(e,o)=>{const n=Qr(e,!0,vn()),r=Hr(n);if(!r.pending.length){let c=!0;return o&&setTimeout(()=>{c&&o(r.loaded,r.missing,r.pending,Lo)}),()=>{c=!1}}const s=Object.create(null),i=[];let l,a;return r.pending.forEach(c=>{const{provider:f,prefix:h}=c;if(h===a&&f===l)return;l=f,a=h,i.push(ve(f,h));const k=s[f]||(s[f]=Object.create(null));k[h]||(k[h]=[])}),r.pending.forEach(c=>{const{provider:f,prefix:h,name:k}=c,x=ve(f,h),p=x.pendingIcons||(x.pendingIcons=new Set);p.has(k)||(p.add(k),s[f][h].push(k))}),i.forEach(c=>{const{provider:f,prefix:h}=c;s[f][h].length&&ll(c,s[f][h])}),o?Jr(o,r,i):Lo};function cl(e,o){const n={...e};for(const r in o){const s=o[r],i=typeof s;r in wn?(s===null||s&&(i==="string"||i==="number"))&&(n[r]=s):i===typeof n[r]&&(n[r]=r==="rotate"?s%4:s)}return n}const al=/[\s,]+/;function dl(e,o){o.split(al).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function ul(e,o=0){const n=e.replace(/^-?[0-9.]*/,"");function r(s){for(;s<0;)s+=4;return s%4}if(n===""){const s=parseInt(e);return isNaN(s)?0:r(s)}else if(n!==e){let s=0;switch(n){case"%":s=25;break;case"deg":s=90}if(s){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i=i/s,i%1===0?r(i):0)}}return o}function pl(e,o){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in o)n+=" "+r+'="'+o[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function fl(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function hl(e){return"data:image/svg+xml,"+fl(e)}function ml(e){return'url("'+hl(e)+'")'}let Me;function bl(){try{Me=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Me=null}}function xl(e){return Me===void 0&&bl(),Me?Me.createHTML(e):e}const qn={...Cn,inline:!1},gl={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},kl={display:"inline-block"},Rt={backgroundColor:"currentColor"},$n={backgroundColor:"transparent"},qo={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},$o={WebkitMask:Rt,mask:Rt,background:$n};for(const e in $o){const o=$o[e];for(const n in qo)o[e+n]=qo[n]}const jl={...qn,inline:!0};function No(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const yl=(e,o,n,r)=>{const s=n?jl:qn,i=cl(s,o),l=o.mode||"svg",a={},c=o.style||{},f={...l==="svg"?gl:{},ref:r};for(let g in o){const b=o[g];if(b!==void 0)switch(g){case"icon":case"style":case"children":case"onLoad":case"mode":case"_ref":case"_inline":break;case"inline":case"hFlip":case"vFlip":i[g]=b===!0||b==="true"||b===1;break;case"flip":typeof b=="string"&&dl(i,b);break;case"color":a.color=b;break;case"rotate":typeof b=="string"?i[g]=ul(b):typeof b=="number"&&(i[g]=b);break;case"ariaHidden":case"aria-hidden":b!==!0&&b!=="true"&&delete f["aria-hidden"];break;default:s[g]===void 0&&(f[g]=b)}}const h=Lr(e,i),k=h.attributes;if(i.inline&&(a.verticalAlign="-0.125em"),l==="svg"){f.style={...a,...c},Object.assign(f,k);let g=0,b=o.id;return typeof b=="string"&&(b=b.replace(/-/g,"_")),f.dangerouslySetInnerHTML={__html:xl(Ar(h.body,b?()=>b+"ID"+g++:"iconifyReact"))},fe.createElement("svg",f)}const{body:x,width:p,height:j}=e,v=l==="mask"||(l==="bg"?!1:x.indexOf("currentColor")!==-1),I=pl(x,{...k,width:p+"",height:j+""});return f.style={...a,"--svg":ml(I),width:No(k.width),height:No(k.height),...kl,...v?Rt:$n,...c},fe.createElement("span",f)};vn(!0);Er("",Fr);if(typeof document<"u"&&typeof window<"u"){Ln();const e=window;if(e.IconifyPreload!==void 0){const o=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof o=="object"&&o!==null&&(o instanceof Array?o:[o]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!Dr(r))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const o=e.IconifyProviders;if(typeof o=="object"&&o!==null)for(let n in o){const r="IconifyProviders["+n+"] is invalid.";try{const s=o[n];if(typeof s!="object"||!s||s.resources===void 0)continue;Mr(n,s)||console.error(r)}catch{console.error(r)}}}}class Nn extends fe.Component{constructor(o){super(o),this.state={icon:null}}_abortLoading(){this._loading&&(this._loading.abort(),this._loading=null)}_setData(o){this.state.icon!==o&&this.setState({icon:o})}_checkIcon(o){const n=this.state,r=this.props.icon;if(typeof r=="object"&&r!==null&&typeof r.body=="string"){this._icon="",this._abortLoading(),(o||n.icon===null)&&this._setData({data:r});return}let s;if(typeof r!="string"||(s=it(r,!1,!0))===null){this._abortLoading(),this._setData(null);return}const i=Sr(s);if(!i){(!this._loading||this._loading.name!==r)&&(this._abortLoading(),this._icon="",this._setData(null),i!==null&&(this._loading={name:r,abort:il([s],this._checkIcon.bind(this,!1))}));return}if(this._icon!==r||n.icon===null){this._abortLoading(),this._icon=r;const l=["iconify"];s.prefix!==""&&l.push("iconify--"+s.prefix),s.provider!==""&&l.push("iconify--"+s.provider),this._setData({data:i,classes:l}),this.props.onLoad&&this.props.onLoad(r)}}componentDidMount(){this._checkIcon(!1)}componentDidUpdate(o){o.icon!==this.props.icon&&this._checkIcon(!0)}componentWillUnmount(){this._abortLoading()}render(){const o=this.props,n=this.state.icon;if(n===null)return o.children?o.children:fe.createElement("span",{});let r=o;return n.classes&&(r={...o,className:(typeof o.className=="string"?o.className+" ":"")+n.classes.join(" ")}),yl({...Yt,...n.data},r,o._inline,o._ref)}}const vl=fe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!1};return fe.createElement(Nn,r)});fe.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!0};return fe.createElement(Nn,r)});var wl=vl;const Cl=e=>{const o=e.includes("youtube.com")||e.includes("youtu.be"),n=e.includes("vimeo.com");return o||n};function at({url:e,style:o,controls:n,modestbranding:r}){var a;const{t:s}=Q(),i=e.includes("youtube.com")||e.includes("youtu.be"),l=e.includes("vimeo.com");if(i){const c=((a=e.split("v=")[1])==null?void 0:a.split("&")[0])||e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:t.jsx("iframe",{src:`https://www.youtube.com/embed/${c}?modestbranding=${r}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(l){const c=e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:t.jsx("iframe",{src:`https://player.vimeo.com/video/${c}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return t.jsx(u,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:t.jsxs(u,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[t.jsx(wl,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),t.jsx(O,{variant:"body1",sx:{opacity:.5},children:s("studio.videoDialogNoSrc")})]})})}at.propTypes={url:d.string.isRequired,style:d.object,controls:d.number,modestbranding:d.number};at.defaultProps={style:{},controls:1,modestbranding:1};function An({setParams:e,onClose:o,params:n}){const{t:r}=Q(),[s,i]=w.useState(""),l=s&&n.blockletVideos.includes(s),a=Cl(s),c=()=>{e(f=>{const h=[...f.blockletVideos];return h.push(s),{...f,blockletVideos:h}}),o()};return t.jsxs(rt,{open:!0,fullWidth:!0,maxWidth:"sm",children:[t.jsx(Jo,{children:r("studio.videoDialogTitle")}),t.jsxs(Qo,{children:[t.jsx(es,{fullWidth:!0,value:s,onChange:f=>i(f.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:s?t.jsx(Ve,{position:"end",children:t.jsx(oe,{onClick:()=>i(""),children:t.jsx(ks,{})})}):null,error:l}),l&&t.jsx(O,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),t.jsx(at,{url:s,style:{marginTop:"20px",borderRadius:"4px"}})]}),t.jsxs(Yo,{children:[t.jsx(Z,{onClick:()=>o(),children:r("studio.cancel")}),t.jsx(Z,{disabled:!a||l,onClick:c,children:r("studio.confirm")})]})]})}An.propTypes={onClose:d.func.isRequired,params:d.object.isRequired,setParams:d.func.isRequired};const Ao=w.lazy(()=>en(()=>import("./index-BhCl1uU6.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.Uploader})));function En({projectId:e,readOnly:o,loading:n,blocklet:r,params:s,setParams:i,paramsErrTip:l,setParamsErrTip:a,setLoading:c,initUrl:f,initLogoUrl:h,setInitLogoUrl:k,componentDid:x}){const{t:p,locale:j}=Q(),{api:v}=me(),I=St(),g=w.useRef(null),b=w.useRef(null),[C,_]=br(r),[T,D]=w.useState(!1),$=Ps({messageType:"connect-store-message",onOpen:()=>c(!0),onClose:()=>c(!1)}),R=async S=>{const P=setTimeout(()=>{c(!1)},2e4),W=await gr(v,S);c(!1),clearTimeout(P),window.parent.postMessage({event:"studioDialog.connected",componentDid:x},"*"),I(window.location.pathname.replace(`${X.UNOWNED_DID}/create`,`${W}/create`),{replace:!0})},A=()=>{if(!s.blockletTitle){U.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(C!=null&&C.url)){U.error(p("blocklet.publish.noStoreSelected"));return}const S=xr();$(async(P,W)=>{var F,G,ee;try{const J=await v.connectByStudio({input:{did:(F=r==null?void 0:r.meta)==null?void 0:F.did,blockletTitle:s==null?void 0:s.blockletTitle,storeUrl:C.url,storeId:C.id,storeName:C.name,type:((G=s==null?void 0:s.blockletComponents)==null?void 0:G.length)>0?"pack":"resource",componentDid:x,messageId:S,tenantScope:(f==null?void 0:f.searchParams.get("tenantScope"))||""}});if(!(J!=null&&J.url)){U.error("failed to connect to store");return}W(J.url),R({did:(ee=r==null?void 0:r.meta)==null?void 0:ee.did,projectId:"",messageId:S})}catch(J){const se=De(J);U.error(se),c(!1)}})},q=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/logo/upload`,E=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/screenshot/upload`,m=s!=null&&s.blockletLogo?`${q}/${s.blockletLogo}`:`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,y=((s==null?void 0:s.blockletScreenshots)||[]).filter(Boolean).map(S=>`${E}/${S}`),L=()=>o?!1:!e||e===X.UNOWNED_DID?(U.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,z=S=>{if(!S.destination)return;const P=Array.from(s.blockletScreenshots),[W]=P.splice(S.source.index,1);P.splice(S.destination.index,0,W),i(F=>({...F,blockletScreenshots:P}))},B=S=>{if(!S.destination)return;const P=Array.from(s.blockletVideos),[W]=P.splice(S.source.index,1);P.splice(S.destination.index,0,W),i(F=>({...F,blockletVideos:P}))};return t.jsxs(Rl,{children:[t.jsx(u,{display:"flex",className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:s.blockletTitle||"",onChange:S=>{a({blockletTitle:""}),i({blockletTitle:S.target.value})},error:!!l.blockletTitle,helperText:l.blockletTitle||""}),t.jsx(Y,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:e===X.UNOWNED_DID&&t.jsx(Ve,{position:"end",children:t.jsx(Qt,{blocklet:r,store:C,componentDid:x,onChangeStore:_,disabled:!s.blockletTitle||o||n,loading:n,onClick:A})})},error:!!l.projectId,helperText:l.projectId||"",value:e===X.UNOWNED_DID?"":`did:abt:${e}`,sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletDescription||"",onChange:S=>{a({blockletDescription:""}),i({blockletDescription:S.target.value})},error:!!l.blockletDescription,helperText:l.blockletDescription||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletHomepage||"",onChange:S=>{S.target.value&&!/^(http|https):\/\//.test(S.target.value)?a({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletHomepage:""}),i({blockletHomepage:S.target.value})},error:!!l.blockletHomepage,helperText:l.blockletHomepage||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletCommunity||"",onChange:S=>{S.target.value&&!/^(http|https):\/\//.test(S.target.value)?a({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletCommunity:""}),i({blockletCommunity:S.target.value})},error:!!l.blockletCommunity,helperText:l.blockletCommunity||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletSupport||"",onChange:S=>{S.target.value&&!/^(http|https):\/\//.test(S.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(S.target.value)?a({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):a({blockletSupport:""}),i({blockletSupport:S.target.value})},error:!!l.blockletSupport,helperText:l.blockletSupport||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletRepository||"",onChange:S=>{S.target.value&&!/^(git|https|svn)/.test(S.target.value)?a({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletRepository:""}),i({blockletRepository:S.target.value})},error:!!l.blockletRepository,helperText:l.blockletRepository||"",sx:{mt:3}})]})}),t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(u,{sx:{flex:1},children:[t.jsxs(u,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(O,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.type"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),t.jsx(u,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:t.jsx(Vo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:h||m,onClick:()=>{var S;L()&&((S=g.current)==null||S.open())}})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(O,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{sx:{border:"none"},variant:"outlined",size:"small",children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(bo,{onDragEnd:o?void 0:z,children:t.jsx(xo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(S,P)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:P.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:P.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:S.innerRef,...S.droppableProps,children:[y.map((W,F)=>t.jsx(go,{draggableId:W,index:F,isDragDisabled:o,children:(G,ee)=>t.jsxs(u,{ref:G.innerRef,...G.draggableProps,className:"screenshot",sx:{transform:ee.isDragging?"scale(1.05)":"none",boxShadow:ee.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx("img",{alt:"screenshot",src:W}),!o&&t.jsx(oe,{...G.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(gt,{})}),!o&&t.jsx(oe,{className:"action",onClick:()=>{i(J=>{const se=[...J.blockletScreenshots];return se.splice(F,1),{...J,blockletScreenshots:se}})},children:t.jsx(ko,{})})]})},W)),S.placeholder,y.length<5&&t.jsx(u,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var W;L()&&((W=b.current)==null||W.open())},children:"+"})]})})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(je,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(O,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),t.jsxs(je,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.videoType"),":"," "]}),t.jsxs(u,{component:"span",sx:{color:"#007ec6"},children:[t.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",t.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(bo,{onDragEnd:o?void 0:B,children:t.jsx(xo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(S,P)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:P.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:P.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:S.innerRef,...S.droppableProps,children:[s.blockletVideos.map((W,F)=>t.jsx(go,{draggableId:W,index:F,isDragDisabled:o,children:(G,ee)=>t.jsxs(u,{ref:G.innerRef,...G.draggableProps,className:"screenshot",sx:{transform:ee.isDragging?"scale(1.05)":"none",boxShadow:ee.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx(at,{url:W,style:{pointerEvents:ee.isDragging?"none":"auto"}}),!o&&t.jsx(oe,{...G.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(gt,{})}),!o&&t.jsx(oe,{className:"action",onClick:()=>{i(J=>{const se=[...J.blockletVideos];return se.splice(F,1),{...J,blockletVideos:se}})},children:t.jsx(ko,{})})]})},W)),S.placeholder,s.blockletVideos.length<3&&t.jsx(u,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{L()&&D(!0)},children:"+"})]})})})]})]})}),t.jsxs(w.Suspense,{fallback:t.jsx(We,{}),children:[t.jsx(Ao,{ref:g,locale:j,popup:!0,onUploadFinish:S=>{var P;i({blockletLogo:S.data.filename}),k(""),(P=g.current)==null||P.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:q,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"),T&&t.jsx(An,{onClose:()=>D(!1),params:s,setParams:i}),t.jsx(Ao,{ref:b,popup:!0,onUploadFinish:S=>{var P;i(W=>{var G;const F=W.blockletScreenshots||[];return F.push((G=S.data)==null?void 0:G.filename),{...W,blockletScreenshots:F}}),(P=b.current)==null||P.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:E,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-y.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")]})]})}En.propTypes={projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired,blocklet:d.object.isRequired,setLoading:d.func.isRequired,initUrl:d.object.isRequired,componentDid:d.isRequired,initLogoUrl:d.string.isRequired,setInitLogoUrl:d.func.isRequired};const Rl=ae.div`
133
133
  margin-top: 24px;
134
134
  .screenshot {
135
135
  margin-bottom: 16px;
@@ -177,7 +177,7 @@ import{r as w,k as St,l as st,L as ce,f as Qn,h as Yn,i as dt}from"./vendor-reac
177
177
  padding-bottom: 12px;
178
178
  border-bottom: ${({theme:e})=>`1px solid ${e.palette.divider}`};
179
179
  }
180
- `;function Wn({text:e}){return e?t.jsx(zs,{wrapperElement:{"data-color-mode":"light"},source:js.sanitize(e),rehypePlugins:[[Bs,{target:"_blank"}]]}):t.jsx(Te,{Icon:Nt})}Wn.propTypes={text:d.string.isRequired};function Un({params:e,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:s,readOnly:i}){var h;const{t:l}=Q(),[a,c]=w.useState(i?"preview":"write"),f=(k,x)=>{c(x)};return t.jsxs(u,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[t.jsxs(u,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[t.jsx(O,{variant:"h6",fontWeight:"bold",sx:{},children:l("common.introduction")}),t.jsxs(Zo,{value:a,onChange:f,"aria-label":"wrapped label tabs example",children:[t.jsx(Ke,{value:"write",label:"Write"}),t.jsx(Ke,{value:"preview",label:"Preview"})]})]}),t.jsx(u,{display:a==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:t.jsx(Y,{disabled:r||i,sx:{border:"none"},placeholder:`Blocklet ${l("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:i,endAdornment:t.jsxs(Ve,{position:"end",children:[((h=e==null?void 0:e.blockletIntroduction)==null?void 0:h.length)||0," / ",re.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:e.blockletIntroduction||"",onChange:k=>{s({blockletIntroduction:""}),o({blockletIntroduction:k.target.value.slice(0,re.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),t.jsx(u,{display:a==="preview"?"block":"none",mt:3,children:t.jsx(Wn,{text:e.blockletIntroduction||""})})]})}Un.propTypes={params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,readOnly:d.bool.isRequired,loading:d.bool.isRequired};var lo={},Nl=he;Object.defineProperty(lo,"__esModule",{value:!0});var Fn=lo.default=void 0,Al=Nl(be()),Mo=t;Fn=lo.default=(0,Al.default)([(0,Mo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Mo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function io({step:e,ok:o,active:n,error:r}){let s="grey.500",i=e+1;return o&&(i=t.jsx(Vs,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>e?(s="error.main",i=t.jsx(Fn,{sx:{fontSize:18,margin:0},color:"white"})):n>=e&&(s="primary.main"),t.jsx(u,{width:24,height:24,bgcolor:s,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:i})}io.propTypes={step:d.number,ok:d.bool,active:d.number,error:d.string};io.defaultProps={step:0,ok:!1,active:0,error:""};function Hn({steps:e,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:s,loading:i,paramsErrTip:l,viewMode:a,projectId:c}){const{t:f}=Q(),h=()=>{n(j=>j+1)},k=()=>{n(j=>j-1)},x=j=>j===0?(l==null?void 0:l.blockletTitle)||(l==null?void 0:l.projectId)||(l==null?void 0:l.blockletDescription)||(l==null?void 0:l.blockletHomepage)||(l==null?void 0:l.blockletSupport)||(l==null?void 0:l.blockletCommunity)||(l==null?void 0:l.blockletRepository):j===2?(l==null?void 0:l.blockletResource)||(l==null?void 0:l.blockletDocker)||(l==null?void 0:l.dockerImageName):j>=4?(l==null?void 0:l.blockletVersion)||(l==null?void 0:l.note):"",p=a||On({hasSelectedResources:r,params:s,projectId:c,t:f})===null;return t.jsxs(u,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[t.jsx(rs,{activeStep:o,orientation:"vertical",children:e.map((j,v)=>{const I={},g=i||!ql({hasSelectedResources:r,params:s,projectId:c,step:v,t:f}),b=i?"":x(v);return b&&(I.optional=t.jsx(O,{variant:"caption",color:"error",children:b}),I.error=!0),t.jsxs(ls,{children:[t.jsx(is,{icon:t.jsx(io,{error:b,active:p?99:o,step:v,ok:g}),sx:{cursor:"pointer",color:b?"error.main":"inherit"},disabled:!1,onClick:()=>n(v),...I,children:t.jsx(O,{fontSize:"14px",fontWeight:"500",color:b||!g&&o>v?"error.main":"inherit",children:j.label})}),t.jsxs(cs,{children:[t.jsx(O,{fontSize:12,children:j.description}),!p&&t.jsx(u,{sx:{mb:2},children:t.jsxs("div",{children:[v<e.length-1&&t.jsx(Z,{variant:"contained",onClick:h,sx:{mt:1,mr:1},disabled:b||!g,children:f("common.continue")}),v>0&&t.jsx(Z,{disabled:v===0,onClick:k,sx:{mt:1,mr:1},children:f("common.back")})]})})]})]},j.label)})}),o>=e.length-1&&t.jsx(It,{square:!0,elevation:0,sx:{p:3},children:t.jsx(O,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}Hn.propTypes={steps:d.array.isRequired,activeStep:d.number.isRequired,setActiveStep:d.func.isRequired,params:d.object.isRequired,viewMode:d.string.isRequired,loading:d.bool.isRequired,projectId:d.string.isRequired,hasSelectedResources:d.bool.isRequired,paramsErrTip:d.shape({projectId:d.string,blockletVersion:d.string,blockletTitle:d.string,blockletDescription:d.string,note:d.string,blockletResource:d.string,blockletHomepage:d.string,blockletSupport:d.string,blockletCommunity:d.string,blockletRepository:d.string,blockletDocker:d.object,dockerImageName:d.string}).isRequired};const El=[".zip",".gz"],Ml=1024*1024*100,Ol=w.lazy(()=>en(()=>import("./index-CmBEz5CL.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.Uploader})));function co({app:e,projectId:o,readOnly:n,params:r,setParams:s,setParamsErrTip:i,error:l}){const{t:a,locale:c}=Q(),f=w.useRef(null),h=()=>n?!1:!o||o===X.UNOWNED_DID?(U.error(a("blocklet.publish.errorTip.noFirstDid")),!1):!0,k=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e.meta.did}/${o}/resource/upload`;return t.jsxs(u,{sx:{mt:3},children:[t.jsx(O,{gutterBottom:!0,children:a("blocklet.publish.resourceUpload")}),t.jsxs(je,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&t.jsx(O,{component:"a",href:`${k}/params.uploadedResource`,children:r.uploadedResource}),!n&&t.jsx(Z,{variant:"outlined",size:"small",onClick:()=>{var x;h()&&((x=f.current)==null||x.open())},children:r.uploadedResource?a("common.change"):a("common.upload")})]}),t.jsx(w.Suspense,{fallback:t.jsx(We,{}),children:t.jsx(Ol,{ref:f,locale:c,popup:!0,onUploadFinish:x=>{var p;s({uploadedResource:x.data.filename}),i({blockletResource:""}),(p=f.current)==null||p.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:k,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:El,maxFileSize:Ml,maxNumberOfFiles:1}}},"uploader-resource")}),!!l&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:l})]})}co.propTypes={app:d.object.isRequired,projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,error:d.string.isRequired,setParamsErrTip:d.func.isRequired};co.defaultProps={};function ot({readOnly:e,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:s,loading:i}){var a;const{t:l}=Q();return t.jsx(u,{display:"flex",mt:3,className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Y,{required:!0,disabled:i||e,label:`Blocklet ${l("common.version")}`,placeholder:`Blocklet ${l("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:c=>{s({blockletVersion:""}),n({blockletVersion:c.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||""}),t.jsx(Y,{label:l("blocklet.publish.releaseNote"),autoComplete:"off",disabled:i||e,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:e,endAdornment:t.jsxs(Ve,{position:"end",children:[((a=o==null?void 0:o.note)==null?void 0:a.length)||0," / ",re.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:c=>{s({note:""}),n({note:c.target.value.slice(0,re.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}ot.propTypes={readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired};ot.defaultProps={};function Gn(e){for(const o in e)typeof e[o]=="string"?e[o]=e[o].replace(/\\\\/g,"\\"):typeof e[o]=="object"&&e[o]!==null&&Gn(e[o]);return e}function nt({index:e,item:o,dockerParams:n,setDockerParams:r,dataKey:s,t:i,readOnly:l}){const a=(o==null?void 0:o.value)||"",[c,f]=w.useState(!1),h=()=>{var q;(q=n[s])==null||q.splice(e,1),r({...n,[s]:[...n[s]]})},k=(q,E)=>{var m;(m=n[s])!=null&&m[e]&&(E?(n[s][e].custom=n[s][e].value,n[s][e].value=`$${pt(o.key)}`):(n[s][e].value=n[s][e].custom||"",n[s][e].custom="")),r({...n,[s]:[...n[s]]})},x=(q,E)=>{var y;const m=((y=n[s][e])==null?void 0:y.value)||"";n[s][e]={...n[s][e],secure:E,value:E&&m===re.BLOCKLET_AUTOMATIC_ENV_VALUE?"":m},r({...n,[s]:[...n[s]]})},p=(q,E)=>{n[s][e]={...n[s][e],shared:E},r({...n,[s]:[...n[s]]})},j=(q,E)=>{var y;const m=((y=n[s][e])==null?void 0:y.value)||"";n[s][e]={...n[s][e],required:E,value:E&&m===re.BLOCKLET_AUTOMATIC_ENV_VALUE?"":m},r({...n,[s]:[...n[s]]})},v=(q,E)=>{n[s][e]={...n[s][e],value:E?re.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...n,[s]:[...n[s]]})},I=q=>{n[s][e]={...n[s][e],description:q.target.value},r({...n,[s]:[...n[s]]})},g=q=>{const E=q.target.value==="web"?"web":"docker";E==="web"&&n.dockerArgs.forEach(L=>{L.type="docker"});const y=`/${n.dockerImage.replace(/\W/g,"-")}-${e}`;n.dockerArgs[e]={...n.dockerArgs[e],type:E,path:E==="docker"?y:"/",protocol:"http",prefix:E==="docker"?y:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},b=q=>{const E=q.target.value;n[s][e]={...n[s][e],prefix:E,path:E==="*"?"/":E},r({...n,[s]:[...n[s]]})},C=q=>{var E;(E=n[s])!=null&&E[e]&&(n[s][e].value=q.target.value),r({...n,[s]:[...n[s]]})},_=a===`$${pt(o.key)}`||o.custom,T=s==="dockerArgs"&&!cn[o.key],D=$s[o.key],$=s==="dockerEnvs",R=o.key==="--publish";let A=o.key;return R&&o.type==="web"?A="--publish (Web)":$&&(A=`--env ${o.key}`),t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{width:250},children:t.jsx(O,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:A})}),t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[t.jsx(Y,{disabled:l||_||T||o.value===re.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:_?`$${pt(o.key)}`:a,sx:{flex:1},InputProps:{endAdornment:t.jsxs(Ve,{position:"end",sx:{zoom:.9},children:[(!(D||T)||$||R)&&t.jsx(oe,{onClick:()=>f(!0),children:t.jsx(ne,{icon:"icon-park-outline:setting-config"})}),!l&&t.jsx(oe,{onClick:h,color:T?"error":"default",children:t.jsx(ne,{icon:"ic:round-delete"})})]})},error:T,onChange:C}),T&&t.jsx(O,{variant:"caption",color:"error",children:i("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&t.jsx(O,{variant:"caption",color:"text.secondary",children:i("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Ns[o.key](a)&&t.jsx(O,{variant:"caption",color:"error",children:i("blocklet.publish.docker.volumeTips")})]}),c&&t.jsx(Tt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:i($?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[D||T||$?null:t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{children:i("blocklet.publish.docker.needCustomInput")}),t.jsx(ye,{disabled:l,checked:_,onChange:k,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{children:i("blocklet.publish.docker.shared")}),t.jsx(ye,{disabled:l,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{children:i("blocklet.publish.docker.required")}),t.jsx(ye,{disabled:l,checked:o.required,onChange:j,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{children:i("blocklet.publish.docker.secure")}),t.jsx(ye,{disabled:l,checked:o.secure,onChange:x,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{children:i("blocklet.publish.docker.autoGenerated")}),t.jsx(ye,{disabled:l,checked:o.value===re.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:v,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{sx:{flex:1},children:i("blocklet.publish.docker.description")}),t.jsx(Y,{disabled:l,value:o.description,onChange:I,sx:{flex:1},label:i("blocklet.publish.docker.description")})]}),R&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{sx:{flex:1},children:i("blocklet.publish.docker.portType")}),t.jsxs(Ko,{value:o.type||"docker",onChange:g,children:[t.jsx(ue,{value:"docker",children:"Docker"}),t.jsx(ue,{value:"web",children:"Web"})]})]}),R&&o.type==="web"&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{sx:{flex:1},children:i("blocklet.publish.docker.prefix")}),t.jsx(Y,{disabled:l,value:o.prefix,onChange:b,sx:{flex:1},label:i("blocklet.publish.docker.prefix")})]})]})})]})}nt.propTypes={dockerParams:d.object.isRequired,setDockerParams:d.func.isRequired,dataKey:d.string.isRequired,item:d.object.isRequired,t:d.func.isRequired,readOnly:d.bool.isRequired,index:d.number.isRequired};nt.defaultProps={};const zl=`
180
+ `;function Wn({text:e}){return e?t.jsx(zs,{wrapperElement:{"data-color-mode":"light"},source:js.sanitize(e),rehypePlugins:[[Bs,{target:"_blank"}]]}):t.jsx(Te,{Icon:Nt})}Wn.propTypes={text:d.string.isRequired};function Un({params:e,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:s,readOnly:i}){var h;const{t:l}=Q(),[a,c]=w.useState(i?"preview":"write"),f=(k,x)=>{c(x)};return t.jsxs(u,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[t.jsxs(u,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[t.jsx(O,{variant:"h6",fontWeight:"bold",sx:{},children:l("common.introduction")}),t.jsxs(Zo,{value:a,onChange:f,"aria-label":"wrapped label tabs example",children:[t.jsx(Ke,{value:"write",label:"Write"}),t.jsx(Ke,{value:"preview",label:"Preview"})]})]}),t.jsx(u,{display:a==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:t.jsx(Y,{disabled:r||i,sx:{border:"none"},placeholder:`Blocklet ${l("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:i,endAdornment:t.jsxs(Ve,{position:"end",children:[((h=e==null?void 0:e.blockletIntroduction)==null?void 0:h.length)||0," / ",re.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:e.blockletIntroduction||"",onChange:k=>{s({blockletIntroduction:""}),o({blockletIntroduction:k.target.value.slice(0,re.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),t.jsx(u,{display:a==="preview"?"block":"none",mt:3,children:t.jsx(Wn,{text:e.blockletIntroduction||""})})]})}Un.propTypes={params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,readOnly:d.bool.isRequired,loading:d.bool.isRequired};var lo={},Nl=he;Object.defineProperty(lo,"__esModule",{value:!0});var Fn=lo.default=void 0,Al=Nl(be()),Mo=t;Fn=lo.default=(0,Al.default)([(0,Mo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Mo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function io({step:e,ok:o,active:n,error:r}){let s="grey.500",i=e+1;return o&&(i=t.jsx(Vs,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>e?(s="error.main",i=t.jsx(Fn,{sx:{fontSize:18,margin:0},color:"white"})):n>=e&&(s="primary.main"),t.jsx(u,{width:24,height:24,bgcolor:s,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:i})}io.propTypes={step:d.number,ok:d.bool,active:d.number,error:d.string};io.defaultProps={step:0,ok:!1,active:0,error:""};function Hn({steps:e,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:s,loading:i,paramsErrTip:l,viewMode:a,projectId:c}){const{t:f}=Q(),h=()=>{n(j=>j+1)},k=()=>{n(j=>j-1)},x=j=>j===0?(l==null?void 0:l.blockletTitle)||(l==null?void 0:l.projectId)||(l==null?void 0:l.blockletDescription)||(l==null?void 0:l.blockletHomepage)||(l==null?void 0:l.blockletSupport)||(l==null?void 0:l.blockletCommunity)||(l==null?void 0:l.blockletRepository):j===2?(l==null?void 0:l.blockletResource)||(l==null?void 0:l.blockletDocker)||(l==null?void 0:l.dockerImageName):j>=4?(l==null?void 0:l.blockletVersion)||(l==null?void 0:l.note):"",p=a||On({hasSelectedResources:r,params:s,projectId:c,t:f})===null;return t.jsxs(u,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[t.jsx(rs,{activeStep:o,orientation:"vertical",children:e.map((j,v)=>{const I={},g=i||!ql({hasSelectedResources:r,params:s,projectId:c,step:v,t:f}),b=i?"":x(v);return b&&(I.optional=t.jsx(O,{variant:"caption",color:"error",children:b}),I.error=!0),t.jsxs(ls,{children:[t.jsx(is,{icon:t.jsx(io,{error:b,active:p?99:o,step:v,ok:g}),sx:{cursor:"pointer",color:b?"error.main":"inherit"},disabled:!1,onClick:()=>n(v),...I,children:t.jsx(O,{fontSize:"14px",fontWeight:"500",color:b||!g&&o>v?"error.main":"inherit",children:j.label})}),t.jsxs(cs,{children:[t.jsx(O,{fontSize:12,children:j.description}),!p&&t.jsx(u,{sx:{mb:2},children:t.jsxs("div",{children:[v<e.length-1&&t.jsx(Z,{variant:"contained",onClick:h,sx:{mt:1,mr:1},disabled:b||!g,children:f("common.continue")}),v>0&&t.jsx(Z,{disabled:v===0,onClick:k,sx:{mt:1,mr:1},children:f("common.back")})]})})]})]},j.label)})}),o>=e.length-1&&t.jsx(It,{square:!0,elevation:0,sx:{p:3},children:t.jsx(O,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}Hn.propTypes={steps:d.array.isRequired,activeStep:d.number.isRequired,setActiveStep:d.func.isRequired,params:d.object.isRequired,viewMode:d.string.isRequired,loading:d.bool.isRequired,projectId:d.string.isRequired,hasSelectedResources:d.bool.isRequired,paramsErrTip:d.shape({projectId:d.string,blockletVersion:d.string,blockletTitle:d.string,blockletDescription:d.string,note:d.string,blockletResource:d.string,blockletHomepage:d.string,blockletSupport:d.string,blockletCommunity:d.string,blockletRepository:d.string,blockletDocker:d.object,dockerImageName:d.string}).isRequired};const El=[".zip",".gz"],Ml=1024*1024*100,Ol=w.lazy(()=>en(()=>import("./index-BhCl1uU6.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.Uploader})));function co({app:e,projectId:o,readOnly:n,params:r,setParams:s,setParamsErrTip:i,error:l}){const{t:a,locale:c}=Q(),f=w.useRef(null),h=()=>n?!1:!o||o===X.UNOWNED_DID?(U.error(a("blocklet.publish.errorTip.noFirstDid")),!1):!0,k=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e.meta.did}/${o}/resource/upload`;return t.jsxs(u,{sx:{mt:3},children:[t.jsx(O,{gutterBottom:!0,children:a("blocklet.publish.resourceUpload")}),t.jsxs(je,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&t.jsx(O,{component:"a",href:`${k}/params.uploadedResource`,children:r.uploadedResource}),!n&&t.jsx(Z,{variant:"outlined",size:"small",onClick:()=>{var x;h()&&((x=f.current)==null||x.open())},children:r.uploadedResource?a("common.change"):a("common.upload")})]}),t.jsx(w.Suspense,{fallback:t.jsx(We,{}),children:t.jsx(Ol,{ref:f,locale:c,popup:!0,onUploadFinish:x=>{var p;s({uploadedResource:x.data.filename}),i({blockletResource:""}),(p=f.current)==null||p.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:k,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:El,maxFileSize:Ml,maxNumberOfFiles:1}}},"uploader-resource")}),!!l&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:l})]})}co.propTypes={app:d.object.isRequired,projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,error:d.string.isRequired,setParamsErrTip:d.func.isRequired};co.defaultProps={};function ot({readOnly:e,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:s,loading:i}){var a;const{t:l}=Q();return t.jsx(u,{display:"flex",mt:3,className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Y,{required:!0,disabled:i||e,label:`Blocklet ${l("common.version")}`,placeholder:`Blocklet ${l("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:c=>{s({blockletVersion:""}),n({blockletVersion:c.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||""}),t.jsx(Y,{label:l("blocklet.publish.releaseNote"),autoComplete:"off",disabled:i||e,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:e,endAdornment:t.jsxs(Ve,{position:"end",children:[((a=o==null?void 0:o.note)==null?void 0:a.length)||0," / ",re.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:c=>{s({note:""}),n({note:c.target.value.slice(0,re.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}ot.propTypes={readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired};ot.defaultProps={};function Gn(e){for(const o in e)typeof e[o]=="string"?e[o]=e[o].replace(/\\\\/g,"\\"):typeof e[o]=="object"&&e[o]!==null&&Gn(e[o]);return e}function nt({index:e,item:o,dockerParams:n,setDockerParams:r,dataKey:s,t:i,readOnly:l}){const a=(o==null?void 0:o.value)||"",[c,f]=w.useState(!1),h=()=>{var q;(q=n[s])==null||q.splice(e,1),r({...n,[s]:[...n[s]]})},k=(q,E)=>{var m;(m=n[s])!=null&&m[e]&&(E?(n[s][e].custom=n[s][e].value,n[s][e].value=`$${pt(o.key)}`):(n[s][e].value=n[s][e].custom||"",n[s][e].custom="")),r({...n,[s]:[...n[s]]})},x=(q,E)=>{var y;const m=((y=n[s][e])==null?void 0:y.value)||"";n[s][e]={...n[s][e],secure:E,value:E&&m===re.BLOCKLET_AUTOMATIC_ENV_VALUE?"":m},r({...n,[s]:[...n[s]]})},p=(q,E)=>{n[s][e]={...n[s][e],shared:E},r({...n,[s]:[...n[s]]})},j=(q,E)=>{var y;const m=((y=n[s][e])==null?void 0:y.value)||"";n[s][e]={...n[s][e],required:E,value:E&&m===re.BLOCKLET_AUTOMATIC_ENV_VALUE?"":m},r({...n,[s]:[...n[s]]})},v=(q,E)=>{n[s][e]={...n[s][e],value:E?re.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...n,[s]:[...n[s]]})},I=q=>{n[s][e]={...n[s][e],description:q.target.value},r({...n,[s]:[...n[s]]})},g=q=>{const E=q.target.value==="web"?"web":"docker";E==="web"&&n.dockerArgs.forEach(L=>{L.type="docker"});const y=`/${n.dockerImage.replace(/\W/g,"-")}-${e}`;n.dockerArgs[e]={...n.dockerArgs[e],type:E,path:E==="docker"?y:"/",protocol:"http",prefix:E==="docker"?y:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},b=q=>{const E=q.target.value;n[s][e]={...n[s][e],prefix:E,path:E==="*"?"/":E},r({...n,[s]:[...n[s]]})},C=q=>{var E;(E=n[s])!=null&&E[e]&&(n[s][e].value=q.target.value),r({...n,[s]:[...n[s]]})},_=a===`$${pt(o.key)}`||o.custom,T=s==="dockerArgs"&&!cn[o.key],D=$s[o.key],$=s==="dockerEnvs",R=o.key==="--publish";let A=o.key;return R&&o.type==="web"?A="--publish (Web)":$&&(A=`--env ${o.key}`),t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{width:250},children:t.jsx(O,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:A})}),t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[t.jsx(Y,{disabled:l||_||T||o.value===re.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:_?`$${pt(o.key)}`:a,sx:{flex:1},InputProps:{endAdornment:t.jsxs(Ve,{position:"end",sx:{zoom:.9},children:[(!(D||T)||$||R)&&t.jsx(oe,{onClick:()=>f(!0),children:t.jsx(ne,{icon:"icon-park-outline:setting-config"})}),!l&&t.jsx(oe,{onClick:h,color:T?"error":"default",children:t.jsx(ne,{icon:"ic:round-delete"})})]})},error:T,onChange:C}),T&&t.jsx(O,{variant:"caption",color:"error",children:i("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&t.jsx(O,{variant:"caption",color:"text.secondary",children:i("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Ns[o.key](a)&&t.jsx(O,{variant:"caption",color:"error",children:i("blocklet.publish.docker.volumeTips")})]}),c&&t.jsx(Tt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:i($?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[D||T||$?null:t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{children:i("blocklet.publish.docker.needCustomInput")}),t.jsx(ye,{disabled:l,checked:_,onChange:k,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{children:i("blocklet.publish.docker.shared")}),t.jsx(ye,{disabled:l,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{children:i("blocklet.publish.docker.required")}),t.jsx(ye,{disabled:l,checked:o.required,onChange:j,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{children:i("blocklet.publish.docker.secure")}),t.jsx(ye,{disabled:l,checked:o.secure,onChange:x,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{children:i("blocklet.publish.docker.autoGenerated")}),t.jsx(ye,{disabled:l,checked:o.value===re.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:v,sx:{zoom:.9}})]}),$&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{sx:{flex:1},children:i("blocklet.publish.docker.description")}),t.jsx(Y,{disabled:l,value:o.description,onChange:I,sx:{flex:1},label:i("blocklet.publish.docker.description")})]}),R&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{sx:{flex:1},children:i("blocklet.publish.docker.portType")}),t.jsxs(Ko,{value:o.type||"docker",onChange:g,children:[t.jsx(ue,{value:"docker",children:"Docker"}),t.jsx(ue,{value:"web",children:"Web"})]})]}),R&&o.type==="web"&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(O,{sx:{flex:1},children:i("blocklet.publish.docker.prefix")}),t.jsx(Y,{disabled:l,value:o.prefix,onChange:b,sx:{flex:1},label:i("blocklet.publish.docker.prefix")})]})]})})]})}nt.propTypes={dockerParams:d.object.isRequired,setDockerParams:d.func.isRequired,dataKey:d.string.isRequired,item:d.object.isRequired,t:d.func.isRequired,readOnly:d.bool.isRequired,index:d.number.isRequired};nt.defaultProps={};const zl=`
181
181
  docker run --name postgrest
182
182
  -p 3000:3000
183
183
  -e PGRST_DB_URI="postgres://username:password@host:port/database"
@@ -1,4 +1,4 @@
1
- import{r as b}from"./vendor-react-D-afvo_7.js";import{j as e,E as d,a1 as Pe,R as bt,a4 as jt,T as G,a3 as R,A as Fe,bH as _e,cn as et,cm as Te,aN as Ie,bL as De,x as ye,aj as Ee,a2 as tt,aa as ae,V as nt,bO as Ye,bI as vt,aP as yt,al as Je,co as St}from"./vendor-mui-core-BWT1QT-d.js";import{b as Z,ap as re,z as Ct}from"./vendor-utils-5TjOM6td.js";import{j as V,b as L,ad as Nt,a0 as Be,e as Y,bC as wt,D as st,a3 as Ae,aX as at,aF as be,a8 as Rt,ao as Tt,bl as It}from"./vendor-arcblock-BCYov1AG.js";import{z as Dt,G as $,m as Et,I as Qe}from"./index-QGwREoo6.js";import{e as pe,a as Oe}from"./vendor-hooks-ZnvK17j8.js";import{S as ue}from"./shorten-label-CRTt8ftG.js";import{I as it}from"./index-C2h3b3qO.js";import{S as At,a as Ot}from"./list-C8W2Ztkh.js";import{R as ze}from"./relative-time-B24G13wp.js";import{b as We}from"./dashboard-DJwyQ0IN.js";import{W as Lt}from"./did-address-DsaXravU.js";import{p as ot}from"./util-DB9FK0S1.js";import{D as kt,g as Pt}from"./traffic-C3au13Oz.js";import{B as rt}from"./bundle-avatar-kmTWjmMZ.js";import{B as Ft}from"./index-B_f-vCCz.js";import"./index-CV3ZYUK0.js";import"./InfoOutlined-BoujVod4.js";import"./useLocalStorage-grucDLLp.js";import"./confirm-BckBMOcL.js";import"./format-error-C0Ke3VXF.js";import"./PlayArrow-CbK5B-2U.js";import"./get-safe-url-B9KuIPHY.js";import"./session-CXP_o5z6.js";import"./useAsyncRetry-Dgdo-UIp.js";import"./useAsync-CEZQNMFX.js";import"./useSetState-Crt4S51m.js";import"./base32-Bg7zWLHM.js";import"./iframe-BfCk9odl.js";import"./LaunchOutlined-BqUlBjUr.js";import"./ChevronLeft-Dxe-8OAb.js";import"./ChevronRight-Jj-tneRk.js";import"./index-BPho8CPY.js";import"./vendor-mui-x-VJmvJUkN.js";const lt=b.createContext({}),{Provider:_t,Consumer:Qn}=lt;function Bt({children:t,blocklet:n=""}){const{api:s,inService:i}=Dt(),[a,l]=b.useState([]),[p,f]=b.useState({total:0,pageSize:20,pageCount:0,page:1}),y=pe(()=>{var j;return(j=n.meta)==null?void 0:j.did},[n]),[S,T]=b.useState([]),N=async({page:j=1,pageSize:v=20,...x}={})=>{if(!y)return[];try{const w={paging:{page:j,pageSize:v},...x,teamDid:y,dateRange:x.dateRange?[$(x.dateRange[0]).toISOString(),$(x.dateRange[1]).toISOString()]:void 0},{dids:M,...B}=w;let K="";M.includes("system")&&(K="system");const _=M.filter(ee=>ee!=="system"),Q=await s.getNotificationSendLog({input:{...B,source:K,componentDids:_}});return l(Q.list),f(Q.paging),Q.list}catch(w){return V.error(w.message),[]}},A=async()=>{const j=await s.getNotificationComponents({input:{teamDid:y}});T(j.componentDids)},P=b.useCallback(j=>{const v=n.children.find(x=>{var w;return((w=x.meta)==null?void 0:w.did)===j});if(v)return v.ancestors=[n],v},[n]),O=async({notificationId:j,receivers:v,channels:x,...w})=>{await s.resendNotification({input:{teamDid:y,notificationId:j,receivers:v,channels:x.map(M=>M==="wallet"?L.NOTIFICATION_SEND_CHANNEL.WALLET:M==="pushKit"?L.NOTIFICATION_SEND_CHANNEL.PUSH:M),...w}})},F=b.useCallback(async j=>(await s.getUser({input:{teamDid:y,user:{did:j}}})).user,[s,y]),I=b.useCallback(async({page:j=1,pageSize:v=20,...x}={})=>{try{const w={paging:{page:j,pageSize:v},...x,userName:x.searchText||"",teamDid:y,dateRange:x.dateRange?[$(x.dateRange[0]).toISOString(),$(x.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:w})}catch(w){throw V.error(w.message),w}},[s,y]);b.useEffect(()=>{y&&A()},[y]);const U={fetch:N,data:a,paging:p,blocklet:n,getComponent:P,resendNotification:O,getUser:F,componentDids:S,getReceivers:I,inService:i,teamDid:y};return e.jsx(_t,{value:{notificationRecords:U},children:t})}function Me(){const{notificationRecords:t}=b.useContext(lt);return t}fe.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const zt={info:"primary",success:"success",error:"error",warning:"warning"};function fe({severity:t="info"}){return e.jsx(Nt,{type:zt[t],children:t})}var qe={},Wt=Pe;Object.defineProperty(qe,"__esModule",{value:!0});var ct=qe.default=void 0,Mt=Wt(Be()),qt=e;ct=qe.default=(0,Mt.default)((0,qt.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var Ke={},Kt=Pe;Object.defineProperty(Ke,"__esModule",{value:!0});var dt=Ke.default=void 0,Ht=Kt(Be()),$t=e;dt=Ke.default=(0,Ht.default)((0,$t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var He={},Ut=Pe;Object.defineProperty(He,"__esModule",{value:!0});var ut=He.default=void 0,Vt=Ut(Be()),Gt=e;ut=He.default=(0,Vt.default)((0,Gt.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Xt=(t,n,s="")=>{if(!s||!n)return"";switch(s){case L.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return s}};function pt(t,n,s={}){const{status:i,updatedAt:a,reason:l="",channel:p="wallet"}=s,f=a?t("notification.sendStatus.sentTime",{date:Et(a,n)}):"",y=Xt(t,p,l);return i===L.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:f,reason:y}:i===L.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:f}:{status:"pending",title:t("notification.sendStatus.pending"),reason:y,sentTime:f}}const Le={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},ke=["wallet","pushKit","email"],Ze=["info","success","error","warning"],ft=t=>{var s,i;const{settings:n}=t;return(i=(s=n==null?void 0:n.notification)==null?void 0:s.email)==null?void 0:i.enabled},mt=t=>{var s,i;const{settings:n}=t;return(i=(s=n==null?void 0:n.notification)==null?void 0:s.pushKit)==null?void 0:i.enabled},Yt=(t,n)=>{const s=Z(n,"extra.notifications.email",!0);return{available:ft(t),enabled:s}},Jt=(t,n)=>{const s=Z(n,"extra.notifications.push",!0);return{available:mt(t),enabled:s}},Qt=t=>({enabled:Z(t,"extra.notifications.wallet",!0)}),Zt=t=>({enabled:Z(t,"extra.webhooks",[]).length>0}),ge=(t=3)=>new Promise(n=>{setTimeout(()=>{n()},t*1e3)}),en=(t,n)=>n==="wallet"||n==="webhook"?[{channel:n,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:n}),fail:t("notification.sendStatus.reason.disabled",{channel:n})}]:n==="pushKit"||n==="email"?[{channel:n,type:"available",pass:t("notification.sendStatus.reason.available",{channel:n}),fail:t("notification.sendStatus.reason.unavailable",{channel:n})},{channel:n,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:n}),fail:t("notification.sendStatus.reason.disabled",{channel:n})}]:[],xe=(t=[])=>{const n=$().startOf("day");return t.filter(s=>$(s.sendAt).isSame(n,"day")).length},tn=(t,n="")=>{if(n&&ke.includes(n)){const l=`${n}SendRecord`,p=Z(t,l,[]);return xe(p)}const s=Z(t,"webhook",{}),i=Object.keys(s??{})??[];if(n&&i.includes(n)){const l=s[n]??[];return xe(l)}const a={};return ke.forEach(l=>{const p=`${l}SendRecord`,f=Z(t,p,[]),y=xe(f);a[l]=y}),i.length>0&&i.forEach(l=>{const p=s[l]??[],f=xe(p);a[l]=f}),a},je=(t,n,s)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[s].splice(n,1),t},ve=(t,n)=>{if(!Array.isArray(n))throw new Error("filters must be an array");return n.length?!n.includes(t):!1},nn=t=>{switch(t){case L.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case L.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case L.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case L.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ht=()=>bt({typography:{fontSize:14,button:{textTransform:"none"}},palette:{primary:{main:"#1DC1C7",contrastText:"#fff"},secondary:{main:"#030712",contrastText:"#fff"},storeSecondary:{main:"#EBFEFF",contrastText:"#fff"}},components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function J({config:t,enableTooltip:n=!0,showTitle:s=!1,children:i}){const{status:a,title:l="",sentTime:p="",reason:f=""}=t,y=[l,f].filter(Boolean).join(", ");return e.jsx(jt,{title:n?e.jsxs(e.Fragment,{children:[e.jsx(G,{color:"inherit",sx:{fontSize:12},children:y}),e.jsx("span",{children:p})]}):null,arrow:!0,placement:"top",children:e.jsxs(R,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(R,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(R,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Le[a],style:{opacity:.15}}),e.jsx(R,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Le[a]})]}),e.jsx(G,{color:"inherit",sx:{fontSize:12},children:s?l:i})]})})}J.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};J.defaultProps={enableTooltip:!0,showTitle:!1,children:null};le.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};le.defaultProps={onDelete:()=>{}};function le({list:t,label:n,onDelete:s}){const{t:i,locale:a}=Y();return e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(G,{children:[n,": "]}),t.map(l=>{const p=pt(i,a,{status:l});return e.jsx(Fe,{size:"small",label:e.jsx(R,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(J,{config:p,enableTooltip:!1,children:p.title})}),onDelete:f=>s(f,l)},l)})]})}$e.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function $e({filterList:t,onChange:n,index:s,column:i,filterValues:a,label:l,renderLabel:p}){return e.jsxs(_e,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:l}),e.jsx(Te,{row:!0,children:a.map(f=>e.jsx(Ie,{control:e.jsx(De,{checked:t[s].indexOf(f.value??f)>-1,onChange:y=>{const S=[...t];y.target.checked?S[s]=[...S[s],f.value??f]:S[s]=S[s].filter(T=>T!==(f.value??f)),n(S[s],s,i)},name:f.value??f}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:p(f)})},f.value??f))})]})}function Re(t){return e.jsx($e,{...t,renderLabel:n=>e.jsx(J,{enableTooltip:!1,config:{status:n.status},children:n.label})})}oe.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function oe({status:t,updatedAt:n,reason:s="",channel:i="wallet",onResend:a}){const{t:l,locale:p}=Y(),f=pt(l,p,{status:t,updatedAt:n,reason:s,channel:i});return e.jsxs(R,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(J,{config:f,showTitle:!0}),f.status!=="success"&&e.jsx(ye,{className:"resend-btn",size:"small",startIcon:e.jsx(We,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:l("notification.resend")})]})}Ue.propTypes={value:d.array.isRequired,onChange:d.func};function Ue({value:t,onChange:n}){const{locale:s}=Y(),i=$().toDate(),[a,l]=b.useState(null),p=b.useCallback(S=>{l(a?null:S.currentTarget)},[a]),f=!!a,y=b.useCallback(S=>{if(!S.startDate||!S.endDate){V.error("Please select a date range");return}if($(S.startDate).isAfter(S.endDate)||!$(S.startDate).isValid()||!$(S.endDate).isValid()){V.error("Invalid date range");return}n([S.startDate,S.endDate]),l(null)},[n]);return e.jsxs("div",{children:[e.jsx(G,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(ye,{onClick:p,variant:"outlined",size:"small",color:"inherit",children:[Qe(t[0],s)," - ",Qe(t[1],s)]})}),e.jsx(Ee,{open:f,anchorEl:a,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(kt,{open:!0,maxDate:i,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:p,definedRanges:Pt(i),onChange:y})})]})}Ve.propTypes={itemComponent:d.elementType.isRequired};function Ve({itemComponent:t,...n}){var a;const{t:s}=Y();return!((a=n==null?void 0:n.filterList)!=null&&a.filter(l=>l.length).length)?null:e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(wt.TableFilterList,{...n,ItemComponent:t})})]})}function Se({label:t,onDelete:n,canDelete:s=()=>!0,...i}){const a=n&&typeof n=="function"?n:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:t,...i})),e.jsx(Fe,{label:t,variant:"outlined",...a&&l?{onDelete:a}:{}})}Se.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Se.defaultProps={canDelete:()=>!0};const sn=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Ge.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ge.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ge({loading:t=!1,onCancel:n,onConfirm:s}){const{t:i}=Y(),[a,l]=b.useState(sn),[p,f]=b.useState(!0),y=(T,N)=>{N.checked=T.target.checked;const A=a.map(P=>({...P,checked:P.value===N.value?N.checked:P.checked}));l(A)},S=T=>{T.stopPropagation(),s({channels:a.filter(N=>N.checked).map(N=>N.value),isResendFailedOnly:p})};return e.jsxs(R,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(G,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:i("notification.config")}),e.jsx(R,{className:"choose-channel",children:e.jsxs(_e,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:i("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:a.map(T=>e.jsx(Ie,{control:e.jsx(De,{checked:T.checked,onChange:N=>y(N,T),name:T.value}),label:T.label},T.value))})]})}),e.jsx(R,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Ie,{control:e.jsx(De,{checked:p,onChange:T=>f(T.target.checked)}),label:i("notification.resendFailedOnly")})})}),e.jsxs(R,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(ye,{onClick:T=>{T.stopPropagation(),n()},color:"inherit",children:i("common.cancel")}),e.jsxs(ye,{onClick:S,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),i("common.confirm")]})]})]})}gt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function gt({notificationId:t,handleResend:n,resending:s=!1}){const{t:i,locale:a}=Y(),{getReceivers:l,inService:p,teamDid:f,getUser:y,blocklet:S}=Me(),[T,N]=b.useState(!1),[A,P]=b.useState([]),O=Oe({anchorEl:null,position:null}),F=Oe({anchorEl:null,position:null}),[I,U]=b.useState(null),[j,v]=b.useState({total:0,pageSize:10,pageCount:0,page:1}),[x,w]=b.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[$().subtract(1,"month").startOf("day").toDate(),$().endOf("day").toDate()]}),[M,B]=b.useState([]),K=[{label:i("notification.sendStatus.pending"),value:0,status:"pending"},{label:i("notification.sendStatus.success"),value:1,status:"success"},{label:i("notification.sendStatus.failed"),value:2,status:"failed"}],_=async()=>{if(!T&&t)try{N(!0);const o=await l({notificationId:t,...x}),r=o.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:ot(c.receiverUser.avatar,f,p)}}));P(r),v(o.paging),N(!1)}catch(o){V.error(o.message),N(!1)}};b.useEffect(()=>{_()},[x]);const Q=o=>{o.stopPropagation();const r=o.currentTarget;F.anchorEl=r;const c=r.getBoundingClientRect();F.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ee=o=>o.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Ae,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(We,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:Q,children:i("notification.resend")})}):null,Ne={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:i("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:j.page-1,rowsPerPage:j.pageSize,count:j.total,searchText:x.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:M,onRowSelectionChange:(o,r)=>{B(r.map(c=>c.dataIndex))},customToolbarSelect:ee},we=({page:o,rowsPerPage:r,searchText:c,filterList:C})=>{const[,k=[],H=[],q=[]]=C;x.pageSize!==r?w(W=>({...W,pageSize:r,page:1})):x.page!==o+1?w(W=>({...W,page:o+1})):x.searchText!==c?w(W=>({...W,searchText:c,page:1})):re(k,x.walletSendStatus)?re(H,x.pushKitSendStatus)?re(q,x.emailSendStatus)||w(W=>({...W,emailSendStatus:q,page:1})):w(W=>({...W,pushKitSendStatus:H,page:1})):w(W=>({...W,walletSendStatus:k,page:1}))},me=b.useCallback(async(o,r)=>{if(!r)return!1;const c=await y(r);return c?o==="wallet"?Qt(c):o==="email"?Yt(S,c):o==="pushKit"?Jt(S,c):o==="webhook"?Zt(c):!0:!1},[y,S]),h=b.useCallback(o=>en(i,o),[i]),u=()=>{O.anchorEl=null,O.position=null,U(null)},m=()=>{F.anchorEl=null,F.position=null},g=async(o,r,c=!0,C="")=>{if(!(!r.length||!o.length))try{n(o,r,c,C),F.anchorEl||(await ge(.5),u())}catch(k){console.error("handleResend error",{error:k})}},D=async({channels:o,isResendFailedOnly:r})=>{const c=M.map(C=>A[C].receiver);await g(o,c,r),await ge(.5),m(),B([])},E=async(o,r=[],c=!0)=>{try{await g(["webhook"],[o.receiver],c,r)}catch(C){V.error(C.response?C.response.statusText:C.message)}},z=async(o,r,c,C=[],k=!0)=>{if(o.stopPropagation(),tn(r,c)>=4){V.warning(i("notification.resendLimit"));return}if(!ke.includes(c)){await E(r,C,k);return}if(o){const q=o.currentTarget,W=q.getBoundingClientRect();O.anchorEl=q,O.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}U({channel:c});try{const q=await me(c,r.receiver);await ge(1),U({channel:c,result:q}),(typeof q=="boolean"&&q||Ct(q)&&Object.values(q).every(W=>!!W))&&(await n([c],[r.receiver],k),F.anchorEl||(await ge(.5),u()))}catch(q){V.error(q.message)}},X=o=>{w(r=>({...r,dateRange:o,page:1}))},te=(o,r,c,C)=>{o.stopPropagation();const k=c.filter(H=>H!==r);w(H=>({...H,[C]:k,page:1}))},ie=pe(()=>[{label:i("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:o=>{const{receiverUser:r,receiver:c}=A[o];return r?e.jsxs(R,{"data-cy":`member-name-${r.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(st,{src:`${r.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(ue,{children:r.fullName})]},c):e.jsx(Lt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:x.walletSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Wallet",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[1].options.filterList,"walletSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Wallet",filterList:o,onChange:r,index:c,column:C,filterValues:K})},customBodyRenderLite:o=>{const{walletSendStatus:r,walletSendAt:c,walletSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"wallet",onResend:k=>z(k,A[o],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{pushKitSendStatus:r,pushKitSendAt:c,pushKitSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"pushkit",onResend:k=>z(k,A[o],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:x.pushKitSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Push Kit",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[2].options.filterList,"pushKitSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Push Kit",filterList:o,onChange:r,index:c,column:C,filterValues:K})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{emailSendStatus:r,emailSendAt:c,emailSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"email",onResend:k=>z(k,A[o],"email",[],!1)})},filter:!0,filterType:"custom",filterList:x.emailSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Email",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[3].options.filterList,"emailSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Email",filterList:o,onChange:r,index:c,column:C,filterValues:K})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{webhook:r}=A[o];if(!r)return null;const c=Object.entries(r)[0];if(!c)return null;const[C,k]=c,H=k[0];return e.jsx(R,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(R,{className:"webhook-item",fontSize:12,children:[e.jsx(ue,{maxLength:30,children:C},C),e.jsx(oe,{status:H.status,updatedAt:H.sendAt,reason:H.failedReason,channel:"webhook",onResend:q=>z(q,A[o],"webhook",[C],!1)})]},C)})}}},{label:i("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:o=>{const{createdAt:r}=A[o];return e.jsx(ze,{value:r,locale:a,shouldUpdate:!0})}}}],[A,a,x,i]),he=[e.jsx(Ue,{value:x.dateRange,onChange:X},"date-picker"),e.jsx(Ae,{variant:"contained",size:"small",color:"primary",loading:T,startIcon:e.jsx(ut,{}),onClick:()=>_(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:i("common.refresh")},"refresh")];return e.jsx(R,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(on,{children:e.jsxs(nt,{theme:ht(),children:[e.jsx(at,{className:"receivers-table",locale:a,loading:T,columns:ie,data:A,onChange:we,options:Ne,customButtons:he,components:{TableFilterList:o=>e.jsx(Ve,{...o,itemComponent:r=>e.jsx(Se,{...r,canDelete:()=>!1})})}}),O.anchorEl&&e.jsx(Ee,{open:!!O.anchorEl,anchorReference:"anchorPosition",anchorPosition:O.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(rn,{children:[e.jsxs(G,{variant:"body1",component:"div",className:"check-title",children:[I==null?void 0:I.channel," Checking"]}),e.jsx(R,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:h(I==null?void 0:I.channel).map(o=>{var k,H;const{type:r,pass:c,fail:C}=o;return!(I!=null&&I.result)||(k=I==null?void 0:I.result)!=null&&k[r]?e.jsxs(G,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(H=I==null?void 0:I.result)!=null&&H[r]?be.success.main:"inherit"},children:[I!=null&&I.result?e.jsx(ct,{}):e.jsx(tt,{size:12,sx:{color:be.primary.main}}),e.jsx("span",{children:c})]},r):e.jsxs(G,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:be.error.main},children:[e.jsx(dt,{}),e.jsx("span",{children:C})]},r)})})]})}),F.anchorEl&&e.jsx(Ee,{open:!!F.anchorEl,anchorReference:"anchorPosition",anchorPosition:F.position,onClose:m,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ge,{loading:s,onCancel:m,onConfirm:D})})]})})})}const an=b.memo(gt),on=ae.div`
1
+ import{r as b}from"./vendor-react-D-afvo_7.js";import{j as e,E as d,a1 as Pe,R as bt,a4 as jt,T as G,a3 as R,A as Fe,bH as _e,cn as et,cm as Te,aN as Ie,bL as De,x as ye,aj as Ee,a2 as tt,aa as ae,V as nt,bO as Ye,bI as vt,aP as yt,al as Je,co as St}from"./vendor-mui-core-BWT1QT-d.js";import{b as Z,ap as re,z as Ct}from"./vendor-utils-5TjOM6td.js";import{j as V,b as L,ad as Nt,a0 as Be,e as Y,bC as wt,D as st,a3 as Ae,aX as at,aF as be,a8 as Rt,ao as Tt,bl as It}from"./vendor-arcblock-MU05F41R.js";import{z as Dt,G as $,m as Et,I as Qe}from"./index-EWFwC-1m.js";import{e as pe,a as Oe}from"./vendor-hooks-ZnvK17j8.js";import{S as ue}from"./shorten-label-CRTt8ftG.js";import{I as it}from"./index-B0KY0nDh.js";import{S as At,a as Ot}from"./list-DLHeHUuz.js";import{R as ze}from"./relative-time-CXKwoBm5.js";import{b as We}from"./dashboard-B2P35pBD.js";import{W as Lt}from"./did-address-C1Gnyot5.js";import{p as ot}from"./util-OT81aO9n.js";import{D as kt,g as Pt}from"./traffic-Bd81vPt8.js";import{B as rt}from"./bundle-avatar-qG-4JjJF.js";import{B as Ft}from"./index-Bh1ysd6q.js";import"./index-CV3ZYUK0.js";import"./InfoOutlined-DXbe7-Vo.js";import"./useLocalStorage-C6K1MfKS.js";import"./confirm-ZDAjMdiD.js";import"./format-error-C0Ke3VXF.js";import"./PlayArrow-DisvYm5k.js";import"./get-safe-url-BUeJ9nhL.js";import"./session-Cbe0QivC.js";import"./useAsyncRetry-Dgdo-UIp.js";import"./useAsync-CEZQNMFX.js";import"./useSetState-Crt4S51m.js";import"./base32-Gx8S-X9Y.js";import"./iframe-DJUrVJrV.js";import"./LaunchOutlined-BqIvI1Me.js";import"./ChevronLeft-BCqszL0Z.js";import"./ChevronRight-B-QUfWQJ.js";import"./index-BPho8CPY.js";import"./vendor-mui-x-VJmvJUkN.js";const lt=b.createContext({}),{Provider:_t,Consumer:Qn}=lt;function Bt({children:t,blocklet:n=""}){const{api:s,inService:i}=Dt(),[a,l]=b.useState([]),[p,f]=b.useState({total:0,pageSize:20,pageCount:0,page:1}),y=pe(()=>{var j;return(j=n.meta)==null?void 0:j.did},[n]),[S,T]=b.useState([]),N=async({page:j=1,pageSize:v=20,...x}={})=>{if(!y)return[];try{const w={paging:{page:j,pageSize:v},...x,teamDid:y,dateRange:x.dateRange?[$(x.dateRange[0]).toISOString(),$(x.dateRange[1]).toISOString()]:void 0},{dids:M,...B}=w;let K="";M.includes("system")&&(K="system");const _=M.filter(ee=>ee!=="system"),Q=await s.getNotificationSendLog({input:{...B,source:K,componentDids:_}});return l(Q.list),f(Q.paging),Q.list}catch(w){return V.error(w.message),[]}},A=async()=>{const j=await s.getNotificationComponents({input:{teamDid:y}});T(j.componentDids)},P=b.useCallback(j=>{const v=n.children.find(x=>{var w;return((w=x.meta)==null?void 0:w.did)===j});if(v)return v.ancestors=[n],v},[n]),O=async({notificationId:j,receivers:v,channels:x,...w})=>{await s.resendNotification({input:{teamDid:y,notificationId:j,receivers:v,channels:x.map(M=>M==="wallet"?L.NOTIFICATION_SEND_CHANNEL.WALLET:M==="pushKit"?L.NOTIFICATION_SEND_CHANNEL.PUSH:M),...w}})},F=b.useCallback(async j=>(await s.getUser({input:{teamDid:y,user:{did:j}}})).user,[s,y]),I=b.useCallback(async({page:j=1,pageSize:v=20,...x}={})=>{try{const w={paging:{page:j,pageSize:v},...x,userName:x.searchText||"",teamDid:y,dateRange:x.dateRange?[$(x.dateRange[0]).toISOString(),$(x.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:w})}catch(w){throw V.error(w.message),w}},[s,y]);b.useEffect(()=>{y&&A()},[y]);const U={fetch:N,data:a,paging:p,blocklet:n,getComponent:P,resendNotification:O,getUser:F,componentDids:S,getReceivers:I,inService:i,teamDid:y};return e.jsx(_t,{value:{notificationRecords:U},children:t})}function Me(){const{notificationRecords:t}=b.useContext(lt);return t}fe.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const zt={info:"primary",success:"success",error:"error",warning:"warning"};function fe({severity:t="info"}){return e.jsx(Nt,{type:zt[t],children:t})}var qe={},Wt=Pe;Object.defineProperty(qe,"__esModule",{value:!0});var ct=qe.default=void 0,Mt=Wt(Be()),qt=e;ct=qe.default=(0,Mt.default)((0,qt.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var Ke={},Kt=Pe;Object.defineProperty(Ke,"__esModule",{value:!0});var dt=Ke.default=void 0,Ht=Kt(Be()),$t=e;dt=Ke.default=(0,Ht.default)((0,$t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var He={},Ut=Pe;Object.defineProperty(He,"__esModule",{value:!0});var ut=He.default=void 0,Vt=Ut(Be()),Gt=e;ut=He.default=(0,Vt.default)((0,Gt.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Xt=(t,n,s="")=>{if(!s||!n)return"";switch(s){case L.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return s}};function pt(t,n,s={}){const{status:i,updatedAt:a,reason:l="",channel:p="wallet"}=s,f=a?t("notification.sendStatus.sentTime",{date:Et(a,n)}):"",y=Xt(t,p,l);return i===L.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:f,reason:y}:i===L.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:f}:{status:"pending",title:t("notification.sendStatus.pending"),reason:y,sentTime:f}}const Le={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},ke=["wallet","pushKit","email"],Ze=["info","success","error","warning"],ft=t=>{var s,i;const{settings:n}=t;return(i=(s=n==null?void 0:n.notification)==null?void 0:s.email)==null?void 0:i.enabled},mt=t=>{var s,i;const{settings:n}=t;return(i=(s=n==null?void 0:n.notification)==null?void 0:s.pushKit)==null?void 0:i.enabled},Yt=(t,n)=>{const s=Z(n,"extra.notifications.email",!0);return{available:ft(t),enabled:s}},Jt=(t,n)=>{const s=Z(n,"extra.notifications.push",!0);return{available:mt(t),enabled:s}},Qt=t=>({enabled:Z(t,"extra.notifications.wallet",!0)}),Zt=t=>({enabled:Z(t,"extra.webhooks",[]).length>0}),ge=(t=3)=>new Promise(n=>{setTimeout(()=>{n()},t*1e3)}),en=(t,n)=>n==="wallet"||n==="webhook"?[{channel:n,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:n}),fail:t("notification.sendStatus.reason.disabled",{channel:n})}]:n==="pushKit"||n==="email"?[{channel:n,type:"available",pass:t("notification.sendStatus.reason.available",{channel:n}),fail:t("notification.sendStatus.reason.unavailable",{channel:n})},{channel:n,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:n}),fail:t("notification.sendStatus.reason.disabled",{channel:n})}]:[],xe=(t=[])=>{const n=$().startOf("day");return t.filter(s=>$(s.sendAt).isSame(n,"day")).length},tn=(t,n="")=>{if(n&&ke.includes(n)){const l=`${n}SendRecord`,p=Z(t,l,[]);return xe(p)}const s=Z(t,"webhook",{}),i=Object.keys(s??{})??[];if(n&&i.includes(n)){const l=s[n]??[];return xe(l)}const a={};return ke.forEach(l=>{const p=`${l}SendRecord`,f=Z(t,p,[]),y=xe(f);a[l]=y}),i.length>0&&i.forEach(l=>{const p=s[l]??[],f=xe(p);a[l]=f}),a},je=(t,n,s)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[s].splice(n,1),t},ve=(t,n)=>{if(!Array.isArray(n))throw new Error("filters must be an array");return n.length?!n.includes(t):!1},nn=t=>{switch(t){case L.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case L.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case L.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case L.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ht=()=>bt({typography:{fontSize:14,button:{textTransform:"none"}},palette:{primary:{main:"#1DC1C7",contrastText:"#fff"},secondary:{main:"#030712",contrastText:"#fff"},storeSecondary:{main:"#EBFEFF",contrastText:"#fff"}},components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function J({config:t,enableTooltip:n=!0,showTitle:s=!1,children:i}){const{status:a,title:l="",sentTime:p="",reason:f=""}=t,y=[l,f].filter(Boolean).join(", ");return e.jsx(jt,{title:n?e.jsxs(e.Fragment,{children:[e.jsx(G,{color:"inherit",sx:{fontSize:12},children:y}),e.jsx("span",{children:p})]}):null,arrow:!0,placement:"top",children:e.jsxs(R,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(R,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(R,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Le[a],style:{opacity:.15}}),e.jsx(R,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Le[a]})]}),e.jsx(G,{color:"inherit",sx:{fontSize:12},children:s?l:i})]})})}J.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};J.defaultProps={enableTooltip:!0,showTitle:!1,children:null};le.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};le.defaultProps={onDelete:()=>{}};function le({list:t,label:n,onDelete:s}){const{t:i,locale:a}=Y();return e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(G,{children:[n,": "]}),t.map(l=>{const p=pt(i,a,{status:l});return e.jsx(Fe,{size:"small",label:e.jsx(R,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(J,{config:p,enableTooltip:!1,children:p.title})}),onDelete:f=>s(f,l)},l)})]})}$e.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function $e({filterList:t,onChange:n,index:s,column:i,filterValues:a,label:l,renderLabel:p}){return e.jsxs(_e,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:l}),e.jsx(Te,{row:!0,children:a.map(f=>e.jsx(Ie,{control:e.jsx(De,{checked:t[s].indexOf(f.value??f)>-1,onChange:y=>{const S=[...t];y.target.checked?S[s]=[...S[s],f.value??f]:S[s]=S[s].filter(T=>T!==(f.value??f)),n(S[s],s,i)},name:f.value??f}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:p(f)})},f.value??f))})]})}function Re(t){return e.jsx($e,{...t,renderLabel:n=>e.jsx(J,{enableTooltip:!1,config:{status:n.status},children:n.label})})}oe.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function oe({status:t,updatedAt:n,reason:s="",channel:i="wallet",onResend:a}){const{t:l,locale:p}=Y(),f=pt(l,p,{status:t,updatedAt:n,reason:s,channel:i});return e.jsxs(R,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(J,{config:f,showTitle:!0}),f.status!=="success"&&e.jsx(ye,{className:"resend-btn",size:"small",startIcon:e.jsx(We,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:l("notification.resend")})]})}Ue.propTypes={value:d.array.isRequired,onChange:d.func};function Ue({value:t,onChange:n}){const{locale:s}=Y(),i=$().toDate(),[a,l]=b.useState(null),p=b.useCallback(S=>{l(a?null:S.currentTarget)},[a]),f=!!a,y=b.useCallback(S=>{if(!S.startDate||!S.endDate){V.error("Please select a date range");return}if($(S.startDate).isAfter(S.endDate)||!$(S.startDate).isValid()||!$(S.endDate).isValid()){V.error("Invalid date range");return}n([S.startDate,S.endDate]),l(null)},[n]);return e.jsxs("div",{children:[e.jsx(G,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(ye,{onClick:p,variant:"outlined",size:"small",color:"inherit",children:[Qe(t[0],s)," - ",Qe(t[1],s)]})}),e.jsx(Ee,{open:f,anchorEl:a,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(kt,{open:!0,maxDate:i,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:p,definedRanges:Pt(i),onChange:y})})]})}Ve.propTypes={itemComponent:d.elementType.isRequired};function Ve({itemComponent:t,...n}){var a;const{t:s}=Y();return!((a=n==null?void 0:n.filterList)!=null&&a.filter(l=>l.length).length)?null:e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(wt.TableFilterList,{...n,ItemComponent:t})})]})}function Se({label:t,onDelete:n,canDelete:s=()=>!0,...i}){const a=n&&typeof n=="function"?n:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:t,...i})),e.jsx(Fe,{label:t,variant:"outlined",...a&&l?{onDelete:a}:{}})}Se.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Se.defaultProps={canDelete:()=>!0};const sn=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Ge.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ge.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ge({loading:t=!1,onCancel:n,onConfirm:s}){const{t:i}=Y(),[a,l]=b.useState(sn),[p,f]=b.useState(!0),y=(T,N)=>{N.checked=T.target.checked;const A=a.map(P=>({...P,checked:P.value===N.value?N.checked:P.checked}));l(A)},S=T=>{T.stopPropagation(),s({channels:a.filter(N=>N.checked).map(N=>N.value),isResendFailedOnly:p})};return e.jsxs(R,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(G,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:i("notification.config")}),e.jsx(R,{className:"choose-channel",children:e.jsxs(_e,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:i("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:a.map(T=>e.jsx(Ie,{control:e.jsx(De,{checked:T.checked,onChange:N=>y(N,T),name:T.value}),label:T.label},T.value))})]})}),e.jsx(R,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Ie,{control:e.jsx(De,{checked:p,onChange:T=>f(T.target.checked)}),label:i("notification.resendFailedOnly")})})}),e.jsxs(R,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(ye,{onClick:T=>{T.stopPropagation(),n()},color:"inherit",children:i("common.cancel")}),e.jsxs(ye,{onClick:S,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),i("common.confirm")]})]})]})}gt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function gt({notificationId:t,handleResend:n,resending:s=!1}){const{t:i,locale:a}=Y(),{getReceivers:l,inService:p,teamDid:f,getUser:y,blocklet:S}=Me(),[T,N]=b.useState(!1),[A,P]=b.useState([]),O=Oe({anchorEl:null,position:null}),F=Oe({anchorEl:null,position:null}),[I,U]=b.useState(null),[j,v]=b.useState({total:0,pageSize:10,pageCount:0,page:1}),[x,w]=b.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[$().subtract(1,"month").startOf("day").toDate(),$().endOf("day").toDate()]}),[M,B]=b.useState([]),K=[{label:i("notification.sendStatus.pending"),value:0,status:"pending"},{label:i("notification.sendStatus.success"),value:1,status:"success"},{label:i("notification.sendStatus.failed"),value:2,status:"failed"}],_=async()=>{if(!T&&t)try{N(!0);const o=await l({notificationId:t,...x}),r=o.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:ot(c.receiverUser.avatar,f,p)}}));P(r),v(o.paging),N(!1)}catch(o){V.error(o.message),N(!1)}};b.useEffect(()=>{_()},[x]);const Q=o=>{o.stopPropagation();const r=o.currentTarget;F.anchorEl=r;const c=r.getBoundingClientRect();F.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ee=o=>o.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Ae,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(We,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:Q,children:i("notification.resend")})}):null,Ne={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:i("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:j.page-1,rowsPerPage:j.pageSize,count:j.total,searchText:x.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:M,onRowSelectionChange:(o,r)=>{B(r.map(c=>c.dataIndex))},customToolbarSelect:ee},we=({page:o,rowsPerPage:r,searchText:c,filterList:C})=>{const[,k=[],H=[],q=[]]=C;x.pageSize!==r?w(W=>({...W,pageSize:r,page:1})):x.page!==o+1?w(W=>({...W,page:o+1})):x.searchText!==c?w(W=>({...W,searchText:c,page:1})):re(k,x.walletSendStatus)?re(H,x.pushKitSendStatus)?re(q,x.emailSendStatus)||w(W=>({...W,emailSendStatus:q,page:1})):w(W=>({...W,pushKitSendStatus:H,page:1})):w(W=>({...W,walletSendStatus:k,page:1}))},me=b.useCallback(async(o,r)=>{if(!r)return!1;const c=await y(r);return c?o==="wallet"?Qt(c):o==="email"?Yt(S,c):o==="pushKit"?Jt(S,c):o==="webhook"?Zt(c):!0:!1},[y,S]),h=b.useCallback(o=>en(i,o),[i]),u=()=>{O.anchorEl=null,O.position=null,U(null)},m=()=>{F.anchorEl=null,F.position=null},g=async(o,r,c=!0,C="")=>{if(!(!r.length||!o.length))try{n(o,r,c,C),F.anchorEl||(await ge(.5),u())}catch(k){console.error("handleResend error",{error:k})}},D=async({channels:o,isResendFailedOnly:r})=>{const c=M.map(C=>A[C].receiver);await g(o,c,r),await ge(.5),m(),B([])},E=async(o,r=[],c=!0)=>{try{await g(["webhook"],[o.receiver],c,r)}catch(C){V.error(C.response?C.response.statusText:C.message)}},z=async(o,r,c,C=[],k=!0)=>{if(o.stopPropagation(),tn(r,c)>=4){V.warning(i("notification.resendLimit"));return}if(!ke.includes(c)){await E(r,C,k);return}if(o){const q=o.currentTarget,W=q.getBoundingClientRect();O.anchorEl=q,O.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}U({channel:c});try{const q=await me(c,r.receiver);await ge(1),U({channel:c,result:q}),(typeof q=="boolean"&&q||Ct(q)&&Object.values(q).every(W=>!!W))&&(await n([c],[r.receiver],k),F.anchorEl||(await ge(.5),u()))}catch(q){V.error(q.message)}},X=o=>{w(r=>({...r,dateRange:o,page:1}))},te=(o,r,c,C)=>{o.stopPropagation();const k=c.filter(H=>H!==r);w(H=>({...H,[C]:k,page:1}))},ie=pe(()=>[{label:i("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:o=>{const{receiverUser:r,receiver:c}=A[o];return r?e.jsxs(R,{"data-cy":`member-name-${r.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(st,{src:`${r.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(ue,{children:r.fullName})]},c):e.jsx(Lt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:x.walletSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Wallet",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[1].options.filterList,"walletSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Wallet",filterList:o,onChange:r,index:c,column:C,filterValues:K})},customBodyRenderLite:o=>{const{walletSendStatus:r,walletSendAt:c,walletSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"wallet",onResend:k=>z(k,A[o],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{pushKitSendStatus:r,pushKitSendAt:c,pushKitSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"pushkit",onResend:k=>z(k,A[o],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:x.pushKitSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Push Kit",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[2].options.filterList,"pushKitSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Push Kit",filterList:o,onChange:r,index:c,column:C,filterValues:K})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{emailSendStatus:r,emailSendAt:c,emailSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"email",onResend:k=>z(k,A[o],"email",[],!1)})},filter:!0,filterType:"custom",filterList:x.emailSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Email",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[3].options.filterList,"emailSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Email",filterList:o,onChange:r,index:c,column:C,filterValues:K})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{webhook:r}=A[o];if(!r)return null;const c=Object.entries(r)[0];if(!c)return null;const[C,k]=c,H=k[0];return e.jsx(R,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(R,{className:"webhook-item",fontSize:12,children:[e.jsx(ue,{maxLength:30,children:C},C),e.jsx(oe,{status:H.status,updatedAt:H.sendAt,reason:H.failedReason,channel:"webhook",onResend:q=>z(q,A[o],"webhook",[C],!1)})]},C)})}}},{label:i("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:o=>{const{createdAt:r}=A[o];return e.jsx(ze,{value:r,locale:a,shouldUpdate:!0})}}}],[A,a,x,i]),he=[e.jsx(Ue,{value:x.dateRange,onChange:X},"date-picker"),e.jsx(Ae,{variant:"contained",size:"small",color:"primary",loading:T,startIcon:e.jsx(ut,{}),onClick:()=>_(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:i("common.refresh")},"refresh")];return e.jsx(R,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(on,{children:e.jsxs(nt,{theme:ht(),children:[e.jsx(at,{className:"receivers-table",locale:a,loading:T,columns:ie,data:A,onChange:we,options:Ne,customButtons:he,components:{TableFilterList:o=>e.jsx(Ve,{...o,itemComponent:r=>e.jsx(Se,{...r,canDelete:()=>!1})})}}),O.anchorEl&&e.jsx(Ee,{open:!!O.anchorEl,anchorReference:"anchorPosition",anchorPosition:O.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(rn,{children:[e.jsxs(G,{variant:"body1",component:"div",className:"check-title",children:[I==null?void 0:I.channel," Checking"]}),e.jsx(R,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:h(I==null?void 0:I.channel).map(o=>{var k,H;const{type:r,pass:c,fail:C}=o;return!(I!=null&&I.result)||(k=I==null?void 0:I.result)!=null&&k[r]?e.jsxs(G,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(H=I==null?void 0:I.result)!=null&&H[r]?be.success.main:"inherit"},children:[I!=null&&I.result?e.jsx(ct,{}):e.jsx(tt,{size:12,sx:{color:be.primary.main}}),e.jsx("span",{children:c})]},r):e.jsxs(G,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:be.error.main},children:[e.jsx(dt,{}),e.jsx("span",{children:C})]},r)})})]})}),F.anchorEl&&e.jsx(Ee,{open:!!F.anchorEl,anchorReference:"anchorPosition",anchorPosition:F.position,onClose:m,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ge,{loading:s,onCancel:m,onConfirm:D})})]})})})}const an=b.memo(gt),on=ae.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }