@abtnode/blocklet-services 1.16.43-beta-20250425-130658-8da18f4d → 1.16.43-beta-20250427-132304-6da95c55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/routes/oauth/client.js +2 -0
- package/api/routes/oauth/server.js +75 -0
- package/api/routes/user.js +1 -0
- package/api/services/oauth/server.js +31 -1
- package/dist/assets/{AdapterDayjs-6a0bjomM.js → AdapterDayjs-BUGplkxR.js} +1 -1
- package/dist/assets/{ArrowDropDown-DiAXbLgf.js → ArrowDropDown-B0sLkJoY.js} +1 -1
- package/dist/assets/{CheckCircle-BOBzbtP2.js → CheckCircle-BNrN9mgy.js} +1 -1
- package/dist/assets/{ChevronLeft-JDNo_7RB.js → ChevronLeft-Dq00IS01.js} +1 -1
- package/dist/assets/{ChevronRight-Cfe-QLJe.js → ChevronRight-ZTqWK-Ga.js} +1 -1
- package/dist/assets/{DeleteOutline-DW9Kk9LF.js → DeleteOutline-C2sY6hfm.js} +1 -1
- package/dist/assets/{Done-CAPpWSLt.js → Done-JLiLhELm.js} +1 -1
- package/dist/assets/{Download-BFPjDYTH.js → Download-Ch4RfGRW.js} +1 -1
- package/dist/assets/{Edit-D6qkTeBz.js → Edit-CY6fFHQM.js} +1 -1
- package/dist/assets/{Error-SwROBcf8.js → Error-CSFUqG0m.js} +1 -1
- package/dist/assets/{ExpandLess-BpA2naWp.js → ExpandLess-BiMmSOBl.js} +1 -1
- package/dist/assets/{Google-C5jm8HrI.js → Google-GOp5YvmZ.js} +1 -1
- package/dist/assets/{InfoOutlined-B-fGWta1.js → InfoOutlined-CQB5qKm-.js} +1 -1
- package/dist/assets/{Launch-GqtcaQf1.js → Launch-fxgQvk19.js} +1 -1
- package/dist/assets/{LaunchOutlined-D7W2P0hG.js → LaunchOutlined-BV4_W1pb.js} +1 -1
- package/dist/assets/{MoreHoriz-3W8Fr_ZL.js → MoreHoriz-CX_pwfPT.js} +1 -1
- package/dist/assets/{PlayArrow-Cja7S4vv.js → PlayArrow-DFH1Psjx.js} +1 -1
- package/dist/assets/{TuneOutlined-B3W8vgdw.js → TuneOutlined-Dy2qPFGI.js} +1 -1
- package/dist/assets/{ViewList-BRsEAVjL.js → ViewList-e3CoNi3K.js} +1 -1
- package/dist/assets/{access-control-hoDAWTTL.js → access-control-B20P1UrY.js} +1 -1
- package/dist/assets/{actions-BPVh6JdI.js → actions-DA-6s_nQ.js} +1 -1
- package/dist/assets/{add-component-core-BXXPrLkI.js → add-component-core-DG9mQFsr.js} +1 -1
- package/dist/assets/{add-resource-DSoZMbAG.js → add-resource-BoS5YkVy.js} +1 -1
- package/dist/assets/{addon-CY4PNd8X.js → addon-Bcc-Xwbf.js} +1 -1
- package/dist/assets/{advanced-BV9dnonO.js → advanced-DTe2fs5L.js} +1 -1
- package/dist/assets/{appearance-DbKPqE0i.js → appearance-DYi32tlk.js} +1 -1
- package/dist/assets/{ar-mN5tHF4O.js → ar-DupP3pla.js} +1 -1
- package/dist/assets/{audit-logs-CY7CyxpG.js → audit-logs-CydL26ZC.js} +2 -2
- package/dist/assets/{authorize-CLUD6O4F.js → authorize-DUyL7MEU.js} +1 -1
- package/dist/assets/{base32-bFQC4m_a.js → base32-p9VcJrwv.js} +1 -1
- package/dist/assets/{branding-LKt9TBDZ.js → branding-CAMtNLMU.js} +1 -1
- package/dist/assets/{branding-psyKu6rz.js → branding-_VO2ZZ3t.js} +2 -2
- package/dist/assets/{bundle-avatar-CNkSW5-i.js → bundle-avatar-D0t7RLGx.js} +1 -1
- package/dist/assets/{button-BXbVAdLT.js → button-BeZibzB9.js} +1 -1
- package/dist/assets/{click-to-copy-CSwrPBKm.js → click-to-copy-BGyXQL2i.js} +1 -1
- package/dist/assets/{complete-B8igFASe.js → complete-BzCBoyhn.js} +1 -1
- package/dist/assets/{component-RJz0SwId.js → component-5gjaNHCg.js} +1 -1
- package/dist/assets/{config-C2EcTJzj.js → config-1xq1_d84.js} +1 -1
- package/dist/assets/{config-CqUiFvo_.js → config-Bh19ZUJ-.js} +1 -1
- package/dist/assets/{config-navigation-D8u4Wwi0.js → config-navigation-Dvjz9nAh.js} +3 -3
- package/dist/assets/{config-space-BytYjhBd.js → config-space-CYg-72ab.js} +1 -1
- package/dist/assets/{confirm-qekNSA6N.js → confirm-DqvNmeoz.js} +1 -1
- package/dist/assets/{connect-BPW0KY4c.js → connect-Bbc2y5nS.js} +1 -1
- package/dist/assets/{connect-DZqNlu4F.js → connect-DM2xKEWk.js} +1 -1
- package/dist/assets/{connect-to-BcxM4POV.js → connect-to-Ck5O2M1K.js} +1 -1
- package/dist/assets/{dashboard-DrtJT0zg.js → dashboard-8QXGSoVu.js} +3 -3
- package/dist/assets/{de-BP5gdcKp.js → de-TcDcBkI0.js} +1 -1
- package/dist/assets/{delete-confirm-DEV7zNkl.js → delete-confirm-_BzUlhv2.js} +1 -1
- package/dist/assets/{did-address-DZ4aPkg2.js → did-address-DUThaBlf.js} +1 -1
- package/dist/assets/{domain-action-card-B5PD8_Bw.js → domain-action-card-D3w6jyPR.js} +1 -1
- package/dist/assets/{domain-CcBq0Tmt.js → domain-ag7_Ivc1.js} +1 -1
- package/dist/assets/domains-BDxEOJh6.js +1 -0
- package/dist/assets/{email-BWcxSNWH.js → email-DKpgximx.js} +1 -1
- package/dist/assets/{es-CBFvWN06.js → es-CDD0y3ur.js} +1 -1
- package/dist/assets/{exchange-passport-Bw0lAjY5.js → exchange-passport-Izkf8qpM.js} +1 -1
- package/dist/assets/{fr-CmHa1dCv.js → fr-zYSSKlBw.js} +1 -1
- package/dist/assets/{fuel-DBFO1voi.js → fuel-CcBzY6Bt.js} +1 -1
- package/dist/assets/{gen-access-key-BW8kZ1Xs.js → gen-access-key-DxKwgiGT.js} +1 -1
- package/dist/assets/{get-safe-url-BZgGKuU5.js → get-safe-url-Bq9SFfX6.js} +1 -1
- package/dist/assets/{get-safe-url-C0AtthsC.js → get-safe-url-DBsPGn--.js} +1 -1
- package/dist/assets/{hi-CWyDCXYI.js → hi-BsP-0YrU.js} +1 -1
- package/dist/assets/{home-CTPoo1SY.js → home-Bi8fA3jh.js} +1 -1
- package/dist/assets/{id-3xH3q-wr.js → id-CY2FWdMB.js} +1 -1
- package/dist/assets/{iframe--qNemH7W.js → iframe-DZ181i8X.js} +1 -1
- package/dist/assets/{index-eeIdp1fF.js → index-B2yOcqTl.js} +1 -1
- package/dist/assets/{index-d728JwfZ.js → index-BGgGfqEc.js} +1 -1
- package/dist/assets/{index-D5iB7faJ.js → index-B_vrglsK.js} +1 -1
- package/dist/assets/{index-u9S0L-Rf.js → index-BnmeT4Bk.js} +1 -1
- package/dist/assets/{index-BvQykj-W.js → index-C8QMe2NL.js} +1 -1
- package/dist/assets/{index-Ci9HJ6Iv.js → index-CGBZONPv.js} +1 -1
- package/dist/assets/{index-C5yNf__V.js → index-Cjjg2_Xp.js} +1 -1
- package/dist/assets/{index-BUb5Yjs_.js → index-DNG6b9sp.js} +4 -4
- package/dist/assets/{index-CGJUebpH.js → index-DO3_1y-L.js} +7 -7
- package/dist/assets/{index-CnjT4Zv0.js → index-DO4cSlUf.js} +1 -1
- package/dist/assets/{index-BoJFRi1m.js → index-DcBUShKK.js} +1 -1
- package/dist/assets/{index-CY6pLbAD.js → index-Dl4W1N74.js} +1 -1
- package/dist/assets/{index-DLBv7Dtg.js → index-DuH8q5ir.js} +1 -1
- package/dist/assets/{index-DS-sLY6b.js → index-DyxFC42L.js} +3 -3
- package/dist/assets/{index-COd4R-rR.js → index-EnQ254k3.js} +1 -1
- package/dist/assets/{index-lI6b97z3.js → index-bb90BUf4.js} +1 -1
- package/dist/assets/{index-Dv_p9rOk.js → index-mDKG4SiY.js} +1 -1
- package/dist/assets/index-n0Q-fETi.js +99 -0
- package/dist/assets/{index-CXuahOvP.js → index-slEV_y-C.js} +1 -1
- package/dist/assets/{invitation-DRfkSNu9.js → invitation-BrAZQXQL.js} +1 -1
- package/dist/assets/{invite-t5XgIivH.js → invite-Cbz8B2uW.js} +1 -1
- package/dist/assets/{issue-passport-Cn04_O-m.js → issue-passport-Dd_yyO08.js} +1 -1
- package/dist/assets/{item-cpKk__48.js → item-nK3D7WH5.js} +1 -1
- package/dist/assets/{ja-Dlm9gbED.js → ja-BLPXqHM4.js} +1 -1
- package/dist/assets/{ko-JYKwx9PY.js → ko-Cxgk34co.js} +1 -1
- package/dist/assets/{landing-page-CaOceQxT.js → landing-page-BMM_oJb1.js} +1 -1
- package/dist/assets/{layout-DTFm6q61.js → layout-Cw-hwCHs.js} +1 -1
- package/dist/assets/{list-CMmXasDM.js → list-Dmtz4mRb.js} +1 -1
- package/dist/assets/localization-DATb3Y_j.js +1 -0
- package/dist/assets/{log-CYW8Ap44.js → log-Chqr_or_.js} +1 -1
- package/dist/assets/{logger-BbYYsfRo.js → logger-zix81YaM.js} +1 -1
- package/dist/assets/{login-GHsnMk-9.js → login-DjB23H9M.js} +1 -1
- package/dist/assets/{login-oauth-callback-B2HyhVt7.js → login-oauth-callback-ILeP59KT.js} +1 -1
- package/dist/assets/{logo-uploader-ly-3UjHj.js → logo-uploader-CJrdpVcQ.js} +3 -3
- package/dist/assets/{lost-passport-BduGI9L4.js → lost-passport-Do1Pl0xI.js} +1 -1
- package/dist/assets/{open-window-Cw3Ugf66.js → open-window-D8MZhu_7.js} +1 -1
- package/dist/assets/{overview-C101Lhxl.js → overview-DLA9wj6a.js} +1 -1
- package/dist/assets/{page-header-Bk-0dymm.js → page-header-CWY8mxlT.js} +1 -1
- package/dist/assets/{passport-item-BUfjEppi.js → passport-item-CWtlyIE_.js} +1 -1
- package/dist/assets/{permission-C_VicyW0.js → permission-BGM09622.js} +1 -1
- package/dist/assets/{preferences-C_nxZvVu.js → preferences-DYdbb0kG.js} +1 -1
- package/dist/assets/{profile-embed-CgXxt11D.js → profile-embed-CeEMHxEc.js} +1 -1
- package/dist/assets/{pt-BgyGyT44.js → pt-BINIHul4.js} +1 -1
- package/dist/assets/{publish-resource-DBfSpWOt.js → publish-resource-BEc_A5mC.js} +1 -1
- package/dist/assets/{react-beautiful-dnd.esm-kaYRX6nt.js → react-beautiful-dnd.esm-ByydTUk4.js} +1 -1
- package/dist/assets/{relative-time-CuIhVa08.js → relative-time-Djw-K4Zu.js} +1 -1
- package/dist/assets/{ru-CEVWIKf9.js → ru-BifF7u-P.js} +1 -1
- package/dist/assets/{runtime-Pqx3AapT.js → runtime-DXl0lfXF.js} +1 -1
- package/dist/assets/sdk-CTe6rL6c.js +1 -0
- package/dist/assets/{security-BSs6l8nY.js → security-BhkfG23R.js} +1 -1
- package/dist/assets/{session-BoLXmmdy.js → session-VIMbdc9j.js} +1 -1
- package/dist/assets/{setup-BK8QRxSP.js → setup-BmYxTt6Z.js} +9 -3
- package/dist/assets/{spaces-FInvGagn.js → spaces-WkJCApHO.js} +1 -1
- package/dist/assets/{start-e5k6uJu1.js → start-CVexuuAk.js} +1 -1
- package/dist/assets/{status-uX3_TUfC.js → status-CygZ0LuY.js} +1 -1
- package/dist/assets/{step-actions-5JhpbsMf.js → step-actions-D_1PFeFs.js} +1 -1
- package/dist/assets/{studio-gQoPFCFH.js → studio-Byjzwg8q.js} +1 -1
- package/dist/assets/{switch-control-1DAS0xgi.js → switch-control-5fEOPVKs.js} +1 -1
- package/dist/assets/{th-y94pKVk7.js → th-CBxM23U5.js} +1 -1
- package/dist/assets/{traffic-CLSnYOIK.js → traffic-T11hxc--.js} +1 -1
- package/dist/assets/{transfer-Dh9v20QV.js → transfer-ROpxn9LD.js} +1 -1
- package/dist/assets/{unsubscribe-BiCDicGU.js → unsubscribe-Cd3XOnSp.js} +1 -1
- package/dist/assets/{use-app-logo-Cc5WhrJy.js → use-app-logo-B8Kl9EZt.js} +1 -1
- package/dist/assets/{useLocalStorage-BxIzITf9.js → useLocalStorage-DldnaMbZ.js} +1 -1
- package/dist/assets/{user-center-1qavaXbB.js → user-center-CzyCbtWm.js} +1 -1
- package/dist/assets/{util-Ce3AQBfV.js → util-Bjy-tP7q.js} +1 -1
- package/dist/assets/{util-BrciyiqD.js → util-Dw9Eiuko.js} +1 -1
- package/dist/assets/{vendor-arcblock-BUng-RXZ.js → vendor-arcblock-ScFEr-lj.js} +2 -2
- package/dist/assets/{vendor-ux-did-connect-CsNUdA6Y.js → vendor-ux-did-connect-BdkhddhO.js} +1 -1
- package/dist/assets/{vi-Dw7W2UPp.js → vi-DY_Y13jR.js} +1 -1
- package/dist/assets/wrap-locale-DMTYAE64.js +1 -0
- package/dist/assets/{zh-Dag6w2Z7.js → zh-BYRCoK6F.js} +1 -1
- package/dist/assets/{zh-tw-CMYkmBeh.js → zh-tw-BG0rlH8p.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/service-worker.js +1 -1
- package/package.json +21 -21
- package/dist/assets/domains-CGsSPrGB.js +0 -1
- package/dist/assets/index-BtWj67HV.js +0 -99
- package/dist/assets/localization-Bp5pyrsz.js +0 -1
- package/dist/assets/sdk-guHRt_DC.js +0 -1
- package/dist/assets/wrap-locale-Bc5OA7-R.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{r as x,f as Tt,l as ct,L as ke,g as Wn,u as Mn,i as Un,j as jt}from"./vendor-react-DEoibe3W.js";import{a8 as we,j as e,v as We,a9 as c,bc as Pt,H as s,ac as je,I as ce,T as E,c4 as Oo,D as at,ag as ye,at as Vn,bS as Ke,aj as dt,bs as et,bw as tt,y as K,aa as Re,P as Bo,G as Wo,w as _t,a6 as Mo,M as Uo,q as fe,X as Fn,ai as Vo,t as Fo,bV as Hn,N as Je,z as Ho,O as ne,ak as ve,as as Go,L as Jo,A as $t,b5 as Xo,bK as Yo,bx as Gn,e as Jn,ap as Xn,b$ as Yn,ae as Qn,U as Qo,W as ot,bF as Zn,bG as Kn,c5 as es,c6 as ts,bn as Ct,bo as os,bq as ns,bu as ss,bv as kt}from"./vendor-mui-core-CQ38ohp2.js";import{z as ge,C as Se,af as rs,a7 as ls,f as yo,ag as vo,ab as is}from"./index-CGJUebpH.js";import{r as De,j as Y,u as Q,bt as Zo,f as cs,B as qe,b6 as Ko,V as en,b4 as tn,an as as,bu as ds,a5 as qt,Y as W,a1 as us,I as ae,bv as ps,b9 as hs,a as Be,al as ut,b5 as fs,ar as on}from"./vendor-ux-did-connect-CsNUdA6Y.js";import{K as pt,c as he,q as ms,P as bs,_ as nn,Q as $e,p as xs}from"./vendor-arcblock-BUng-RXZ.js";import{d as gs}from"./Error-SwROBcf8.js";import{C as ht}from"./confirm-qekNSA6N.js";import{u as Ue}from"./session-BoLXmmdy.js";import{W as wt}from"./did-address-DZ4aPkg2.js";import{E as Xe}from"./empty-spinner-DmDm8XzF.js";import{B as Et}from"./bundle-avatar-CNkSW5-i.js";import{S as Ce}from"./shorten-label-DFzv9EKX.js";import{L as Lt}from"./list-header-CgF1S4js.js";import{Z as js,y as de,I as Nt,D as sn}from"./vendor-utils-BNHJB5U7.js";import{d as ks}from"./Download-BFPjDYTH.js";import{C as rn}from"./click-to-copy-CSwrPBKm.js";import{Q as ys}from"./QuestionMarkCircle-p6m3avKp.js";import{u as vs}from"./vendor-hooks-DftG_2gV.js";import{_ as _e}from"./useSetState-CWq0AVWn.js";import{c as At}from"./index-DVQCgvFb.js";import{E as zt}from"./index-DKhrYmrN.js";import"./api-BrU7j0QA.js";import{d as Rs}from"./ChevronRight-Cfe-QLJe.js";import{T as Cs,a as ws}from"./vendor-mui-x-B0hsmEJ3.js";import{d as nt}from"./DeleteOutline-DW9Kk9LF.js";import{D as Ro,C as Co,P as wo}from"./react-beautiful-dnd.esm-kaYRX6nt.js";import{c as Ss,A as ln,u as cn,S as Ds,a as Is,b as Ts,e as Ps,U as _s,f as yt,g as an,n as $s,h as qs,i as So,k as Es,l as Ls}from"./item-cpKk__48.js";import{d as Ns}from"./ArrowDropDown-DiAXbLgf.js";import{f as xe}from"./format-error-BrmqJs5a.js";import{d as dn}from"./Launch-GqtcaQf1.js";import{d as un}from"./Done-CAPpWSLt.js";import{D as As}from"./delete-confirm-DEV7zNkl.js";import{g as pn}from"./get-safe-url-BZgGKuU5.js";import{M as zs}from"./index-CHbpkZwO.js";import{r as Os}from"./index-SDdS_qt8.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ot={},Bs=we;Object.defineProperty(Ot,"__esModule",{value:!0});var hn=Ot.default=void 0,Ws=Bs(De()),Ms=e;hn=Ot.default=(0,Ws.default)((0,Ms.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var Bt={},Us=we;Object.defineProperty(Bt,"__esModule",{value:!0});var fn=Bt.default=void 0,Vs=Us(De()),Fs=e;fn=Bt.default=(0,Vs.default)((0,Fs.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Wt={},Hs=we;Object.defineProperty(Wt,"__esModule",{value:!0});var mn=Wt.default=void 0,Gs=Hs(De()),Js=e;mn=Wt.default=(0,Gs.default)((0,Js.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Mt({did:t,projectId:o,title:n,logo:l,describe:i}){const r=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${l}`,[u,a]=x.useState(!1),f=We(b=>b.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx(Pt,{sx:{borderRadius:1},src:r}),e.jsxs(c,{children:[e.jsx(Ce,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),e.jsx(Ce,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||u?"primary.main":"grey.700"},children:i||"/"})]})]})}Mt.propTypes={projectId:s.string.isRequired,did:s.string.isRequired,title:s.string.isRequired,logo:s.string.isRequired,describe:s.string.isRequired};function Ut({initUrl:t}){const o=Tt(),n=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:l,locale:i}=Q(),{api:d}=ge(),{api:r}=Ue(),[u,a]=x.useState(!0),{blocklet:f}=Se(),[b,j]=x.useState(null),[y,h]=x.useState(!1),p=We(S=>S.breakpoints.down("xl")),v=We(S=>S.breakpoints.down("md")),{componentDid:C=""}=ct(),[m,k]=x.useState(null),w=`publish-${f.meta.did}`,T=Zo(w),[P,I]=x.useState({searchText:T.searchText||"",pageSize:T.rowsPerPage||10,page:1}),L=()=>{d.getProjects({input:{did:f.meta.did,componentDid:C,tenantScope:n}}).then(S=>{const A=(S==null?void 0:S.projects)||[];a(!1),k(A)}).catch(S=>{a(!1),W.error(S.message)})},z=()=>{o(`${Y.UNOWNED_DID}/create/none`,{replace:!0})},q=S=>{j(S)},Z=()=>{a(!1),h(!0)},U=()=>{h(!1),j(null)},R=S=>{W.error(S.message),h(!1),j(null)},g=S=>{if(!(S!=null&&S.deleted)){W.error("Delete project failed");return}L(),h(!1),j(null)};x.useEffect(()=>{L()},[]);const D=x.useMemo(()=>{var A;if(!P.searchText)return m;let S=(A=P.searchText)==null?void 0:A.trim();return S?(S=cs.toAddress(S).toLocaleLowerCase(),m.filter(H=>H.blockletTitle.toLowerCase().includes(S)||H.blockletDid.toLowerCase().includes(S))):m},[m,P.searchText]);if(!m&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!m)return null;if(!m.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:l("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:l("blocklet.publish.createBlockletTip")}),e.jsx(qe,{onClick:z,variant:"contained",children:l("blocklet.publish.createBlocklet")})]});const M=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:S=>{const A=m[S];return e.jsx(ke,{to:`${A.id}`,children:e.jsx(Mt,{did:f.meta.did,projectId:A.id,logo:A.blockletLogo,title:A.blockletTitle,describe:A.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:S=>S?e.jsx(Ko,{type:"success",children:S}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:S=>S?e.jsx(wt,{size:14,compact:!0,responsive:!1,did:S}):null}},p||C?null:{label:l("common.createdBy"),name:"createdBy",options:{customBodyRender:S=>S?e.jsx(wt,{onClick:()=>{o(`/.well-known/service/admin/members?did=${S}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:S}):null}},p||C?null:{label:l("common.scope"),name:"componentDid",options:{customBodyRender:S=>{const A=(f.children||[]).find(H=>H.meta.did===S);return A?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Et,{size:14,blocklet:A,ancestors:[f]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:A.meta.title})]},S):""}}},p||n?null:{label:l("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:S=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Ce,{children:S})})}},{label:l("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:S=>e.jsx(en,{value:Number(S),locale:i})}},{label:l("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:S=>{const A=m[S];return e.jsxs(c,{display:"flex",children:[e.jsx(ke,{to:`${A.id}/new-release/${A.lastReleaseId}`,children:e.jsx(je,{title:l("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(hn,{style:{fontSize:18}})})})}),!!A.lastReleaseId&&e.jsx(je,{title:l("blocklet.publish.viewLastRelease",{name:A.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(ke,{style:{display:"flex"},to:`${A.id}/view/${A.lastReleaseId}`,children:e.jsx(fn,{sx:{fontSize:18}})})})}),e.jsx(je,{title:l("blocklet.publish.delete",{name:A.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>q(A),children:e.jsx(tn,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),O=({page:S,rowsPerPage:A,searchText:H})=>{P.pageSize!==A?I(J=>({...J,searchText:"",pageSize:A,page:1})):P.page!==S+1?I(J=>({...J,searchText:"",page:S+1})):P.searchText!==H&&I(J=>({...J,searchText:H,page:1}))},G=y?e.jsx(as,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:r.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:g,onError:R,extraParams:{projectId:b.id,did:f.meta.did,name:b.blockletTitle},messages:{title:l("blocklet.publish.deleteProject.title",{name:b.blockletTitle}),scan:l("blocklet.publish.deleteProject.scan",{name:b.blockletTitle}),confirm:l("blocklet.publish.deleteProject.confirm"),success:l("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(c,{children:[e.jsx(Lt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:l("common.blockletStudio")}),e.jsx(je,{title:l("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(mn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(ds,{options:{searchPlaceholder:l("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:v},search:P.searchText,searchText:P.searchText,searchTextUpdate:S=>I(A=>({...A,searchText:S})),searchClose:()=>I(S=>({...S,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(qe,{onClick:z,variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),l("blocklet.publish.createBlocklet")]})]})}),e.jsx(qt,{className:"main-table",locale:i,data:D,columns:M,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:w,onChange:O}),b&&e.jsx(ht,{title:`${l("common.delete")} ${b.blockletTitle}`,description:l("blocklet.publish.deleteProject.description"),confirm:l("common.confirm"),onConfirm:Z,onCancel:()=>j(null),children:e.jsx(c,{sx:{marginTop:2},children:[l("blocklet.publish.deleteProject.tip1"),l("blocklet.publish.deleteProject.tip2"),l("blocklet.publish.deleteProject.tip3")].map(S=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(gs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(E,{component:"span",variant:"inherit",color:"text.secondary",children:S})]}))})}),G]})}Ut.propTypes={initUrl:s.object};Ut.defaultProps={initUrl:null};var Vt={},Xs=we;Object.defineProperty(Vt,"__esModule",{value:!0});var bn=Vt.default=void 0,Ys=Xs(De()),Do=e;bn=Vt.default=(0,Ys.default)([(0,Do.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,Do.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const Qs=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},xn=Qs;function Zs(){var R;const{t,locale:o}=Q(),{projectId:n}=ct(),{api:l}=ge(),[i,d]=x.useState(!0),{blocklet:r}=Se(),u=We(g=>g.breakpoints.down("md")),[a,f]=x.useState(null),[b,j]=x.useState(null),[y,h]=x.useState(null),p=(R=window.env)==null?void 0:R.serverEndpoint,v=`releases-${r.meta.did}-${n}`,C=Zo(v),[m,k]=x.useState({searchText:C.searchText||"",pageSize:C.rowsPerPage||10,page:1}),w=()=>{l.getReleases({input:{did:r.meta.did,projectId:n}}).then(g=>{const D=(g==null?void 0:g.releases)||[];d(!1),f(D)}).catch(g=>{d(!1),W.error(g.message)})},T=()=>{l.doBatchQuery({getProject:{input:{did:r.meta.did,projectId:n}},getReleases:{input:{did:r.meta.did,projectId:n}}}).then(g=>{j(g.getProject.project||{}),f(g.getReleases.releases||[]),d(!1)}).catch(g=>{d(!1),W.error(g.message)})};x.useEffect(()=>{T()},[]);const[P,I]=x.useState(""),L=()=>{d(!1);const g=y.id;l.deleteRelease({input:{did:r.meta.did,projectId:n,releaseId:g}}).then(()=>{d(!1),w(),W.success(t("common.removeSuccess")),h(null)}).catch(D=>{d(!1),W.error(D.message)})},z=g=>{h(g)};if(!a&&i)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!a)return null;const q=e.jsxs(Oo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(ke,{to:"..",children:t("common.blockletStudio")}),e.jsx(E,{color:"text.primary",children:e.jsx(Ce,{maxLength:u?6:30,children:b.blockletTitle})})]});if(!a.length)return e.jsxs(e.Fragment,{children:[q,e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),e.jsx(ke,{to:"create/none",children:e.jsx(qe,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const Z=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:g=>{const D=a[g];return e.jsx(ke,{to:`view/${D.id}`,children:e.jsx(Mt,{did:r.meta.did,projectId:b.id,logo:D.blockletLogo,title:D.blockletVersion,describe:D.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:g=>{const D=a[g];return e.jsx(E,{className:"note",children:xn(D.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:g=>e.jsx(Ko,{type:g==="published"?"success":"warning",children:g==="published"?"Released":js(g)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:g=>{const D=a[g];return D.status!==he.PROJECT.RELEASE_STATUS.published?"":e.jsx(en,{value:Number(D.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:g=>{var A;const D=a[g];let M="",O="";const G=D.status==="published";if(G){const H=de(p,`/api/project/${r.meta.did}/${b.id}/${b.lastReleaseId}/release/blocklet.json`),J=new URL(p);J.pathname=de(J.pathname,"/launch-blocklet/agreement"),J.searchParams.set("blocklet_meta_url",H),M=J.href,O=de(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${b.id}/${b.lastReleaseId}/download/${(b.lastReleaseFiles||[])[0]}`)}const S=(A=b.blockletComponents)!=null&&A.some(H=>H.included)||D.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[G&&S==="pack"&&e.jsx(je,{title:t("blocklet.publish.install",{name:b.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:M,target:"_blank",rel:"noreferrer",children:e.jsx(bn,{sx:{fontSize:18}})})})}),G&&e.jsx(je,{title:t("blocklet.publish.download",{name:b.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:O,children:e.jsx(ks,{sx:{fontSize:18}})})})}),e.jsx(je,{title:t("blocklet.publish.delete",{name:b.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>z(D),children:e.jsx(tn,{sx:{fontSize:18}})})})]})}}}],U=({page:g,rowsPerPage:D,searchText:M})=>{m.pageSize!==D?k(O=>({...O,searchText:"",pageSize:D,page:1})):m.page!==g+1?k(O=>({...O,searchText:"",page:g+1})):m.searchText!==M&&k(O=>({...O,searchText:M,page:1}))};return e.jsxs(Ks,{children:[e.jsx(Lt,{sx:{mb:2},left:q,actions:e.jsxs(e.Fragment,{children:[e.jsx(qe,{variant:"outlined",onClick:()=>{const g=de(p,`/api/project/${r.meta.did}/${n}/blocklet.json`);I(g)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(ke,{to:"new-release/none",children:e.jsxs(qe,{variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(at,{fullWidth:!0,maxWidth:"sm",open:P,onClose:()=>I(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(E,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(rn,{children:P}),e.jsxs(E,{sx:{mt:2},children:[t("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:t("blocklet.publish.installResourceHelp")})]})]})}),e.jsx(qt,{className:"main-table",verticalKeyWidth:100,locale:o,data:a,columns:Z,durable:v,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1},onChange:U}),y&&e.jsx(ht,{title:t(`${t("common.delete")} ${y.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:L,onCancel:()=>h(null)})]})}const Ks=ye(c)`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DyxFC42L.js","assets/vendor-ux-did-connect-BdkhddhO.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-BNHJB5U7.js","assets/vendor-mui-core-CQ38ohp2.js","assets/vendor-hooks-DftG_2gV.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-ScFEr-lj.js","assets/index-YbJjfDTR.js","assets/index-DO3_1y-L.js","assets/index-B1ljmpu4.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as x,f as Tt,l as ct,L as ke,g as Wn,u as Mn,i as Un,j as jt}from"./vendor-react-DEoibe3W.js";import{a8 as we,j as e,v as We,a9 as c,bc as Pt,H as s,ac as je,I as ce,T as E,c4 as Oo,D as at,ag as ye,at as Vn,bS as Ke,aj as dt,bs as et,bw as tt,y as K,aa as Re,P as Bo,G as Wo,w as _t,a6 as Mo,M as Uo,q as fe,X as Fn,ai as Vo,t as Fo,bV as Hn,N as Je,z as Ho,O as ne,ak as ve,as as Go,L as Jo,A as $t,b5 as Xo,bK as Yo,bx as Gn,e as Jn,ap as Xn,b$ as Yn,ae as Qn,U as Qo,W as ot,bF as Zn,bG as Kn,c5 as es,c6 as ts,bn as Ct,bo as os,bq as ns,bu as ss,bv as kt}from"./vendor-mui-core-CQ38ohp2.js";import{z as ge,C as Se,af as rs,a7 as ls,f as yo,ag as vo,ab as is}from"./index-DO3_1y-L.js";import{r as De,j as Y,u as Q,bt as Zo,f as cs,B as qe,b6 as Ko,V as en,b4 as tn,an as as,bu as ds,a5 as qt,Y as W,a1 as us,I as ae,bv as ps,b9 as hs,a as Be,al as ut,b5 as fs,ar as on}from"./vendor-ux-did-connect-BdkhddhO.js";import{K as pt,c as he,q as ms,P as bs,_ as nn,Q as $e,p as xs}from"./vendor-arcblock-ScFEr-lj.js";import{d as gs}from"./Error-CSFUqG0m.js";import{C as ht}from"./confirm-DqvNmeoz.js";import{u as Ue}from"./session-VIMbdc9j.js";import{W as wt}from"./did-address-DUThaBlf.js";import{E as Xe}from"./empty-spinner-DmDm8XzF.js";import{B as Et}from"./bundle-avatar-D0t7RLGx.js";import{S as Ce}from"./shorten-label-DFzv9EKX.js";import{L as Lt}from"./list-header-CgF1S4js.js";import{Z as js,y as de,I as Nt,D as sn}from"./vendor-utils-BNHJB5U7.js";import{d as ks}from"./Download-Ch4RfGRW.js";import{C as rn}from"./click-to-copy-BGyXQL2i.js";import{Q as ys}from"./QuestionMarkCircle-p6m3avKp.js";import{u as vs}from"./vendor-hooks-DftG_2gV.js";import{_ as _e}from"./useSetState-CWq0AVWn.js";import{c as At}from"./index-DVQCgvFb.js";import{E as zt}from"./index-DKhrYmrN.js";import"./api-BrU7j0QA.js";import{d as Rs}from"./ChevronRight-ZTqWK-Ga.js";import{T as Cs,a as ws}from"./vendor-mui-x-B0hsmEJ3.js";import{d as nt}from"./DeleteOutline-C2sY6hfm.js";import{D as Ro,C as Co,P as wo}from"./react-beautiful-dnd.esm-ByydTUk4.js";import{c as Ss,A as ln,u as cn,S as Ds,a as Is,b as Ts,e as Ps,U as _s,f as yt,g as an,n as $s,h as qs,i as So,k as Es,l as Ls}from"./item-nK3D7WH5.js";import{d as Ns}from"./ArrowDropDown-B0sLkJoY.js";import{f as xe}from"./format-error-BrmqJs5a.js";import{d as dn}from"./Launch-fxgQvk19.js";import{d as un}from"./Done-JLiLhELm.js";import{D as As}from"./delete-confirm-_BzUlhv2.js";import{g as pn}from"./get-safe-url-DBsPGn--.js";import{M as zs}from"./index-CHbpkZwO.js";import{r as Os}from"./index-SDdS_qt8.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ot={},Bs=we;Object.defineProperty(Ot,"__esModule",{value:!0});var hn=Ot.default=void 0,Ws=Bs(De()),Ms=e;hn=Ot.default=(0,Ws.default)((0,Ms.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var Bt={},Us=we;Object.defineProperty(Bt,"__esModule",{value:!0});var fn=Bt.default=void 0,Vs=Us(De()),Fs=e;fn=Bt.default=(0,Vs.default)((0,Fs.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Wt={},Hs=we;Object.defineProperty(Wt,"__esModule",{value:!0});var mn=Wt.default=void 0,Gs=Hs(De()),Js=e;mn=Wt.default=(0,Gs.default)((0,Js.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Mt({did:t,projectId:o,title:n,logo:l,describe:i}){const r=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${l}`,[u,a]=x.useState(!1),f=We(b=>b.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx(Pt,{sx:{borderRadius:1},src:r}),e.jsxs(c,{children:[e.jsx(Ce,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),e.jsx(Ce,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||u?"primary.main":"grey.700"},children:i||"/"})]})]})}Mt.propTypes={projectId:s.string.isRequired,did:s.string.isRequired,title:s.string.isRequired,logo:s.string.isRequired,describe:s.string.isRequired};function Ut({initUrl:t}){const o=Tt(),n=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:l,locale:i}=Q(),{api:d}=ge(),{api:r}=Ue(),[u,a]=x.useState(!0),{blocklet:f}=Se(),[b,j]=x.useState(null),[y,h]=x.useState(!1),p=We(S=>S.breakpoints.down("xl")),v=We(S=>S.breakpoints.down("md")),{componentDid:C=""}=ct(),[m,k]=x.useState(null),w=`publish-${f.meta.did}`,T=Zo(w),[P,I]=x.useState({searchText:T.searchText||"",pageSize:T.rowsPerPage||10,page:1}),L=()=>{d.getProjects({input:{did:f.meta.did,componentDid:C,tenantScope:n}}).then(S=>{const A=(S==null?void 0:S.projects)||[];a(!1),k(A)}).catch(S=>{a(!1),W.error(S.message)})},z=()=>{o(`${Y.UNOWNED_DID}/create/none`,{replace:!0})},q=S=>{j(S)},Z=()=>{a(!1),h(!0)},U=()=>{h(!1),j(null)},R=S=>{W.error(S.message),h(!1),j(null)},g=S=>{if(!(S!=null&&S.deleted)){W.error("Delete project failed");return}L(),h(!1),j(null)};x.useEffect(()=>{L()},[]);const D=x.useMemo(()=>{var A;if(!P.searchText)return m;let S=(A=P.searchText)==null?void 0:A.trim();return S?(S=cs.toAddress(S).toLocaleLowerCase(),m.filter(H=>H.blockletTitle.toLowerCase().includes(S)||H.blockletDid.toLowerCase().includes(S))):m},[m,P.searchText]);if(!m&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!m)return null;if(!m.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:l("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:l("blocklet.publish.createBlockletTip")}),e.jsx(qe,{onClick:z,variant:"contained",children:l("blocklet.publish.createBlocklet")})]});const M=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:S=>{const A=m[S];return e.jsx(ke,{to:`${A.id}`,children:e.jsx(Mt,{did:f.meta.did,projectId:A.id,logo:A.blockletLogo,title:A.blockletTitle,describe:A.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:S=>S?e.jsx(Ko,{type:"success",children:S}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:S=>S?e.jsx(wt,{size:14,compact:!0,responsive:!1,did:S}):null}},p||C?null:{label:l("common.createdBy"),name:"createdBy",options:{customBodyRender:S=>S?e.jsx(wt,{onClick:()=>{o(`/.well-known/service/admin/members?did=${S}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:S}):null}},p||C?null:{label:l("common.scope"),name:"componentDid",options:{customBodyRender:S=>{const A=(f.children||[]).find(H=>H.meta.did===S);return A?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Et,{size:14,blocklet:A,ancestors:[f]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:A.meta.title})]},S):""}}},p||n?null:{label:l("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:S=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Ce,{children:S})})}},{label:l("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:S=>e.jsx(en,{value:Number(S),locale:i})}},{label:l("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:S=>{const A=m[S];return e.jsxs(c,{display:"flex",children:[e.jsx(ke,{to:`${A.id}/new-release/${A.lastReleaseId}`,children:e.jsx(je,{title:l("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(hn,{style:{fontSize:18}})})})}),!!A.lastReleaseId&&e.jsx(je,{title:l("blocklet.publish.viewLastRelease",{name:A.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(ke,{style:{display:"flex"},to:`${A.id}/view/${A.lastReleaseId}`,children:e.jsx(fn,{sx:{fontSize:18}})})})}),e.jsx(je,{title:l("blocklet.publish.delete",{name:A.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>q(A),children:e.jsx(tn,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),O=({page:S,rowsPerPage:A,searchText:H})=>{P.pageSize!==A?I(J=>({...J,searchText:"",pageSize:A,page:1})):P.page!==S+1?I(J=>({...J,searchText:"",page:S+1})):P.searchText!==H&&I(J=>({...J,searchText:H,page:1}))},G=y?e.jsx(as,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:r.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:g,onError:R,extraParams:{projectId:b.id,did:f.meta.did,name:b.blockletTitle},messages:{title:l("blocklet.publish.deleteProject.title",{name:b.blockletTitle}),scan:l("blocklet.publish.deleteProject.scan",{name:b.blockletTitle}),confirm:l("blocklet.publish.deleteProject.confirm"),success:l("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(c,{children:[e.jsx(Lt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:l("common.blockletStudio")}),e.jsx(je,{title:l("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(mn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(ds,{options:{searchPlaceholder:l("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:v},search:P.searchText,searchText:P.searchText,searchTextUpdate:S=>I(A=>({...A,searchText:S})),searchClose:()=>I(S=>({...S,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(qe,{onClick:z,variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),l("blocklet.publish.createBlocklet")]})]})}),e.jsx(qt,{className:"main-table",locale:i,data:D,columns:M,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:w,onChange:O}),b&&e.jsx(ht,{title:`${l("common.delete")} ${b.blockletTitle}`,description:l("blocklet.publish.deleteProject.description"),confirm:l("common.confirm"),onConfirm:Z,onCancel:()=>j(null),children:e.jsx(c,{sx:{marginTop:2},children:[l("blocklet.publish.deleteProject.tip1"),l("blocklet.publish.deleteProject.tip2"),l("blocklet.publish.deleteProject.tip3")].map(S=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(gs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(E,{component:"span",variant:"inherit",color:"text.secondary",children:S})]}))})}),G]})}Ut.propTypes={initUrl:s.object};Ut.defaultProps={initUrl:null};var Vt={},Xs=we;Object.defineProperty(Vt,"__esModule",{value:!0});var bn=Vt.default=void 0,Ys=Xs(De()),Do=e;bn=Vt.default=(0,Ys.default)([(0,Do.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,Do.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const Qs=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},xn=Qs;function Zs(){var R;const{t,locale:o}=Q(),{projectId:n}=ct(),{api:l}=ge(),[i,d]=x.useState(!0),{blocklet:r}=Se(),u=We(g=>g.breakpoints.down("md")),[a,f]=x.useState(null),[b,j]=x.useState(null),[y,h]=x.useState(null),p=(R=window.env)==null?void 0:R.serverEndpoint,v=`releases-${r.meta.did}-${n}`,C=Zo(v),[m,k]=x.useState({searchText:C.searchText||"",pageSize:C.rowsPerPage||10,page:1}),w=()=>{l.getReleases({input:{did:r.meta.did,projectId:n}}).then(g=>{const D=(g==null?void 0:g.releases)||[];d(!1),f(D)}).catch(g=>{d(!1),W.error(g.message)})},T=()=>{l.doBatchQuery({getProject:{input:{did:r.meta.did,projectId:n}},getReleases:{input:{did:r.meta.did,projectId:n}}}).then(g=>{j(g.getProject.project||{}),f(g.getReleases.releases||[]),d(!1)}).catch(g=>{d(!1),W.error(g.message)})};x.useEffect(()=>{T()},[]);const[P,I]=x.useState(""),L=()=>{d(!1);const g=y.id;l.deleteRelease({input:{did:r.meta.did,projectId:n,releaseId:g}}).then(()=>{d(!1),w(),W.success(t("common.removeSuccess")),h(null)}).catch(D=>{d(!1),W.error(D.message)})},z=g=>{h(g)};if(!a&&i)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!a)return null;const q=e.jsxs(Oo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(ke,{to:"..",children:t("common.blockletStudio")}),e.jsx(E,{color:"text.primary",children:e.jsx(Ce,{maxLength:u?6:30,children:b.blockletTitle})})]});if(!a.length)return e.jsxs(e.Fragment,{children:[q,e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),e.jsx(ke,{to:"create/none",children:e.jsx(qe,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const Z=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:g=>{const D=a[g];return e.jsx(ke,{to:`view/${D.id}`,children:e.jsx(Mt,{did:r.meta.did,projectId:b.id,logo:D.blockletLogo,title:D.blockletVersion,describe:D.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:g=>{const D=a[g];return e.jsx(E,{className:"note",children:xn(D.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:g=>e.jsx(Ko,{type:g==="published"?"success":"warning",children:g==="published"?"Released":js(g)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:g=>{const D=a[g];return D.status!==he.PROJECT.RELEASE_STATUS.published?"":e.jsx(en,{value:Number(D.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:g=>{var A;const D=a[g];let M="",O="";const G=D.status==="published";if(G){const H=de(p,`/api/project/${r.meta.did}/${b.id}/${b.lastReleaseId}/release/blocklet.json`),J=new URL(p);J.pathname=de(J.pathname,"/launch-blocklet/agreement"),J.searchParams.set("blocklet_meta_url",H),M=J.href,O=de(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${b.id}/${b.lastReleaseId}/download/${(b.lastReleaseFiles||[])[0]}`)}const S=(A=b.blockletComponents)!=null&&A.some(H=>H.included)||D.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[G&&S==="pack"&&e.jsx(je,{title:t("blocklet.publish.install",{name:b.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:M,target:"_blank",rel:"noreferrer",children:e.jsx(bn,{sx:{fontSize:18}})})})}),G&&e.jsx(je,{title:t("blocklet.publish.download",{name:b.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:O,children:e.jsx(ks,{sx:{fontSize:18}})})})}),e.jsx(je,{title:t("blocklet.publish.delete",{name:b.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>z(D),children:e.jsx(tn,{sx:{fontSize:18}})})})]})}}}],U=({page:g,rowsPerPage:D,searchText:M})=>{m.pageSize!==D?k(O=>({...O,searchText:"",pageSize:D,page:1})):m.page!==g+1?k(O=>({...O,searchText:"",page:g+1})):m.searchText!==M&&k(O=>({...O,searchText:M,page:1}))};return e.jsxs(Ks,{children:[e.jsx(Lt,{sx:{mb:2},left:q,actions:e.jsxs(e.Fragment,{children:[e.jsx(qe,{variant:"outlined",onClick:()=>{const g=de(p,`/api/project/${r.meta.did}/${n}/blocklet.json`);I(g)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(ke,{to:"new-release/none",children:e.jsxs(qe,{variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(at,{fullWidth:!0,maxWidth:"sm",open:P,onClose:()=>I(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(E,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(rn,{children:P}),e.jsxs(E,{sx:{mt:2},children:[t("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:t("blocklet.publish.installResourceHelp")})]})]})}),e.jsx(qt,{className:"main-table",verticalKeyWidth:100,locale:o,data:a,columns:Z,durable:v,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1},onChange:U}),y&&e.jsx(ht,{title:t(`${t("common.delete")} ${y.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:L,onCancel:()=>h(null)})]})}const Ks=ye(c)`
|
|
3
3
|
.main-table > div:first-child {
|
|
4
4
|
display: none;
|
|
5
5
|
}
|
|
@@ -125,7 +125,7 @@ import{r as x,f as Tt,l as ct,L as ke,g as Wn,u as Mn,i as Un,j as jt}from"./ven
|
|
|
125
125
|
background: #fff;
|
|
126
126
|
z-index: 10;
|
|
127
127
|
}
|
|
128
|
-
`;var Zt={},Cr=we;Object.defineProperty(Zt,"__esModule",{value:!0});var St=Zt.default=void 0,wr=Cr(De()),Sr=e;St=Zt.default=(0,wr.default)((0,Sr.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 _o="lastWantToConnectStoreId";function Dr(t){var u,a;const[o,n]=x.useState(null),{session:l}=Ue(),i=x.useCallback(f=>{n(f),localStorage.setItem(_o,f==null?void 0:f.id)},[n]),d=x.useMemo(()=>{var y,h,p,v;const f=localStorage.getItem(_o),b=f?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(C=>C.id===f):null;if(b)return b;let j=(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(C=>{var m;return!(C.id!==Y.BLOCKLET_STORE.id||C.scope&&C.scope!=="studio"&&C.scope!==((m=l==null?void 0:l.user)==null?void 0:m.did))});return j||(j=(v=(p=t==null?void 0:t.settings)==null?void 0:p.storeList)==null?void 0:v[0]),j},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=l==null?void 0:l.user)==null?void 0:a.did]);return[o||d||{},i]}const Rt={};async function Kt(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:l=4e3,timerKey:i=""}){Rt[i]&&clearTimeout(Rt[i]),await new Promise(u=>setTimeout(u,l));const d=Date.now(),r=async(u,a)=>{try{const f=await t();u(f)}catch(f){Date.now()-d>n?a(f):i?Rt[i]=setTimeout(()=>r(u,a),o):setTimeout(()=>r(u,a),o)}};return new Promise(r)}function Ir(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Tr(t,{did:o,projectId:n,messageId:l}){return Kt(async()=>{var d;const i=await t.getProject({input:{did:o,projectId:n,messageId:l}});if(!((d=i==null?void 0:i.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return i.project.blockletDid},{timerKey:"connect-studio"})}function Pr(t,{did:o,projectId:n,storeId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(a=>a.storeId===l))throw new Error("Connected store not found")},{timerKey:`connect-store-${l}`})}function _r(t,{did:o,projectId:n,endpointId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(a=>a.endpointId===l))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${l}`})}const $r=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:l})=>{var r,u;const i=t?(r=n==null?void 0:n.meta)==null?void 0:r.did:o==null?void 0:o.did;let d=t?((u=n==null?void 0:n.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===l),{teamDid:i,storeList:d}},eo=$r;function to({blocklet:t,store:o={},onChangeStore:n,onClick:l,disabled:i,loading:d,componentDid:r}){var R,g,D;const{t:u}=Q(),{session:a}=Ue(),{api:f,info:b,inService:j}=ge(),y=Se(),[h,p]=x.useState(!1),v=x.useRef(null),[C,m]=x.useState(!1),[k,w]=x.useState(null),T=M=>{n(M),p(!1)},P=()=>{p(!h)},I=M=>{v.current&&v.current.contains(M.target)||p(!1)},L=()=>{m(!0)},z=()=>{m(!1)},q=async()=>{var M;if(k)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:k.url,projectId:"",scope:k.scope||"studio"}}),await((M=y==null?void 0:y.actions)==null?void 0:M.refreshBlocklet())}catch(O){W.error(`Remove Blocklet Store Error: ${xe(O)}`)}finally{w(null)}},{storeList:Z}=eo({fromBlocklet:j,blocklet:t,nodeInfo:b,componentDid:r,userDid:(R=a==null?void 0:a.user)==null?void 0:R.did}),U=(g=t==null?void 0:t.meta)==null?void 0:g.did;return e.jsxs(e.Fragment,{children:[e.jsxs(tt,{disabled:i,ref:v,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(K,{onClick:l,children:[d&&e.jsx(Re,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(K,{size:"small","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:P,children:e.jsx(Ns,{})})]}),e.jsx(Bo,{sx:{zIndex:10},open:h,anchorEl:v.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:M})=>e.jsx(Wo,{...M,style:{transformOrigin:"center top"},children:e.jsx(_t,{children:e.jsx(Mo,{onClickAway:I,children:e.jsxs(Uo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[Z==null?void 0:Z.map(O=>{var G;return e.jsxs(fe,{selected:O.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>T(O),children:[e.jsxs(c,{children:[e.jsx(Ce,{sx:{fontSize:"16px"},maxLength:24,children:O.name}),e.jsx(Ce,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:O.url})]}),Ss({store:O,userDid:(G=a==null?void 0:a.user)==null?void 0:G.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),w(O)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},O.url)}),e.jsx(Fn,{}),e.jsxs(fe,{onClick:L,children:[e.jsx(pt,{font:!0}),e.jsx(E,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),C&&e.jsx(ln,{hiddenChildren:!0,open:!0,onClose:z,teamDid:U,storeList:Z,scope:"studio",onAdd:(D=y==null?void 0:y.actions)==null?void 0:D.refreshBlocklet}),k&&e.jsx(ht,{displayError:!0,title:`${u("common.delete")} ${k.name}`,description:u("blocklet.publish.deleteStoreTip",{name:k.name}),confirm:u("common.confirm"),onConfirm:q,onCancel:()=>w(null)})]})}to.propTypes={store:s.object,blocklet:s.object,onChangeStore:s.func.isRequired,onClick:s.func.isRequired,loading:s.bool.isRequired,disabled:s.bool.isRequired,componentDid:s.string.isRequired,projectType:s.string.isRequired,getData:s.func.isRequired};to.defaultProps={store:null,blocklet:null};const qr=(t,o,n)=>{const l=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${l}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,r=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:d,screenshotUrls:r,uploadLogoPrefix:l,uploadScreenshotPrefix:i}},vn=qr,Er=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");return o||n};function ft({url:t,style:o,controls:n,modestbranding:l}){var u;const{t:i}=Q(),d=t.includes("youtube.com")||t.includes("youtu.be"),r=t.includes("vimeo.com");if(d){const a=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${a}?modestbranding=${l}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(r){const a=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${a}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(E,{variant:"body1",sx:{opacity:.5},children:i("studio.videoDialogNoSrc")})]})})}ft.propTypes={url:s.string.isRequired,style:s.object,controls:s.number,modestbranding:s.number};ft.defaultProps={style:{},controls:1,modestbranding:1};function Rn({setParams:t,onClose:o,params:n}){const{t:l}=Q(),[i,d]=x.useState(""),r=i&&n.blockletVideos.includes(i),u=Er(i),a=()=>{t(f=>{const b=[...f.blockletVideos];return b.push(i),{...f,blockletVideos:b}}),o()};return e.jsxs(at,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Vo,{children:l("studio.videoDialogTitle")}),e.jsxs(Fo,{children:[e.jsx(Hn,{fullWidth:!0,value:i,onChange:f=>d(f.target.value),placeholder:l("studio.videoInputLabel"),endAdornment:i?e.jsx(Je,{position:"end",children:e.jsx(ce,{onClick:()=>d(""),children:e.jsx(hs,{})})}):null,error:r}),r&&e.jsx(E,{variant:"body2",color:"error",children:l("studio.duplicateVideo")}),e.jsx(ft,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Ho,{children:[e.jsx(K,{onClick:()=>o(),children:l("studio.cancel")}),e.jsx(K,{disabled:!u||r,onClick:a,children:l("studio.confirm")})]})]})}Rn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Dt({errors:t,storeList:o,...n}){const{t:l}=Q();return e.jsxs(c,{...n,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(E,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:l("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([i,d])=>{const r=Object.values(d),u=o.find(a=>a.url===i);return r.length>0&&e.jsxs(c,{children:[e.jsx(je,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),r.map(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},i)})]})}Dt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const $o=x.lazy(()=>nn(()=>import("./index-DS-sLY6b.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function Cn({projectId:t,readOnly:o,loading:n,blocklet:l,params:i,setParams:d,paramsErrTip:r,setParamsErrTip:u,warning:a,setLoading:f,initUrl:b,initLogoUrl:j,setInitLogoUrl:y,componentDid:h}){const{t:p,locale:v}=Q(),{api:C}=ge(),m=Tt(),k=x.useRef(null),w=x.useRef(null),[T,P]=Dr(l),[I,L]=x.useState(!1),z=cn({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),q=async $=>{const V=setTimeout(()=>{f(!1)},2e4),X=await Tr(C,$);f(!1),clearTimeout(V),window.parent.postMessage({event:"studioDialog.connected",componentDid:h},"*"),m(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},Z=()=>{if(!i.blockletTitle){W.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(T!=null&&T.url)){W.error(p("blocklet.publish.noStoreSelected"));return}const $=Ir();z(async(V,X)=>{var te,oe,ie;try{const ee=await C.connectByStudio({input:{did:(te=l==null?void 0:l.meta)==null?void 0:te.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:T.url,storeId:T.id,storeName:T.name,type:((oe=i==null?void 0:i.blockletComponents)==null?void 0:oe.length)>0?"pack":"resource",componentDid:h,messageId:$,tenantScope:(b==null?void 0:b.searchParams.get("tenantScope"))||""}});if(!(ee!=null&&ee.url)){W.error("failed to connect to store");return}X(ee.url),q({did:(ie=l==null?void 0:l.meta)==null?void 0:ie.did,projectId:"",messageId:$})}catch(ee){const ue=xe(ee);W.error(ue),f(!1)}})},{logoUrl:U,screenshotUrls:R,uploadLogoPrefix:g,uploadScreenshotPrefix:D}=vn(i,l,t),{logoErrors:M,screenshotErrors:O,storeList:G,hasLogoWarning:S,hasScreenshotWarning:A}=a,H=()=>o?!1:!t||t===Y.UNOWNED_DID?(W.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,J=$=>{if(!$.destination)return;const V=Array.from(i.blockletScreenshots),[X]=V.splice($.source.index,1);V.splice($.destination.index,0,X),d(te=>({...te,blockletScreenshots:V}))},Ie=$=>{if(!$.destination)return;const V=Array.from(i.blockletVideos),[X]=V.splice($.source.index,1);V.splice($.destination.index,0,X),d(te=>({...te,blockletVideos:V}))};return e.jsxs(Lr,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:i.blockletTitle||"",onChange:$=>{u({blockletTitle:""}),d({blockletTitle:$.target.value})},error:!!r.blockletTitle,helperText:r.blockletTitle||""}),e.jsx(ne,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===Y.UNOWNED_DID&&e.jsx(Je,{position:"end",children:e.jsx(to,{blocklet:l,store:T,componentDid:h,onChangeStore:P,disabled:!i.blockletTitle||o||n,loading:n,onClick:Z})})},error:!!r.projectId,helperText:r.projectId||"",value:t===Y.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletDescription||"",onChange:$=>{u({blockletDescription:""}),d({blockletDescription:$.target.value})},error:!!r.blockletDescription,helperText:r.blockletDescription||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletHomepage||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:$.target.value})},error:!!r.blockletHomepage,helperText:r.blockletHomepage||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletCommunity||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:$.target.value})},error:!!r.blockletCommunity,helperText:r.blockletCommunity||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletSupport||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test($.target.value)?u({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:$.target.value})},error:!!r.blockletSupport,helperText:r.blockletSupport||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletRepository||"",onChange:$=>{$.target.value&&!/^(git|https|svn)/.test($.target.value)?u({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:$.target.value})},error:!!r.blockletRepository,helperText:r.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),e.jsxs(ve,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Pt,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:j||U,onClick:()=>{var $;H()&&(($=k.current)==null||$.open())}})})]}),S&&e.jsx(Dt,{errors:M,storeList:G,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),e.jsxs(ve,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:J,children:e.jsx(Co,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:($,V)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[R.map((X,te)=>e.jsx(wo,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ie)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:X}),!o&&e.jsx(ce,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(ee=>{const ue=[...ee.blockletScreenshots];return ue.splice(te,1),{...ee,blockletScreenshots:ue}})},children:e.jsx(nt,{})})]})},X)),$.placeholder,R.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var X;H()&&((X=w.current)==null||X.open())},children:"+"})]})})})]}),A&&e.jsx(Dt,{errors:O,storeList:G}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),e.jsxs(ve,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"#007ec6"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:Ie,children:e.jsx(Co,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:($,V)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[i.blockletVideos.map((X,te)=>e.jsx(wo,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ie)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(ft,{url:X,style:{pointerEvents:ie.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(ee=>{const ue=[...ee.blockletVideos];return ue.splice(te,1),{...ee,blockletVideos:ue}})},children:e.jsx(nt,{})})]})},X)),$.placeholder,i.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{H()&&L(!0)},children:"+"})]})})})]})]})}),e.jsxs(x.Suspense,{fallback:e.jsx(Xe,{}),children:[e.jsx($o,{ref:k,locale:v,popup:!0,onUploadFinish:$=>{var V;d({blockletLogo:$.data.filename}),y(""),(V=k.current)==null||V.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:g,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),I&&e.jsx(Rn,{onClose:()=>L(!1),params:i,setParams:d}),e.jsx($o,{ref:w,locale:v,popup:!0,onUploadFinish:$=>{var V;d(X=>{var oe;const te=X.blockletScreenshots||[];return te.push((oe=$.data)==null?void 0:oe.filename),{...X,blockletScreenshots:te}}),(V=w.current)==null||V.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:D,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-R.length}},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}Cn.propTypes={projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,setLoading:s.func.isRequired,initUrl:s.object.isRequired,componentDid:s.isRequired,initLogoUrl:s.string.isRequired,setInitLogoUrl:s.func.isRequired};const Lr=ye.div`
|
|
128
|
+
`;var Zt={},Cr=we;Object.defineProperty(Zt,"__esModule",{value:!0});var St=Zt.default=void 0,wr=Cr(De()),Sr=e;St=Zt.default=(0,wr.default)((0,Sr.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 _o="lastWantToConnectStoreId";function Dr(t){var u,a;const[o,n]=x.useState(null),{session:l}=Ue(),i=x.useCallback(f=>{n(f),localStorage.setItem(_o,f==null?void 0:f.id)},[n]),d=x.useMemo(()=>{var y,h,p,v;const f=localStorage.getItem(_o),b=f?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(C=>C.id===f):null;if(b)return b;let j=(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(C=>{var m;return!(C.id!==Y.BLOCKLET_STORE.id||C.scope&&C.scope!=="studio"&&C.scope!==((m=l==null?void 0:l.user)==null?void 0:m.did))});return j||(j=(v=(p=t==null?void 0:t.settings)==null?void 0:p.storeList)==null?void 0:v[0]),j},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=l==null?void 0:l.user)==null?void 0:a.did]);return[o||d||{},i]}const Rt={};async function Kt(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:l=4e3,timerKey:i=""}){Rt[i]&&clearTimeout(Rt[i]),await new Promise(u=>setTimeout(u,l));const d=Date.now(),r=async(u,a)=>{try{const f=await t();u(f)}catch(f){Date.now()-d>n?a(f):i?Rt[i]=setTimeout(()=>r(u,a),o):setTimeout(()=>r(u,a),o)}};return new Promise(r)}function Ir(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Tr(t,{did:o,projectId:n,messageId:l}){return Kt(async()=>{var d;const i=await t.getProject({input:{did:o,projectId:n,messageId:l}});if(!((d=i==null?void 0:i.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return i.project.blockletDid},{timerKey:"connect-studio"})}function Pr(t,{did:o,projectId:n,storeId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(a=>a.storeId===l))throw new Error("Connected store not found")},{timerKey:`connect-store-${l}`})}function _r(t,{did:o,projectId:n,endpointId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(a=>a.endpointId===l))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${l}`})}const $r=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:l})=>{var r,u;const i=t?(r=n==null?void 0:n.meta)==null?void 0:r.did:o==null?void 0:o.did;let d=t?((u=n==null?void 0:n.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===l),{teamDid:i,storeList:d}},eo=$r;function to({blocklet:t,store:o={},onChangeStore:n,onClick:l,disabled:i,loading:d,componentDid:r}){var R,g,D;const{t:u}=Q(),{session:a}=Ue(),{api:f,info:b,inService:j}=ge(),y=Se(),[h,p]=x.useState(!1),v=x.useRef(null),[C,m]=x.useState(!1),[k,w]=x.useState(null),T=M=>{n(M),p(!1)},P=()=>{p(!h)},I=M=>{v.current&&v.current.contains(M.target)||p(!1)},L=()=>{m(!0)},z=()=>{m(!1)},q=async()=>{var M;if(k)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:k.url,projectId:"",scope:k.scope||"studio"}}),await((M=y==null?void 0:y.actions)==null?void 0:M.refreshBlocklet())}catch(O){W.error(`Remove Blocklet Store Error: ${xe(O)}`)}finally{w(null)}},{storeList:Z}=eo({fromBlocklet:j,blocklet:t,nodeInfo:b,componentDid:r,userDid:(R=a==null?void 0:a.user)==null?void 0:R.did}),U=(g=t==null?void 0:t.meta)==null?void 0:g.did;return e.jsxs(e.Fragment,{children:[e.jsxs(tt,{disabled:i,ref:v,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(K,{onClick:l,children:[d&&e.jsx(Re,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(K,{size:"small","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:P,children:e.jsx(Ns,{})})]}),e.jsx(Bo,{sx:{zIndex:10},open:h,anchorEl:v.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:M})=>e.jsx(Wo,{...M,style:{transformOrigin:"center top"},children:e.jsx(_t,{children:e.jsx(Mo,{onClickAway:I,children:e.jsxs(Uo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[Z==null?void 0:Z.map(O=>{var G;return e.jsxs(fe,{selected:O.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>T(O),children:[e.jsxs(c,{children:[e.jsx(Ce,{sx:{fontSize:"16px"},maxLength:24,children:O.name}),e.jsx(Ce,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:O.url})]}),Ss({store:O,userDid:(G=a==null?void 0:a.user)==null?void 0:G.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),w(O)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},O.url)}),e.jsx(Fn,{}),e.jsxs(fe,{onClick:L,children:[e.jsx(pt,{font:!0}),e.jsx(E,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),C&&e.jsx(ln,{hiddenChildren:!0,open:!0,onClose:z,teamDid:U,storeList:Z,scope:"studio",onAdd:(D=y==null?void 0:y.actions)==null?void 0:D.refreshBlocklet}),k&&e.jsx(ht,{displayError:!0,title:`${u("common.delete")} ${k.name}`,description:u("blocklet.publish.deleteStoreTip",{name:k.name}),confirm:u("common.confirm"),onConfirm:q,onCancel:()=>w(null)})]})}to.propTypes={store:s.object,blocklet:s.object,onChangeStore:s.func.isRequired,onClick:s.func.isRequired,loading:s.bool.isRequired,disabled:s.bool.isRequired,componentDid:s.string.isRequired,projectType:s.string.isRequired,getData:s.func.isRequired};to.defaultProps={store:null,blocklet:null};const qr=(t,o,n)=>{const l=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${l}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,r=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:d,screenshotUrls:r,uploadLogoPrefix:l,uploadScreenshotPrefix:i}},vn=qr,Er=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");return o||n};function ft({url:t,style:o,controls:n,modestbranding:l}){var u;const{t:i}=Q(),d=t.includes("youtube.com")||t.includes("youtu.be"),r=t.includes("vimeo.com");if(d){const a=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${a}?modestbranding=${l}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(r){const a=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${a}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(E,{variant:"body1",sx:{opacity:.5},children:i("studio.videoDialogNoSrc")})]})})}ft.propTypes={url:s.string.isRequired,style:s.object,controls:s.number,modestbranding:s.number};ft.defaultProps={style:{},controls:1,modestbranding:1};function Rn({setParams:t,onClose:o,params:n}){const{t:l}=Q(),[i,d]=x.useState(""),r=i&&n.blockletVideos.includes(i),u=Er(i),a=()=>{t(f=>{const b=[...f.blockletVideos];return b.push(i),{...f,blockletVideos:b}}),o()};return e.jsxs(at,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Vo,{children:l("studio.videoDialogTitle")}),e.jsxs(Fo,{children:[e.jsx(Hn,{fullWidth:!0,value:i,onChange:f=>d(f.target.value),placeholder:l("studio.videoInputLabel"),endAdornment:i?e.jsx(Je,{position:"end",children:e.jsx(ce,{onClick:()=>d(""),children:e.jsx(hs,{})})}):null,error:r}),r&&e.jsx(E,{variant:"body2",color:"error",children:l("studio.duplicateVideo")}),e.jsx(ft,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Ho,{children:[e.jsx(K,{onClick:()=>o(),children:l("studio.cancel")}),e.jsx(K,{disabled:!u||r,onClick:a,children:l("studio.confirm")})]})]})}Rn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Dt({errors:t,storeList:o,...n}){const{t:l}=Q();return e.jsxs(c,{...n,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(E,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:l("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([i,d])=>{const r=Object.values(d),u=o.find(a=>a.url===i);return r.length>0&&e.jsxs(c,{children:[e.jsx(je,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),r.map(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},i)})]})}Dt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const $o=x.lazy(()=>nn(()=>import("./index-DyxFC42L.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function Cn({projectId:t,readOnly:o,loading:n,blocklet:l,params:i,setParams:d,paramsErrTip:r,setParamsErrTip:u,warning:a,setLoading:f,initUrl:b,initLogoUrl:j,setInitLogoUrl:y,componentDid:h}){const{t:p,locale:v}=Q(),{api:C}=ge(),m=Tt(),k=x.useRef(null),w=x.useRef(null),[T,P]=Dr(l),[I,L]=x.useState(!1),z=cn({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),q=async $=>{const V=setTimeout(()=>{f(!1)},2e4),X=await Tr(C,$);f(!1),clearTimeout(V),window.parent.postMessage({event:"studioDialog.connected",componentDid:h},"*"),m(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},Z=()=>{if(!i.blockletTitle){W.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(T!=null&&T.url)){W.error(p("blocklet.publish.noStoreSelected"));return}const $=Ir();z(async(V,X)=>{var te,oe,ie;try{const ee=await C.connectByStudio({input:{did:(te=l==null?void 0:l.meta)==null?void 0:te.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:T.url,storeId:T.id,storeName:T.name,type:((oe=i==null?void 0:i.blockletComponents)==null?void 0:oe.length)>0?"pack":"resource",componentDid:h,messageId:$,tenantScope:(b==null?void 0:b.searchParams.get("tenantScope"))||""}});if(!(ee!=null&&ee.url)){W.error("failed to connect to store");return}X(ee.url),q({did:(ie=l==null?void 0:l.meta)==null?void 0:ie.did,projectId:"",messageId:$})}catch(ee){const ue=xe(ee);W.error(ue),f(!1)}})},{logoUrl:U,screenshotUrls:R,uploadLogoPrefix:g,uploadScreenshotPrefix:D}=vn(i,l,t),{logoErrors:M,screenshotErrors:O,storeList:G,hasLogoWarning:S,hasScreenshotWarning:A}=a,H=()=>o?!1:!t||t===Y.UNOWNED_DID?(W.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,J=$=>{if(!$.destination)return;const V=Array.from(i.blockletScreenshots),[X]=V.splice($.source.index,1);V.splice($.destination.index,0,X),d(te=>({...te,blockletScreenshots:V}))},Ie=$=>{if(!$.destination)return;const V=Array.from(i.blockletVideos),[X]=V.splice($.source.index,1);V.splice($.destination.index,0,X),d(te=>({...te,blockletVideos:V}))};return e.jsxs(Lr,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:i.blockletTitle||"",onChange:$=>{u({blockletTitle:""}),d({blockletTitle:$.target.value})},error:!!r.blockletTitle,helperText:r.blockletTitle||""}),e.jsx(ne,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===Y.UNOWNED_DID&&e.jsx(Je,{position:"end",children:e.jsx(to,{blocklet:l,store:T,componentDid:h,onChangeStore:P,disabled:!i.blockletTitle||o||n,loading:n,onClick:Z})})},error:!!r.projectId,helperText:r.projectId||"",value:t===Y.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletDescription||"",onChange:$=>{u({blockletDescription:""}),d({blockletDescription:$.target.value})},error:!!r.blockletDescription,helperText:r.blockletDescription||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletHomepage||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:$.target.value})},error:!!r.blockletHomepage,helperText:r.blockletHomepage||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletCommunity||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)?u({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:$.target.value})},error:!!r.blockletCommunity,helperText:r.blockletCommunity||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletSupport||"",onChange:$=>{$.target.value&&!/^(http|https):\/\//.test($.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test($.target.value)?u({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:$.target.value})},error:!!r.blockletSupport,helperText:r.blockletSupport||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletRepository||"",onChange:$=>{$.target.value&&!/^(git|https|svn)/.test($.target.value)?u({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:$.target.value})},error:!!r.blockletRepository,helperText:r.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),e.jsxs(ve,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Pt,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:j||U,onClick:()=>{var $;H()&&(($=k.current)==null||$.open())}})})]}),S&&e.jsx(Dt,{errors:M,storeList:G,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),e.jsxs(ve,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:J,children:e.jsx(Co,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:($,V)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[R.map((X,te)=>e.jsx(wo,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ie)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:X}),!o&&e.jsx(ce,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(ee=>{const ue=[...ee.blockletScreenshots];return ue.splice(te,1),{...ee,blockletScreenshots:ue}})},children:e.jsx(nt,{})})]})},X)),$.placeholder,R.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var X;H()&&((X=w.current)==null||X.open())},children:"+"})]})})})]}),A&&e.jsx(Dt,{errors:O,storeList:G}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),e.jsxs(ve,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"#007ec6"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:Ie,children:e.jsx(Co,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:($,V)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[i.blockletVideos.map((X,te)=>e.jsx(wo,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ie)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(ft,{url:X,style:{pointerEvents:ie.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(ee=>{const ue=[...ee.blockletVideos];return ue.splice(te,1),{...ee,blockletVideos:ue}})},children:e.jsx(nt,{})})]})},X)),$.placeholder,i.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{H()&&L(!0)},children:"+"})]})})})]})]})}),e.jsxs(x.Suspense,{fallback:e.jsx(Xe,{}),children:[e.jsx($o,{ref:k,locale:v,popup:!0,onUploadFinish:$=>{var V;d({blockletLogo:$.data.filename}),y(""),(V=k.current)==null||V.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:g,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),I&&e.jsx(Rn,{onClose:()=>L(!1),params:i,setParams:d}),e.jsx($o,{ref:w,locale:v,popup:!0,onUploadFinish:$=>{var V;d(X=>{var oe;const te=X.blockletScreenshots||[];return te.push((oe=$.data)==null?void 0:oe.filename),{...X,blockletScreenshots:te}}),(V=w.current)==null||V.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:D,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-R.length}},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}Cn.propTypes={projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,setLoading:s.func.isRequired,initUrl:s.object.isRequired,componentDid:s.isRequired,initLogoUrl:s.string.isRequired,setInitLogoUrl:s.func.isRequired};const Lr=ye.div`
|
|
129
129
|
margin-top: 24px;
|
|
130
130
|
.screenshot {
|
|
131
131
|
margin-bottom: 16px;
|
|
@@ -173,7 +173,7 @@ import{r as x,f as Tt,l as ct,L as ke,g as Wn,u as Mn,i as Un,j as jt}from"./ven
|
|
|
173
173
|
padding-bottom: 12px;
|
|
174
174
|
border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
|
|
175
175
|
}
|
|
176
|
-
`;function Pn({text:t}){return t?e.jsx(zs,{wrapperElement:{"data-color-mode":"light"},source:xs.sanitize(t),rehypePlugins:[[Os,{target:"_blank"}]]}):e.jsx(Me,{Icon:zt})}Pn.propTypes={text:s.string.isRequired};function _n({params:t,setParams:o,paramsErrTip:n,loading:l,setParamsErrTip:i,readOnly:d}){var b;const{t:r}=Q(),[u,a]=x.useState(d?"preview":"write"),f=(j,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(E,{variant:"h6",fontWeight:"bold",sx:{},children:r("common.introduction")}),e.jsxs(Qo,{value:u,onChange:f,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(ne,{disabled:l||d,sx:{border:"none"},placeholder:`Blocklet ${r("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Je,{position:"end",children:[((b=t==null?void 0:t.blockletIntroduction)==null?void 0:b.length)||0," / ",he.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:j=>{i({blockletIntroduction:""}),o({blockletIntroduction:j.target.value.slice(0,he.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(Pn,{text:t.blockletIntroduction||""})})]})}_n.propTypes={params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired};var uo={},Gr=we;Object.defineProperty(uo,"__esModule",{value:!0});var It=uo.default=void 0,Jr=Gr(De()),Lo=e;It=uo.default=(0,Jr.default)([(0,Lo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Lo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function po({step:t,ok:o,active:n,error:l,warning:i}){let d="grey.500",r=t+1;return o&&(r=e.jsx(un,{sx:{fontSize:18,margin:0},color:"white"})),l||!o&&n>t?(d="error.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):i?(d="warning.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):n>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:r})}po.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};po.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function $n({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:l,params:i,loading:d,paramsErrTip:r,warning:u,viewMode:a,projectId:f}){const{t:b}=Q(),j=()=>{n(v=>v+1)},y=()=>{n(v=>v-1)},h=v=>v===0?(r==null?void 0:r.blockletTitle)||(r==null?void 0:r.projectId)||(r==null?void 0:r.blockletDescription)||(r==null?void 0:r.blockletHomepage)||(r==null?void 0:r.blockletSupport)||(r==null?void 0:r.blockletCommunity)||(r==null?void 0:r.blockletRepository):v===2?(r==null?void 0:r.blockletResource)||(r==null?void 0:r.blockletDocker)||(r==null?void 0:r.dockerImageName):v>=4?(r==null?void 0:r.blockletVersion)||(r==null?void 0:r.note):"",p=a||Sn({hasSelectedResources:l,params:i,projectId:f,t:b})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[e.jsx(Zn,{activeStep:o,orientation:"vertical",children:t.map((v,C)=>{const m={},k=d||!Ur({hasSelectedResources:l,params:i,projectId:f,step:C,t:b}),w=d?"":h(C);return w&&(m.optional=e.jsx(E,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:w}),m.error=!0),e.jsxs(Kn,{children:[e.jsx(es,{icon:e.jsx(po,{error:w,warning:C===0?u.hasWarning:!1,active:p?99:o,step:C,ok:k}),sx:{cursor:"pointer",color:w?"error.main":"inherit"},disabled:!1,onClick:()=>n(C),...m,children:e.jsx(E,{fontSize:"14px",fontWeight:"500",color:w||!k&&o>C?"error.main":"inherit",children:v.label})}),e.jsxs(ts,{children:[e.jsx(E,{fontSize:12,children:v.description}),!p&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[C<t.length-1&&e.jsx(K,{variant:"contained",onClick:j,sx:{mt:1,mr:1},disabled:w||!k,children:b("common.continue")}),C>0&&e.jsx(K,{disabled:C===0,onClick:y,sx:{mt:1,mr:1},children:b("common.back")})]})})]})]},v.label)})}),o>=t.length-1&&e.jsx(_t,{square:!0,elevation:0,sx:{p:3},children:e.jsx(E,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}$n.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.string.isRequired,loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.bool.isRequired,warning:s.object.isRequired,paramsErrTip:s.shape({projectId:s.string,blockletVersion:s.string,blockletTitle:s.string,blockletDescription:s.string,note:s.string,blockletResource:s.string,blockletHomepage:s.string,blockletSupport:s.string,blockletCommunity:s.string,blockletRepository:s.string,blockletDocker:s.object,dockerImageName:s.string}).isRequired};const Xr=[".zip",".gz"],Yr=1024*1024*100,Qr=x.lazy(()=>nn(()=>import("./index-DS-sLY6b.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ho({app:t,projectId:o,readOnly:n,params:l,setParams:i,setParamsErrTip:d,error:r}){const{t:u,locale:a}=Q(),f=x.useRef(null),b=()=>n?!1:!o||o===Y.UNOWNED_DID?(W.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,j=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(E,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(ve,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!l.uploadedResource&&e.jsx(E,{component:"a",href:`${j}/params.uploadedResource`,children:l.uploadedResource}),!n&&e.jsx(K,{variant:"outlined",size:"small",onClick:()=>{var y;b()&&((y=f.current)==null||y.open())},children:l.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(x.Suspense,{fallback:e.jsx(Xe,{}),children:e.jsx(Qr,{ref:f,locale:a,popup:!0,onUploadFinish:y=>{var h;i({uploadedResource:y.data.filename}),d({blockletResource:""}),(h=f.current)==null||h.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:j,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Xr,maxFileSize:Yr,maxNumberOfFiles:1}}},"uploader-resource")}),!!r&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:r})]})}ho.propTypes={app:s.object.isRequired,projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired};ho.defaultProps={};function lt({readOnly:t,params:o,setParams:n,paramsErrTip:l,setParamsErrTip:i,loading:d}){var u;const{t:r}=Q();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:d||t,label:`Blocklet ${r("common.version")}`,placeholder:`Blocklet ${r("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:a=>{i({blockletVersion:""}),n({blockletVersion:a.target.value})},error:!!l.blockletVersion,helperText:l.blockletVersion||""}),e.jsx(ne,{label:r("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Je,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",he.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:a=>{i({note:""}),n({note:a.target.value.slice(0,he.PROJECT.MAX_NOTE_LENGTH)})},error:!!l.note,helperText:l.note||"",sx:{mt:3}})]})})}lt.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,loading:s.bool.isRequired};lt.defaultProps={};function qn(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&qn(t[o]);return t}function it({index:t,item:o,dockerParams:n,setDockerParams:l,dataKey:i,t:d,readOnly:r}){const u=(o==null?void 0:o.value)||"",[a,f]=x.useState(!1),b=()=>{var U;(U=n[i])==null||U.splice(t,1),l({...n,[i]:[...n[i]]})},j=(U,R)=>{var g;(g=n[i])!=null&&g[t]&&(R?(n[i][t].custom=n[i][t].value,n[i][t].value=`$${yt(o.key)}`):(n[i][t].value=n[i][t].custom||"",n[i][t].custom="")),l({...n,[i]:[...n[i]]})},y=(U,R)=>{var D;const g=((D=n[i][t])==null?void 0:D.value)||"";n[i][t]={...n[i][t],secure:R,value:R&&g===he.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},h=(U,R)=>{n[i][t]={...n[i][t],shared:R},l({...n,[i]:[...n[i]]})},p=(U,R)=>{var D;const g=((D=n[i][t])==null?void 0:D.value)||"";n[i][t]={...n[i][t],required:R,value:R&&g===he.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},v=(U,R)=>{n[i][t]={...n[i][t],value:R?he.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},l({...n,[i]:[...n[i]]})},C=U=>{n[i][t]={...n[i][t],description:U.target.value},l({...n,[i]:[...n[i]]})},m=U=>{const R=U.target.value==="web"?"web":"docker";R==="web"&&n.dockerArgs.forEach(M=>{M.type="docker"});const D=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:R,path:R==="docker"?D:"/",protocol:"http",prefix:R==="docker"?D:"/",name:"publicUrl",port:"BLOCKLET_PORT"},l({...n,dockerArgs:[...n.dockerArgs]})},k=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},l({...n,dockerArgs:[...n.dockerArgs]})},w=U=>{const R=U.target.value;n[i][t]={...n[i][t],prefix:R,path:R==="*"?"/":R},l({...n,[i]:[...n[i]]})},T=U=>{var R;(R=n[i])!=null&&R[t]&&(n[i][t].value=U.target.value),l({...n,[i]:[...n[i]]})},P=u===`$${yt(o.key)}`||o.custom,I=i==="dockerArgs"&&!an[o.key],L=$s[o.key],z=i==="dockerEnvs",q=o.key==="--publish";let Z=o.key;return q&&o.type==="web"?Z="--publish (Web)":z&&(Z=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(E,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:Z})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(ne,{disabled:r||P||I||o.value===he.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:P?`$${yt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Je,{position:"end",sx:{zoom:.9},children:[(!(L||I)||z||q)&&e.jsx(ce,{onClick:()=>f(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!r&&e.jsx(ce,{onClick:b,color:I?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})},error:I,onChange:T}),I&&e.jsx(E,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(E,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&qs[o.key](u)&&e.jsx(E,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(ut,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(z?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[L||I||z?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx($e,{disabled:r,checked:P,onChange:j,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.shared")}),e.jsx($e,{disabled:r,checked:o.shared,onChange:h,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.required")}),e.jsx($e,{disabled:r,checked:o.required,onChange:p,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.secure")}),e.jsx($e,{disabled:r,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx($e,{disabled:r,checked:o.value===he.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:v,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.description")}),e.jsx(ne,{disabled:r,value:o.description,onChange:C,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),q&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.portType")}),e.jsxs(Ct,{value:o.type||"docker",onChange:m,children:[e.jsx(fe,{value:"docker",children:"Docker"}),e.jsx(fe,{value:"web",children:"Web"})]})]}),q&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(Ct,{value:o.proxyBehavior||"service",onChange:k,children:[e.jsx(fe,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(fe,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),q&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.prefix")}),e.jsx(ne,{disabled:r,value:o.prefix,onChange:w,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}it.propTypes={dockerParams:s.object.isRequired,setDockerParams:s.func.isRequired,dataKey:s.string.isRequired,item:s.object.isRequired,t:s.func.isRequired,readOnly:s.bool.isRequired,index:s.number.isRequired};it.defaultProps={};const Zr=`
|
|
176
|
+
`;function Pn({text:t}){return t?e.jsx(zs,{wrapperElement:{"data-color-mode":"light"},source:xs.sanitize(t),rehypePlugins:[[Os,{target:"_blank"}]]}):e.jsx(Me,{Icon:zt})}Pn.propTypes={text:s.string.isRequired};function _n({params:t,setParams:o,paramsErrTip:n,loading:l,setParamsErrTip:i,readOnly:d}){var b;const{t:r}=Q(),[u,a]=x.useState(d?"preview":"write"),f=(j,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(E,{variant:"h6",fontWeight:"bold",sx:{},children:r("common.introduction")}),e.jsxs(Qo,{value:u,onChange:f,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(ne,{disabled:l||d,sx:{border:"none"},placeholder:`Blocklet ${r("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Je,{position:"end",children:[((b=t==null?void 0:t.blockletIntroduction)==null?void 0:b.length)||0," / ",he.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:j=>{i({blockletIntroduction:""}),o({blockletIntroduction:j.target.value.slice(0,he.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(Pn,{text:t.blockletIntroduction||""})})]})}_n.propTypes={params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired};var uo={},Gr=we;Object.defineProperty(uo,"__esModule",{value:!0});var It=uo.default=void 0,Jr=Gr(De()),Lo=e;It=uo.default=(0,Jr.default)([(0,Lo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Lo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function po({step:t,ok:o,active:n,error:l,warning:i}){let d="grey.500",r=t+1;return o&&(r=e.jsx(un,{sx:{fontSize:18,margin:0},color:"white"})),l||!o&&n>t?(d="error.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):i?(d="warning.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):n>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:r})}po.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};po.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function $n({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:l,params:i,loading:d,paramsErrTip:r,warning:u,viewMode:a,projectId:f}){const{t:b}=Q(),j=()=>{n(v=>v+1)},y=()=>{n(v=>v-1)},h=v=>v===0?(r==null?void 0:r.blockletTitle)||(r==null?void 0:r.projectId)||(r==null?void 0:r.blockletDescription)||(r==null?void 0:r.blockletHomepage)||(r==null?void 0:r.blockletSupport)||(r==null?void 0:r.blockletCommunity)||(r==null?void 0:r.blockletRepository):v===2?(r==null?void 0:r.blockletResource)||(r==null?void 0:r.blockletDocker)||(r==null?void 0:r.dockerImageName):v>=4?(r==null?void 0:r.blockletVersion)||(r==null?void 0:r.note):"",p=a||Sn({hasSelectedResources:l,params:i,projectId:f,t:b})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[e.jsx(Zn,{activeStep:o,orientation:"vertical",children:t.map((v,C)=>{const m={},k=d||!Ur({hasSelectedResources:l,params:i,projectId:f,step:C,t:b}),w=d?"":h(C);return w&&(m.optional=e.jsx(E,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:w}),m.error=!0),e.jsxs(Kn,{children:[e.jsx(es,{icon:e.jsx(po,{error:w,warning:C===0?u.hasWarning:!1,active:p?99:o,step:C,ok:k}),sx:{cursor:"pointer",color:w?"error.main":"inherit"},disabled:!1,onClick:()=>n(C),...m,children:e.jsx(E,{fontSize:"14px",fontWeight:"500",color:w||!k&&o>C?"error.main":"inherit",children:v.label})}),e.jsxs(ts,{children:[e.jsx(E,{fontSize:12,children:v.description}),!p&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[C<t.length-1&&e.jsx(K,{variant:"contained",onClick:j,sx:{mt:1,mr:1},disabled:w||!k,children:b("common.continue")}),C>0&&e.jsx(K,{disabled:C===0,onClick:y,sx:{mt:1,mr:1},children:b("common.back")})]})})]})]},v.label)})}),o>=t.length-1&&e.jsx(_t,{square:!0,elevation:0,sx:{p:3},children:e.jsx(E,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}$n.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.string.isRequired,loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.bool.isRequired,warning:s.object.isRequired,paramsErrTip:s.shape({projectId:s.string,blockletVersion:s.string,blockletTitle:s.string,blockletDescription:s.string,note:s.string,blockletResource:s.string,blockletHomepage:s.string,blockletSupport:s.string,blockletCommunity:s.string,blockletRepository:s.string,blockletDocker:s.object,dockerImageName:s.string}).isRequired};const Xr=[".zip",".gz"],Yr=1024*1024*100,Qr=x.lazy(()=>nn(()=>import("./index-DyxFC42L.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ho({app:t,projectId:o,readOnly:n,params:l,setParams:i,setParamsErrTip:d,error:r}){const{t:u,locale:a}=Q(),f=x.useRef(null),b=()=>n?!1:!o||o===Y.UNOWNED_DID?(W.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,j=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(E,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(ve,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!l.uploadedResource&&e.jsx(E,{component:"a",href:`${j}/params.uploadedResource`,children:l.uploadedResource}),!n&&e.jsx(K,{variant:"outlined",size:"small",onClick:()=>{var y;b()&&((y=f.current)==null||y.open())},children:l.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(x.Suspense,{fallback:e.jsx(Xe,{}),children:e.jsx(Qr,{ref:f,locale:a,popup:!0,onUploadFinish:y=>{var h;i({uploadedResource:y.data.filename}),d({blockletResource:""}),(h=f.current)==null||h.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:j,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Xr,maxFileSize:Yr,maxNumberOfFiles:1}}},"uploader-resource")}),!!r&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:r})]})}ho.propTypes={app:s.object.isRequired,projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired};ho.defaultProps={};function lt({readOnly:t,params:o,setParams:n,paramsErrTip:l,setParamsErrTip:i,loading:d}){var u;const{t:r}=Q();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:d||t,label:`Blocklet ${r("common.version")}`,placeholder:`Blocklet ${r("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:a=>{i({blockletVersion:""}),n({blockletVersion:a.target.value})},error:!!l.blockletVersion,helperText:l.blockletVersion||""}),e.jsx(ne,{label:r("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Je,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",he.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:a=>{i({note:""}),n({note:a.target.value.slice(0,he.PROJECT.MAX_NOTE_LENGTH)})},error:!!l.note,helperText:l.note||"",sx:{mt:3}})]})})}lt.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,loading:s.bool.isRequired};lt.defaultProps={};function qn(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&qn(t[o]);return t}function it({index:t,item:o,dockerParams:n,setDockerParams:l,dataKey:i,t:d,readOnly:r}){const u=(o==null?void 0:o.value)||"",[a,f]=x.useState(!1),b=()=>{var U;(U=n[i])==null||U.splice(t,1),l({...n,[i]:[...n[i]]})},j=(U,R)=>{var g;(g=n[i])!=null&&g[t]&&(R?(n[i][t].custom=n[i][t].value,n[i][t].value=`$${yt(o.key)}`):(n[i][t].value=n[i][t].custom||"",n[i][t].custom="")),l({...n,[i]:[...n[i]]})},y=(U,R)=>{var D;const g=((D=n[i][t])==null?void 0:D.value)||"";n[i][t]={...n[i][t],secure:R,value:R&&g===he.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},h=(U,R)=>{n[i][t]={...n[i][t],shared:R},l({...n,[i]:[...n[i]]})},p=(U,R)=>{var D;const g=((D=n[i][t])==null?void 0:D.value)||"";n[i][t]={...n[i][t],required:R,value:R&&g===he.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},v=(U,R)=>{n[i][t]={...n[i][t],value:R?he.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},l({...n,[i]:[...n[i]]})},C=U=>{n[i][t]={...n[i][t],description:U.target.value},l({...n,[i]:[...n[i]]})},m=U=>{const R=U.target.value==="web"?"web":"docker";R==="web"&&n.dockerArgs.forEach(M=>{M.type="docker"});const D=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:R,path:R==="docker"?D:"/",protocol:"http",prefix:R==="docker"?D:"/",name:"publicUrl",port:"BLOCKLET_PORT"},l({...n,dockerArgs:[...n.dockerArgs]})},k=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},l({...n,dockerArgs:[...n.dockerArgs]})},w=U=>{const R=U.target.value;n[i][t]={...n[i][t],prefix:R,path:R==="*"?"/":R},l({...n,[i]:[...n[i]]})},T=U=>{var R;(R=n[i])!=null&&R[t]&&(n[i][t].value=U.target.value),l({...n,[i]:[...n[i]]})},P=u===`$${yt(o.key)}`||o.custom,I=i==="dockerArgs"&&!an[o.key],L=$s[o.key],z=i==="dockerEnvs",q=o.key==="--publish";let Z=o.key;return q&&o.type==="web"?Z="--publish (Web)":z&&(Z=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(E,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:Z})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(ne,{disabled:r||P||I||o.value===he.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:P?`$${yt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Je,{position:"end",sx:{zoom:.9},children:[(!(L||I)||z||q)&&e.jsx(ce,{onClick:()=>f(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!r&&e.jsx(ce,{onClick:b,color:I?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})},error:I,onChange:T}),I&&e.jsx(E,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(E,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&qs[o.key](u)&&e.jsx(E,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(ut,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(z?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[L||I||z?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx($e,{disabled:r,checked:P,onChange:j,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.shared")}),e.jsx($e,{disabled:r,checked:o.shared,onChange:h,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.required")}),e.jsx($e,{disabled:r,checked:o.required,onChange:p,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.secure")}),e.jsx($e,{disabled:r,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx($e,{disabled:r,checked:o.value===he.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:v,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.description")}),e.jsx(ne,{disabled:r,value:o.description,onChange:C,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),q&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.portType")}),e.jsxs(Ct,{value:o.type||"docker",onChange:m,children:[e.jsx(fe,{value:"docker",children:"Docker"}),e.jsx(fe,{value:"web",children:"Web"})]})]}),q&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(Ct,{value:o.proxyBehavior||"service",onChange:k,children:[e.jsx(fe,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(fe,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),q&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.prefix")}),e.jsx(ne,{disabled:r,value:o.prefix,onChange:w,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}it.propTypes={dockerParams:s.object.isRequired,setDockerParams:s.func.isRequired,dataKey:s.string.isRequired,item:s.object.isRequired,t:s.func.isRequired,readOnly:s.bool.isRequired,index:s.number.isRequired};it.defaultProps={};const Zr=`
|
|
177
177
|
docker run --name postgrest
|
|
178
178
|
-p 3000:3000
|
|
179
179
|
-e PGRST_DB_URI="postgres://username:password@host:port/database"
|