@abtnode/blocklet-services 1.16.43-beta-20250424-125523-08a65a5c → 1.16.43-beta-20250427-132304-6da95c55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/routes/oauth/client.js +2 -0
- package/api/routes/oauth/server.js +75 -0
- package/api/routes/user-session.js +5 -5
- package/api/routes/user.js +3 -2
- package/api/services/auth/session.js +23 -35
- package/api/services/oauth/server.js +31 -1
- package/api/util/attach-shared-utils.js +2 -2
- package/dist/assets/{AdapterDayjs-DT-SVlwP.js → AdapterDayjs-BUGplkxR.js} +1 -1
- package/dist/assets/{ArrowDropDown-D0s0w2rW.js → ArrowDropDown-B0sLkJoY.js} +1 -1
- package/dist/assets/{CheckCircle-BMPTHnwd.js → CheckCircle-BNrN9mgy.js} +1 -1
- package/dist/assets/{ChevronLeft-BV65HBup.js → ChevronLeft-Dq00IS01.js} +1 -1
- package/dist/assets/{ChevronRight-CSrWhu1k.js → ChevronRight-ZTqWK-Ga.js} +1 -1
- package/dist/assets/{Community-B6sqs6QK.js → Community-DZCTPNMP.js} +1 -1
- package/dist/assets/{DeleteOutline-BwlJCwaD.js → DeleteOutline-C2sY6hfm.js} +1 -1
- package/dist/assets/{Done-ClKUqna8.js → Done-JLiLhELm.js} +1 -1
- package/dist/assets/{Download-DydXtD3g.js → Download-Ch4RfGRW.js} +1 -1
- package/dist/assets/{Edit-Cydc64DB.js → Edit-CY6fFHQM.js} +1 -1
- package/dist/assets/{EditIcon-B3vzcBhw.js → EditIcon-Bi2cR-_u.js} +1 -1
- package/dist/assets/{Email-DscM5ZVr.js → Email-Dz2Eyqu0.js} +1 -1
- package/dist/assets/{Error-BUxloyCF.js → Error-CSFUqG0m.js} +1 -1
- package/dist/assets/{ExpandLess-D3psCjh2.js → ExpandLess-BiMmSOBl.js} +1 -1
- package/dist/assets/{Google-nw2S1BAe.js → Google-GOp5YvmZ.js} +1 -1
- package/dist/assets/{Holiday-COvP72sQ.js → Holiday-Lc6woG1j.js} +1 -1
- package/dist/assets/{InfoOutlined-K2cm3ASV.js → InfoOutlined-CQB5qKm-.js} +1 -1
- package/dist/assets/{Launch-DSlNzUJo.js → Launch-fxgQvk19.js} +1 -1
- package/dist/assets/{LaunchOutlined-DB41H1FZ.js → LaunchOutlined-BV4_W1pb.js} +1 -1
- package/dist/assets/{Location-DSdE-EW4.js → Location-B8EOY3d0.js} +1 -1
- package/dist/assets/{LockIcon-Yic1ETPw.js → LockIcon-fuTfhB_G.js} +1 -1
- package/dist/assets/{Meeting-DlfumstQ.js → Meeting-Epdyx36z.js} +1 -1
- package/dist/assets/{MoreHoriz-BWdkQIhx.js → MoreHoriz-CX_pwfPT.js} +1 -1
- package/dist/assets/{OffSick-CG2hJbSq.js → OffSick-VYgugWxu.js} +1 -1
- package/dist/assets/{Phone-DkIl-1KJ.js → Phone-KP65huHK.js} +1 -1
- package/dist/assets/{PlayArrow-DfQEcw-G.js → PlayArrow-DFH1Psjx.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-TVw9KuLr.js → QuestionMarkCircle-p6m3avKp.js} +1 -1
- package/dist/assets/{ServerLogo-DQ3yw9lw.js → ServerLogo-Bssx1Eou.js} +1 -1
- package/dist/assets/{Timezone-B77bSXNW.js → Timezone-Ce4E1Xey.js} +1 -1
- package/dist/assets/{TuneOutlined-8KrrUCQF.js → TuneOutlined-Dy2qPFGI.js} +1 -1
- package/dist/assets/{ViewList-Bql1EC1c.js → ViewList-e3CoNi3K.js} +1 -1
- package/dist/assets/{WorkingRemotely-DNUERtUR.js → WorkingRemotely-CXFJ6pz8.js} +1 -1
- package/dist/assets/{access-control-Bcd_n74E.js → access-control-B20P1UrY.js} +1 -1
- package/dist/assets/{actions-f0wKxzR1.js → actions-DA-6s_nQ.js} +1 -1
- package/dist/assets/{add-component-core-BUAlsG4_.js → add-component-core-DG9mQFsr.js} +1 -1
- package/dist/assets/{add-resource-Djfsmv61.js → add-resource-BoS5YkVy.js} +1 -1
- package/dist/assets/{addon-BkBy38_b.js → addon-Bcc-Xwbf.js} +1 -1
- package/dist/assets/{advanced-BPM38tnR.js → advanced-DTe2fs5L.js} +1 -1
- package/dist/assets/{appearance-DUNDV_8X.js → appearance-DYi32tlk.js} +1 -1
- package/dist/assets/{ar-wbCXBm9M.js → ar-CmhpkjwX.js} +1 -1
- package/dist/assets/{ar-BNaEJSr3.js → ar-DupP3pla.js} +1 -1
- package/dist/assets/{audit-logs-ClIsZeWB.js → audit-logs-CydL26ZC.js} +2 -2
- package/dist/assets/{authorize-Czqr5dx0.js → authorize-DUyL7MEU.js} +1 -1
- package/dist/assets/{base32-CXHhcaAE.js → base32-p9VcJrwv.js} +1 -1
- package/dist/assets/{branding-CDVXldZI.js → branding-CAMtNLMU.js} +1 -1
- package/dist/assets/{branding-Dr6iifVv.js → branding-_VO2ZZ3t.js} +2 -2
- package/dist/assets/{bundle-avatar-CXZCyfoQ.js → bundle-avatar-D0t7RLGx.js} +1 -1
- package/dist/assets/button-BeZibzB9.js +1 -0
- package/dist/assets/{click-to-copy-CYn1U-tf.js → click-to-copy-BGyXQL2i.js} +1 -1
- package/dist/assets/{complete-C-F4GC22.js → complete-BzCBoyhn.js} +1 -1
- package/dist/assets/{component-DsEe2qX3.js → component-5gjaNHCg.js} +1 -1
- package/dist/assets/{config-DYPbZpg_.js → config-1xq1_d84.js} +1 -1
- package/dist/assets/{config-A_My2cMO.js → config-Bh19ZUJ-.js} +1 -1
- package/dist/assets/{config-navigation-Bi-pxL5K.js → config-navigation-Dvjz9nAh.js} +3 -3
- package/dist/assets/{config-space-DVjhjgJC.js → config-space-CYg-72ab.js} +1 -1
- package/dist/assets/{confirm-BshZuFnD.js → confirm-DqvNmeoz.js} +1 -1
- package/dist/assets/{connect-BPsVsyF2.js → connect-Bbc2y5nS.js} +1 -1
- package/dist/assets/{connect-DQxK32G8.js → connect-DM2xKEWk.js} +1 -1
- package/dist/assets/{connect-to-DXXf0Nkb.js → connect-to-Ck5O2M1K.js} +1 -1
- package/dist/assets/{content-layout-AHDEW7YQ.js → content-layout-BPaAeaMQ.js} +1 -1
- package/dist/assets/{dashboard-CCzZLCC4.js → dashboard-8QXGSoVu.js} +3 -3
- package/dist/assets/{de-8GAnQkrt.js → de-Doy9B4I7.js} +1 -1
- package/dist/assets/{de-BsZVQmUM.js → de-TcDcBkI0.js} +1 -1
- package/dist/assets/{delete-confirm-DuoSMgmG.js → delete-confirm-_BzUlhv2.js} +1 -1
- package/dist/assets/{did-address-Cg-ez88b.js → did-address-DUThaBlf.js} +1 -1
- package/dist/assets/domain-action-card-D3w6jyPR.js +24 -0
- package/dist/assets/domain-ag7_Ivc1.js +9 -0
- package/dist/assets/domains-BDxEOJh6.js +1 -0
- package/dist/assets/{dot-tsWWWiOg.js → dot-BE1YP292.js} +1 -1
- package/dist/assets/{email-DWoydsl3.js → email-DKpgximx.js} +1 -1
- package/dist/assets/{empty-spinner-D_1iEwTc.js → empty-spinner-DmDm8XzF.js} +1 -1
- package/dist/assets/{es-ntlJbt-a.js → es-CDD0y3ur.js} +1 -1
- package/dist/assets/{es-DsjXdm2X.js → es-CruF8tDk.js} +1 -1
- package/dist/assets/{exchange-passport-DysHnVpr.js → exchange-passport-Izkf8qpM.js} +1 -1
- package/dist/assets/{fr-B-64BlVz.js → fr-Bajh_D8H.js} +1 -1
- package/dist/assets/{fr-Bv4B0MVB.js → fr-zYSSKlBw.js} +1 -1
- package/dist/assets/{fuel-TLPi2Hr-.js → fuel-CcBzY6Bt.js} +1 -1
- package/dist/assets/{gen-access-key-D4caSeDS.js → gen-access-key-DxKwgiGT.js} +1 -1
- package/dist/assets/{get-safe-url-Bz4L9R5-.js → get-safe-url-Bq9SFfX6.js} +1 -1
- package/dist/assets/{get-safe-url-Dex6FTwp.js → get-safe-url-DBsPGn--.js} +1 -1
- package/dist/assets/hi-BsP-0YrU.js +5 -0
- package/dist/assets/{hi-CY-kyCxp.js → hi-DOsApYK0.js} +1 -1
- package/dist/assets/{home-CBFACtB_.js → home-Bi8fA3jh.js} +1 -1
- package/dist/assets/{id-BT_84X-S.js → id-BderyGO5.js} +1 -1
- package/dist/assets/{id-DZBgOnwF.js → id-CY2FWdMB.js} +1 -1
- package/dist/assets/{iframe-B4jzt2b3.js → iframe-DZ181i8X.js} +1 -1
- package/dist/assets/{index-BplAimRX.js → index-B2yOcqTl.js} +2 -2
- package/dist/assets/{index-CSARD20E.js → index-BGgGfqEc.js} +1 -1
- package/dist/assets/{index-BG5LYRZd.js → index-BT0GBmWF.js} +1 -1
- package/dist/assets/{index-B0-4M8vb.js → index-B_vrglsK.js} +1 -1
- package/dist/assets/{index-BOEhBltr.js → index-BnmeT4Bk.js} +1 -1
- package/dist/assets/{index-CGe7n5Gc.js → index-C8QMe2NL.js} +2 -2
- package/dist/assets/{index-ARVZ7FJv.js → index-CGBZONPv.js} +1 -1
- package/dist/assets/{index-BowdADDJ.js → index-CHbpkZwO.js} +1 -1
- package/dist/assets/{index-NRj7GpkA.js → index-Cjjg2_Xp.js} +1 -1
- package/dist/assets/{index-Cks6t9cs.js → index-DKhrYmrN.js} +1 -1
- package/dist/assets/index-DNG6b9sp.js +224 -0
- package/dist/assets/{index-CVvs-hHV.js → index-DO3_1y-L.js} +15 -15
- package/dist/assets/{index-DPpP2Hz6.js → index-DO4cSlUf.js} +1 -1
- package/dist/assets/{index-DomukIqT.js → index-DcBUShKK.js} +1 -1
- package/dist/assets/{index-BXkEM7e9.js → index-Dl4W1N74.js} +1 -1
- package/dist/assets/{index-DO1hKTlI.js → index-DuH8q5ir.js} +1 -1
- package/dist/assets/{index-C3f1mXja.js → index-DyxFC42L.js} +3 -3
- package/dist/assets/{index-MbAvBCGD.js → index-EnQ254k3.js} +1 -1
- package/dist/assets/{index-Bdp7LpPc.js → index-SDdS_qt8.js} +1 -1
- package/dist/assets/{index-DKq7-33g.js → index-bb90BUf4.js} +2 -2
- package/dist/assets/{index-CU8fxqsS.js → index-mDKG4SiY.js} +1 -1
- package/dist/assets/index-n0Q-fETi.js +99 -0
- package/dist/assets/{index-3r4UtN8A.js → index-slEV_y-C.js} +1 -1
- package/dist/assets/{invitation-7bE4cIXB.js → invitation-BrAZQXQL.js} +1 -1
- package/dist/assets/{invite-COQN-rNg.js → invite-Cbz8B2uW.js} +1 -1
- package/dist/assets/{issue-passport-11S7tmQW.js → issue-passport-Dd_yyO08.js} +1 -1
- package/dist/assets/{item-BeeQ2vgS.js → item-nK3D7WH5.js} +1 -1
- package/dist/assets/{ja-BMmtgJml.js → ja-99RIjwwl.js} +1 -1
- package/dist/assets/{ja-8jRYJGVw.js → ja-BLPXqHM4.js} +1 -1
- package/dist/assets/{ko-ChmGYnnx.js → ko-8oFi6wHH.js} +1 -1
- package/dist/assets/{ko-C4pbuwv8.js → ko-Cxgk34co.js} +1 -1
- package/dist/assets/{landing-page-DfhVYZ3b.js → landing-page-BMM_oJb1.js} +1 -1
- package/dist/assets/{launch-result-message-CCo4xyOd.js → launch-result-message-C9huWJUf.js} +1 -1
- package/dist/assets/{layout-DToDlHEw.js → layout-Cw-hwCHs.js} +1 -1
- package/dist/assets/{list-ChvGKHw5.js → list-Dmtz4mRb.js} +1 -1
- package/dist/assets/{list-header-C7I2nEkf.js → list-header-CgF1S4js.js} +1 -1
- package/dist/assets/localization-DATb3Y_j.js +1 -0
- package/dist/assets/{log-DwhNr5TA.js → log-Chqr_or_.js} +1 -1
- package/dist/assets/{logger-DwVuCvCH.js → logger-zix81YaM.js} +1 -1
- package/dist/assets/{login-_FUfsuwA.js → login-DjB23H9M.js} +1 -1
- package/dist/assets/{login-oauth-callback-BfAWMSC0.js → login-oauth-callback-ILeP59KT.js} +1 -1
- package/dist/assets/{logo-uploader-CYJXgjdA.js → logo-uploader-CJrdpVcQ.js} +3 -3
- package/dist/assets/{lost-passport-bl0QaFCp.js → lost-passport-Do1Pl0xI.js} +1 -1
- package/dist/assets/{open-window-BTH_1q7i.js → open-window-D8MZhu_7.js} +1 -1
- package/dist/assets/{overview-D4gQwSex.js → overview-DLA9wj6a.js} +1 -1
- package/dist/assets/{page-header-DWEFpJCI.js → page-header-CWY8mxlT.js} +1 -1
- package/dist/assets/{passport-item-Z9x6DkU5.js → passport-item-CWtlyIE_.js} +1 -1
- package/dist/assets/{permission-CDRSpazM.js → permission-BGM09622.js} +1 -1
- package/dist/assets/{preferences-Dck4NebC.js → preferences-DYdbb0kG.js} +1 -1
- package/dist/assets/{profile-embed-CJdf2c_q.js → profile-embed-CeEMHxEc.js} +1 -1
- package/dist/assets/pt-BINIHul4.js +5 -0
- package/dist/assets/{pt-DjThuHre.js → pt-ChXuTrrd.js} +1 -1
- package/dist/assets/publish-resource-BEc_A5mC.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-CP-WHcip.js → react-beautiful-dnd.esm-ByydTUk4.js} +1 -1
- package/dist/assets/{relative-time-4f6xdgg-.js → relative-time-Djw-K4Zu.js} +1 -1
- package/dist/assets/ru-BifF7u-P.js +5 -0
- package/dist/assets/{ru-CI1dkyMC.js → ru-IkTTTY0K.js} +1 -1
- package/dist/assets/{runtime-r0b7mSwp.js → runtime-DXl0lfXF.js} +1 -1
- package/dist/assets/sdk-CTe6rL6c.js +1 -0
- package/dist/assets/{security-CLc8EI2b.js → security-BhkfG23R.js} +4 -4
- package/dist/assets/{session-CmpGpqja.js → session-VIMbdc9j.js} +1 -1
- package/dist/assets/{setup-C0tLi0hm.js → setup-BmYxTt6Z.js} +9 -3
- package/dist/assets/{shorten-label-CE57Fd6E.js → shorten-label-DFzv9EKX.js} +1 -1
- package/dist/assets/{simple-select-rdkVpCfB.js → simple-select-DlrdVbaI.js} +1 -1
- package/dist/assets/{slicedToArray-BBoi0da6.js → slicedToArray-CPl5_eGD.js} +1 -1
- package/dist/assets/{spaces-Cf25Nw85.js → spaces-WkJCApHO.js} +1 -1
- package/dist/assets/{start-CrRC75qe.js → start-CVexuuAk.js} +1 -1
- package/dist/assets/{status-BSBLuo2u.js → status-CygZ0LuY.js} +1 -1
- package/dist/assets/{step-actions-YXGJQMCB.js → step-actions-D_1PFeFs.js} +1 -1
- package/dist/assets/{studio-wUJ0pUIv.js → studio-Byjzwg8q.js} +1 -1
- package/dist/assets/{switch-control-D0bd_WCg.js → switch-control-5fEOPVKs.js} +1 -1
- package/dist/assets/th-CBxM23U5.js +5 -0
- package/dist/assets/{th-4Bnumejd.js → th-OF8xr--T.js} +1 -1
- package/dist/assets/{traffic-BhA3A82Z.js → traffic-T11hxc--.js} +1 -1
- package/dist/assets/{transfer-BmP7JwN2.js → transfer-ROpxn9LD.js} +1 -1
- package/dist/assets/{unsubscribe-zK0TSWH3.js → unsubscribe-Cd3XOnSp.js} +1 -1
- package/dist/assets/{use-app-logo-DAnHvb1d.js → use-app-logo-B8Kl9EZt.js} +1 -1
- package/dist/assets/{use-mobile-CwehvZ0f.js → use-mobile-C_flBrm-.js} +1 -1
- package/dist/assets/{use-mobile-KRs0Yv73.js → use-mobile-DlKplWTG.js} +1 -1
- package/dist/assets/{useLocalStorage-CNdV3Qx_.js → useLocalStorage-DldnaMbZ.js} +1 -1
- package/dist/assets/{user-center-CTXkd8hW.js → user-center-CzyCbtWm.js} +1 -1
- package/dist/assets/util-Bjy-tP7q.js +1 -0
- package/dist/assets/{util-DrL3FFCf.js → util-Dw9Eiuko.js} +1 -1
- package/dist/assets/{vendor-arcblock-JGYMkSwE.js → vendor-arcblock-ScFEr-lj.js} +5 -5
- package/dist/assets/{vendor-mui-core-8zafwTFh.js → vendor-mui-core-CQ38ohp2.js} +20 -20
- package/dist/assets/{vendor-mui-x-Df6DxoLi.js → vendor-mui-x-B0hsmEJ3.js} +1 -1
- package/dist/assets/{vendor-ux-did-connect-D2f9rdKK.js → vendor-ux-did-connect-BdkhddhO.js} +4 -4
- package/dist/assets/{vi-Bc6q0tph.js → vi-DCBJBc4G.js} +1 -1
- package/dist/assets/vi-DY_Y13jR.js +5 -0
- package/dist/assets/wrap-locale-DMTYAE64.js +1 -0
- package/dist/assets/{zh-_GYrLCB8.js → zh-BRAYg0sY.js} +1 -1
- package/dist/assets/{zh-DZlGQAU9.js → zh-BYRCoK6F.js} +1 -1
- package/dist/assets/{zh-tw-Be5lgYGX.js → zh-tw-BG0rlH8p.js} +1 -1
- package/dist/assets/{zh-tw-CLcDyLaC.js → zh-tw-D5-DkgwC.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/service-worker.js +1 -1
- package/package.json +29 -29
- package/dist/assets/button-n0UOGLKx.js +0 -1
- package/dist/assets/domain-B57opALw.js +0 -9
- package/dist/assets/domain-action-card-DGNzWGpO.js +0 -24
- package/dist/assets/domains-DSFXU6AI.js +0 -1
- package/dist/assets/hi-DIf_hqVB.js +0 -5
- package/dist/assets/index-Birdle6P.js +0 -224
- package/dist/assets/index-DEAA6iri.js +0 -92
- package/dist/assets/localization-DfJCYesK.js +0 -1
- package/dist/assets/pt-CMeQ7KWn.js +0 -5
- package/dist/assets/publish-resource-CaRrvCS8.js +0 -1
- package/dist/assets/ru-8cWKcW3b.js +0 -5
- package/dist/assets/sdk-fuEXLKzh.js +0 -1
- package/dist/assets/th-DYYGBboI.js +0 -5
- package/dist/assets/util-C4Ha7L5d.js +0 -1
- package/dist/assets/vi-CfH0km8q.js +0 -5
- package/dist/assets/wrap-locale-5dMXj7tV.js +0 -1
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-C3f1mXja.js","assets/vendor-ux-did-connect-D2f9rdKK.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-BNHJB5U7.js","assets/vendor-mui-core-8zafwTFh.js","assets/vendor-hooks-DftG_2gV.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-JGYMkSwE.js","assets/index-YbJjfDTR.js","assets/index-CVvs-hHV.js","assets/index-B1ljmpu4.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as g,f as Tt,l as ct,L as ke,g as Bn,u as Wn,i as Mn,j as jt}from"./vendor-react-DEoibe3W.js";import{a8 as we,j as e,v as We,a9 as c,bc as Pt,H as s,ac as je,I as ce,T as E,c4 as zo,D as at,ag as ye,at as Un,bS as Ke,aj as dt,bs as et,bw as tt,y as K,aa as Re,P as Oo,G as Bo,w as _t,a6 as Wo,M as Mo,q as fe,X as Vn,ai as Uo,t as Vo,bV as Fn,N as Je,z as Fo,O as ne,ak as ve,as as Ho,L as Go,A as $t,b5 as Jo,bK as Xo,bx as Hn,e as Gn,ap as Jn,b$ as Xn,ae as Yn,U as Yo,W as ot,bF as Qn,bG as Zn,c5 as Kn,c6 as es,bn as Ct,bo as ts,bq as os,bu as ns,bv as kt}from"./vendor-mui-core-8zafwTFh.js";import{z as ge,C as Se,af as ss,a7 as rs,f as ko,ag as yo,ab as ls}from"./index-CVvs-hHV.js";import{r as De,j as Y,u as Q,bt as Qo,f as is,B as qe,b6 as Zo,V as Ko,b4 as en,an as cs,bu as as,a5 as qt,Y as W,a1 as ds,I as ae,bv as us,b9 as ps,a as Be,al as ut,b5 as hs,ar as tn}from"./vendor-ux-did-connect-D2f9rdKK.js";import{K as pt,c as he,q as fs,P as ms,_ as on,Q as $e,p as bs}from"./vendor-arcblock-JGYMkSwE.js";import{d as xs}from"./Error-BUxloyCF.js";import{C as ht}from"./confirm-BshZuFnD.js";import{u as Ue}from"./session-CmpGpqja.js";import{W as wt}from"./did-address-Cg-ez88b.js";import{E as Xe}from"./empty-spinner-D_1iEwTc.js";import{B as Et}from"./bundle-avatar-CXZCyfoQ.js";import{S as Ce}from"./shorten-label-CE57Fd6E.js";import{L as Lt}from"./list-header-C7I2nEkf.js";import{Z as gs,y as de,I as Nt,D as nn}from"./vendor-utils-BNHJB5U7.js";import{d as js}from"./Download-DydXtD3g.js";import{C as sn}from"./click-to-copy-CYn1U-tf.js";import{Q as ks}from"./QuestionMarkCircle-TVw9KuLr.js";import{u as ys}from"./vendor-hooks-DftG_2gV.js";import{_ as _e}from"./useSetState-CWq0AVWn.js";import{c as At}from"./index-DVQCgvFb.js";import{E as zt}from"./index-Cks6t9cs.js";import"./api-BrU7j0QA.js";import{d as vs}from"./ChevronRight-CSrWhu1k.js";import{T as Rs,a as Cs}from"./vendor-mui-x-Df6DxoLi.js";import{d as nt}from"./DeleteOutline-BwlJCwaD.js";import{D as vo,C as Ro,P as Co}from"./react-beautiful-dnd.esm-CP-WHcip.js";import{c as ws,A as rn,u as ln,S as Ss,a as Ds,b as Is,e as Ts,U as Ps,f as yt,g as cn,n as _s,h as $s,i as wo,k as qs,l as Es}from"./item-BeeQ2vgS.js";import{d as Ls}from"./ArrowDropDown-D0s0w2rW.js";import{f as xe}from"./format-error-BrmqJs5a.js";import{d as an}from"./Launch-DSlNzUJo.js";import{d as dn}from"./Done-ClKUqna8.js";import{D as Ns}from"./delete-confirm-DuoSMgmG.js";import{g as un}from"./get-safe-url-Bz4L9R5-.js";import{M as As}from"./index-BowdADDJ.js";import{r as zs}from"./index-Bdp7LpPc.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ot={},Os=we;Object.defineProperty(Ot,"__esModule",{value:!0});var pn=Ot.default=void 0,Bs=Os(De()),Ws=e;pn=Ot.default=(0,Bs.default)((0,Ws.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var Bt={},Ms=we;Object.defineProperty(Bt,"__esModule",{value:!0});var hn=Bt.default=void 0,Us=Ms(De()),Vs=e;hn=Bt.default=(0,Us.default)((0,Vs.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Wt={},Fs=we;Object.defineProperty(Wt,"__esModule",{value:!0});var fn=Wt.default=void 0,Hs=Fs(De()),Gs=e;fn=Wt.default=(0,Hs.default)((0,Gs.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Mt({did:t,projectId:o,title:n,logo:r,describe:i}){const l=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${r}`,[u,a]=g.useState(!1),f=We(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(Pt,{sx:{borderRadius:1},src:l}),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:r,locale:i}=Q(),{api:d}=ge(),{api:l}=Ue(),[u,a]=g.useState(!0),{blocklet:f}=Se(),[m,x]=g.useState(null),[v,h]=g.useState(!1),p=We(S=>S.breakpoints.down("xl")),C=We(S=>S.breakpoints.down("md")),{componentDid:R=""}=ct(),[k,y]=g.useState(null),b=`publish-${f.meta.did}`,I=Qo(b),[P,T]=g.useState({searchText:I.searchText||"",pageSize:I.rowsPerPage||10,page:1}),L=()=>{d.getProjects({input:{did:f.meta.did,componentDid:R,tenantScope:n}}).then(S=>{const A=(S==null?void 0:S.projects)||[];a(!1),y(A)}).catch(S=>{a(!1),W.error(S.message)})},z=()=>{o(`${Y.UNOWNED_DID}/create/none`,{replace:!0})},q=S=>{x(S)},Z=()=>{a(!1),h(!0)},U=()=>{h(!1),x(null)},w=S=>{W.error(S.message),h(!1),x(null)},j=S=>{if(!(S!=null&&S.deleted)){W.error("Delete project failed");return}L(),h(!1),x(null)};g.useEffect(()=>{L()},[]);const D=g.useMemo(()=>{var A;if(!P.searchText)return k;let S=(A=P.searchText)==null?void 0:A.trim();return S?(S=is.toAddress(S).toLocaleLowerCase(),k.filter(H=>H.blockletTitle.toLowerCase().includes(S)||H.blockletDid.toLowerCase().includes(S))):k},[k,P.searchText]);if(!k&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!k)return null;if(!k.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:r("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),e.jsx(qe,{onClick:z,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const M=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:S=>{const A=k[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(Zo,{type:"success",children:S}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:S=>S?e.jsx(wt,{size:14,compact:!0,responsive:!1,did:S}):null}},p||R?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:S=>S?e.jsx(wt,{onClick:()=>{o(`/.well-known/service/admin/members?did=${S}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:S}):null}},p||R?null:{label:r("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:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:S=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(Ce,{children:S})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:S=>e.jsx(Ko,{value:Number(S),locale:i})}},{label:r("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:S=>{const A=k[S];return e.jsxs(c,{display:"flex",children:[e.jsx(ke,{to:`${A.id}/new-release/${A.lastReleaseId}`,children:e.jsx(je,{title:r("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(pn,{style:{fontSize:18}})})})}),!!A.lastReleaseId&&e.jsx(je,{title:r("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(hn,{sx:{fontSize:18}})})})}),e.jsx(je,{title:r("blocklet.publish.delete",{name:A.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>q(A),children:e.jsx(en,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),O=({page:S,rowsPerPage:A,searchText:H})=>{P.pageSize!==A?T(J=>({...J,searchText:"",pageSize:A,page:1})):P.page!==S+1?T(J=>({...J,searchText:"",page:S+1})):P.searchText!==H&&T(J=>({...J,searchText:H,page:1}))},G=v?e.jsx(cs,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:l.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:j,onError:w,extraParams:{projectId:m.id,did:f.meta.did,name:m.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:m.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:m.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(c,{children:[e.jsx(Lt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:r("common.blockletStudio")}),e.jsx(je,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(fn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(as,{options:{searchPlaceholder:r("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:C},search:P.searchText,searchText:P.searchText,searchTextUpdate:S=>T(A=>({...A,searchText:S})),searchClose:()=>T(S=>({...S,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(qe,{onClick:z,variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),r("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:b,onChange:O}),m&&e.jsx(ht,{title:`${r("common.delete")} ${m.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:Z,onCancel:()=>x(null),children:e.jsx(c,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(S=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(xs,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(E,{component:"span",variant:"inherit",color:"text.secondary",children:S})]}))})}),G]})}Ut.propTypes={initUrl:s.object};Ut.defaultProps={initUrl:null};var Vt={},Js=we;Object.defineProperty(Vt,"__esModule",{value:!0});var mn=Vt.default=void 0,Xs=Js(De()),So=e;mn=Vt.default=(0,Xs.default)([(0,So.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,So.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const Ys=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},bn=Ys;function Qs(){var w;const{t,locale:o}=Q(),{projectId:n}=ct(),{api:r}=ge(),[i,d]=g.useState(!0),{blocklet:l}=Se(),u=We(j=>j.breakpoints.down("md")),[a,f]=g.useState(null),[m,x]=g.useState(null),[v,h]=g.useState(null),p=(w=window.env)==null?void 0:w.serverEndpoint,C=`releases-${l.meta.did}-${n}`,R=Qo(C),[k,y]=g.useState({searchText:R.searchText||"",pageSize:R.rowsPerPage||10,page:1}),b=()=>{r.getReleases({input:{did:l.meta.did,projectId:n}}).then(j=>{const D=(j==null?void 0:j.releases)||[];d(!1),f(D)}).catch(j=>{d(!1),W.error(j.message)})},I=()=>{r.doBatchQuery({getProject:{input:{did:l.meta.did,projectId:n}},getReleases:{input:{did:l.meta.did,projectId:n}}}).then(j=>{x(j.getProject.project||{}),f(j.getReleases.releases||[]),d(!1)}).catch(j=>{d(!1),W.error(j.message)})};g.useEffect(()=>{I()},[]);const[P,T]=g.useState(""),L=()=>{d(!1);const j=v.id;r.deleteRelease({input:{did:l.meta.did,projectId:n,releaseId:j}}).then(()=>{d(!1),b(),W.success(t("common.removeSuccess")),h(null)}).catch(D=>{d(!1),W.error(D.message)})},z=j=>{h(j)};if(!a&&i)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!a)return null;const q=e.jsxs(zo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(ke,{to:"..",children:t("common.blockletStudio")}),e.jsx(E,{color:"text.primary",children:e.jsx(Ce,{maxLength:u?6:30,children:m.blockletTitle})})]});if(!a.length)return e.jsxs(e.Fragment,{children:[q,e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),e.jsx(ke,{to:"create/none",children:e.jsx(qe,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const Z=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:j=>{const D=a[j];return e.jsx(ke,{to:`view/${D.id}`,children:e.jsx(Mt,{did:l.meta.did,projectId:m.id,logo:D.blockletLogo,title:D.blockletVersion,describe:D.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:j=>{const D=a[j];return e.jsx(E,{className:"note",children:bn(D.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:j=>e.jsx(Zo,{type:j==="published"?"success":"warning",children:j==="published"?"Released":gs(j)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:j=>{const D=a[j];return D.status!==he.PROJECT.RELEASE_STATUS.published?"":e.jsx(Ko,{value:Number(D.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:j=>{var A;const D=a[j];let M="",O="";const G=D.status==="published";if(G){const H=de(p,`/api/project/${l.meta.did}/${m.id}/${m.lastReleaseId}/release/blocklet.json`),J=new URL(p);J.pathname=de(J.pathname,"/launch-blocklet/agreement"),J.searchParams.set("blocklet_meta_url",H),M=J.href,O=de(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${l.meta.did}/${m.id}/${m.lastReleaseId}/download/${(m.lastReleaseFiles||[])[0]}`)}const S=(A=m.blockletComponents)!=null&&A.some(H=>H.included)||D.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[G&&S==="pack"&&e.jsx(je,{title:t("blocklet.publish.install",{name:m.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:M,target:"_blank",rel:"noreferrer",children:e.jsx(mn,{sx:{fontSize:18}})})})}),G&&e.jsx(je,{title:t("blocklet.publish.download",{name:m.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:O,children:e.jsx(js,{sx:{fontSize:18}})})})}),e.jsx(je,{title:t("blocklet.publish.delete",{name:m.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>z(D),children:e.jsx(en,{sx:{fontSize:18}})})})]})}}}],U=({page:j,rowsPerPage:D,searchText:M})=>{k.pageSize!==D?y(O=>({...O,searchText:"",pageSize:D,page:1})):k.page!==j+1?y(O=>({...O,searchText:"",page:j+1})):k.searchText!==M&&y(O=>({...O,searchText:M,page:1}))};return e.jsxs(Zs,{children:[e.jsx(Lt,{sx:{mb:2},left:q,actions:e.jsxs(e.Fragment,{children:[e.jsx(qe,{variant:"outlined",onClick:()=>{const j=de(p,`/api/project/${l.meta.did}/${n}/blocklet.json`);T(j)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(ke,{to:"new-release/none",children:e.jsxs(qe,{variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(at,{fullWidth:!0,maxWidth:"sm",open:P,onClose:()=>T(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(E,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(sn,{children:P}),e.jsxs(E,{sx:{mt:2},children:[t("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:t("blocklet.publish.installResourceHelp")})]})]})}),e.jsx(qt,{className:"main-table",verticalKeyWidth:100,locale:o,data:a,columns:Z,durable:C,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1},onChange:U}),v&&e.jsx(ht,{title:t(`${t("common.delete")} ${v.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:L,onCancel:()=>h(null)})]})}const Zs=ye(c)`
|
|
3
|
-
.main-table > div:first-child {
|
|
4
|
-
display: none;
|
|
5
|
-
}
|
|
6
|
-
.note {
|
|
7
|
-
word-break: break-all;
|
|
8
|
-
white-space: pre-line;
|
|
9
|
-
}
|
|
10
|
-
`;var Ft={},Ks=we;Object.defineProperty(Ft,"__esModule",{value:!0});var xn=Ft.default=void 0,er=Ks(De()),tr=e;xn=Ft.default=(0,er.default)((0,tr.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(Un,{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:xn};function Ht({value:t,app:o,onChange:n,onChangeBlockletResourceType:r,disabled:i,resourceRelateComponents:d,projectType:l,dependentComponentsMode:u,blockletResourceType:a}){const{t:f,locale:m}=Q(),x=u==="readonly",v=g.useMemo(()=>{const b=t.reduce((I,P)=>(I[P.did]=P.included,I),{});return(o.children||[]).filter(I=>x?d[I.meta.did]||b[I.meta.did]:!0)},[o.children,t,d,x]),h=g.useMemo(()=>v.map(b=>t.find(P=>P.did===b.meta.did)||{did:b.meta.did}),[v,t]),p=h.reduce((b,I)=>(b[I.did]=Nt(I,["required","included"]),b),{}),C=b=>{const I=h.map(P=>{if(P.did===b){const T=!P.included;return{...P,included:T,required:T}}return P});n(I)},R=b=>{const I=h.map(P=>P.did===b?{...P,required:!P.required}:P);n(I)},k=b=>{r(b.target.checked?"resource":"")},y=[{label:f("common.name"),name:"meta.title",width:200,options:{customBodyRenderLite:b=>{var T;const I=v[b],P=(T=p[I.meta.did])==null?void 0:T.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:!P}),children:e.jsx(c,{children:I.meta.title})})]})}}},{label:f("blocklet.publish.componentIncluded"),width:100,options:{customBodyRenderLite:b=>{var L;const I=v[b],P=d[I.meta.did],T=!!((L=p[I.meta.did])!=null&&L.included);return e.jsx(Ke,{size:"small",checked:P||T,onClick:()=>C(I.meta.did),disabled:x||P||i})}}},{label:f("blocklet.publish.componentForceRequired"),width:100,options:{customBodyRenderLite:b=>{var z,q;const I=v[b],P=d[I.meta.did],T=!!((z=p[I.meta.did])!=null&&z.included),L=!!((q=p[I.meta.did])!=null&&q.required);return e.jsx(Ke,{size:"small",checked:P||L&&T,onClick:()=>R(I.meta.did),disabled:x||P||i||!T})}}}];return e.jsx(or,{children:v!=null&&v.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(l==="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:k}),f("blocklet.publish.forceResourceBlocklet")]})]}),e.jsx(qt,{className:"main-table",verticalKeyWidth:100,locale:m,data:v,columns:y,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 or=ye(c)`
|
|
11
|
-
.main-table {
|
|
12
|
-
.text.excluded {
|
|
13
|
-
color: #999;
|
|
14
|
-
}
|
|
15
|
-
width: 400px;
|
|
16
|
-
${({theme:t})=>t.breakpoints.down("md")} {
|
|
17
|
-
width: 100%;
|
|
18
|
-
}
|
|
19
|
-
> div:first-child {
|
|
20
|
-
display: none;
|
|
21
|
-
}
|
|
22
|
-
.MuiTableCell-head {
|
|
23
|
-
padding-top: 0;
|
|
24
|
-
padding-bottom: 0;
|
|
25
|
-
}
|
|
26
|
-
.MuiTableCell-body {
|
|
27
|
-
padding-top: 6px;
|
|
28
|
-
padding-bottom: 6px;
|
|
29
|
-
}
|
|
30
|
-
.datatable-footer {
|
|
31
|
-
display: none;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
`;var nr=(t,o=1,n)=>{if(n={indent:" ",includeEmptyLines:!1,...n},typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof o!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof o}\``);if(typeof n.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof n.indent}\``);if(o===0)return t;const r=n.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return t.replace(r,n.indent.repeat(o))};const Do=ss,Io=/\s+at.*(?:\(|\s)(.*)\)?/,sr=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,rr=typeof Do.homedir>"u"?"":Do.homedir();var lr=(t,o)=>(o=Object.assign({pretty:!1},o),t.replace(/\\/g,"/").split(`
|
|
35
|
-
`).filter(n=>{const r=n.match(Io);if(r===null||!r[1])return!0;const i=r[1];return i.includes(".app/Contents/Resources/electron.asar")||i.includes(".app/Contents/Resources/default_app.asar")?!1:!sr.test(i)}).filter(n=>n.trim()!=="").map(n=>o.pretty?n.replace(Io,(r,i)=>r.replace(i,i.replace(rr,"~"))):n).join(`
|
|
36
|
-
`));const ir=nr,cr=lr,ar=t=>t.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,"");let dr=class extends Error{constructor(o){if(!Array.isArray(o))throw new TypeError(`Expected input to be an Array, got ${typeof o}`);o=[...o].map(r=>r instanceof Error?r:r!==null&&typeof r=="object"?Object.assign(new Error(r.message),r):new Error(r));let n=o.map(r=>typeof r.stack=="string"?ar(cr(r.stack)):String(r)).join(`
|
|
37
|
-
`);n=`
|
|
38
|
-
`+ir(n,4),super(n),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:o})}*[Symbol.iterator](){for(const o of this._errors)yield o}};var ur=dr;const pr=ur;var hr=async(t,o,{concurrency:n=1/0,stopOnError:r=!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 l=[],u=[],a=t[Symbol.iterator]();let f=!1,m=!1,x=0,v=0;const h=()=>{if(f)return;const p=a.next(),C=v;if(v++,p.done){m=!0,x===0&&(!r&&u.length!==0?d(new pr(u)):i(l));return}x++,(async()=>{try{const R=await p.value;l[C]=await o(R,C),x--,h()}catch(R){r?(f=!0,d(R)):(u.push(R),x--,h())}})()};for(let p=0;p<n&&(h(),!m);p++);});const fr=hr;var mr=(t,o)=>fr(t,n=>n(),o);const st=Bn(mr);function br(t,o){const n=new Set(o||[]),r=[];function i(d){n.has(d==null?void 0:d.id)&&r.push(d==null?void 0:d.id),d!=null&&d.children&&d.children.forEach(i)}return(t||[]).forEach(i),r}function Gt({src:t,alt:o,...n}){const[r,i]=g.useState(!1),d=g.useRef(null);return g.useEffect(()=>{if(!("IntersectionObserver"in window))return i(!0),()=>{};const l=new IntersectionObserver(u=>{u.forEach(a=>{a.isIntersecting&&(i(!0),l.disconnect())})},{threshold:.1});return d.current&&l.observe(d.current),()=>{l.disconnect()}},[]),e.jsx("img",{ref:d,src:r?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(xr,{...n,children:t.map(r=>e.jsx("a",{href:r.url,target:"_blank",rel:"noreferrer",children:o?e.jsx(Gt,{src:r.url,alt:r.alt||""}):e.jsx("img",{src:r.url,alt:r.alt||""})},r.url))})}Jt.propTypes={data:s.arrayOf(s.shape({url:s.string,alt:s.string})),lazy:s.bool};Jt.defaultProps={data:[],lazy:!1};const xr=ye(c)`
|
|
39
|
-
display: flex;
|
|
40
|
-
justify-content: flex-start;
|
|
41
|
-
flex-wrap: wrap;
|
|
42
|
-
margin-bottom: -12px;
|
|
43
|
-
a {
|
|
44
|
-
display: flex;
|
|
45
|
-
}
|
|
46
|
-
img {
|
|
47
|
-
height: 128px;
|
|
48
|
-
cursor: pointer;
|
|
49
|
-
margin-right: 12px;
|
|
50
|
-
margin-bottom: 12px;
|
|
51
|
-
}
|
|
52
|
-
`,vt=(t,o)=>{const n=[...t];for(;n.length>0;){const r=n.shift();if(r.id===o)return r;r.children&&n.push(...r.children)}return[]};function Xt({icon:t}){return t?ds(t)?e.jsx("img",{className:"resource-icon",src:t,alt:"icon"}):e.jsx(ae,{className:"resource-icon",icon:t}):null}Xt.propTypes={icon:s.string};Xt.defaultProps={icon:""};function Yt({disabled:t,data:o,onChange:n,value:r}){const i=r;function d(h,p=[]){return p.push(h.id),h.children&&h.children.forEach(C=>d(C,p)),p}const l=h=>d(vt(o,h)),u=(h,p=[])=>{const C=vt(o,h);return C.parent?(p.push(C.parent),u(C.parent,p)):p};function a(h,p){const C=l(h.id),R=C.indexOf(h.id);return C.splice(R,1),C.every(k=>i.concat(p).includes(k))}const f=(h,p)=>{h.stopPropagation();const C=l(p),R=u(p);if(i.includes(p)){const k=i.filter(y=>!C.concat(R).includes(y));n(k)}else{const k=C;for(let y=0;y<R.length;++y)a(vt(o,R[y]),k)&&k.push(R[y]);n([...i].concat(k))}},m=h=>{h.stopPropagation()},x=o.some(h=>{var p;return((p=h.children)==null?void 0:p.length)>0}),v=h=>{var y;const p=i.indexOf(h.id)!==-1,C=Array.isArray(h.children),R=l(h.id),k=C&&!p&&i.some(b=>R.includes(b));return e.jsx(Rs,{nodeId:h.id,label:e.jsx(et,{onClick:m,control:e.jsx(Ke,{size:"small",checked:p,indeterminate:k,tabIndex:-1,disableRipple:!0,onClick:b=>f(b,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(ms,{className:"link-icon"})})]}),!!h.description&&e.jsx(c,{className:"description",children:h.description}),!!((y=h.images)!=null&&y.length)&&e.jsx(Jt,{className:"images",data:h.images,lazy:!0})]})}),children:C?h.children.map(v):null},h.id)};return e.jsx(gr,{className:At(!x&&"no-children"),multiSelect:!0,defaultCollapseIcon:e.jsx(fs,{}),defaultExpandIcon:e.jsx(vs,{}),selected:i,children:o.map(h=>v(h))})}Yt.propTypes={data:s.array,value:s.array,onChange:s.func,disabled:s.bool};Yt.defaultProps={data:[],value:[],onChange:()=>{},disabled:!1};const gr=ye(Cs)`
|
|
53
|
-
&.no-children {
|
|
54
|
-
.MuiTreeItem-content {
|
|
55
|
-
padding: 0;
|
|
56
|
-
.MuiTreeItem-iconContainer {
|
|
57
|
-
display: none;
|
|
58
|
-
}
|
|
59
|
-
.MuiTreeItem-label {
|
|
60
|
-
padding-left: 0;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
.MuiTreeItem-content {
|
|
65
|
-
align-items: flex-start;
|
|
66
|
-
.MuiTreeItem-iconContainer {
|
|
67
|
-
transform: translateY(10px);
|
|
68
|
-
}
|
|
69
|
-
&.Mui-selected {
|
|
70
|
-
background-color: transparent;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
.MuiTreeItem-label {
|
|
74
|
-
cursor: default;
|
|
75
|
-
}
|
|
76
|
-
.MuiFormControlLabel-root {
|
|
77
|
-
align-items: flex-start;
|
|
78
|
-
}
|
|
79
|
-
.content {
|
|
80
|
-
padding-top: 6px;
|
|
81
|
-
}
|
|
82
|
-
.name {
|
|
83
|
-
font-size: 16px;
|
|
84
|
-
font-weight: 700;
|
|
85
|
-
}
|
|
86
|
-
.resource-icon {
|
|
87
|
-
margin-right: 2px;
|
|
88
|
-
font-size: 16px;
|
|
89
|
-
}
|
|
90
|
-
img.resource-icon {
|
|
91
|
-
width: 1rem;
|
|
92
|
-
height: 1rem;
|
|
93
|
-
}
|
|
94
|
-
.link {
|
|
95
|
-
margin-left: 8px;
|
|
96
|
-
font-size: 16px;
|
|
97
|
-
color: ${({theme:t})=>t.palette.primary.main};
|
|
98
|
-
display: flex;
|
|
99
|
-
}
|
|
100
|
-
.link-icon {
|
|
101
|
-
font-size: inherit;
|
|
102
|
-
}
|
|
103
|
-
.description {
|
|
104
|
-
font-size: 14px;
|
|
105
|
-
color: ${({theme:t})=>t.palette.text.secondary};
|
|
106
|
-
}
|
|
107
|
-
`,To={},jr=(t,o,{key:n,cacheTime:r=1e3*3}={})=>{const i=n+JSON.stringify({params:o}),d=To[i];if(d&&d.timestamp>Date.now()-r)return d.promise;const l=t(...o);return To[i]={promise:l,timestamp:Date.now()},l},gn=jr,jn=(t,o)=>(t.forEach(n=>{o&&(n.parent=o),(n.children||[]).forEach(r=>{r.parent=n.id,jn(r.children||[],r.id)})}),t),kn=(t,o,n,r,i)=>{const{exportApi:d="/"}=(t==null?void 0:t.meta.resource)||{},l=new URL(de("http://127.0.0.1",t==null?void 0:t.mountPoint,d||"/").replace(/\/+/g,"/"));return l.searchParams.set("projectId",o),l.searchParams.set("releaseId",n),l.searchParams.set("local",r),i&&l.searchParams.set("resourcesParams",i.searchParams.get("resourcesParams")),`${l.pathname}${l.search}`},kr=async({api:t,appDid:o,component:n,projectId:r,releaseId:i,locale:d,initUrl:l,resources:u})=>{let a;if(l&&l.searchParams.get("resourcesParams"))try{a=JSON.parse(l.searchParams.get("resourcesParams"))}catch(f){W.error(f.message);return}await nn.post(kn(n,r,i,d,l),{resources:u,projectId:r,releaseId:i,locale:d,...a?{resourcesParams:a}:{}},{headers:{"x-csrf-token":us()},timeout:10*60*1e3}),await t.updateSelectedResources({input:{did:o,projectId:r,releaseId:i,componentDid:n.meta.did,resources:u}})},yr=(t,o)=>{if(!t)return{};const n=o.reduce((i,d)=>(i[d]=!0,i),{}),r=(i,d)=>(i.forEach(l=>{var u;n[l.id]&&((u=l.dependentComponents)!=null&&u.length)&&l.dependentComponents.forEach(a=>{d[a]=!0}),l.children&&r(l.children,d)}),d);return r(t,{})};function Qt({app:t,component:o,projectId:n,release:r,loading:i,error:d,saveSelectedEventsRef:l,readOnly:u,componentDid:a,initialResources:f={},setResourceComponentsMap:m,selectedResourceIds:x,setSelectedResourceIds:v,showTree:h,initUrl:p}){var U;const{t:C,locale:R}=Q(),{api:k}=ge(),[y,b]=_e({}),I=g.useRef({}),P=g.useRef(!1),T=r.id;I.current.projectId=n,I.current.releaseId=T;const L=(w,j,D)=>{if(!j)return;const M=yr(j,D);m==null||m({[w]:Object.keys(M)})},z=w=>{l.current[o.meta.did]={resources:w,component:o},v({[o.meta.did]:w}),L(o.meta.did,y[o.meta.did],w)},q=g.useCallback(async w=>{var j;try{const D=await gn(nn.get,[kn(w,n,T,R,p),{timeout:6e4}],{key:"getResources"});return jn(((j=D==null?void 0:D.data)==null?void 0:j.resources)||[])}catch{return[]}},[n,T,R,p]);g.useEffect(()=>{y[o==null?void 0:o.meta.did]||q(o).then(w=>{b({[o==null?void 0:o.meta.did]:w})}).catch(w=>{W.error(w.message)})},[o,b,y,q]),g.useEffect(()=>{T&&n&&!P.current&&st(t.children.map(w=>async()=>{var j,D;if(!(a&&a!==w.meta.did)&&!(!(w!=null&&w.mountPoint)||!rs.hasStartEngine(w==null?void 0:w.meta)||!((D=(j=w==null?void 0:w.meta)==null?void 0:j.resource)!=null&&D.exportApi)))try{const M=await q(w);b({[w==null?void 0:w.meta.did]:M});const O=await k.getSelectedResources({input:{did:t.meta.did,projectId:n,releaseId:T,componentDid:w.meta.did}}),G=(O==null?void 0:O.resources)||[];G!=null&&G.length&&(v({[w.meta.did]:br(M,G)}),L(w.meta.did,M,G),u||(l.current[w==null?void 0:w.meta.did]={resources:G,component:w}))}catch(M){W.error(M.message)}}),{concurrency:2}).then(()=>{P.current=!0})},[T,n,u,R,p,b]),g.useEffect(()=>{f&&Object.keys(f).length&&st(t.children.map(async w=>{const j=f[w.meta.did];if(j!=null&&j.length){const D=await q(w);v({[w.meta.did]:j}),L(w.meta.did,D,j),u||(l.current[w==null?void 0:w.meta.did]={resources:j,component:w})}}))},[t,f,u]);let Z=null;return(!o||!((U=y[o.meta.did])!=null&&U.length))&&(Z=e.jsx(Me,{Icon:zt,children:C("blocklet.publish.resourceEmptyTip",{name:ko.getDisplayName(o)})})),(o==null?void 0:o.status)!=="running"&&(Z=e.jsx(Me,{children:C("blocklet.publish.componentNotRunning",{name:ko.getDisplayName(o)})})),e.jsxs(e.Fragment,{children:[e.jsx(vr,{className:At(d&&"error"),children:h&&e.jsx(c,{pb:2,width:"100%",children:Z||e.jsx(Yt,{data:y[o.meta.did]||[],value:x[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 vr=ye(c)`
|
|
108
|
-
border: 1px solid #ccc;
|
|
109
|
-
max-height: 600px;
|
|
110
|
-
width: 100%;
|
|
111
|
-
&.error {
|
|
112
|
-
border-color: ${t=>t.theme.palette.error.main};
|
|
113
|
-
}
|
|
114
|
-
border-radius: 4px;
|
|
115
|
-
padding: 16px;
|
|
116
|
-
padding-bottom: 0px;
|
|
117
|
-
overflow-y: auto;
|
|
118
|
-
.footer {
|
|
119
|
-
border-top: 1px solid #ddd;
|
|
120
|
-
display: flex;
|
|
121
|
-
padding: 12px 0;
|
|
122
|
-
margin-top: 12px;
|
|
123
|
-
position: sticky;
|
|
124
|
-
bottom: 0;
|
|
125
|
-
background: #fff;
|
|
126
|
-
z-index: 10;
|
|
127
|
-
}
|
|
128
|
-
`;var Zt={},Rr=we;Object.defineProperty(Zt,"__esModule",{value:!0});var St=Zt.default=void 0,Cr=Rr(De()),wr=e;St=Zt.default=(0,Cr.default)((0,wr.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 Sr(t){var u,a;const[o,n]=g.useState(null),{session:r}=Ue(),i=g.useCallback(f=>{n(f),localStorage.setItem(Po,f==null?void 0:f.id)},[n]),d=g.useMemo(()=>{var v,h,p,C;const f=localStorage.getItem(Po),m=f?(((v=t==null?void 0:t.settings)==null?void 0:v.storeList)||[]).find(R=>R.id===f):null;if(m)return m;let x=(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(R=>{var k;return!(R.id!==Y.BLOCKLET_STORE.id||R.scope&&R.scope!=="studio"&&R.scope!==((k=r==null?void 0:r.user)==null?void 0:k.did))});return x||(x=(C=(p=t==null?void 0:t.settings)==null?void 0:p.storeList)==null?void 0:C[0]),x},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=r==null?void 0:r.user)==null?void 0:a.did]);return[o||d||{},i]}const Rt={};async function Kt(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:r=4e3,timerKey:i=""}){Rt[i]&&clearTimeout(Rt[i]),await new Promise(u=>setTimeout(u,r));const d=Date.now(),l=async(u,a)=>{try{const f=await t();u(f)}catch(f){Date.now()-d>n?a(f):i?Rt[i]=setTimeout(()=>l(u,a),o):setTimeout(()=>l(u,a),o)}};return new Promise(l)}function Dr(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Ir(t,{did:o,projectId:n,messageId:r}){return Kt(async()=>{var d;const i=await t.getProject({input:{did:o,projectId:n,messageId:r}});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 Tr(t,{did:o,projectId:n,storeId:r}){return Kt(async()=>{var l,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(l=i==null?void 0:i.project)==null?void 0:l.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(a=>a.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}function Pr(t,{did:o,projectId:n,endpointId:r}){return Kt(async()=>{var l,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(l=i==null?void 0:i.project)==null?void 0:l.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(a=>a.endpointId===r))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${r}`})}const _r=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:r})=>{var l,u;const i=t?(l=n==null?void 0:n.meta)==null?void 0:l.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===r),{teamDid:i,storeList:d}},eo=_r;function to({blocklet:t,store:o={},onChangeStore:n,onClick:r,disabled:i,loading:d,componentDid:l}){var w,j,D;const{t:u}=Q(),{session:a}=Ue(),{api:f,info:m,inService:x}=ge(),v=Se(),[h,p]=g.useState(!1),C=g.useRef(null),[R,k]=g.useState(!1),[y,b]=g.useState(null),I=M=>{n(M),p(!1)},P=()=>{p(!h)},T=M=>{C.current&&C.current.contains(M.target)||p(!1)},L=()=>{k(!0)},z=()=>{k(!1)},q=async()=>{var M;if(y)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:y.url,projectId:"",scope:y.scope||"studio"}}),await((M=v==null?void 0:v.actions)==null?void 0:M.refreshBlocklet())}catch(O){W.error(`Remove Blocklet Store Error: ${xe(O)}`)}finally{b(null)}},{storeList:Z}=eo({fromBlocklet:x,blocklet:t,nodeInfo:m,componentDid:l,userDid:(w=a==null?void 0:a.user)==null?void 0:w.did}),U=(j=t==null?void 0:t.meta)==null?void 0:j.did;return e.jsxs(e.Fragment,{children:[e.jsxs(tt,{disabled:i,ref:C,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(K,{onClick:r,children:[d&&e.jsx(Re,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(K,{size:"small","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:P,children:e.jsx(Ls,{})})]}),e.jsx(Oo,{sx:{zIndex:10},open:h,anchorEl:C.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(_t,{children:e.jsx(Wo,{onClickAway:T,children:e.jsxs(Mo,{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:()=>I(O),children:[e.jsxs(c,{children:[e.jsx(Ce,{sx:{fontSize:"16px"},maxLength:24,children:O.name}),e.jsx(Ce,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:O.url})]}),ws({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(),b(O)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},O.url)}),e.jsx(Vn,{}),e.jsxs(fe,{onClick:L,children:[e.jsx(pt,{font:!0}),e.jsx(E,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),R&&e.jsx(rn,{hiddenChildren:!0,open:!0,onClose:z,teamDid:U,storeList:Z,scope:"studio",onAdd:(D=v==null?void 0:v.actions)==null?void 0:D.refreshBlocklet}),y&&e.jsx(ht,{displayError:!0,title:`${u("common.delete")} ${y.name}`,description:u("blocklet.publish.deleteStoreTip",{name:y.name}),confirm:u("common.confirm"),onConfirm:q,onCancel:()=>b(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 $r=(t,o,n)=>{const r=`${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?`${r}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,l=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:d,screenshotUrls:l,uploadLogoPrefix:r,uploadScreenshotPrefix:i}},yn=$r,qr=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:r}){var u;const{t:i}=Q(),d=t.includes("youtube.com")||t.includes("youtu.be"),l=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=${r}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(l){const 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 vn({setParams:t,onClose:o,params:n}){const{t:r}=Q(),[i,d]=g.useState(""),l=i&&n.blockletVideos.includes(i),u=qr(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(Uo,{children:r("studio.videoDialogTitle")}),e.jsxs(Vo,{children:[e.jsx(Fn,{fullWidth:!0,value:i,onChange:f=>d(f.target.value),placeholder:r("studio.videoInputLabel"),endAdornment:i?e.jsx(Je,{position:"end",children:e.jsx(ce,{onClick:()=>d(""),children:e.jsx(ps,{})})}):null,error:l}),l&&e.jsx(E,{variant:"body2",color:"error",children:r("studio.duplicateVideo")}),e.jsx(ft,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Fo,{children:[e.jsx(K,{onClick:()=>o(),children:r("studio.cancel")}),e.jsx(K,{disabled:!u||l,onClick:a,children:r("studio.confirm")})]})]})}vn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Dt({errors:t,storeList:o,...n}){const{t:r}=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:r("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([i,d])=>{const l=Object.values(d),u=o.find(a=>a.url===i);return l.length>0&&e.jsxs(c,{children:[e.jsx(je,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),l.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=g.lazy(()=>on(()=>import("./index-C3f1mXja.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function Rn({projectId:t,readOnly:o,loading:n,blocklet:r,params:i,setParams:d,paramsErrTip:l,setParamsErrTip:u,warning:a,setLoading:f,initUrl:m,initLogoUrl:x,setInitLogoUrl:v,componentDid:h}){const{t:p,locale:C}=Q(),{api:R}=ge(),k=Tt(),y=g.useRef(null),b=g.useRef(null),[I,P]=Sr(r),[T,L]=g.useState(!1),z=ln({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),q=async $=>{const V=setTimeout(()=>{f(!1)},2e4),X=await Ir(R,$);f(!1),clearTimeout(V),window.parent.postMessage({event:"studioDialog.connected",componentDid:h},"*"),k(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},Z=()=>{if(!i.blockletTitle){W.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(I!=null&&I.url)){W.error(p("blocklet.publish.noStoreSelected"));return}const $=Dr();z(async(V,X)=>{var te,oe,ie;try{const ee=await R.connectByStudio({input:{did:(te=r==null?void 0:r.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:$,tenantScope:(m==null?void 0:m.searchParams.get("tenantScope"))||""}});if(!(ee!=null&&ee.url)){W.error("failed to connect to store");return}X(ee.url),q({did:(ie=r==null?void 0:r.meta)==null?void 0:ie.did,projectId:"",messageId:$})}catch(ee){const ue=xe(ee);W.error(ue),f(!1)}})},{logoUrl:U,screenshotUrls:w,uploadLogoPrefix:j,uploadScreenshotPrefix:D}=yn(i,r,t),{logoErrors:M,screenshotErrors:O,storeList:G,hasLogoWarning:S,hasScreenshotWarning:A}=a,H=()=>o?!1:!t||t===Y.UNOWNED_DID?(W.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,J=$=>{if(!$.destination)return;const V=Array.from(i.blockletScreenshots),[X]=V.splice($.source.index,1);V.splice($.destination.index,0,X),d(te=>({...te,blockletScreenshots:V}))},Ie=$=>{if(!$.destination)return;const V=Array.from(i.blockletVideos),[X]=V.splice($.source.index,1);V.splice($.destination.index,0,X),d(te=>({...te,blockletVideos:V}))};return e.jsxs(Er,{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:!!l.blockletTitle,helperText:l.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:r,store:I,componentDid:h,onChangeStore:P,disabled:!i.blockletTitle||o||n,loading:n,onClick:Z})})},error:!!l.projectId,helperText:l.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:!!l.blockletDescription,helperText:l.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:!!l.blockletHomepage,helperText:l.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:!!l.blockletCommunity,helperText:l.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:!!l.blockletSupport,helperText:l.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:!!l.blockletRepository,helperText:l.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),e.jsxs(ve,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx(Pt,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:x||U,onClick:()=>{var $;H()&&(($=y.current)==null||$.open())}})})]}),S&&e.jsx(Dt,{errors:M,storeList:G,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),e.jsxs(ve,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),e.jsx(vo,{onDragEnd:o?void 0:J,children:e.jsx(Ro,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:($,V)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:$.innerRef,...$.droppableProps,children:[w.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,w.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=b.current)==null||X.open())},children:"+"})]})})})]}),A&&e.jsx(Dt,{errors:O,storeList:G}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),e.jsxs(ve,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"#007ec6"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"#555"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"#007ec6"},children:p("studio.orderTip")})]})})]})]}),e.jsx(vo,{onDragEnd:o?void 0:Ie,children:e.jsx(Ro,{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(g.Suspense,{fallback:e.jsx(Xe,{}),children:[e.jsx(_o,{ref:y,locale:C,popup:!0,onUploadFinish:$=>{var V;d({blockletLogo:$.data.filename}),v(""),(V=y.current)==null||V.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:j,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"),T&&e.jsx(vn,{onClose:()=>L(!1),params:i,setParams:d}),e.jsx(_o,{ref:b,locale:C,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=b.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-w.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")]})]})}Rn.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 Er=ye.div`
|
|
129
|
-
margin-top: 24px;
|
|
130
|
-
.screenshot {
|
|
131
|
-
margin-bottom: 16px;
|
|
132
|
-
max-width: 240px;
|
|
133
|
-
max-height: 135px;
|
|
134
|
-
width: 240px;
|
|
135
|
-
height: 135px;
|
|
136
|
-
overflow: hidden;
|
|
137
|
-
display: flex;
|
|
138
|
-
align-items: center;
|
|
139
|
-
justify-content: center;
|
|
140
|
-
background-color: #eee;
|
|
141
|
-
margin-right: 16px;
|
|
142
|
-
position: relative;
|
|
143
|
-
.action {
|
|
144
|
-
visibility: hidden;
|
|
145
|
-
position: absolute;
|
|
146
|
-
width: 42px;
|
|
147
|
-
height: 42px;
|
|
148
|
-
right: 6px;
|
|
149
|
-
top: 6px;
|
|
150
|
-
border-radius: 4px;
|
|
151
|
-
background-color: rgba(0, 0, 0, 1);
|
|
152
|
-
color: rgba(255, 255, 255, 1);
|
|
153
|
-
}
|
|
154
|
-
&:hover .action {
|
|
155
|
-
visibility: visible;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
.screenshot img {
|
|
159
|
-
width: 100%; /* 图像宽度填充容器 */
|
|
160
|
-
height: auto; /* 图像高度自适应 */
|
|
161
|
-
}
|
|
162
|
-
`;var oo={},Lr=we;Object.defineProperty(oo,"__esModule",{value:!0});var Cn=oo.default=void 0,Nr=Lr(De()),Ar=e;Cn=oo.default=(0,Nr.default)((0,Ar.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 zr=(t,o,n,r)=>{const i=t?[...t]:[],d=((o==null?void 0:o.children)||[]).reduce((l,u)=>(l[u.meta.did]=!0,l),{});return Object.keys(n).forEach(l=>{if(!d[l])return;let u=!1;r||i.forEach(a=>{a.did===l&&(a.included=!0,a.required=!0,u=!0)}),u||i.push({did:l,included:!0,required:!0})}),i},Or=async t=>{if(typeof t!="string")throw new Error("URL must be a string");try{const o=t.split("/").pop().split("?")[0],r=await(await fetch(t)).blob();return new File([r],o,{type:r.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*Br(t,o){let n=0;for(;n<t.size;)yield t.slice(n,n+o),n+=o}const Wr=async({did:t,projectId:o,uploadType:n="logo",imageUrl:r})=>{const i=await Or(r);new FormData().append("file",i);const l={uploaderId:"Uploader",relativePath:encodeURIComponent(i.name),name:encodeURIComponent(i.name),type:i.type},a=(await yo.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(l).map(v=>`${v} ${btoa(l[v])}`).join(",")}})).headers.location,f=2*1024*1024;let m=0,x="";for(const v of Br(i,f)){const h=await yo.patch(de(Y.WELLKNOWN_SERVICE_PATH_PREFIX,a),v,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":m,"Content-Type":"application/offset+octet-stream"}});m+=v.size,x=h.data.filename}return x},wn=({params:t,projectId:o,status:n,t:r})=>{const i=[];return t.blockletTitle||i.push({param:"blockletTitle",message:r("blocklet.publish.errorTip.noTitle")}),(!o||o===Y.UNOWNED_DID)&&i.push({param:"projectId",message:r("blocklet.publish.errorTip.noDid")}),t.blockletVersion?Be.valid(t.blockletVersion)||i.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.inValidVersion")}):i.push({param:"blockletVersion",message:r("blocklet.publish.errorTip.noVersion")}),n===he.PROJECT.RELEASE_STATUS.published&&(t.blockletDescription||i.push({param:"blockletDescription",message:r("blocklet.publish.errorTip.noDescription")}),t.note||i.push({param:"note",message:r("blocklet.publish.errorTip.noNote")})),i.length?i:null},Mr=({params:t,step:o,t:n,projectId:r})=>{if(o===0){if(!t.blockletTitle)return n("blocklet.publish.errorTip.noTitle");if(!r||r===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(!Be.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:r,releaseType:i,publishedStoreIds:d,onPublish:l,onDelete:u,warning:a,projectType:f,componentDid:m,onOpenConnectStore:x,behavior:v,onSelectConnectStore:h}){var P,T;const{t:p}=Q(),{actions:{refreshBlocklet:C}}=Se(),{session:R}=Ue(),{storeList:k}=eo({fromBlocklet:!0,blocklet:t,componentDid:m,userDid:(P=R==null?void 0:R.user)==null?void 0:P.did}),y=g.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((L,z)=>(L[z.storeId]=z,L),{}):{},[n]),b=(T=t==null?void 0:t.meta)==null?void 0:T.did,I={};return Object.entries((a==null?void 0:a.logoErrors)||{}).forEach(([L,z])=>{const q=Object.values(z);q.length>0&&(I[L]=q)}),Object.entries((a==null?void 0:a.screenshotErrors)||{}).forEach(([L,z])=>{const q=Object.values(z);q.length>0&&(I[L]=I[L]?[...I[L],...q]:q)}),e.jsxs(e.Fragment,{children:[v==="connect"&&!!(k!=null&&k.length)&&e.jsx(dt,{severity:"info",style:{width:"100%"},children:e.jsxs(c,{color:Ho[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(an,{sx:{marginLeft:1}})]})}),e.jsx(Go,{children:k==null?void 0:k.map(L=>e.jsx($t,{"data-cy":"store-switch",children:e.jsx(Jo,{children:e.jsx(Ss,{behavior:v,onSelectConnectStore:h,releaseId:o,projectId:r,releaseType:i,kind:"publish",teamDid:b,warningList:I[L.url],store:L,published:(d==null?void 0:d.indexOf(L.id))>-1,connectedStore:y[L.id],onPublish:l,onDelete:u,scope:L.scope||"studio",onOpenConnectStore:x})})},L.url))}),e.jsx(rn,{teamDid:b,storeList:k,scope:"studio",onAdd:C})]})}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 Ur=Xo(t=>({addMenuItemRoot:{marginTop:"8px",justifyContent:"center",color:t.palette.primary.main,lineHeight:"3.2"}}));function so({disabled:t,endpointList:o,teamDid:n,onAdd:r,hiddenChildren:i,open:d,onClose:l}){const{api:u}=ge(),[a,f]=g.useState(!1),[m,x]=g.useState(!0),[v,h]=g.useState(!1),[p,C]=g.useState(""),[R,k]=g.useState(""),{t:y}=Q(),b=Ur(),I=async()=>{f(!0);try{const{decoded:T}=ls(p,o);await u.addUploadEndpoint({input:{teamDid:n,url:T}}),r(T),h(!1),l()}catch(T){const L=`${y("blocklet.publish.endpoint.addFailed")} ${xe(T)}`;k(L)}finally{f(!1)}},P=()=>{C(""),h(!1),l()};return e.jsxs(e.Fragment,{children:[!i&&e.jsxs($t,{button:!0,disabled:t,className:b.addMenuItemRoot,onClick:()=>{h(!0)},children:[e.jsx(pt,{font:!0}),e.jsx(E,{variant:"inherit",children:y("blocklet.publish.endpoint.addEndpoint")})]}),e.jsxs(ut,{title:y("blocklet.publish.endpoint.addEndpoint"),fullWidth:!0,maxWidth:"md",open:d||v,onClose:P,PaperProps:{style:{minHeight:"auto"}},actions:e.jsxs(e.Fragment,{children:[e.jsx(qe,{onClick:T=>{T.stopPropagation(),P()},color:"inherit",children:y("common.cancel")}),e.jsxs(qe,{onClick:T=>{T.stopPropagation(),I()},color:"primary","data-cy":"install-blocklet-next-step",disabled:a||!p||m,variant:"contained",autoFocus:!0,children:[a&&e.jsx(Re,{size:16}),y("common.confirm")]})]}),children:[e.jsx("div",{style:{paddingTop:12,overflowY:"hidden"},children:e.jsx(Hn,{component:"div",children:e.jsx(E,{component:"div",children:e.jsx(ne,{label:y("blocklet.publish.endpoint.addEndpoint"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"add-blocklet-endpoint-url",fullWidth:!0,value:p,onChange:T=>{k(null);let L=!1;T.target.value.trim()||(L=!0),T.target.value.trim()||k(y("blocklet.publish.endpoint.urlEmpty")),C(T.target.value),x(L)},disabled:a,onKeyPress:T=>{T.key==="Enter"&&(T.preventDefault(),T.target.value.trim()?I():k(y("blocklet.publish.endpoint.urlEmpty")))}})})})}),!!R&&e.jsx(dt,{severity:"error",style:{width:"100%"},children:R})]})]})}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 Vr({endpoint:t,teamDid:o,onDelete:n,projectId:r="",children:i}){const{api:d}=ge(),{t:l}=Q(),u=Gn(),a=Se(),[f,m]=g.useState(!1),[x,v]=g.useState(null),h=()=>{m(!1),v(null)},p=async()=>{var b;try{m(!0),await d.deleteUploadEndpoint({input:{teamDid:o,did:t.id,projectId:r}}),await((b=a==null?void 0:a.actions)==null?void 0:b.refreshBlocklet()),n==null||n()}catch(I){W.error(`${l("blocklet.publish.endpoint.deleteFailed")}: ${xe(I)}`)}finally{m(!1),v(null)}},C={keyName:t.url,title:l("blocklet.publish.endpoint.deleteEndpoint"),description:l("blocklet.publish.endpoint.deleteDesc",{name:`<b>${t.url}</b>`,color:u.palette.error.main}),confirmPlaceholder:l("blocklet.publish.endpoint.confirmDesc",{name:t.url}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:p,onCancel:h},R=b=>{t.protected||(b.stopPropagation(),v(C))};function k(){return i?e.jsx(c,{component:"span",onClick:R,children:i}):e.jsx(K,{"data-cy":"endpoint-action-delete",color:"primary",disabled:f,onClick:R,size:"small",children:e.jsx(nt,{sx:{zoom:.95}})})}function y(){return x?e.jsx(Ns,{keyName:x.keyName,title:x.title,description:x.description,confirmPlaceholder:x.confirmPlaceholder,confirm:x.confirm,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel}):null}return{handleDelete:R,DeleteButton:k,DeleteConfirmDialog:y}}function ro({connectedEndpoint:t,onDisconnect:o,onDelete:n,endpoint:r,teamDid:i,projectId:d}){const{handleDelete:l,DeleteConfirmDialog:u}=Vr({endpoint:r,teamDid:i,onDelete:n,projectId:d}),[a,f]=g.useState(null),m=!!a,{t:x}=Q(),[v,h]=g.useState(!1),p=b=>{b.stopPropagation(),window.open(un(`${de(r.url)}`,{allowDomains:null}))},C=b=>{f(b.currentTarget)},R=()=>{f(null)},k=()=>{h(!1),o()},y=[{label:x("blocklet.publish.endpoint.visitEndpoint"),action:p,icon:an},{label:x("common.disconnect"),action:()=>{R(),h(!0)},icon:Ds,hidden:!t}];return e.jsxs(e.Fragment,{children:[e.jsx(K,{ref:a,color:"primary",onClick:C,size:"small",children:e.jsx(hs,{sx:{zoom:.95}})}),e.jsxs(Jn,{anchorEl:a,open:m,onClose:R,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:[y.map(b=>b.hidden?null:e.jsxs(fe,{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.jsxs(fe,{dense:!0,disabled:r.protected,onClick:l,children:[e.jsx(nt,{sx:{color:r.protected?"action":"error.main",marginRight:1}}),e.jsx(c,{color:r.protected?"action":"error.main",children:x("common.delete")})]})]}),v&&e.jsx(ht,{displayError:!0,title:`${x("common.disconnect")} ${r.appName}`,description:x("blocklet.publish.endpoint.disconnectEndpointTip",{url:r.url}),confirm:x("common.confirm"),onConfirm:k,onCancel:()=>h(!1)}),e.jsx(u,{})]})}ro.propTypes={connectedEndpoint:s.object.isRequired,onDisconnect:s.func,onDelete:s.func,endpoint:s.object.isRequired,teamDid:s.string.isRequired,projectId:s.string};ro.defaultProps={projectId:"",onDelete:()=>{},onDisconnect:()=>{}};function rt({developerUrl:t,developerDid:o,sx:n,...r}){return e.jsx(Pt,{sx:{width:24,height:24,...n},src:de(new URL(t).origin,`/.well-known/service/user/avatar/${o}?imageFilter=resize&w=120&h=120`),...r})}rt.propTypes={developerDid:s.string.isRequired,developerUrl:s.string.isRequired,sx:s.object};rt.defaultProps={sx:{}};function lo({endpoint:t,published:o}){const{t:n}=Q(),r=()=>{window.open(un(`${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:r,variant:"contained",color:"success",children:n("common.visitTarget",{name:t.appName})})]})}lo.propTypes={endpoint:s.object.isRequired,published:s.bool.isRequired};lo.defaultProps={};const Fr=Xo(()=>({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"}})),$o=Xn(({className:t,...o})=>e.jsx(je,{...o,classes:{popper:t}}))(({theme:t})=>({[`& .${Yn.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 io({teamDid:t,projectId:o,releaseId:n,endpoint:r,warningList:i,onDelete:d,published:l,onPublish:u,connectedEndpoint:a,onOpenConnectEndpoint:f}){const m=Fr(),{t:x}=Q(),{api:v}=ge(),[h,p]=g.useState(!1),C=ln({messageType:"connect-endpoint-message",onOpen:()=>p(!0),onClose:()=>p(!1)}),R=!!a,k=()=>{C(async(T,L)=>{try{const z=await v.connectToEndpoint({input:{did:t,endpointId:r.id,projectId:o}});if(!(z!=null&&z.url)){W.error("failed to connect to endpoint");return}L(z.url),await f({did:t,projectId:o,endpointId:r.id}),p(!1)}catch(z){const q=xe(z);W.error(q),p(!1)}})},y=async()=>{try{await v.disconnectFromEndpoint({input:{did:t,endpointId:r.id,projectId:o}}),d()}catch(T){W.error(xe(T))}},b=()=>{p(!0),v.publishToEndpoint({input:{did:t,endpointId:r.id,projectId:o,releaseId:n}}).then(()=>{W.success(e.jsx(lo,{endpoint:r,published:!0}),{duration:1e4}),u==null||u(null)}).catch(T=>{W.error(xe(T)),u==null||u(T)}).finally(()=>{p(!1)})};g.useEffect(()=>{R&&p(!1)},[R]);const I=i.length>0,P=e.jsxs(K,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130,height:"100%"},disabled:I,onClick:b,children:[h?e.jsx(Re,{sx:{marginRight:1},size:16}):e.jsx(Is,{sx:{marginRight:1,fontSize:20}}),x("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(E,{component:"span",className:m.title,variant:"subtitle1",children:r.appName})}),e.jsx(E,{className:m.url,component:"span",variant:"inherit",children:`${r.url}`})]}),e.jsxs(c,{className:m.actions,children:[a&&e.jsx($o,{placement:"top",title:e.jsxs(c,{children:[e.jsx(E,{component:"span",variant:"caption",sx:{opacity:.7},children:x("blocklet.publish.developerInfo")}),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:1,mt:1},children:[e.jsx(rt,{developerUrl:r.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(wt,{size:14,copyable:!0,compact:!0,responsive:!1,did:a.developerDid})]})]})]}),children:e.jsx(c,{children:e.jsx(rt,{developerUrl:r.url,developerDid:a.developerDid,sx:{marginRight:1,cursor:"help"}})})}),e.jsxs(tt,{disabled:h,variant:"outlined",sx:{height:38},size:"small",children:[!R&&e.jsxs(K,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},onClick:k,children:[h?e.jsx(Re,{sx:{marginRight:1},size:16}):e.jsx(Ts,{sx:{marginRight:1}}),x("common.connect")]}),R&&l&&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(dn,{sx:{marginRight:1}}),x("common.uploaded")]}),R&&!l&&(I?e.jsx($o,{title:e.jsxs(c,{children:[e.jsx(c,{sx:{color:"error.main",mb:.5},children:x("blocklet.publish.storeRule.warning")}),i.map((T,L)=>e.jsxs(c,{sx:{color:"error.main"},children:[L+1,". ",T]},T))]}),children:e.jsx("div",{children:P})}):P),e.jsx(ro,{projectId:o,endpoint:r,teamDid:t,connectedEndpoint:a,onDisconnect:y,onDelete:d})]})]})]})}io.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};io.defaultProps={published:!1,connectedEndpoint:null,projectId:"",warningList:[],releaseId:"",onDelete:()=>{},onOpenConnectEndpoint:()=>{},onPublish:()=>{}};function co({releaseId:t,blocklet:o,connectedEndpoints:n,projectId:r,publishedEndpointIds:i,onPublish:d,onDelete:l,warning:u,onOpenConnectEndpoint:a}){var R,k;const{actions:{refreshBlocklet:f}}=Se(),{session:m}=Ue(),{t:x}=Q(),v=(((R=o==null?void 0:o.settings)==null?void 0:R.endpointList)||[]).filter(y=>{var b;return y.scope===((b=m==null?void 0:m.user)==null?void 0:b.did)}),h=g.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((y,b)=>(y[b.endpointId]=b,y),{}):{},[n]),p=(k=o==null?void 0:o.meta)==null?void 0:k.did,C={};return Object.entries((u==null?void 0:u.logoErrors)||{}).forEach(([y,b])=>{const I=Object.values(b);I.length>0&&(C[y]=I)}),Object.entries((u==null?void 0:u.screenshotErrors)||{}).forEach(([y,b])=>{const I=Object.values(b);I.length>0&&(C[y]=C[y]?[...C[y],...I]:I)}),e.jsxs(e.Fragment,{children:[!!(v!=null&&v.length)&&e.jsx(dt,{severity:"info",style:{width:"100%"},children:e.jsx(c,{color:Ho[400],children:x("blocklet.publish.endpoint.uploadToEndpoint")})}),e.jsx(Go,{sx:{flex:1},children:v==null?void 0:v.map(y=>e.jsx($t,{"data-cy":"endpoint-switch",children:e.jsx(Jo,{children:e.jsx(io,{releaseId:t,projectId:r,teamDid:p,warningList:C[y.url],endpoint:y,published:(i==null?void 0:i.indexOf(y.id))>-1,connectedEndpoint:h[y.id],onPublish:d,onDelete:l,onOpenConnectEndpoint:a})})},y.url))}),e.jsx(so,{teamDid:p,endpointList:v,onAdd:f})]})}co.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)};co.defaultProps={publishedEndpointIds:[],onPublish:()=>{},onDelete:()=>{},warning:{},onOpenConnectEndpoint:()=>{}};function Sn({did:t,params:o,setParams:n,projectId:r,open:i,onClose:d}){const{t:l}=Q(),[u,a]=g.useState(!1),{api:f}=ge(),[m,x]=g.useState(!1),[v,h]=g.useState(!1),p=()=>{x(o.autoUpload),h(o.possibleSameStore),a(!1),d(!1)},C=async()=>{a(!0);try{await f.updateProject({input:{did:t,projectId:r,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!m,possibleSameStore:!!v}}),n({autoUpload:m,possibleSameStore:v}),d(!1)}catch(k){W.error(k.message)}a(!1)};g.useEffect(()=>{x(o.autoUpload),h(o.possibleSameStore)},[o]);const R=!!(r&&r!==Y.UNOWNED_DID);return e.jsx(ut,{title:l("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:i,onClose:p,actions:e.jsxs(e.Fragment,{children:[e.jsx(K,{onClick:k=>{k.stopPropagation(),d()},color:"inherit",children:l("common.cancel")}),R&&e.jsxs(K,{onClick:k=>{k.stopPropagation(),C()},color:"primary","data-cy":"install-blocklet-next-step",disabled:u,variant:"contained",autoFocus:!0,children:[u&&e.jsx(Re,{size:16}),l("common.confirm")]})]}),children:R?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:l("blocklet.publish.autoUploadTip")}),e.jsx($e,{checked:m,onChange:(k,y)=>x(y)})]}),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:l("blocklet.publish.possibleSameStoreTip")}),e.jsx($e,{checked:v,onChange:(k,y)=>h(y)})]})]}):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:l("blocklet.publish.needProjectId")})]})})}Sn.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 Dn({downloadUrl:t,installUrl:o,handleSetTip:n,isPack:r,disabled:i}){const{t:d}=Q(),[l,u]=g.useState(!1),a=g.useRef(null),f=()=>{u(!l)},m=x=>{a.current&&a.current.contains(x.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(Oo,{sx:{zIndex:10},open:l,anchorEl:a.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:x})=>e.jsx(Bo,{...x,style:{transformOrigin:"center top"},children:e.jsx(_t,{children:e.jsx(Wo,{onClickAway:m,children:e.jsxs(Mo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[r&&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")})]})})]})})})})})]})}Dn.propTypes={disabled:s.bool.isRequired,isPack:s.bool.isRequired,downloadUrl:s.string.isRequired,installUrl:s.string.isRequired,handleSetTip:s.func.isRequired};var Ao;const qo=(Ao=window.env)==null?void 0:Ao.serverEndpoint;function In({projectId:t,params:o,setParamsErrTip:n,initUrl:r,setParams:i,mode:d,loading:l,blocklet:u,release:a,isPublished:f,releaseId:m,getData:x,getRelease:v,paramsErrTip:h,warning:p,componentDid:C,resourceRelateComponents:R,disabledSelectComponents:k,saveSelectedEventsRef:y,hasSelectedResources:b,initLogoUrl:I,setLoading:P,releaseUsedLast:T,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"}],[w,j]=g.useState(U[0].value),{api:D}=ge(),M=Tt(),[O,G]=g.useState(!1),[S,A]=g.useState(!1),[H,J]=g.useState(),Ie=We(se=>se.breakpoints.down("md")),$=g.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(B=>B.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),V=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:C},"*"),v()},X=async se=>{var Ae,Fe,ze,Qe;if(h!=null&&h.blockletHomepage||h!=null&&h.blockletSupport||h!=null&&h.blockletCommunity){W.error((h==null?void 0:h.blockletHomepage)||(h==null?void 0:h.blockletSupport)||(h==null?void 0:h.blockletCommunity));return}const Le=wn({params:o,hasSelectedResources:b,projectId:t,status:se,t:q});if(Le){W.error(Le.map(F=>F.message).join("; ")),n(Le.reduce((F,re)=>({...F,[re.param]:re.message}),{}));return}const B={...o};if(B.blockletComponents=zr(B.blockletComponents,u,R,k),B.blockletVersion=Be.valid(B.blockletVersion),!B.blockletVersion){W.error("Invalid Blocklet Version"),n({blockletVersion:"Invalid Blocklet Version"});return}if(I)try{const F=await Wr({did:u.meta.did,projectId:t,imageUrl:I});B.blockletLogo=F,i({blockletLogo:F})}catch(F){W.error(F.message);return}if(o.resourceFromSelect){B.uploadedResource="";try{const F=Object.keys(y.current);await st(F.map(re=>()=>{const He=y.current[re];return kr({api:D,locale:Z,projectId:t,releaseId:T?"":m,appDid:u.meta.did,component:He.component,resources:He.resources,initUrl:r})}),{concurrency:2})}catch(F){W.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||(B.blockletComponents=[]);B.blockletTitle=(B.blockletTitle||"").trim(),B.blockletDescription=(B.blockletDescription||"").trim(),B.blockletSupport=(B.blockletSupport||"").trim(),B.blockletHomepage=(B.blockletHomepage||"").trim(),B.blockletCommunity=(B.blockletCommunity||"").trim(),B.blockletRepository=(B.blockletRepository||"").trim(),B.blockletIntroduction=(B.blockletIntroduction||"").trim(),B.note=(B.note||"").trim(),B.blockletComponents=((B==null?void 0:B.blockletComponents)||[]).filter(F=>F.included).map(F=>Nt(F,["did","required"])).map(JSON.stringify),B.contentType!=="docker"&&(B.blockletDocker={dockerImage:"",dockerCommand:"",dockerArgs:[],dockerEnvs:[]}),B.blockletDocker.dockerImage=B.blockletDocker.dockerImage||"",B.blockletDocker.dockerArgs.length>0&&B.blockletDocker.dockerArgs.forEach(F=>{F.proxyBehavior=F.proxyBehavior||"service"});try{await D.createRelease({input:{...B,note:JSON.stringify({note:B.note}),did:u.meta.did,projectId:t,releaseId:T?"":m,status:se}}),se==="draft"?W.success(q("blocklet.publish.saveDraftSuccess")):(L(!1),W.success(q("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:C},"*")),n({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(F){const re=xe(F);W.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:$}});W.success(e.jsx(Ps,{storeName:F.storeName,storeUrl:F.storeUrl,developerDid:F.developerDid,did:u.meta.did,published:re.url==="published"}),{duration:1e4})}catch(re){W.error(xe(re))}}),{concurrency:4}),V==null||V(),M(`../${t}/view/${Ne}`,{replace:!0})},te=se=>(P(!0),X(se).finally(()=>{P(!1)})),oe=async se=>{await Tr(D,se),x()},ie=async se=>{await Pr(D,se),x()},ee=()=>{A(!0)},ue=de(qo,`/api/project/${u.meta.did}/${t}/${m}/release/blocklet.json`),pe=new URL(qo);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(Hr,{className:"sticky-header",children:e.jsx(Lt,{left:e.jsxs(zo,{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(Ce,{maxLength:Ie?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):e.jsx(ke,{to:`../${t}`,children:e.jsx(Ce,{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:l,variant:"contained",children:[e.jsxs(K,{variant:"contained",onClick:()=>te(he.PROJECT.RELEASE_STATUS.published),children:[l&&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(sn,{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:l,variant:"contained",children:[e.jsxs(K,{onClick:()=>G(!0),children:[l?e.jsx(Re,{size:14,sx:{mr:1},color:"inherit"}):e.jsx(Cn,{sx:{fontSize:"1.3em",mr:1}}),q(Ie?"common.upload":"blocklet.publish.connectOrUpload")]}),e.jsx(Dn,{isPack:$==="pack",downloadUrl:de(`${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(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(tn,{tabs:U,current:w,onChange:j})}),w==="store"&&e.jsx(no,{projectType:z,blocklet:u,releaseType:$,projectId:t,releaseId:m,componentDid:C,warning:p,onPublish:V,onOpenConnectStore:oe,onDelete:x,connectedStores:o.connectedStores||[],publishedStoreIds:a==null?void 0:a.publishedStoreIds}),w==="endpoint"&&e.jsx(ve,{minHeight:400,children:e.jsx(co,{blocklet:u,releaseType:$,projectId:t,releaseId:m,warning:p,publishedEndpointIds:[],connectedEndpoints:o.connectedEndpoints||[],onPublish:V,onOpenConnectEndpoint:ie,onDelete:x})})]})}),e.jsx(Sn,{did:(Ee=u==null?void 0:u.meta)==null?void 0:Ee.did,params:o,projectId:t,open:S,setParams:i,onClose:()=>A(!1)})]})}In.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 Hr=ye.div`
|
|
163
|
-
.sticky-header {
|
|
164
|
-
margin-top: -12px;
|
|
165
|
-
padding: 12px 0;
|
|
166
|
-
position: sticky;
|
|
167
|
-
top: 0;
|
|
168
|
-
z-index: 99;
|
|
169
|
-
display: flex;
|
|
170
|
-
align-items: center;
|
|
171
|
-
justify-content: space-between;
|
|
172
|
-
background-color: #fff;
|
|
173
|
-
padding-bottom: 12px;
|
|
174
|
-
border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
|
|
175
|
-
}
|
|
176
|
-
`;function Tn({text:t}){return t?e.jsx(As,{wrapperElement:{"data-color-mode":"light"},source:bs.sanitize(t),rehypePlugins:[[zs,{target:"_blank"}]]}):e.jsx(Me,{Icon:zt})}Tn.propTypes={text:s.string.isRequired};function Pn({params:t,setParams:o,paramsErrTip:n,loading:r,setParamsErrTip:i,readOnly:d}){var m;const{t:l}=Q(),[u,a]=g.useState(d?"preview":"write"),f=(x,v)=>{a(v)};return e.jsxs(c,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(E,{variant:"h6",fontWeight:"bold",sx:{},children:l("common.introduction")}),e.jsxs(Yo,{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:r||d,sx:{border:"none"},placeholder:`Blocklet ${l("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," / ",he.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:x=>{i({blockletIntroduction:""}),o({blockletIntroduction:x.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(Tn,{text:t.blockletIntroduction||""})})]})}Pn.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 ao={},Gr=we;Object.defineProperty(ao,"__esModule",{value:!0});var It=ao.default=void 0,Jr=Gr(De()),Eo=e;It=ao.default=(0,Jr.default)([(0,Eo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Eo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function uo({step:t,ok:o,active:n,error:r,warning:i}){let d="grey.500",l=t+1;return o&&(l=e.jsx(dn,{sx:{fontSize:18,margin:0},color:"white"})),r||!o&&n>t?(d="error.main",l=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):i?(d="warning.main",l=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:l})}uo.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};uo.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function _n({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:r,params:i,loading:d,paramsErrTip:l,warning:u,viewMode:a,projectId:f}){const{t:m}=Q(),x=()=>{n(C=>C+1)},v=()=>{n(C=>C-1)},h=C=>C===0?(l==null?void 0:l.blockletTitle)||(l==null?void 0:l.projectId)||(l==null?void 0:l.blockletDescription)||(l==null?void 0:l.blockletHomepage)||(l==null?void 0:l.blockletSupport)||(l==null?void 0:l.blockletCommunity)||(l==null?void 0:l.blockletRepository):C===2?(l==null?void 0:l.blockletResource)||(l==null?void 0:l.blockletDocker)||(l==null?void 0:l.dockerImageName):C>=4?(l==null?void 0:l.blockletVersion)||(l==null?void 0:l.note):"",p=a||wn({hasSelectedResources:r,params:i,projectId:f,t:m})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[e.jsx(Qn,{activeStep:o,orientation:"vertical",children:t.map((C,R)=>{const k={},y=d||!Mr({hasSelectedResources:r,params:i,projectId:f,step:R,t:m}),b=d?"":h(R);return b&&(k.optional=e.jsx(E,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:b}),k.error=!0),e.jsxs(Zn,{children:[e.jsx(Kn,{icon:e.jsx(uo,{error:b,warning:R===0?u.hasWarning:!1,active:p?99:o,step:R,ok:y}),sx:{cursor:"pointer",color:b?"error.main":"inherit"},disabled:!1,onClick:()=>n(R),...k,children:e.jsx(E,{fontSize:"14px",fontWeight:"500",color:b||!y&&o>R?"error.main":"inherit",children:C.label})}),e.jsxs(es,{children:[e.jsx(E,{fontSize:12,children:C.description}),!p&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[R<t.length-1&&e.jsx(K,{variant:"contained",onClick:x,sx:{mt:1,mr:1},disabled:b||!y,children:m("common.continue")}),R>0&&e.jsx(K,{disabled:R===0,onClick:v,sx:{mt:1,mr:1},children:m("common.back")})]})})]})]},C.label)})}),o>=t.length-1&&e.jsx(_t,{square:!0,elevation:0,sx:{p:3},children:e.jsx(E,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}_n.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.string.isRequired,loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.bool.isRequired,warning:s.object.isRequired,paramsErrTip:s.shape({projectId:s.string,blockletVersion:s.string,blockletTitle:s.string,blockletDescription:s.string,note:s.string,blockletResource:s.string,blockletHomepage:s.string,blockletSupport:s.string,blockletCommunity:s.string,blockletRepository:s.string,blockletDocker:s.object,dockerImageName:s.string}).isRequired};const Xr=[".zip",".gz"],Yr=1024*1024*100,Qr=g.lazy(()=>on(()=>import("./index-C3f1mXja.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function po({app:t,projectId:o,readOnly:n,params:r,setParams:i,setParamsErrTip:d,error:l}){const{t:u,locale:a}=Q(),f=g.useRef(null),m=()=>n?!1:!o||o===Y.UNOWNED_DID?(W.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,x=`${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:[!!r.uploadedResource&&e.jsx(E,{component:"a",href:`${x}/params.uploadedResource`,children:r.uploadedResource}),!n&&e.jsx(K,{variant:"outlined",size:"small",onClick:()=>{var v;m()&&((v=f.current)==null||v.open())},children:r.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(g.Suspense,{fallback:e.jsx(Xe,{}),children:e.jsx(Qr,{ref:f,locale:a,popup:!0,onUploadFinish:v=>{var h;i({uploadedResource:v.data.filename}),d({blockletResource:""}),(h=f.current)==null||h.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:x,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Xr,maxFileSize:Yr,maxNumberOfFiles:1}}},"uploader-resource")}),!!l&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:l})]})}po.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};po.defaultProps={};function lt({readOnly:t,params:o,setParams:n,paramsErrTip:r,setParamsErrTip:i,loading:d}){var u;const{t:l}=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 ${l("common.version")}`,placeholder:`Blocklet ${l("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:!!r.blockletVersion,helperText:r.blockletVersion||""}),e.jsx(ne,{label:l("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:!!r.note,helperText:r.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 $n(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&$n(t[o]);return t}function it({index:t,item:o,dockerParams:n,setDockerParams:r,dataKey:i,t:d,readOnly:l}){const u=(o==null?void 0:o.value)||"",[a,f]=g.useState(!1),m=()=>{var U;(U=n[i])==null||U.splice(t,1),r({...n,[i]:[...n[i]]})},x=(U,w)=>{var j;(j=n[i])!=null&&j[t]&&(w?(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="")),r({...n,[i]:[...n[i]]})},v=(U,w)=>{var D;const j=((D=n[i][t])==null?void 0:D.value)||"";n[i][t]={...n[i][t],secure:w,value:w&&j===he.BLOCKLET_AUTOMATIC_ENV_VALUE?"":j},r({...n,[i]:[...n[i]]})},h=(U,w)=>{n[i][t]={...n[i][t],shared:w},r({...n,[i]:[...n[i]]})},p=(U,w)=>{var D;const j=((D=n[i][t])==null?void 0:D.value)||"";n[i][t]={...n[i][t],required:w,value:w&&j===he.BLOCKLET_AUTOMATIC_ENV_VALUE?"":j},r({...n,[i]:[...n[i]]})},C=(U,w)=>{n[i][t]={...n[i][t],value:w?he.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},r({...n,[i]:[...n[i]]})},R=U=>{n[i][t]={...n[i][t],description:U.target.value},r({...n,[i]:[...n[i]]})},k=U=>{const w=U.target.value==="web"?"web":"docker";w==="web"&&n.dockerArgs.forEach(M=>{M.type="docker"});const D=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:w,path:w==="docker"?D:"/",protocol:"http",prefix:w==="docker"?D:"/",name:"publicUrl",port:"BLOCKLET_PORT"},r({...n,dockerArgs:[...n.dockerArgs]})},y=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},r({...n,dockerArgs:[...n.dockerArgs]})},b=U=>{const w=U.target.value;n[i][t]={...n[i][t],prefix:w,path:w==="*"?"/":w},r({...n,[i]:[...n[i]]})},I=U=>{var w;(w=n[i])!=null&&w[t]&&(n[i][t].value=U.target.value),r({...n,[i]:[...n[i]]})},P=u===`$${yt(o.key)}`||o.custom,T=i==="dockerArgs"&&!cn[o.key],L=_s[o.key],z=i==="dockerEnvs",q=o.key==="--publish";let Z=o.key;return q&&o.type==="web"?Z="--publish (Web)":z&&(Z=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(E,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:Z})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(ne,{disabled:l||P||T||o.value===he.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:P?`$${yt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Je,{position:"end",sx:{zoom:.9},children:[(!(L||T)||z||q)&&e.jsx(ce,{onClick:()=>f(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!l&&e.jsx(ce,{onClick:m,color:T?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})},error:T,onChange:I}),T&&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"&&$s[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||T||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:l,checked:P,onChange:x,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:l,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:l,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:l,checked:o.secure,onChange:v,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:l,checked:o.value===he.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:C,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:l,value:o.description,onChange:R,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),q&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.portType")}),e.jsxs(Ct,{value:o.type||"docker",onChange:k,children:[e.jsx(fe,{value:"docker",children:"Docker"}),e.jsx(fe,{value:"web",children:"Web"})]})]}),q&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(Ct,{value:o.proxyBehavior||"service",onChange:y,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:l,value:o.prefix,onChange:b,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}it.propTypes={dockerParams:s.object.isRequired,setDockerParams:s.func.isRequired,dataKey:s.string.isRequired,item:s.object.isRequired,t:s.func.isRequired,readOnly:s.bool.isRequired,index:s.number.isRequired};it.defaultProps={};const Zr=`
|
|
177
|
-
docker run --name postgrest
|
|
178
|
-
-p 3000:3000
|
|
179
|
-
-e PGRST_DB_URI="postgres://username:password@host:port/database"
|
|
180
|
-
-e PGRST_DB_SCHEMA="public"
|
|
181
|
-
-e PGRST_DB_ANON_ROLE="anon"
|
|
182
|
-
postgrest/postgrest
|
|
183
|
-
`.trim();function ho({readOnly:t,paramsErrTip:o,setParamsErrTip:n,error:r,params:i,setParams:d}){const{t:l}=Q(),[u,a]=g.useState("dockerParams"),[f,m]=g.useState(""),[x,v]=g.useState(!1),[h,p]=g.useState("--volume"),[C,R]=g.useState(""),[k,y]=g.useState(wo(f)),b=k.dockerArgs||[],I=k.dockerEnvs||[],P=k.dockerImage||"",T=k.dockerCommand||"",L=j=>{const{value:D}=j.target;m(D)};g.useEffect(()=>{i.blockletDocker&&i.blockletDocker.dockerImage&&!P&&y(i.blockletDocker)},[i,P,y]);const z=j=>{const D=wo(j.target.value);y(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(v(!1),h==="--env"){y({...k,dockerEnvs:[...I,{key:C,value:"",custom:"",secure:!1,shared:!1,required:!1,description:C}]}),R("");return}y({...k,dockerArgs:[...b,{key:h,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},Z=()=>{v(!1),R("")},U=j=>{const{value:D}=j.target;y({...k,dockerImage:D}),D.indexOf(" ")>-1?n({...o,dockerImageName:l("blocklet.publish.docker.dockerImageNameError")}):n({...o,dockerImageName:""})},w=j=>{const{value:D}=j.target;y({...k,dockerCommand:D});try{Es(D),n({...o,dockerCMD:""})}catch{n({...o,dockerCMD:l("blocklet.publish.docker.dockerCMDError")})}};return g.useEffect(()=>{u==="dockerCommand"&&m(qs(k))},[k,u]),g.useEffect(()=>{d(j=>({...j,blockletDocker:{dockerImage:k.dockerImage,dockerCommand:k.dockerCommand,dockerArgs:k.dockerArgs,dockerEnvs:k.dockerEnvs}}))},[k,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(Yo,{value:u,onChange:(j,D)=>a(D),children:[e.jsx(ot,{value:"dockerParams",label:l("blocklet.publish.docker.dockerParams")}),e.jsx(ot,{value:"dockerCommand",label:l("blocklet.publish.docker.dockerCommand")})]})}),u==="dockerCommand"&&e.jsx(ne,{disabled:t,label:l("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:Zr,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:l("blocklet.publish.docker.dockerImageName"),placeholder:"Example: docker.io/postgrest/postgrest:latest",value:P,sx:{flex:1},color:o.dockerImageName?"error":"primary",error:!!o.dockerImageName,helperText:o.dockerImageName||"",onChange:U}),e.jsx(ne,{disabled:t,label:`Docker CMD (${l("common.optional")})`,placeholder:"Docker CMD",value:T,sx:{flex:1},color:o.dockerCMD?"error":"primary",error:!!o.dockerCMD,helperText:o.dockerCMD||"",onChange:w}),e.jsx(c,{sx:{height:4}}),b.map((j,D)=>e.jsx(it,{index:D,item:j,dockerParams:k,setDockerParams:y,dataKey:"dockerArgs",t:l,readOnly:t},`${j.key}-${D}`)),I.map((j,D)=>e.jsx(it,{index:D,item:j,dockerParams:k,setDockerParams:y,dataKey:"dockerEnvs",t:l,readOnly:t},`${j.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:()=>v(!0),children:l("blocklet.publish.docker.addItem")})]})]})]}),!!r&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:r}),x&&e.jsxs(at,{fullWidth:!0,open:!0,children:[e.jsx(Uo,{children:l("blocklet.publish.docker.addItem")}),e.jsx(Vo,{children:e.jsxs(ts,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[e.jsx(Ct,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:h,sx:{width:"100%"},onChange:j=>p(j.target.value),children:Object.keys(cn).map(j=>e.jsx(fe,{value:j,children:j}))}),h==="--publish"&&e.jsx(E,{variant:"caption",color:"text.secondary",children:l("blocklet.publish.docker.publishTips")}),h==="--volume"&&e.jsx(E,{variant:"caption",color:"text.secondary",children:l("blocklet.publish.docker.volumeTips")}),h==="--env"&&e.jsxs(c,{sx:{mt:3,width:"100%"},children:[e.jsx(ne,{value:C,onChange:j=>R(j.target.value),sx:{width:"100%"},label:l("blocklet.publish.docker.envKey")}),e.jsx(os,{children:l("blocklet.publish.docker.dockerArgValue")})]})]})}),e.jsxs(Fo,{children:[e.jsx(K,{onClick:Z,children:l("common.cancel")}),e.jsx(K,{onClick:q,children:l("common.confirm")})]})]})]})}ho.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};ho.defaultProps={};const Kr=({tabs:t,blocklet:o,ancestors:n=[]})=>{const r=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})})]},r),value:r})},Lo=(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(r=>({...r,included:!0})):n.blockletComponents=(o.children||[]).map(r=>({did:r.meta.did,included:!1,required:!1})),n},el={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},No={branding:0,introduction:1,resources:2,blocklets:3,version:4};function fo({initUrl:t,...o}){var mo,bo;const{projectId:n,mode:r,releaseId:i,componentDid:d=""}=ct(),{t:l}=Q(),{blocklet:u}=Se(),[a,f]=_e({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}}),[m,x]=_e({}),[v,h]=_e({}),[p,C]=g.useState(!1),[R,k]=_e(null),{api:y}=ge(),b=We(_=>_.breakpoints.down("md")),[I,P]=g.useState({}),[T,L]=g.useState(!1),z=g.useRef({}),[q,Z]=_e({}),[U,w]=g.useState(""),[j,D]=_e({}),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:(mo=G==null?void 0:G.user)==null?void 0:mo.did}),[A,H]=g.useState([]);g.useEffect(()=>{Array.isArray(S)&&S.length>0&&Promise.all(S.map(async _=>({...(await(await fetch(`${_.url}/__blocklet__.js?type=json`)).json()).preferences,storeInfo:_}))).then(_=>{H(_)})},[S.length]),g.useEffect(()=>{const _={},N={},{logoUrl:me,screenshotUrls:Te}=yn(a,u,n);Promise.all(A.map(async be=>{const{maxImageCount:Oe,minImageCount:mt,logoImageType:Pe,imageMinHeight:xo,imageMinWidth:go}=be,Ze=Array.isArray(Pe)?Pe:Pe.split(",");_[be.storeInfo.url]||(_[be.storeInfo.url]={}),N[be.storeInfo.url]||(N[be.storeInfo.url]={});const bt=N[be.storeInfo.url],Ln=_[be.storeInfo.url];Number(Oe)<=Te.length&&(bt.maxImageCount=l("blocklet.publish.storeRule.maxImageCount",{max:Oe,count:Te.length,unit:Oe>1?l("blocklet.publish.storeRule.screenshots"):l("blocklet.publish.storeRule.screenshot")})),Number(be.minImageCount)>Te.length&&(bt.minImageCount=l("blocklet.publish.storeRule.minImageCount",{min:mt,count:Te.length,unit:mt>1?l("blocklet.publish.storeRule.screenshots"):l("blocklet.publish.storeRule.screenshot")}));const jo=me?me.split(".").pop():"";jo&&!(Ze.includes("jpg")?[...Ze,"jpeg"]:Ze).includes(jo)&&(Ln.logoFormat=l("blocklet.publish.storeRule.logoFormat",{format:Ze.join(",")})),await Promise.all(Te.map((Nn,xt)=>{const gt=new Image;return gt.src=Nn,new Promise(An=>{gt.onload=()=>{const{width:zn,height:On}=gt;if(zn<Number(go)||On<Number(xo)){let Ge="";switch(xt+1){case 1:Ge=l("blocklet.publish.storeRule.first");break;case 2:Ge=l("blocklet.publish.storeRule.second");break;case 3:Ge=l("blocklet.publish.storeRule.third");break;default:Ge=`${xt+1}`;break}bt[`imageSize-${xt+1}`]=l("blocklet.publish.storeRule.minImageSize",{width:go,height:xo,name:Ge})}An()}})}))})).then(()=>{const be=Object.values(_).some(Pe=>Object.values(Pe).length>0),Oe=Object.values(N).some(Pe=>Object.values(Pe).length>0);h({logoErrors:_,screenshotErrors:N,storeList:S,hasWarning:be||Oe,hasLogoWarning:be,hasScreenshotWarning:Oe})})},[a,u.did,n,A,l]);const J=g.useMemo(()=>{const _={};return Object.keys(j).forEach(N=>{const me=j[N];me&&me.forEach(Te=>{_[Te]=!0})}),_},[j]),Ie=g.useCallback(_=>{O&&f({blockletComponents:[]}),D(_)},[O,D,f]),$=g.useCallback((..._)=>{Z(..._),x({blockletResource:"",blockletDocker:""})},[]),V=i==="none"?(a==null?void 0:a.lastReleaseId)||"":i,[X,te]=g.useState(r==="new-release"?4:0),oe=t==null?void 0:t.searchParams.get("resourcesTitle"),ie=t==null?void 0:t.searchParams.get("componentsTitle"),ee=[{label:l("blocklet.publish.branding"),description:l("blocklet.publish.steps.branding")},{label:l("common.introduction"),description:l("blocklet.publish.steps.introduction")},{label:oe||l("blocklet.publish.resourceTitle"),description:l("blocklet.publish.steps.resources")},{label:ie||l("common.components"),description:l("blocklet.publish.steps.blocklets")},{label:l("blocklet.publish.versionTitle"),description:l("blocklet.publish.steps.version")}],ue=ee[X]||ee[ee.length-1],pe=el[X];g.useEffect(()=>{n&&x({projectId:""})},[n,x]);const Ye=g.useMemo(()=>{var _;return(a==null?void 0:a.blockletResourceType)==="resource"?"resource":(_=a==null?void 0:a.blockletComponents)!=null&&_.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(_=>{var N;return(N=_.meta.resource)==null?void 0:N.exportApi}).filter(_=>!d||_.meta.did===d);Ee.forEach(_=>{Kr({tabs:Ve,blocklet:_,t:l,ancestors:[u]})});const[se,Le]=g.useState((bo=Ve[0])==null?void 0:bo.value),B=!T&&(R==null?void 0:R.status)==="published",le=B,Ne=ys(()=>{if(!t)return;w(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 _=t.searchParams.get("resources");try{const N=JSON.parse(_);P(N)}catch{}}),Ae=async()=>{if(V)try{const _=await y.getRelease({input:{did:u.meta.did,projectId:n,releaseId:V}});if(C(!1),!_.release){W.error("Release not found");return}_.release.note=bn(_.release.note,"note"),_.release=$n(_.release),r!=="view"&&(_.release.note=""),f(N=>Lo({...N,..._.release,blockletVersion:r==="create"||r==="new-release"?Be.inc(_.release.blockletVersion,"patch"):_.release.blockletVersion},u)),k(_.release)}catch(_){C(!1),W.error(xe(_))}},Fe=async()=>{if(n===Y.UNOWNED_DID){f({blockletVersion:"0.0.1",blockletTitle:""});return}if(!n){W.error(l("blocklet.publish.errorTip.noDid"));return}try{const N=(await gn(y.getProject,[{input:{did:u.meta.did,projectId:n}}],{key:"getProject"})).project||{};N.blockletVersion?(r==="create"||r==="new-release")&&Be.valid(N.blockletVersion)&&(N.blockletVersion=Be.inc(N.blockletVersion,"patch")):N.blockletVersion="0.0.1";const me=Lo(N,u);f(me),N.lastReleaseId||Ne()}catch(_){W.error(xe(_))}},ze=g.useCallback(async()=>{C(!0);try{if(r==="view"){if(!V){W.error("Empty release id");return}await Fe(),await Ae();return}await Fe(),V&&(L(!0),await Ae())}finally{C(!1)}},[r,V]),Qe=_=>{f({blockletComponents:_})},F=_=>{f({blockletResourceType:_})};g.useEffect(()=>{ze()},[ze]),g.useEffect(()=>{n===Y.UNOWNED_DID&&(r==="create"||r==="new-release")&&t&&Ne()},[n,t,r,Ne]),g.useEffect(()=>{a.contentType==="docker"?f({resourceFromSelect:!1}):a.contentType==="blocklet"?f({resourceFromSelect:!0}):a.contentType==="upload"&&f({resourceFromSelect:!1})},[a.contentType,f]);const re=g.useMemo(()=>!!Object.keys(q).find(_=>!!q[_].length),[q]);if(!a&&p)return e.jsx(Xe,{});if(!a)return null;const He=Ee.find(_=>_.meta.did===se),En=_=>{Le(_)};return e.jsxs(tl,{...o,children:[e.jsx(In,{blocklet:u,release:R,getData:ze,getRelease:Ae,mode:r,params:a,setParams:f,setParamsErrTip:x,warning:v,readOnly:le,isPublished:B,loading:p,setLoading:C,initLogoUrl:U,releaseId:V,projectId:n,projectType:Ye,resourceComponents:Ee,resourceComponentsMap:j,resourceRelateComponents:J,resourceItem:He,saveSelectedEventsRef:z,hasSelectedResources:re,releaseUsedLast:T,setReleaseUsedLast:L,setRelease:k,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:b?"column":"row",children:[!b&&e.jsx(_n,{steps:ee,loading:p,viewMode:r==="view",params:a,hasSelectedResources:re||a.uploadedResource,paramsErrTip:m,warning:v,activeStep:X,setActiveStep:te,projectId:n,resourcesUrlTitle:oe,componentsUrlTitle:ie}),e.jsxs(c,{flex:"1",maxWidth:"720px",children:[!b&&pe!=="introduction"&&e.jsxs(E,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[ue.label,pe==="branding"&&e.jsx(je,{title:l("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(ks,{})})})]}),(b||pe==="branding")&&e.jsx(c,{flexDirection:"column",children:e.jsx(Rn,{projectId:n,setParams:f,setParamsErrTip:x,warning:v,params:a,componentDid:d,blocklet:u,initUrl:t,loading:p,setLoading:C,paramsErrTip:m,readOnly:le,initLogoUrl:U,setInitLogoUrl:w})}),b&&e.jsx(c,{flexDirection:"column",children:e.jsx(lt,{loading:p,params:a,paramsErrTip:m,setParams:f,setParamsErrTip:x,readOnly:le})}),(b||pe==="introduction")&&e.jsx(c,{display:"flex",flexDirection:"column",sx:{mt:b?5:0,width:"100%"},children:e.jsx(Pn,{loading:p,readOnly:le,params:a,setParams:f,paramsErrTip:m,setParamsErrTip:x})}),b&&e.jsx(E,{variant:"h6",fontWeight:"bold",mt:5,children:ee[No.resources].label}),e.jsx(c,{sx:{maxWidth:720},display:b||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(ns,{onChange:_=>f({contentType:_.target.value}),children:[e.jsx(et,{value:"blocklet",disabled:le,control:e.jsx(kt,{size:"small",checked:a.contentType==="blocklet"}),label:l("blocklet.publish.resourceSelect")}),e.jsx(et,{value:"upload",disabled:le,control:e.jsx(kt,{size:"small",checked:a.contentType==="upload"}),label:l("blocklet.publish.resourceUpload")}),e.jsx(et,{value:"docker",disabled:le,control:e.jsx(kt,{size:"small",checked:a.contentType==="docker"}),label:l("blocklet.publish.resourceDocker")})]}),e.jsxs(c,{display:a.contentType==="blocklet"?"block":"none",children:[!d&&e.jsx(tn,{tabs:Ve,current:se,onChange:En,sx:{ml:-2,mt:2,maxWidth:b?window.innerWidth-24:"100%"}}),e.jsx(Qt,{loading:p,initialResources:I,saveSelectedEventsRef:z,selectedResourceIds:q,setSelectedResourceIds:$,setResourceComponentsMap:Ie,error:m.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:T,release:{...R,id:V}})]}),a.contentType==="upload"&&e.jsx(po,{app:u,readOnly:le,projectId:n===Y.UNOWNED_DID?"":n,params:a,error:m.blockletResource,setParams:f,setParamsErrTip:x}),a.contentType==="docker"&&e.jsx(ho,{app:u,readOnly:le,projectId:n===Y.UNOWNED_DID?"":n,params:a,error:m.blockletResource,setParams:f,setParamsErrTip:x,paramsErrTip:m})]})})}),b&&e.jsx(E,{variant:"h6",fontWeight:"bold",mt:5,children:ee[No.blocklets].label}),(b||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})})})}),!b&&pe==="version"&&e.jsx(c,{flexDirection:"column",children:e.jsx(lt,{loading:p,params:a,paramsErrTip:m,setParams:f,setParamsErrTip:x,readOnly:le})})]})]})]})]})}fo.propTypes={initUrl:s.object};fo.defaultProps={initUrl:null};const tl=ye.div`
|
|
184
|
-
.section {
|
|
185
|
-
&.full-width {
|
|
186
|
-
max-width: 100%;
|
|
187
|
-
}
|
|
188
|
-
.MuiTypography-h3 {
|
|
189
|
-
font-size: 1.1rem;
|
|
190
|
-
font-weight: 700;
|
|
191
|
-
}
|
|
192
|
-
.left {
|
|
193
|
-
flex-shrink: 0;
|
|
194
|
-
width: 140px;
|
|
195
|
-
}
|
|
196
|
-
.MuiTabs-indicator {
|
|
197
|
-
display: none;
|
|
198
|
-
}
|
|
199
|
-
.MuiTypography-subtitle1 {
|
|
200
|
-
width: 120px;
|
|
201
|
-
font-weight: 700;
|
|
202
|
-
font-size: 1rem;
|
|
203
|
-
${({theme:t})=>t.breakpoints.down("sm")} {
|
|
204
|
-
width: 80px;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
.MuiButtonBase-root {
|
|
209
|
-
a {
|
|
210
|
-
color: inherit;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
.MuiInputBase-multiline .MuiInputAdornment-positionEnd {
|
|
214
|
-
align-self: flex-end;
|
|
215
|
-
.MuiTypography-root {
|
|
216
|
-
font-size: 0.8rem;
|
|
217
|
-
}
|
|
218
|
-
font-size: 0.8rem;
|
|
219
|
-
}
|
|
220
|
-
`;function qn({padding:t,initUrl:o}){const{blocklet:n}=Se(),r=Wn(),{componentDid:i}=ct();if(g.useEffect(()=>{if(i&&window.parent){const l=`${r.pathname}${r.search}`;window.parent.postMessage({event:"popstate",page:"publish",componentDid:i,path:l},"*")}},[i,r]),!n)return null;const d={};return t&&(d.padding=t),e.jsx(ol,{style:d,children:e.jsxs(Mn,{children:[e.jsx(jt,{path:"/",element:e.jsx(Ut,{initUrl:o})}),e.jsx(jt,{path:"/:projectId",element:e.jsx(Qs,{})}),e.jsx(jt,{path:"/:projectId/:mode/:releaseId",element:e.jsx(fo,{initUrl:o})})]})})}qn.propTypes={padding:s.oneOfType([s.string,s.number]),initUrl:s.object};qn.defaultProps={padding:"",initUrl:null};const ol=ye(c)`
|
|
221
|
-
a {
|
|
222
|
-
color: ${({theme:t})=>t.palette.primary.main};
|
|
223
|
-
}
|
|
224
|
-
`;export{qn as default};
|