@abtnode/blocklet-services 1.16.43-beta-20250508-132430-79f0da2d → 1.16.43-beta-20250509-094134-34c76f98
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/services/auth/session.js +9 -12
- package/dist/assets/{AdapterDayjs-DdJ4VT-y.js → AdapterDayjs-DWoymUZR.js} +1 -1
- package/dist/assets/{ArrowDropDown-eLxSrK0e.js → ArrowDropDown-oIFrKvRQ.js} +1 -1
- package/dist/assets/{CheckCircle-DxRgzKvx.js → CheckCircle-DKTlmPGr.js} +1 -1
- package/dist/assets/{ChevronLeft-B15pinY6.js → ChevronLeft-CFwnl5kG.js} +1 -1
- package/dist/assets/{ChevronRight-B2sjje0T.js → ChevronRight-8T5vdE8C.js} +1 -1
- package/dist/assets/{Community-HWgwjOzD.js → Community-BUrh_Kqh.js} +1 -1
- package/dist/assets/{DeleteOutline-DYyAnzFX.js → DeleteOutline-1ZpdOBb4.js} +1 -1
- package/dist/assets/{Done-CiSqPhhR.js → Done-1iBqzwts.js} +1 -1
- package/dist/assets/{Download-Zxb7WMKn.js → Download-BZiCoF-V.js} +1 -1
- package/dist/assets/{Edit-RoUmIPTL.js → Edit-BGameSEw.js} +1 -1
- package/dist/assets/{EditIcon-_JnvyTnF.js → EditIcon-Tb4i_lkD.js} +1 -1
- package/dist/assets/{Email-22EBBQEA.js → Email-DVjqqt2m.js} +1 -1
- package/dist/assets/{Error-C782OBuj.js → Error-DmLM9r9y.js} +1 -1
- package/dist/assets/{ExpandLess-CJztBroj.js → ExpandLess-mzw0LYV7.js} +1 -1
- package/dist/assets/{Google-DwaWO1n0.js → Google-DknSY4FA.js} +1 -1
- package/dist/assets/{Holiday-Lj9LTNQ5.js → Holiday-Aqm_6mkn.js} +1 -1
- package/dist/assets/{InfoOutlined-BCqZENBx.js → InfoOutlined-BMdv5FNj.js} +1 -1
- package/dist/assets/{Launch-BbLsJvEN.js → Launch-BGXBIBAE.js} +1 -1
- package/dist/assets/{LaunchOutlined-BdTDYYqz.js → LaunchOutlined-C1cAhHQM.js} +1 -1
- package/dist/assets/{Location-R9yMI3QX.js → Location-9D-5nMVA.js} +1 -1
- package/dist/assets/{LockIcon-DEqu2BZe.js → LockIcon-DJgkKDXB.js} +1 -1
- package/dist/assets/{Meeting-CYNfXiDR.js → Meeting-Drc_0V1u.js} +1 -1
- package/dist/assets/{MoreHoriz-Bp9phGCA.js → MoreHoriz-KJHmH0lv.js} +1 -1
- package/dist/assets/{OffSick-BWarRVS4.js → OffSick-C991mOvw.js} +1 -1
- package/dist/assets/{Phone-Df90pdBA.js → Phone-BfBgFKKG.js} +1 -1
- package/dist/assets/{PlayArrow-qTn22j6x.js → PlayArrow-CY4IxSfG.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-DV5837_n.js → QuestionMarkCircle-dkY86QWO.js} +1 -1
- package/dist/assets/{ServerLogo-7OspbhQZ.js → ServerLogo-BTwLn5Zv.js} +1 -1
- package/dist/assets/{Timezone-BfjUkoy7.js → Timezone-BWB21Pdc.js} +1 -1
- package/dist/assets/{TuneOutlined-BkH0zJXZ.js → TuneOutlined-BEZh1SVU.js} +1 -1
- package/dist/assets/{ViewList-BBNBkCo1.js → ViewList-BwVW4Mbn.js} +1 -1
- package/dist/assets/{WorkingRemotely-C3lk6KRk.js → WorkingRemotely-DHNo6euv.js} +1 -1
- package/dist/assets/{access-control-DVj3Uudk.js → access-control-BULUPRVa.js} +1 -1
- package/dist/assets/{actions-CcV0Tb1p.js → actions-7FcWNRsN.js} +1 -1
- package/dist/assets/{add-component-core-BxVPX1qJ.js → add-component-core-BMiZ7LE5.js} +13 -13
- package/dist/assets/{add-resource-CR93luK2.js → add-resource-j8u2ovZD.js} +1 -1
- package/dist/assets/{addon-igarTbiO.js → addon-vARTsq3u.js} +1 -1
- package/dist/assets/advanced-u-DAzAIF.js +14 -0
- package/dist/assets/api-BjteVZFg.js +1 -0
- package/dist/assets/{appearance-CuEL_wAd.js → appearance-DROrcrHA.js} +1 -1
- package/dist/assets/{audit-logs-DXfN0Akp.js → audit-logs-CcVb9ghw.js} +2 -2
- package/dist/assets/{authorize-DyX7LBCN.js → authorize-ChpWebj3.js} +1 -1
- package/dist/assets/{base32-sa8QWx2s.js → base32-HzVjc8tz.js} +1 -1
- package/dist/assets/{branding-B8w6MlXP.js → branding-BbyygUCZ.js} +2 -2
- package/dist/assets/{branding-CVWmoAus.js → branding-Be5nWHmr.js} +1 -1
- package/dist/assets/{bundle-avatar-DJNl27pn.js → bundle-avatar-CkhAjy4c.js} +1 -1
- package/dist/assets/button-Bk6R99H4.js +1 -0
- package/dist/assets/click-to-copy-CzMRt9dA.js +1 -0
- package/dist/assets/{cloneDeep-DBPWtvi_.js → cloneDeep-UpFQ2VNg.js} +1 -1
- package/dist/assets/{complete-jXf2IsN1.js → complete-B8pYAeSZ.js} +1 -1
- package/dist/assets/{component-DFHLfmfe.js → component-B79RqFMg.js} +1 -1
- package/dist/assets/{config-E-Dkdpbo.js → config-Cr_HvxTH.js} +1 -1
- package/dist/assets/{config-navigation-BbbAAFTA.js → config-navigation-BEcY6Wrz.js} +3 -3
- package/dist/assets/{config-space-B3L4cc62.js → config-space-CxYC75c6.js} +1 -1
- package/dist/assets/{config-DIa982AP.js → config-zGEZcVMw.js} +1 -1
- package/dist/assets/{confirm-CHZbNj0g.js → confirm-qyOtSX3L.js} +1 -1
- package/dist/assets/{connect-60F826H5.js → connect-D3ZxLXkG.js} +1 -1
- package/dist/assets/{connect-xMiXau0y.js → connect-sAGOXOYo.js} +1 -1
- package/dist/assets/{connect-to-Do1R8dL3.js → connect-to-DjFFSoXW.js} +1 -1
- package/dist/assets/{content-layout-clTZd0qL.js → content-layout-HQq6mBBk.js} +1 -1
- package/dist/assets/{dashboard-BjhEdRo6.js → dashboard-CuF4binC.js} +12 -12
- package/dist/assets/{delete-confirm-D-jVITSf.js → delete-confirm-DQ_YJQpj.js} +1 -1
- package/dist/assets/{did-address-anPrguG7.js → did-address-Dd9R3pkY.js} +1 -1
- package/dist/assets/{domain-CYWI_G__.js → domain-B2_scx4B.js} +1 -1
- package/dist/assets/{domain-action-card-CDfoYMjV.js → domain-action-card-DE7xLk29.js} +1 -1
- package/dist/assets/domains-bZXw9tDX.js +1 -0
- package/dist/assets/{dot-Bc3KtmUA.js → dot-B5LFAb8e.js} +1 -1
- package/dist/assets/{email-CQL_CvUV.js → email-CWYkPTia.js} +1 -1
- package/dist/assets/{empty-spinner-Bm-LVesB.js → empty-spinner-g1Jw7iuj.js} +1 -1
- package/dist/assets/{exchange-passport-nsHr64lM.js → exchange-passport-BbC_bBga.js} +1 -1
- package/dist/assets/{fuel-BEbwZqYG.js → fuel-BdagEU33.js} +1 -1
- package/dist/assets/{gen-access-key-DsEy5ZlI.js → gen-access-key-Cf76OFN7.js} +1 -1
- package/dist/assets/get-safe-url-Dh8rhVin.js +1 -0
- package/dist/assets/get-safe-url-_fT029s-.js +1 -0
- package/dist/assets/{home-DUvgZ0gR.js → home-BSxVGonp.js} +1 -1
- package/dist/assets/{iframe-D7qMCC0L.js → iframe-DXRYs3PX.js} +1 -1
- package/dist/assets/{index-iTlCZ1FK.js → index-B9xM_Hng.js} +1 -1
- package/dist/assets/{index-BUwaZJ5Y.js → index-BFsMuPKK.js} +4 -4
- package/dist/assets/{index-DFkZuM1_.js → index-BPuJmMx-.js} +1 -1
- package/dist/assets/{index-DyU89GO9.js → index-BQJa9ZJC.js} +1 -1
- package/dist/assets/{index-Bpz-SuLt.js → index-BSuIcvk6.js} +12 -12
- package/dist/assets/{index-CiWjpC34.js → index-Bs1kxR8_.js} +1 -1
- package/dist/assets/{index-DiZbt9Ww.js → index-C-RHInKj.js} +4 -4
- package/dist/assets/{index-hgktawrH.js → index-CXDRY0Gs.js} +1 -1
- package/dist/assets/{index-B1yanBlZ.js → index-Cc-_2bD1.js} +1 -1
- package/dist/assets/{index-w68bai-3.js → index-Cy1Hvxt0.js} +1 -1
- package/dist/assets/{index-BJfBmMvG.js → index-CzGXBMFc.js} +1 -1
- package/dist/assets/{index-Pu5My3eU.js → index-DEsvwKlq.js} +1 -1
- package/dist/assets/{index-CYz41Upz.js → index-DF0z_zii.js} +1 -1
- package/dist/assets/{index-OVTGvi9j.js → index-DW75AsWb.js} +1 -1
- package/dist/assets/{index-BmpX2Oqa.js → index-Djpx18Tz.js} +2 -2
- package/dist/assets/{index-DQncaTCr.js → index-DpW-Ik8u.js} +9 -9
- package/dist/assets/{index-egCz4jdE.js → index-TE82Z_py.js} +1 -1
- package/dist/assets/{index-DBajhv2h.js → index-aMtQhU6T.js} +18 -18
- package/dist/assets/{index-CZqp_6Zr.js → index-aQxEawZE.js} +14 -14
- package/dist/assets/{index-Ctbrsvlm.js → index-cs-08BqN.js} +4 -4
- package/dist/assets/{index-0ncGiO4u.js → index-ftkgQlGr.js} +1 -1
- package/dist/assets/{index-DZ9Jqm_w.js → index-m_po8k60.js} +2 -2
- package/dist/assets/{index-pvu3nbgn.js → index-mbuQZLIX.js} +1 -1
- package/dist/assets/{index-B6vKQTr4.js → index-yiU4BWrm.js} +1 -1
- package/dist/assets/{invitation-DqKIvv6t.js → invitation-B8tJTJsE.js} +1 -1
- package/dist/assets/{invite-uMWH0SpB.js → invite-EdScAUQO.js} +1 -1
- package/dist/assets/{issue-passport-BurnsPQZ.js → issue-passport-CStwxDqe.js} +1 -1
- package/dist/assets/{item-C69diC1y.js → item-B4NAOVBY.js} +2 -2
- package/dist/assets/{landing-page-CUkHfAZ5.js → landing-page-CBb5_s7o.js} +1 -1
- package/dist/assets/{launch-result-message-CiDoyZ_1.js → launch-result-message-mW7oxgKT.js} +1 -1
- package/dist/assets/{layout-CLOmXrMq.js → layout-uc9mKcbg.js} +1 -1
- package/dist/assets/{list-D69IwVXI.js → list-BK68Cxh8.js} +8 -8
- package/dist/assets/{list-header-D9r1Z68x.js → list-header-D4MXeBc7.js} +1 -1
- package/dist/assets/localization-CJlgb0T8.js +1 -0
- package/dist/assets/{log-CskQJ4o-.js → log-BdBIH8S_.js} +1 -1
- package/dist/assets/{logger-D6jfI5U_.js → logger-DCttRmHI.js} +1 -1
- package/dist/assets/{login-DWvvPy3b.js → login-CKa2oQPz.js} +1 -1
- package/dist/assets/{login-oauth-callback-gLyMSemT.js → login-oauth-callback-DVRZRaip.js} +1 -1
- package/dist/assets/{logo-uploader-D5rcqbIA.js → logo-uploader-DRH-fnyc.js} +3 -3
- package/dist/assets/{lost-passport-BWY_TJIl.js → lost-passport-ClMglNv0.js} +1 -1
- package/dist/assets/{omit-CM6MPIu5.js → omit-D2k92RIF.js} +1 -1
- package/dist/assets/{open-window-DKiwPBLK.js → open-window-Cu3fShwR.js} +1 -1
- package/dist/assets/{overview-DedgPJyh.js → overview-D5q1KD9x.js} +1 -1
- package/dist/assets/{page-header-D7vhn9dN.js → page-header-C1NOmuYB.js} +1 -1
- package/dist/assets/{passport-item-B45OGe4c.js → passport-item-CjxzZUKR.js} +1 -1
- package/dist/assets/{permission-6aZ4MNgh.js → permission-DzaDpKIW.js} +1 -1
- package/dist/assets/preferences-Dmcgwjhp.js +1 -0
- package/dist/assets/profile-embed-DsYLFLkt.js +1 -0
- package/dist/assets/publish-resource--xDHKiTt.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-DPnGSgvn.js → react-beautiful-dnd.esm-CrdGz16R.js} +1 -1
- package/dist/assets/{relative-time-CKENJIpb.js → relative-time-tY0x-ayF.js} +1 -1
- package/dist/assets/{runtime-Dfcxeun4.js → runtime-CRViKGyG.js} +1 -1
- package/dist/assets/sdk-D0dqnQoQ.js +1 -0
- package/dist/assets/{security-zb06EOxl.js → security-fwRPOvQx.js} +1 -1
- package/dist/assets/{session-Ir9UAnhf.js → session-xl6Fb2Wm.js} +1 -1
- package/dist/assets/{setup-Pi8eih8l.js → setup-KZaDiyeL.js} +3 -3
- package/dist/assets/{shorten-label-DTcisg7Q.js → shorten-label-srsBvHNw.js} +1 -1
- package/dist/assets/{simple-select-DpNtA3N5.js → simple-select-DyL9G1FX.js} +1 -1
- package/dist/assets/{slicedToArray-CM_xB2K2.js → slicedToArray-B3Jznk0w.js} +1 -1
- package/dist/assets/{spaces-DfgQftqB.js → spaces-BtThOmfG.js} +1 -1
- package/dist/assets/{start-CnF5I9iM.js → start-DNZ-ulwN.js} +1 -1
- package/dist/assets/{starting-progress-CUkPGiLq.js → starting-progress-CN1sTPnO.js} +1 -1
- package/dist/assets/{status-w7wNdwd8.js → status-kLLmMBy7.js} +1 -1
- package/dist/assets/{step-actions-CvAYbv4K.js → step-actions-DSriMOaL.js} +1 -1
- package/dist/assets/{studio-mvCiDQFy.js → studio-CqjHflyE.js} +1 -1
- package/dist/assets/{switch-control-BP0JyiwP.js → switch-control-DsHfwUN7.js} +1 -1
- package/dist/assets/{traffic-Bo3Bp96o.js → traffic-38eCC37i.js} +1 -1
- package/dist/assets/{transfer-DsERsnl1.js → transfer-zdDZ9_KG.js} +1 -1
- package/dist/assets/{unsubscribe-l6QkVxmr.js → unsubscribe-DiFsgDJ8.js} +1 -1
- package/dist/assets/use-blocklet-logo-OwFyCoUV.js +1 -0
- package/dist/assets/{use-mobile-BleYjZfN.js → use-mobile-B-WdQWoB.js} +1 -1
- package/dist/assets/{use-mobile-BnYZ5d8f.js → use-mobile-PBkFclTq.js} +1 -1
- package/dist/assets/{useAsync-BTtZas5A.js → useAsync-DV3NyLhI.js} +1 -1
- package/dist/assets/{useLocalStorage-C7usthsI.js → useLocalStorage-DeyICx-h.js} +1 -1
- package/dist/assets/{user-center-CSjvhqGU.js → user-center-D-0-UOTc.js} +1 -1
- package/dist/assets/{util-CRVGSd5f.js → util-CZd-jYUF.js} +1 -1
- package/dist/assets/{util-CKfiFLd5.js → util-DStpLP3f.js} +1 -1
- package/dist/assets/{vendor-arcblock-Bi9JkCAO.js → vendor-arcblock-CORkwLwW.js} +5 -5
- package/dist/assets/{vendor-hooks-zv9Oe7Yx.js → vendor-hooks-rDgu5KV9.js} +1 -1
- package/dist/assets/{vendor-mui-core-FzKVVAue.js → vendor-mui-core-DMvlMpwf.js} +1 -1
- package/dist/assets/{vendor-mui-x-B9zuOzS0.js → vendor-mui-x-mcVodcG2.js} +1 -1
- package/dist/assets/vendor-utils-rHXShPKm.js +208 -0
- package/dist/assets/vendor-ux-did-connect-akcz-Ldw.js +2296 -0
- package/dist/assets/{wrap-locale-BmmKAsYR.js → wrap-locale-NyChvVhT.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/service-worker.js +1 -1
- package/package.json +30 -30
- package/dist/assets/advanced-C22Mc4mt.js +0 -14
- package/dist/assets/api-DPHyou8y.js +0 -1
- package/dist/assets/button-D0USBc4l.js +0 -1
- package/dist/assets/click-to-copy-Dhxc_blG.js +0 -1
- package/dist/assets/domains-D-YYFzTK.js +0 -1
- package/dist/assets/get-safe-url-CH0a4wzx.js +0 -1
- package/dist/assets/get-safe-url-Cn647BYQ.js +0 -1
- package/dist/assets/localization-CAh5vCty.js +0 -1
- package/dist/assets/preferences-DU_A8Q43.js +0 -1
- package/dist/assets/profile-embed-B8hvxRm0.js +0 -1
- package/dist/assets/publish-resource-riTnsr3y.js +0 -1
- package/dist/assets/sdk-DUAPwTSQ.js +0 -1
- package/dist/assets/use-blocklet-logo-BiDCl8v3.js +0 -2
- package/dist/assets/vendor-utils-lR6P1BXz.js +0 -208
- package/dist/assets/vendor-ux-did-connect-CaDmrsW1.js +0 -2296
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{r as x,f as Tt,l as ct,L as ke,g as Mn,u as Un,i as Vn,j as jt}from"./vendor-react-DEoibe3W.js";import{a9 as Ce,j as e,v as Be,aa as c,bd as $t,H as s,ad as je,I as ce,T as E,s as Fn,c7 as Oo,D as at,ah as ye,au as Hn,bS as Ke,ak as dt,bt as et,bx as tt,y as K,ab as Re,P as Wo,G as Bo,w as Pt,a7 as Mo,M as Uo,q as fe,X as Gn,aj as Vo,t as Fo,bV as Jn,N as Je,z as Ho,O as ne,al as ve,at as Go,L as Jo,A as _t,b6 as Xo,bK as Yo,by as Xn,e as Qo,aq as Yn,b$ as Qn,af as Zn,U as Zo,W as ot,bF as Kn,bG as es,c8 as ts,c9 as os,bo as wt,bp as ns,br as ss,bv as rs,bw as kt}from"./vendor-mui-core-FzKVVAue.js";import{z as ge,C as Se,af as ls,a7 as is,f as yo,ag as vo,ab as cs}from"./index-BUwaZJ5Y.js";import{r as De,j as Y,u as Q,bO as Ko,h as as,B as qe,b7 as en,X as tn,b4 as on,ao as ds,bP as us,a7 as qt,_ as B,a3 as ps,I as ae,bQ as hs,bv as fs,a as We,am as ut,b5 as ms,as as nn}from"./vendor-ux-did-connect-CaDmrsW1.js";import{M as pt,c as he,q as bs,Q as xs,_ as sn,T as _e,p as gs}from"./vendor-arcblock-Bi9JkCAO.js";import{d as js}from"./Error-C782OBuj.js";import{C as ht}from"./confirm-CHZbNj0g.js";import{u as Ue}from"./session-Ir9UAnhf.js";import{W as Ct}from"./did-address-anPrguG7.js";import{E as Xe}from"./empty-spinner-Bm-LVesB.js";import{B as Et}from"./bundle-avatar-DJNl27pn.js";import{S as we}from"./shorten-label-DTcisg7Q.js";import{L as Lt}from"./list-header-D9r1Z68x.js";import{$ as ks,A as de,J as Nt,E as rn}from"./vendor-utils-lR6P1BXz.js";import{d as ys}from"./Download-Zxb7WMKn.js";import{C as ln}from"./click-to-copy-Dhxc_blG.js";import{Q as vs}from"./QuestionMarkCircle-DV5837_n.js";import{u as Rs}from"./vendor-hooks-zv9Oe7Yx.js";import{_ as Pe}from"./useSetState-CWq0AVWn.js";import{c as At}from"./index-DVQCgvFb.js";import{E as zt}from"./index-DFkZuM1_.js";import"./api-DPHyou8y.js";import{d as ws}from"./ChevronRight-B2sjje0T.js";import{T as Cs,a as Ss}from"./vendor-mui-x-B9zuOzS0.js";import{d as nt}from"./DeleteOutline-DYyAnzFX.js";import{D as Ro,C as wo,P as Co}from"./react-beautiful-dnd.esm-DPnGSgvn.js";import{c as Ds,A as cn,u as an,S as Is,a as Ts,b as $s,e as Ps,U as _s,f as yt,g as dn,n as qs,h as Es,i as So,k as Ls,l as Ns}from"./item-C69diC1y.js";import{d as As}from"./ArrowDropDown-eLxSrK0e.js";import{f as xe}from"./format-error-BrmqJs5a.js";import{d as un}from"./Launch-BbLsJvEN.js";import{d as pn}from"./Done-CiSqPhhR.js";import{D as zs}from"./delete-confirm-D-jVITSf.js";import{g as hn}from"./get-safe-url-Cn647BYQ.js";import{M as Os}from"./index-DyU89GO9.js";import{r as Ws}from"./index-BJfBmMvG.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ot={},Bs=Ce;Object.defineProperty(Ot,"__esModule",{value:!0});var fn=Ot.default=void 0,Ms=Bs(De()),Us=e;fn=Ot.default=(0,Ms.default)((0,Us.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 Wt={},Vs=Ce;Object.defineProperty(Wt,"__esModule",{value:!0});var mn=Wt.default=void 0,Fs=Vs(De()),Hs=e;mn=Wt.default=(0,Fs.default)((0,Hs.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={},Gs=Ce;Object.defineProperty(Bt,"__esModule",{value:!0});var bn=Bt.default=void 0,Js=Gs(De()),Xs=e;bn=Bt.default=(0,Js.default)((0,Xs.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Mt({did:t,projectId:o,title:n,logo:l,describe:i}){const r=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${l}`,[u,a]=x.useState(!1),f=Be(b=>b.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx($t,{sx:{borderRadius:1},src:r}),e.jsxs(c,{children:[e.jsx(we,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),e.jsx(we,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||u?"primary.main":"grey.700"},children:i||"/"})]})]})}Mt.propTypes={projectId:s.string.isRequired,did:s.string.isRequired,title:s.string.isRequired,logo:s.string.isRequired,describe:s.string.isRequired};function Ut({initUrl:t}){const o=Tt(),n=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:l,locale:i}=Q(),{api:d}=ge(),{api:r}=Ue(),[u,a]=x.useState(!0),{blocklet:f}=Se(),[b,j]=x.useState(null),[y,h]=x.useState(!1),p=Be(S=>S.breakpoints.down("xl")),v=Be(S=>S.breakpoints.down("md")),{componentDid:w=""}=ct(),[m,k]=x.useState(null),C=`publish-${f.meta.did}`,T=Ko(C),[$,I]=x.useState({searchText:T.searchText||"",pageSize:T.rowsPerPage||10,page:1}),L=()=>{d.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:n}}).then(S=>{const A=(S==null?void 0:S.projects)||[];a(!1),k(A)}).catch(S=>{a(!1),B.error(S.message)})},z=()=>{o(`${Y.UNOWNED_DID}/create/none`,{replace:!0})},q=S=>{j(S)},Z=()=>{a(!1),h(!0)},U=()=>{h(!1),j(null)},R=S=>{B.error(S.message),h(!1),j(null)},g=S=>{if(!(S!=null&&S.deleted)){B.error("Delete project failed");return}L(),h(!1),j(null)};x.useEffect(()=>{L()},[]);const D=x.useMemo(()=>{var A;if(!$.searchText)return m;let S=(A=$.searchText)==null?void 0:A.trim();return S?(S=as.toAddress(S).toLocaleLowerCase(),m.filter(H=>H.blockletTitle.toLowerCase().includes(S)||H.blockletDid.toLowerCase().includes(S))):m},[m,$.searchText]);if(!m&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!m)return null;if(!m.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:l("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:l("blocklet.publish.createBlockletTip")}),e.jsx(qe,{onClick:z,variant:"contained",children:l("blocklet.publish.createBlocklet")})]});const M=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:S=>{const A=m[S];return e.jsx(ke,{to:`${A.id}`,children:e.jsx(Mt,{did:f.meta.did,projectId:A.id,logo:A.blockletLogo,title:A.blockletTitle,describe:A.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:S=>S?e.jsx(en,{type:"success",children:S}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:S=>S?e.jsx(Ct,{size:14,compact:!0,responsive:!1,did:S}):null}},p||w?null:{label:l("common.createdBy"),name:"createdBy",options:{customBodyRender:S=>S?e.jsx(Ct,{onClick:()=>{o(`/.well-known/service/admin/members?did=${S}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:S}):null}},p||w?null:{label:l("common.scope"),name:"componentDid",options:{customBodyRender:S=>{const A=(f.children||[]).find(H=>H.meta.did===S);return A?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Et,{size:14,blocklet:A,ancestors:[f]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:A.meta.title})]},S):""}}},p||n?null:{label:l("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:S=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(we,{children:S})})}},{label:l("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:S=>e.jsx(tn,{value:Number(S),locale:i})}},{label:l("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:S=>{const A=m[S];return e.jsxs(c,{display:"flex",children:[e.jsx(ke,{to:`${A.id}/new-release/${A.lastReleaseId}`,children:e.jsx(je,{title:l("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(fn,{style:{fontSize:18}})})})}),!!A.lastReleaseId&&e.jsx(je,{title:l("blocklet.publish.viewLastRelease",{name:A.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(ke,{style:{display:"flex"},to:`${A.id}/view/${A.lastReleaseId}`,children:e.jsx(mn,{sx:{fontSize:18}})})})}),e.jsx(je,{title:l("blocklet.publish.delete",{name:A.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>q(A),children:e.jsx(on,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),O=({page:S,rowsPerPage:A,searchText:H})=>{$.pageSize!==A?I(J=>({...J,searchText:"",pageSize:A,page:1})):$.page!==S+1?I(J=>({...J,searchText:"",page:S+1})):$.searchText!==H&&I(J=>({...J,searchText:H,page:1}))},G=y?e.jsx(ds,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:r.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:g,onError:R,extraParams:{projectId:b.id,did:f.meta.did,name:b.blockletTitle},messages:{title:l("blocklet.publish.deleteProject.title",{name:b.blockletTitle}),scan:l("blocklet.publish.deleteProject.scan",{name:b.blockletTitle}),confirm:l("blocklet.publish.deleteProject.confirm"),success:l("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(Ys,{children:[e.jsx(Lt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:l("common.blockletStudio")}),e.jsx(je,{title:l("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(bn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(us,{options:{searchPlaceholder:l("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:v},search:$.searchText,searchText:$.searchText,searchTextUpdate:S=>I(A=>({...A,searchText:S})),searchClose:()=>I(S=>({...S,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(qe,{onClick:z,variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),l("blocklet.publish.createBlocklet")]})]})}),e.jsx(qt,{className:"main-table",locale:i,data:D,columns:M,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:C,onChange:O}),b&&e.jsx(ht,{title:`${l("common.delete")} ${b.blockletTitle}`,description:l("blocklet.publish.deleteProject.description"),confirm:l("common.confirm"),onConfirm:Z,onCancel:()=>j(null),children:e.jsx(c,{sx:{marginTop:2},children:[l("blocklet.publish.deleteProject.tip1"),l("blocklet.publish.deleteProject.tip2"),l("blocklet.publish.deleteProject.tip3")].map(S=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(js,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(E,{component:"span",variant:"inherit",color:"text.secondary",children:S})]}))})}),G]})}const Ys=Fn(c)`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-aMtQhU6T.js","assets/vendor-ux-did-connect-akcz-Ldw.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-rHXShPKm.js","assets/vendor-mui-core-DMvlMpwf.js","assets/vendor-hooks-rDgu5KV9.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-CORkwLwW.js","assets/index-Bs1kxR8_.js","assets/index-BFsMuPKK.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as x,f as Tt,l as ct,L as ye,g as Mn,u as Un,i as Vn,j as jt}from"./vendor-react-DEoibe3W.js";import{a9 as Se,j as e,v as Be,aa as c,bd as $t,H as s,ad as ke,I as ae,T as L,s as Fn,c7 as Oo,D as at,ah as ve,au as Hn,bS as Ke,ak as dt,bt as et,bx as tt,y as K,ab as we,P as Wo,G as Bo,w as Pt,a7 as Mo,M as Uo,q as be,X as Gn,aj as Vo,t as Fo,bV as Jn,N as Je,z as Ho,O as ne,al as Re,at as Go,L as Jo,A as _t,b6 as Xo,bK as Yo,by as Xn,e as Qo,aq as Yn,b$ as Qn,af as Zn,U as Zo,W as ot,bF as Kn,bG as es,c8 as ts,c9 as os,bo as wt,bp as ns,br as ss,bv as rs,bw as kt}from"./vendor-mui-core-DMvlMpwf.js";import{z as je,C as De,af as ls,a7 as is,f as yo,ag as vo,ab as cs}from"./index-BFsMuPKK.js";import{r as Ie,j as Y,u as Q,bu as Ko,h as as,B as qe,b7 as en,X as tn,b4 as on,ao as ds,bv as us,a7 as qt,_ as M,a3 as ps,I as de,bw as hs,ba as fs,a as We,am as ut,b5 as bs,as as nn}from"./vendor-ux-did-connect-akcz-Ldw.js";import{M as pt,c as fe,q as ms,Q as xs,_ as sn,T as _e,p as gs}from"./vendor-arcblock-CORkwLwW.js";import{d as js}from"./Error-DmLM9r9y.js";import{C as ht}from"./confirm-qyOtSX3L.js";import{u as Ue}from"./session-xl6Fb2Wm.js";import{W as Ct}from"./did-address-Dd9R3pkY.js";import{E as Xe}from"./empty-spinner-g1Jw7iuj.js";import{B as Et}from"./bundle-avatar-CkhAjy4c.js";import{S as Ce}from"./shorten-label-srsBvHNw.js";import{L as Lt}from"./list-header-D4MXeBc7.js";import{$ as ks,A as ue,J as Nt,E as rn}from"./vendor-utils-rHXShPKm.js";import{d as ys}from"./Download-BZiCoF-V.js";import{C as ln}from"./click-to-copy-CzMRt9dA.js";import{Q as vs}from"./QuestionMarkCircle-dkY86QWO.js";import{u as Rs}from"./vendor-hooks-rDgu5KV9.js";import{_ as Pe}from"./useSetState-CWq0AVWn.js";import{c as At}from"./index-DVQCgvFb.js";import{E as zt}from"./index-BPuJmMx-.js";import"./api-BjteVZFg.js";import{d as ws}from"./ChevronRight-8T5vdE8C.js";import{T as Cs,a as Ss}from"./vendor-mui-x-mcVodcG2.js";import{d as nt}from"./DeleteOutline-1ZpdOBb4.js";import{D as Ro,C as wo,P as Co}from"./react-beautiful-dnd.esm-CrdGz16R.js";import{c as Ds,A as cn,u as an,S as Is,a as Ts,b as $s,e as Ps,U as _s,f as yt,g as dn,n as qs,h as Es,i as So,k as Ls,l as Ns}from"./item-B4NAOVBY.js";import{d as As}from"./ArrowDropDown-oIFrKvRQ.js";import{f as ge}from"./format-error-BrmqJs5a.js";import{d as un}from"./Launch-BGXBIBAE.js";import{d as pn}from"./Done-1iBqzwts.js";import{D as zs}from"./delete-confirm-DQ_YJQpj.js";import{g as hn}from"./get-safe-url-_fT029s-.js";import{M as Os}from"./index-BQJa9ZJC.js";import{r as Ws}from"./index-CzGXBMFc.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ot={},Bs=Se;Object.defineProperty(Ot,"__esModule",{value:!0});var fn=Ot.default=void 0,Ms=Bs(Ie()),Us=e;fn=Ot.default=(0,Ms.default)((0,Us.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 Wt={},Vs=Se;Object.defineProperty(Wt,"__esModule",{value:!0});var bn=Wt.default=void 0,Fs=Vs(Ie()),Hs=e;bn=Wt.default=(0,Fs.default)((0,Hs.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={},Gs=Se;Object.defineProperty(Bt,"__esModule",{value:!0});var mn=Bt.default=void 0,Js=Gs(Ie()),Xs=e;mn=Bt.default=(0,Js.default)((0,Xs.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Mt({did:t,projectId:o,title:n,logo:l,describe:i}){const r=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${l}`,[u,a]=x.useState(!1),f=Be(m=>m.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx($t,{sx:{borderRadius:1},src:r}),e.jsxs(c,{children:[e.jsx(Ce,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),e.jsx(Ce,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||u?"primary.main":"grey.700"},children:i||"/"})]})]})}Mt.propTypes={projectId:s.string.isRequired,did:s.string.isRequired,title:s.string.isRequired,logo:s.string.isRequired,describe:s.string.isRequired};function Ut({initUrl:t}){const o=Tt(),n=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:l,locale:i}=Q(),{api:d}=je(),{api:r}=Ue(),[u,a]=x.useState(!0),{blocklet:f}=De(),[m,j]=x.useState(null),[y,h]=x.useState(!1),p=Be(T=>T.breakpoints.down("xl")),v=Be(T=>T.breakpoints.down("md")),{componentDid:w=""}=ct(),[b,k]=x.useState(null),C=`publish-${f.meta.did}`,I=Ko(C),[$,D]=x.useState({searchText:I.searchText||"",pageSize:I.rowsPerPage||10,page:1}),N=()=>{d.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:n}}).then(T=>{const P=(T==null?void 0:T.projects)||[];a(!1),k(P)}).catch(T=>{a(!1),M.error(T.message)})},z=()=>{o(`${Y.UNOWNED_DID}/create/none`,{replace:!0})},E=T=>{j(T)},Z=()=>{a(!1),h(!0)},U=()=>{h(!1),j(null)},R=T=>{M.error(T.message),h(!1),j(null)},g=T=>{if(!(T!=null&&T.deleted)){M.error("Delete project failed");return}N(),h(!1),j(null)};x.useEffect(()=>{N()},[]);const S=x.useMemo(()=>{var P;if(!$.searchText)return b;let T=(P=$.searchText)==null?void 0:P.trim();return T?(T=as.toAddress(T).toLocaleLowerCase(),b.filter(H=>H.blockletTitle.toLowerCase().includes(T)||H.blockletDid.toLowerCase().includes(T))):b},[b,$.searchText]);if(!b&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!b)return null;if(!b.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:l("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:l("blocklet.publish.createBlockletTip")}),e.jsx(qe,{onClick:z,variant:"contained",children:l("blocklet.publish.createBlocklet")})]});const W=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:T=>{const P=b[T];return e.jsx(ye,{to:`${P.id}`,children:e.jsx(Mt,{did:f.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:T=>T?e.jsx(en,{type:"success",children:T}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:T=>T?e.jsx(Ct,{size:14,compact:!0,responsive:!1,did:T}):null}},p||w?null:{label:l("common.createdBy"),name:"createdBy",options:{customBodyRender:T=>T?e.jsx(Ct,{onClick:()=>{o(`/.well-known/service/admin/members?did=${T}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:T}):null}},p||w?null:{label:l("common.scope"),name:"componentDid",options:{customBodyRender:T=>{const P=(f.children||[]).find(H=>H.meta.did===T);return P?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Et,{size:14,blocklet:P,ancestors:[f]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},T):""}}},p||n?null:{label:l("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:T=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Ce,{children:T})})}},{label:l("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:T=>e.jsx(tn,{value:Number(T),locale:i})}},{label:l("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:T=>{const P=b[T];return e.jsxs(c,{display:"flex",children:[e.jsx(ye,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:e.jsx(ke,{title:l("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ae,{color:"primary","aria-label":"create",children:e.jsx(fn,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&e.jsx(ke,{title:l("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:e.jsx(ae,{color:"secondary","aria-label":"create",children:e.jsx(ye,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:e.jsx(bn,{sx:{fontSize:18}})})})}),e.jsx(ke,{title:l("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:e.jsx(ae,{color:"primary","aria-label":"delete",onClick:()=>E(P),children:e.jsx(on,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),B=({page:T,rowsPerPage:P,searchText:H})=>{$.pageSize!==P?D(V=>({...V,searchText:"",pageSize:P,page:1})):$.page!==T+1?D(V=>({...V,searchText:"",page:T+1})):$.searchText!==H&&D(V=>({...V,searchText:H,page:1}))},J=y?e.jsx(ds,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:r.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:g,onError:R,extraParams:{projectId:m.id,did:f.meta.did,name:m.blockletTitle},messages:{title:l("blocklet.publish.deleteProject.title",{name:m.blockletTitle}),scan:l("blocklet.publish.deleteProject.scan",{name:m.blockletTitle}),confirm:l("blocklet.publish.deleteProject.confirm"),success:l("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(Ys,{children:[e.jsx(Lt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:l("common.blockletStudio")}),e.jsx(ke,{title:l("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(mn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(us,{options:{searchPlaceholder:l("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:v},search:$.searchText,searchText:$.searchText,searchTextUpdate:T=>D(P=>({...P,searchText:T})),searchClose:()=>D(T=>({...T,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(qe,{onClick:z,variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),l("blocklet.publish.createBlocklet")]})]})}),e.jsx(qt,{className:"main-table",locale:i,data:S,columns:W,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:C,onChange:B}),m&&e.jsx(ht,{title:`${l("common.delete")} ${m.blockletTitle}`,description:l("blocklet.publish.deleteProject.description"),confirm:l("common.confirm"),onConfirm:Z,onCancel:()=>j(null),children:e.jsx(c,{sx:{marginTop:2},children:[l("blocklet.publish.deleteProject.tip1"),l("blocklet.publish.deleteProject.tip2"),l("blocklet.publish.deleteProject.tip3")].map(T=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(js,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(L,{component:"span",variant:"inherit",color:"text.secondary",children:T})]}))})}),J]})}const Ys=Fn(c)`
|
|
3
3
|
${({theme:t})=>t.breakpoints.down("md")} {
|
|
4
4
|
.MuiTableRow-root {
|
|
5
5
|
border-color: ${({theme:t})=>t.palette.divider};
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
`;Ut.propTypes={initUrl:s.object};Ut.defaultProps={initUrl:null};var Vt={},Qs=
|
|
8
|
+
`;Ut.propTypes={initUrl:s.object};Ut.defaultProps={initUrl:null};var Vt={},Qs=Se;Object.defineProperty(Vt,"__esModule",{value:!0});var xn=Vt.default=void 0,Zs=Qs(Ie()),Do=e;xn=Vt.default=(0,Zs.default)([(0,Do.jsx)("path",{d:"M20 17H4V5h8V3H4c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h4v2h8v-2h4c1.1 0 2-.9 2-2v-3h-2z"},"0"),(0,Do.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const Ks=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},gn=Ks;function er(){var R;const{t,locale:o}=Q(),{projectId:n}=ct(),{api:l}=je(),[i,d]=x.useState(!0),{blocklet:r}=De(),u=Be(g=>g.breakpoints.down("md")),[a,f]=x.useState(null),[m,j]=x.useState(null),[y,h]=x.useState(null),p=(R=window.env)==null?void 0:R.serverEndpoint,v=`releases-${r.meta.did}-${n}`,w=Ko(v),[b,k]=x.useState({searchText:w.searchText||"",pageSize:w.rowsPerPage||10,page:1}),C=()=>{l.getReleases({input:{did:r.meta.did,projectId:n}}).then(g=>{const S=(g==null?void 0:g.releases)||[];d(!1),f(S)}).catch(g=>{d(!1),M.error(g.message)})},I=()=>{l.doBatchQuery({getProject:{input:{did:r.meta.did,projectId:n}},getReleases:{input:{did:r.meta.did,projectId:n}}}).then(g=>{j(g.getProject.project||{}),f(g.getReleases.releases||[]),d(!1)}).catch(g=>{d(!1),M.error(g.message)})};x.useEffect(()=>{I()},[]);const[$,D]=x.useState(""),N=()=>{d(!1);const g=y.id;l.deleteRelease({input:{did:r.meta.did,projectId:n,releaseId:g}}).then(()=>{d(!1),C(),M.success(t("common.removeSuccess")),h(null)}).catch(S=>{d(!1),M.error(S.message)})},z=g=>{h(g)};if(!a&&i)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!a)return null;const E=e.jsxs(Oo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(ye,{to:"..",children:t("common.blockletStudio")}),e.jsx(L,{color:"text.primary",children:e.jsx(Ce,{maxLength:u?6:30,children:m.blockletTitle})})]});if(!a.length)return e.jsxs(e.Fragment,{children:[E,e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),e.jsx(ye,{to:"create/none",children:e.jsx(qe,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const Z=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:g=>{const S=a[g];return e.jsx(ye,{to:`view/${S.id}`,children:e.jsx(Mt,{did:r.meta.did,projectId:m.id,logo:S.blockletLogo,title:S.blockletVersion,describe:S.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:g=>{const S=a[g];return e.jsx(L,{className:"note",children:gn(S.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:g=>e.jsx(en,{type:g==="published"?"success":"warning",children:g==="published"?"Released":ks(g)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:g=>{const S=a[g];return S.status!==fe.PROJECT.RELEASE_STATUS.published?"":e.jsx(tn,{value:Number(S.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:g=>{var P;const S=a[g];let W="",B="";const J=S.status==="published";if(J){const H=ue(p,`/api/project/${r.meta.did}/${m.id}/${m.lastReleaseId}/release/blocklet.json`),V=new URL(p);V.pathname=ue(V.pathname,"/launch-blocklet/agreement"),V.searchParams.set("blocklet_meta_url",H),W=V.href,B=ue(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${m.id}/${m.lastReleaseId}/download/${(m.lastReleaseFiles||[])[0]}`)}const T=(P=m.blockletComponents)!=null&&P.some(H=>H.included)||S.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[J&&T==="pack"&&e.jsx(ke,{title:t("blocklet.publish.install",{name:m.blockletTitle}),placement:"top",children:e.jsx(ae,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:W,target:"_blank",rel:"noreferrer",children:e.jsx(xn,{sx:{fontSize:18}})})})}),J&&e.jsx(ke,{title:t("blocklet.publish.download",{name:m.blockletTitle}),placement:"top",children:e.jsx(ae,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:B,children:e.jsx(ys,{sx:{fontSize:18}})})})}),e.jsx(ke,{title:t("blocklet.publish.delete",{name:m.blockletTitle}),placement:"top",children:e.jsx(ae,{color:"primary","aria-label":"delete",onClick:()=>z(S),children:e.jsx(on,{sx:{fontSize:18}})})})]})}}}],U=({page:g,rowsPerPage:S,searchText:W})=>{b.pageSize!==S?k(B=>({...B,searchText:"",pageSize:S,page:1})):b.page!==g+1?k(B=>({...B,searchText:"",page:g+1})):b.searchText!==W&&k(B=>({...B,searchText:W,page:1}))};return e.jsxs(tr,{children:[e.jsx(Lt,{sx:{mb:2},left:E,actions:e.jsxs(e.Fragment,{children:[e.jsx(qe,{variant:"outlined",onClick:()=>{const g=ue(p,`/api/project/${r.meta.did}/${n}/blocklet.json`);D(g)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(ye,{to:"new-release/none",children:e.jsxs(qe,{variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(at,{fullWidth:!0,maxWidth:"sm",open:$,onClose:()=>D(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(L,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(ln,{children:$}),e.jsxs(L,{sx:{mt:2},children:[t("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:t("blocklet.publish.installResourceHelp")})]})]})}),e.jsx(qt,{className:"main-table",verticalKeyWidth:100,locale:o,data:a,columns:Z,durable:v,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1},onChange:U}),y&&e.jsx(ht,{title:t(`${t("common.delete")} ${y.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:N,onCancel:()=>h(null)})]})}const tr=ve(c)`
|
|
9
9
|
.main-table > div:first-child {
|
|
10
10
|
display: none;
|
|
11
11
|
}
|
|
@@ -18,7 +18,7 @@ import{r as x,f as Tt,l as ct,L as ke,g as Mn,u as Un,i as Vn,j as jt}from"./ven
|
|
|
18
18
|
border-color: ${({theme:t})=>t.palette.divider};
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
`;var Ft={},or=
|
|
21
|
+
`;var Ft={},or=Se;Object.defineProperty(Ft,"__esModule",{value:!0});var jn=Ft.default=void 0,nr=or(Ie()),sr=e;jn=Ft.default=(0,nr.default)((0,sr.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 Me({children:t,Icon:o}){return e.jsxs(Hn,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"10px",margin:"10px 0px"},children:[e.jsx(c,{sx:{opacity:.3,fontSize:32},children:e.jsx(o,{})}),e.jsx(c,{sx:{mb:2,opacity:.7,fontSize:"small",color:"action"},children:t})]})}Me.propTypes={children:s.node.isRequired,Icon:s.elementType};Me.defaultProps={Icon:jn};function Ht({value:t,app:o,onChange:n,onChangeBlockletResourceType:l,disabled:i,resourceRelateComponents:d,projectType:r,dependentComponentsMode:u,blockletResourceType:a}){const{t:f,locale:m}=Q(),j=u==="readonly",y=x.useMemo(()=>{const C=t.reduce((I,$)=>(I[$.did]=$.included,I),{});return(o.children||[]).filter(I=>j?d[I.meta.did]||C[I.meta.did]:!0)},[o.children,t,d,j]),h=x.useMemo(()=>y.map(C=>t.find($=>$.did===C.meta.did)||{did:C.meta.did}),[y,t]),p=h.reduce((C,I)=>(C[I.did]=Nt(I,["required","included"]),C),{}),v=C=>{const I=h.map($=>{if($.did===C){const D=!$.included;return{...$,included:D,required:D}}return $});n(I)},w=C=>{const I=h.map($=>$.did===C?{...$,required:!$.required}:$);n(I)},b=C=>{l(C.target.checked?"resource":"")},k=[{label:f("common.name"),name:"meta.title",width:200,options:{customBodyRenderLite:C=>{var D;const I=y[C],$=(D=p[I.meta.did])==null?void 0:D.included;return e.jsxs(c,{display:"flex",alignItems:"center",children:[e.jsx(Et,{size:24,blocklet:I,ancestors:[o]}),e.jsx(c,{ml:"4px",className:At("text",{excluded:!$}),children:e.jsx(c,{children:I.meta.title})})]})}}},{label:f("blocklet.publish.componentIncluded"),width:100,options:{customBodyRenderLite:C=>{var N;const I=y[C],$=d[I.meta.did],D=!!((N=p[I.meta.did])!=null&&N.included);return e.jsx(Ke,{size:"small",checked:$||D,onClick:()=>v(I.meta.did),disabled:j||$||i})}}},{label:f("blocklet.publish.componentForceRequired"),width:100,options:{customBodyRenderLite:C=>{var z,E;const I=y[C],$=d[I.meta.did],D=!!((z=p[I.meta.did])!=null&&z.included),N=!!((E=p[I.meta.did])!=null&&E.required);return e.jsx(Ke,{size:"small",checked:$||N&&D,onClick:()=>w(I.meta.did),disabled:j||$||i||!D})}}}];return e.jsx(rr,{children:y!=null&&y.length?e.jsxs(e.Fragment,{children:[e.jsxs(dt,{severity:"info",style:{width:"100%"},children:[e.jsx(c,{display:"flex",alignItems:"center",rel:"noreferrer",ml:"13px",children:f(r==="pack"?"blocklet.publish.packTip":"blocklet.publish.resourceTip")}),e.jsxs(c,{component:"label",style:{cursor:"pointer"},children:[e.jsx(Ke,{size:"small",style:{marginLeft:"0px"},disabled:i,checked:a==="resource",onChange:b}),f("blocklet.publish.forceResourceBlocklet")]})]}),e.jsx(qt,{className:"main-table",verticalKeyWidth:100,locale:m,data:y,columns:k,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1,rowsPerPage:50}})]}):e.jsx(Me,{Icon:zt,children:f("blocklet.publish.blockletEmptyTip")})})}Ht.propTypes={app:s.object.isRequired,value:s.arrayOf(s.shape({did:s.string.isRequired,required:s.bool,included:s.bool})),onChange:s.func,onChangeBlockletResourceType:s.func,disabled:s.bool,dependentComponentsMode:s.string,resourceRelateComponents:s.object,blockletResourceType:s.string,projectType:s.string.isRequired};Ht.defaultProps={value:[],onChange:()=>{},onChangeBlockletResourceType:()=>{},disabled:!1,dependentComponentsMode:"auto",blockletResourceType:"",resourceRelateComponents:{}};const rr=ve(c)`
|
|
22
22
|
.main-table {
|
|
23
23
|
.text.excluded {
|
|
24
24
|
color: #999;
|
|
@@ -51,7 +51,7 @@ import{r as x,f as Tt,l as ct,L as ke,g as Mn,u as Un,i as Vn,j as jt}from"./ven
|
|
|
51
51
|
`).filter(n=>{const l=n.match(To);if(l===null||!l[1])return!0;const i=l[1];return i.includes(".app/Contents/Resources/electron.asar")||i.includes(".app/Contents/Resources/default_app.asar")?!1:!ir.test(i)}).filter(n=>n.trim()!=="").map(n=>o.pretty?n.replace(To,(l,i)=>l.replace(i,i.replace(cr,"~"))):n).join(`
|
|
52
52
|
`));const dr=lr,ur=ar,pr=t=>t.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,"");let hr=class extends Error{constructor(o){if(!Array.isArray(o))throw new TypeError(`Expected input to be an Array, got ${typeof o}`);o=[...o].map(l=>l instanceof Error?l:l!==null&&typeof l=="object"?Object.assign(new Error(l.message),l):new Error(l));let n=o.map(l=>typeof l.stack=="string"?pr(ur(l.stack)):String(l)).join(`
|
|
53
53
|
`);n=`
|
|
54
|
-
`+dr(n,4),super(n),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:o})}*[Symbol.iterator](){for(const o of this._errors)yield o}};var fr=hr;const
|
|
54
|
+
`+dr(n,4),super(n),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:o})}*[Symbol.iterator](){for(const o of this._errors)yield o}};var fr=hr;const br=fr;var mr=async(t,o,{concurrency:n=1/0,stopOnError:l=!0}={})=>new Promise((i,d)=>{if(typeof o!="function")throw new TypeError("Mapper function is required");if(!((Number.isSafeInteger(n)||n===1/0)&&n>=1))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${n}\` (${typeof n})`);const r=[],u=[],a=t[Symbol.iterator]();let f=!1,m=!1,j=0,y=0;const h=()=>{if(f)return;const p=a.next(),v=y;if(y++,p.done){m=!0,j===0&&(!l&&u.length!==0?d(new br(u)):i(r));return}j++,(async()=>{try{const w=await p.value;r[v]=await o(w,v),j--,h()}catch(w){l?(f=!0,d(w)):(u.push(w),j--,h())}})()};for(let p=0;p<n&&(h(),!m);p++);});const xr=mr;var gr=(t,o)=>xr(t,n=>n(),o);const st=Mn(gr);function jr(t,o){const n=new Set(o||[]),l=[];function i(d){n.has(d==null?void 0:d.id)&&l.push(d==null?void 0:d.id),d!=null&&d.children&&d.children.forEach(i)}return(t||[]).forEach(i),l}function Gt({src:t,alt:o,...n}){const[l,i]=x.useState(!1),d=x.useRef(null);return x.useEffect(()=>{if(!("IntersectionObserver"in window))return i(!0),()=>{};const r=new IntersectionObserver(u=>{u.forEach(a=>{a.isIntersecting&&(i(!0),r.disconnect())})},{threshold:.1});return d.current&&r.observe(d.current),()=>{r.disconnect()}},[]),e.jsx("img",{ref:d,src:l?t:void 0,alt:o,...n})}Gt.propTypes={src:s.string.isRequired,alt:s.string};Gt.defaultProps={alt:""};function Jt({data:t,lazy:o,...n}){return!t||!t.length?null:e.jsx(kr,{...n,children:t.map(l=>e.jsx("a",{href:l.url,target:"_blank",rel:"noreferrer",children:o?e.jsx(Gt,{src:l.url,alt:l.alt||""}):e.jsx("img",{src:l.url,alt:l.alt||""})},l.url))})}Jt.propTypes={data:s.arrayOf(s.shape({url:s.string,alt:s.string})),lazy:s.bool};Jt.defaultProps={data:[],lazy:!1};const kr=ve(c)`
|
|
55
55
|
display: flex;
|
|
56
56
|
justify-content: flex-start;
|
|
57
57
|
flex-wrap: wrap;
|
|
@@ -65,7 +65,7 @@ import{r as x,f as Tt,l as ct,L as ke,g as Mn,u as Un,i as Vn,j as jt}from"./ven
|
|
|
65
65
|
margin-right: 12px;
|
|
66
66
|
margin-bottom: 12px;
|
|
67
67
|
}
|
|
68
|
-
`,vt=(t,o)=>{const n=[...t];for(;n.length>0;){const l=n.shift();if(l.id===o)return l;l.children&&n.push(...l.children)}return[]};function Xt({icon:t}){return t?ps(t)?e.jsx("img",{className:"resource-icon",src:t,alt:"icon"}):e.jsx(
|
|
68
|
+
`,vt=(t,o)=>{const n=[...t];for(;n.length>0;){const l=n.shift();if(l.id===o)return l;l.children&&n.push(...l.children)}return[]};function Xt({icon:t}){return t?ps(t)?e.jsx("img",{className:"resource-icon",src:t,alt:"icon"}):e.jsx(de,{className:"resource-icon",icon:t}):null}Xt.propTypes={icon:s.string};Xt.defaultProps={icon:""};function Yt({disabled:t,data:o,onChange:n,value:l}){const i=l;function d(h,p=[]){return p.push(h.id),h.children&&h.children.forEach(v=>d(v,p)),p}const r=h=>d(vt(o,h)),u=(h,p=[])=>{const v=vt(o,h);return v.parent?(p.push(v.parent),u(v.parent,p)):p};function a(h,p){const v=r(h.id),w=v.indexOf(h.id);return v.splice(w,1),v.every(b=>i.concat(p).includes(b))}const f=(h,p)=>{h.stopPropagation();const v=r(p),w=u(p);if(i.includes(p)){const b=i.filter(k=>!v.concat(w).includes(k));n(b)}else{const b=v;for(let k=0;k<w.length;++k)a(vt(o,w[k]),b)&&b.push(w[k]);n([...i].concat(b))}},m=h=>{h.stopPropagation()},j=o.some(h=>{var p;return((p=h.children)==null?void 0:p.length)>0}),y=h=>{var k;const p=i.indexOf(h.id)!==-1,v=Array.isArray(h.children),w=r(h.id),b=v&&!p&&i.some(C=>w.includes(C));return e.jsx(Cs,{nodeId:h.id,label:e.jsx(et,{onClick:m,control:e.jsx(Ke,{size:"small",checked:p,indeterminate:b,tabIndex:-1,disableRipple:!0,onClick:C=>f(C,h.id),disabled:h.disabled||t}),label:e.jsxs(c,{className:"content",children:[e.jsxs(c,{display:"flex",alignItems:"center",children:[h.icon&&e.jsx(Xt,{icon:h.icon}),e.jsx(c,{className:"name",children:h.name}),h.url&&e.jsx("a",{href:h.url,target:"_blank",rel:"noreferrer",className:"link",children:e.jsx(xs,{className:"link-icon"})})]}),!!h.description&&e.jsx(c,{className:"description",children:h.description}),!!((k=h.images)!=null&&k.length)&&e.jsx(Jt,{className:"images",data:h.images,lazy:!0})]})}),children:v?h.children.map(y):null},h.id)};return e.jsx(yr,{className:At(!j&&"no-children"),multiSelect:!0,defaultCollapseIcon:e.jsx(ms,{}),defaultExpandIcon:e.jsx(ws,{}),selected:i,children:o.map(h=>y(h))})}Yt.propTypes={data:s.array,value:s.array,onChange:s.func,disabled:s.bool};Yt.defaultProps={data:[],value:[],onChange:()=>{},disabled:!1};const yr=ve(Ss)`
|
|
69
69
|
&.no-children {
|
|
70
70
|
.MuiTreeItem-content {
|
|
71
71
|
padding: 0;
|
|
@@ -120,7 +120,7 @@ import{r as x,f as Tt,l as ct,L as ke,g as Mn,u as Un,i as Vn,j as jt}from"./ven
|
|
|
120
120
|
font-size: 14px;
|
|
121
121
|
color: ${({theme:t})=>t.palette.text.secondary};
|
|
122
122
|
}
|
|
123
|
-
`,$o={},vr=(t,o,{key:n,cacheTime:l=1e3*3}={})=>{const i=n+JSON.stringify({params:o}),d=$o[i];if(d&&d.timestamp>Date.now()-l)return d.promise;const r=t(...o);return $o[i]={promise:r,timestamp:Date.now()},r},kn=vr,yn=(t,o)=>(t.forEach(n=>{o&&(n.parent=o),(n.children||[]).forEach(l=>{l.parent=n.id,yn(l.children||[],l.id)})}),t),vn=(t,o,n,l,i)=>{const{exportApi:d="/"}=(t==null?void 0:t.meta.resource)||{},r=new URL(
|
|
123
|
+
`,$o={},vr=(t,o,{key:n,cacheTime:l=1e3*3}={})=>{const i=n+JSON.stringify({params:o}),d=$o[i];if(d&&d.timestamp>Date.now()-l)return d.promise;const r=t(...o);return $o[i]={promise:r,timestamp:Date.now()},r},kn=vr,yn=(t,o)=>(t.forEach(n=>{o&&(n.parent=o),(n.children||[]).forEach(l=>{l.parent=n.id,yn(l.children||[],l.id)})}),t),vn=(t,o,n,l,i)=>{const{exportApi:d="/"}=(t==null?void 0:t.meta.resource)||{},r=new URL(ue("http://127.0.0.1",t==null?void 0:t.mountPoint,d||"/").replace(/\/+/g,"/"));return r.searchParams.set("projectId",o),r.searchParams.set("releaseId",n),r.searchParams.set("local",l),i&&r.searchParams.set("resourcesParams",i.searchParams.get("resourcesParams")),`${r.pathname}${r.search}`},Rr=async({api:t,appDid:o,component:n,projectId:l,releaseId:i,locale:d,initUrl:r,resources:u})=>{let a;if(r&&r.searchParams.get("resourcesParams"))try{a=JSON.parse(r.searchParams.get("resourcesParams"))}catch(f){M.error(f.message);return}await rn.post(vn(n,l,i,d,r),{resources:u,projectId:l,releaseId:i,locale:d,...a?{resourcesParams:a}:{}},{headers:{"x-csrf-token":hs()},timeout:10*60*1e3}),await t.updateSelectedResources({input:{did:o,projectId:l,releaseId:i,componentDid:n.meta.did,resources:u}})},wr=(t,o)=>{if(!t)return{};const n=o.reduce((i,d)=>(i[d]=!0,i),{}),l=(i,d)=>(i.forEach(r=>{var u;n[r.id]&&((u=r.dependentComponents)!=null&&u.length)&&r.dependentComponents.forEach(a=>{d[a]=!0}),r.children&&l(r.children,d)}),d);return l(t,{})};function Qt({app:t,component:o,projectId:n,release:l,loading:i,error:d,saveSelectedEventsRef:r,readOnly:u,componentDid:a,initialResources:f={},setResourceComponentsMap:m,selectedResourceIds:j,setSelectedResourceIds:y,showTree:h,initUrl:p}){var U;const{t:v,locale:w}=Q(),{api:b}=je(),[k,C]=Pe({}),I=x.useRef({}),$=x.useRef(!1),D=l.id;I.current.projectId=n,I.current.releaseId=D;const N=(R,g,S)=>{if(!g)return;const W=wr(g,S);m==null||m({[R]:Object.keys(W)})},z=R=>{r.current[o.meta.did]={resources:R,component:o},y({[o.meta.did]:R}),N(o.meta.did,k[o.meta.did],R)},E=x.useCallback(async R=>{var g;try{const S=await kn(rn.get,[vn(R,n,D,w,p),{timeout:6e4}],{key:"getResources"});return yn(((g=S==null?void 0:S.data)==null?void 0:g.resources)||[])}catch{return[]}},[n,D,w,p]);x.useEffect(()=>{k[o==null?void 0:o.meta.did]||E(o).then(R=>{C({[o==null?void 0:o.meta.did]:R})}).catch(R=>{M.error(R.message)})},[o,C,k,E]),x.useEffect(()=>{D&&n&&!$.current&&st(t.children.map(R=>async()=>{var g,S;if(!(a&&a!==R.meta.did)&&!(!(R!=null&&R.mountPoint)||!is.hasStartEngine(R==null?void 0:R.meta)||!((S=(g=R==null?void 0:R.meta)==null?void 0:g.resource)!=null&&S.exportApi)))try{const W=await E(R);C({[R==null?void 0:R.meta.did]:W});const B=await b.getSelectedResources({input:{did:t.meta.did,projectId:n,releaseId:D,componentDid:R.meta.did}}),J=(B==null?void 0:B.resources)||[];J!=null&&J.length&&(y({[R.meta.did]:jr(W,J)}),N(R.meta.did,W,J),u||(r.current[R==null?void 0:R.meta.did]={resources:J,component:R}))}catch(W){M.error(W.message)}}),{concurrency:2}).then(()=>{$.current=!0})},[D,n,u,w,p,C]),x.useEffect(()=>{f&&Object.keys(f).length&&st(t.children.map(async R=>{const g=f[R.meta.did];if(g!=null&&g.length){const S=await E(R);y({[R.meta.did]:g}),N(R.meta.did,S,g),u||(r.current[R==null?void 0:R.meta.did]={resources:g,component:R})}}))},[t,f,u]);let Z=null;return(!o||!((U=k[o.meta.did])!=null&&U.length))&&(Z=e.jsx(Me,{Icon:zt,children:v("blocklet.publish.resourceEmptyTip",{name:yo.getDisplayName(o)})})),(o==null?void 0:o.status)!=="running"&&(Z=e.jsx(Me,{children:v("blocklet.publish.componentNotRunning",{name:yo.getDisplayName(o)})})),e.jsxs(e.Fragment,{children:[e.jsx(Cr,{className:At(d&&"error"),children:h&&e.jsx(c,{pb:2,width:"100%",children:Z||e.jsx(Yt,{data:k[o.meta.did]||[],value:j[o.meta.did]||[],onChange:z,disabled:i||u})})}),!!d&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:d})]})}Qt.propTypes={component:s.object.isRequired,app:s.object.isRequired,projectId:s.string.isRequired,error:s.string,saveSelectedEventsRef:s.object.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired,release:s.shape({id:s.string.isRequired,status:s.string}),initialResources:s.object,initUrl:s.object,setResourceComponentsMap:s.func,componentDid:s.string,selectedResourceIds:s.array.isRequired,setSelectedResourceIds:s.func.isRequired,showTree:s.bool.isRequired};Qt.defaultProps={error:"",release:{id:""},initUrl:null,initialResources:{},setResourceComponentsMap:()=>{},componentDid:""};const Cr=ve(c)`
|
|
124
124
|
border: 1px solid;
|
|
125
125
|
border-color: ${({theme:t})=>t.palette.divider};
|
|
126
126
|
max-height: 600px;
|
|
@@ -142,7 +142,7 @@ import{r as x,f as Tt,l as ct,L as ke,g as Mn,u as Un,i as Vn,j as jt}from"./ven
|
|
|
142
142
|
background: #fff;
|
|
143
143
|
z-index: 10;
|
|
144
144
|
}
|
|
145
|
-
`;var Zt={},Sr=Ce;Object.defineProperty(Zt,"__esModule",{value:!0});var St=Zt.default=void 0,Dr=Sr(De()),Ir=e;St=Zt.default=(0,Dr.default)((0,Ir.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 Po="lastWantToConnectStoreId";function Tr(t){var u,a;const[o,n]=x.useState(null),{session:l}=Ue(),i=x.useCallback(f=>{n(f),localStorage.setItem(Po,f==null?void 0:f.id)},[n]),d=x.useMemo(()=>{var y,h,p,v;const f=localStorage.getItem(Po),b=f?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(w=>w.id===f):null;if(b)return b;let j=(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(w=>{var m;return!(w.id!==Y.BLOCKLET_STORE.id||w.scope&&w.scope!=="studio"&&w.scope!==((m=l==null?void 0:l.user)==null?void 0:m.did))});return j||(j=(v=(p=t==null?void 0:t.settings)==null?void 0:p.storeList)==null?void 0:v[0]),j},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=l==null?void 0:l.user)==null?void 0:a.did]);return[o||d||{},i]}const Rt={};async function Kt(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:l=4e3,timerKey:i=""}){Rt[i]&&clearTimeout(Rt[i]),await new Promise(u=>setTimeout(u,l));const d=Date.now(),r=async(u,a)=>{try{const f=await t();u(f)}catch(f){Date.now()-d>n?a(f):i?Rt[i]=setTimeout(()=>r(u,a),o):setTimeout(()=>r(u,a),o)}};return new Promise(r)}function $r(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Pr(t,{did:o,projectId:n,messageId:l}){return Kt(async()=>{var d;const i=await t.getProject({input:{did:o,projectId:n,messageId:l}});if(!((d=i==null?void 0:i.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return i.project.blockletDid},{timerKey:"connect-studio"})}function _r(t,{did:o,projectId:n,storeId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(a=>a.storeId===l))throw new Error("Connected store not found")},{timerKey:`connect-store-${l}`})}function qr(t,{did:o,projectId:n,endpointId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(a=>a.endpointId===l))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${l}`})}const Er=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:l})=>{var r,u;const i=t?(r=n==null?void 0:n.meta)==null?void 0:r.did:o==null?void 0:o.did;let d=t?((u=n==null?void 0:n.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===l),{teamDid:i,storeList:d}},eo=Er;function to({blocklet:t,store:o={},onChangeStore:n,onClick:l,disabled:i,loading:d,componentDid:r}){var R,g,D;const{t:u}=Q(),{session:a}=Ue(),{api:f,info:b,inService:j}=ge(),y=Se(),[h,p]=x.useState(!1),v=x.useRef(null),[w,m]=x.useState(!1),[k,C]=x.useState(null),T=M=>{n(M),p(!1)},$=()=>{p(!h)},I=M=>{v.current&&v.current.contains(M.target)||p(!1)},L=()=>{m(!0)},z=()=>{m(!1)},q=async()=>{var M;if(k)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:k.url,projectId:"",scope:k.scope||"studio"}}),await((M=y==null?void 0:y.actions)==null?void 0:M.refreshBlocklet())}catch(O){B.error(`Remove Blocklet Store Error: ${xe(O)}`)}finally{C(null)}},{storeList:Z}=eo({fromBlocklet:j,blocklet:t,nodeInfo:b,componentDid:r,userDid:(R=a==null?void 0:a.user)==null?void 0:R.did}),U=(g=t==null?void 0:t.meta)==null?void 0:g.did;return e.jsxs(e.Fragment,{children:[e.jsxs(tt,{disabled:i,ref:v,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(K,{onClick:l,children:[d&&e.jsx(Re,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(K,{size:"small","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:$,children:e.jsx(As,{})})]}),e.jsx(Wo,{sx:{zIndex:10},open:h,anchorEl:v.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:M})=>e.jsx(Bo,{...M,style:{transformOrigin:"center top"},children:e.jsx(Pt,{children:e.jsx(Mo,{onClickAway:I,children:e.jsxs(Uo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[Z==null?void 0:Z.map(O=>{var G;return e.jsxs(fe,{selected:O.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>T(O),children:[e.jsxs(c,{children:[e.jsx(we,{sx:{fontSize:"16px"},maxLength:24,children:O.name}),e.jsx(we,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:O.url})]}),Ds({store:O,userDid:(G=a==null?void 0:a.user)==null?void 0:G.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),C(O)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},O.url)}),e.jsx(Gn,{}),e.jsxs(fe,{onClick:L,children:[e.jsx(pt,{font:!0}),e.jsx(E,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),w&&e.jsx(cn,{hiddenChildren:!0,open:!0,onClose:z,teamDid:U,storeList:Z,scope:"studio",onAdd:(D=y==null?void 0:y.actions)==null?void 0:D.refreshBlocklet}),k&&e.jsx(ht,{displayError:!0,title:`${u("common.delete")} ${k.name}`,description:u("blocklet.publish.deleteStoreTip",{name:k.name}),confirm:u("common.confirm"),onConfirm:q,onCancel:()=>C(null)})]})}to.propTypes={store:s.object,blocklet:s.object,onChangeStore:s.func.isRequired,onClick:s.func.isRequired,loading:s.bool.isRequired,disabled:s.bool.isRequired,componentDid:s.string.isRequired,projectType:s.string.isRequired,getData:s.func.isRequired};to.defaultProps={store:null,blocklet:null};const Lr=(t,o,n)=>{const l=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${l}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,r=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:d,screenshotUrls:r,uploadLogoPrefix:l,uploadScreenshotPrefix:i}},Rn=Lr,Nr=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");return o||n};function ft({url:t,style:o,controls:n,modestbranding:l}){var u;const{t:i}=Q(),d=t.includes("youtube.com")||t.includes("youtu.be"),r=t.includes("vimeo.com");if(d){const a=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${a}?modestbranding=${l}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(r){const a=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${a}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(E,{variant:"body1",sx:{opacity:.5},children:i("studio.videoDialogNoSrc")})]})})}ft.propTypes={url:s.string.isRequired,style:s.object,controls:s.number,modestbranding:s.number};ft.defaultProps={style:{},controls:1,modestbranding:1};function wn({setParams:t,onClose:o,params:n}){const{t:l}=Q(),[i,d]=x.useState(""),r=i&&n.blockletVideos.includes(i),u=Nr(i),a=()=>{t(f=>{const b=[...f.blockletVideos];return b.push(i),{...f,blockletVideos:b}}),o()};return e.jsxs(at,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Vo,{children:l("studio.videoDialogTitle")}),e.jsxs(Fo,{children:[e.jsx(Jn,{fullWidth:!0,value:i,onChange:f=>d(f.target.value),placeholder:l("studio.videoInputLabel"),endAdornment:i?e.jsx(Je,{position:"end",children:e.jsx(ce,{onClick:()=>d(""),children:e.jsx(fs,{})})}):null,error:r}),r&&e.jsx(E,{variant:"body2",color:"error",children:l("studio.duplicateVideo")}),e.jsx(ft,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Ho,{children:[e.jsx(K,{onClick:()=>o(),children:l("studio.cancel")}),e.jsx(K,{disabled:!u||r,onClick:a,children:l("studio.confirm")})]})]})}wn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Dt({errors:t,storeList:o,...n}){const{t:l}=Q();return e.jsxs(c,{...n,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(E,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:l("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([i,d])=>{const r=Object.values(d),u=o.find(a=>a.url===i);return r.length>0&&e.jsxs(c,{children:[e.jsx(je,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),r.map(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},i)})]})}Dt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const _o=x.lazy(()=>sn(()=>import("./index-DBajhv2h.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function Cn({projectId:t,readOnly:o,loading:n,blocklet:l,params:i,setParams:d,paramsErrTip:r,setParamsErrTip:u,warning:a,setLoading:f,initUrl:b,initLogoUrl:j,setInitLogoUrl:y,componentDid:h}){const{t:p,locale:v}=Q(),{api:w}=ge(),m=Tt(),k=x.useRef(null),C=x.useRef(null),[T,$]=Tr(l),[I,L]=x.useState(!1),z=an({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),q=async _=>{const V=setTimeout(()=>{f(!1)},2e4),X=await Pr(w,_);f(!1),clearTimeout(V),window.parent.postMessage({event:"studioDialog.connected",componentDid:h},"*"),m(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},Z=()=>{if(!i.blockletTitle){B.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(T!=null&&T.url)){B.error(p("blocklet.publish.noStoreSelected"));return}const _=$r();z(async(V,X)=>{var te,oe,ie;try{const ee=await w.connectByStudio({input:{did:(te=l==null?void 0:l.meta)==null?void 0:te.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:T.url,storeId:T.id,storeName:T.name,type:((oe=i==null?void 0:i.blockletComponents)==null?void 0:oe.length)>0?"pack":"resource",componentDid:h,messageId:_,tenantScope:(b==null?void 0:b.searchParams.get("tenantScope"))||""}});if(!(ee!=null&&ee.url)){B.error("failed to connect to store");return}X(ee.url),q({did:(ie=l==null?void 0:l.meta)==null?void 0:ie.did,projectId:"",messageId:_})}catch(ee){const ue=xe(ee);B.error(ue),f(!1)}})},{logoUrl:U,screenshotUrls:R,uploadLogoPrefix:g,uploadScreenshotPrefix:D}=Rn(i,l,t),{logoErrors:M,screenshotErrors:O,storeList:G,hasLogoWarning:S,hasScreenshotWarning:A}=a,H=()=>o?!1:!t||t===Y.UNOWNED_DID?(B.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,J=_=>{if(!_.destination)return;const V=Array.from(i.blockletScreenshots),[X]=V.splice(_.source.index,1);V.splice(_.destination.index,0,X),d(te=>({...te,blockletScreenshots:V}))},Ie=_=>{if(!_.destination)return;const V=Array.from(i.blockletVideos),[X]=V.splice(_.source.index,1);V.splice(_.destination.index,0,X),d(te=>({...te,blockletVideos:V}))};return e.jsxs(Ar,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:i.blockletTitle||"",onChange:_=>{u({blockletTitle:""}),d({blockletTitle:_.target.value})},error:!!r.blockletTitle,helperText:r.blockletTitle||""}),e.jsx(ne,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===Y.UNOWNED_DID&&e.jsx(Je,{position:"end",children:e.jsx(to,{blocklet:l,store:T,componentDid:h,onChangeStore:$,disabled:!i.blockletTitle||o||n,loading:n,onClick:Z})})},error:!!r.projectId,helperText:r.projectId||"",value:t===Y.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletDescription||"",onChange:_=>{u({blockletDescription:""}),d({blockletDescription:_.target.value})},error:!!r.blockletDescription,helperText:r.blockletDescription||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletHomepage||"",onChange:_=>{_.target.value&&!/^(http|https):\/\//.test(_.target.value)?u({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:_.target.value})},error:!!r.blockletHomepage,helperText:r.blockletHomepage||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletCommunity||"",onChange:_=>{_.target.value&&!/^(http|https):\/\//.test(_.target.value)?u({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:_.target.value})},error:!!r.blockletCommunity,helperText:r.blockletCommunity||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletSupport||"",onChange:_=>{_.target.value&&!/^(http|https):\/\//.test(_.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(_.target.value)?u({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:_.target.value})},error:!!r.blockletSupport,helperText:r.blockletSupport||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletRepository||"",onChange:_=>{_.target.value&&!/^(git|https|svn)/.test(_.target.value)?u({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:_.target.value})},error:!!r.blockletRepository,helperText:r.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),e.jsxs(ve,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx($t,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:j||U,onClick:()=>{var _;H()&&((_=k.current)==null||_.open())}})})]}),S&&e.jsx(Dt,{errors:M,storeList:G,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),e.jsxs(ve,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:J,children:e.jsx(wo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(_,V)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:V.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:_.innerRef,..._.droppableProps,children:[R.map((X,te)=>e.jsx(Co,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ie)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:X}),!o&&e.jsx(ce,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(ee=>{const ue=[...ee.blockletScreenshots];return ue.splice(te,1),{...ee,blockletScreenshots:ue}})},children:e.jsx(nt,{})})]})},X)),_.placeholder,R.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var X;H()&&((X=C.current)==null||X.open())},children:"+"})]})})})]}),A&&e.jsx(Dt,{errors:O,storeList:G}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),e.jsxs(ve,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"secondary.main"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:Ie,children:e.jsx(wo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(_,V)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:_.innerRef,..._.droppableProps,children:[i.blockletVideos.map((X,te)=>e.jsx(Co,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ie)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(ft,{url:X,style:{pointerEvents:ie.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(ee=>{const ue=[...ee.blockletVideos];return ue.splice(te,1),{...ee,blockletVideos:ue}})},children:e.jsx(nt,{})})]})},X)),_.placeholder,i.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{H()&&L(!0)},children:"+"})]})})})]})]})}),e.jsxs(x.Suspense,{fallback:e.jsx(Xe,{}),children:[e.jsx(_o,{ref:k,locale:v,popup:!0,onUploadFinish:_=>{var V;d({blockletLogo:_.data.filename}),y(""),(V=k.current)==null||V.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:g,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),I&&e.jsx(wn,{onClose:()=>L(!1),params:i,setParams:d}),e.jsx(_o,{ref:C,locale:v,popup:!0,onUploadFinish:_=>{var V;d(X=>{var oe;const te=X.blockletScreenshots||[];return te.push((oe=_.data)==null?void 0:oe.filename),{...X,blockletScreenshots:te}}),(V=C.current)==null||V.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:D,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-R.length}},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}Cn.propTypes={projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,setLoading:s.func.isRequired,initUrl:s.object.isRequired,componentDid:s.isRequired,initLogoUrl:s.string.isRequired,setInitLogoUrl:s.func.isRequired};const Ar=ye.div`
|
|
145
|
+
`;var Zt={},Sr=Se;Object.defineProperty(Zt,"__esModule",{value:!0});var St=Zt.default=void 0,Dr=Sr(Ie()),Ir=e;St=Zt.default=(0,Dr.default)((0,Ir.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 Po="lastWantToConnectStoreId";function Tr(t){var u,a;const[o,n]=x.useState(null),{session:l}=Ue(),i=x.useCallback(f=>{n(f),localStorage.setItem(Po,f==null?void 0:f.id)},[n]),d=x.useMemo(()=>{var y,h,p,v;const f=localStorage.getItem(Po),m=f?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(w=>w.id===f):null;if(m)return m;let j=(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(w=>{var b;return!(w.id!==Y.BLOCKLET_STORE.id||w.scope&&w.scope!=="studio"&&w.scope!==((b=l==null?void 0:l.user)==null?void 0:b.did))});return j||(j=(v=(p=t==null?void 0:t.settings)==null?void 0:p.storeList)==null?void 0:v[0]),j},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=l==null?void 0:l.user)==null?void 0:a.did]);return[o||d||{},i]}const Rt={};async function Kt(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:l=4e3,timerKey:i=""}){Rt[i]&&clearTimeout(Rt[i]),await new Promise(u=>setTimeout(u,l));const d=Date.now(),r=async(u,a)=>{try{const f=await t();u(f)}catch(f){Date.now()-d>n?a(f):i?Rt[i]=setTimeout(()=>r(u,a),o):setTimeout(()=>r(u,a),o)}};return new Promise(r)}function $r(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Pr(t,{did:o,projectId:n,messageId:l}){return Kt(async()=>{var d;const i=await t.getProject({input:{did:o,projectId:n,messageId:l}});if(!((d=i==null?void 0:i.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return i.project.blockletDid},{timerKey:"connect-studio"})}function _r(t,{did:o,projectId:n,storeId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(a=>a.storeId===l))throw new Error("Connected store not found")},{timerKey:`connect-store-${l}`})}function qr(t,{did:o,projectId:n,endpointId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(a=>a.endpointId===l))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${l}`})}const Er=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:l})=>{var r,u;const i=t?(r=n==null?void 0:n.meta)==null?void 0:r.did:o==null?void 0:o.did;let d=t?((u=n==null?void 0:n.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===l),{teamDid:i,storeList:d}},eo=Er;function to({blocklet:t,store:o={},onChangeStore:n,onClick:l,disabled:i,loading:d,componentDid:r}){var R,g,S;const{t:u}=Q(),{session:a}=Ue(),{api:f,info:m,inService:j}=je(),y=De(),[h,p]=x.useState(!1),v=x.useRef(null),[w,b]=x.useState(!1),[k,C]=x.useState(null),I=W=>{n(W),p(!1)},$=()=>{p(!h)},D=W=>{v.current&&v.current.contains(W.target)||p(!1)},N=()=>{b(!0)},z=()=>{b(!1)},E=async()=>{var W;if(k)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:k.url,projectId:"",scope:k.scope||"studio"}}),await((W=y==null?void 0:y.actions)==null?void 0:W.refreshBlocklet())}catch(B){M.error(`Remove Blocklet Store Error: ${ge(B)}`)}finally{C(null)}},{storeList:Z}=eo({fromBlocklet:j,blocklet:t,nodeInfo:m,componentDid:r,userDid:(R=a==null?void 0:a.user)==null?void 0:R.did}),U=(g=t==null?void 0:t.meta)==null?void 0:g.did;return e.jsxs(e.Fragment,{children:[e.jsxs(tt,{disabled:i,ref:v,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(K,{onClick:l,children:[d&&e.jsx(we,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(K,{size:"small","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:$,children:e.jsx(As,{})})]}),e.jsx(Wo,{sx:{zIndex:10},open:h,anchorEl:v.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:W})=>e.jsx(Bo,{...W,style:{transformOrigin:"center top"},children:e.jsx(Pt,{children:e.jsx(Mo,{onClickAway:D,children:e.jsxs(Uo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[Z==null?void 0:Z.map(B=>{var J;return e.jsxs(be,{selected:B.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>I(B),children:[e.jsxs(c,{children:[e.jsx(Ce,{sx:{fontSize:"16px"},maxLength:24,children:B.name}),e.jsx(Ce,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:B.url})]}),Ds({store:B,userDid:(J=a==null?void 0:a.user)==null?void 0:J.did})&&e.jsx(ae,{sx:{ml:1},onClick:T=>{T.preventDefault(),T.stopPropagation(),C(B)},children:e.jsx(de,{icon:"ic:outline-delete"})})]},B.url)}),e.jsx(Gn,{}),e.jsxs(be,{onClick:N,children:[e.jsx(pt,{font:!0}),e.jsx(L,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),w&&e.jsx(cn,{hiddenChildren:!0,open:!0,onClose:z,teamDid:U,storeList:Z,scope:"studio",onAdd:(S=y==null?void 0:y.actions)==null?void 0:S.refreshBlocklet}),k&&e.jsx(ht,{displayError:!0,title:`${u("common.delete")} ${k.name}`,description:u("blocklet.publish.deleteStoreTip",{name:k.name}),confirm:u("common.confirm"),onConfirm:E,onCancel:()=>C(null)})]})}to.propTypes={store:s.object,blocklet:s.object,onChangeStore:s.func.isRequired,onClick:s.func.isRequired,loading:s.bool.isRequired,disabled:s.bool.isRequired,componentDid:s.string.isRequired,projectType:s.string.isRequired,getData:s.func.isRequired};to.defaultProps={store:null,blocklet:null};const Lr=(t,o,n)=>{const l=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${l}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,r=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:d,screenshotUrls:r,uploadLogoPrefix:l,uploadScreenshotPrefix:i}},Rn=Lr,Nr=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");return o||n};function ft({url:t,style:o,controls:n,modestbranding:l}){var u;const{t:i}=Q(),d=t.includes("youtube.com")||t.includes("youtu.be"),r=t.includes("vimeo.com");if(d){const a=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${a}?modestbranding=${l}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(r){const a=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${a}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(de,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(L,{variant:"body1",sx:{opacity:.5},children:i("studio.videoDialogNoSrc")})]})})}ft.propTypes={url:s.string.isRequired,style:s.object,controls:s.number,modestbranding:s.number};ft.defaultProps={style:{},controls:1,modestbranding:1};function wn({setParams:t,onClose:o,params:n}){const{t:l}=Q(),[i,d]=x.useState(""),r=i&&n.blockletVideos.includes(i),u=Nr(i),a=()=>{t(f=>{const m=[...f.blockletVideos];return m.push(i),{...f,blockletVideos:m}}),o()};return e.jsxs(at,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Vo,{children:l("studio.videoDialogTitle")}),e.jsxs(Fo,{children:[e.jsx(Jn,{fullWidth:!0,value:i,onChange:f=>d(f.target.value),placeholder:l("studio.videoInputLabel"),endAdornment:i?e.jsx(Je,{position:"end",children:e.jsx(ae,{onClick:()=>d(""),children:e.jsx(fs,{})})}):null,error:r}),r&&e.jsx(L,{variant:"body2",color:"error",children:l("studio.duplicateVideo")}),e.jsx(ft,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Ho,{children:[e.jsx(K,{onClick:()=>o(),children:l("studio.cancel")}),e.jsx(K,{disabled:!u||r,onClick:a,children:l("studio.confirm")})]})]})}wn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Dt({errors:t,storeList:o,...n}){const{t:l}=Q();return e.jsxs(c,{...n,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(L,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:l("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([i,d])=>{const r=Object.values(d),u=o.find(a=>a.url===i);return r.length>0&&e.jsxs(c,{children:[e.jsx(ke,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),r.map(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},i)})]})}Dt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const _o=x.lazy(()=>sn(()=>import("./index-aMtQhU6T.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function Cn({projectId:t,readOnly:o,loading:n,blocklet:l,params:i,setParams:d,paramsErrTip:r,setParamsErrTip:u,warning:a,setLoading:f,initUrl:m,initLogoUrl:j,setInitLogoUrl:y,componentDid:h}){const{t:p,locale:v}=Q(),{api:w}=je(),b=Tt(),k=x.useRef(null),C=x.useRef(null),[I,$]=Tr(l),[D,N]=x.useState(!1),z=an({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),E=async q=>{const F=setTimeout(()=>{f(!1)},2e4),X=await Pr(w,q);f(!1),clearTimeout(F),window.parent.postMessage({event:"studioDialog.connected",componentDid:h},"*"),b(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},Z=()=>{if(!i.blockletTitle){M.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(I!=null&&I.url)){M.error(p("blocklet.publish.noStoreSelected"));return}const q=$r();z(async(F,X)=>{var te,oe,ce;try{const ee=await w.connectByStudio({input:{did:(te=l==null?void 0:l.meta)==null?void 0:te.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:I.url,storeId:I.id,storeName:I.name,type:((oe=i==null?void 0:i.blockletComponents)==null?void 0:oe.length)>0?"pack":"resource",componentDid:h,messageId:q,tenantScope:(m==null?void 0:m.searchParams.get("tenantScope"))||""}});if(!(ee!=null&&ee.url)){M.error("failed to connect to store");return}X(ee.url),E({did:(ce=l==null?void 0:l.meta)==null?void 0:ce.did,projectId:"",messageId:q})}catch(ee){const pe=ge(ee);M.error(pe),f(!1)}})},{logoUrl:U,screenshotUrls:R,uploadLogoPrefix:g,uploadScreenshotPrefix:S}=Rn(i,l,t),{logoErrors:W,screenshotErrors:B,storeList:J,hasLogoWarning:T,hasScreenshotWarning:P}=a,H=()=>o?!1:!t||t===Y.UNOWNED_DID?(M.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,V=q=>{if(!q.destination)return;const F=Array.from(i.blockletScreenshots),[X]=F.splice(q.source.index,1);F.splice(q.destination.index,0,X),d(te=>({...te,blockletScreenshots:F}))},le=q=>{if(!q.destination)return;const F=Array.from(i.blockletVideos),[X]=F.splice(q.source.index,1);F.splice(q.destination.index,0,X),d(te=>({...te,blockletVideos:F}))};return e.jsxs(Ar,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:i.blockletTitle||"",onChange:q=>{u({blockletTitle:""}),d({blockletTitle:q.target.value})},error:!!r.blockletTitle,helperText:r.blockletTitle||""}),e.jsx(ne,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===Y.UNOWNED_DID&&e.jsx(Je,{position:"end",children:e.jsx(to,{blocklet:l,store:I,componentDid:h,onChangeStore:$,disabled:!i.blockletTitle||o||n,loading:n,onClick:Z})})},error:!!r.projectId,helperText:r.projectId||"",value:t===Y.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletDescription||"",onChange:q=>{u({blockletDescription:""}),d({blockletDescription:q.target.value})},error:!!r.blockletDescription,helperText:r.blockletDescription||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletHomepage||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?u({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:q.target.value})},error:!!r.blockletHomepage,helperText:r.blockletHomepage||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletCommunity||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)?u({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:q.target.value})},error:!!r.blockletCommunity,helperText:r.blockletCommunity||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletSupport||"",onChange:q=>{q.target.value&&!/^(http|https):\/\//.test(q.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(q.target.value)?u({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:q.target.value})},error:!!r.blockletSupport,helperText:r.blockletSupport||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletRepository||"",onChange:q=>{q.target.value&&!/^(git|https|svn)/.test(q.target.value)?u({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:q.target.value})},error:!!r.blockletRepository,helperText:r.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),e.jsxs(Re,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx($t,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:j||U,onClick:()=>{var q;H()&&((q=k.current)==null||q.open())}})})]}),T&&e.jsx(Dt,{errors:W,storeList:J,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),e.jsxs(Re,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:V,children:e.jsx(wo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(q,F)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:F.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:F.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:q.innerRef,...q.droppableProps,children:[R.map((X,te)=>e.jsx(Co,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ce)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ce.isDragging?"scale(1.05)":"none",boxShadow:ce.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:X}),!o&&e.jsx(ae,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ae,{className:"action",onClick:()=>{d(ee=>{const pe=[...ee.blockletScreenshots];return pe.splice(te,1),{...ee,blockletScreenshots:pe}})},children:e.jsx(nt,{})})]})},X)),q.placeholder,R.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var X;H()&&((X=C.current)==null||X.open())},children:"+"})]})})})]}),P&&e.jsx(Dt,{errors:B,storeList:J}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(Re,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(L,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),e.jsxs(Re,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"secondary.main"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:le,children:e.jsx(wo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(q,F)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:F.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:F.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:q.innerRef,...q.droppableProps,children:[i.blockletVideos.map((X,te)=>e.jsx(Co,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ce)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ce.isDragging?"scale(1.05)":"none",boxShadow:ce.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(ft,{url:X,style:{pointerEvents:ce.isDragging?"none":"auto"}}),!o&&e.jsx(ae,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ae,{className:"action",onClick:()=>{d(ee=>{const pe=[...ee.blockletVideos];return pe.splice(te,1),{...ee,blockletVideos:pe}})},children:e.jsx(nt,{})})]})},X)),q.placeholder,i.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{H()&&N(!0)},children:"+"})]})})})]})]})}),e.jsxs(x.Suspense,{fallback:e.jsx(Xe,{}),children:[e.jsx(_o,{ref:k,locale:v,popup:!0,onUploadFinish:q=>{var F;d({blockletLogo:q.data.filename}),y(""),(F=k.current)==null||F.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:g,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),D&&e.jsx(wn,{onClose:()=>N(!1),params:i,setParams:d}),e.jsx(_o,{ref:C,locale:v,popup:!0,onUploadFinish:q=>{var F;d(X=>{var oe;const te=X.blockletScreenshots||[];return te.push((oe=q.data)==null?void 0:oe.filename),{...X,blockletScreenshots:te}}),(F=C.current)==null||F.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:S,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-R.length}},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}Cn.propTypes={projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,setLoading:s.func.isRequired,initUrl:s.object.isRequired,componentDid:s.isRequired,initLogoUrl:s.string.isRequired,setInitLogoUrl:s.func.isRequired};const Ar=ve.div`
|
|
146
146
|
margin-top: 24px;
|
|
147
147
|
.screenshot {
|
|
148
148
|
margin-bottom: 16px;
|
|
@@ -176,7 +176,7 @@ import{r as x,f as Tt,l as ct,L as ke,g as Mn,u as Un,i as Vn,j as jt}from"./ven
|
|
|
176
176
|
width: 100%; /* 图像宽度填充容器 */
|
|
177
177
|
height: auto; /* 图像高度自适应 */
|
|
178
178
|
}
|
|
179
|
-
`;var oo={},zr=Ce;Object.defineProperty(oo,"__esModule",{value:!0});var Sn=oo.default=void 0,Or=zr(De()),Wr=e;Sn=oo.default=(0,Or.default)((0,Wr.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 Br=(t,o,n,l)=>{const i=t?[...t]:[],d=((o==null?void 0:o.children)||[]).reduce((r,u)=>(r[u.meta.did]=!0,r),{});return Object.keys(n).forEach(r=>{if(!d[r])return;let u=!1;l||i.forEach(a=>{a.did===r&&(a.included=!0,a.required=!0,u=!0)}),u||i.push({did:r,included:!0,required:!0})}),i},Mr=async t=>{if(typeof t!="string")throw new Error("URL must be a string");try{const o=t.split("/").pop().split("?")[0],l=await(await fetch(t)).blob();return new File([l],o,{type:l.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*Ur(t,o){let n=0;for(;n<t.size;)yield t.slice(n,n+o),n+=o}const Vr=async({did:t,projectId:o,uploadType:n="logo",imageUrl:l})=>{const i=await Mr(l);new FormData().append("file",i);const r={uploaderId:"Uploader",relativePath:encodeURIComponent(i.name),name:encodeURIComponent(i.name),type:i.type},a=(await vo.post(de(Y.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project",t,o,n,"upload"),null,{headers:{"Tus-Resumable":"1.0.0","Upload-Length":i.size,"X-Uploader-File-Ext":i.name.split(".").pop(),"Upload-Metadata":Object.keys(r).map(y=>`${y} ${btoa(r[y])}`).join(",")}})).headers.location,f=2*1024*1024;let b=0,j="";for(const y of Ur(i,f)){const h=await vo.patch(de(Y.WELLKNOWN_SERVICE_PATH_PREFIX,a),y,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":b,"Content-Type":"application/offset+octet-stream"}});b+=y.size,j=h.data.filename}return j},Dn=({params:t,projectId:o,status:n,t:l})=>{const i=[];return t.blockletTitle||i.push({param:"blockletTitle",message:l("blocklet.publish.errorTip.noTitle")}),(!o||o===Y.UNOWNED_DID)&&i.push({param:"projectId",message:l("blocklet.publish.errorTip.noDid")}),t.blockletVersion?We.valid(t.blockletVersion)||i.push({param:"blockletVersion",message:l("blocklet.publish.errorTip.inValidVersion")}):i.push({param:"blockletVersion",message:l("blocklet.publish.errorTip.noVersion")}),n===he.PROJECT.RELEASE_STATUS.published&&(t.blockletDescription||i.push({param:"blockletDescription",message:l("blocklet.publish.errorTip.noDescription")}),t.note||i.push({param:"note",message:l("blocklet.publish.errorTip.noNote")})),i.length?i:null},Fr=({params:t,step:o,t:n,projectId:l})=>{if(o===0){if(!t.blockletTitle)return n("blocklet.publish.errorTip.noTitle");if(!l||l===Y.UNOWNED_DID)return n("blocklet.publish.errorTip.noDid");if(!t.blockletDescription)return n("blocklet.publish.errorTip.noDescription")}if(o>=4){if(!t.blockletVersion)return n("blocklet.publish.errorTip.noVersion");if(!We.valid(t.blockletVersion))return n("blocklet.publish.errorTip.inValidVersion");if(!t.note)return n("blocklet.publish.errorTip.noNote")}return""};function no({blocklet:t,releaseId:o,connectedStores:n,projectId:l,releaseType:i,publishedStoreIds:d,onPublish:r,onDelete:u,warning:a,projectType:f,componentDid:b,onOpenConnectStore:j,behavior:y,onSelectConnectStore:h}){var $,I;const{t:p}=Q(),{actions:{refreshBlocklet:v}}=Se(),{session:w}=Ue(),{storeList:m}=eo({fromBlocklet:!0,blocklet:t,componentDid:b,userDid:($=w==null?void 0:w.user)==null?void 0:$.did}),k=x.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((L,z)=>(L[z.storeId]=z,L),{}):{},[n]),C=(I=t==null?void 0:t.meta)==null?void 0:I.did,T={};return Object.entries((a==null?void 0:a.logoErrors)||{}).forEach(([L,z])=>{const q=Object.values(z);q.length>0&&(T[L]=q)}),Object.entries((a==null?void 0:a.screenshotErrors)||{}).forEach(([L,z])=>{const q=Object.values(z);q.length>0&&(T[L]=T[L]?[...T[L],...q]:q)}),e.jsxs(e.Fragment,{children:[y==="connect"&&!!(m!=null&&m.length)&&e.jsx(dt,{severity:"info",style:{width:"100%"},children:e.jsxs(c,{color:Go[400],component:"a",href:f==="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(f==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),e.jsx(un,{sx:{marginLeft:1}})]})}),e.jsx(Jo,{children:m==null?void 0:m.map(L=>e.jsx(_t,{"data-cy":"store-switch",children:e.jsx(Xo,{children:e.jsx(Is,{behavior:y,onSelectConnectStore:h,releaseId:o,projectId:l,releaseType:i,kind:"publish",teamDid:C,warningList:T[L.url],store:L,published:(d==null?void 0:d.indexOf(L.id))>-1,connectedStore:k[L.id],onPublish:r,onDelete:u,scope:L.scope||"studio",onOpenConnectStore:j})})},L.url))}),e.jsx(cn,{teamDid:C,storeList:m,scope:"studio",onAdd:v})]})}no.propTypes={blocklet:s.object.isRequired,projectId:s.string.isRequired,releaseId:s.string.isRequired,releaseType:s.string.isRequired,onPublish:s.func,onDelete:s.func,publishedStoreIds:s.arrayOf(s.string),connectedStores:s.arrayOf(s.object).isRequired,projectType:s.string,componentDid:s.string,warning:s.object,onOpenConnectStore:s.func,onSelectConnectStore:s.func,behavior:s.string};no.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},warning:{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};const Hr=Yo(t=>({addMenuItemRoot:{marginTop:"8px",justifyContent:"center",color:t.palette.primary.main,lineHeight:"3.2"}}));function so({disabled:t,endpointList:o,teamDid:n,onAdd:l,hiddenChildren:i,open:d,onClose:r}){const{api:u}=ge(),[a,f]=x.useState(!1),[b,j]=x.useState(!0),[y,h]=x.useState(!1),[p,v]=x.useState(""),[w,m]=x.useState(""),{t:k}=Q(),C=Hr(),T=()=>{v(""),h(!1),r()},$=async()=>{f(!0);try{const{decoded:I}=cs(p,o);await u.addUploadEndpoint({input:{teamDid:n,url:I}}),l(I),T()}catch(I){const L=`${k("blocklet.publish.endpoint.addFailed")} ${xe(I)}`;m(L)}finally{f(!1)}};return e.jsxs(e.Fragment,{children:[!i&&e.jsxs(_t,{button:!0,disabled:t,className:C.addMenuItemRoot,onClick:()=>{h(!0)},children:[e.jsx(pt,{font:!0}),e.jsx(E,{variant:"inherit",children:k("blocklet.publish.endpoint.addEndpoint")})]}),e.jsxs(ut,{title:k("blocklet.publish.endpoint.addEndpoint"),fullWidth:!0,maxWidth:"md",open:d||y,onClose:T,PaperProps:{style:{minHeight:"auto"}},actions:e.jsxs(e.Fragment,{children:[e.jsx(qe,{onClick:I=>{I.stopPropagation(),T()},color:"inherit",children:k("common.cancel")}),e.jsxs(qe,{onClick:I=>{I.stopPropagation(),$()},color:"primary","data-cy":"install-blocklet-next-step",disabled:a||!p||b,variant:"contained",autoFocus:!0,children:[a&&e.jsx(Re,{size:16}),k("common.confirm")]})]}),children:[e.jsx("div",{style:{paddingTop:12,overflowY:"hidden"},children:e.jsx(Xn,{component:"div",children:e.jsx(E,{component:"div",children:e.jsx(ne,{label:k("blocklet.publish.endpoint.addEndpoint"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"add-blocklet-endpoint-url",fullWidth:!0,value:p,onChange:I=>{m(null);let L=!1;I.target.value.trim()||(L=!0),I.target.value.trim()||m(k("blocklet.publish.endpoint.urlEmpty")),v(I.target.value),j(L)},disabled:a,onKeyPress:I=>{I.key==="Enter"&&(I.preventDefault(),I.target.value.trim()?$():m(k("blocklet.publish.endpoint.urlEmpty")))}})})})}),!!w&&e.jsx(dt,{severity:"error",style:{width:"100%"},children:w})]})]})}so.propTypes={teamDid:s.string.isRequired,disabled:s.bool,endpointList:s.array,onAdd:s.func,hiddenChildren:s.bool,open:s.bool,onClose:s.func};so.defaultProps={disabled:!1,endpointList:[],onAdd:()=>{},hiddenChildren:!1,open:!1,onClose:()=>{}};function ro({endpoint:t,teamDid:o,onDelete:n,projectId:l="",children:i}){const{api:d}=ge(),{t:r}=Q(),u=Qo(),a=Se(),[f,b]=x.useState(!1),[j,y]=x.useState(null),h=()=>{b(!1),y(null)},p=async()=>{var m;try{b(!0),await d.deleteUploadEndpoint({input:{teamDid:o,did:t.id,projectId:l}}),await((m=a==null?void 0:a.actions)==null?void 0:m.refreshBlocklet()),n==null||n()}catch(k){B.error(`${r("blocklet.publish.endpoint.deleteFailed")}: ${xe(k)}`)}finally{b(!1),y(null)}},v={keyName:t.url,title:r("blocklet.publish.endpoint.deleteEndpoint"),description:r("blocklet.publish.endpoint.deleteDesc",{name:`<b>${t.url}</b>`,color:u.palette.error.main}),confirmPlaceholder:r("blocklet.publish.endpoint.confirmDesc",{name:t.url}),confirm:r("common.delConfirm"),cancel:r("common.cancel"),onConfirm:p,onCancel:h},w=m=>{t.protected||(m.stopPropagation(),y(v))};return e.jsxs(e.Fragment,{children:[i?e.jsx(c,{component:"span",onClick:w,children:i}):e.jsx(K,{"data-cy":"endpoint-action-delete",color:"primary",disabled:f,onClick:w,size:"small",children:e.jsx(nt,{sx:{zoom:.95}})}),j?e.jsx(zs,{keyName:j.keyName,title:j.title,description:j.description,confirmPlaceholder:j.confirmPlaceholder,confirm:j.confirm,cancel:j.cancel,params:j.params,onConfirm:j.onConfirm,onCancel:j.onCancel}):null]})}ro.propTypes={endpoint:s.object.isRequired,teamDid:s.string.isRequired,onDelete:s.func,projectId:s.string,children:s.node};ro.defaultProps={onDelete:"",projectId:"",children:null};function lo({connectedEndpoint:t,onDisconnect:o,onDelete:n,endpoint:l,teamDid:i,projectId:d}){const[r,u]=x.useState(null),a=!!r,{t:f}=Q(),[b,j]=x.useState(!1),y=m=>{m.stopPropagation(),window.open(hn(`${de(l.url)}`,{allowDomains:null}))},h=m=>{u(m.currentTarget)},p=()=>{u(null)},v=()=>{j(!1),o()},w=[{label:f("blocklet.publish.endpoint.visitEndpoint"),action:y,icon:un},{label:f("common.disconnect"),action:()=>{p(),j(!0)},icon:Ts,hidden:!t}];return e.jsxs(e.Fragment,{children:[e.jsx(K,{ref:r,color:"primary",onClick:h,size:"small",children:e.jsx(ms,{sx:{zoom:.95}})}),e.jsxs(Yn,{anchorEl:r,open:a,onClose:p,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:[w.map(m=>m.hidden?null:e.jsxs(fe,{dense:!0,onClick:m.action,disabled:m.disabled,children:[m.icon&&e.jsx(m.icon,{color:"action",sx:{marginRight:1}}),e.jsx(c,{color:"action",children:m.label})]},m.label)),e.jsx(ro,{endpoint:l,teamDid:i,onDelete:n,projectId:d,children:e.jsxs(fe,{dense:!0,disabled:l.protected,children:[e.jsx(nt,{sx:{color:l.protected?"action":"error.main",marginRight:1}}),e.jsx(c,{color:l.protected?"action":"error.main",children:f("common.delete")})]})})]}),b&&e.jsx(ht,{displayError:!0,title:`${f("common.disconnect")} ${l.appName}`,description:f("blocklet.publish.endpoint.disconnectEndpointTip",{url:l.url}),confirm:f("common.confirm"),onConfirm:v,onCancel:()=>j(!1)})]})}lo.propTypes={connectedEndpoint:s.object.isRequired,onDisconnect:s.func,onDelete:s.func,endpoint:s.object.isRequired,teamDid:s.string.isRequired,projectId:s.string};lo.defaultProps={projectId:"",onDelete:()=>{},onDisconnect:()=>{}};function rt({developerUrl:t,developerDid:o,sx:n,...l}){return e.jsx($t,{sx:{width:24,height:24,...n},src:de(new URL(t).origin,`/.well-known/service/user/avatar/${o}?imageFilter=resize&w=120&h=120`),...l})}rt.propTypes={developerDid:s.string.isRequired,developerUrl:s.string.isRequired,sx:s.object};rt.defaultProps={sx:{}};function io({endpoint:t,published:o}){const{t:n}=Q(),l=()=>{window.open(hn(`${de(t.url)}`,{allowDomains:null}))};return e.jsxs(c,{children:[e.jsx(E,{variant:"subtitle2",children:n(o?"blocklet.publish.endpoint.publishToEndpointSuccess":"blocklet.publish.endpoint.uploadToEndpointSuccess",{name:t.appName})}),e.jsx(K,{size:"small",sx:{mt:1},onClick:l,variant:"contained",color:"success",children:n("common.visitTarget",{name:t.appName})})]})}io.propTypes={endpoint:s.object.isRequired,published:s.bool.isRequired};io.defaultProps={};const Gr=Yo(()=>({buttonText:{textTransform:"none !important"},iconRoot:{minWidth:24},box:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",overflow:"hidden",width:"100%"},menuName:{flexShrink:1,display:"flex",flexDirection:"column",overflow:"hidden",flex:1},actions:{flex:1,display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center"},title:{fontSize:16,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},url:{fontSize:14,opacity:.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},buttonLine:{height:"100%",width:"1px",backgroundColor:"#e0e0e0"}})),qo=Qn(({className:t,...o})=>e.jsx(je,{...o,classes:{popper:t}}))(({theme:t})=>({[`& .${Zn.tooltip}`]:{backgroundColor:"#fff",color:"rgba(0, 0, 0, 0.87)",borderRadius:8,padding:t.spacing(2),fontSize:t.typography.pxToRem(12),border:"1px solid rgba(0,0,0,0.08)",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.05)"}}));function co({teamDid:t,projectId:o,releaseId:n,endpoint:l,warningList:i,onDelete:d,published:r,onPublish:u,connectedEndpoint:a,onOpenConnectEndpoint:f}){const b=Gr(),{t:j}=Q(),{api:y}=ge(),[h,p]=x.useState(!1),v=an({messageType:"connect-endpoint-message",onOpen:()=>p(!0),onClose:()=>p(!1)}),w=!!a,m=()=>{v(async(I,L)=>{try{const z=await y.connectToEndpoint({input:{did:t,endpointId:l.id,projectId:o}});if(!(z!=null&&z.url)){B.error("failed to connect to endpoint");return}L(z.url),await f({did:t,projectId:o,endpointId:l.id}),p(!1)}catch(z){const q=xe(z);B.error(q),p(!1)}})},k=async()=>{try{await y.disconnectFromEndpoint({input:{did:t,endpointId:l.id,projectId:o}}),d()}catch(I){B.error(xe(I))}},C=()=>{p(!0),y.publishToEndpoint({input:{did:t,endpointId:l.id,projectId:o,releaseId:n}}).then(()=>{B.success(e.jsx(io,{endpoint:l,published:!0}),{duration:1e4}),u==null||u(null)}).catch(I=>{B.error(xe(I)),u==null||u(I)}).finally(()=>{p(!1)})};x.useEffect(()=>{w&&p(!1)},[w]);const T=i.length>0,$=e.jsxs(K,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130,height:"100%"},disabled:T,onClick:C,children:[h?e.jsx(Re,{sx:{marginRight:1},size:16}):e.jsx($s,{sx:{marginRight:1,fontSize:20}}),j("common.upload")]});return e.jsxs(c,{className:b.box,children:[e.jsxs(c,{className:b.menuName,children:[e.jsx(c,{sx:{display:"flex",flexDirection:"row"},children:e.jsx(E,{component:"span",className:b.title,variant:"subtitle1",children:l.appName})}),e.jsx(E,{className:b.url,component:"span",variant:"inherit",children:`${l.url}`})]}),e.jsxs(c,{className:b.actions,children:[a&&e.jsx(qo,{placement:"top",title:e.jsxs(c,{children:[e.jsx(E,{component:"span",variant:"caption",sx:{opacity:.7},children:j("blocklet.publish.developerInfo")}),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:1,mt:1},children:[e.jsx(rt,{developerUrl:l.url,developerDid:a.developerDid,sx:{width:42,height:42}}),e.jsxs(c,{sx:{flex:1},children:[e.jsx(E,{component:"span",variant:"subtitle1",children:a.developerName}),e.jsx(Ct,{size:14,copyable:!0,compact:!0,responsive:!1,did:a.developerDid})]})]})]}),children:e.jsx(c,{children:e.jsx(rt,{developerUrl:l.url,developerDid:a.developerDid,sx:{marginRight:1,cursor:"help"}})})}),e.jsxs(tt,{disabled:h,variant:"outlined",sx:{height:38},size:"small",children:[!w&&e.jsxs(K,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},onClick:m,children:[h?e.jsx(Re,{sx:{marginRight:1},size:16}):e.jsx(Ps,{sx:{marginRight:1}}),j("common.connect")]}),w&&r&&e.jsxs(K,{disabled:!0,sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},children:[h?e.jsx(Re,{sx:{marginRight:1},size:16}):e.jsx(pn,{sx:{marginRight:1}}),j("common.uploaded")]}),w&&!r&&(T?e.jsx(qo,{title:e.jsxs(c,{children:[e.jsx(c,{sx:{color:"error.main",mb:.5},children:j("blocklet.publish.storeRule.warning")}),i.map((I,L)=>e.jsxs(c,{sx:{color:"error.main"},children:[L+1,". ",I]},I))]}),children:e.jsx("div",{children:$})}):$),e.jsx(lo,{projectId:o,endpoint:l,teamDid:t,connectedEndpoint:a,onDisconnect:k,onDelete:d})]})]})]})}co.propTypes={teamDid:s.string.isRequired,published:s.bool,connectedEndpoint:s.shape({endpointId:s.string,accessKeyId:s.string,accessKeySecret:s.string,createdBy:s.string,developerDid:s.string,developerName:s.string,developerEmail:s.string}),warningList:s.array,projectId:s.string,releaseId:s.string,endpoint:s.shape({id:s.string.isRequired,appName:s.string,url:s.string.isRequired,endpoint:s.string.isRequired,protected:s.bool,connected:s.bool}).isRequired,onDelete:s.func,onOpenConnectEndpoint:s.func,onPublish:s.func};co.defaultProps={published:!1,connectedEndpoint:null,projectId:"",warningList:[],releaseId:"",onDelete:()=>{},onOpenConnectEndpoint:()=>{},onPublish:()=>{}};function ao({releaseId:t,blocklet:o,connectedEndpoints:n,projectId:l,publishedEndpointIds:i,onPublish:d,onDelete:r,warning:u,onOpenConnectEndpoint:a}){var w,m;const{actions:{refreshBlocklet:f}}=Se(),{session:b}=Ue(),{t:j}=Q(),y=(((w=o==null?void 0:o.settings)==null?void 0:w.endpointList)||[]).filter(k=>{var C;return k.scope===((C=b==null?void 0:b.user)==null?void 0:C.did)}),h=x.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((k,C)=>(k[C.endpointId]=C,k),{}):{},[n]),p=(m=o==null?void 0:o.meta)==null?void 0:m.did,v={};return Object.entries((u==null?void 0:u.logoErrors)||{}).forEach(([k,C])=>{const T=Object.values(C);T.length>0&&(v[k]=T)}),Object.entries((u==null?void 0:u.screenshotErrors)||{}).forEach(([k,C])=>{const T=Object.values(C);T.length>0&&(v[k]=v[k]?[...v[k],...T]:T)}),e.jsxs(e.Fragment,{children:[!!(y!=null&&y.length)&&e.jsx(dt,{severity:"info",style:{width:"100%"},children:e.jsx(c,{color:Go[400],children:j("blocklet.publish.endpoint.uploadToEndpoint")})}),e.jsx(Jo,{sx:{flex:1},children:y==null?void 0:y.map(k=>e.jsx(_t,{"data-cy":"endpoint-switch",children:e.jsx(Xo,{children:e.jsx(co,{releaseId:t,projectId:l,teamDid:p,warningList:v[k.url],endpoint:k,published:(i==null?void 0:i.indexOf(k.id))>-1,connectedEndpoint:h[k.id],onPublish:d,onDelete:r,onOpenConnectEndpoint:a})})},k.url))}),e.jsx(so,{teamDid:p,endpointList:y,onAdd:f})]})}ao.propTypes={releaseId:s.string.isRequired,blocklet:s.object.isRequired,projectId:s.string.isRequired,warning:s.object,onPublish:s.func,onOpenConnectEndpoint:s.func,onDelete:s.func,connectedEndpoints:s.arrayOf(s.object).isRequired,publishedEndpointIds:s.arrayOf(s.string)};ao.defaultProps={publishedEndpointIds:[],onPublish:()=>{},onDelete:()=>{},warning:{},onOpenConnectEndpoint:()=>{}};function In({did:t,params:o,setParams:n,projectId:l,open:i,onClose:d}){const{t:r}=Q(),[u,a]=x.useState(!1),{api:f}=ge(),[b,j]=x.useState(!1),[y,h]=x.useState(!1),p=()=>{j(o.autoUpload),h(o.possibleSameStore),a(!1),d(!1)},v=async()=>{a(!0);try{await f.updateProject({input:{did:t,projectId:l,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!b,possibleSameStore:!!y}}),n({autoUpload:b,possibleSameStore:y}),d(!1)}catch(m){B.error(m.message)}a(!1)};x.useEffect(()=>{j(o.autoUpload),h(o.possibleSameStore)},[o]);const w=!!(l&&l!==Y.UNOWNED_DID);return e.jsx(ut,{title:r("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:i,onClose:p,actions:e.jsxs(e.Fragment,{children:[e.jsx(K,{onClick:m=>{m.stopPropagation(),d()},color:"inherit",children:r("common.cancel")}),w&&e.jsxs(K,{onClick:m=>{m.stopPropagation(),v()},color:"primary","data-cy":"install-blocklet-next-step",disabled:u,variant:"contained",autoFocus:!0,children:[u&&e.jsx(Re,{size:16}),r("common.confirm")]})]}),children:w?e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"ph:upload",sx:{fontSize:24,mr:2}}),e.jsx(E,{variant:"body1",sx:{flex:1},children:r("blocklet.publish.autoUploadTip")}),e.jsx(_e,{checked:b,onChange:(m,k)=>j(k)})]}),e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"fluent-mdl2:merge-duplicate",sx:{fontSize:24,mr:2}}),e.jsx(E,{variant:"body1",sx:{flex:1},children:r("blocklet.publish.possibleSameStoreTip")}),e.jsx(_e,{checked:y,onChange:(m,k)=>h(k)})]})]}):e.jsxs(c,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),e.jsx(E,{variant:"body1",sx:{flex:1},children:r("blocklet.publish.needProjectId")})]})})}In.propTypes={did:s.string.isRequired,params:s.object.isRequired,open:s.bool.isRequired,onClose:s.func.isRequired,setParams:s.func.isRequired,projectId:s.string.isRequired};function Tn({downloadUrl:t,installUrl:o,handleSetTip:n,isPack:l,disabled:i}){const{t:d}=Q(),[r,u]=x.useState(!1),a=x.useRef(null),f=()=>{u(!r)},b=j=>{a.current&&a.current.contains(j.target)||u(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(K,{disabled:i,ref:a,onClick:f,children:e.jsx(c,{component:ae,sx:{fontSize:18},icon:"bxs:download"})}),e.jsx(Wo,{sx:{zIndex:10},open:r,anchorEl:a.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:j})=>e.jsx(Bo,{...j,style:{transformOrigin:"center top"},children:e.jsx(Pt,{children:e.jsx(Mo,{onClickAway:b,children:e.jsxs(Uo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[l&&e.jsx(c,{component:"a",href:o,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(fe,{sx:{color:"#333"},children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"ic:round-install-desktop"}),e.jsx(E,{variant:"inherit",children:d("blocklet.publish.installToThisServer")})]})}),e.jsxs(fe,{onClick:n,children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"iconamoon:copy"}),e.jsx(E,{variant:"inherit",children:d("blocklet.publish.copyInstallUrl")})]}),e.jsx(c,{component:"a",href:t,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(fe,{sx:{color:"#333"},children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"ph:download"}),e.jsx(E,{variant:"inherit",children:d("common.download")})]})})]})})})})})]})}Tn.propTypes={disabled:s.bool.isRequired,isPack:s.bool.isRequired,downloadUrl:s.string.isRequired,installUrl:s.string.isRequired,handleSetTip:s.func.isRequired};var zo;const Eo=(zo=window.env)==null?void 0:zo.serverEndpoint;function $n({projectId:t,params:o,setParamsErrTip:n,initUrl:l,setParams:i,mode:d,loading:r,blocklet:u,release:a,isPublished:f,releaseId:b,getData:j,getRelease:y,paramsErrTip:h,warning:p,componentDid:v,resourceRelateComponents:w,disabledSelectComponents:m,saveSelectedEventsRef:k,hasSelectedResources:C,initLogoUrl:T,setLoading:$,releaseUsedLast:I,setReleaseUsedLast:L,projectType:z}){var Ee;const{t:q,locale:Z}=Q(),U=[{label:e.jsx(c,{textAlign:"center",width:"100%",children:q("blocklet.publish.store")}),value:"store"},{label:e.jsx(c,{textAlign:"center",width:"100%",children:q("blocklet.publish.endpoint.tab")}),value:"endpoint"}],[R,g]=x.useState(U[0].value),{api:D}=ge(),M=Tt(),[O,G]=x.useState(!1),[S,A]=x.useState(!1),[H,J]=x.useState(),Ie=Be(se=>se.breakpoints.down("md")),_=x.useMemo(()=>{var se;return o!=null&&o.blockletResourceType?o==null?void 0:o.blockletResourceType:((se=o==null?void 0:o.blockletComponents)==null?void 0:se.length)>0?(o==null?void 0:o.blockletComponents.find(W=>W.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),V=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:v},"*"),y()},X=async se=>{var Ae,Fe,ze,Qe;if(h!=null&&h.blockletHomepage||h!=null&&h.blockletSupport||h!=null&&h.blockletCommunity){B.error((h==null?void 0:h.blockletHomepage)||(h==null?void 0:h.blockletSupport)||(h==null?void 0:h.blockletCommunity));return}const Le=Dn({params:o,hasSelectedResources:C,projectId:t,status:se,t:q});if(Le){B.error(Le.map(F=>F.message).join("; ")),n(Le.reduce((F,re)=>({...F,[re.param]:re.message}),{}));return}const W={...o};if(W.blockletComponents=Br(W.blockletComponents,u,w,m),W.blockletVersion=We.valid(W.blockletVersion),!W.blockletVersion){B.error("Invalid Blocklet Version"),n({blockletVersion:"Invalid Blocklet Version"});return}if(T)try{const F=await Vr({did:u.meta.did,projectId:t,imageUrl:T});W.blockletLogo=F,i({blockletLogo:F})}catch(F){B.error(F.message);return}if(o.resourceFromSelect){W.uploadedResource="";try{const F=Object.keys(k.current);await st(F.map(re=>()=>{const He=k.current[re];return Rr({api:D,locale:Z,projectId:t,releaseId:I?"":b,appDid:u.meta.did,component:He.component,resources:He.resources,initUrl:l})}),{concurrency:2})}catch(F){B.error(((ze=(Fe=(Ae=F==null?void 0:F.response)==null?void 0:Ae.data)==null?void 0:Fe.error)==null?void 0:ze.message)||F.message),n({blockletResource:"Invalid save the resource"});return}}else(Qe=o.blockletDocker)!=null&&Qe.dockerImage||(W.blockletComponents=[]);W.blockletTitle=(W.blockletTitle||"").trim(),W.blockletDescription=(W.blockletDescription||"").trim(),W.blockletSupport=(W.blockletSupport||"").trim(),W.blockletHomepage=(W.blockletHomepage||"").trim(),W.blockletCommunity=(W.blockletCommunity||"").trim(),W.blockletRepository=(W.blockletRepository||"").trim(),W.blockletIntroduction=(W.blockletIntroduction||"").trim(),W.note=(W.note||"").trim(),W.blockletComponents=((W==null?void 0:W.blockletComponents)||[]).filter(F=>F.included).map(F=>Nt(F,["did","required"])).map(JSON.stringify),W.contentType!=="docker"&&(W.blockletDocker={dockerImage:"",dockerCommand:"",dockerArgs:[],dockerEnvs:[]}),W.blockletDocker.dockerImage=W.blockletDocker.dockerImage||"",W.blockletDocker.dockerArgs.length>0&&W.blockletDocker.dockerArgs.forEach(F=>{F.proxyBehavior=F.proxyBehavior||"service"});try{await D.createRelease({input:{...W,note:JSON.stringify({note:W.note}),did:u.meta.did,projectId:t,releaseId:I?"":b,status:se}}),se==="draft"?B.success(q("blocklet.publish.saveDraftSuccess")):(L(!1),B.success(q("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:v},"*")),n({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(F){const re=xe(F);B.error(re),(/resource/.test(re)||/zip/.test(re))&&n({blockletResource:re});return}const le=await D.getProject({input:{did:u.meta.did,projectId:t}}),Ne=le.project.lastReleaseId;o.autoUpload&&await st(le.project.connectedStores.map(F=>async()=>{try{const re=await D.publishToStore({input:{did:u.meta.did,storeId:F.storeId,storeName:F.storeName,projectId:t,releaseId:Ne,type:_}});B.success(e.jsx(_s,{storeName:F.storeName,storeUrl:F.storeUrl,developerDid:F.developerDid,did:u.meta.did,published:re.url==="published"}),{duration:1e4})}catch(re){B.error(xe(re))}}),{concurrency:4}),V==null||V(),M(`../${t}/view/${Ne}`,{replace:!0})},te=se=>($(!0),X(se).finally(()=>{$(!1)})),oe=async se=>{await _r(D,se),j()},ie=async se=>{await qr(D,se),j()},ee=()=>{A(!0)},ue=de(Eo,`/api/project/${u.meta.did}/${t}/${b}/release/blocklet.json`),pe=new URL(Eo);pe.pathname=de(pe.pathname,"/launch-blocklet/agreement"),pe.searchParams.set("blocklet_meta_url",ue);const Ye=pe.href,Ve=()=>J(ue);return e.jsxs(e.Fragment,{children:[e.jsx(Jr,{className:"sticky-header",children:e.jsx(Lt,{left:e.jsxs(Oo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(ke,{to:"../",children:q("common.blockletStudio")}),t===Y.UNOWNED_DID?e.jsx(E,{color:"text.primary",children:e.jsx(we,{maxLength:Ie?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):e.jsx(ke,{to:`../${t}`,children:e.jsx(we,{maxLength:Ie?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),e.jsx(E,{color:"text.primary",children:d==="create"?q("common.create"):(o==null?void 0:o.blockletVersion)||q("common.edit")})]}),actions:e.jsxs(e.Fragment,{children:[!f&&e.jsxs(tt,{disabled:r,variant:"contained",children:[e.jsxs(K,{variant:"contained",onClick:()=>te(he.PROJECT.RELEASE_STATUS.published),children:[r&&e.jsx(Re,{size:14,sx:{mr:.5},color:"inherit"}),q("blocklet.publish.createRelease")]}),e.jsx(K,{variant:"contained",onClick:ee,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]}),f&&e.jsxs(e.Fragment,{children:[e.jsx(at,{fullWidth:!0,maxWidth:"sm",open:H,onClose:()=>J(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(E,{variant:"h6",sx:{mb:2},children:q("blocklet.publish.installResourceTip")}),e.jsx(ln,{children:H}),e.jsxs(E,{sx:{mt:2},children:[q("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:q("blocklet.publish.installResourceHelp")})]})]})}),e.jsxs(tt,{disabled:r,variant:"contained",children:[e.jsxs(K,{onClick:()=>G(!0),children:[r?e.jsx(Re,{size:14,sx:{mr:1},color:"inherit"}):e.jsx(Sn,{sx:{fontSize:"1.3em",mr:1}}),q(Ie?"common.upload":"blocklet.publish.connectOrUpload")]}),e.jsx(Tn,{isPack:_==="pack",downloadUrl:de(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${u.meta.did}/${t}/${b}/download/${(a.files||[])[0]}`),installUrl:Ye,handleSetTip:Ve}),e.jsx(K,{onClick:ee,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})})}),e.jsx(ut,{title:q("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:O,onClose:()=>G(!1),children:e.jsxs(c,{children:[e.jsx(c,{mt:-2,mb:2,children:e.jsx(nn,{tabs:U,current:R,onChange:g})}),R==="store"&&e.jsx(no,{projectType:z,blocklet:u,releaseType:_,projectId:t,releaseId:b,componentDid:v,warning:p,onPublish:V,onOpenConnectStore:oe,onDelete:j,connectedStores:o.connectedStores||[],publishedStoreIds:a==null?void 0:a.publishedStoreIds}),R==="endpoint"&&e.jsx(ve,{minHeight:400,children:e.jsx(ao,{blocklet:u,releaseType:_,projectId:t,releaseId:b,warning:p,publishedEndpointIds:[],connectedEndpoints:o.connectedEndpoints||[],onPublish:V,onOpenConnectEndpoint:ie,onDelete:j})})]})}),e.jsx(In,{did:(Ee=u==null?void 0:u.meta)==null?void 0:Ee.did,params:o,projectId:t,open:S,setParams:i,onClose:()=>A(!1)})]})}$n.propTypes={projectId:s.string.isRequired,params:s.object.isRequired,mode:s.string.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,release:s.object.isRequired,isPublished:s.bool.isRequired,releaseId:s.string.isRequired,getData:s.func.isRequired,getRelease:s.func.isRequired,componentDid:s.string.isRequired,resourceRelateComponents:s.object.isRequired,disabledSelectComponents:s.bool.isRequired,saveSelectedEventsRef:s.object.isRequired,hasSelectedResources:s.bool.isRequired,initLogoUrl:s.string.isRequired,setLoading:s.func.isRequired,releaseUsedLast:s.bool.isRequired,setReleaseUsedLast:s.func.isRequired,projectType:s.string.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,setParams:s.func.isRequired,initUrl:s.object.isRequired,paramsErrTip:s.object.isRequired};const Jr=ye.div`
|
|
179
|
+
`;var oo={},zr=Se;Object.defineProperty(oo,"__esModule",{value:!0});var Sn=oo.default=void 0,Or=zr(Ie()),Wr=e;Sn=oo.default=(0,Or.default)((0,Wr.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 Br=(t,o,n,l)=>{const i=t?[...t]:[],d=((o==null?void 0:o.children)||[]).reduce((r,u)=>(r[u.meta.did]=!0,r),{});return Object.keys(n).forEach(r=>{if(!d[r])return;let u=!1;l||i.forEach(a=>{a.did===r&&(a.included=!0,a.required=!0,u=!0)}),u||i.push({did:r,included:!0,required:!0})}),i},Mr=async t=>{if(typeof t!="string")throw new Error("URL must be a string");try{const o=t.split("/").pop().split("?")[0],l=await(await fetch(t)).blob();return new File([l],o,{type:l.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*Ur(t,o){let n=0;for(;n<t.size;)yield t.slice(n,n+o),n+=o}const Vr=async({did:t,projectId:o,uploadType:n="logo",imageUrl:l})=>{const i=await Mr(l);new FormData().append("file",i);const r={uploaderId:"Uploader",relativePath:encodeURIComponent(i.name),name:encodeURIComponent(i.name),type:i.type},a=(await vo.post(ue(Y.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project",t,o,n,"upload"),null,{headers:{"Tus-Resumable":"1.0.0","Upload-Length":i.size,"X-Uploader-File-Ext":i.name.split(".").pop(),"Upload-Metadata":Object.keys(r).map(y=>`${y} ${btoa(r[y])}`).join(",")}})).headers.location,f=2*1024*1024;let m=0,j="";for(const y of Ur(i,f)){const h=await vo.patch(ue(Y.WELLKNOWN_SERVICE_PATH_PREFIX,a),y,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":m,"Content-Type":"application/offset+octet-stream"}});m+=y.size,j=h.data.filename}return j},Dn=({params:t,projectId:o,status:n,t:l})=>{const i=[];return t.blockletTitle||i.push({param:"blockletTitle",message:l("blocklet.publish.errorTip.noTitle")}),(!o||o===Y.UNOWNED_DID)&&i.push({param:"projectId",message:l("blocklet.publish.errorTip.noDid")}),t.blockletVersion?We.valid(t.blockletVersion)||i.push({param:"blockletVersion",message:l("blocklet.publish.errorTip.inValidVersion")}):i.push({param:"blockletVersion",message:l("blocklet.publish.errorTip.noVersion")}),n===fe.PROJECT.RELEASE_STATUS.published&&(t.blockletDescription||i.push({param:"blockletDescription",message:l("blocklet.publish.errorTip.noDescription")}),t.note||i.push({param:"note",message:l("blocklet.publish.errorTip.noNote")})),i.length?i:null},Fr=({params:t,step:o,t:n,projectId:l})=>{if(o===0){if(!t.blockletTitle)return n("blocklet.publish.errorTip.noTitle");if(!l||l===Y.UNOWNED_DID)return n("blocklet.publish.errorTip.noDid");if(!t.blockletDescription)return n("blocklet.publish.errorTip.noDescription")}if(o>=4){if(!t.blockletVersion)return n("blocklet.publish.errorTip.noVersion");if(!We.valid(t.blockletVersion))return n("blocklet.publish.errorTip.inValidVersion");if(!t.note)return n("blocklet.publish.errorTip.noNote")}return""};function no({blocklet:t,releaseId:o,connectedStores:n,projectId:l,releaseType:i,publishedStoreIds:d,onPublish:r,onDelete:u,warning:a,projectType:f,componentDid:m,onOpenConnectStore:j,behavior:y,onSelectConnectStore:h}){var $,D;const{t:p}=Q(),{actions:{refreshBlocklet:v}}=De(),{session:w}=Ue(),{storeList:b}=eo({fromBlocklet:!0,blocklet:t,componentDid:m,userDid:($=w==null?void 0:w.user)==null?void 0:$.did}),k=x.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((N,z)=>(N[z.storeId]=z,N),{}):{},[n]),C=(D=t==null?void 0:t.meta)==null?void 0:D.did,I={};return Object.entries((a==null?void 0:a.logoErrors)||{}).forEach(([N,z])=>{const E=Object.values(z);E.length>0&&(I[N]=E)}),Object.entries((a==null?void 0:a.screenshotErrors)||{}).forEach(([N,z])=>{const E=Object.values(z);E.length>0&&(I[N]=I[N]?[...I[N],...E]:E)}),e.jsxs(e.Fragment,{children:[y==="connect"&&!!(b!=null&&b.length)&&e.jsx(dt,{severity:"info",style:{width:"100%"},children:e.jsxs(c,{color:Go[400],component:"a",href:f==="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(f==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),e.jsx(un,{sx:{marginLeft:1}})]})}),e.jsx(Jo,{children:b==null?void 0:b.map(N=>e.jsx(_t,{"data-cy":"store-switch",children:e.jsx(Xo,{children:e.jsx(Is,{behavior:y,onSelectConnectStore:h,releaseId:o,projectId:l,releaseType:i,kind:"publish",teamDid:C,warningList:I[N.url],store:N,published:(d==null?void 0:d.indexOf(N.id))>-1,connectedStore:k[N.id],onPublish:r,onDelete:u,scope:N.scope||"studio",onOpenConnectStore:j})})},N.url))}),e.jsx(cn,{teamDid:C,storeList:b,scope:"studio",onAdd:v})]})}no.propTypes={blocklet:s.object.isRequired,projectId:s.string.isRequired,releaseId:s.string.isRequired,releaseType:s.string.isRequired,onPublish:s.func,onDelete:s.func,publishedStoreIds:s.arrayOf(s.string),connectedStores:s.arrayOf(s.object).isRequired,projectType:s.string,componentDid:s.string,warning:s.object,onOpenConnectStore:s.func,onSelectConnectStore:s.func,behavior:s.string};no.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},warning:{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};const Hr=Yo(t=>({addMenuItemRoot:{marginTop:"8px",justifyContent:"center",color:t.palette.primary.main,lineHeight:"3.2"}}));function so({disabled:t,endpointList:o,teamDid:n,onAdd:l,hiddenChildren:i,open:d,onClose:r}){const{api:u}=je(),[a,f]=x.useState(!1),[m,j]=x.useState(!0),[y,h]=x.useState(!1),[p,v]=x.useState(""),[w,b]=x.useState(""),{t:k}=Q(),C=Hr(),I=()=>{v(""),h(!1),r()},$=async()=>{f(!0);try{const{decoded:D}=cs(p,o);await u.addUploadEndpoint({input:{teamDid:n,url:D}}),l(D),I()}catch(D){const N=`${k("blocklet.publish.endpoint.addFailed")} ${ge(D)}`;b(N)}finally{f(!1)}};return e.jsxs(e.Fragment,{children:[!i&&e.jsxs(_t,{button:!0,disabled:t,className:C.addMenuItemRoot,onClick:()=>{h(!0)},children:[e.jsx(pt,{font:!0}),e.jsx(L,{variant:"inherit",children:k("blocklet.publish.endpoint.addEndpoint")})]}),e.jsxs(ut,{title:k("blocklet.publish.endpoint.addEndpoint"),fullWidth:!0,maxWidth:"md",open:d||y,onClose:I,PaperProps:{style:{minHeight:"auto"}},actions:e.jsxs(e.Fragment,{children:[e.jsx(qe,{onClick:D=>{D.stopPropagation(),I()},color:"inherit",children:k("common.cancel")}),e.jsxs(qe,{onClick:D=>{D.stopPropagation(),$()},color:"primary","data-cy":"install-blocklet-next-step",disabled:a||!p||m,variant:"contained",autoFocus:!0,children:[a&&e.jsx(we,{size:16}),k("common.confirm")]})]}),children:[e.jsx("div",{style:{paddingTop:12,overflowY:"hidden"},children:e.jsx(Xn,{component:"div",children:e.jsx(L,{component:"div",children:e.jsx(ne,{label:k("blocklet.publish.endpoint.addEndpoint"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"add-blocklet-endpoint-url",fullWidth:!0,value:p,onChange:D=>{b(null);let N=!1;D.target.value.trim()||(N=!0),D.target.value.trim()||b(k("blocklet.publish.endpoint.urlEmpty")),v(D.target.value),j(N)},disabled:a,onKeyPress:D=>{D.key==="Enter"&&(D.preventDefault(),D.target.value.trim()?$():b(k("blocklet.publish.endpoint.urlEmpty")))}})})})}),!!w&&e.jsx(dt,{severity:"error",style:{width:"100%"},children:w})]})]})}so.propTypes={teamDid:s.string.isRequired,disabled:s.bool,endpointList:s.array,onAdd:s.func,hiddenChildren:s.bool,open:s.bool,onClose:s.func};so.defaultProps={disabled:!1,endpointList:[],onAdd:()=>{},hiddenChildren:!1,open:!1,onClose:()=>{}};function ro({endpoint:t,teamDid:o,onDelete:n,projectId:l="",children:i}){const{api:d}=je(),{t:r}=Q(),u=Qo(),a=De(),[f,m]=x.useState(!1),[j,y]=x.useState(null),h=()=>{m(!1),y(null)},p=async()=>{var b;try{m(!0),await d.deleteUploadEndpoint({input:{teamDid:o,did:t.id,projectId:l}}),await((b=a==null?void 0:a.actions)==null?void 0:b.refreshBlocklet()),n==null||n()}catch(k){M.error(`${r("blocklet.publish.endpoint.deleteFailed")}: ${ge(k)}`)}finally{m(!1),y(null)}},v={keyName:t.url,title:r("blocklet.publish.endpoint.deleteEndpoint"),description:r("blocklet.publish.endpoint.deleteDesc",{name:`<b>${t.url}</b>`,color:u.palette.error.main}),confirmPlaceholder:r("blocklet.publish.endpoint.confirmDesc",{name:t.url}),confirm:r("common.delConfirm"),cancel:r("common.cancel"),onConfirm:p,onCancel:h},w=b=>{t.protected||(b.stopPropagation(),y(v))};return e.jsxs(e.Fragment,{children:[i?e.jsx(c,{component:"span",onClick:w,children:i}):e.jsx(K,{"data-cy":"endpoint-action-delete",color:"primary",disabled:f,onClick:w,size:"small",children:e.jsx(nt,{sx:{zoom:.95}})}),j?e.jsx(zs,{keyName:j.keyName,title:j.title,description:j.description,confirmPlaceholder:j.confirmPlaceholder,confirm:j.confirm,cancel:j.cancel,params:j.params,onConfirm:j.onConfirm,onCancel:j.onCancel}):null]})}ro.propTypes={endpoint:s.object.isRequired,teamDid:s.string.isRequired,onDelete:s.func,projectId:s.string,children:s.node};ro.defaultProps={onDelete:"",projectId:"",children:null};function lo({connectedEndpoint:t,onDisconnect:o,onDelete:n,endpoint:l,teamDid:i,projectId:d}){const[r,u]=x.useState(null),a=!!r,{t:f}=Q(),[m,j]=x.useState(!1),y=b=>{b.stopPropagation(),window.open(hn(`${ue(l.url)}`,{allowDomains:null}))},h=b=>{u(b.currentTarget)},p=()=>{u(null)},v=()=>{j(!1),o()},w=[{label:f("blocklet.publish.endpoint.visitEndpoint"),action:y,icon:un},{label:f("common.disconnect"),action:()=>{p(),j(!0)},icon:Ts,hidden:!t}];return e.jsxs(e.Fragment,{children:[e.jsx(K,{ref:r,color:"primary",onClick:h,size:"small",children:e.jsx(bs,{sx:{zoom:.95}})}),e.jsxs(Yn,{anchorEl:r,open:a,onClose:p,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:[w.map(b=>b.hidden?null:e.jsxs(be,{dense:!0,onClick:b.action,disabled:b.disabled,children:[b.icon&&e.jsx(b.icon,{color:"action",sx:{marginRight:1}}),e.jsx(c,{color:"action",children:b.label})]},b.label)),e.jsx(ro,{endpoint:l,teamDid:i,onDelete:n,projectId:d,children:e.jsxs(be,{dense:!0,disabled:l.protected,children:[e.jsx(nt,{sx:{color:l.protected?"action":"error.main",marginRight:1}}),e.jsx(c,{color:l.protected?"action":"error.main",children:f("common.delete")})]})})]}),m&&e.jsx(ht,{displayError:!0,title:`${f("common.disconnect")} ${l.appName}`,description:f("blocklet.publish.endpoint.disconnectEndpointTip",{url:l.url}),confirm:f("common.confirm"),onConfirm:v,onCancel:()=>j(!1)})]})}lo.propTypes={connectedEndpoint:s.object.isRequired,onDisconnect:s.func,onDelete:s.func,endpoint:s.object.isRequired,teamDid:s.string.isRequired,projectId:s.string};lo.defaultProps={projectId:"",onDelete:()=>{},onDisconnect:()=>{}};function rt({developerUrl:t,developerDid:o,sx:n,...l}){return e.jsx($t,{sx:{width:24,height:24,...n},src:ue(new URL(t).origin,`/.well-known/service/user/avatar/${o}?imageFilter=resize&w=120&h=120`),...l})}rt.propTypes={developerDid:s.string.isRequired,developerUrl:s.string.isRequired,sx:s.object};rt.defaultProps={sx:{}};function io({endpoint:t,published:o}){const{t:n}=Q(),l=()=>{window.open(hn(`${ue(t.url)}`,{allowDomains:null}))};return e.jsxs(c,{children:[e.jsx(L,{variant:"subtitle2",children:n(o?"blocklet.publish.endpoint.publishToEndpointSuccess":"blocklet.publish.endpoint.uploadToEndpointSuccess",{name:t.appName})}),e.jsx(K,{size:"small",sx:{mt:1},onClick:l,variant:"contained",color:"success",children:n("common.visitTarget",{name:t.appName})})]})}io.propTypes={endpoint:s.object.isRequired,published:s.bool.isRequired};io.defaultProps={};const Gr=Yo(()=>({buttonText:{textTransform:"none !important"},iconRoot:{minWidth:24},box:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",overflow:"hidden",width:"100%"},menuName:{flexShrink:1,display:"flex",flexDirection:"column",overflow:"hidden",flex:1},actions:{flex:1,display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center"},title:{fontSize:16,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},url:{fontSize:14,opacity:.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},buttonLine:{height:"100%",width:"1px",backgroundColor:"#e0e0e0"}})),qo=Qn(({className:t,...o})=>e.jsx(ke,{...o,classes:{popper:t}}))(({theme:t})=>({[`& .${Zn.tooltip}`]:{backgroundColor:"#fff",color:"rgba(0, 0, 0, 0.87)",borderRadius:8,padding:t.spacing(2),fontSize:t.typography.pxToRem(12),border:"1px solid rgba(0,0,0,0.08)",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.05)"}}));function co({teamDid:t,projectId:o,releaseId:n,endpoint:l,warningList:i,onDelete:d,published:r,onPublish:u,connectedEndpoint:a,onOpenConnectEndpoint:f}){const m=Gr(),{t:j}=Q(),{api:y}=je(),[h,p]=x.useState(!1),v=an({messageType:"connect-endpoint-message",onOpen:()=>p(!0),onClose:()=>p(!1)}),w=!!a,b=()=>{v(async(D,N)=>{try{const z=await y.connectToEndpoint({input:{did:t,endpointId:l.id,projectId:o}});if(!(z!=null&&z.url)){M.error("failed to connect to endpoint");return}N(z.url),await f({did:t,projectId:o,endpointId:l.id}),p(!1)}catch(z){const E=ge(z);M.error(E),p(!1)}})},k=async()=>{try{await y.disconnectFromEndpoint({input:{did:t,endpointId:l.id,projectId:o}}),d()}catch(D){M.error(ge(D))}},C=()=>{p(!0),y.publishToEndpoint({input:{did:t,endpointId:l.id,projectId:o,releaseId:n}}).then(()=>{M.success(e.jsx(io,{endpoint:l,published:!0}),{duration:1e4}),u==null||u(null)}).catch(D=>{M.error(ge(D)),u==null||u(D)}).finally(()=>{p(!1)})};x.useEffect(()=>{w&&p(!1)},[w]);const I=i.length>0,$=e.jsxs(K,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130,height:"100%"},disabled:I,onClick:C,children:[h?e.jsx(we,{sx:{marginRight:1},size:16}):e.jsx($s,{sx:{marginRight:1,fontSize:20}}),j("common.upload")]});return e.jsxs(c,{className:m.box,children:[e.jsxs(c,{className:m.menuName,children:[e.jsx(c,{sx:{display:"flex",flexDirection:"row"},children:e.jsx(L,{component:"span",className:m.title,variant:"subtitle1",children:l.appName})}),e.jsx(L,{className:m.url,component:"span",variant:"inherit",children:`${l.url}`})]}),e.jsxs(c,{className:m.actions,children:[a&&e.jsx(qo,{placement:"top",title:e.jsxs(c,{children:[e.jsx(L,{component:"span",variant:"caption",sx:{opacity:.7},children:j("blocklet.publish.developerInfo")}),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:1,mt:1},children:[e.jsx(rt,{developerUrl:l.url,developerDid:a.developerDid,sx:{width:42,height:42}}),e.jsxs(c,{sx:{flex:1},children:[e.jsx(L,{component:"span",variant:"subtitle1",children:a.developerName}),e.jsx(Ct,{size:14,copyable:!0,compact:!0,responsive:!1,did:a.developerDid})]})]})]}),children:e.jsx(c,{children:e.jsx(rt,{developerUrl:l.url,developerDid:a.developerDid,sx:{marginRight:1,cursor:"help"}})})}),e.jsxs(tt,{disabled:h,variant:"outlined",sx:{height:38},size:"small",children:[!w&&e.jsxs(K,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},onClick:b,children:[h?e.jsx(we,{sx:{marginRight:1},size:16}):e.jsx(Ps,{sx:{marginRight:1}}),j("common.connect")]}),w&&r&&e.jsxs(K,{disabled:!0,sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},children:[h?e.jsx(we,{sx:{marginRight:1},size:16}):e.jsx(pn,{sx:{marginRight:1}}),j("common.uploaded")]}),w&&!r&&(I?e.jsx(qo,{title:e.jsxs(c,{children:[e.jsx(c,{sx:{color:"error.main",mb:.5},children:j("blocklet.publish.storeRule.warning")}),i.map((D,N)=>e.jsxs(c,{sx:{color:"error.main"},children:[N+1,". ",D]},D))]}),children:e.jsx("div",{children:$})}):$),e.jsx(lo,{projectId:o,endpoint:l,teamDid:t,connectedEndpoint:a,onDisconnect:k,onDelete:d})]})]})]})}co.propTypes={teamDid:s.string.isRequired,published:s.bool,connectedEndpoint:s.shape({endpointId:s.string,accessKeyId:s.string,accessKeySecret:s.string,createdBy:s.string,developerDid:s.string,developerName:s.string,developerEmail:s.string}),warningList:s.array,projectId:s.string,releaseId:s.string,endpoint:s.shape({id:s.string.isRequired,appName:s.string,url:s.string.isRequired,endpoint:s.string.isRequired,protected:s.bool,connected:s.bool}).isRequired,onDelete:s.func,onOpenConnectEndpoint:s.func,onPublish:s.func};co.defaultProps={published:!1,connectedEndpoint:null,projectId:"",warningList:[],releaseId:"",onDelete:()=>{},onOpenConnectEndpoint:()=>{},onPublish:()=>{}};function ao({releaseId:t,blocklet:o,connectedEndpoints:n,projectId:l,publishedEndpointIds:i,onPublish:d,onDelete:r,warning:u,onOpenConnectEndpoint:a}){var w,b;const{actions:{refreshBlocklet:f}}=De(),{session:m}=Ue(),{t:j}=Q(),y=(((w=o==null?void 0:o.settings)==null?void 0:w.endpointList)||[]).filter(k=>{var C;return k.scope===((C=m==null?void 0:m.user)==null?void 0:C.did)}),h=x.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((k,C)=>(k[C.endpointId]=C,k),{}):{},[n]),p=(b=o==null?void 0:o.meta)==null?void 0:b.did,v={};return Object.entries((u==null?void 0:u.logoErrors)||{}).forEach(([k,C])=>{const I=Object.values(C);I.length>0&&(v[k]=I)}),Object.entries((u==null?void 0:u.screenshotErrors)||{}).forEach(([k,C])=>{const I=Object.values(C);I.length>0&&(v[k]=v[k]?[...v[k],...I]:I)}),e.jsxs(e.Fragment,{children:[!!(y!=null&&y.length)&&e.jsx(dt,{severity:"info",style:{width:"100%"},children:e.jsx(c,{color:Go[400],children:j("blocklet.publish.endpoint.uploadToEndpoint")})}),e.jsx(Jo,{sx:{flex:1},children:y==null?void 0:y.map(k=>e.jsx(_t,{"data-cy":"endpoint-switch",children:e.jsx(Xo,{children:e.jsx(co,{releaseId:t,projectId:l,teamDid:p,warningList:v[k.url],endpoint:k,published:(i==null?void 0:i.indexOf(k.id))>-1,connectedEndpoint:h[k.id],onPublish:d,onDelete:r,onOpenConnectEndpoint:a})})},k.url))}),e.jsx(so,{teamDid:p,endpointList:y,onAdd:f})]})}ao.propTypes={releaseId:s.string.isRequired,blocklet:s.object.isRequired,projectId:s.string.isRequired,warning:s.object,onPublish:s.func,onOpenConnectEndpoint:s.func,onDelete:s.func,connectedEndpoints:s.arrayOf(s.object).isRequired,publishedEndpointIds:s.arrayOf(s.string)};ao.defaultProps={publishedEndpointIds:[],onPublish:()=>{},onDelete:()=>{},warning:{},onOpenConnectEndpoint:()=>{}};function In({did:t,params:o,setParams:n,projectId:l,open:i,onClose:d}){const{t:r}=Q(),[u,a]=x.useState(!1),{api:f}=je(),[m,j]=x.useState(!1),[y,h]=x.useState(!1),p=()=>{j(o.autoUpload),h(o.possibleSameStore),a(!1),d(!1)},v=async()=>{a(!0);try{await f.updateProject({input:{did:t,projectId:l,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!m,possibleSameStore:!!y}}),n({autoUpload:m,possibleSameStore:y}),d(!1)}catch(b){M.error(b.message)}a(!1)};x.useEffect(()=>{j(o.autoUpload),h(o.possibleSameStore)},[o]);const w=!!(l&&l!==Y.UNOWNED_DID);return e.jsx(ut,{title:r("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:i,onClose:p,actions:e.jsxs(e.Fragment,{children:[e.jsx(K,{onClick:b=>{b.stopPropagation(),d()},color:"inherit",children:r("common.cancel")}),w&&e.jsxs(K,{onClick:b=>{b.stopPropagation(),v()},color:"primary","data-cy":"install-blocklet-next-step",disabled:u,variant:"contained",autoFocus:!0,children:[u&&e.jsx(we,{size:16}),r("common.confirm")]})]}),children:w?e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:de,icon:"ph:upload",sx:{fontSize:24,mr:2}}),e.jsx(L,{variant:"body1",sx:{flex:1},children:r("blocklet.publish.autoUploadTip")}),e.jsx(_e,{checked:m,onChange:(b,k)=>j(k)})]}),e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:de,icon:"fluent-mdl2:merge-duplicate",sx:{fontSize:24,mr:2}}),e.jsx(L,{variant:"body1",sx:{flex:1},children:r("blocklet.publish.possibleSameStoreTip")}),e.jsx(_e,{checked:y,onChange:(b,k)=>h(k)})]})]}):e.jsxs(c,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[e.jsx(c,{component:de,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),e.jsx(L,{variant:"body1",sx:{flex:1},children:r("blocklet.publish.needProjectId")})]})})}In.propTypes={did:s.string.isRequired,params:s.object.isRequired,open:s.bool.isRequired,onClose:s.func.isRequired,setParams:s.func.isRequired,projectId:s.string.isRequired};function Tn({downloadUrl:t,installUrl:o,handleSetTip:n,isPack:l,disabled:i}){const{t:d}=Q(),[r,u]=x.useState(!1),a=x.useRef(null),f=()=>{u(!r)},m=j=>{a.current&&a.current.contains(j.target)||u(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(K,{disabled:i,ref:a,onClick:f,children:e.jsx(c,{component:de,sx:{fontSize:18},icon:"bxs:download"})}),e.jsx(Wo,{sx:{zIndex:10},open:r,anchorEl:a.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:j})=>e.jsx(Bo,{...j,style:{transformOrigin:"center top"},children:e.jsx(Pt,{children:e.jsx(Mo,{onClickAway:m,children:e.jsxs(Uo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[l&&e.jsx(c,{component:"a",href:o,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(be,{sx:{color:"#333"},children:[e.jsx(c,{component:de,sx:{mr:1},icon:"ic:round-install-desktop"}),e.jsx(L,{variant:"inherit",children:d("blocklet.publish.installToThisServer")})]})}),e.jsxs(be,{onClick:n,children:[e.jsx(c,{component:de,sx:{mr:1},icon:"iconamoon:copy"}),e.jsx(L,{variant:"inherit",children:d("blocklet.publish.copyInstallUrl")})]}),e.jsx(c,{component:"a",href:t,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(be,{sx:{color:"#333"},children:[e.jsx(c,{component:de,sx:{mr:1},icon:"ph:download"}),e.jsx(L,{variant:"inherit",children:d("common.download")})]})})]})})})})})]})}Tn.propTypes={disabled:s.bool.isRequired,isPack:s.bool.isRequired,downloadUrl:s.string.isRequired,installUrl:s.string.isRequired,handleSetTip:s.func.isRequired};var zo;const Eo=(zo=window.env)==null?void 0:zo.serverEndpoint;function $n({projectId:t,params:o,setParamsErrTip:n,initUrl:l,setParams:i,mode:d,loading:r,blocklet:u,release:a,isPublished:f,releaseId:m,getData:j,getRelease:y,paramsErrTip:h,warning:p,componentDid:v,resourceRelateComponents:w,disabledSelectComponents:b,saveSelectedEventsRef:k,hasSelectedResources:C,initLogoUrl:I,setLoading:$,releaseUsedLast:D,setReleaseUsedLast:N,projectType:z}){var Ee;const{t:E,locale:Z}=Q(),U=[{label:e.jsx(c,{textAlign:"center",width:"100%",children:E("blocklet.publish.store")}),value:"store"},{label:e.jsx(c,{textAlign:"center",width:"100%",children:E("blocklet.publish.endpoint.tab")}),value:"endpoint"}],[R,g]=x.useState(U[0].value),{api:S}=je(),W=Tt(),[B,J]=x.useState(!1),[T,P]=x.useState(!1),[H,V]=x.useState(),le=Be(se=>se.breakpoints.down("md")),q=x.useMemo(()=>{var se;return o!=null&&o.blockletResourceType?o==null?void 0:o.blockletResourceType:((se=o==null?void 0:o.blockletComponents)==null?void 0:se.length)>0?(o==null?void 0:o.blockletComponents.find(O=>O.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),F=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:v},"*"),y()},X=async se=>{var Ae,Fe,ze,Qe;if(h!=null&&h.blockletHomepage||h!=null&&h.blockletSupport||h!=null&&h.blockletCommunity){M.error((h==null?void 0:h.blockletHomepage)||(h==null?void 0:h.blockletSupport)||(h==null?void 0:h.blockletCommunity));return}const Le=Dn({params:o,hasSelectedResources:C,projectId:t,status:se,t:E});if(Le){M.error(Le.map(G=>G.message).join("; ")),n(Le.reduce((G,re)=>({...G,[re.param]:re.message}),{}));return}const O={...o};if(O.blockletComponents=Br(O.blockletComponents,u,w,b),O.blockletVersion=We.valid(O.blockletVersion),!O.blockletVersion){M.error("Invalid Blocklet Version"),n({blockletVersion:"Invalid Blocklet Version"});return}if(I)try{const G=await Vr({did:u.meta.did,projectId:t,imageUrl:I});O.blockletLogo=G,i({blockletLogo:G})}catch(G){M.error(G.message);return}if(o.resourceFromSelect){O.uploadedResource="";try{const G=Object.keys(k.current);await st(G.map(re=>()=>{const He=k.current[re];return Rr({api:S,locale:Z,projectId:t,releaseId:D?"":m,appDid:u.meta.did,component:He.component,resources:He.resources,initUrl:l})}),{concurrency:2})}catch(G){M.error(((ze=(Fe=(Ae=G==null?void 0:G.response)==null?void 0:Ae.data)==null?void 0:Fe.error)==null?void 0:ze.message)||G.message),n({blockletResource:"Invalid save the resource"});return}}else(Qe=o.blockletDocker)!=null&&Qe.dockerImage||(O.blockletComponents=[]);O.blockletTitle=(O.blockletTitle||"").trim(),O.blockletDescription=(O.blockletDescription||"").trim(),O.blockletSupport=(O.blockletSupport||"").trim(),O.blockletHomepage=(O.blockletHomepage||"").trim(),O.blockletCommunity=(O.blockletCommunity||"").trim(),O.blockletRepository=(O.blockletRepository||"").trim(),O.blockletIntroduction=(O.blockletIntroduction||"").trim(),O.note=(O.note||"").trim(),O.blockletComponents=((O==null?void 0:O.blockletComponents)||[]).filter(G=>G.included).map(G=>Nt(G,["did","required"])).map(JSON.stringify),O.contentType!=="docker"&&(O.blockletDocker={dockerImage:"",dockerCommand:"",dockerArgs:[],dockerEnvs:[]}),O.blockletDocker.dockerImage=O.blockletDocker.dockerImage||"",O.blockletDocker.dockerArgs.length>0&&O.blockletDocker.dockerArgs.forEach(G=>{G.proxyBehavior=G.proxyBehavior||"service"});try{await S.createRelease({input:{...O,note:JSON.stringify({note:O.note}),did:u.meta.did,projectId:t,releaseId:D?"":m,status:se}}),se==="draft"?M.success(E("blocklet.publish.saveDraftSuccess")):(N(!1),M.success(E("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:v},"*")),n({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(G){const re=ge(G);M.error(re),(/resource/.test(re)||/zip/.test(re))&&n({blockletResource:re});return}const ie=await S.getProject({input:{did:u.meta.did,projectId:t}}),Ne=ie.project.lastReleaseId;o.autoUpload&&await st(ie.project.connectedStores.map(G=>async()=>{try{const re=await S.publishToStore({input:{did:u.meta.did,storeId:G.storeId,storeName:G.storeName,projectId:t,releaseId:Ne,type:q}});M.success(e.jsx(_s,{storeName:G.storeName,storeUrl:G.storeUrl,developerDid:G.developerDid,did:u.meta.did,published:re.url==="published"}),{duration:1e4})}catch(re){M.error(ge(re))}}),{concurrency:4}),F==null||F(),W(`../${t}/view/${Ne}`,{replace:!0})},te=se=>($(!0),X(se).finally(()=>{$(!1)})),oe=async se=>{await _r(S,se),j()},ce=async se=>{await qr(S,se),j()},ee=()=>{P(!0)},pe=ue(Eo,`/api/project/${u.meta.did}/${t}/${m}/release/blocklet.json`),he=new URL(Eo);he.pathname=ue(he.pathname,"/launch-blocklet/agreement"),he.searchParams.set("blocklet_meta_url",pe);const Ye=he.href,Ve=()=>V(pe);return e.jsxs(e.Fragment,{children:[e.jsx(Jr,{className:"sticky-header",children:e.jsx(Lt,{left:e.jsxs(Oo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(ye,{to:"../",children:E("common.blockletStudio")}),t===Y.UNOWNED_DID?e.jsx(L,{color:"text.primary",children:e.jsx(Ce,{maxLength:le?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):e.jsx(ye,{to:`../${t}`,children:e.jsx(Ce,{maxLength:le?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),e.jsx(L,{color:"text.primary",children:d==="create"?E("common.create"):(o==null?void 0:o.blockletVersion)||E("common.edit")})]}),actions:e.jsxs(e.Fragment,{children:[!f&&e.jsxs(tt,{disabled:r,variant:"contained",children:[e.jsxs(K,{variant:"contained",onClick:()=>te(fe.PROJECT.RELEASE_STATUS.published),children:[r&&e.jsx(we,{size:14,sx:{mr:.5},color:"inherit"}),E("blocklet.publish.createRelease")]}),e.jsx(K,{variant:"contained",onClick:ee,children:e.jsx(de,{icon:"mage:settings-fill",fontSize:"16px"})})]}),f&&e.jsxs(e.Fragment,{children:[e.jsx(at,{fullWidth:!0,maxWidth:"sm",open:H,onClose:()=>V(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(L,{variant:"h6",sx:{mb:2},children:E("blocklet.publish.installResourceTip")}),e.jsx(ln,{children:H}),e.jsxs(L,{sx:{mt:2},children:[E("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:E("blocklet.publish.installResourceHelp")})]})]})}),e.jsxs(tt,{disabled:r,variant:"contained",children:[e.jsxs(K,{onClick:()=>J(!0),children:[r?e.jsx(we,{size:14,sx:{mr:1},color:"inherit"}):e.jsx(Sn,{sx:{fontSize:"1.3em",mr:1}}),E(le?"common.upload":"blocklet.publish.connectOrUpload")]}),e.jsx(Tn,{isPack:q==="pack",downloadUrl:ue(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${u.meta.did}/${t}/${m}/download/${(a.files||[])[0]}`),installUrl:Ye,handleSetTip:Ve}),e.jsx(K,{onClick:ee,children:e.jsx(de,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})})}),e.jsx(ut,{title:E("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:B,onClose:()=>J(!1),children:e.jsxs(c,{children:[e.jsx(c,{mt:-2,mb:2,children:e.jsx(nn,{tabs:U,current:R,onChange:g})}),R==="store"&&e.jsx(no,{projectType:z,blocklet:u,releaseType:q,projectId:t,releaseId:m,componentDid:v,warning:p,onPublish:F,onOpenConnectStore:oe,onDelete:j,connectedStores:o.connectedStores||[],publishedStoreIds:a==null?void 0:a.publishedStoreIds}),R==="endpoint"&&e.jsx(Re,{minHeight:400,children:e.jsx(ao,{blocklet:u,releaseType:q,projectId:t,releaseId:m,warning:p,publishedEndpointIds:[],connectedEndpoints:o.connectedEndpoints||[],onPublish:F,onOpenConnectEndpoint:ce,onDelete:j})})]})}),e.jsx(In,{did:(Ee=u==null?void 0:u.meta)==null?void 0:Ee.did,params:o,projectId:t,open:T,setParams:i,onClose:()=>P(!1)})]})}$n.propTypes={projectId:s.string.isRequired,params:s.object.isRequired,mode:s.string.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,release:s.object.isRequired,isPublished:s.bool.isRequired,releaseId:s.string.isRequired,getData:s.func.isRequired,getRelease:s.func.isRequired,componentDid:s.string.isRequired,resourceRelateComponents:s.object.isRequired,disabledSelectComponents:s.bool.isRequired,saveSelectedEventsRef:s.object.isRequired,hasSelectedResources:s.bool.isRequired,initLogoUrl:s.string.isRequired,setLoading:s.func.isRequired,releaseUsedLast:s.bool.isRequired,setReleaseUsedLast:s.func.isRequired,projectType:s.string.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,setParams:s.func.isRequired,initUrl:s.object.isRequired,paramsErrTip:s.object.isRequired};const Jr=ve.div`
|
|
180
180
|
.sticky-header {
|
|
181
181
|
margin-top: -12px;
|
|
182
182
|
padding: 12px 0;
|
|
@@ -190,14 +190,14 @@ import{r as x,f as Tt,l as ct,L as ke,g as Mn,u as Un,i as Vn,j as jt}from"./ven
|
|
|
190
190
|
padding-bottom: 12px;
|
|
191
191
|
border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
|
|
192
192
|
}
|
|
193
|
-
`;function Pn({text:t}){const{palette:o}=Qo();return t?e.jsx(Os,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:gs.sanitize(t),rehypePlugins:[[Ws,{target:"_blank"}]]}):e.jsx(Me,{Icon:zt})}Pn.propTypes={text:s.string.isRequired};function _n({params:t,setParams:o,paramsErrTip:n,loading:l,setParamsErrTip:i,readOnly:d}){var b;const{t:r}=Q(),[u,a]=x.useState(d?"preview":"write"),f=(j,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(E,{variant:"h6",fontWeight:"bold",sx:{},children:r("common.introduction")}),e.jsxs(Zo,{value:u,onChange:f,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(ne,{disabled:l||d,sx:{border:"none"},placeholder:`Blocklet ${r("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Je,{position:"end",children:[((b=t==null?void 0:t.blockletIntroduction)==null?void 0:b.length)||0," / ",he.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:j=>{i({blockletIntroduction:""}),o({blockletIntroduction:j.target.value.slice(0,he.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(Pn,{text:t.blockletIntroduction||""})})]})}_n.propTypes={params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired};var uo={},Xr=Ce;Object.defineProperty(uo,"__esModule",{value:!0});var It=uo.default=void 0,Yr=Xr(De()),Lo=e;It=uo.default=(0,Yr.default)([(0,Lo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Lo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function po({step:t,ok:o,active:n,error:l,warning:i}){let d="grey.500",r=t+1;return o&&(r=e.jsx(pn,{sx:{fontSize:18,margin:0},color:"white"})),l||!o&&n>t?(d="error.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):i?(d="warning.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):n>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:r})}po.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};po.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function qn({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:l,params:i,loading:d,paramsErrTip:r,warning:u,viewMode:a,projectId:f}){const{t:b}=Q(),j=()=>{n(v=>v+1)},y=()=>{n(v=>v-1)},h=v=>v===0?(r==null?void 0:r.blockletTitle)||(r==null?void 0:r.projectId)||(r==null?void 0:r.blockletDescription)||(r==null?void 0:r.blockletHomepage)||(r==null?void 0:r.blockletSupport)||(r==null?void 0:r.blockletCommunity)||(r==null?void 0:r.blockletRepository):v===2?(r==null?void 0:r.blockletResource)||(r==null?void 0:r.blockletDocker)||(r==null?void 0:r.dockerImageName):v>=4?(r==null?void 0:r.blockletVersion)||(r==null?void 0:r.note):"",p=a||Dn({hasSelectedResources:l,params:i,projectId:f,t:b})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(Kn,{activeStep:o,orientation:"vertical",children:t.map((v,w)=>{const m={},k=d||!Fr({hasSelectedResources:l,params:i,projectId:f,step:w,t:b}),C=d?"":h(w);return C&&(m.optional=e.jsx(E,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:C}),m.error=!0),e.jsxs(es,{children:[e.jsx(ts,{icon:e.jsx(po,{error:C,warning:w===0?u.hasWarning:!1,active:p?99:o,step:w,ok:k}),sx:{cursor:"pointer",color:C?"error.main":"inherit"},disabled:!1,onClick:()=>n(w),...m,children:e.jsx(E,{fontSize:"14px",fontWeight:"500",color:C||!k&&o>w?"error.main":"inherit",children:v.label})}),e.jsxs(os,{children:[e.jsx(E,{fontSize:12,children:v.description}),!p&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[w<t.length-1&&e.jsx(K,{variant:"contained",onClick:j,sx:{mt:1,mr:1},disabled:C||!k,children:b("common.continue")}),w>0&&e.jsx(K,{disabled:w===0,onClick:y,sx:{mt:1,mr:1},children:b("common.back")})]})})]})]},v.label)})}),o>=t.length-1&&e.jsx(Pt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(E,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}qn.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.string.isRequired,loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.bool.isRequired,warning:s.object.isRequired,paramsErrTip:s.shape({projectId:s.string,blockletVersion:s.string,blockletTitle:s.string,blockletDescription:s.string,note:s.string,blockletResource:s.string,blockletHomepage:s.string,blockletSupport:s.string,blockletCommunity:s.string,blockletRepository:s.string,blockletDocker:s.object,dockerImageName:s.string}).isRequired};const Qr=[".zip",".gz"],Zr=1024*1024*100,Kr=x.lazy(()=>sn(()=>import("./index-DBajhv2h.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ho({app:t,projectId:o,readOnly:n,params:l,setParams:i,setParamsErrTip:d,error:r}){const{t:u,locale:a}=Q(),f=x.useRef(null),b=()=>n?!1:!o||o===Y.UNOWNED_DID?(B.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,j=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(E,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(ve,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!l.uploadedResource&&e.jsx(E,{component:"a",href:`${j}/params.uploadedResource`,children:l.uploadedResource}),!n&&e.jsx(K,{variant:"outlined",size:"small",onClick:()=>{var y;b()&&((y=f.current)==null||y.open())},children:l.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(x.Suspense,{fallback:e.jsx(Xe,{}),children:e.jsx(Kr,{ref:f,locale:a,popup:!0,onUploadFinish:y=>{var h;i({uploadedResource:y.data.filename}),d({blockletResource:""}),(h=f.current)==null||h.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:j,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Qr,maxFileSize:Zr,maxNumberOfFiles:1}}},"uploader-resource")}),!!r&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:r})]})}ho.propTypes={app:s.object.isRequired,projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired};ho.defaultProps={};function lt({readOnly:t,params:o,setParams:n,paramsErrTip:l,setParamsErrTip:i,loading:d}){var u;const{t:r}=Q();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:d||t,label:`Blocklet ${r("common.version")}`,placeholder:`Blocklet ${r("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:a=>{i({blockletVersion:""}),n({blockletVersion:a.target.value})},error:!!l.blockletVersion,helperText:l.blockletVersion||""}),e.jsx(ne,{label:r("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Je,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",he.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:a=>{i({note:""}),n({note:a.target.value.slice(0,he.PROJECT.MAX_NOTE_LENGTH)})},error:!!l.note,helperText:l.note||"",sx:{mt:3}})]})})}lt.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,loading:s.bool.isRequired};lt.defaultProps={};function En(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&En(t[o]);return t}function it({index:t,item:o,dockerParams:n,setDockerParams:l,dataKey:i,t:d,readOnly:r}){const u=(o==null?void 0:o.value)||"",[a,f]=x.useState(!1),b=()=>{var U;(U=n[i])==null||U.splice(t,1),l({...n,[i]:[...n[i]]})},j=(U,R)=>{var g;(g=n[i])!=null&&g[t]&&(R?(n[i][t].custom=n[i][t].value,n[i][t].value=`$${yt(o.key)}`):(n[i][t].value=n[i][t].custom||"",n[i][t].custom="")),l({...n,[i]:[...n[i]]})},y=(U,R)=>{var D;const g=((D=n[i][t])==null?void 0:D.value)||"";n[i][t]={...n[i][t],secure:R,value:R&&g===he.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},h=(U,R)=>{n[i][t]={...n[i][t],shared:R},l({...n,[i]:[...n[i]]})},p=(U,R)=>{var D;const g=((D=n[i][t])==null?void 0:D.value)||"";n[i][t]={...n[i][t],required:R,value:R&&g===he.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},v=(U,R)=>{n[i][t]={...n[i][t],value:R?he.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},l({...n,[i]:[...n[i]]})},w=U=>{n[i][t]={...n[i][t],description:U.target.value},l({...n,[i]:[...n[i]]})},m=U=>{const R=U.target.value==="web"?"web":"docker";R==="web"&&n.dockerArgs.forEach(M=>{M.type="docker"});const D=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:R,path:R==="docker"?D:"/",protocol:"http",prefix:R==="docker"?D:"/",name:"publicUrl",port:"BLOCKLET_PORT"},l({...n,dockerArgs:[...n.dockerArgs]})},k=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},l({...n,dockerArgs:[...n.dockerArgs]})},C=U=>{const R=U.target.value;n[i][t]={...n[i][t],prefix:R,path:R==="*"?"/":R},l({...n,[i]:[...n[i]]})},T=U=>{var R;(R=n[i])!=null&&R[t]&&(n[i][t].value=U.target.value),l({...n,[i]:[...n[i]]})},$=u===`$${yt(o.key)}`||o.custom,I=i==="dockerArgs"&&!dn[o.key],L=qs[o.key],z=i==="dockerEnvs",q=o.key==="--publish";let Z=o.key;return q&&o.type==="web"?Z="--publish (Web)":z&&(Z=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(E,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:Z})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(ne,{disabled:r||$||I||o.value===he.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:$?`$${yt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Je,{position:"end",sx:{zoom:.9},children:[(!(L||I)||z||q)&&e.jsx(ce,{onClick:()=>f(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!r&&e.jsx(ce,{onClick:b,color:I?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})},error:I,onChange:T}),I&&e.jsx(E,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(E,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Es[o.key](u)&&e.jsx(E,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(ut,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(z?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[L||I||z?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx(_e,{disabled:r,checked:$,onChange:j,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.shared")}),e.jsx(_e,{disabled:r,checked:o.shared,onChange:h,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.required")}),e.jsx(_e,{disabled:r,checked:o.required,onChange:p,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.secure")}),e.jsx(_e,{disabled:r,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx(_e,{disabled:r,checked:o.value===he.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:v,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.description")}),e.jsx(ne,{disabled:r,value:o.description,onChange:w,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),q&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.portType")}),e.jsxs(wt,{value:o.type||"docker",onChange:m,children:[e.jsx(fe,{value:"docker",children:"Docker"}),e.jsx(fe,{value:"web",children:"Web"})]})]}),q&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(wt,{value:o.proxyBehavior||"service",onChange:k,children:[e.jsx(fe,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(fe,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),q&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.prefix")}),e.jsx(ne,{disabled:r,value:o.prefix,onChange:C,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}it.propTypes={dockerParams:s.object.isRequired,setDockerParams:s.func.isRequired,dataKey:s.string.isRequired,item:s.object.isRequired,t:s.func.isRequired,readOnly:s.bool.isRequired,index:s.number.isRequired};it.defaultProps={};const el=`
|
|
193
|
+
`;function Pn({text:t}){const{palette:o}=Qo();return t?e.jsx(Os,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:gs.sanitize(t),rehypePlugins:[[Ws,{target:"_blank"}]]}):e.jsx(Me,{Icon:zt})}Pn.propTypes={text:s.string.isRequired};function _n({params:t,setParams:o,paramsErrTip:n,loading:l,setParamsErrTip:i,readOnly:d}){var m;const{t:r}=Q(),[u,a]=x.useState(d?"preview":"write"),f=(j,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(L,{variant:"h6",fontWeight:"bold",sx:{},children:r("common.introduction")}),e.jsxs(Zo,{value:u,onChange:f,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(ne,{disabled:l||d,sx:{border:"none"},placeholder:`Blocklet ${r("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Je,{position:"end",children:[((m=t==null?void 0:t.blockletIntroduction)==null?void 0:m.length)||0," / ",fe.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:j=>{i({blockletIntroduction:""}),o({blockletIntroduction:j.target.value.slice(0,fe.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(Pn,{text:t.blockletIntroduction||""})})]})}_n.propTypes={params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired};var uo={},Xr=Se;Object.defineProperty(uo,"__esModule",{value:!0});var It=uo.default=void 0,Yr=Xr(Ie()),Lo=e;It=uo.default=(0,Yr.default)([(0,Lo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Lo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function po({step:t,ok:o,active:n,error:l,warning:i}){let d="grey.500",r=t+1;return o&&(r=e.jsx(pn,{sx:{fontSize:18,margin:0},color:"white"})),l||!o&&n>t?(d="error.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):i?(d="warning.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):n>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:r})}po.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};po.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function qn({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:l,params:i,loading:d,paramsErrTip:r,warning:u,viewMode:a,projectId:f}){const{t:m}=Q(),j=()=>{n(v=>v+1)},y=()=>{n(v=>v-1)},h=v=>v===0?(r==null?void 0:r.blockletTitle)||(r==null?void 0:r.projectId)||(r==null?void 0:r.blockletDescription)||(r==null?void 0:r.blockletHomepage)||(r==null?void 0:r.blockletSupport)||(r==null?void 0:r.blockletCommunity)||(r==null?void 0:r.blockletRepository):v===2?(r==null?void 0:r.blockletResource)||(r==null?void 0:r.blockletDocker)||(r==null?void 0:r.dockerImageName):v>=4?(r==null?void 0:r.blockletVersion)||(r==null?void 0:r.note):"",p=a||Dn({hasSelectedResources:l,params:i,projectId:f,t:m})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(Kn,{activeStep:o,orientation:"vertical",children:t.map((v,w)=>{const b={},k=d||!Fr({hasSelectedResources:l,params:i,projectId:f,step:w,t:m}),C=d?"":h(w);return C&&(b.optional=e.jsx(L,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:C}),b.error=!0),e.jsxs(es,{children:[e.jsx(ts,{icon:e.jsx(po,{error:C,warning:w===0?u.hasWarning:!1,active:p?99:o,step:w,ok:k}),sx:{cursor:"pointer",color:C?"error.main":"inherit"},disabled:!1,onClick:()=>n(w),...b,children:e.jsx(L,{fontSize:"14px",fontWeight:"500",color:C||!k&&o>w?"error.main":"inherit",children:v.label})}),e.jsxs(os,{children:[e.jsx(L,{fontSize:12,children:v.description}),!p&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[w<t.length-1&&e.jsx(K,{variant:"contained",onClick:j,sx:{mt:1,mr:1},disabled:C||!k,children:m("common.continue")}),w>0&&e.jsx(K,{disabled:w===0,onClick:y,sx:{mt:1,mr:1},children:m("common.back")})]})})]})]},v.label)})}),o>=t.length-1&&e.jsx(Pt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(L,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}qn.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.string.isRequired,loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.bool.isRequired,warning:s.object.isRequired,paramsErrTip:s.shape({projectId:s.string,blockletVersion:s.string,blockletTitle:s.string,blockletDescription:s.string,note:s.string,blockletResource:s.string,blockletHomepage:s.string,blockletSupport:s.string,blockletCommunity:s.string,blockletRepository:s.string,blockletDocker:s.object,dockerImageName:s.string}).isRequired};const Qr=[".zip",".gz"],Zr=1024*1024*100,Kr=x.lazy(()=>sn(()=>import("./index-aMtQhU6T.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ho({app:t,projectId:o,readOnly:n,params:l,setParams:i,setParamsErrTip:d,error:r}){const{t:u,locale:a}=Q(),f=x.useRef(null),m=()=>n?!1:!o||o===Y.UNOWNED_DID?(M.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,j=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(L,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(Re,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!l.uploadedResource&&e.jsx(L,{component:"a",href:`${j}/params.uploadedResource`,children:l.uploadedResource}),!n&&e.jsx(K,{variant:"outlined",size:"small",onClick:()=>{var y;m()&&((y=f.current)==null||y.open())},children:l.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(x.Suspense,{fallback:e.jsx(Xe,{}),children:e.jsx(Kr,{ref:f,locale:a,popup:!0,onUploadFinish:y=>{var h;i({uploadedResource:y.data.filename}),d({blockletResource:""}),(h=f.current)==null||h.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:j,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Qr,maxFileSize:Zr,maxNumberOfFiles:1}}},"uploader-resource")}),!!r&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:r})]})}ho.propTypes={app:s.object.isRequired,projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired};ho.defaultProps={};function lt({readOnly:t,params:o,setParams:n,paramsErrTip:l,setParamsErrTip:i,loading:d}){var u;const{t:r}=Q();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:d||t,label:`Blocklet ${r("common.version")}`,placeholder:`Blocklet ${r("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:a=>{i({blockletVersion:""}),n({blockletVersion:a.target.value})},error:!!l.blockletVersion,helperText:l.blockletVersion||""}),e.jsx(ne,{label:r("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Je,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",fe.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:a=>{i({note:""}),n({note:a.target.value.slice(0,fe.PROJECT.MAX_NOTE_LENGTH)})},error:!!l.note,helperText:l.note||"",sx:{mt:3}})]})})}lt.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,loading:s.bool.isRequired};lt.defaultProps={};function En(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&En(t[o]);return t}function it({index:t,item:o,dockerParams:n,setDockerParams:l,dataKey:i,t:d,readOnly:r}){const u=(o==null?void 0:o.value)||"",[a,f]=x.useState(!1),m=()=>{var U;(U=n[i])==null||U.splice(t,1),l({...n,[i]:[...n[i]]})},j=(U,R)=>{var g;(g=n[i])!=null&&g[t]&&(R?(n[i][t].custom=n[i][t].value,n[i][t].value=`$${yt(o.key)}`):(n[i][t].value=n[i][t].custom||"",n[i][t].custom="")),l({...n,[i]:[...n[i]]})},y=(U,R)=>{var S;const g=((S=n[i][t])==null?void 0:S.value)||"";n[i][t]={...n[i][t],secure:R,value:R&&g===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},h=(U,R)=>{n[i][t]={...n[i][t],shared:R},l({...n,[i]:[...n[i]]})},p=(U,R)=>{var S;const g=((S=n[i][t])==null?void 0:S.value)||"";n[i][t]={...n[i][t],required:R,value:R&&g===fe.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},v=(U,R)=>{n[i][t]={...n[i][t],value:R?fe.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},l({...n,[i]:[...n[i]]})},w=U=>{n[i][t]={...n[i][t],description:U.target.value},l({...n,[i]:[...n[i]]})},b=U=>{const R=U.target.value==="web"?"web":"docker";R==="web"&&n.dockerArgs.forEach(W=>{W.type="docker"});const S=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:R,path:R==="docker"?S:"/",protocol:"http",prefix:R==="docker"?S:"/",name:"publicUrl",port:"BLOCKLET_PORT"},l({...n,dockerArgs:[...n.dockerArgs]})},k=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},l({...n,dockerArgs:[...n.dockerArgs]})},C=U=>{const R=U.target.value;n[i][t]={...n[i][t],prefix:R,path:R==="*"?"/":R},l({...n,[i]:[...n[i]]})},I=U=>{var R;(R=n[i])!=null&&R[t]&&(n[i][t].value=U.target.value),l({...n,[i]:[...n[i]]})},$=u===`$${yt(o.key)}`||o.custom,D=i==="dockerArgs"&&!dn[o.key],N=qs[o.key],z=i==="dockerEnvs",E=o.key==="--publish";let Z=o.key;return E&&o.type==="web"?Z="--publish (Web)":z&&(Z=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(L,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:Z})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(ne,{disabled:r||$||D||o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:$?`$${yt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Je,{position:"end",sx:{zoom:.9},children:[(!(N||D)||z||E)&&e.jsx(ae,{onClick:()=>f(!0),children:e.jsx(de,{icon:"icon-park-outline:setting-config"})}),!r&&e.jsx(ae,{onClick:m,color:D?"error":"default",children:e.jsx(de,{icon:"ic:round-delete"})})]})},error:D,onChange:I}),D&&e.jsx(L,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Es[o.key](u)&&e.jsx(L,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(ut,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(z?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[N||D||z?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx(_e,{disabled:r,checked:$,onChange:j,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.shared")}),e.jsx(_e,{disabled:r,checked:o.shared,onChange:h,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.required")}),e.jsx(_e,{disabled:r,checked:o.required,onChange:p,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.secure")}),e.jsx(_e,{disabled:r,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx(_e,{disabled:r,checked:o.value===fe.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:v,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:d("blocklet.publish.docker.description")}),e.jsx(ne,{disabled:r,value:o.description,onChange:w,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),E&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:d("blocklet.publish.docker.portType")}),e.jsxs(wt,{value:o.type||"docker",onChange:b,children:[e.jsx(be,{value:"docker",children:"Docker"}),e.jsx(be,{value:"web",children:"Web"})]})]}),E&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(wt,{value:o.proxyBehavior||"service",onChange:k,children:[e.jsx(be,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(be,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),E&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(L,{sx:{flex:1},children:d("blocklet.publish.docker.prefix")}),e.jsx(ne,{disabled:r,value:o.prefix,onChange:C,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}it.propTypes={dockerParams:s.object.isRequired,setDockerParams:s.func.isRequired,dataKey:s.string.isRequired,item:s.object.isRequired,t:s.func.isRequired,readOnly:s.bool.isRequired,index:s.number.isRequired};it.defaultProps={};const el=`
|
|
194
194
|
docker run --name postgrest
|
|
195
195
|
-p 3000:3000
|
|
196
196
|
-e PGRST_DB_URI="postgres://username:password@host:port/database"
|
|
197
197
|
-e PGRST_DB_SCHEMA="public"
|
|
198
198
|
-e PGRST_DB_ANON_ROLE="anon"
|
|
199
199
|
postgrest/postgrest
|
|
200
|
-
`.trim();function fo({readOnly:t,paramsErrTip:o,setParamsErrTip:n,error:l,params:i,setParams:d}){const{t:r}=Q(),[u,a]=x.useState("dockerParams"),[f,b]=x.useState(""),[j,y]=x.useState(!1),[h,p]=x.useState("--volume"),[v,w]=x.useState(""),[m,k]=x.useState(So(f)),C=m.dockerArgs||[],T=m.dockerEnvs||[],$=m.dockerImage||"",I=m.dockerCommand||"",L=g=>{const{value:D}=g.target;b(D)};x.useEffect(()=>{i.blockletDocker&&i.blockletDocker.dockerImage&&!$&&k(i.blockletDocker)},[i,$,k]);const z=g=>{const D=So(g.target.value);k(M=>{let O,G=!1;return D.dockerArgs.forEach(S=>{const A=M.dockerArgs.find(H=>H.key===S.key);A&&(Object.entries(A).forEach(([H,J])=>{J!=null&&H!=="value"&&(S[H]=J)}),S.proxyBehavior=S.proxyBehavior||"server",S.type==="web"&&(S.path="/",S.protocol="http",S.prefix="/",S.name="publicUrl",S.port="BLOCKLET_PORT",G=!0),!O&&S.key==="--publish"&&(O=S))}),!G&&O&&(O.type="web",O.path="/",O.protocol="http",O.prefix="/",O.name="publicUrl",O.port="BLOCKLET_PORT"),D.dockerEnvs.forEach(S=>{const A=M.dockerEnvs.find(H=>H.key===S.key);A&&Object.entries(A).forEach(([H,J])=>{J!=null&&H!=="value"&&(S[H]=J)})}),D})},q=()=>{if(y(!1),h==="--env"){k({...m,dockerEnvs:[...T,{key:v,value:"",custom:"",secure:!1,shared:!1,required:!1,description:v}]}),w("");return}k({...m,dockerArgs:[...C,{key:h,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},Z=()=>{y(!1),w("")},U=g=>{const{value:D}=g.target;k({...m,dockerImage:D}),D.indexOf(" ")>-1?n({...o,dockerImageName:r("blocklet.publish.docker.dockerImageNameError")}):n({...o,dockerImageName:""})},R=g=>{const{value:D}=g.target;k({...m,dockerCommand:D});try{Ns(D),n({...o,dockerCMD:""})}catch{n({...o,dockerCMD:r("blocklet.publish.docker.dockerCMDError")})}};return x.useEffect(()=>{u==="dockerCommand"&&b(Ls(m))},[m,u]),x.useEffect(()=>{d(g=>({...g,blockletDocker:{dockerImage:m.dockerImage,dockerCommand:m.dockerCommand,dockerArgs:m.dockerArgs,dockerEnvs:m.dockerEnvs}}))},[m,d]),e.jsxs(c,{sx:{mt:3},children:[e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[e.jsx(c,{sx:{borderBottom:1,borderColor:"divider",mb:2},children:e.jsxs(Zo,{value:u,onChange:(g,D)=>a(D),children:[e.jsx(ot,{value:"dockerParams",label:r("blocklet.publish.docker.dockerParams")}),e.jsx(ot,{value:"dockerCommand",label:r("blocklet.publish.docker.dockerCommand")})]})}),u==="dockerCommand"&&e.jsx(ne,{disabled:t,label:r("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:el,InputProps:{"data-cy":"blocklet-docker-command",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,spellCheck:!1,minRows:10,value:f,onChange:L,onBlur:z}),u==="dockerParams"&&e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(ne,{disabled:t,label:r("blocklet.publish.docker.dockerImageName"),placeholder:"Example: docker.io/postgrest/postgrest:latest",value:$,sx:{flex:1},color:o.dockerImageName?"error":"primary",error:!!o.dockerImageName,helperText:o.dockerImageName||"",onChange:U}),e.jsx(ne,{disabled:t,label:`Docker CMD (${r("common.optional")})`,placeholder:"Docker CMD",value:I,sx:{flex:1},color:o.dockerCMD?"error":"primary",error:!!o.dockerCMD,helperText:o.dockerCMD||"",onChange:R}),e.jsx(c,{sx:{height:4}}),C.map((g,D)=>e.jsx(it,{index:D,item:g,dockerParams:m,setDockerParams:k,dataKey:"dockerArgs",t:r,readOnly:t},`${g.key}-${D}`)),T.map((g,D)=>e.jsx(it,{index:D,item:g,dockerParams:m,setDockerParams:k,dataKey:"dockerEnvs",t:r,readOnly:t},`${g.key}-${D}`)),!t&&e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{flex:1}}),e.jsx(K,{onClick:()=>y(!0),children:r("blocklet.publish.docker.addItem")})]})]})]}),!!l&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:l}),j&&e.jsxs(at,{fullWidth:!0,open:!0,children:[e.jsx(Vo,{children:r("blocklet.publish.docker.addItem")}),e.jsx(Fo,{children:e.jsxs(ns,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[e.jsx(wt,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:h,sx:{width:"100%"},onChange:g=>p(g.target.value),children:Object.keys(dn).map(g=>e.jsx(fe,{value:g,children:g}))}),h==="--publish"&&e.jsx(E,{variant:"caption",color:"text.secondary",children:r("blocklet.publish.docker.publishTips")}),h==="--volume"&&e.jsx(E,{variant:"caption",color:"text.secondary",children:r("blocklet.publish.docker.volumeTips")}),h==="--env"&&e.jsxs(c,{sx:{mt:3,width:"100%"},children:[e.jsx(ne,{value:v,onChange:g=>w(g.target.value),sx:{width:"100%"},label:r("blocklet.publish.docker.envKey")}),e.jsx(ss,{children:r("blocklet.publish.docker.dockerArgValue")})]})]})}),e.jsxs(Ho,{children:[e.jsx(K,{onClick:Z,children:r("common.cancel")}),e.jsx(K,{onClick:q,children:r("common.confirm")})]})]})]})}fo.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired,paramsErrTip:s.func.isRequired};fo.defaultProps={};const tl=({tabs:t,blocklet:o,ancestors:n=[]})=>{const l=o.meta.did;t.push({label:e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Et,{size:24,blocklet:o,ancestors:n}),e.jsx(c,{ml:"4px",className:"text",children:e.jsx(c,{children:o.meta.title})})]},l),value:l})},No=(t,o)=>{const n=Nt(t,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletVideos","blockletScreenshots","blockletResourceType","blockletSupport","blockletHomepage","blockletCommunity","blockletRepository","blockletDocker","contentType","connectedStores","blockletComponents","lastReleaseId","uploadedResource","autoUpload","possibleSameStore","note","connectedEndpoints"]);return n.blockletComponents?n.blockletComponents=n.blockletComponents.map(l=>({...l,included:!0})):n.blockletComponents=(o.children||[]).map(l=>({did:l.meta.did,included:!1,required:!1})),n},ol={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},Ao={branding:0,introduction:1,resources:2,blocklets:3,version:4};function mo({initUrl:t,...o}){var bo,xo;const{projectId:n,mode:l,releaseId:i,componentDid:d=""}=ct(),{t:r}=Q(),{blocklet:u}=Se(),[a,f]=Pe({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}}),[b,j]=Pe({}),[y,h]=Pe({}),[p,v]=x.useState(!1),[w,m]=Pe(null),{api:k}=ge(),C=Be(P=>P.breakpoints.down("md")),[T,$]=x.useState({}),[I,L]=x.useState(!1),z=x.useRef({}),[q,Z]=Pe({}),[U,R]=x.useState(""),[g,D]=Pe({}),M=t==null?void 0:t.searchParams.get("dependentComponentsMode"),O=M==="readonly",{session:G}=Ue(),{storeList:S}=eo({fromBlocklet:!0,blocklet:u,componentDid:d,userDid:(bo=G==null?void 0:G.user)==null?void 0:bo.did}),[A,H]=x.useState([]);x.useEffect(()=>{Array.isArray(S)&&S.length>0&&Promise.all(S.map(async P=>({...(await(await fetch(`${P.url}/__blocklet__.js?type=json`)).json()).preferences,storeInfo:P}))).then(P=>{H(P)})},[S.length]),x.useEffect(()=>{const P={},N={},{logoUrl:me,screenshotUrls:Te}=Rn(a,u,n);Promise.all(A.map(async be=>{const{maxImageCount:Oe,minImageCount:mt,logoImageType:$e,imageMinHeight:go,imageMinWidth:jo}=be,Ze=Array.isArray($e)?$e:$e.split(",");P[be.storeInfo.url]||(P[be.storeInfo.url]={}),N[be.storeInfo.url]||(N[be.storeInfo.url]={});const bt=N[be.storeInfo.url],An=P[be.storeInfo.url];Number(Oe)<=Te.length&&(bt.maxImageCount=r("blocklet.publish.storeRule.maxImageCount",{max:Oe,count:Te.length,unit:Oe>1?r("blocklet.publish.storeRule.screenshots"):r("blocklet.publish.storeRule.screenshot")})),Number(be.minImageCount)>Te.length&&(bt.minImageCount=r("blocklet.publish.storeRule.minImageCount",{min:mt,count:Te.length,unit:mt>1?r("blocklet.publish.storeRule.screenshots"):r("blocklet.publish.storeRule.screenshot")}));const ko=me?me.split(".").pop():"";ko&&!(Ze.includes("jpg")?[...Ze,"jpeg"]:Ze).includes(ko)&&(An.logoFormat=r("blocklet.publish.storeRule.logoFormat",{format:Ze.join(",")})),await Promise.all(Te.map((zn,xt)=>{const gt=new Image;return gt.src=zn,new Promise(On=>{gt.onload=()=>{const{width:Wn,height:Bn}=gt;if(Wn<Number(jo)||Bn<Number(go)){let Ge="";switch(xt+1){case 1:Ge=r("blocklet.publish.storeRule.first");break;case 2:Ge=r("blocklet.publish.storeRule.second");break;case 3:Ge=r("blocklet.publish.storeRule.third");break;default:Ge=`${xt+1}`;break}bt[`imageSize-${xt+1}`]=r("blocklet.publish.storeRule.minImageSize",{width:jo,height:go,name:Ge})}On()}})}))})).then(()=>{const be=Object.values(P).some($e=>Object.values($e).length>0),Oe=Object.values(N).some($e=>Object.values($e).length>0);h({logoErrors:P,screenshotErrors:N,storeList:S,hasWarning:be||Oe,hasLogoWarning:be,hasScreenshotWarning:Oe})})},[a,u.did,n,A,r]);const J=x.useMemo(()=>{const P={};return Object.keys(g).forEach(N=>{const me=g[N];me&&me.forEach(Te=>{P[Te]=!0})}),P},[g]),Ie=x.useCallback(P=>{O&&f({blockletComponents:[]}),D(P)},[O,D,f]),_=x.useCallback((...P)=>{Z(...P),j({blockletResource:"",blockletDocker:""})},[]),V=i==="none"?(a==null?void 0:a.lastReleaseId)||"":i,[X,te]=x.useState(l==="new-release"?4:0),oe=t==null?void 0:t.searchParams.get("resourcesTitle"),ie=t==null?void 0:t.searchParams.get("componentsTitle"),ee=[{label:r("blocklet.publish.branding"),description:r("blocklet.publish.steps.branding")},{label:r("common.introduction"),description:r("blocklet.publish.steps.introduction")},{label:oe||r("blocklet.publish.resourceTitle"),description:r("blocklet.publish.steps.resources")},{label:ie||r("common.components"),description:r("blocklet.publish.steps.blocklets")},{label:r("blocklet.publish.versionTitle"),description:r("blocklet.publish.steps.version")}],ue=ee[X]||ee[ee.length-1],pe=ol[X];x.useEffect(()=>{n&&j({projectId:""})},[n,j]);const Ye=x.useMemo(()=>{var P;return(a==null?void 0:a.blockletResourceType)==="resource"?"resource":(P=a==null?void 0:a.blockletComponents)!=null&&P.some(N=>N.included)||Object.keys(J).length||a!=null&&a.uploadedResource?"pack":"resource"},[a==null?void 0:a.blockletComponents,a==null?void 0:a.uploadedResource,J,a==null?void 0:a.blockletResourceType]),Ve=[],Ee=((u==null?void 0:u.children)||[]).filter(P=>{var N;return(N=P.meta.resource)==null?void 0:N.exportApi}).filter(P=>!d||P.meta.did===d);Ee.forEach(P=>{tl({tabs:Ve,blocklet:P,t:r,ancestors:[u]})});const[se,Le]=x.useState((xo=Ve[0])==null?void 0:xo.value),W=!I&&(w==null?void 0:w.status)==="published",le=W,Ne=Rs(()=>{if(!t)return;R(t.searchParams.get("logo")),f(N=>{var me;return{...N,blockletTitle:(N==null?void 0:N.blockletTitle)||t.searchParams.get("title"),blockletDescription:(N==null?void 0:N.blockletDescription)||t.searchParams.get("description"),blockletIntroduction:(N==null?void 0:N.blockletIntroduction)||t.searchParams.get("introduction")||t.searchParams.get("description"),blockletComponents:(me=N==null?void 0:N.blockletComponents)!=null&&me.length?N==null?void 0:N.blockletComponents:JSON.parse(t.searchParams.get("components")||"[]"),note:(N==null?void 0:N.note)||t.searchParams.get("note")||"No note"}});const P=t.searchParams.get("resources");try{const N=JSON.parse(P);$(N)}catch{}}),Ae=async()=>{if(V)try{const P=await k.getRelease({input:{did:u.meta.did,projectId:n,releaseId:V}});if(v(!1),!P.release){B.error("Release not found");return}P.release.note=gn(P.release.note,"note"),P.release=En(P.release),l!=="view"&&(P.release.note=""),f(N=>No({...N,...P.release,blockletVersion:l==="create"||l==="new-release"?We.inc(P.release.blockletVersion,"patch"):P.release.blockletVersion},u)),m(P.release)}catch(P){v(!1),B.error(xe(P))}},Fe=async()=>{if(n===Y.UNOWNED_DID){f({blockletVersion:"0.0.1",blockletTitle:""});return}if(!n){B.error(r("blocklet.publish.errorTip.noDid"));return}try{const N=(await kn(k.getProject,[{input:{did:u.meta.did,projectId:n}}],{key:"getProject"})).project||{};N.blockletVersion?(l==="create"||l==="new-release")&&We.valid(N.blockletVersion)&&(N.blockletVersion=We.inc(N.blockletVersion,"patch")):N.blockletVersion="0.0.1";const me=No(N,u);f(me),N.lastReleaseId||Ne()}catch(P){B.error(xe(P))}},ze=x.useCallback(async()=>{v(!0);try{if(l==="view"){if(!V){B.error("Empty release id");return}await Fe(),await Ae();return}await Fe(),V&&(L(!0),await Ae())}finally{v(!1)}},[l,V]),Qe=P=>{f({blockletComponents:P})},F=P=>{f({blockletResourceType:P})};x.useEffect(()=>{ze()},[ze]),x.useEffect(()=>{n===Y.UNOWNED_DID&&(l==="create"||l==="new-release")&&t&&Ne()},[n,t,l,Ne]),x.useEffect(()=>{a.contentType==="docker"?f({resourceFromSelect:!1}):a.contentType==="blocklet"?f({resourceFromSelect:!0}):a.contentType==="upload"&&f({resourceFromSelect:!1})},[a.contentType,f]);const re=x.useMemo(()=>!!Object.keys(q).find(P=>!!q[P].length),[q]);if(!a&&p)return e.jsx(Xe,{});if(!a)return null;const He=Ee.find(P=>P.meta.did===se),Nn=P=>{Le(P)};return e.jsxs(nl,{...o,children:[e.jsx($n,{blocklet:u,release:w,getData:ze,getRelease:Ae,mode:l,params:a,setParams:f,setParamsErrTip:j,warning:y,readOnly:le,isPublished:W,loading:p,setLoading:v,initLogoUrl:U,releaseId:V,projectId:n,projectType:Ye,resourceComponents:Ee,resourceComponentsMap:g,resourceRelateComponents:J,resourceItem:He,saveSelectedEventsRef:z,hasSelectedResources:re,releaseUsedLast:I,setReleaseUsedLast:L,setRelease:m,paramsErrTip:b}),e.jsxs(c,{display:"flex",flexDirection:"column",sx:{width:"100%"},children:[e.jsx(c,{pt:3}),e.jsxs(c,{sx:{gap:3},display:"flex",flexDirection:C?"column":"row",children:[!C&&e.jsx(qn,{steps:ee,loading:p,viewMode:l==="view",params:a,hasSelectedResources:re||a.uploadedResource,paramsErrTip:b,warning:y,activeStep:X,setActiveStep:te,projectId:n,resourcesUrlTitle:oe,componentsUrlTitle:ie}),e.jsxs(c,{flex:"1",maxWidth:"720px",children:[!C&&pe!=="introduction"&&e.jsxs(E,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[ue.label,pe==="branding"&&e.jsx(je,{title:r("blocklet.publish.brandingHelp"),placement:"right",children:e.jsx(c,{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:e.jsx(vs,{})})})]}),(C||pe==="branding")&&e.jsx(c,{flexDirection:"column",children:e.jsx(Cn,{projectId:n,setParams:f,setParamsErrTip:j,warning:y,params:a,componentDid:d,blocklet:u,initUrl:t,loading:p,setLoading:v,paramsErrTip:b,readOnly:le,initLogoUrl:U,setInitLogoUrl:R})}),C&&e.jsx(c,{flexDirection:"column",children:e.jsx(lt,{loading:p,params:a,paramsErrTip:b,setParams:f,setParamsErrTip:j,readOnly:le})}),(C||pe==="introduction")&&e.jsx(c,{display:"flex",flexDirection:"column",sx:{mt:C?5:0,width:"100%"},children:e.jsx(_n,{loading:p,readOnly:le,params:a,setParams:f,paramsErrTip:b,setParamsErrTip:j})}),C&&e.jsx(E,{variant:"h6",fontWeight:"bold",mt:5,children:ee[Ao.resources].label}),e.jsx(c,{sx:{maxWidth:720},display:C||pe==="resources"?"flex":"none",flexDirection:"column",children:e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{sx:{flex:1},children:[e.jsxs(rs,{onChange:P=>f({contentType:P.target.value}),children:[e.jsx(et,{value:"blocklet",disabled:le,control:e.jsx(kt,{size:"small",checked:a.contentType==="blocklet"}),label:r("blocklet.publish.resourceSelect")}),e.jsx(et,{value:"upload",disabled:le,control:e.jsx(kt,{size:"small",checked:a.contentType==="upload"}),label:r("blocklet.publish.resourceUpload")}),e.jsx(et,{value:"docker",disabled:le,control:e.jsx(kt,{size:"small",checked:a.contentType==="docker"}),label:r("blocklet.publish.resourceDocker")})]}),e.jsxs(c,{display:a.contentType==="blocklet"?"block":"none",children:[!d&&e.jsx(nn,{tabs:Ve,current:se,onChange:Nn,sx:{ml:-2,mt:2,maxWidth:C?window.innerWidth-24:"100%"}}),e.jsx(Qt,{loading:p,initialResources:T,saveSelectedEventsRef:z,selectedResourceIds:q,setSelectedResourceIds:_,setResourceComponentsMap:Ie,error:b.blockletResource,app:u,readOnly:le,component:He,componentDid:d,initUrl:t,params:a,showTree:a.contentType==="blocklet",setParams:f,projectId:n===Y.UNOWNED_DID?"":n,releaseUsedLast:I,release:{...w,id:V}})]}),a.contentType==="upload"&&e.jsx(ho,{app:u,readOnly:le,projectId:n===Y.UNOWNED_DID?"":n,params:a,error:b.blockletResource,setParams:f,setParamsErrTip:j}),a.contentType==="docker"&&e.jsx(fo,{app:u,readOnly:le,projectId:n===Y.UNOWNED_DID?"":n,params:a,error:b.blockletResource,setParams:f,setParamsErrTip:j,paramsErrTip:b})]})})}),C&&e.jsx(E,{variant:"h6",fontWeight:"bold",mt:5,children:ee[Ao.blocklets].label}),(C||pe==="blocklets")&&e.jsx(c,{flexDirection:"column",children:e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsx(c,{sx:{flex:1},children:e.jsx(Ht,{projectType:Ye,disabled:p||le,app:u,value:(a==null?void 0:a.blockletComponents)||[],blockletResourceType:(a==null?void 0:a.blockletResourceType)||"",onChange:Qe,onChangeBlockletResourceType:F,resourceRelateComponents:J,dependentComponentsMode:M})})})}),!C&&pe==="version"&&e.jsx(c,{flexDirection:"column",children:e.jsx(lt,{loading:p,params:a,paramsErrTip:b,setParams:f,setParamsErrTip:j,readOnly:le})})]})]})]})]})}mo.propTypes={initUrl:s.object};mo.defaultProps={initUrl:null};const nl=ye.div`
|
|
200
|
+
`.trim();function fo({readOnly:t,paramsErrTip:o,setParamsErrTip:n,error:l,params:i,setParams:d}){const{t:r}=Q(),[u,a]=x.useState("dockerParams"),[f,m]=x.useState(""),[j,y]=x.useState(!1),[h,p]=x.useState("--volume"),[v,w]=x.useState(""),[b,k]=x.useState(So(f)),C=b.dockerArgs||[],I=b.dockerEnvs||[],$=b.dockerImage||"",D=b.dockerCommand||"",N=g=>{const{value:S}=g.target;m(S)};x.useEffect(()=>{i.blockletDocker&&i.blockletDocker.dockerImage&&!$&&k(i.blockletDocker)},[i,$,k]);const z=g=>{const S=So(g.target.value);k(W=>{const B=W.dockerArgs.find(P=>P.key==="--publish"&&P.type==="web");let J=!1;const T=P=>{P.type="web",P.path=B.path||"/",P.protocol=B.protocol||"http",P.prefix=B.prefix||"/",P.name=B.name||"publicUrl",P.port=B.port||"BLOCKLET_PORT"};if(S.dockerArgs.forEach(P=>{const H=W.dockerArgs.find(V=>V.key===P.key);H&&(Object.entries(H).forEach(([V,le])=>{le!=null&&V!=="value"&&(P[V]=le)}),P.proxyBehavior=P.proxyBehavior||"server",P.key==="--publish"&&P.type==="web"&&(J?P.type="docker":(T(P),J=!0)))}),B&&!S.dockerArgs.find(H=>H.key==="--publish"&&H.type==="web")){const H=S.dockerArgs.find(V=>V.key==="--publish"&&V.value===B.value);H?T(H):(J=!1,S.dockerArgs.forEach(V=>{V.key==="--publish"&&!J&&(T(V),J=!0)}))}return S.dockerEnvs.forEach(P=>{const H=W.dockerEnvs.find(V=>V.key===P.key);H&&Object.entries(H).forEach(([V,le])=>{le!=null&&V!=="value"&&(P[V]=le)})}),S})},E=()=>{if(y(!1),h==="--env"){k({...b,dockerEnvs:[...I,{key:v,value:"",custom:"",secure:!1,shared:!1,required:!1,description:v}]}),w("");return}k({...b,dockerArgs:[...C,{key:h,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},Z=()=>{y(!1),w("")},U=g=>{const{value:S}=g.target;k({...b,dockerImage:S}),S.indexOf(" ")>-1?n({...o,dockerImageName:r("blocklet.publish.docker.dockerImageNameError")}):n({...o,dockerImageName:""})},R=g=>{const{value:S}=g.target;k({...b,dockerCommand:S});try{Ns(S),n({...o,dockerCMD:""})}catch{n({...o,dockerCMD:r("blocklet.publish.docker.dockerCMDError")})}};return x.useEffect(()=>{u==="dockerCommand"&&m(Ls(b))},[b,u]),x.useEffect(()=>{d(g=>({...g,blockletDocker:{dockerImage:b.dockerImage,dockerCommand:b.dockerCommand,dockerArgs:b.dockerArgs,dockerEnvs:b.dockerEnvs}}))},[b,d]),e.jsxs(c,{sx:{mt:3},children:[e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[e.jsx(c,{sx:{borderBottom:1,borderColor:"divider",mb:2},children:e.jsxs(Zo,{value:u,onChange:(g,S)=>a(S),children:[e.jsx(ot,{value:"dockerParams",label:r("blocklet.publish.docker.dockerParams")}),e.jsx(ot,{value:"dockerCommand",label:r("blocklet.publish.docker.dockerCommand")})]})}),u==="dockerCommand"&&e.jsx(ne,{disabled:t,label:r("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:el,InputProps:{"data-cy":"blocklet-docker-command",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,spellCheck:!1,minRows:10,value:f,onChange:N,onBlur:z}),u==="dockerParams"&&e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(ne,{disabled:t,label:r("blocklet.publish.docker.dockerImageName"),placeholder:"Example: docker.io/postgrest/postgrest:latest",value:$,sx:{flex:1},color:o.dockerImageName?"error":"primary",error:!!o.dockerImageName,helperText:o.dockerImageName||"",onChange:U}),e.jsx(ne,{disabled:t,label:`Docker CMD (${r("common.optional")})`,placeholder:"Docker CMD",value:D,sx:{flex:1},color:o.dockerCMD?"error":"primary",error:!!o.dockerCMD,helperText:o.dockerCMD||"",onChange:R}),e.jsx(c,{sx:{height:4}}),C.map((g,S)=>e.jsx(it,{index:S,item:g,dockerParams:b,setDockerParams:k,dataKey:"dockerArgs",t:r,readOnly:t},`${g.key}-${S}`)),I.map((g,S)=>e.jsx(it,{index:S,item:g,dockerParams:b,setDockerParams:k,dataKey:"dockerEnvs",t:r,readOnly:t},`${g.key}-${S}`)),!t&&e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{flex:1}}),e.jsx(K,{onClick:()=>y(!0),children:r("blocklet.publish.docker.addItem")})]})]})]}),!!l&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:l}),j&&e.jsxs(at,{fullWidth:!0,open:!0,children:[e.jsx(Vo,{children:r("blocklet.publish.docker.addItem")}),e.jsx(Fo,{children:e.jsxs(ns,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[e.jsx(wt,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:h,sx:{width:"100%"},onChange:g=>p(g.target.value),children:Object.keys(dn).map(g=>e.jsx(be,{value:g,children:g}))}),h==="--publish"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:r("blocklet.publish.docker.publishTips")}),h==="--volume"&&e.jsx(L,{variant:"caption",color:"text.secondary",children:r("blocklet.publish.docker.volumeTips")}),h==="--env"&&e.jsxs(c,{sx:{mt:3,width:"100%"},children:[e.jsx(ne,{value:v,onChange:g=>w(g.target.value),sx:{width:"100%"},label:r("blocklet.publish.docker.envKey")}),e.jsx(ss,{children:r("blocklet.publish.docker.dockerArgValue")})]})]})}),e.jsxs(Ho,{children:[e.jsx(K,{onClick:Z,children:r("common.cancel")}),e.jsx(K,{onClick:E,children:r("common.confirm")})]})]})]})}fo.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired,paramsErrTip:s.func.isRequired};fo.defaultProps={};const tl=({tabs:t,blocklet:o,ancestors:n=[]})=>{const l=o.meta.did;t.push({label:e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Et,{size:24,blocklet:o,ancestors:n}),e.jsx(c,{ml:"4px",className:"text",children:e.jsx(c,{children:o.meta.title})})]},l),value:l})},No=(t,o)=>{const n=Nt(t,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletVideos","blockletScreenshots","blockletResourceType","blockletSupport","blockletHomepage","blockletCommunity","blockletRepository","blockletDocker","contentType","connectedStores","blockletComponents","lastReleaseId","uploadedResource","autoUpload","possibleSameStore","note","connectedEndpoints"]);return n.blockletComponents?n.blockletComponents=n.blockletComponents.map(l=>({...l,included:!0})):n.blockletComponents=(o.children||[]).map(l=>({did:l.meta.did,included:!1,required:!1})),n},ol={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},Ao={branding:0,introduction:1,resources:2,blocklets:3,version:4};function bo({initUrl:t,...o}){var mo,xo;const{projectId:n,mode:l,releaseId:i,componentDid:d=""}=ct(),{t:r}=Q(),{blocklet:u}=De(),[a,f]=Pe({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}}),[m,j]=Pe({}),[y,h]=Pe({}),[p,v]=x.useState(!1),[w,b]=Pe(null),{api:k}=je(),C=Be(_=>_.breakpoints.down("md")),[I,$]=x.useState({}),[D,N]=x.useState(!1),z=x.useRef({}),[E,Z]=Pe({}),[U,R]=x.useState(""),[g,S]=Pe({}),W=t==null?void 0:t.searchParams.get("dependentComponentsMode"),B=W==="readonly",{session:J}=Ue(),{storeList:T}=eo({fromBlocklet:!0,blocklet:u,componentDid:d,userDid:(mo=J==null?void 0:J.user)==null?void 0:mo.did}),[P,H]=x.useState([]);x.useEffect(()=>{Array.isArray(T)&&T.length>0&&Promise.all(T.map(async _=>({...(await(await fetch(`${_.url}/__blocklet__.js?type=json`)).json()).preferences,storeInfo:_}))).then(_=>{H(_)})},[T.length]),x.useEffect(()=>{const _={},A={},{logoUrl:me,screenshotUrls:Te}=Rn(a,u,n);Promise.all(P.map(async xe=>{const{maxImageCount:Oe,minImageCount:bt,logoImageType:$e,imageMinHeight:go,imageMinWidth:jo}=xe,Ze=Array.isArray($e)?$e:$e.split(",");_[xe.storeInfo.url]||(_[xe.storeInfo.url]={}),A[xe.storeInfo.url]||(A[xe.storeInfo.url]={});const mt=A[xe.storeInfo.url],An=_[xe.storeInfo.url];Number(Oe)<=Te.length&&(mt.maxImageCount=r("blocklet.publish.storeRule.maxImageCount",{max:Oe,count:Te.length,unit:Oe>1?r("blocklet.publish.storeRule.screenshots"):r("blocklet.publish.storeRule.screenshot")})),Number(xe.minImageCount)>Te.length&&(mt.minImageCount=r("blocklet.publish.storeRule.minImageCount",{min:bt,count:Te.length,unit:bt>1?r("blocklet.publish.storeRule.screenshots"):r("blocklet.publish.storeRule.screenshot")}));const ko=me?me.split(".").pop():"";ko&&!(Ze.includes("jpg")?[...Ze,"jpeg"]:Ze).includes(ko)&&(An.logoFormat=r("blocklet.publish.storeRule.logoFormat",{format:Ze.join(",")})),await Promise.all(Te.map((zn,xt)=>{const gt=new Image;return gt.src=zn,new Promise(On=>{gt.onload=()=>{const{width:Wn,height:Bn}=gt;if(Wn<Number(jo)||Bn<Number(go)){let Ge="";switch(xt+1){case 1:Ge=r("blocklet.publish.storeRule.first");break;case 2:Ge=r("blocklet.publish.storeRule.second");break;case 3:Ge=r("blocklet.publish.storeRule.third");break;default:Ge=`${xt+1}`;break}mt[`imageSize-${xt+1}`]=r("blocklet.publish.storeRule.minImageSize",{width:jo,height:go,name:Ge})}On()}})}))})).then(()=>{const xe=Object.values(_).some($e=>Object.values($e).length>0),Oe=Object.values(A).some($e=>Object.values($e).length>0);h({logoErrors:_,screenshotErrors:A,storeList:T,hasWarning:xe||Oe,hasLogoWarning:xe,hasScreenshotWarning:Oe})})},[a,u.did,n,P,r]);const V=x.useMemo(()=>{const _={};return Object.keys(g).forEach(A=>{const me=g[A];me&&me.forEach(Te=>{_[Te]=!0})}),_},[g]),le=x.useCallback(_=>{B&&f({blockletComponents:[]}),S(_)},[B,S,f]),q=x.useCallback((..._)=>{Z(..._),j({blockletResource:"",blockletDocker:""})},[]),F=i==="none"?(a==null?void 0:a.lastReleaseId)||"":i,[X,te]=x.useState(l==="new-release"?4:0),oe=t==null?void 0:t.searchParams.get("resourcesTitle"),ce=t==null?void 0:t.searchParams.get("componentsTitle"),ee=[{label:r("blocklet.publish.branding"),description:r("blocklet.publish.steps.branding")},{label:r("common.introduction"),description:r("blocklet.publish.steps.introduction")},{label:oe||r("blocklet.publish.resourceTitle"),description:r("blocklet.publish.steps.resources")},{label:ce||r("common.components"),description:r("blocklet.publish.steps.blocklets")},{label:r("blocklet.publish.versionTitle"),description:r("blocklet.publish.steps.version")}],pe=ee[X]||ee[ee.length-1],he=ol[X];x.useEffect(()=>{n&&j({projectId:""})},[n,j]);const Ye=x.useMemo(()=>{var _;return(a==null?void 0:a.blockletResourceType)==="resource"?"resource":(_=a==null?void 0:a.blockletComponents)!=null&&_.some(A=>A.included)||Object.keys(V).length||a!=null&&a.uploadedResource?"pack":"resource"},[a==null?void 0:a.blockletComponents,a==null?void 0:a.uploadedResource,V,a==null?void 0:a.blockletResourceType]),Ve=[],Ee=((u==null?void 0:u.children)||[]).filter(_=>{var A;return(A=_.meta.resource)==null?void 0:A.exportApi}).filter(_=>!d||_.meta.did===d);Ee.forEach(_=>{tl({tabs:Ve,blocklet:_,t:r,ancestors:[u]})});const[se,Le]=x.useState((xo=Ve[0])==null?void 0:xo.value),O=!D&&(w==null?void 0:w.status)==="published",ie=O,Ne=Rs(()=>{if(!t)return;R(t.searchParams.get("logo")),f(A=>{var me;return{...A,blockletTitle:(A==null?void 0:A.blockletTitle)||t.searchParams.get("title"),blockletDescription:(A==null?void 0:A.blockletDescription)||t.searchParams.get("description"),blockletIntroduction:(A==null?void 0:A.blockletIntroduction)||t.searchParams.get("introduction")||t.searchParams.get("description"),blockletComponents:(me=A==null?void 0:A.blockletComponents)!=null&&me.length?A==null?void 0:A.blockletComponents:JSON.parse(t.searchParams.get("components")||"[]"),note:(A==null?void 0:A.note)||t.searchParams.get("note")||"No note"}});const _=t.searchParams.get("resources");try{const A=JSON.parse(_);$(A)}catch{}}),Ae=async()=>{if(F)try{const _=await k.getRelease({input:{did:u.meta.did,projectId:n,releaseId:F}});if(v(!1),!_.release){M.error("Release not found");return}_.release.note=gn(_.release.note,"note"),_.release=En(_.release),l!=="view"&&(_.release.note=""),f(A=>No({...A,..._.release,blockletVersion:l==="create"||l==="new-release"?We.inc(_.release.blockletVersion,"patch"):_.release.blockletVersion},u)),b(_.release)}catch(_){v(!1),M.error(ge(_))}},Fe=async()=>{if(n===Y.UNOWNED_DID){f({blockletVersion:"0.0.1",blockletTitle:""});return}if(!n){M.error(r("blocklet.publish.errorTip.noDid"));return}try{const A=(await kn(k.getProject,[{input:{did:u.meta.did,projectId:n}}],{key:"getProject"})).project||{};A.blockletVersion?(l==="create"||l==="new-release")&&We.valid(A.blockletVersion)&&(A.blockletVersion=We.inc(A.blockletVersion,"patch")):A.blockletVersion="0.0.1";const me=No(A,u);f(me),A.lastReleaseId||Ne()}catch(_){M.error(ge(_))}},ze=x.useCallback(async()=>{v(!0);try{if(l==="view"){if(!F){M.error("Empty release id");return}await Fe(),await Ae();return}await Fe(),F&&(N(!0),await Ae())}finally{v(!1)}},[l,F]),Qe=_=>{f({blockletComponents:_})},G=_=>{f({blockletResourceType:_})};x.useEffect(()=>{ze()},[ze]),x.useEffect(()=>{n===Y.UNOWNED_DID&&(l==="create"||l==="new-release")&&t&&Ne()},[n,t,l,Ne]),x.useEffect(()=>{a.contentType==="docker"?f({resourceFromSelect:!1}):a.contentType==="blocklet"?f({resourceFromSelect:!0}):a.contentType==="upload"&&f({resourceFromSelect:!1})},[a.contentType,f]);const re=x.useMemo(()=>!!Object.keys(E).find(_=>!!E[_].length),[E]);if(!a&&p)return e.jsx(Xe,{});if(!a)return null;const He=Ee.find(_=>_.meta.did===se),Nn=_=>{Le(_)};return e.jsxs(nl,{...o,children:[e.jsx($n,{blocklet:u,release:w,getData:ze,getRelease:Ae,mode:l,params:a,setParams:f,setParamsErrTip:j,warning:y,readOnly:ie,isPublished:O,loading:p,setLoading:v,initLogoUrl:U,releaseId:F,projectId:n,projectType:Ye,resourceComponents:Ee,resourceComponentsMap:g,resourceRelateComponents:V,resourceItem:He,saveSelectedEventsRef:z,hasSelectedResources:re,releaseUsedLast:D,setReleaseUsedLast:N,setRelease:b,paramsErrTip:m}),e.jsxs(c,{display:"flex",flexDirection:"column",sx:{width:"100%"},children:[e.jsx(c,{pt:3}),e.jsxs(c,{sx:{gap:3},display:"flex",flexDirection:C?"column":"row",children:[!C&&e.jsx(qn,{steps:ee,loading:p,viewMode:l==="view",params:a,hasSelectedResources:re||a.uploadedResource,paramsErrTip:m,warning:y,activeStep:X,setActiveStep:te,projectId:n,resourcesUrlTitle:oe,componentsUrlTitle:ce}),e.jsxs(c,{flex:"1",maxWidth:"720px",children:[!C&&he!=="introduction"&&e.jsxs(L,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[pe.label,he==="branding"&&e.jsx(ke,{title:r("blocklet.publish.brandingHelp"),placement:"right",children:e.jsx(c,{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:e.jsx(vs,{})})})]}),(C||he==="branding")&&e.jsx(c,{flexDirection:"column",children:e.jsx(Cn,{projectId:n,setParams:f,setParamsErrTip:j,warning:y,params:a,componentDid:d,blocklet:u,initUrl:t,loading:p,setLoading:v,paramsErrTip:m,readOnly:ie,initLogoUrl:U,setInitLogoUrl:R})}),C&&e.jsx(c,{flexDirection:"column",children:e.jsx(lt,{loading:p,params:a,paramsErrTip:m,setParams:f,setParamsErrTip:j,readOnly:ie})}),(C||he==="introduction")&&e.jsx(c,{display:"flex",flexDirection:"column",sx:{mt:C?5:0,width:"100%"},children:e.jsx(_n,{loading:p,readOnly:ie,params:a,setParams:f,paramsErrTip:m,setParamsErrTip:j})}),C&&e.jsx(L,{variant:"h6",fontWeight:"bold",mt:5,children:ee[Ao.resources].label}),e.jsx(c,{sx:{maxWidth:720},display:C||he==="resources"?"flex":"none",flexDirection:"column",children:e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{sx:{flex:1},children:[e.jsxs(rs,{onChange:_=>f({contentType:_.target.value}),children:[e.jsx(et,{value:"blocklet",disabled:ie,control:e.jsx(kt,{size:"small",checked:a.contentType==="blocklet"}),label:r("blocklet.publish.resourceSelect")}),e.jsx(et,{value:"upload",disabled:ie,control:e.jsx(kt,{size:"small",checked:a.contentType==="upload"}),label:r("blocklet.publish.resourceUpload")}),e.jsx(et,{value:"docker",disabled:ie,control:e.jsx(kt,{size:"small",checked:a.contentType==="docker"}),label:r("blocklet.publish.resourceDocker")})]}),e.jsxs(c,{display:a.contentType==="blocklet"?"block":"none",children:[!d&&e.jsx(nn,{tabs:Ve,current:se,onChange:Nn,sx:{ml:-2,mt:2,maxWidth:C?window.innerWidth-24:"100%"}}),e.jsx(Qt,{loading:p,initialResources:I,saveSelectedEventsRef:z,selectedResourceIds:E,setSelectedResourceIds:q,setResourceComponentsMap:le,error:m.blockletResource,app:u,readOnly:ie,component:He,componentDid:d,initUrl:t,params:a,showTree:a.contentType==="blocklet",setParams:f,projectId:n===Y.UNOWNED_DID?"":n,releaseUsedLast:D,release:{...w,id:F}})]}),a.contentType==="upload"&&e.jsx(ho,{app:u,readOnly:ie,projectId:n===Y.UNOWNED_DID?"":n,params:a,error:m.blockletResource,setParams:f,setParamsErrTip:j}),a.contentType==="docker"&&e.jsx(fo,{app:u,readOnly:ie,projectId:n===Y.UNOWNED_DID?"":n,params:a,error:m.blockletResource,setParams:f,setParamsErrTip:j,paramsErrTip:m})]})})}),C&&e.jsx(L,{variant:"h6",fontWeight:"bold",mt:5,children:ee[Ao.blocklets].label}),(C||he==="blocklets")&&e.jsx(c,{flexDirection:"column",children:e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsx(c,{sx:{flex:1},children:e.jsx(Ht,{projectType:Ye,disabled:p||ie,app:u,value:(a==null?void 0:a.blockletComponents)||[],blockletResourceType:(a==null?void 0:a.blockletResourceType)||"",onChange:Qe,onChangeBlockletResourceType:G,resourceRelateComponents:V,dependentComponentsMode:W})})})}),!C&&he==="version"&&e.jsx(c,{flexDirection:"column",children:e.jsx(lt,{loading:p,params:a,paramsErrTip:m,setParams:f,setParamsErrTip:j,readOnly:ie})})]})]})]})]})}bo.propTypes={initUrl:s.object};bo.defaultProps={initUrl:null};const nl=ve.div`
|
|
201
201
|
.section {
|
|
202
202
|
&.full-width {
|
|
203
203
|
max-width: 100%;
|
|
@@ -234,7 +234,7 @@ postgrest/postgrest
|
|
|
234
234
|
}
|
|
235
235
|
font-size: 0.8rem;
|
|
236
236
|
}
|
|
237
|
-
`;function Ln({padding:t,initUrl:o}){const{blocklet:n}=
|
|
237
|
+
`;function Ln({padding:t,initUrl:o}){const{blocklet:n}=De(),l=Un(),{componentDid:i}=ct();if(x.useEffect(()=>{if(i&&window.parent){const r=`${l.pathname}${l.search}`;window.parent.postMessage({event:"popstate",page:"publish",componentDid:i,path:r},"*")}},[i,l]),!n)return null;const d={};return t&&(d.padding=t),e.jsx(sl,{style:d,children:e.jsxs(Vn,{children:[e.jsx(jt,{path:"/",element:e.jsx(Ut,{initUrl:o})}),e.jsx(jt,{path:"/:projectId",element:e.jsx(er,{})}),e.jsx(jt,{path:"/:projectId/:mode/:releaseId",element:e.jsx(bo,{initUrl:o})})]})})}Ln.propTypes={padding:s.oneOfType([s.string,s.number]),initUrl:s.object};Ln.defaultProps={padding:"",initUrl:null};const sl=ve(c)`
|
|
238
238
|
a {
|
|
239
239
|
color: ${({theme:t})=>t.palette.primary.main};
|
|
240
240
|
}
|