@abtnode/blocklet-services 1.16.38-beta-20250127-092551-3bb6da3b → 1.16.38-beta-20250206-084543-4d7b4331
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/socket/channel/did.js +2 -1
- package/dist/assets/{Add-0_yO_NcD.js → Add-DTHqaebJ.js} +1 -1
- package/dist/assets/{ArrowDropDown-CSe7vdhu.js → ArrowDropDown-DbyzWNvL.js} +1 -1
- package/dist/assets/{CheckCircle-C20J4AX-.js → CheckCircle-CFxGo9yf.js} +1 -1
- package/dist/assets/{ChevronLeft-CYpg5M_K.js → ChevronLeft-BfXQoYEz.js} +1 -1
- package/dist/assets/{ChevronRight-DORpkdoL.js → ChevronRight-CfoEIq_n.js} +1 -1
- package/dist/assets/{DeleteOutline-BaOxCgo3.js → DeleteOutline-BmH9ek4A.js} +1 -1
- package/dist/assets/{Done-Bsd0QwkQ.js → Done-EMi5bDwr.js} +1 -1
- package/dist/assets/{Download-BF8ec3kS.js → Download-Dhtefh1X.js} +1 -1
- package/dist/assets/{EditIcon-D6Lk4OxD.js → EditIcon-BGaX97FF.js} +1 -1
- package/dist/assets/{Error-CmnuwZkD.js → Error-Djqvk_X8.js} +1 -1
- package/dist/assets/{Google-F1HiAjHW.js → Google-MetxIaR3.js} +1 -1
- package/dist/assets/{InfoOutlined-DZAeG3v-.js → InfoOutlined-Bd6IN61C.js} +1 -1
- package/dist/assets/{Launch-DNY7Ut_B.js → Launch-DC2ZwJy0.js} +1 -1
- package/dist/assets/{LaunchOutlined-BUOyH9Rv.js → LaunchOutlined-CYryXNUL.js} +1 -1
- package/dist/assets/{LockIcon-BITD3hjp.js → LockIcon-BHLM_myO.js} +1 -1
- package/dist/assets/{Loop-gZ2g1v3i.js → Loop-Dwj655TP.js} +1 -1
- package/dist/assets/{MoreHoriz-CwoKs0Gg.js → MoreHoriz-B8ywH5RE.js} +1 -1
- package/dist/assets/{PlayArrow-C6dXJHO6.js → PlayArrow-vglCW7W4.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-SCPzvU7T.js → QuestionMarkCircle-BDO28oyM.js} +1 -1
- package/dist/assets/{ServerLogo-DRTZsm8x.js → ServerLogo-D3ppBqIq.js} +1 -1
- package/dist/assets/{ViewList-DfGpYdZ-.js → ViewList-BEBx2X_O.js} +1 -1
- package/dist/assets/{access-control-DWS7Lowo.js → access-control-C15ttx-y.js} +1 -1
- package/dist/assets/{actions-BvtS-2sJ.js → actions-D-mxVcNU.js} +1 -1
- package/dist/assets/{add-component-core-DZPE4BRe.js → add-component-core-DNqTsrPg.js} +1 -1
- package/dist/assets/add-resource-C6AMLerq.js +1 -0
- package/dist/assets/{addon-CDVN9YCj.js → addon-_m1gJFAF.js} +1 -1
- package/dist/assets/analytics-DvHwLQn7.js +11 -0
- package/dist/assets/{ar-DV4YJwQy.js → ar-C89hW7LF.js} +1 -1
- package/dist/assets/{audit-logs-CJvI5okV.js → audit-logs-BCbtyCHg.js} +1 -1
- package/dist/assets/{base32-Bl4ek2bl.js → base32-BFfp490K.js} +1 -1
- package/dist/assets/{branding-CfeUWBA7.js → branding-D8S6jsa0.js} +2 -2
- package/dist/assets/{bundle-avatar-TEUPlhi2.js → bundle-avatar-C9ats955.js} +1 -1
- package/dist/assets/button-BmPwSTan.js +1 -0
- package/dist/assets/{click-to-copy-Ck4RKrL7.js → click-to-copy-_Hi7Yhx3.js} +1 -1
- package/dist/assets/{complete-CPnz5QUF.js → complete-DUg7uJ4N.js} +1 -1
- package/dist/assets/{component-Srk2_SVH.js → component-D1agqLE_.js} +1 -1
- package/dist/assets/{config-Cp3L8D_L.js → config-S6WZ6U3Y.js} +2 -2
- package/dist/assets/{config-navigation-a3GJWM1m.js → config-navigation-CMi0YByE.js} +6 -6
- package/dist/assets/{config-space-piVzY5c1.js → config-space-BtoXeFsn.js} +1 -1
- package/dist/assets/{config-kJZsVZD6.js → config-xTynYj5F.js} +1 -1
- package/dist/assets/{confirm-D7n9Rzfx.js → confirm-yYw8jeh5.js} +1 -1
- package/dist/assets/{connect-BZUv1d-6.js → connect-CT8urDCb.js} +1 -1
- package/dist/assets/{connect-rdXbvbmJ.js → connect-DMnZDuPy.js} +1 -1
- package/dist/assets/{connect-to-BzfmK9yx.js → connect-to-BtXA2Q7q.js} +1 -1
- package/dist/assets/{content-layout-CzrxMNjA.js → content-layout-DRV8Bqu8.js} +1 -1
- package/dist/assets/dashboard-D7xokuFw.js +217 -0
- package/dist/assets/{de-C2Y_05d1.js → de-BScxb0zD.js} +1 -1
- package/dist/assets/{did-address-CLeqbWiu.js → did-address-DL8dQh4X.js} +1 -1
- package/dist/assets/{domain-DgPzyf2N.js → domain-WlHroGqS.js} +1 -1
- package/dist/assets/{domain-list-BiYGOOY3.js → domain-list-CID5R830.js} +2 -2
- package/dist/assets/{email-5azpRba_.js → email-XNK7Gwt2.js} +1 -1
- package/dist/assets/{es-DPVOSPPn.js → es-B9f-yiTL.js} +1 -1
- package/dist/assets/{exchange-passport-Cus1rYsJ.js → exchange-passport-BkvQV3O8.js} +1 -1
- package/dist/assets/{form-text-input-Cf1j6PeI.js → form-text-input-B1uYH91s.js} +2 -2
- package/dist/assets/{fr-C8dIIOc9.js → fr-BguXQaFu.js} +1 -1
- package/dist/assets/{fuel-BaqDy7AE.js → fuel-uFxFD3IR.js} +1 -1
- package/dist/assets/{fullpage-Dx8PYbvz.js → fullpage-Dc1dR2nf.js} +1 -1
- package/dist/assets/{get-safe-url-BF9qL1PD.js → get-safe-url-B9qOA7gB.js} +1 -1
- package/dist/assets/{get-safe-url-BsKINLVF.js → get-safe-url-BTwyxtCV.js} +1 -1
- package/dist/assets/{hi-C5r4WQDs.js → hi-7nPwxLb7.js} +1 -1
- package/dist/assets/{home-D42zu2I_.js → home-BfUTLxOL.js} +1 -1
- package/dist/assets/{id-BQK45J6o.js → id-gU7ysJNs.js} +1 -1
- package/dist/assets/{iframe-Cn--d9nR.js → iframe-CDk6_C57.js} +1 -1
- package/dist/assets/{index-6oQLUjq6.js → index-1NdG9dcQ.js} +7 -7
- package/dist/assets/index-BBlaG9rd.js +77 -0
- package/dist/assets/{index-DpNGP1ih.js → index-BNjqST1U.js} +12 -12
- package/dist/assets/{index-CXVY5UoP.js → index-BQ9qcXAM.js} +7 -7
- package/dist/assets/{index-C0uUrAqS.js → index-BzpSavwm.js} +1 -1
- package/dist/assets/{index-DpOEjWGx.js → index-C8bsu4NM.js} +1 -1
- package/dist/assets/index-CEYigfYv.js +228 -0
- package/dist/assets/{index-BgGF6utP.js → index-CIjk07iX.js} +2 -2
- package/dist/assets/{index-CEbjBHHi.js → index-CKIpILov.js} +1 -1
- package/dist/assets/{index-BvLMNAG0.js → index-CeDgfE-R.js} +1 -1
- package/dist/assets/{index-BDfZ8xEV.js → index-D0faGVLi.js} +3 -3
- package/dist/assets/{index-D5mFr1eo.js → index-D4b-IulH.js} +1 -1
- package/dist/assets/index-DBoRYbIw.js +1 -0
- package/dist/assets/{index-DE_r-gh_.js → index-DGE6IUiK.js} +1 -1
- package/dist/assets/{index-CFT-L0SZ.js → index-DUqnq1p0.js} +1 -1
- package/dist/assets/{index-kk2gduJr.js → index-DX_lvtWO.js} +1 -1
- package/dist/assets/{index-CKsz_iVM.js → index-Hq7kqq19.js} +1 -1
- package/dist/assets/{index-uosYiNLl.js → index-QX3ZQRUn.js} +16 -16
- package/dist/assets/{index-DTzPwoh8.js → index-cBCi42Bf.js} +1 -1
- package/dist/assets/{invitation-DpOgzXor.js → invitation-BkpzegkF.js} +1 -1
- package/dist/assets/{invite-DmpCzOPN.js → invite-DSfHEBpk.js} +1 -1
- package/dist/assets/{issue-passport--83QQUn2.js → issue-passport-DRO3fhhX.js} +1 -1
- package/dist/assets/{item-7Z8_UB5K.js → item-D9PJoNKZ.js} +1 -1
- package/dist/assets/{ja-DsJERrpD.js → ja-C4BURK37.js} +1 -1
- package/dist/assets/{ko-t760ZSCl.js → ko-CeKzLbt8.js} +1 -1
- package/dist/assets/{launch-result-message-C_UhVRcl.js → launch-result-message-0WH2fKJs.js} +1 -1
- package/dist/assets/{layout-Dv_7-Fpq.js → layout-KUVrIKnH.js} +1 -1
- package/dist/assets/list-BmQp9JBM.js +160 -0
- package/dist/assets/{list-header-CfBPZZEw.js → list-header-Cm2JzuBu.js} +1 -1
- package/dist/assets/localization-BUyqSLbi.js +1 -0
- package/dist/assets/{log-CNjGA-yl.js → log-VT6HCVkp.js} +2 -2
- package/dist/assets/{login-DWrSz67b.js → login-BXw8BSYh.js} +1 -1
- package/dist/assets/{login-oauth-callback-VNeZxFH0.js → login-oauth-callback-D_ULXKRT.js} +1 -1
- package/dist/assets/{logo-uploader-DZm2nb0s.js → logo-uploader-B0QGvHYx.js} +5 -5
- package/dist/assets/{lost-passport-DFh2B6Gl.js → lost-passport-CMs5A43o.js} +1 -1
- package/dist/assets/{open-window-BvyLumiN.js → open-window-DFVq0Vka.js} +1 -1
- package/dist/assets/{overview-DNQZ-tgj.js → overview-JoUamf5H.js} +2 -2
- package/dist/assets/{page-header-CJHCTtBc.js → page-header-B2kRYRXR.js} +1 -1
- package/dist/assets/{permission-B0xKCybj.js → permission-CtM69wEM.js} +1 -1
- package/dist/assets/{preferences-BMgF6Djl.js → preferences-BI2Qy7wd.js} +1 -1
- package/dist/assets/{pt-BkjUa7uv.js → pt-o1EeyLhb.js} +1 -1
- package/dist/assets/publish-resource-D5Rx9baz.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-DY38RjFx.js → react-beautiful-dnd.esm-C6Cs2eu-.js} +1 -1
- package/dist/assets/{relative-time-C36uWHLw.js → relative-time-D_pFZIBd.js} +1 -1
- package/dist/assets/{ru-1WsQFvuL.js → ru-BlfgKyTj.js} +1 -1
- package/dist/assets/sdk-DCjm9lEU.js +1 -0
- package/dist/assets/session-BTTAIWAT.js +1 -0
- package/dist/assets/{setup-lHrzljce.js → setup-C_n4S096.js} +3 -3
- package/dist/assets/{shorten-label-CYJeMT7h.js → shorten-label-BPVcqm_d.js} +1 -1
- package/dist/assets/{simple-select-CAyDBkK6.js → simple-select-Bly6GilY.js} +1 -1
- package/dist/assets/{slicedToArray-CV571vyX.js → slicedToArray--pkkXr1E.js} +2 -2
- package/dist/assets/{start-DNIWxyMi.js → start-B0Bo1ke7.js} +1 -1
- package/dist/assets/{step-actions-BYFwIhu4.js → step-actions-BdvB3K8O.js} +1 -1
- package/dist/assets/{studio-DBfgF1ck.js → studio-DADXtyow.js} +1 -1
- package/dist/assets/{switch-control-B8wYzo2_.js → switch-control-3273Ci8c.js} +1 -1
- package/dist/assets/{th-CecKmVWf.js → th-BHBtH1Zl.js} +1 -1
- package/dist/assets/{traffic-1TtyUzFO.js → traffic-CG1Pxqmj.js} +1 -1
- package/dist/assets/{transfer-Bh7VQuKL.js → transfer-O3YQ6b4a.js} +1 -1
- package/dist/assets/{unsubscribe-C_eX2N6S.js → unsubscribe-Dx2vvXHo.js} +1 -1
- package/dist/assets/{use-mobile-Bk8quGt9.js → use-mobile-CtFE3PKN.js} +1 -1
- package/dist/assets/{useAsyncRetry-EMRT9Ldq.js → useAsyncRetry-DO0NcRB-.js} +1 -1
- package/dist/assets/{useLocalStorage-tmIJr51I.js → useLocalStorage-BiHNUBhw.js} +1 -1
- package/dist/assets/user-center-LYxpEnYV.js +71 -0
- package/dist/assets/{util-BY6uUuCk.js → util-CB4v94Ia.js} +1 -1
- package/dist/assets/{util-CtKeCk_N.js → util-lgEyE78l.js} +1 -1
- package/dist/assets/{vendor-arcblock-Bf7AGBSd.js → vendor-arcblock-ZjreIevk.js} +3 -3
- package/dist/assets/{vendor-mui-core-CCMNKHtm.js → vendor-mui-core-DHnPlNQK.js} +8 -8
- package/dist/assets/{vendor-mui-x-DmPVvZFJ.js → vendor-mui-x-BcCkWIwf.js} +1 -1
- package/dist/assets/{vi-CDrTp7No.js → vi-CuGQRG8r.js} +1 -1
- package/dist/assets/wrap-locale-dvgNAAzE.js +1 -0
- package/dist/assets/zh-DfOtp2w7.js +4 -0
- package/dist/assets/{zh-tw-CUyoe2CD.js → zh-tw-DFpaHA6Z.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/service-worker.js +1 -1
- package/package.json +21 -21
- package/dist/assets/add-resource-CYNZTaOG.js +0 -1
- package/dist/assets/analytics-0lVXNyXs.js +0 -11
- package/dist/assets/button-CzSgwkGN.js +0 -1
- package/dist/assets/dashboard-B_hsqmQK.js +0 -86
- package/dist/assets/index-BWKYj-2X.js +0 -228
- package/dist/assets/index-CSkA6M4K.js +0 -1
- package/dist/assets/index-fel1gHRy.js +0 -61
- package/dist/assets/list-yjVo8vxH.js +0 -160
- package/dist/assets/localization-CRwVeETn.js +0 -1
- package/dist/assets/publish-resource-B_OOg2Om.js +0 -1
- package/dist/assets/sdk-VtyRZZVE.js +0 -1
- package/dist/assets/session-DutPZhUI.js +0 -1
- package/dist/assets/user-center-pv7oyGUu.js +0 -71
- package/dist/assets/wrap-locale-BjJvyHQM.js +0 -1
- package/dist/assets/zh-Bqr2c2To.js +0 -4
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BDfZ8xEV.js","assets/vendor-arcblock-Bf7AGBSd.js","assets/vendor-react-D-afvo_7.js","assets/vendor-utils-5TjOM6td.js","assets/vendor-mui-core-CCMNKHtm.js","assets/vendor-hooks-BKxTDk_P.js","assets/vendor-arcblock-DhgPdlEj.css","assets/index-C2fPoxDR.js","assets/index-uosYiNLl.js","assets/index-DoZ2YM4T.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as R,k as Dt,l as lt,L as le,f as Hn,h as Gn,i as pt}from"./vendor-react-D-afvo_7.js";import{a1 as me,j as t,t as ze,a3 as u,aM as Wo,E as d,a4 as ue,I as oe,T as E,bT as Uo,aa as ae,aE as Xn,bJ as Ge,ad as Fo,aN as Xe,bq as jt,x as Q,a2 as et,P as Ho,G as Go,v as Tt,$ as Xo,ar as Jo,al as pe,ah as Jn,D as _t,ab as Qo,r as Yo,bG as Qn,K as Be,y as Zo,M as Y,ac as ke,aL as Yn,L as Zn,z as Kn,bn as es,aA as Ko,az as tt,bt as ts,bu as os,bU as ns,bV as ss,aP as en,bD as rs,bM as is,bx as ls,by as ft}from"./vendor-mui-core-CCMNKHtm.js";import{y as be,B as De,h as re,a5 as cs,f as mo,_ as tn,ad as bo}from"./index-uosYiNLl.js";import{_ as xe,b as H,e as J,a1 as ot,aa as on,aQ as nn,a8 as sn,Y as as,aR as Pt,j as V,n as ds,aS as us,aT as ps,X as fs,ax as se,aU as hs,ah as ms,aI as Se,a5 as Lt,aV as ye,ap as bs,af as xs}from"./vendor-arcblock-Bf7AGBSd.js";import{d as qt}from"./Add-0_yO_NcD.js";import{d as gs}from"./Error-CmnuwZkD.js";import{C as $t}from"./confirm-D7n9Rzfx.js";import{u as ct}from"./session-DutPZhUI.js";import{W as xo}from"./did-address-CLeqbWiu.js";import{E as Ve,D as go,C as jo,P as ko}from"./react-beautiful-dnd.esm-DY38RjFx.js";import{B as Nt}from"./bundle-avatar-TEUPlhi2.js";import{S as fe}from"./shorten-label-CYJeMT7h.js";import{T as js,x as ce,G as At,C as Je}from"./vendor-utils-5TjOM6td.js";import{d as ks}from"./Download-BF8ec3kS.js";import{d as ys}from"./QuestionMarkCircle-SCPzvU7T.js";import{u as vs}from"./vendor-hooks-BKxTDk_P.js";import{_ as Ce}from"./useSetState-Crt4S51m.js";import{c as Et}from"./index-DoZ2YM4T.js";import{E as Mt}from"./index-DE_r-gh_.js";import{p as nt}from"./index-DpOEjWGx.js";import"./api-K65cLqol.js";import{d as ws}from"./ChevronRight-DORpkdoL.js";import{T as Cs,a as Ss}from"./vendor-mui-x-DmPVvZFJ.js";import{d as yo}from"./DeleteOutline-BaOxCgo3.js";import{c as Rs,A as rn,u as Is,S as Ds,U as Ts,a as ht,b as ln,n as _s,e as Ps,f as vo,g as Ls}from"./item-7Z8_UB5K.js";import{d as qs}from"./ArrowDropDown-CSe7vdhu.js";import{f as Re}from"./format-error-C0Ke3VXF.js";import{C as $s}from"./click-to-copy-Ck4RKrL7.js";import{d as Ns}from"./Launch-DNY7Ut_B.js";import{M as As}from"./index-BvLMNAG0.js";import{r as Es}from"./index-C0uUrAqS.js";import{d as Ms}from"./Done-Bsd0QwkQ.js";import"./raf-schd.esm-Cxhj8umC.js";import"./get-safe-url-BsKINLVF.js";var Ot={},Os=me;Object.defineProperty(Ot,"__esModule",{value:!0});var cn=Ot.default=void 0,zs=Os(xe()),Bs=t;cn=Ot.default=(0,zs.default)((0,Bs.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 zt={},Vs=me;Object.defineProperty(zt,"__esModule",{value:!0});var an=zt.default=void 0,Ws=Vs(xe()),Us=t;an=zt.default=(0,Ws.default)((0,Us.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Bt={},Fs=me;Object.defineProperty(Bt,"__esModule",{value:!0});var dn=Bt.default=void 0,Hs=Fs(xe()),Gs=t;dn=Bt.default=(0,Hs.default)((0,Gs.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Vt({did:e,projectId:o,title:n,logo:r,describe:s}){const i=`${`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e}/${o}/logo/upload`}/${r}`,[a,c]=R.useState(!1),f=ze(h=>h.breakpoints.down("md"));return t.jsxs(u,{sx:{display:"flex",flexDirection:"row",color:a?"primary.main":"grey.900",gap:1},onPointerEnter:()=>c(!0),onPointerLeave:()=>c(!1),children:[t.jsx(Wo,{sx:{borderRadius:1},src:i}),t.jsxs(u,{children:[t.jsx(fe,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),t.jsx(fe,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||a?"primary.main":"grey.700"},children:s||"/"})]})]})}Vt.propTypes={projectId:d.string.isRequired,did:d.string.isRequired,title:d.string.isRequired,logo:d.string.isRequired,describe:d.string.isRequired};function Wt({initUrl:e}){const o=Dt(),n=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:r,locale:s}=J(),{api:l}=be(),{api:i}=ct(),[a,c]=R.useState(!0),{blocklet:f}=De(),[h,x]=R.useState(null),[b,p]=R.useState(!1),v=ze(g=>g.breakpoints.down("xl")),{componentDid:C=""}=lt(),[D,j]=R.useState(null),m=()=>{l.getProjects({input:{did:f.meta.did,componentDid:C,tenantScope:n}}).then(g=>{const P=(g==null?void 0:g.projects)||[];c(!1),j(P)}).catch(g=>{c(!1),V.error(g.message)})},T=()=>{o(`${H.UNOWNED_DID}/create/none`,{replace:!0})},L=g=>{x(g)},I=()=>{c(!1),p(!0)},y=()=>{p(!1),x(null)},_=g=>{V.error(g.message),p(!1),x(null)},A=g=>{if(!(g!=null&&g.deleted)){V.error("Delete project failed");return}m(),p(!1),x(null)},W=(g,P,O)=>{let F=g==null?void 0:g.trim();return F?(F=ds.toAddress(F).toLocaleLowerCase(),O.some((w,$)=>{const q=P[$];return q&&w.searchable&&w.display!=="excluded"&&w.display!=="false"&&q.toLocaleLowerCase().includes(F)})):!0};if(R.useEffect(()=>{m()},[]),!D&&a)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Ve,{})});if(!D)return null;if(!D.length)return t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:r("blocklet.publish.blockletEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),t.jsx(ot,{onClick:T,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const k=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:g=>{const P=D[g];return t.jsx(le,{to:`${P.id}`,children:t.jsx(Vt,{did:f.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:g=>g?t.jsx(on,{type:"success",children:g}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:g=>g?t.jsx(xo,{size:14,compact:!0,responsive:!1,did:g}):null}},v||C?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:g=>g?t.jsx(xo,{onClick:()=>{o(`/.well-known/service/admin/members?did=${g}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:g}):null}},v||C?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:g=>{const P=(f.children||[]).find(O=>O.meta.did===g);return P?t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Nt,{size:14,blocklet:P,ancestors:[f]}),t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},g):""}}},v||n?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:g=>t.jsx(u,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:t.jsx(fe,{children:g})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:g=>t.jsx(nn,{value:Number(g),locale:s})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:g=>{const P=D[g];return t.jsxs(u,{display:"flex",children:[t.jsx(le,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:t.jsx(ue,{title:r("blocklet.publish.createRelease"),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"create",children:t.jsx(cn,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&t.jsx(ue,{title:r("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"secondary","aria-label":"create",children:t.jsx(le,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:t.jsx(an,{sx:{fontSize:18}})})})}),t.jsx(ue,{title:r("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"delete",onClick:()=>L(P),children:t.jsx(sn,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),S=b?t.jsx(as,{open:!0,popup:!0,onClose:y,action:"check-has-project-id",locale:s,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:A,onError:_,extraParams:{projectId:h.id,did:f.meta.did,name:h.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:h.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:h.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return t.jsxs(u,{children:[t.jsxs(u,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(u,{display:"flex",flexDirection:"row",alignItems:"center",children:[t.jsx(u,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),t.jsx(ue,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:t.jsx(dn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),t.jsxs(ot,{onClick:T,variant:"contained",children:[t.jsx(qt,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]}),t.jsx(Pt,{className:"main-table",locale:s,data:D,columns:k,options:{sort:!1,download:!1,filter:!1,print:!1,search:!0,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100],searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:400,customSearch:W}}),h&&t.jsx($t,{title:`${r("common.delete")} ${h.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:I,onCancel:()=>x(null),children:t.jsx(u,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(g=>t.jsxs(u,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[t.jsx(gs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),t.jsx(E,{component:"span",variant:"inherit",color:"text.secondary",children:g})]}))})}),S]})}Wt.propTypes={initUrl:d.object};Wt.defaultProps={initUrl:null};var Ut={},Xs=me;Object.defineProperty(Ut,"__esModule",{value:!0});var un=Ut.default=void 0,Js=Xs(xe()),wo=t;un=Ut.default=(0,Js.default)([(0,wo.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,wo.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");function Qs(){var I;const{t:e,locale:o}=J(),{projectId:n}=lt(),{api:r}=be(),[s,l]=R.useState(!0),{blocklet:i}=De(),a=ze(y=>y.breakpoints.down("md")),[c,f]=R.useState(null),[h,x]=R.useState(null),[b,p]=R.useState(null),v=(I=window.env)==null?void 0:I.serverEndpoint,C=()=>{r.getReleases({input:{did:i.meta.did,projectId:n}}).then(y=>{const _=(y==null?void 0:y.releases)||[];l(!1),f(_)}).catch(y=>{l(!1),V.error(y.message)})},D=()=>{r.doBatchQuery({getProject:{input:{did:i.meta.did,projectId:n}},getReleases:{input:{did:i.meta.did,projectId:n}}}).then(y=>{x(y.getProject.project||{}),f(y.getReleases.releases||[]),l(!1)}).catch(y=>{l(!1),V.error(y.message)})};R.useEffect(()=>{D()},[]);const j=()=>{l(!1);const y=b.id;r.deleteRelease({input:{did:i.meta.did,projectId:n,releaseId:y}}).then(()=>{l(!1),C(),V.success(e("common.removeSuccess")),p(null)}).catch(_=>{l(!1),V.error(_.message)})},m=y=>{p(y)};if(!c&&s)return t.jsx(u,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:t.jsx(Ve,{})});if(!c)return null;const T=t.jsxs(Uo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(le,{to:"..",children:e("common.blockletStudio")}),t.jsx(E,{color:"text.primary",children:t.jsx(fe,{maxLength:a?6:30,children:h.blockletTitle})})]});if(!c.length)return t.jsxs(t.Fragment,{children:[T,t.jsxs(u,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[t.jsx(u,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:e("blocklet.publish.releaseEmptyTip")}),t.jsx(u,{sx:{fontSize:14,color:"text.secondary",mb:3},children:e("blocklet.publish.createReleaseTip")}),t.jsx(le,{to:"create/none",children:t.jsx(ot,{variant:"contained",children:e("blocklet.publish.createRelease")})})]})]});const L=[{label:e("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:y=>{const _=c[y];return t.jsx(le,{to:`view/${_.id}`,children:t.jsx(Vt,{did:i.meta.did,projectId:h.id,logo:_.blockletLogo,title:_.blockletVersion,describe:_.blockletTitle})})}}},{label:e("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:y=>{const _=c[y];return t.jsx(E,{className:"note",children:_.note||""})}}},{label:e("common.status"),name:"status",options:{customBodyRender:y=>t.jsx(on,{type:y==="published"?"success":"warning",children:y==="published"?"Released":js(y)})}},{label:e("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:y=>{const _=c[y];return _.status!==re.PROJECT.RELEASE_STATUS.published?"":t.jsx(nn,{value:Number(_.updatedAt),locale:o})}}},{label:e("common.actions"),name:"actions",options:{customBodyRenderLite:y=>{var g;const _=c[y];let A="",W="";const k=_.status==="published";if(k){const P=ce(v,`/api/project/${i.meta.did}/${h.id}/${h.lastReleaseId}/release/blocklet.json`),O=new URL(v);O.pathname=ce(O.pathname,"/launch-blocklet/agreement"),O.searchParams.set("blocklet_meta_url",P),A=O.href,W=ce(`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${i.meta.did}/${h.id}/${h.lastReleaseId}/download/${(h.lastReleaseFiles||[])[0]}`)}const S=(g=h.blockletComponents)!=null&&g.some(P=>P.included)||_.uploadedResource?"pack":"resource";return t.jsxs(u,{display:"flex",alignItems:"center",children:[k&&S==="pack"&&t.jsx(ue,{title:e("blocklet.publish.install",{name:h.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"secondary","aria-label":"create",children:t.jsx("a",{style:{display:"flex"},href:A,target:"_blank",rel:"noreferrer",children:t.jsx(un,{sx:{fontSize:18}})})})}),k&&t.jsx(ue,{title:e("blocklet.publish.download",{name:h.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"download",children:t.jsx("a",{style:{display:"flex"},href:W,children:t.jsx(ks,{sx:{fontSize:18}})})})}),t.jsx(ue,{title:e("blocklet.publish.delete",{name:h.blockletTitle}),placement:"top",children:t.jsx(oe,{color:"primary","aria-label":"delete",onClick:()=>m(_),children:t.jsx(sn,{sx:{fontSize:18}})})})]})}}}];return t.jsxs(Ys,{children:[t.jsxs(u,{className:"header",children:[T,t.jsx(le,{to:"new-release/none",children:t.jsxs(ot,{variant:"contained",children:[t.jsx(qt,{style:{fontSize:"1.3em",marginRight:4}}),e("blocklet.publish.createRelease")]})})]}),t.jsx(Pt,{className:"main-table",verticalKeyWidth:100,locale:o,data:c,columns:L,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),b&&t.jsx($t,{title:e(`${e("common.delete")} ${b.blockletVersion}`),description:e("blocklet.publish.deleteReleaseTip"),confirm:e("common.confirm"),onConfirm:j,onCancel:()=>p(null)})]})}const Ys=ae(u)`
|
|
3
|
-
.header {
|
|
4
|
-
display: flex;
|
|
5
|
-
align-items: center;
|
|
6
|
-
justify-content: space-between;
|
|
7
|
-
}
|
|
8
|
-
.main-table {
|
|
9
|
-
margin-top: 24px;
|
|
10
|
-
}
|
|
11
|
-
.main-table > div:first-child {
|
|
12
|
-
display: none;
|
|
13
|
-
}
|
|
14
|
-
.note {
|
|
15
|
-
word-break: break-all;
|
|
16
|
-
white-space: pre-line;
|
|
17
|
-
}
|
|
18
|
-
`;var Ft={},Zs=me;Object.defineProperty(Ft,"__esModule",{value:!0});var pn=Ft.default=void 0,Ks=Zs(xe()),er=t;pn=Ft.default=(0,Ks.default)((0,er.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20m6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9"}),"DoDisturbAlt");function Ie({children:e,Icon:o}){return t.jsxs(Xn,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"10px",margin:"10px 0px"},children:[t.jsx(u,{sx:{opacity:.3,fontSize:32},children:t.jsx(o,{})}),t.jsx(u,{sx:{mb:2,opacity:.7,fontSize:"small",color:"action"},children:e})]})}Ie.propTypes={children:d.node.isRequired,Icon:d.elementType};Ie.defaultProps={Icon:pn};function Ht({value:e,app:o,onChange:n,onChangeBlockletResourceType:r,disabled:s,resourceRelateComponents:l,projectType:i,dependentComponentsMode:a,blockletResourceType:c}){const{t:f,locale:h}=J(),x=a==="readonly",b=R.useMemo(()=>{const T=e.reduce((L,I)=>(L[I.did]=I.included,L),{});return(o.children||[]).filter(L=>x?l[L.meta.did]||T[L.meta.did]:!0)},[o.children,e,l,x]),p=R.useMemo(()=>b.map(T=>e.find(I=>I.did===T.meta.did)||{did:T.meta.did}),[b,e]),v=p.reduce((T,L)=>(T[L.did]=At(L,["required","included"]),T),{}),C=T=>{const L=p.map(I=>{if(I.did===T){const y=!I.included;return{...I,included:y,required:y}}return I});n(L)},D=T=>{const L=p.map(I=>I.did===T?{...I,required:!I.required}:I);n(L)},j=T=>{r(T.target.checked?"resource":"")},m=[{label:f("common.name"),name:"meta.title",width:200,options:{customBodyRenderLite:T=>{var y;const L=b[T],I=(y=v[L.meta.did])==null?void 0:y.included;return t.jsxs(u,{display:"flex",alignItems:"center",children:[t.jsx(Nt,{size:24,blocklet:L,ancestors:[o]}),t.jsx(u,{ml:"4px",className:Et("text",{excluded:!I}),children:t.jsx(u,{children:L.meta.title})})]})}}},{label:f("blocklet.publish.componentIncluded"),width:100,options:{customBodyRenderLite:T=>{var _;const L=b[T],I=l[L.meta.did],y=!!((_=v[L.meta.did])!=null&&_.included);return t.jsx(Ge,{size:"small",checked:I||y,onClick:()=>C(L.meta.did),disabled:x||I||s})}}},{label:f("blocklet.publish.componentForceRequired"),width:100,options:{customBodyRenderLite:T=>{var A,W;const L=b[T],I=l[L.meta.did],y=!!((A=v[L.meta.did])!=null&&A.included),_=!!((W=v[L.meta.did])!=null&&W.required);return t.jsx(Ge,{size:"small",checked:I||_&&y,onClick:()=>D(L.meta.did),disabled:x||I||s||!y})}}}];return t.jsx(tr,{children:b!=null&&b.length?t.jsxs(t.Fragment,{children:[t.jsxs(Fo,{severity:"info",style:{width:"100%"},children:[t.jsx(u,{display:"flex",alignItems:"center",rel:"noreferrer",ml:"13px",children:f(i==="pack"?"blocklet.publish.packTip":"blocklet.publish.resourceTip")}),t.jsxs(u,{component:"label",style:{cursor:"pointer"},children:[t.jsx(Ge,{size:"small",style:{marginLeft:"0px"},disabled:s,checked:c==="resource",onChange:j}),f("blocklet.publish.forceResourceBlocklet")]})]}),t.jsx(Pt,{className:"main-table",verticalKeyWidth:100,locale:h,data:b,columns:m,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1,rowsPerPage:50}})]}):t.jsx(Ie,{Icon:Mt,children:f("blocklet.publish.blockletEmptyTip")})})}Ht.propTypes={app:d.object.isRequired,value:d.arrayOf(d.shape({did:d.string.isRequired,required:d.bool,included:d.bool})),onChange:d.func,onChangeBlockletResourceType:d.func,disabled:d.bool,dependentComponentsMode:d.string,resourceRelateComponents:d.object,blockletResourceType:d.string,projectType:d.string.isRequired};Ht.defaultProps={value:[],onChange:()=>{},onChangeBlockletResourceType:()=>{},disabled:!1,dependentComponentsMode:"auto",blockletResourceType:"",resourceRelateComponents:{}};const tr=ae(u)`
|
|
19
|
-
.main-table {
|
|
20
|
-
.text.excluded {
|
|
21
|
-
color: #999;
|
|
22
|
-
}
|
|
23
|
-
width: 400px;
|
|
24
|
-
${({theme:e})=>e.breakpoints.down("md")} {
|
|
25
|
-
width: 100%;
|
|
26
|
-
}
|
|
27
|
-
> div:first-child {
|
|
28
|
-
display: none;
|
|
29
|
-
}
|
|
30
|
-
.MuiTableCell-head {
|
|
31
|
-
padding-top: 0;
|
|
32
|
-
padding-bottom: 0;
|
|
33
|
-
}
|
|
34
|
-
.MuiTableCell-body {
|
|
35
|
-
padding-top: 6px;
|
|
36
|
-
padding-bottom: 6px;
|
|
37
|
-
}
|
|
38
|
-
.datatable-footer {
|
|
39
|
-
display: none;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
`;function or(e,o){const n=new Set(o||[]),r=[];function s(l){n.has(l==null?void 0:l.id)&&r.push(l==null?void 0:l.id),l!=null&&l.children&&l.children.forEach(s)}return(e||[]).forEach(s),r}function Gt({data:e,...o}){return!e||!e.length?null:t.jsx(nr,{...o,children:e.map(n=>t.jsx("a",{href:n.url,target:"_blank",rel:"noreferrer",children:t.jsx("img",{src:n.url,alt:n.alt||""})},n.url))})}Gt.propTypes={data:d.arrayOf(d.shape({url:d.string,alt:d.string}))};Gt.defaultProps={data:[]};const nr=ae(u)`
|
|
43
|
-
display: flex;
|
|
44
|
-
justify-content: flex-start;
|
|
45
|
-
flex-wrap: wrap;
|
|
46
|
-
margin-bottom: -12px;
|
|
47
|
-
a {
|
|
48
|
-
display: flex;
|
|
49
|
-
}
|
|
50
|
-
img {
|
|
51
|
-
height: 128px;
|
|
52
|
-
cursor: pointer;
|
|
53
|
-
margin-right: 12px;
|
|
54
|
-
margin-bottom: 12px;
|
|
55
|
-
}
|
|
56
|
-
`,mt=(e,o)=>{const n=[...e];for(;n.length>0;){const r=n.shift();if(r.id===o)return r;r.children&&n.push(...r.children)}return[]};function Xt({icon:e}){return e?fs(e)?t.jsx("img",{className:"resource-icon",src:e,alt:"icon"}):t.jsx(se,{className:"resource-icon",icon:e}):null}Xt.propTypes={icon:d.string};Xt.defaultProps={icon:""};function Jt({disabled:e,data:o,onChange:n,value:r}){const s=r;function l(p,v=[]){return v.push(p.id),p.children&&p.children.forEach(C=>l(C,v)),v}const i=p=>l(mt(o,p)),a=(p,v=[])=>{const C=mt(o,p);return C.parent?(v.push(C.parent),a(C.parent,v)):v};function c(p,v){const C=i(p.id),D=C.indexOf(p.id);return C.splice(D,1),C.every(j=>s.concat(v).includes(j))}const f=(p,v)=>{p.stopPropagation();const C=i(v),D=a(v);if(s.includes(v)){const j=s.filter(m=>!C.concat(D).includes(m));n(j)}else{const j=C;for(let m=0;m<D.length;++m)c(mt(o,D[m]),j)&&j.push(D[m]);n([...s].concat(j))}},h=p=>{p.stopPropagation()},x=o.some(p=>{var v;return((v=p.children)==null?void 0:v.length)>0}),b=p=>{var m;const v=s.indexOf(p.id)!==-1,C=Array.isArray(p.children),D=i(p.id),j=C&&!v&&s.some(T=>D.includes(T));return t.jsx(Cs,{nodeId:p.id,label:t.jsx(Xe,{onClick:h,control:t.jsx(Ge,{size:"small",checked:v,indeterminate:j,tabIndex:-1,disableRipple:!0,onClick:T=>f(T,p.id),disabled:p.disabled||e}),label:t.jsxs(u,{className:"content",children:[t.jsxs(u,{display:"flex",alignItems:"center",children:[p.icon&&t.jsx(Xt,{icon:p.icon}),t.jsx(u,{className:"name",children:p.name}),p.url&&t.jsx("a",{href:p.url,target:"_blank",rel:"noreferrer",className:"link",children:t.jsx(ps,{className:"link-icon"})})]}),!!p.description&&t.jsx(u,{className:"description",children:p.description}),!!((m=p.images)!=null&&m.length)&&t.jsx(Gt,{className:"images",data:p.images})]})}),children:C?p.children.map(b):null},p.id)};return t.jsx(sr,{className:Et(!x&&"no-children"),multiSelect:!0,defaultCollapseIcon:t.jsx(us,{}),defaultExpandIcon:t.jsx(ws,{}),selected:s,children:o.map(p=>b(p))})}Jt.propTypes={data:d.array,value:d.array,onChange:d.func,disabled:d.bool};Jt.defaultProps={data:[],value:[],onChange:()=>{},disabled:!1};const sr=ae(Ss)`
|
|
57
|
-
&.no-children {
|
|
58
|
-
.MuiTreeItem-content {
|
|
59
|
-
padding: 0;
|
|
60
|
-
.MuiTreeItem-iconContainer {
|
|
61
|
-
display: none;
|
|
62
|
-
}
|
|
63
|
-
.MuiTreeItem-label {
|
|
64
|
-
padding-left: 0;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
.MuiTreeItem-content {
|
|
69
|
-
align-items: flex-start;
|
|
70
|
-
.MuiTreeItem-iconContainer {
|
|
71
|
-
transform: translateY(10px);
|
|
72
|
-
}
|
|
73
|
-
&.Mui-selected {
|
|
74
|
-
background-color: transparent;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
.MuiTreeItem-label {
|
|
78
|
-
cursor: default;
|
|
79
|
-
}
|
|
80
|
-
.MuiFormControlLabel-root {
|
|
81
|
-
align-items: flex-start;
|
|
82
|
-
}
|
|
83
|
-
.content {
|
|
84
|
-
padding-top: 6px;
|
|
85
|
-
}
|
|
86
|
-
.name {
|
|
87
|
-
font-size: 16px;
|
|
88
|
-
font-weight: 700;
|
|
89
|
-
}
|
|
90
|
-
.resource-icon {
|
|
91
|
-
margin-right: 2px;
|
|
92
|
-
font-size: 16px;
|
|
93
|
-
}
|
|
94
|
-
img.resource-icon {
|
|
95
|
-
width: 1rem;
|
|
96
|
-
height: 1rem;
|
|
97
|
-
}
|
|
98
|
-
.link {
|
|
99
|
-
margin-left: 8px;
|
|
100
|
-
font-size: 16px;
|
|
101
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
102
|
-
display: flex;
|
|
103
|
-
}
|
|
104
|
-
.link-icon {
|
|
105
|
-
font-size: inherit;
|
|
106
|
-
}
|
|
107
|
-
.description {
|
|
108
|
-
font-size: 14px;
|
|
109
|
-
color: ${({theme:e})=>e.palette.text.secondary};
|
|
110
|
-
}
|
|
111
|
-
`,Qe=(e,o)=>(e.forEach(n=>{o&&(n.parent=o),(n.children||[]).forEach(r=>{r.parent=n.id,Qe(r.children||[],r.id)})}),e),Ye=(e,o,n,r,s)=>{const{exportApi:l="/"}=(e==null?void 0:e.meta.resource)||{},i=new URL(ce("http://127.0.0.1",e==null?void 0:e.mountPoint,l||"/").replace(/\/+/g,"/"));return i.searchParams.set("projectId",o),i.searchParams.set("releaseId",n),i.searchParams.set("local",r),s&&i.searchParams.set("resourcesParams",s.searchParams.get("resourcesParams")),`${i.pathname}${i.search}`},rr=async({api:e,appDid:o,component:n,projectId:r,releaseId:s,locale:l,initUrl:i,resources:a})=>{let c;if(i&&i.searchParams.get("resourcesParams"))try{c=JSON.parse(i.searchParams.get("resourcesParams"))}catch(f){V.error(f.message);return}await Je.post(Ye(n,r,s,l,i),{resources:a,projectId:r,releaseId:s,locale:l,...c?{resourcesParams:c}:{}},{headers:{"x-csrf-token":hs()},timeout:60*1e3}),await e.updateSelectedResources({input:{did:o,projectId:r,releaseId:s,componentDid:n.meta.did,resources:a}})},ir=(e,o)=>{if(!e)return{};const n=o.reduce((s,l)=>(s[l]=!0,s),{}),r=(s,l)=>(s.forEach(i=>{var a;n[i.id]&&((a=i.dependentComponents)!=null&&a.length)&&i.dependentComponents.forEach(c=>{l[c]=!0}),i.children&&r(i.children,l)}),l);return r(e,{})};function Qt({app:e,component:o,projectId:n,release:r,loading:s,error:l,saveSelectedEventsRef:i,readOnly:a,componentDid:c,initialResources:f={},setResourceComponentsMap:h,selectedResourceIds:x,setSelectedResourceIds:b,initUrl:p}){var W;const{t:v,locale:C}=J(),{api:D}=be(),[j,m]=Ce({}),T=R.useRef({}),L=R.useRef(!1),I=r.id;T.current.projectId=n,T.current.releaseId=I;const y=(k,S,g)=>{if(!S)return;const P=ir(S,g);h==null||h({[k]:Object.keys(P)})},_=k=>{i.current[o.meta.did]={resources:k,component:o},b({[o.meta.did]:k}),y(o.meta.did,j[o.meta.did],k)};R.useEffect(()=>{j[o==null?void 0:o.meta.did]||Je.get(Ye(o,n,I,C,p)).then(k=>{var g;const S=Qe(((g=k.data)==null?void 0:g.resources)||[]);m({[o==null?void 0:o.meta.did]:S})}).catch(k=>{V.error(k.message)})},[o,n,r,C,p,m,j,I]),R.useEffect(()=>{I&&n&&!L.current&&nt(e.children.map(k=>async()=>{var S,g,P;if(!(c&&c!==k.meta.did)&&!(!(k!=null&&k.mountPoint)||!cs.hasStartEngine(k==null?void 0:k.meta)||!((g=(S=k==null?void 0:k.meta)==null?void 0:S.resource)!=null&&g.exportApi)))try{const O=await Je.get(Ye(k,n,I,C,p)),F=Qe(((P=O==null?void 0:O.data)==null?void 0:P.resources)||[]);m({[k==null?void 0:k.meta.did]:F});const w=await D.getSelectedResources({input:{did:e.meta.did,projectId:n,releaseId:I,componentDid:k.meta.did}}),$=(w==null?void 0:w.resources)||[];$!=null&&$.length&&(b({[k.meta.did]:or(F,$)}),y(k.meta.did,F,$),a||(i.current[k==null?void 0:k.meta.did]={resources:$,component:k}))}catch(O){V.error(O.message)}}),{concurrency:2}).then(()=>{L.current=!0})},[I,n,a,C,p,m]),R.useEffect(()=>{f&&Object.keys(f).length&&nt(e.children.map(async k=>{var g;const S=f[k.meta.did];if(S!=null&&S.length){const P=await Je.get(Ye(k,n,I,C,p)),O=Qe(((g=P==null?void 0:P.data)==null?void 0:g.resources)||[]);b({[k.meta.did]:S}),y(k.meta.did,O,S),a||(i.current[k==null?void 0:k.meta.did]={resources:S,component:k})}}))},[e,f,a]);let A=null;return(!o||!((W=j[o.meta.did])!=null&&W.length))&&(A=t.jsx(Ie,{Icon:Mt,children:v("blocklet.publish.resourceEmptyTip",{name:mo.getDisplayName(o)})})),(o==null?void 0:o.status)!=="running"&&(A=t.jsx(Ie,{children:v("blocklet.publish.componentNotRunning",{name:mo.getDisplayName(o)})})),t.jsxs(t.Fragment,{children:[t.jsx(lr,{className:Et(l&&"error"),children:t.jsx(u,{pb:2,width:"100%",children:A||t.jsx(Jt,{data:j[o.meta.did]||[],value:x[o.meta.did]||[],onChange:_,disabled:s||a})})}),!!l&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:l})]})}Qt.propTypes={component:d.object.isRequired,app:d.object.isRequired,projectId:d.string.isRequired,error:d.string,saveSelectedEventsRef:d.object.isRequired,readOnly:d.bool.isRequired,loading:d.bool.isRequired,release:d.shape({id:d.string.isRequired,status:d.string}),initialResources:d.object,initUrl:d.object,setResourceComponentsMap:d.func,componentDid:d.string,selectedResourceIds:d.array.isRequired,setSelectedResourceIds:d.func.isRequired};Qt.defaultProps={error:"",release:{id:""},initUrl:null,initialResources:{},setResourceComponentsMap:()=>{},componentDid:""};const lr=ae(u)`
|
|
112
|
-
border: 1px solid #ccc;
|
|
113
|
-
max-height: 600px;
|
|
114
|
-
width: 100%;
|
|
115
|
-
&.error {
|
|
116
|
-
border-color: ${e=>e.theme.palette.error.main};
|
|
117
|
-
}
|
|
118
|
-
border-radius: 4px;
|
|
119
|
-
padding: 16px;
|
|
120
|
-
padding-bottom: 0px;
|
|
121
|
-
overflow-y: auto;
|
|
122
|
-
.footer {
|
|
123
|
-
border-top: 1px solid #ddd;
|
|
124
|
-
display: flex;
|
|
125
|
-
padding: 12px 0;
|
|
126
|
-
margin-top: 12px;
|
|
127
|
-
position: sticky;
|
|
128
|
-
bottom: 0;
|
|
129
|
-
background: #fff;
|
|
130
|
-
z-index: 10;
|
|
131
|
-
}
|
|
132
|
-
`;var Yt={},cr=me;Object.defineProperty(Yt,"__esModule",{value:!0});var kt=Yt.default=void 0,ar=cr(xe()),dr=t;kt=Yt.default=(0,ar.default)((0,dr.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 Co="lastWantToConnectStoreId";function ur(e){var a,c;const[o,n]=R.useState(null),{session:r}=ct(),s=R.useCallback(f=>{n(f),localStorage.setItem(Co,f==null?void 0:f.id)},[n]),l=R.useMemo(()=>{var b,p,v,C;const f=localStorage.getItem(Co),h=f?(((b=e==null?void 0:e.settings)==null?void 0:b.storeList)||[]).find(D=>D.id===f):null;if(h)return h;let x=(((p=e==null?void 0:e.settings)==null?void 0:p.storeList)||[]).find(D=>{var j;return!(D.id!==H.BLOCKLET_STORE.id||D.scope&&D.scope!=="studio"&&D.scope!==((j=r==null?void 0:r.user)==null?void 0:j.did))});return x||(x=(C=(v=e==null?void 0:e.settings)==null?void 0:v.storeList)==null?void 0:C[0]),x},[(a=e==null?void 0:e.settings)==null?void 0:a.storeList,(c=r==null?void 0:r.user)==null?void 0:c.did]);return[o||l||{},s]}const bt={};async function fn(e,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:s=""}){bt[s]&&clearTimeout(bt[s]),await new Promise(a=>setTimeout(a,r));const l=Date.now(),i=async(a,c)=>{try{const f=await e();a(f)}catch(f){Date.now()-l>n?c(f):s?bt[s]=setTimeout(()=>i(a,c),o):setTimeout(()=>i(a,c),o)}};return new Promise(i)}function pr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function fr(e,{did:o,projectId:n,messageId:r}){return fn(async()=>{var l;const s=await e.getProject({input:{did:o,projectId:n,messageId:r}});if(!((l=s==null?void 0:s.project)!=null&&l.blockletDid))throw new Error("Connected store not found");return s.project.blockletDid},{timerKey:"connect-studio"})}function hr(e,{did:o,projectId:n,storeId:r}){return fn(async()=>{var i,a;const s=await e.getProject({input:{did:o,projectId:n,messageId:""}});if(!((a=(i=s==null?void 0:s.project)==null?void 0:i.connectedStores)!=null&&a.length))throw new Error("Connected store not found");if(!s.project.connectedStores.find(c=>c.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}const hn=({fromBlocklet:e,nodeInfo:o,blocklet:n,userDid:r})=>{var i,a;const s=e?(i=n==null?void 0:n.meta)==null?void 0:i.did:o==null?void 0:o.did;let l=e?((a=n==null?void 0:n.settings)==null?void 0:a.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(l)||(l=[]),l=l.filter(c=>c.protected||!c.scope||c.scope==="studio"||c.scope===r),{teamDid:s,storeList:l}};function Zt({blocklet:e,store:o={},onChangeStore:n,onClick:r,disabled:s,loading:l,componentDid:i}){var g,P,O;const{t:a}=J(),{session:c}=ct(),{api:f,info:h,inService:x}=be(),b=De(),[p,v]=R.useState(!1),C=R.useRef(null),[D,j]=R.useState(!1),[m,T]=R.useState(null),L=F=>{n(F),v(!1)},I=()=>{v(!p)},y=F=>{C.current&&C.current.contains(F.target)||v(!1)},_=()=>{j(!0)},A=()=>{j(!1)},W=async()=>{var F;if(m)try{await f.deleteBlockletStore({input:{teamDid:e.meta.did,url:m.url,projectId:"",scope:m.scope||"studio"}}),await((F=b==null?void 0:b.actions)==null?void 0:F.refreshBlocklet())}catch(w){V.error(`Remove Blocklet Store Error: ${Re(w)}`)}finally{T(null)}},{storeList:k}=hn({fromBlocklet:x,blocklet:e,nodeInfo:h,componentDid:i,userDid:(g=c==null?void 0:c.user)==null?void 0:g.did}),S=(P=e==null?void 0:e.meta)==null?void 0:P.did;return t.jsxs(t.Fragment,{children:[t.jsxs(jt,{disabled:s,ref:C,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[t.jsxs(Q,{onClick:r,children:[l&&t.jsx(et,{size:14,sx:{mr:.5}}),`${a("common.connect")} ${o.name||""}`]}),t.jsx(Q,{size:"small","aria-controls":p?"split-button-menu":void 0,"aria-expanded":p?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:I,children:t.jsx(qs,{})})]}),t.jsx(Ho,{sx:{zIndex:10},open:p,anchorEl:C.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:F})=>t.jsx(Go,{...F,style:{transformOrigin:"center top"},children:t.jsx(Tt,{children:t.jsx(Xo,{onClickAway:y,children:t.jsxs(Jo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[k==null?void 0:k.map(w=>{var $;return t.jsxs(pe,{selected:w.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>L(w),children:[t.jsxs(u,{children:[t.jsx(fe,{sx:{fontSize:"16px"},maxLength:24,children:w.name}),t.jsx(fe,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:w.url})]}),Rs({store:w,userDid:($=c==null?void 0:c.user)==null?void 0:$.did})&&t.jsx(oe,{sx:{ml:1},onClick:q=>{q.preventDefault(),q.stopPropagation(),T(w)},children:t.jsx(se,{icon:"ic:outline-delete"})})]},w.url)}),t.jsx(Jn,{}),t.jsxs(pe,{onClick:_,children:[t.jsx(qt,{font:!0}),t.jsx(E,{variant:"inherit",children:a("store.blockletRegistry.addRegistry")})]})]})})})})}),D&&t.jsx(rn,{hiddenChildren:!0,open:!0,onClose:A,teamDid:S,storeList:k,scope:"studio",onAdd:(O=b==null?void 0:b.actions)==null?void 0:O.refreshBlocklet}),m&&t.jsx($t,{displayError:!0,title:`${a("common.delete")} ${m.name}`,description:a("blocklet.publish.deleteStoreTip",{name:m.name}),confirm:a("common.confirm"),onConfirm:W,onCancel:()=>T(null)})]})}Zt.propTypes={store:d.object,blocklet:d.object,onChangeStore:d.func.isRequired,onClick:d.func.isRequired,loading:d.bool.isRequired,disabled:d.bool.isRequired,componentDid:d.string.isRequired,projectType:d.string.isRequired,getData:d.func.isRequired};Zt.defaultProps={store:null,blocklet:null};var he=R;const Ae=/^[a-z0-9]+(-[a-z0-9]+)*$/,at=(e,o,n,r="")=>{const s=e.split(":");if(e.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;r=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const a=s.pop(),c=s.pop(),f={provider:s.length>0?s[0]:r,prefix:c,name:a};return o&&!Ze(f)?null:f}const l=s[0],i=l.split("-");if(i.length>1){const a={provider:r,prefix:i.shift(),name:i.join("-")};return o&&!Ze(a)?null:a}if(n&&r===""){const a={provider:r,prefix:"",name:l};return o&&!Ze(a,n)?null:a}return null},Ze=(e,o)=>e?!!((e.provider===""||e.provider.match(Ae))&&(o&&e.prefix===""||e.prefix.match(Ae))&&e.name.match(Ae)):!1,mn=Object.freeze({left:0,top:0,width:16,height:16}),st=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Kt=Object.freeze({...mn,...st}),yt=Object.freeze({...Kt,body:"",hidden:!1});function mr(e,o){const n={};!e.hFlip!=!o.hFlip&&(n.hFlip=!0),!e.vFlip!=!o.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(o.rotate||0))%4;return r&&(n.rotate=r),n}function So(e,o){const n=mr(e,o);for(const r in yt)r in st?r in e&&!(r in n)&&(n[r]=st[r]):r in o?n[r]=o[r]:r in e&&(n[r]=e[r]);return n}function br(e,o){const n=e.icons,r=e.aliases||Object.create(null),s=Object.create(null);function l(i){if(n[i])return s[i]=[];if(!(i in s)){s[i]=null;const a=r[i]&&r[i].parent,c=a&&l(a);c&&(s[i]=[a].concat(c))}return s[i]}return Object.keys(n).concat(Object.keys(r)).forEach(l),s}function xr(e,o,n){const r=e.icons,s=e.aliases||Object.create(null);let l={};function i(a){l=So(r[a]||s[a],l)}return i(o),n.forEach(i),So(e,l)}function bn(e,o){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(s=>{o(s,null),n.push(s)});const r=br(e);for(const s in r){const l=r[s];l&&(o(s,xr(e,s,l)),n.push(s))}return n}const gr={provider:"",aliases:{},not_found:{},...mn};function xt(e,o){for(const n in o)if(n in e&&typeof e[n]!=typeof o[n])return!1;return!0}function xn(e){if(typeof e!="object"||e===null)return null;const o=e;if(typeof o.prefix!="string"||!e.icons||typeof e.icons!="object"||!xt(e,gr))return null;const n=o.icons;for(const s in n){const l=n[s];if(!s.match(Ae)||typeof l.body!="string"||!xt(l,yt))return null}const r=o.aliases||Object.create(null);for(const s in r){const l=r[s],i=l.parent;if(!s.match(Ae)||typeof i!="string"||!n[i]&&!r[i]||!xt(l,yt))return null}return o}const Ro=Object.create(null);function jr(e,o){return{provider:e,prefix:o,icons:Object.create(null),missing:new Set}}function ve(e,o){const n=Ro[e]||(Ro[e]=Object.create(null));return n[o]||(n[o]=jr(e,o))}function eo(e,o){return xn(o)?bn(o,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function kr(e,o,n){try{if(typeof n.body=="string")return e.icons[o]={...n},!0}catch{}return!1}let Me=!1;function gn(e){return typeof e=="boolean"&&(Me=e),Me}function yr(e){const o=typeof e=="string"?at(e,!0,Me):e;if(o){const n=ve(o.provider,o.prefix),r=o.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function vr(e,o){const n=at(e,!0,Me);if(!n)return!1;const r=ve(n.provider,n.prefix);return kr(r,n.name,o)}function wr(e,o){if(typeof e!="object")return!1;if(typeof o!="string"&&(o=e.provider||""),Me&&!o&&!e.prefix){let s=!1;return xn(e)&&(e.prefix="",bn(e,(l,i)=>{i&&vr(l,i)&&(s=!0)})),s}const n=e.prefix;if(!Ze({provider:o,prefix:n,name:"a"}))return!1;const r=ve(o,n);return!!eo(r,e)}const jn=Object.freeze({width:null,height:null}),kn=Object.freeze({...jn,...st}),Cr=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Sr=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Io(e,o,n){if(o===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*o*n)/n;if(typeof e!="string")return e;const r=e.split(Cr);if(r===null||!r.length)return e;const s=[];let l=r.shift(),i=Sr.test(l);for(;;){if(i){const a=parseFloat(l);isNaN(a)?s.push(l):s.push(Math.ceil(a*o*n)/n)}else s.push(l);if(l=r.shift(),l===void 0)return s.join("");i=!i}}const Rr=e=>e==="unset"||e==="undefined"||e==="none";function Ir(e,o){const n={...Kt,...e},r={...kn,...o},s={left:n.left,top:n.top,width:n.width,height:n.height};let l=n.body;[n,r].forEach(v=>{const C=[],D=v.hFlip,j=v.vFlip;let m=v.rotate;D?j?m+=2:(C.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),C.push("scale(-1 1)"),s.top=s.left=0):j&&(C.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),C.push("scale(1 -1)"),s.top=s.left=0);let T;switch(m<0&&(m-=Math.floor(m/4)*4),m=m%4,m){case 1:T=s.height/2+s.top,C.unshift("rotate(90 "+T.toString()+" "+T.toString()+")");break;case 2:C.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:T=s.width/2+s.left,C.unshift("rotate(-90 "+T.toString()+" "+T.toString()+")");break}m%2===1&&(s.left!==s.top&&(T=s.left,s.left=s.top,s.top=T),s.width!==s.height&&(T=s.width,s.width=s.height,s.height=T)),C.length&&(l='<g transform="'+C.join(" ")+'">'+l+"</g>")});const i=r.width,a=r.height,c=s.width,f=s.height;let h,x;i===null?(x=a===null?"1em":a==="auto"?f:a,h=Io(x,c/f)):(h=i==="auto"?c:i,x=a===null?Io(h,f/c):a==="auto"?f:a);const b={},p=(v,C)=>{Rr(C)||(b[v]=C.toString())};return p("width",h),p("height",x),b.viewBox=s.left.toString()+" "+s.top.toString()+" "+c.toString()+" "+f.toString(),{attributes:b,body:l}}const Dr=/\sid="(\S+)"/g,Tr="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let _r=0;function Pr(e,o=Tr){const n=[];let r;for(;r=Dr.exec(e);)n.push(r[1]);if(!n.length)return e;const s="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(l=>{const i=typeof o=="function"?o(l):o+(_r++).toString(),a=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+i+s+"$3")}),e=e.replace(new RegExp(s,"g"),""),e}const vt=Object.create(null);function Lr(e,o){vt[e]=o}function wt(e){return vt[e]||vt[""]}function to(e){let o;if(typeof e.resources=="string")o=[e.resources];else if(o=e.resources,!(o instanceof Array)||!o.length)return null;return{resources:o,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const oo=Object.create(null),Ne=["https://api.simplesvg.com","https://api.unisvg.com"],Ke=[];for(;Ne.length>0;)Ne.length===1||Math.random()>.5?Ke.push(Ne.shift()):Ke.push(Ne.pop());oo[""]=to({resources:["https://api.iconify.design"].concat(Ke)});function qr(e,o){const n=to(o);return n===null?!1:(oo[e]=n,!0)}function no(e){return oo[e]}const $r=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Do=$r();function Nr(e,o){const n=no(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let s=0;n.resources.forEach(i=>{s=Math.max(s,i.length)});const l=o+".json?icons=";r=n.maxURL-s-n.path.length-l.length}return r}function Ar(e){return e===404}const Er=(e,o,n)=>{const r=[],s=Nr(e,o),l="icons";let i={type:l,provider:e,prefix:o,icons:[]},a=0;return n.forEach((c,f)=>{a+=c.length+1,a>=s&&f>0&&(r.push(i),i={type:l,provider:e,prefix:o,icons:[]},a=c.length),i.icons.push(c)}),r.push(i),r};function Mr(e){if(typeof e=="string"){const o=no(e);if(o)return o.path}return"/"}const Or=(e,o,n)=>{if(!Do){n("abort",424);return}let r=Mr(o.provider);switch(o.type){case"icons":{const l=o.prefix,a=o.icons.join(","),c=new URLSearchParams({icons:a});r+=l+".json?"+c.toString();break}case"custom":{const l=o.uri;r+=l.slice(0,1)==="/"?l.slice(1):l;break}default:n("abort",400);return}let s=503;Do(e+r).then(l=>{const i=l.status;if(i!==200){setTimeout(()=>{n(Ar(i)?"abort":"next",i)});return}return s=501,l.json()}).then(l=>{if(typeof l!="object"||l===null){setTimeout(()=>{l===404?n("abort",l):n("next",s)});return}setTimeout(()=>{n("success",l)})}).catch(()=>{n("next",s)})},zr={prepare:Er,send:Or};function Br(e){const o={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((s,l)=>s.provider!==l.provider?s.provider.localeCompare(l.provider):s.prefix!==l.prefix?s.prefix.localeCompare(l.prefix):s.name.localeCompare(l.name));let r={provider:"",prefix:"",name:""};return e.forEach(s=>{if(r.name===s.name&&r.prefix===s.prefix&&r.provider===s.provider)return;r=s;const l=s.provider,i=s.prefix,a=s.name,c=n[l]||(n[l]=Object.create(null)),f=c[i]||(c[i]=ve(l,i));let h;a in f.icons?h=o.loaded:i===""||f.missing.has(a)?h=o.missing:h=o.pending;const x={provider:l,prefix:i,name:a};h.push(x)}),o}function yn(e,o){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(s=>s.id!==o))})}function Vr(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const o=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!o.length)return;let n=!1;const r=e.provider,s=e.prefix;o.forEach(l=>{const i=l.icons,a=i.pending.length;i.pending=i.pending.filter(c=>{if(c.prefix!==s)return!0;const f=c.name;if(e.icons[f])i.loaded.push({provider:r,prefix:s,name:f});else if(e.missing.has(f))i.missing.push({provider:r,prefix:s,name:f});else return n=!0,!0;return!1}),i.pending.length!==a&&(n||yn([e],l.id),l.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),l.abort))})}))}let Wr=0;function Ur(e,o,n){const r=Wr++,s=yn.bind(null,n,r);if(!o.pending.length)return s;const l={id:r,icons:o,callback:e,abort:s};return n.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(l)}),s}function Fr(e,o=!0,n=!1){const r=[];return e.forEach(s=>{const l=typeof s=="string"?at(s,o,n):s;l&&r.push(l)}),r}var Hr={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Gr(e,o,n,r){const s=e.resources.length,l=e.random?Math.floor(Math.random()*s):e.index;let i;if(e.random){let y=e.resources.slice(0);for(i=[];y.length>1;){const _=Math.floor(Math.random()*y.length);i.push(y[_]),y=y.slice(0,_).concat(y.slice(_+1))}i=i.concat(y)}else i=e.resources.slice(l).concat(e.resources.slice(0,l));const a=Date.now();let c="pending",f=0,h,x=null,b=[],p=[];typeof r=="function"&&p.push(r);function v(){x&&(clearTimeout(x),x=null)}function C(){c==="pending"&&(c="aborted"),v(),b.forEach(y=>{y.status==="pending"&&(y.status="aborted")}),b=[]}function D(y,_){_&&(p=[]),typeof y=="function"&&p.push(y)}function j(){return{startTime:a,payload:o,status:c,queriesSent:f,queriesPending:b.length,subscribe:D,abort:C}}function m(){c="failed",p.forEach(y=>{y(void 0,h)})}function T(){b.forEach(y=>{y.status==="pending"&&(y.status="aborted")}),b=[]}function L(y,_,A){const W=_!=="success";switch(b=b.filter(k=>k!==y),c){case"pending":break;case"failed":if(W||!e.dataAfterTimeout)return;break;default:return}if(_==="abort"){h=A,m();return}if(W){h=A,b.length||(i.length?I():m());return}if(v(),T(),!e.random){const k=e.resources.indexOf(y.resource);k!==-1&&k!==e.index&&(e.index=k)}c="completed",p.forEach(k=>{k(A)})}function I(){if(c!=="pending")return;v();const y=i.shift();if(y===void 0){if(b.length){x=setTimeout(()=>{v(),c==="pending"&&(T(),m())},e.timeout);return}m();return}const _={status:"pending",resource:y,callback:(A,W)=>{L(_,A,W)}};b.push(_),f++,x=setTimeout(I,e.rotate),n(y,o,_.callback)}return setTimeout(I),j}function vn(e){const o={...Hr,...e};let n=[];function r(){n=n.filter(a=>a().status==="pending")}function s(a,c,f){const h=Gr(o,a,c,(x,b)=>{r(),f&&f(x,b)});return n.push(h),h}function l(a){return n.find(c=>a(c))||null}return{query:s,find:l,setIndex:a=>{o.index=a},getIndex:()=>o.index,cleanup:r}}function To(){}const gt=Object.create(null);function Xr(e){if(!gt[e]){const o=no(e);if(!o)return;const n=vn(o),r={config:o,redundancy:n};gt[e]=r}return gt[e]}function Jr(e,o,n){let r,s;if(typeof e=="string"){const l=wt(e);if(!l)return n(void 0,424),To;s=l.send;const i=Xr(e);i&&(r=i.redundancy)}else{const l=to(e);if(l){r=vn(l);const i=e.resources?e.resources[0]:"",a=wt(i);a&&(s=a.send)}}return!r||!s?(n(void 0,424),To):r.query(o,s,n)().abort}const _o="iconify2",Oe="iconify",wn=Oe+"-count",Po=Oe+"-version",Cn=36e5,Qr=168;function Ct(e,o){try{return e.getItem(o)}catch{}}function so(e,o,n){try{return e.setItem(o,n),!0}catch{}}function Lo(e,o){try{e.removeItem(o)}catch{}}function St(e,o){return so(e,wn,o.toString())}function Rt(e){return parseInt(Ct(e,wn))||0}const dt={local:!0,session:!0},Sn={local:new Set,session:new Set};let ro=!1;function Yr(e){ro=e}let He=typeof window>"u"?{}:window;function Rn(e){const o=e+"Storage";try{if(He&&He[o]&&typeof He[o].length=="number")return He[o]}catch{}dt[e]=!1}function In(e,o){const n=Rn(e);if(!n)return;const r=Ct(n,Po);if(r!==_o){if(r){const a=Rt(n);for(let c=0;c<a;c++)Lo(n,Oe+c.toString())}so(n,Po,_o),St(n,0);return}const s=Math.floor(Date.now()/Cn)-Qr,l=a=>{const c=Oe+a.toString(),f=Ct(n,c);if(typeof f=="string"){try{const h=JSON.parse(f);if(typeof h=="object"&&typeof h.cached=="number"&&h.cached>s&&typeof h.provider=="string"&&typeof h.data=="object"&&typeof h.data.prefix=="string"&&o(h,a))return!0}catch{}Lo(n,c)}};let i=Rt(n);for(let a=i-1;a>=0;a--)l(a)||(a===i-1?(i--,St(n,i)):Sn[e].add(a))}function Dn(){if(!ro){Yr(!0);for(const e in dt)In(e,o=>{const n=o.data,r=o.provider,s=n.prefix,l=ve(r,s);if(!eo(l,n).length)return!1;const i=n.lastModified||-1;return l.lastModifiedCached=l.lastModifiedCached?Math.min(l.lastModifiedCached,i):i,!0})}}function Zr(e,o){const n=e.lastModifiedCached;if(n&&n>=o)return n===o;if(e.lastModifiedCached=o,n)for(const r in dt)In(r,s=>{const l=s.data;return s.provider!==e.provider||l.prefix!==e.prefix||l.lastModified===o});return!0}function Kr(e,o){ro||Dn();function n(r){let s;if(!dt[r]||!(s=Rn(r)))return;const l=Sn[r];let i;if(l.size)l.delete(i=Array.from(l).shift());else if(i=Rt(s),!St(s,i+1))return;const a={cached:Math.floor(Date.now()/Cn),provider:e.provider,data:o};return so(s,Oe+i.toString(),JSON.stringify(a))}o.lastModified&&!Zr(e,o.lastModified)||Object.keys(o.icons).length&&(o.not_found&&(o=Object.assign({},o),delete o.not_found),n("local")||n("session"))}function qo(){}function ei(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Vr(e)}))}function ti(e,o){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(o).sort():e.iconsToLoad=o,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:r}=e,s=e.iconsToLoad;delete e.iconsToLoad;let l;if(!s||!(l=wt(n)))return;l.prepare(n,r,s).forEach(a=>{Jr(n,a,c=>{if(typeof c!="object")a.icons.forEach(f=>{e.missing.add(f)});else try{const f=eo(e,c);if(!f.length)return;const h=e.pendingIcons;h&&f.forEach(x=>{h.delete(x)}),Kr(e,c)}catch(f){console.error(f)}ei(e)})})}))}const oi=(e,o)=>{const n=Fr(e,!0,gn()),r=Br(n);if(!r.pending.length){let c=!0;return o&&setTimeout(()=>{c&&o(r.loaded,r.missing,r.pending,qo)}),()=>{c=!1}}const s=Object.create(null),l=[];let i,a;return r.pending.forEach(c=>{const{provider:f,prefix:h}=c;if(h===a&&f===i)return;i=f,a=h,l.push(ve(f,h));const x=s[f]||(s[f]=Object.create(null));x[h]||(x[h]=[])}),r.pending.forEach(c=>{const{provider:f,prefix:h,name:x}=c,b=ve(f,h),p=b.pendingIcons||(b.pendingIcons=new Set);p.has(x)||(p.add(x),s[f][h].push(x))}),l.forEach(c=>{const{provider:f,prefix:h}=c;s[f][h].length&&ti(c,s[f][h])}),o?Ur(o,r,l):qo};function ni(e,o){const n={...e};for(const r in o){const s=o[r],l=typeof s;r in jn?(s===null||s&&(l==="string"||l==="number"))&&(n[r]=s):l===typeof n[r]&&(n[r]=r==="rotate"?s%4:s)}return n}const si=/[\s,]+/;function ri(e,o){o.split(si).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function ii(e,o=0){const n=e.replace(/^-?[0-9.]*/,"");function r(s){for(;s<0;)s+=4;return s%4}if(n===""){const s=parseInt(e);return isNaN(s)?0:r(s)}else if(n!==e){let s=0;switch(n){case"%":s=25;break;case"deg":s=90}if(s){let l=parseFloat(e.slice(0,e.length-n.length));return isNaN(l)?0:(l=l/s,l%1===0?r(l):0)}}return o}function li(e,o){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in o)n+=" "+r+'="'+o[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function ci(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function ai(e){return"data:image/svg+xml,"+ci(e)}function di(e){return'url("'+ai(e)+'")'}let Ee;function ui(){try{Ee=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Ee=null}}function pi(e){return Ee===void 0&&ui(),Ee?Ee.createHTML(e):e}const Tn={...kn,inline:!1},fi={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},hi={display:"inline-block"},It={backgroundColor:"currentColor"},_n={backgroundColor:"transparent"},$o={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},No={WebkitMask:It,mask:It,background:_n};for(const e in No){const o=No[e];for(const n in $o)o[e+n]=$o[n]}const mi={...Tn,inline:!0};function Ao(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const bi=(e,o,n,r)=>{const s=n?mi:Tn,l=ni(s,o),i=o.mode||"svg",a={},c=o.style||{},f={...i==="svg"?fi:{},ref:r};for(let j in o){const m=o[j];if(m!==void 0)switch(j){case"icon":case"style":case"children":case"onLoad":case"mode":case"_ref":case"_inline":break;case"inline":case"hFlip":case"vFlip":l[j]=m===!0||m==="true"||m===1;break;case"flip":typeof m=="string"&&ri(l,m);break;case"color":a.color=m;break;case"rotate":typeof m=="string"?l[j]=ii(m):typeof m=="number"&&(l[j]=m);break;case"ariaHidden":case"aria-hidden":m!==!0&&m!=="true"&&delete f["aria-hidden"];break;default:s[j]===void 0&&(f[j]=m)}}const h=Ir(e,l),x=h.attributes;if(l.inline&&(a.verticalAlign="-0.125em"),i==="svg"){f.style={...a,...c},Object.assign(f,x);let j=0,m=o.id;return typeof m=="string"&&(m=m.replace(/-/g,"_")),f.dangerouslySetInnerHTML={__html:pi(Pr(h.body,m?()=>m+"ID"+j++:"iconifyReact"))},he.createElement("svg",f)}const{body:b,width:p,height:v}=e,C=i==="mask"||(i==="bg"?!1:b.indexOf("currentColor")!==-1),D=li(b,{...x,width:p+"",height:v+""});return f.style={...a,"--svg":di(D),width:Ao(x.width),height:Ao(x.height),...hi,...C?It:_n,...c},he.createElement("span",f)};gn(!0);Lr("",zr);if(typeof document<"u"&&typeof window<"u"){Dn();const e=window;if(e.IconifyPreload!==void 0){const o=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof o=="object"&&o!==null&&(o instanceof Array?o:[o]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!wr(r))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const o=e.IconifyProviders;if(typeof o=="object"&&o!==null)for(let n in o){const r="IconifyProviders["+n+"] is invalid.";try{const s=o[n];if(typeof s!="object"||!s||s.resources===void 0)continue;qr(n,s)||console.error(r)}catch{console.error(r)}}}}class Pn extends he.Component{constructor(o){super(o),this.state={icon:null}}_abortLoading(){this._loading&&(this._loading.abort(),this._loading=null)}_setData(o){this.state.icon!==o&&this.setState({icon:o})}_checkIcon(o){const n=this.state,r=this.props.icon;if(typeof r=="object"&&r!==null&&typeof r.body=="string"){this._icon="",this._abortLoading(),(o||n.icon===null)&&this._setData({data:r});return}let s;if(typeof r!="string"||(s=at(r,!1,!0))===null){this._abortLoading(),this._setData(null);return}const l=yr(s);if(!l){(!this._loading||this._loading.name!==r)&&(this._abortLoading(),this._icon="",this._setData(null),l!==null&&(this._loading={name:r,abort:oi([s],this._checkIcon.bind(this,!1))}));return}if(this._icon!==r||n.icon===null){this._abortLoading(),this._icon=r;const i=["iconify"];s.prefix!==""&&i.push("iconify--"+s.prefix),s.provider!==""&&i.push("iconify--"+s.provider),this._setData({data:l,classes:i}),this.props.onLoad&&this.props.onLoad(r)}}componentDidMount(){this._checkIcon(!1)}componentDidUpdate(o){o.icon!==this.props.icon&&this._checkIcon(!0)}componentWillUnmount(){this._abortLoading()}render(){const o=this.props,n=this.state.icon;if(n===null)return o.children?o.children:he.createElement("span",{});let r=o;return n.classes&&(r={...o,className:(typeof o.className=="string"?o.className+" ":"")+n.classes.join(" ")}),bi({...Kt,...n.data},r,o._inline,o._ref)}}const xi=he.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!1};return he.createElement(Pn,r)});he.forwardRef(function(o,n){const r={...o,_ref:n,_inline:!0};return he.createElement(Pn,r)});var gi=xi;const ji=e=>{const o=e.includes("youtube.com")||e.includes("youtu.be"),n=e.includes("vimeo.com");return o||n};function ut({url:e,style:o,controls:n,modestbranding:r}){var a;const{t:s}=J(),l=e.includes("youtube.com")||e.includes("youtu.be"),i=e.includes("vimeo.com");if(l){const c=((a=e.split("v=")[1])==null?void 0:a.split("&")[0])||e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:t.jsx("iframe",{src:`https://www.youtube.com/embed/${c}?modestbranding=${r}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(i){const c=e.split("/").pop();return t.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:t.jsx("iframe",{src:`https://player.vimeo.com/video/${c}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return t.jsx(u,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:t.jsxs(u,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[t.jsx(gi,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),t.jsx(E,{variant:"body1",sx:{opacity:.5},children:s("studio.videoDialogNoSrc")})]})})}ut.propTypes={url:d.string.isRequired,style:d.object,controls:d.number,modestbranding:d.number};ut.defaultProps={style:{},controls:1,modestbranding:1};function Ln({setParams:e,onClose:o,params:n}){const{t:r}=J(),[s,l]=R.useState(""),i=s&&n.blockletVideos.includes(s),a=ji(s),c=()=>{e(f=>{const h=[...f.blockletVideos];return h.push(s),{...f,blockletVideos:h}}),o()};return t.jsxs(_t,{open:!0,fullWidth:!0,maxWidth:"sm",children:[t.jsx(Qo,{children:r("studio.videoDialogTitle")}),t.jsxs(Yo,{children:[t.jsx(Qn,{fullWidth:!0,value:s,onChange:f=>l(f.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:s?t.jsx(Be,{position:"end",children:t.jsx(oe,{onClick:()=>l(""),children:t.jsx(ms,{})})}):null,error:i}),i&&t.jsx(E,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),t.jsx(ut,{url:s,style:{marginTop:"20px",borderRadius:"4px"}})]}),t.jsxs(Zo,{children:[t.jsx(Q,{onClick:()=>o(),children:r("studio.cancel")}),t.jsx(Q,{disabled:!a||i,onClick:c,children:r("studio.confirm")})]})]})}Ln.propTypes={onClose:d.func.isRequired,params:d.object.isRequired,setParams:d.func.isRequired};const Eo=R.lazy(()=>tn(()=>import("./index-BDfZ8xEV.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.Uploader})));function qn({projectId:e,readOnly:o,loading:n,blocklet:r,params:s,setParams:l,paramsErrTip:i,setParamsErrTip:a,setLoading:c,initUrl:f,initLogoUrl:h,setInitLogoUrl:x,componentDid:b}){const{t:p}=J(),{api:v}=be(),C=Dt(),D=R.useRef(null),j=R.useRef(null),[m,T]=ur(r),[L,I]=R.useState(!1),y=Is({messageType:"connect-store-message",onOpen:()=>c(!0),onClose:()=>c(!1)}),_=async w=>{const $=setTimeout(()=>{c(!1)},2e4),q=await fr(v,w);c(!1),clearTimeout($),window.parent.postMessage({event:"studioDialog.connected",componentDid:b},"*"),C(window.location.pathname.replace(`${H.UNOWNED_DID}/create`,`${q}/create`),{replace:!0})},A=()=>{if(!s.blockletTitle){V.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(m!=null&&m.url)){V.error(p("blocklet.publish.noStoreSelected"));return}const w=pr();y(async($,q)=>{var U,G,ee;try{const X=await v.connectByStudio({input:{did:(U=r==null?void 0:r.meta)==null?void 0:U.did,blockletTitle:s==null?void 0:s.blockletTitle,storeUrl:m.url,storeId:m.id,storeName:m.name,type:((G=s==null?void 0:s.blockletComponents)==null?void 0:G.length)>0?"pack":"resource",componentDid:b,messageId:w,tenantScope:(f==null?void 0:f.searchParams.get("tenantScope"))||""}});if(!(X!=null&&X.url)){V.error("failed to connect to store");return}q(X.url),_({did:(ee=r==null?void 0:r.meta)==null?void 0:ee.did,projectId:"",messageId:w})}catch(X){const ne=Re(X);V.error(ne),c(!1)}})},W=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/logo/upload`,k=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/screenshot/upload`,S=s!=null&&s.blockletLogo?`${W}/${s.blockletLogo}`:`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,g=((s==null?void 0:s.blockletScreenshots)||[]).filter(Boolean).map(w=>`${k}/${w}`),P=()=>o?!1:!e||e===H.UNOWNED_DID?(V.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,O=w=>{if(!w.destination)return;const $=Array.from(s.blockletScreenshots),[q]=$.splice(w.source.index,1);$.splice(w.destination.index,0,q),l(U=>({...U,blockletScreenshots:$}))},F=w=>{if(!w.destination)return;const $=Array.from(s.blockletVideos),[q]=$.splice(w.source.index,1);$.splice(w.destination.index,0,q),l(U=>({...U,blockletVideos:$}))};return t.jsxs(ki,{children:[t.jsx(u,{display:"flex",className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:s.blockletTitle||"",onChange:w=>{a({blockletTitle:""}),l({blockletTitle:w.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||""}),t.jsx(Y,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:e===H.UNOWNED_DID&&t.jsx(Be,{position:"end",children:t.jsx(Zt,{blocklet:r,store:m,componentDid:b,onChangeStore:T,disabled:!s.blockletTitle||o||n,loading:n,onClick:A})})},error:!!i.projectId,helperText:i.projectId||"",value:e===H.UNOWNED_DID?"":`did:abt:${e}`,sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletDescription||"",onChange:w=>{a({blockletDescription:""}),l({blockletDescription:w.target.value})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletHomepage||"",onChange:w=>{w.target.value&&!/^(http|https):\/\//.test(w.target.value)?a({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletHomepage:""}),l({blockletHomepage:w.target.value})},error:!!i.blockletHomepage,helperText:i.blockletHomepage||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletCommunity||"",onChange:w=>{w.target.value&&!/^(http|https):\/\//.test(w.target.value)?a({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletCommunity:""}),l({blockletCommunity:w.target.value})},error:!!i.blockletCommunity,helperText:i.blockletCommunity||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletSupport||"",onChange:w=>{w.target.value&&!/^(http|https):\/\//.test(w.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(w.target.value)?a({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):a({blockletSupport:""}),l({blockletSupport:w.target.value})},error:!!i.blockletSupport,helperText:i.blockletSupport||"",sx:{mt:3}}),t.jsx(Y,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.blockletRepository||"",onChange:w=>{w.target.value&&!/^(git|https|svn)/.test(w.target.value)?a({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):a({blockletRepository:""}),l({blockletRepository:w.target.value})},error:!!i.blockletRepository,helperText:i.blockletRepository||"",sx:{mt:3}})]})}),t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(u,{sx:{flex:1},children:[t.jsxs(u,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ke,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),t.jsxs(ke,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.type"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),t.jsx(u,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:t.jsx(Wo,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:h||S,onClick:()=>{var w;P()&&((w=D.current)==null||w.open())}})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ke,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),t.jsxs(ke,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{sx:{border:"none"},variant:"outlined",size:"small",children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(go,{onDragEnd:o?void 0:O,children:t.jsx(jo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(w,$)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:$.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:$.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:w.innerRef,...w.droppableProps,children:[g.map((q,U)=>t.jsx(ko,{draggableId:q,index:U,isDragDisabled:o,children:(G,ee)=>t.jsxs(u,{ref:G.innerRef,...G.draggableProps,className:"screenshot",sx:{transform:ee.isDragging?"scale(1.05)":"none",boxShadow:ee.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx("img",{alt:"screenshot",src:q}),!o&&t.jsx(oe,{...G.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(kt,{})}),!o&&t.jsx(oe,{className:"action",onClick:()=>{l(X=>{const ne=[...X.blockletScreenshots];return ne.splice(U,1),{...X,blockletScreenshots:ne}})},children:t.jsx(yo,{})})]})},q)),w.placeholder,g.length<5&&t.jsx(u,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var q;P()&&((q=j.current)==null||q.open())},children:"+"})]})})})]}),t.jsxs(u,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[t.jsxs(ke,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[t.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),t.jsxs(ke,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.videoType"),":"," "]}),t.jsxs(u,{component:"span",sx:{color:"#007ec6"},children:[t.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",t.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&t.jsx(u,{children:t.jsxs(u,{component:"span",children:[t.jsxs(u,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),t.jsx(u,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),t.jsx(go,{onDragEnd:o?void 0:F,children:t.jsx(jo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(w,$)=>t.jsxs(u,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:$.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:$.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:w.innerRef,...w.droppableProps,children:[s.blockletVideos.map((q,U)=>t.jsx(ko,{draggableId:q,index:U,isDragDisabled:o,children:(G,ee)=>t.jsxs(u,{ref:G.innerRef,...G.draggableProps,className:"screenshot",sx:{transform:ee.isDragging?"scale(1.05)":"none",boxShadow:ee.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[t.jsx(ut,{url:q,style:{pointerEvents:ee.isDragging?"none":"auto"}}),!o&&t.jsx(oe,{...G.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:t.jsx(kt,{})}),!o&&t.jsx(oe,{className:"action",onClick:()=>{l(X=>{const ne=[...X.blockletVideos];return ne.splice(U,1),{...X,blockletVideos:ne}})},children:t.jsx(yo,{})})]})},q)),w.placeholder,s.blockletVideos.length<3&&t.jsx(u,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{P()&&I(!0)},children:"+"})]})})})]})]})}),t.jsxs(R.Suspense,{fallback:t.jsx(Ve,{}),children:[t.jsx(Eo,{ref:D,popup:!0,onUploadFinish:w=>{var $;l({blockletLogo:w.data.filename}),x(""),($=D.current)==null||$.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:W,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","application/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),L&&t.jsx(Ln,{onClose:()=>I(!1),params:s,setParams:l}),t.jsx(Eo,{ref:j,popup:!0,onUploadFinish:w=>{var $;l(q=>{var G;const U=q.blockletScreenshots||[];return U.push((G=w.data)==null?void 0:G.filename),{...q,blockletScreenshots:U}}),($=j.current)==null||$.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:k,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-g.length}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}qn.propTypes={projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired,blocklet:d.object.isRequired,setLoading:d.func.isRequired,initUrl:d.object.isRequired,componentDid:d.isRequired,initLogoUrl:d.string.isRequired,setInitLogoUrl:d.func.isRequired};const ki=ae.div`
|
|
133
|
-
margin-top: 24px;
|
|
134
|
-
.screenshot {
|
|
135
|
-
margin-bottom: 16px;
|
|
136
|
-
max-width: 240px;
|
|
137
|
-
max-height: 135px;
|
|
138
|
-
width: 240px;
|
|
139
|
-
height: 135px;
|
|
140
|
-
overflow: hidden;
|
|
141
|
-
display: flex;
|
|
142
|
-
align-items: center;
|
|
143
|
-
justify-content: center;
|
|
144
|
-
background-color: #eee;
|
|
145
|
-
margin-right: 16px;
|
|
146
|
-
position: relative;
|
|
147
|
-
.action {
|
|
148
|
-
visibility: hidden;
|
|
149
|
-
position: absolute;
|
|
150
|
-
width: 42px;
|
|
151
|
-
height: 42px;
|
|
152
|
-
right: 6px;
|
|
153
|
-
top: 6px;
|
|
154
|
-
border-radius: 4px;
|
|
155
|
-
background-color: rgba(0, 0, 0, 1);
|
|
156
|
-
color: rgba(255, 255, 255, 1);
|
|
157
|
-
}
|
|
158
|
-
&:hover .action {
|
|
159
|
-
visibility: visible;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
.screenshot img {
|
|
163
|
-
width: 100%; /* 图像宽度填充容器 */
|
|
164
|
-
height: auto; /* 图像高度自适应 */
|
|
165
|
-
}
|
|
166
|
-
`;var io={},yi=me;Object.defineProperty(io,"__esModule",{value:!0});var $n=io.default=void 0,vi=yi(xe()),wi=t;$n=io.default=(0,vi.default)((0,wi.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l4.65-4.65c.2-.2.51-.2.71 0L17 13z"}),"CloudUploadRounded");const Ci=(e,o,n,r)=>{const s=e?[...e]:[],l=((o==null?void 0:o.children)||[]).reduce((i,a)=>(i[a.meta.did]=!0,i),{});return Object.keys(n).forEach(i=>{if(!l[i])return;let a=!1;r||s.forEach(c=>{c.did===i&&(c.included=!0,c.required=!0,a=!0)}),a||s.push({did:i,included:!0,required:!0})}),s},Si=async e=>{if(typeof e!="string")throw new Error("URL must be a string");try{const o=e.split("/").pop().split("?")[0],r=await(await fetch(e)).blob();return new File([r],o,{type:r.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*Ri(e,o){let n=0;for(;n<e.size;)yield e.slice(n,n+o),n+=o}const Ii=async({did:e,projectId:o,uploadType:n="logo",imageUrl:r})=>{const s=await Si(r);new FormData().append("file",s);const i={uploaderId:"Uploader",relativePath:encodeURIComponent(s.name),name:encodeURIComponent(s.name),type:s.type},c=(await bo.post(ce(H.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project",e,o,n,"upload"),null,{headers:{"Tus-Resumable":"1.0.0","Upload-Length":s.size,"X-Uploader-File-Ext":s.name.split(".").pop(),"Upload-Metadata":Object.keys(i).map(b=>`${b} ${btoa(i[b])}`).join(",")}})).headers.location,f=2*1024*1024;let h=0,x="";for(const b of Ri(s,f)){const p=await bo.patch(ce(H.WELLKNOWN_SERVICE_PATH_PREFIX,c),b,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":h,"Content-Type":"application/offset+octet-stream"}});h+=b.size,x=p.data.filename}return x},Nn=({params:e,projectId:o,status:n,t:r})=>{const s=[];return e.blockletTitle||s.push({param:"blockletTitle",message:r("blocklet.publish.errorTip.noTitle")}),(!o||o===H.UNOWNED_DID)&&s.push({param:"projectId",message:r("blocklet.publish.errorTip.noDid")}),e.blockletVersion?Se.valid(e.blockletVersion)||s.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.inValidVersion")}):s.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.noVersion")}),n===re.PROJECT.RELEASE_STATUS.published&&(e.blockletDescription||s.push({param:"blockletDescription",message:r("blocklet.publish.errorTip.noDescription")}),e.note||s.push({param:"note",message:r("blocklet.publish.errorTip.noNote")})),s.length?s:null},Di=({params:e,step:o,t:n,projectId:r})=>{if(o===0){if(!e.blockletTitle)return n("blocklet.publish.errorTip.noTitle");if(!r||r===H.UNOWNED_DID)return n("blocklet.publish.errorTip.noDid");if(!e.blockletDescription)return n("blocklet.publish.errorTip.noDescription")}if(o>=4){if(!e.blockletVersion)return n("blocklet.publish.errorTip.noVersion");if(!Se.valid(e.blockletVersion))return n("blocklet.publish.errorTip.inValidVersion");if(!e.note)return n("blocklet.publish.errorTip.noNote")}return""};function lo({blocklet:e,releaseId:o,connectedStores:n,projectId:r,releaseType:s,publishedStoreIds:l,onPublish:i,onDelete:a,projectType:c,componentDid:f,onOpenConnectStore:h,behavior:x,onSelectConnectStore:b}){var T,L;const{t:p}=J(),{actions:{refreshBlocklet:v}}=De(),{session:C}=ct(),{storeList:D}=hn({fromBlocklet:!0,blocklet:e,componentDid:f,userDid:(T=C==null?void 0:C.user)==null?void 0:T.did}),j=R.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((I,y)=>(I[y.storeId]=y,I),{}):{},[n]),m=(L=e==null?void 0:e.meta)==null?void 0:L.did;return t.jsxs(t.Fragment,{children:[x==="connect"&&!!(D!=null&&D.length)&&t.jsx(Fo,{severity:"info",style:{width:"100%"},children:t.jsxs(u,{color:Yn[400],component:"a",href:c==="pack"?"https://www.arcblock.io/docs/blocklet-developer/en/5PXToZve-5IXAN1bc8rkpxAc":"https://www.arcblock.io/docs/blocklet-developer/en/hB5VWLfg9VnbWsL1JGLuLUfW",target:"_blank",display:"flex",alignItems:"center",rel:"noreferrer",children:[p(c==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),t.jsx(Ns,{sx:{marginLeft:1}})]})}),t.jsx(Zn,{children:D==null?void 0:D.map(I=>t.jsx(Kn,{"data-cy":"store-switch",children:t.jsx(es,{children:t.jsx(Ds,{behavior:x,onSelectConnectStore:b,releaseId:o,projectId:r,releaseType:s,kind:"publish",teamDid:m,store:I,published:(l==null?void 0:l.indexOf(I.id))>-1,connectedStore:j[I.id],onPublish:i,onDelete:a,scope:I.scope||"studio",onOpenConnectStore:h})})},I.url))}),t.jsx(rn,{teamDid:m,storeList:D,scope:"studio",onAdd:v})]})}lo.propTypes={blocklet:d.object.isRequired,projectId:d.string.isRequired,releaseId:d.string.isRequired,releaseType:d.string.isRequired,onPublish:d.func,onDelete:d.func,publishedStoreIds:d.arrayOf(d.string),connectedStores:d.arrayOf(d.object).isRequired,projectType:d.string,componentDid:d.string,onOpenConnectStore:d.func,onSelectConnectStore:d.func,behavior:d.string};lo.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};function An({did:e,params:o,setParams:n,projectId:r,open:s,onClose:l}){const{t:i}=J(),[a,c]=R.useState(!1),{api:f}=be(),[h,x]=R.useState(!1),[b,p]=R.useState(!1),v=()=>{x(o.autoUpload),p(o.possibleSameStore),c(!1),l(!1)},C=async()=>{c(!0);try{await f.updateProject({input:{did:e,projectId:r,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!h,possibleSameStore:!!b}}),n({autoUpload:h,possibleSameStore:b}),l(!1)}catch(j){V.error(j.message)}c(!1)};R.useEffect(()=>{x(o.autoUpload),p(o.possibleSameStore)},[o]);const D=!!(r&&r!==H.UNOWNED_DID);return t.jsx(Lt,{title:i("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:s,onClose:v,actions:t.jsxs(t.Fragment,{children:[t.jsx(Q,{onClick:j=>{j.stopPropagation(),l()},color:"inherit",children:i("common.cancel")}),D&&t.jsxs(Q,{onClick:j=>{j.stopPropagation(),C()},color:"primary","data-cy":"install-blocklet-next-step",disabled:a,variant:"contained",autoFocus:!0,children:[a&&t.jsx(et,{size:16}),i("common.confirm")]})]}),children:D?t.jsxs(u,{component:"label",sx:{display:"flex",flexDirection:"column",gap:2},children:[t.jsxs(u,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[t.jsx(u,{component:se,icon:"ph:upload",sx:{fontSize:24,mr:2}}),t.jsx(E,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.autoUploadTip")}),t.jsx(ye,{checked:h,onChange:(j,m)=>x(m)})]}),t.jsxs(u,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[t.jsx(u,{component:se,icon:"fluent-mdl2:merge-duplicate",sx:{fontSize:24,mr:2}}),t.jsx(E,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.possibleSameStoreTip")}),t.jsx(ye,{checked:b,onChange:(j,m)=>p(m)})]})]}):t.jsxs(u,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[t.jsx(u,{component:se,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),t.jsx(E,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.needProjectId")})]})})}An.propTypes={did:d.string.isRequired,params:d.object.isRequired,open:d.bool.isRequired,onClose:d.func.isRequired,setParams:d.func.isRequired,projectId:d.string.isRequired};function En({downloadUrl:e,installUrl:o,handleSetTip:n,isPack:r,disabled:s}){const{t:l}=J(),[i,a]=R.useState(!1),c=R.useRef(null),f=()=>{a(!i)},h=x=>{c.current&&c.current.contains(x.target)||a(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(Q,{disabled:s,ref:c,onClick:f,children:t.jsx(u,{component:se,sx:{fontSize:18},icon:"bxs:download"})}),t.jsx(Ho,{sx:{zIndex:10},open:i,anchorEl:c.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:x})=>t.jsx(Go,{...x,style:{transformOrigin:"center top"},children:t.jsx(Tt,{children:t.jsx(Xo,{onClickAway:h,children:t.jsxs(Jo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[r&&t.jsx(u,{component:"a",href:o,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:t.jsxs(pe,{sx:{color:"#333"},children:[t.jsx(u,{component:se,sx:{mr:1},icon:"ic:round-install-desktop"}),t.jsx(E,{variant:"inherit",children:l("blocklet.publish.installToThisServer")})]})}),t.jsxs(pe,{onClick:n,children:[t.jsx(u,{component:se,sx:{mr:1},icon:"iconamoon:copy"}),t.jsx(E,{variant:"inherit",children:l("blocklet.publish.copyInstallUrl")})]}),t.jsx(u,{component:"a",href:e,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:t.jsxs(pe,{sx:{color:"#333"},children:[t.jsx(u,{component:se,sx:{mr:1},icon:"ph:download"}),t.jsx(E,{variant:"inherit",children:l("common.download")})]})})]})})})})})]})}En.propTypes={disabled:d.bool.isRequired,isPack:d.bool.isRequired,downloadUrl:d.string.isRequired,installUrl:d.string.isRequired,handleSetTip:d.func.isRequired};var Vo;const Mo=(Vo=window.env)==null?void 0:Vo.serverEndpoint;function Mn({projectId:e,params:o,setParamsErrTip:n,initUrl:r,setParams:s,mode:l,loading:i,blocklet:a,release:c,isPublished:f,releaseId:h,getData:x,getRelease:b,paramsErrTip:p,componentDid:v,resourceRelateComponents:C,disabledSelectComponents:D,saveSelectedEventsRef:j,hasSelectedResources:m,initLogoUrl:T,setLoading:L,releaseUsedLast:I,setReleaseUsedLast:y,projectType:_}){var we;const{t:A,locale:W}=J(),{api:k}=be(),S=Dt(),[g,P]=R.useState(!1),[O,F]=R.useState(!1),[w,$]=R.useState(),q=ze(Z=>Z.breakpoints.down("md")),U=R.useMemo(()=>{var Z;return o!=null&&o.blockletResourceType?o==null?void 0:o.blockletResourceType:((Z=o==null?void 0:o.blockletComponents)==null?void 0:Z.length)>0?(o==null?void 0:o.blockletComponents.find(z=>z.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),G=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:v},"*"),b()},ee=async Z=>{var Le,Fe,qe,$e;if(p!=null&&p.blockletHomepage||p!=null&&p.blockletSupport||p!=null&&p.blockletCommunity){V.error((p==null?void 0:p.blockletHomepage)||(p==null?void 0:p.blockletSupport)||(p==null?void 0:p.blockletCommunity));return}const de=Nn({params:o,hasSelectedResources:m,projectId:e,status:Z,t:A});if(de){V.error(de.map(B=>B.message).join("; ")),n(de.reduce((B,K)=>({...B,[K.param]:K.message}),{}));return}const z={...o};if(z.blockletComponents=Ci(z.blockletComponents,a,C,D),z.blockletVersion=Se.valid(z.blockletVersion),!z.blockletVersion){V.error("Invalid Blocklet Version"),n({blockletVersion:"Invalid Blocklet Version"});return}if(T)try{const B=await Ii({did:a.meta.did,projectId:e,imageUrl:T});z.blockletLogo=B,s({blockletLogo:B})}catch(B){V.error(B.message);return}if(o.resourceFromSelect){z.uploadedResource="";try{const B=Object.keys(j.current);await nt(B.map(K=>()=>{const ie=j.current[K];return rr({api:k,locale:W,projectId:e,releaseId:I?"":h,appDid:a.meta.did,component:ie.component,resources:ie.resources,initUrl:r})}),{concurrency:2})}catch(B){V.error(((qe=(Fe=(Le=B==null?void 0:B.response)==null?void 0:Le.data)==null?void 0:Fe.error)==null?void 0:qe.message)||B.message),n({blockletResource:"Invalid save the resource"});return}}else($e=o.blockletDocker)!=null&&$e.dockerImage||(z.blockletComponents=[]);z.blockletTitle=(z.blockletTitle||"").trim(),z.blockletDescription=(z.blockletDescription||"").trim(),z.blockletSupport=(z.blockletSupport||"").trim(),z.blockletHomepage=(z.blockletHomepage||"").trim(),z.blockletCommunity=(z.blockletCommunity||"").trim(),z.blockletRepository=(z.blockletRepository||"").trim(),z.blockletIntroduction=(z.blockletIntroduction||"").trim(),z.note=(z.note||"").trim(),z.blockletComponents=((z==null?void 0:z.blockletComponents)||[]).filter(B=>B.included).map(B=>At(B,["did","required"])).map(JSON.stringify),z.contentType!=="docker"&&(z.blockletDocker={dockerImage:"",dockerArgs:[],dockerEnvs:[]});try{await k.createRelease({input:{...z,did:a.meta.did,projectId:e,releaseId:I?"":h,status:Z}}),Z==="draft"?V.success(A("blocklet.publish.saveDraftSuccess")):(y(!1),V.success(A("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:v},"*")),n({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(B){const K=Re(B);V.error(K),(/resource/.test(K)||/zip/.test(K))&&n({blockletResource:K});return}const Ue=await k.getProject({input:{did:a.meta.did,projectId:e}}),Pe=Ue.project.lastReleaseId;o.autoUpload&&await nt(Ue.project.connectedStores.map(B=>async()=>{try{const K=await k.publishToStore({input:{did:a.meta.did,storeId:B.storeId,storeName:B.storeName,projectId:e,releaseId:Pe,type:U}});V.success(t.jsx(Ts,{storeName:B.storeName,storeUrl:B.storeUrl,developerDid:B.developerDid,published:K.url==="published"}),{duration:1e4})}catch(K){V.error(Re(K))}}),{concurrency:4}),G==null||G(),S(`../${e}/view/${Pe}`,{replace:!0})},X=Z=>(L(!0),ee(Z).finally(()=>{L(!1)})),ne=async Z=>{await hr(k,Z),x()},Te=()=>{F(!0)},We=ce(Mo,`/api/project/${a.meta.did}/${e}/${h}/release/blocklet.json`),ge=new URL(Mo);ge.pathname=ce(ge.pathname,"/launch-blocklet/agreement"),ge.searchParams.set("blocklet_meta_url",We);const te=ge.href,_e=()=>$(We);return t.jsxs(t.Fragment,{children:[t.jsx(Ti,{className:"sticky-header",children:t.jsxs(u,{display:"flex",alignItems:"center",flexDirection:"row",children:[t.jsxs(Uo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[t.jsx(le,{to:"../",children:A("common.blockletStudio")}),e===H.UNOWNED_DID?t.jsx(E,{color:"text.primary",children:t.jsx(fe,{maxLength:q?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):t.jsx(le,{to:`../${e}`,children:t.jsx(fe,{maxLength:q?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),t.jsx(E,{color:"text.primary",children:l==="create"?A("common.create"):(o==null?void 0:o.blockletVersion)||A("common.edit")})]}),t.jsx(u,{flex:"1"}),!f&&t.jsxs(jt,{disabled:i,variant:"contained",children:[t.jsxs(Q,{variant:"contained",onClick:()=>X(re.PROJECT.RELEASE_STATUS.published),children:[i&&t.jsx(et,{size:14,sx:{mr:.5},color:"inherit"}),A("blocklet.publish.createRelease")]}),t.jsx(Q,{variant:"contained",onClick:Te,children:t.jsx(se,{icon:"mage:settings-fill",fontSize:"16px"})})]}),f&&t.jsxs(t.Fragment,{children:[t.jsx(_t,{fullWidth:!0,maxWidth:"sm",open:w,onClose:()=>$(""),children:t.jsxs(u,{sx:{py:5,px:4,wordBreak:"break-all"},children:[t.jsx(E,{variant:"h6",sx:{mb:2},children:A("blocklet.publish.installResourceTip")}),t.jsx($s,{children:w}),t.jsxs(E,{sx:{mt:2},children:[A("blocklet.publish.installResourceTip2"),t.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/R3weqCy7WPI8ggudt0C2alWv",target:"_blank",rel:"noreferrer",children:A("blocklet.publish.installResourceHelp")})]})]})}),t.jsxs(jt,{disabled:i,variant:"contained",children:[t.jsxs(Q,{onClick:()=>P(!0),children:[i?t.jsx(et,{size:14,sx:{mr:1},color:"inherit"}):t.jsx($n,{sx:{fontSize:"1.3em",mr:1}}),A(q?"common.upload":"blocklet.publish.connectOrUpload")]}),t.jsx(En,{isPack:U==="pack",downloadUrl:ce(`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${a.meta.did}/${e}/${h}/download/${(c.files||[])[0]}`),installUrl:te,handleSetTip:_e}),t.jsx(Q,{onClick:Te,children:t.jsx(se,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})}),t.jsx(Lt,{title:A("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:g,onClose:()=>P(!1),children:t.jsx(lo,{projectType:_,blocklet:a,releaseType:U,projectId:e,releaseId:h,componentDid:v,onPublish:G,onOpenConnectStore:ne,onDelete:x,connectedStores:o.connectedStores||[],publishedStoreIds:c==null?void 0:c.publishedStoreIds})}),t.jsx(An,{did:(we=a==null?void 0:a.meta)==null?void 0:we.did,params:o,projectId:e,open:O,setParams:s,onClose:()=>F(!1)})]})}Mn.propTypes={projectId:d.string.isRequired,params:d.object.isRequired,mode:d.string.isRequired,loading:d.bool.isRequired,blocklet:d.object.isRequired,release:d.object.isRequired,isPublished:d.bool.isRequired,releaseId:d.string.isRequired,getData:d.func.isRequired,getRelease:d.func.isRequired,componentDid:d.string.isRequired,resourceRelateComponents:d.object.isRequired,disabledSelectComponents:d.bool.isRequired,saveSelectedEventsRef:d.object.isRequired,hasSelectedResources:d.bool.isRequired,initLogoUrl:d.string.isRequired,setLoading:d.func.isRequired,releaseUsedLast:d.bool.isRequired,setReleaseUsedLast:d.func.isRequired,projectType:d.string.isRequired,setParamsErrTip:d.func.isRequired,setParams:d.func.isRequired,initUrl:d.object.isRequired,paramsErrTip:d.object.isRequired};const Ti=ae.div`
|
|
167
|
-
.sticky-header {
|
|
168
|
-
margin-top: -12px;
|
|
169
|
-
padding: 12px 0;
|
|
170
|
-
position: sticky;
|
|
171
|
-
top: 0;
|
|
172
|
-
z-index: 99;
|
|
173
|
-
display: flex;
|
|
174
|
-
align-items: center;
|
|
175
|
-
justify-content: space-between;
|
|
176
|
-
background-color: #fff;
|
|
177
|
-
padding-bottom: 12px;
|
|
178
|
-
border-bottom: ${({theme:e})=>`1px solid ${e.palette.divider}`};
|
|
179
|
-
}
|
|
180
|
-
`;function On({text:e}){return e?t.jsx(As,{wrapperElement:{"data-color-mode":"light"},source:bs.sanitize(e),rehypePlugins:[[Es,{target:"_blank"}]]}):t.jsx(Ie,{Icon:Mt})}On.propTypes={text:d.string.isRequired};function zn({params:e,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:s,readOnly:l}){var h;const{t:i}=J(),[a,c]=R.useState(l?"preview":"write"),f=(x,b)=>{c(b)};return t.jsxs(u,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[t.jsxs(u,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[t.jsx(E,{variant:"h6",fontWeight:"bold",sx:{},children:i("common.introduction")}),t.jsxs(Ko,{value:a,onChange:f,"aria-label":"wrapped label tabs example",children:[t.jsx(tt,{value:"write",label:"Write"}),t.jsx(tt,{value:"preview",label:"Preview"})]})]}),t.jsx(u,{display:a==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:t.jsx(Y,{disabled:r||l,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:l,endAdornment:t.jsxs(Be,{position:"end",children:[((h=e==null?void 0:e.blockletIntroduction)==null?void 0:h.length)||0," / ",re.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:e.blockletIntroduction||"",onChange:x=>{s({blockletIntroduction:""}),o({blockletIntroduction:x.target.value.slice(0,re.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),t.jsx(u,{display:a==="preview"?"block":"none",mt:3,children:t.jsx(On,{text:e.blockletIntroduction||""})})]})}zn.propTypes={params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,readOnly:d.bool.isRequired,loading:d.bool.isRequired};var co={},_i=me;Object.defineProperty(co,"__esModule",{value:!0});var Bn=co.default=void 0,Pi=_i(xe()),Oo=t;Bn=co.default=(0,Pi.default)([(0,Oo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Oo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function ao({step:e,ok:o,active:n,error:r}){let s="grey.500",l=e+1;return o&&(l=t.jsx(Ms,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>e?(s="error.main",l=t.jsx(Bn,{sx:{fontSize:18,margin:0},color:"white"})):n>=e&&(s="primary.main"),t.jsx(u,{width:24,height:24,bgcolor:s,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:l})}ao.propTypes={step:d.number,ok:d.bool,active:d.number,error:d.string};ao.defaultProps={step:0,ok:!1,active:0,error:""};function Vn({steps:e,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:s,loading:l,paramsErrTip:i,viewMode:a,projectId:c}){const{t:f}=J(),h=()=>{n(v=>v+1)},x=()=>{n(v=>v-1)},b=v=>v===0?(i==null?void 0:i.blockletTitle)||(i==null?void 0:i.projectId)||(i==null?void 0:i.blockletDescription)||(i==null?void 0:i.blockletHomepage)||(i==null?void 0:i.blockletSupport)||(i==null?void 0:i.blockletCommunity)||(i==null?void 0:i.blockletRepository):v===2?(i==null?void 0:i.blockletResource)||(i==null?void 0:i.blockletDocker)||(i==null?void 0:i.dockerImageName):v>=4?(i==null?void 0:i.blockletVersion)||(i==null?void 0:i.note):"",p=a||Nn({hasSelectedResources:r,params:s,projectId:c,t:f})===null;return t.jsxs(u,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[t.jsx(ts,{activeStep:o,orientation:"vertical",children:e.map((v,C)=>{const D={},j=l||!Di({hasSelectedResources:r,params:s,projectId:c,step:C,t:f}),m=l?"":b(C);return m&&(D.optional=t.jsx(E,{variant:"caption",color:"error",children:m}),D.error=!0),t.jsxs(os,{children:[t.jsx(ns,{icon:t.jsx(ao,{error:m,active:p?99:o,step:C,ok:j}),sx:{cursor:"pointer",color:m?"error.main":"inherit"},disabled:!1,onClick:()=>n(C),...D,children:t.jsx(E,{fontSize:"14px",fontWeight:"500",color:m||!j&&o>C?"error.main":"inherit",children:v.label})}),t.jsxs(ss,{children:[t.jsx(E,{fontSize:12,children:v.description}),!p&&t.jsx(u,{sx:{mb:2},children:t.jsxs("div",{children:[C<e.length-1&&t.jsx(Q,{variant:"contained",onClick:h,sx:{mt:1,mr:1},disabled:m||!j,children:f("common.continue")}),C>0&&t.jsx(Q,{disabled:C===0,onClick:x,sx:{mt:1,mr:1},children:f("common.back")})]})})]})]},v.label)})}),o>=e.length-1&&t.jsx(Tt,{square:!0,elevation:0,sx:{p:3},children:t.jsx(E,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}Vn.propTypes={steps:d.array.isRequired,activeStep:d.number.isRequired,setActiveStep:d.func.isRequired,params:d.object.isRequired,viewMode:d.string.isRequired,loading:d.bool.isRequired,projectId:d.string.isRequired,hasSelectedResources:d.bool.isRequired,paramsErrTip:d.shape({projectId:d.string,blockletVersion:d.string,blockletTitle:d.string,blockletDescription:d.string,note:d.string,blockletResource:d.string,blockletHomepage:d.string,blockletSupport:d.string,blockletCommunity:d.string,blockletRepository:d.string,blockletDocker:d.object,dockerImageName:d.string}).isRequired};const Li=[".zip",".gz"],qi=1024*1024*100,$i=R.lazy(()=>tn(()=>import("./index-BDfZ8xEV.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.Uploader})));function uo({app:e,projectId:o,readOnly:n,params:r,setParams:s,setParamsErrTip:l,error:i}){const{t:a}=J(),c=R.useRef(null),f=()=>n?!1:!o||o===H.UNOWNED_DID?(V.error(a("blocklet.publish.errorTip.noFirstDid")),!1):!0,h=`${H.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e.meta.did}/${o}/resource/upload`;return t.jsxs(u,{sx:{mt:3},children:[t.jsx(E,{gutterBottom:!0,children:a("blocklet.publish.resourceUpload")}),t.jsxs(ke,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!r.uploadedResource&&t.jsx(E,{component:"a",href:`${h}/params.uploadedResource`,children:r.uploadedResource}),!n&&t.jsx(Q,{variant:"outlined",size:"small",onClick:()=>{var x;f()&&((x=c.current)==null||x.open())},children:r.uploadedResource?a("common.change"):a("common.upload")})]}),t.jsx(R.Suspense,{fallback:t.jsx(Ve,{}),children:t.jsx($i,{ref:c,popup:!0,onUploadFinish:x=>{var b;s({uploadedResource:x.data.filename}),l({blockletResource:""}),(b=c.current)==null||b.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:h,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Li,maxFileSize:qi,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:i})]})}uo.propTypes={app:d.object.isRequired,projectId:d.string.isRequired,readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,error:d.string.isRequired,setParamsErrTip:d.func.isRequired};uo.defaultProps={};function rt({readOnly:e,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:s,loading:l}){var a;const{t:i}=J();return t.jsx(u,{display:"flex",mt:3,className:"section",children:t.jsxs(u,{sx:{flex:1},children:[t.jsx(Y,{required:!0,disabled:l||e,label:`Blocklet ${i("common.version")}`,placeholder:`Blocklet ${i("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:c=>{s({blockletVersion:""}),n({blockletVersion:c.target.value})},error:!!r.blockletVersion,helperText:r.blockletVersion||""}),t.jsx(Y,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:l||e,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:e,endAdornment:t.jsxs(Be,{position:"end",children:[((a=o==null?void 0:o.note)==null?void 0:a.length)||0," / ",re.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:c=>{s({note:""}),n({note:c.target.value.slice(0,re.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}rt.propTypes={readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,paramsErrTip:d.object.isRequired,setParamsErrTip:d.func.isRequired,loading:d.bool.isRequired};rt.defaultProps={};function Wn(e){for(const o in e)typeof e[o]=="string"?e[o]=e[o].replace(/\\\\/g,"\\"):typeof e[o]=="object"&&e[o]!==null&&Wn(e[o]);return e}function it({index:e,item:o,dockerParams:n,setDockerParams:r,dataKey:s,t:l,readOnly:i}){const a=(o==null?void 0:o.value)||"",[c,f]=R.useState(!1),h=()=>{var k;(k=n[s])==null||k.splice(e,1),r({...n,[s]:[...n[s]]})},x=(k,S)=>{var g;(g=n[s])!=null&&g[e]&&(S?(n[s][e].custom=n[s][e].value,n[s][e].value=`$${ht(o.key)}`):(n[s][e].value=n[s][e].custom||"",n[s][e].custom="")),r({...n,[s]:[...n[s]]})},b=(k,S)=>{var P;const g=((P=n[s][e])==null?void 0:P.value)||"";n[s][e]={...n[s][e],secure:S,value:S&&g===re.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},r({...n,[s]:[...n[s]]})},p=(k,S)=>{n[s][e]={...n[s][e],shared:S},r({...n,[s]:[...n[s]]})},v=(k,S)=>{var P;const g=((P=n[s][e])==null?void 0:P.value)||"";n[s][e]={...n[s][e],required:S,value:S&&g===re.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},r({...n,[s]:[...n[s]]})},C=(k,S)=>{n[s][e]={...n[s][e],value:S?re.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...n,[s]:[...n[s]]})},D=k=>{n[s][e]={...n[s][e],description:k.target.value},r({...n,[s]:[...n[s]]})},j=k=>{const S=k.target.value==="web"?"web":"docker";S==="web"&&n.dockerArgs.forEach(O=>{O.type="docker"});const P=`/${n.dockerImage.replace(/\W/g,"-")}-${e}`;n.dockerArgs[e]={...n.dockerArgs[e],type:S,path:S==="docker"?P:"/",protocol:"http",prefix:S==="docker"?P:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},m=k=>{const S=k.target.value;n[s][e]={...n[s][e],prefix:S,path:S==="*"?"/":S},r({...n,[s]:[...n[s]]})},T=k=>{var S;(S=n[s])!=null&&S[e]&&(n[s][e].value=k.target.value),r({...n,[s]:[...n[s]]})},L=a===`$${ht(o.key)}`||o.custom,I=s==="dockerArgs"&&!ln[o.key],y=_s[o.key],_=s==="dockerEnvs",A=o.key==="--publish";let W=o.key;return A&&o.type==="web"?W="--publish (Web)":_&&(W=`--env ${o.key}`),t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{width:250},children:t.jsx(E,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:W})}),t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[t.jsx(Y,{disabled:i||L||I||o.value===re.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:L?`$${ht(o.key)}`:a,sx:{flex:1},InputProps:{endAdornment:t.jsxs(Be,{position:"end",sx:{zoom:.9},children:[(!(y||I)||_||A)&&t.jsx(oe,{onClick:()=>f(!0),children:t.jsx(se,{icon:"icon-park-outline:setting-config"})}),!i&&t.jsx(oe,{onClick:h,color:I?"error":"default",children:t.jsx(se,{icon:"ic:round-delete"})})]})},error:I,onChange:T}),I&&t.jsx(E,{variant:"caption",color:"error",children:l("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&t.jsx(E,{variant:"caption",color:"text.secondary",children:l("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Ps[o.key](a)&&t.jsx(E,{variant:"caption",color:"error",children:l("blocklet.publish.docker.volumeTips")})]}),c&&t.jsx(Lt,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:l(_?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[y||I||_?null:t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{children:l("blocklet.publish.docker.needCustomInput")}),t.jsx(ye,{disabled:i,checked:L,onChange:x,sx:{zoom:.9}})]}),_&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{children:l("blocklet.publish.docker.shared")}),t.jsx(ye,{disabled:i,checked:o.shared,onChange:p,sx:{zoom:.9}})]}),_&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{children:l("blocklet.publish.docker.required")}),t.jsx(ye,{disabled:i,checked:o.required,onChange:v,sx:{zoom:.9}})]}),_&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{children:l("blocklet.publish.docker.secure")}),t.jsx(ye,{disabled:i,checked:o.secure,onChange:b,sx:{zoom:.9}})]}),_&&t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{children:l("blocklet.publish.docker.autoGenerated")}),t.jsx(ye,{disabled:i,checked:o.value===re.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:C,sx:{zoom:.9}})]}),_&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{sx:{flex:1},children:l("blocklet.publish.docker.description")}),t.jsx(Y,{disabled:i,value:o.description,onChange:D,sx:{flex:1},label:l("blocklet.publish.docker.description")})]}),A&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{sx:{flex:1},children:l("blocklet.publish.docker.portType")}),t.jsxs(en,{value:o.type||"docker",onChange:j,children:[t.jsx(pe,{value:"docker",children:"Docker"}),t.jsx(pe,{value:"web",children:"Web"})]})]}),A&&o.type==="web"&&t.jsxs(u,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(E,{sx:{flex:1},children:l("blocklet.publish.docker.prefix")}),t.jsx(Y,{disabled:i,value:o.prefix,onChange:m,sx:{flex:1},label:l("blocklet.publish.docker.prefix")})]})]})})]})}it.propTypes={dockerParams:d.object.isRequired,setDockerParams:d.func.isRequired,dataKey:d.string.isRequired,item:d.object.isRequired,t:d.func.isRequired,readOnly:d.bool.isRequired,index:d.number.isRequired};it.defaultProps={};const Ni=`
|
|
181
|
-
docker run --name postgrest
|
|
182
|
-
-p 3000:3000
|
|
183
|
-
-e PGRST_DB_URI="postgres://username:password@host:port/database"
|
|
184
|
-
-e PGRST_DB_SCHEMA="public"
|
|
185
|
-
-e PGRST_DB_ANON_ROLE="anon"
|
|
186
|
-
postgrest/postgrest
|
|
187
|
-
`.trim();function po({readOnly:e,paramsErrTip:o,setParamsErrTip:n,error:r,params:s,setParams:l}){const{t:i}=J(),[a,c]=R.useState("dockerParams"),[f,h]=R.useState(""),[x,b]=R.useState(!1),[p,v]=R.useState("--volume"),[C,D]=R.useState(""),[j,m]=R.useState(vo(f)),T=j.dockerArgs||[],L=j.dockerEnvs||[],I=j.dockerImage||"",y=S=>{const{value:g}=S.target;h(g)};R.useEffect(()=>{s.blockletDocker&&s.blockletDocker.dockerImage&&!I&&m(s.blockletDocker)},[s,I,m]);const _=S=>{const g=vo(S.target.value);m(P=>{let O,F=!1;return g.dockerArgs.forEach(w=>{const $=P.dockerArgs.find(q=>q.key===w.key);$&&(Object.entries($).forEach(([q,U])=>{U!=null&&q!=="value"&&(w[q]=U)}),w.type==="web"&&(w.path="/",w.protocol="http",w.prefix="/",w.name="publicUrl",w.port="BLOCKLET_PORT",F=!0),!O&&w.key==="--publish"&&(O=w))}),!F&&O&&(O.type="web",O.path="/",O.protocol="http",O.prefix="/",O.name="publicUrl",O.port="BLOCKLET_PORT"),g.dockerEnvs.forEach(w=>{const $=P.dockerEnvs.find(q=>q.key===w.key);$&&Object.entries($).forEach(([q,U])=>{U!=null&&q!=="value"&&(w[q]=U)})}),g})},A=()=>{if(b(!1),p==="--env"){m({...j,dockerEnvs:[...L,{key:C,value:"",custom:"",secure:!1,shared:!1,required:!1,description:C}]}),D("");return}m({...j,dockerArgs:[...T,{key:p,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},W=()=>{b(!1),D("")},k=S=>{const{value:g}=S.target;m({...j,dockerImage:g}),g.indexOf(" ")>-1?n({...o,dockerImageName:i("blocklet.publish.docker.dockerImageNameError")}):n({...o,dockerImageName:""})};return R.useEffect(()=>{a==="dockerCommand"&&h(Ls(j))},[j,a]),R.useEffect(()=>{l(S=>({...S,blockletDocker:{dockerImage:j.dockerImage,dockerArgs:j.dockerArgs,dockerEnvs:j.dockerEnvs}}))},[j,l]),t.jsxs(u,{sx:{mt:3},children:[t.jsxs(u,{sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[t.jsx(u,{sx:{borderBottom:1,borderColor:"divider",mb:2},children:t.jsxs(Ko,{value:a,onChange:(S,g)=>c(g),children:[t.jsx(tt,{value:"dockerParams",label:i("blocklet.publish.docker.dockerParams")}),t.jsx(tt,{value:"dockerCommand",label:i("blocklet.publish.docker.dockerCommand")})]})}),a==="dockerCommand"&&t.jsx(Y,{disabled:e,label:i("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:Ni,InputProps:{"data-cy":"blocklet-docker-command",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,spellCheck:!1,minRows:10,value:f,onChange:y,onBlur:_}),a==="dockerParams"&&t.jsxs(u,{sx:{display:"flex",flexDirection:"column",gap:2},children:[t.jsx(Y,{disabled:e,label:i("blocklet.publish.docker.dockerImageName"),placeholder:i("blocklet.publish.docker.dockerImageName"),value:I,sx:{flex:1},color:o.dockerImageName?"error":"primary",error:!!o.dockerImageName,helperText:o.dockerImageName||"",onChange:k}),t.jsx(E,{variant:"caption",color:"text.secondary",children:"Example: docker.io/postgrest/postgrest:latest"}),t.jsx(u,{sx:{height:4}}),T.map((S,g)=>t.jsx(it,{index:g,item:S,dockerParams:j,setDockerParams:m,dataKey:"dockerArgs",t:i,readOnly:e},`${S.key}-${g}`)),L.map((S,g)=>t.jsx(it,{index:g,item:S,dockerParams:j,setDockerParams:m,dataKey:"dockerEnvs",t:i,readOnly:e},`${S.key}-${g}`)),!e&&t.jsxs(u,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[t.jsx(u,{sx:{flex:1}}),t.jsx(Q,{onClick:()=>b(!0),children:i("blocklet.publish.docker.addItem")})]})]})]}),!!r&&t.jsx(u,{color:"error.main",mt:1,fontSize:14,children:r}),x&&t.jsxs(_t,{fullWidth:!0,open:!0,children:[t.jsx(Qo,{children:i("blocklet.publish.docker.addItem")}),t.jsx(Yo,{children:t.jsxs(rs,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[t.jsx(en,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:p,sx:{width:"100%"},onChange:S=>v(S.target.value),children:Object.keys(ln).map(S=>t.jsx(pe,{value:S,children:S}))}),p==="--publish"&&t.jsx(E,{variant:"caption",color:"text.secondary",children:i("blocklet.publish.docker.publishTips")}),p==="--volume"&&t.jsx(E,{variant:"caption",color:"text.secondary",children:i("blocklet.publish.docker.volumeTips")}),p==="--env"&&t.jsxs(u,{sx:{mt:3,width:"100%"},children:[t.jsx(Y,{value:C,onChange:S=>D(S.target.value),sx:{width:"100%"},label:i("blocklet.publish.docker.envKey")}),t.jsx(is,{children:i("blocklet.publish.docker.dockerArgValue")})]})]})}),t.jsxs(Zo,{children:[t.jsx(Q,{onClick:W,children:i("common.cancel")}),t.jsx(Q,{onClick:A,children:i("common.confirm")})]})]})]})}po.propTypes={readOnly:d.bool.isRequired,params:d.object.isRequired,setParams:d.func.isRequired,error:d.string.isRequired,setParamsErrTip:d.func.isRequired,paramsErrTip:d.func.isRequired};po.defaultProps={};const Ai=({tabs:e,blocklet:o,ancestors:n=[]})=>{const r=o.meta.did;e.push({label:t.jsxs(u,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[t.jsx(Nt,{size:24,blocklet:o,ancestors:n}),t.jsx(u,{ml:"4px",className:"text",children:t.jsx(u,{children:o.meta.title})})]},r),value:r})},zo=(e,o)=>{const n=At(e,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletVideos","blockletScreenshots","blockletResourceType","blockletSupport","blockletHomepage","blockletCommunity","blockletRepository","blockletDocker","contentType","connectedStores","blockletComponents","lastReleaseId","uploadedResource","autoUpload","possibleSameStore","note"]);return n.blockletComponents?n.blockletComponents=n.blockletComponents.map(r=>({...r,included:!0})):n.blockletComponents=(o.children||[]).map(r=>({did:r.meta.did,included:!1,required:!1})),n},Ei={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},Bo={branding:0,introduction:1,resources:2,blocklets:3,version:4};function fo({initUrl:e,...o}){var ho;const{projectId:n,mode:r,releaseId:s,componentDid:l=""}=lt(),{t:i}=J(),{blocklet:a}=De(),[c,f]=Ce({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}}),[h,x]=Ce({}),[b,p]=R.useState(!1),[v,C]=Ce(null),{api:D}=be(),j=ze(N=>N.breakpoints.down("md")),[m,T]=R.useState({}),[L,I]=R.useState(!1),y=R.useRef({}),[_,A]=Ce({}),[W,k]=R.useState(""),[S,g]=Ce({}),P=e==null?void 0:e.searchParams.get("dependentComponentsMode"),O=P==="readonly",F=R.useMemo(()=>{const N={};return Object.keys(S).forEach(M=>{const je=S[M];je&&je.forEach(Fn=>{N[Fn]=!0})}),N},[S]),w=R.useCallback(N=>{O&&f({blockletComponents:[]}),g(N)},[O,g,f]),$=R.useCallback((...N)=>{A(...N),x({blockletResource:"",blockletDocker:""})},[]),q=s==="none"?(c==null?void 0:c.lastReleaseId)||"":s,[U,G]=R.useState(r==="new-release"?4:0);R.useEffect(()=>{n&&x({projectId:""})},[n,x]);const ee=R.useMemo(()=>{var N;return(c==null?void 0:c.blockletResourceType)==="resource"?"resource":(N=c==null?void 0:c.blockletComponents)!=null&&N.some(M=>M.included)||Object.keys(F).length||c!=null&&c.uploadedResource?"pack":"resource"},[c==null?void 0:c.blockletComponents,c==null?void 0:c.uploadedResource,F,c==null?void 0:c.blockletResourceType]),X=[],ne=((a==null?void 0:a.children)||[]).filter(N=>{var M;return(M=N.meta.resource)==null?void 0:M.exportApi}).filter(N=>!l||N.meta.did===l);ne.forEach(N=>{Ai({tabs:X,blocklet:N,t:i,ancestors:[a]})});const[Te,We]=R.useState((ho=X[0])==null?void 0:ho.value),ge=!L&&(v==null?void 0:v.status)==="published",te=ge,_e=vs(()=>{if(!e)return;k(e.searchParams.get("logo")),f(M=>{var je;return{...M,blockletTitle:(M==null?void 0:M.blockletTitle)||e.searchParams.get("title"),blockletDescription:(M==null?void 0:M.blockletDescription)||e.searchParams.get("description"),blockletIntroduction:(M==null?void 0:M.blockletIntroduction)||e.searchParams.get("introduction")||e.searchParams.get("description"),blockletComponents:(je=M==null?void 0:M.blockletComponents)!=null&&je.length?M==null?void 0:M.blockletComponents:JSON.parse(e.searchParams.get("components")||"[]"),note:(M==null?void 0:M.note)||e.searchParams.get("note")||"No note"}});const N=e.searchParams.get("resources");try{const M=JSON.parse(N);T(M)}catch{}}),we=async()=>{if(q)try{const N=await D.getRelease({input:{did:a.meta.did,projectId:n,releaseId:q}});if(p(!1),!N.release){V.error("Release not found");return}N.release=Wn(N.release),r!=="view"&&(N.release.note=""),f(M=>zo({...M,...N.release,blockletVersion:r==="create"||r==="new-release"?Se.inc(N.release.blockletVersion,"patch"):N.release.blockletVersion},a)),C(N.release)}catch(N){p(!1),V.error(Re(N))}},Z=async()=>{if(n===H.UNOWNED_DID){f({blockletVersion:"0.0.1",blockletTitle:""});return}if(!n){V.error(i("blocklet.publish.errorTip.noDid"));return}try{const M=(await D.getProject({input:{did:a.meta.did,projectId:n}})).project||{};M.blockletVersion?(r==="create"||r==="new-release")&&Se.valid(M.blockletVersion)&&(M.blockletVersion=Se.inc(M.blockletVersion,"patch")):M.blockletVersion="0.0.1";const je=zo(M,a);f(je),M.lastReleaseId||_e()}catch(N){V.error(Re(N))}},de=R.useCallback(async()=>{p(!0);try{if(r==="view"){if(!q){V.error("Empty release id");return}await Z(),await we();return}await Z(),q&&(I(!0),await we())}finally{p(!1)}},[r,q]),z=N=>{f({blockletComponents:N})},Ue=N=>{f({blockletResourceType:N})};R.useEffect(()=>{de()},[de]),R.useEffect(()=>{n===H.UNOWNED_DID&&(r==="create"||r==="new-release")&&e&&_e()},[n,e,r,_e]),R.useEffect(()=>{c.contentType==="docker"?f({resourceFromSelect:!1}):c.contentType==="blocklet"?f({resourceFromSelect:!0}):c.contentType==="upload"&&f({resourceFromSelect:!1})},[c.contentType,f]);const Pe=R.useMemo(()=>!!Object.keys(_).find(N=>!!_[N].length),[_]);if(!c&&b)return t.jsx(Ve,{});if(!c)return null;const Le=ne.find(N=>N.meta.did===Te),Fe=N=>{We(N)},qe=e==null?void 0:e.searchParams.get("resourcesTitle"),$e=e==null?void 0:e.searchParams.get("componentsTitle"),B=[{label:i("blocklet.publish.branding"),description:i("blocklet.publish.steps.branding")},{label:i("common.introduction"),description:i("blocklet.publish.steps.introduction")},{label:qe||i("blocklet.publish.resourceTitle"),description:i("blocklet.publish.steps.resources")},{label:$e||i("common.components"),description:i("blocklet.publish.steps.blocklets")},{label:i("blocklet.publish.versionTitle"),description:i("blocklet.publish.steps.version")}],K=B[U]||B[B.length-1],ie=Ei[U];return t.jsxs(Mi,{...o,children:[t.jsx(Mn,{blocklet:a,release:v,getData:de,getRelease:we,mode:r,params:c,setParams:f,setParamsErrTip:x,readOnly:te,isPublished:ge,loading:b,setLoading:p,initLogoUrl:W,releaseId:q,projectId:n,projectType:ee,resourceComponents:ne,resourceComponentsMap:S,resourceRelateComponents:F,resourceItem:Le,saveSelectedEventsRef:y,hasSelectedResources:Pe,releaseUsedLast:L,setReleaseUsedLast:I,setRelease:C,paramsErrTip:h}),t.jsxs(u,{display:"flex",flexDirection:"column",sx:{width:"100%"},children:[t.jsx(u,{pt:3}),t.jsxs(u,{sx:{gap:3},display:"flex",flexDirection:j?"column":"row",children:[!j&&t.jsx(Vn,{steps:B,loading:b,viewMode:r==="view",params:c,hasSelectedResources:Pe||c.uploadedResource,paramsErrTip:h,activeStep:U,setActiveStep:G,projectId:n,resourcesUrlTitle:qe,componentsUrlTitle:$e}),t.jsxs(u,{flex:"1",maxWidth:"720px",children:[!j&&ie!=="introduction"&&t.jsxs(E,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[K.label,ie==="branding"&&t.jsx(ue,{title:i("blocklet.publish.brandingHelp"),placement:"right",children:t.jsx(u,{component:"a",target:"_blank",href:"https://www.arcblock.io/docs/blocklet-store/en/blocklet-detail-page",sx:{paddingTop:1,marginLeft:1},style:{color:"gray"},children:t.jsx(ys,{})})})]}),(j||ie==="branding")&&t.jsx(u,{flexDirection:"column",children:t.jsx(qn,{projectId:n,setParams:f,setParamsErrTip:x,params:c,componentDid:l,blocklet:a,initUrl:e,loading:b,setLoading:p,paramsErrTip:h,readOnly:te,initLogoUrl:W,setInitLogoUrl:k})}),j&&t.jsx(u,{flexDirection:"column",children:t.jsx(rt,{loading:b,params:c,paramsErrTip:h,setParams:f,setParamsErrTip:x,readOnly:te})}),(j||ie==="introduction")&&t.jsx(u,{display:"flex",flexDirection:"column",sx:{mt:j?5:0,width:"100%"},children:t.jsx(zn,{loading:b,readOnly:te,params:c,setParams:f,paramsErrTip:h,setParamsErrTip:x})}),j&&t.jsx(E,{variant:"h6",fontWeight:"bold",mt:5,children:B[Bo.resources].label}),t.jsx(u,{display:j||ie==="resources"?"flex":"none",sx:{maxWidth:720},flexDirection:"column",children:t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsxs(u,{sx:{flex:1},children:[t.jsxs(ls,{onChange:N=>f({contentType:N.target.value}),children:[t.jsx(Xe,{value:"blocklet",disabled:te,control:t.jsx(ft,{size:"small",checked:c.contentType==="blocklet"}),label:i("blocklet.publish.resourceSelect")}),t.jsx(Xe,{value:"upload",disabled:te,control:t.jsx(ft,{size:"small",checked:c.contentType==="upload"}),label:i("blocklet.publish.resourceUpload")}),t.jsx(Xe,{value:"docker",disabled:te,control:t.jsx(ft,{size:"small",checked:c.contentType==="docker"}),label:i("blocklet.publish.resourceDocker")})]}),c.contentType==="blocklet"&&t.jsxs(t.Fragment,{children:[!l&&t.jsx(xs,{tabs:X,current:Te,onChange:Fe,sx:{ml:-2,mt:2,maxWidth:j?window.innerWidth-24:"100%"}}),t.jsx(Qt,{loading:b,initialResources:m,saveSelectedEventsRef:y,selectedResourceIds:_,setSelectedResourceIds:$,setResourceComponentsMap:w,error:h.blockletResource,app:a,readOnly:te,component:Le,componentDid:l,initUrl:e,params:c,setParams:f,projectId:n===H.UNOWNED_DID?"":n,releaseUsedLast:L,release:{...v,id:q}})]}),c.contentType==="upload"&&t.jsx(uo,{app:a,readOnly:te,projectId:n===H.UNOWNED_DID?"":n,params:c,error:h.blockletResource,setParams:f,setParamsErrTip:x}),c.contentType==="docker"&&t.jsx(po,{app:a,readOnly:te,projectId:n===H.UNOWNED_DID?"":n,params:c,error:h.blockletResource,setParams:f,setParamsErrTip:x,paramsErrTip:h})]})})}),j&&t.jsx(E,{variant:"h6",fontWeight:"bold",mt:5,children:B[Bo.blocklets].label}),(j||ie==="blocklets")&&t.jsx(u,{flexDirection:"column",children:t.jsx(u,{display:"flex",mt:3,className:"section full-width",children:t.jsx(u,{sx:{flex:1},children:t.jsx(Ht,{projectType:ee,disabled:b||te,app:a,value:(c==null?void 0:c.blockletComponents)||[],blockletResourceType:(c==null?void 0:c.blockletResourceType)||"",onChange:z,onChangeBlockletResourceType:Ue,resourceRelateComponents:F,dependentComponentsMode:P})})})}),!j&&ie==="version"&&t.jsx(u,{flexDirection:"column",children:t.jsx(rt,{loading:b,params:c,paramsErrTip:h,setParams:f,setParamsErrTip:x,readOnly:te})})]})]})]})]})}fo.propTypes={initUrl:d.object};fo.defaultProps={initUrl:null};const Mi=ae.div`
|
|
188
|
-
.section {
|
|
189
|
-
&.full-width {
|
|
190
|
-
max-width: 100%;
|
|
191
|
-
}
|
|
192
|
-
.MuiTypography-h3 {
|
|
193
|
-
font-size: 1.1rem;
|
|
194
|
-
font-weight: 700;
|
|
195
|
-
}
|
|
196
|
-
.left {
|
|
197
|
-
flex-shrink: 0;
|
|
198
|
-
width: 140px;
|
|
199
|
-
}
|
|
200
|
-
.MuiTabs-indicator {
|
|
201
|
-
display: none;
|
|
202
|
-
}
|
|
203
|
-
.MuiTypography-subtitle1 {
|
|
204
|
-
width: 120px;
|
|
205
|
-
font-weight: 700;
|
|
206
|
-
font-size: 1rem;
|
|
207
|
-
${({theme:e})=>e.breakpoints.down("sm")} {
|
|
208
|
-
width: 80px;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
.MuiButtonBase-root {
|
|
213
|
-
a {
|
|
214
|
-
color: inherit;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
.MuiInputBase-multiline .MuiInputAdornment-positionEnd {
|
|
218
|
-
align-self: flex-end;
|
|
219
|
-
.MuiTypography-root {
|
|
220
|
-
font-size: 0.8rem;
|
|
221
|
-
}
|
|
222
|
-
font-size: 0.8rem;
|
|
223
|
-
}
|
|
224
|
-
`;function Un({padding:e,initUrl:o}){const{blocklet:n}=De(),r=Hn(),{componentDid:s}=lt();if(R.useEffect(()=>{if(s&&window.parent){const i=`${r.pathname}${r.search}`;window.parent.postMessage({event:"popstate",page:"publish",componentDid:s,path:i},"*")}},[s,r]),!n)return null;const l={};return e&&(l.padding=e),t.jsx(Oi,{style:l,children:t.jsxs(Gn,{children:[t.jsx(pt,{path:"/",element:t.jsx(Wt,{initUrl:o})}),t.jsx(pt,{path:"/:projectId",element:t.jsx(Qs,{})}),t.jsx(pt,{path:"/:projectId/:mode/:releaseId",element:t.jsx(fo,{initUrl:o})})]})})}Un.propTypes={padding:d.oneOfType([d.string,d.number]),initUrl:d.object};Un.defaultProps={padding:"",initUrl:null};const Oi=ae(u)`
|
|
225
|
-
a {
|
|
226
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
227
|
-
}
|
|
228
|
-
`;export{Un as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as O,j as P,aM as x}from"./vendor-mui-core-CCMNKHtm.js";import{x as h}from"./vendor-utils-5TjOM6td.js";import{y as K,h as f,Q as I,M as R}from"./index-uosYiNLl.js";import{g as F}from"./vendor-react-D-afvo_7.js";const L=(e,n)=>{var t;let a="?v=";return n?a+=I(n):a+=`${(t=e==null?void 0:e.meta)==null?void 0:t.version}${R(e==null?void 0:e.status)?"~":""}`,a};function j({blocklet:e}){var l,v,$,N,U,A,M;const{inService:n}=K(),a=(l=((e==null?void 0:e.environments)||[]).find(d=>d.key===f.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE))==null?void 0:l.value,t=(v=((e==null?void 0:e.environments)||[]).find(d=>d.key===f.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_RECT))==null?void 0:v.value,_=($=((e==null?void 0:e.environments)||[]).find(d=>d.key===f.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_FAVICON))==null?void 0:$.value,i=(N=((e==null?void 0:e.environments)||[]).find(d=>d.key===f.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPLASH_PORTRAIT))==null?void 0:N.value,r=(U=((e==null?void 0:e.environments)||[]).find(d=>d.key===f.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPLASH_LANDSCAPE))==null?void 0:U.value,o=(A=((e==null?void 0:e.environments)||[]).find(d=>d.key===f.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_OG_IMAGE))==null?void 0:A.value,s=((M=window.env)==null?void 0:M.apiPrefix)||"/",m=`${h(s,`/blocklet/logo/${n?"":e.meta.did}`)}${L(e,a)}`,c=`${h(s,`/blocklet/logo-rect/${n?"":e.meta.did}`)}${L(e,t??a)}`,E=`${h(s,`/blocklet/logo-favicon/${n?"":e.meta.did}`)}${L(e,_??a)}`,u=`${h(s,`/blocklet/splash/portrait/${n?"":e.meta.did}`)}${L(e,i)}`,y=`${h(s,`/blocklet/splash/landscape/${n?"":e.meta.did}`)}${L(e,r)}`,g=`${h(s,`/blocklet/og-image/${n?"":e.meta.did}`)}${L(e,o)}`;return{logoUrl:m,rectLogoUrl:c,faviconUrl:E,splashPortraitUrl:u,splashLandscapeUrl:y,ogImageUrl:g}}function B({blocklet:e,style:n,size:a,...t}){const{logoUrl:_}=j({blocklet:e}),{variant:i}=t;return P.jsx(x,{variant:i||"square",style:Object.assign({backgroundColor:"transparent",width:a,height:a,borderRadius:10},n),...t,children:P.jsx("img",{src:_,alt:"",style:{width:a}})})}B.propTypes={blocklet:O.object.isRequired,style:O.object,size:O.oneOfType([O.number,O.string])};B.defaultProps={style:{},size:40};var G={year:{long:"year",short:"y"},day:{long:"day",short:"d"},hour:{long:"hour",short:"h"},minute:{long:"minute",short:"m"},second:{long:"second",short:"s"},millisecond:{long:"millisecond",short:"ms"},microsecond:{long:"microsecond",short:"µs"},nanosecond:{long:"nanosecond",short:"ns"}},w={year:{long:"年",short:"年"},day:{long:"天",short:"天"},hour:{long:"小时",short:"小时"},minute:{long:"分钟",short:"分"},second:{long:"秒钟",short:"秒"},millisecond:{long:"毫秒",short:"毫秒"},microsecond:{long:"微秒",short:"微秒"},nanosecond:{long:"纳秒",short:"纳秒"}};const C=new Map,z=(e,n)=>{C.set(e,n)},Y=(e="en_US")=>C.get(e)||C.get("en_US");var D={registerLang:z,getLang:Y},V=e=>{if(typeof e!="number")throw new TypeError("Expected a number");const n=e>0?Math.floor:Math.ceil;return{days:n(e/864e5),hours:n(e/36e5)%24,minutes:n(e/6e4)%60,seconds:n(e/1e3)%60,milliseconds:n(e)%1e3,microseconds:n(e*1e3)%1e3,nanoseconds:n(e*1e6)%1e3}};const H=V,{getLang:p}=D,q=(e,n)=>n===1?e:`${e}s`,Q=1e-7;var W=(e,n={})=>{if(!Number.isFinite(e))throw new TypeError("Expected a finite number");n.colonNotation&&(n.compact=!1,n.formatSubMilliseconds=!1,n.separateMilliseconds=!1,n.verbose=!1),n.compact&&(n.secondsDecimalDigits=0,n.millisecondsDecimalDigits=0);const a=p(n.locale),t=[],_=(o,s)=>{const m=Math.floor(o*10**s+Q);return(Math.round(m)/10**s).toFixed(s)},i=(o,s,m)=>{if((t.length===0||!n.colonNotation)&&o===0&&!(n.colonNotation&&s==="minute"))return;const{long:c}=a[s]||p("en_US")[s],{short:E}=a[s]||p("en_US")[s];let u=(m||o||"0").toString(),y,g;if(n.colonNotation){y=t.length>0?":":"",g="";const l=u.includes(".")?u.split(".")[0].length:u.length,v=t.length>0?2:1;u="0".repeat(Math.max(0,v-l))+u}else y="",n.locale==="zh_CN"?Object.values(r).filter(l=>l>0).length>1?!r.days&&!r.hours&&r.minutes&&n.compact?g=c:g=E:r.minutes?g=c:g=E:g=n.verbose?` ${q(c,o)}`:E;t.push(y+u+g)},r=H(e);if(i(Math.trunc(r.days/365),"year"),i(r.days%365,"day"),i(r.hours,"hour"),i(r.minutes,"minute"),n.separateMilliseconds||n.formatSubMilliseconds||!n.colonNotation&&e<1e3)if(i(r.seconds,"second"),n.formatSubMilliseconds)i(r.milliseconds,"millisecond"),i(r.microseconds,"microsecond"),i(r.nanoseconds,"nanosecond");else{const o=r.milliseconds+r.microseconds/1e3+r.nanoseconds/1e6,s=typeof n.millisecondsDecimalDigits=="number"?n.millisecondsDecimalDigits:0,m=o>=1?Math.round(o):Math.ceil(o),c=s?o.toFixed(s):m;i(Number.parseFloat(c,10),"millisecond",c)}else{const o=e/1e3%60,s=typeof n.secondsDecimalDigits=="number"?n.secondsDecimalDigits:1,m=_(o,s),c=n.keepDecimalsOnWholeSeconds?m:m.replace(/\.0+$/,"");i(Number.parseFloat(c,10),"second",c)}if(t.length===0){const o=(a.millisecond||p("en_US").millisecond).long,s=(a.millisecond||p("en_US").millisecond).short;return n.locale==="zh_CN"?`0${n.verbose?`${o}`:s}`:`0${n.verbose?` ${o}s`:s}`}if(n.compact)return t[0];if(typeof n.unitCount=="number"){const o=n.colonNotation?"":" ";return t.slice(0,Math.max(n.unitCount,1)).join(o)}return n.colonNotation?t.join(""):t.join(" ")};const Z=G,J=w,{registerLang:S}=D,T=W;S("en_US",Z);S("zh_CN",J);T.registerLang=S;var X=T;const se=F(X);export{B,se as p,j as u};
|